Merge branch 'master' of ssh://git.giugl.io/peperunas/nixos

This commit is contained in:
Giulio De Pasquale 2024-07-16 23:49:33 +01:00
commit f571e82c28
2 changed files with 193 additions and 62 deletions

View File

@ -19,8 +19,8 @@ let
max_input_tokens: 128000 max_input_tokens: 128000
max_output_tokens: 8192 max_output_tokens: 8192
- name: codestral:22b-v0.1-q6_K - name: pino-coder
max_input_tokens: 32000 max_input_tokens: 28000
max_output_tokens: 8192 max_output_tokens: 8192
- type: openai - type: openai
@ -28,81 +28,206 @@ let
api_base: https://api.openai.com/v1 api_base: https://api.openai.com/v1
''; '';
roles = '' roles = ''
- name: commitmessage - name: commitmessage
prompt: |- prompt: |-
The task is to generate a commit message for a given git diff. The commit message should follow the Commit Convention, which typically includes a type, scope, and a brief description. The types can be `feat` (for new features), `fix` (for bug fixes), `docs` (for documentation changes), `style` (for code formatting changes), `refactor` (for code restructuring), `test` (for adding or updating tests), `chore` (for maintenance tasks), and `perf` (for performance improvements). Your task is to generate a commit message for a given git diff. The commit message should follow the Conventional Commits specification, which includes a type, optional scope, and a brief description. The message should be concise, unambiguous, and capture the technical details of the changes made.
**Commit Convention Format:** Commit Convention Format:
``` <type>(<scope>): <description>
<type>(<scope>): <description>
- <bullet points details> [optional body]
```
The description should be concise, unambiguos yet capture the technical details of the changes made. The output should exclusively be the commit message. [optional footer(s)]
### INPUT: Common types include:
- feat: A new feature
- fix: A bug fix
- docs: Documentation changes
- style: Code style/formatting changes (not affecting code logic)
- refactor: Code changes that neither fix a bug nor add a feature
- test: Adding or modifying tests
- chore: Changes to build process or auxiliary tools
- perf: Performance improvements
``` Here are some examples of well-formatted commit messages:
diff --git a/src/app.js b/src/app.js
index 83d2e7a..b6a1c3f 100644 ### INPUT :
--- a/src/app.js
+++ b/src/app.js diff --git a/src/utils/date-formatter.js b/src/utils/date-formatter.js
@@ -10,6 +10,10 @@ function initialize() { index 2345678..3456789 100644
setupEventListeners(); --- a/src/utils/date-formatter.js
+++ b/src/utils/date-formatter.js
@@ -5,7 +5,7 @@ export function formatDate(date) {
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
- return `$${year}-$${month}-$${day}`;
+ return `$${year}/$${month}/$${day}`;
}
### OUTPUT:
fix(date-formatter): modified `formatDate()` to use '/' instead of '-' as the separator
### INPUT:
diff --git a/src/app.js b/src/app.js
index 83d2e7a..b6a1c3f 100644
--- a/src/app.js
+++ b/src/app.js
@@ -10,6 +10,10 @@ function initialize() {
setupEventListeners();
}
+// TODO: add other listeners
+// https://github.com/user/project/issue/123
+function setupEventListeners() {
+ document.getElementById('submit').addEventListener('click', handleSubmit);
+ document.getElementById('reset').addEventListener('click', handleReset);
+}
+
function handleSubmit(event) {
event.preventDefault();
const data = new FormData(event.target);
@@ -20,6 +24,10 @@ function handleSubmit(event) {
console.log('Form submitted:', data);
}
+function handleReset(event) {
+ event.preventDefault();
+ event.target.form.reset();
+ console.log('Form reset');
}
### OUTPUT:
feat(app): implement form event listeners
- Added `setupEventListeners()` to handle form interactions
- Implemented `handleReset()` for form reset functionality
- Added event listeners for submit and reset buttons
- Track TODO comment for future listener additions (https://github.com/user/project/issue/123)
### INPUT:
diff --git a/pkg/database/client.go b/pkg/database/client.go
index 003740f..6fc4861 100644
--- a/pkg/database/client.go
+++ b/pkg/database/client.go
@@ -24,9 +24,12 @@ var ErrNilDatabaseClient = errors.New("database client is nil after setup")
// InitDB initializes the database with the given application name and optional dbpath for SQLite.
func InitDB(appName string, dbpath ...string) error {
- cfg := config.New()
+ var (
+ psqlReadReplica string
+ err error
+ )
- var err error
+ cfg := config.New()
// Set up a new logger with your required configuration.
newLogger := logger.New(
@@ -38,9 +41,8 @@ func InitDB(appName string, dbpath ...string) error {
},
)
- // Load PostgreSQL configurations
- var psqlReadReplica string
psqlSource, err := cfg.Load(config.PSQL.String())
+
if err != nil {
log.Println("PSQL not set, using SQLite instead.")
} else {
### OUTPUT:
style(database/client): group together `psqlReadReplica` and `err` in function's prologue
### INPUT:
diff --git a/pkg/khttp/client.go b/pkg/khttp/client.go
index a53064c..3aff938 100644
--- a/pkg/khttp/client.go
+++ b/pkg/khttp/client.go
@@ -11,14 +11,17 @@ import (
"github.pie.apple.com/kerosene/Core/structs"
)
+// TODO: https://github.pie.apple.com/Kerosene/Core/issues/43
+// feat: Centralise and remove over use of os.Environment
const (
- // Environment variables and file names.
authFilesDirEnvVar = "WHISPER_AUTH_FILES_DIR"
keyName = "decrypted_key.pem"
certName = "cert.pem"
)
// Error for missing environment variable.
+// TODO: refactor: move errors into centralized errors.go files
+// https://github.pie.apple.com/Kerosene/Core/issues/57
var errMissingEnvironmentVariable = fmt.Errorf("%s environment variable is not set", authFilesDirEnvVar)
// AuthConfig holds authentication file paths.
@@ -31,9 +34,11 @@ type AuthConfig struct {
// NewAuthConfig creates an AuthConfig from environment variables.
func NewAuthConfig() (*AuthConfig, error) {
dir := os.Getenv(authFilesDirEnvVar)
+
if dir == "" {
return nil, errMissingEnvironmentVariable
} }
+
return &AuthConfig{
Dir: dir,
CertFile: filepath.Join(dir, certName),
@@ -211,7 +216,7 @@ func setupMTLSOnlyTransport(certData string, keyData string) (*http.Transport, e
// Make scheme and Auth Type separate and load from DB.
func parseProxyURL(scheme string, routing structs.Routing) (*url.URL, error) {
- return url.Parse(fmt.Sprintf("%s://%s:%s", scheme, routing.Proxy, routing.Port))
+ return url.Parse(fmt.Sprintf("%s://%s:%d", scheme, routing.Proxy, routing.Port))
}
// loadX509KeyPair loads an X509 key pair from the specified cert and key files.
+// TODO: add other listeners ### OUTPUT:
+// https://github.com/user/project/issue/123
+function setupEventListeners() {
+ document.getElementById('submit').addEventListener('click', handleSubmit);
+ document.getElementById('reset').addEventListener('click', handleReset);
+}
+
function handleSubmit(event) {
event.preventDefault();
const data = new FormData(event.target);
@@ -20,6 +24,10 @@ function handleSubmit(event) {
console.log('Form submitted:', data); fix/refactor(khttp/client): use correct format specifier for and add TODOs
}
+function handleReset(event) { - Parsed proxy URL using `fmt.Sprintf()` with correct format specifier for port
+ event.preventDefault(); - Added TODOs to centralize errors and remove overuse of `os.Environment` (#43, #57)
+ event.target.form.reset();
+ console.log('Form reset');
}
```
### OUTPUT:
```
feat(app): add event listeners for submit and reset buttons
- Added `setupEventListeners` function to handle submit and reset button click events - name: createpr
- Implemented `handleReset` function to reset the form and log the action prompt: |-
- Added TODO comment for issue #123 Create a concise and informative PR message for a given code diff using the Conventional Commits format.
``` Include all significant changes, such as new environment variables, refactored functions, and added or removed TODOs.
Mention specific issue numbers for better trackability.
- name: createpr:diff:messages ### OUTPUT:
prompt: |-
You are an AI language model tasked with generating a comprehensive Pull Request (PR) description. Your goal is to create a clear and informative PR description that summarizes the changes and highlights any important details or considerations.
You are given a git diff and a list of commits - use this context to generate the PR message.
# Requirements for the PR Description: feat(config): add new env vars and refactor database initialization
1. **Title:** Provide a concise and descriptive title for the PR.
2. **Summary:** Summarize the overall purpose and scope of the changes.
3. **Details of Changes:** Describe the key changes made, referencing specific files or functions if necessary.
4. **Impact:** Discuss any potential impact on the system, including backward compatibility, performance implications, and any new dependencies.
### Input: Git diff This PR introduces new environment variables and improves our database initialization and migration process:
__ARG1__ - Add new environment variables:
1. `RUN_AUTOMIGRATION`: to control auto-migration
2. `DEFAULT_DATA_CONFIG_DIR`: to specify the data configuration directory
- Implement conditional auto-migration support based on `RUN_AUTOMIGRATION` or function parameters
- Refactor database client initialization for better error handling and flexibility
- Streamline the migration process in the main application and various commands
### Input: Commit messages Key changes:
1. Introduce `RUN_AUTOMIGRATION` and `DEFAULT_DATA_CONFIG_DIR` environment variables
__ARG2__ 2. Add `applyMigrations` flag in database initialization
3. Implement `GetDataConfigDir()` method to handle default and overridden config directories
4. Refactor `InitDB()` to accept `automigrate` parameter
5. Update `cmd/api/main.go`, `cmd/fixtures/fixtures.go`, and `pkg/advans/connect.go` to use new initialization process
6. Simplify `cmd/migrator/migrator.go` to leverage the new auto-migration feature
7. Improve error handling and logging throughout the affected files
''; '';
in in
{ {

View File

@ -36,6 +36,8 @@ in
golangci-lint-langserver golangci-lint-langserver
py3 py3
ruff ruff
gh
gofumpt
] ++ nodePkgs; ] ++ nodePkgs;
sessionVariables = { sessionVariables = {
@ -51,7 +53,7 @@ in
cursorline = true cursorline = true
true-color = true true-color = true
gutters = ["diff", "diagnostics", "line-numbers", "spacer"] gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
[editor.cursor-shape] [editor.cursor-shape]
insert = "bar" insert = "bar"
normal = "block" normal = "block"
@ -77,6 +79,10 @@ in
ruff = {enabled = true} ruff = {enabled = true}
rope = {enabled = true} rope = {enabled = true}
[[language]]
name = "bash"
formatter = { command = "shfmt", args = ["-s", "-ci", "-sr"] }
[[language]] [[language]]
name = "go" name = "go"
language-servers = ["gopls", "golangci-lint-langserver"] language-servers = ["gopls", "golangci-lint-langserver"]