code-agent-auto-commit 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/cli.js +6 -0
- package/dist/core/ai.js +11 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -89,6 +89,7 @@ Usage:
|
|
|
89
89
|
cac status [--scope project|global] [--worktree <path>] [--config <path>]
|
|
90
90
|
cac run [--tool opencode|codex|claude|manual] [--worktree <path>] [--config <path>] [--event-json <json>] [--event-stdin]
|
|
91
91
|
cac set-worktree <path> [--config <path>]
|
|
92
|
+
cac version
|
|
92
93
|
`);
|
|
93
94
|
}
|
|
94
95
|
async function commandInit(flags) {
|
|
@@ -248,6 +249,11 @@ async function main() {
|
|
|
248
249
|
printHelp();
|
|
249
250
|
return;
|
|
250
251
|
}
|
|
252
|
+
if (command === "version" || command === "--version" || command === "-v") {
|
|
253
|
+
const pkg = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(__dirname, "..", "package.json"), "utf-8"));
|
|
254
|
+
console.log(pkg.version);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
251
257
|
if (command === "init") {
|
|
252
258
|
await commandInit(parsed.flags);
|
|
253
259
|
return;
|
package/dist/core/ai.js
CHANGED
|
@@ -92,15 +92,21 @@ function splitModelRef(modelRef, defaultProvider) {
|
|
|
92
92
|
}
|
|
93
93
|
function buildUserPrompt(summary, maxLength) {
|
|
94
94
|
return [
|
|
95
|
-
`Generate a
|
|
96
|
-
"
|
|
95
|
+
`Generate a concise commit message (<= ${maxLength} chars) in Conventional Commits format: "<type>(<scope>): <description>".`,
|
|
96
|
+
"Rules:",
|
|
97
|
+
"- type: feat | fix | refactor | docs | style | test | chore | perf | ci | build",
|
|
98
|
+
"- scope: optional, the module or file area affected (e.g. cli, ai, config)",
|
|
99
|
+
"- description: imperative mood, lowercase, no period, explain WHAT and WHY briefly",
|
|
100
|
+
"- Do NOT just say 'update <filename>' — describe the actual change",
|
|
101
|
+
"- Output exactly one line, no quotes, no code block",
|
|
102
|
+
"",
|
|
97
103
|
"Changed files:",
|
|
98
104
|
summary.nameStatus || "(none)",
|
|
99
105
|
"Diff stat:",
|
|
100
106
|
summary.diffStat || "(none)",
|
|
101
107
|
"Patch excerpt:",
|
|
102
108
|
summary.patch || "(none)",
|
|
103
|
-
].join("\n
|
|
109
|
+
].join("\n");
|
|
104
110
|
}
|
|
105
111
|
async function generateOpenAiStyleMessage(provider, model, summary, maxLength, signal) {
|
|
106
112
|
const apiKey = getApiKey(provider);
|
|
@@ -120,7 +126,7 @@ async function generateOpenAiStyleMessage(provider, model, summary, maxLength, s
|
|
|
120
126
|
messages: [
|
|
121
127
|
{
|
|
122
128
|
role: "system",
|
|
123
|
-
content: "You generate exactly one commit message
|
|
129
|
+
content: "You generate exactly one conventional commit message. Format: '<type>(<scope>): <description>'. Scope is optional. Allowed types: feat, fix, refactor, docs, style, test, chore, perf, ci, build. Description must be imperative, lowercase, no period. Describe the actual change, not just 'update <file>'. No quotes. No code block.",
|
|
124
130
|
},
|
|
125
131
|
{
|
|
126
132
|
role: "user",
|
|
@@ -154,7 +160,7 @@ async function generateAnthropicStyleMessage(provider, model, summary, maxLength
|
|
|
154
160
|
model,
|
|
155
161
|
max_tokens: 120,
|
|
156
162
|
temperature: 0.2,
|
|
157
|
-
system: "Generate exactly one commit message
|
|
163
|
+
system: "Generate exactly one conventional commit message. Format: '<type>(<scope>): <description>'. Scope is optional. Allowed types: feat, fix, refactor, docs, style, test, chore, perf, ci, build. Description must be imperative, lowercase, no period. Describe the actual change, not just 'update <file>'. No quotes. No code block.",
|
|
158
164
|
messages: [
|
|
159
165
|
{
|
|
160
166
|
role: "user",
|
package/package.json
CHANGED