Skip to content

Commit 98e0062

Browse files
committed
feat(config): add config file with backend, model, ollama url, temperature, retry temperatures, default language, default scope, and default type
1 parent 5e37b83 commit 98e0062

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/config.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ export function saveConfig(config: Config): void {
114114
mkdirSync(dir, { recursive: true });
115115
}
116116

117-
const content = `# git-commit-ai configuration
118-
# Backend: ollama, openai, anthropic, groq
117+
let content = `# git-commit-ai configuration
118+
# Backend: ollama, llamacpp, openai, anthropic, groq
119119
backend = "${config.backend}"
120120
model = "${config.model}"
121121
ollama_url = "${config.ollama_url}"
@@ -126,6 +126,20 @@ temperature = ${config.temperature}
126126
retry_temperatures = [${config.retry_temperatures.join(", ")}]
127127
`;
128128

129+
// Add optional fields if set
130+
if (config.default_language) {
131+
content += `default_language = "${config.default_language}"\n`;
132+
}
133+
if (config.default_scope) {
134+
content += `default_scope = "${config.default_scope}"\n`;
135+
}
136+
if (config.default_type) {
137+
content += `default_type = "${config.default_type}"\n`;
138+
}
139+
if (config.ignore_patterns && config.ignore_patterns.length > 0) {
140+
content += `ignore_patterns = [${config.ignore_patterns.map(p => `"${p}"`).join(", ")}]\n`;
141+
}
142+
129143
writeFileSync(configPath, content, "utf-8");
130144
}
131145

0 commit comments

Comments
 (0)