@hifullmoon/aicommit 2.6.11 → 2.6.12
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/CHANGELOG.md +9 -1
- package/docs/distribution.md +1 -1
- package/package.json +1 -1
- package/src/api.js +10 -4
- package/src/change-analysis.js +33 -6
- package/src/policy.js +4 -1
- package/src/split.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ This file lists notable user-facing changes. Internal refactors, test-only chang
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.6.12] - 2026-11-21
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Single-commit diff capture now uses `maxDiffChars` instead of `splitMaxDiffChars`, strips lockfile and `stripFiles` bodies before size checks, and lets `condenseDiff` handle oversized individual files instead of prematurely falling back to local large-change sampling.
|
|
12
|
+
- Automatic policy-correction retries now include the target language constraint, use a lower deterministic temperature, and disable follow-up reasoning when supported by the provider.
|
|
13
|
+
|
|
7
14
|
## [2.6.11] - 2026-11-19
|
|
8
15
|
|
|
9
16
|
### Added
|
|
@@ -314,7 +321,8 @@ This file lists notable user-facing changes. Internal refactors, test-only chang
|
|
|
314
321
|
- Added file-level split planning and execution with Git-state concurrency checks.
|
|
315
322
|
- Added provider presets and user/project configuration boundaries.
|
|
316
323
|
|
|
317
|
-
[Unreleased]: https://github.com/hi-fullmoon/AICommit/compare/v2.6.
|
|
324
|
+
[Unreleased]: https://github.com/hi-fullmoon/AICommit/compare/v2.6.12...HEAD
|
|
325
|
+
[2.6.12]: https://github.com/hi-fullmoon/AICommit/tree/v2.6.12
|
|
318
326
|
[2.6.11]: https://github.com/hi-fullmoon/AICommit/tree/v2.6.11
|
|
319
327
|
[2.6.10]: https://github.com/hi-fullmoon/AICommit/tree/v2.6.10
|
|
320
328
|
[2.6.9]: https://github.com/hi-fullmoon/AICommit/tree/v2.6.9
|
package/docs/distribution.md
CHANGED
|
@@ -33,7 +33,7 @@ The release workflow uses npm Trusted Publishing without a long-lived `NPM_TOKEN
|
|
|
33
33
|
```bash
|
|
34
34
|
workdir=$(mktemp -d)
|
|
35
35
|
cd "$workdir"
|
|
36
|
-
npm install --package-lock-only @hifullmoon/aicommit@2.6.
|
|
36
|
+
npm install --package-lock-only @hifullmoon/aicommit@2.6.12
|
|
37
37
|
npm audit signatures
|
|
38
38
|
```
|
|
39
39
|
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -158,7 +158,7 @@ function extractFromReasoning(reasoning, policy) {
|
|
|
158
158
|
// reasoning trace and no content.
|
|
159
159
|
function followupCommitPrompt(policy) {
|
|
160
160
|
return (
|
|
161
|
-
|
|
161
|
+
`Based on your analysis above, output ONLY the final commitPolicy v${policy.version} message. ` +
|
|
162
162
|
`Use one of these types: ${policy.types.join(', ')}. ` +
|
|
163
163
|
'Do not include any other text, explanation, or code fences.'
|
|
164
164
|
);
|
|
@@ -408,8 +408,14 @@ export async function generateCommitMessage(
|
|
|
408
408
|
let validation = await validate(message);
|
|
409
409
|
if (message.trim() && validation.needsCorrection) {
|
|
410
410
|
corrections = 1;
|
|
411
|
+
const correctionReasoning = await reasoningForFollowUp(config);
|
|
412
|
+
const correctionTokenLimit =
|
|
413
|
+
correctionReasoning?.mode === 'on'
|
|
414
|
+
? Math.max(maxTokens, correctionReasoning.maxTokens || 4096)
|
|
415
|
+
: maxTokens;
|
|
416
|
+
const correctionTemperature = Math.min(config.temperature ?? 0.3, 0.2);
|
|
411
417
|
const retry = await getResponseText(
|
|
412
|
-
config,
|
|
418
|
+
{ ...config, reasoning: correctionReasoning },
|
|
413
419
|
[
|
|
414
420
|
messages[0],
|
|
415
421
|
{
|
|
@@ -417,8 +423,8 @@ export async function generateCommitMessage(
|
|
|
417
423
|
content: buildPolicyCorrectionPrompt(message, validation.errors, policy),
|
|
418
424
|
},
|
|
419
425
|
],
|
|
420
|
-
|
|
421
|
-
|
|
426
|
+
correctionTemperature,
|
|
427
|
+
correctionTokenLimit,
|
|
422
428
|
followupCommitPrompt(policy),
|
|
423
429
|
stream,
|
|
424
430
|
).catch((error) => {
|
package/src/change-analysis.js
CHANGED
|
@@ -39,7 +39,7 @@ function gitQuote(path) {
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function captureChanges(commands, cwd, files, config) {
|
|
42
|
+
export function captureChanges(commands, cwd, files, config, { split = false } = {}) {
|
|
43
43
|
const source = spoolGit(
|
|
44
44
|
commands.map((args) => [
|
|
45
45
|
'-c',
|
|
@@ -72,6 +72,18 @@ export function captureChanges(commands, cwd, files, config) {
|
|
|
72
72
|
byHeader.set(`diff --git ${gitQuote(`a/${newPath}`)} ${gitQuote(`b/${newPath}`)}`, file);
|
|
73
73
|
byHeader.set(`diff --git ${gitQuote(`a/${oldPath}`)} ${gitQuote(`b/${oldPath}`)}`, file);
|
|
74
74
|
}
|
|
75
|
+
const diffLimit = split ? config.splitMaxDiffChars || 16000 : config.maxDiffChars || 30000;
|
|
76
|
+
let diffChunks = [];
|
|
77
|
+
let diffChars = 0;
|
|
78
|
+
const appendDiff = (chunk) => {
|
|
79
|
+
if (!diffChunks) return;
|
|
80
|
+
diffChars += chunk.length;
|
|
81
|
+
if (diffChars > diffLimit) {
|
|
82
|
+
diffChunks = null;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
diffChunks.push(chunk);
|
|
86
|
+
};
|
|
75
87
|
const findings = new Set();
|
|
76
88
|
const sections = [];
|
|
77
89
|
let current;
|
|
@@ -82,9 +94,23 @@ export function captureChanges(commands, cwd, files, config) {
|
|
|
82
94
|
const file = byHeader.get(header);
|
|
83
95
|
if (!file)
|
|
84
96
|
throw new Error('Git diff contains a path outside the captured change manifest.');
|
|
85
|
-
|
|
97
|
+
const paths = file.addPaths || [file.path];
|
|
98
|
+
const lock = paths.some(isLockFile);
|
|
99
|
+
const stripped = !lock && paths.some((p) => matchStripPattern(p, config.stripFiles));
|
|
100
|
+
current = {
|
|
101
|
+
file,
|
|
102
|
+
header,
|
|
103
|
+
ordinal: ordinal++,
|
|
104
|
+
privateKey: false,
|
|
105
|
+
omittedInDiff: lock || stripped,
|
|
106
|
+
};
|
|
86
107
|
sections.push(current);
|
|
87
108
|
file.sections.push(current.ordinal);
|
|
109
|
+
if (lock) appendDiff(`${header}\n(lock file — content omitted)\n`);
|
|
110
|
+
else if (stripped) appendDiff(`${header}\n(generated file — content omitted)\n`);
|
|
111
|
+
else appendDiff(line);
|
|
112
|
+
} else if (current && !current.omittedInDiff) {
|
|
113
|
+
appendDiff(line);
|
|
88
114
|
}
|
|
89
115
|
if (!current) continue;
|
|
90
116
|
const file = current.file;
|
|
@@ -109,7 +135,7 @@ export function captureChanges(commands, cwd, files, config) {
|
|
|
109
135
|
source,
|
|
110
136
|
manifest,
|
|
111
137
|
findings: [...findings],
|
|
112
|
-
diff:
|
|
138
|
+
diff: diffChunks ? diffChunks.join('').trim() : null,
|
|
113
139
|
stats: {
|
|
114
140
|
files: files.length,
|
|
115
141
|
additions: manifest.reduce((n, f) => n + f.additions, 0),
|
|
@@ -964,8 +990,9 @@ export function needsAnalysis(capture, config, split = false) {
|
|
|
964
990
|
if (split && capture.manifest.length > (config.splitMaxPlanFiles || 100)) return true;
|
|
965
991
|
return (
|
|
966
992
|
estimateTokens(capture.diff) > (config.largeChange?.chunkInputTokens || 12000) * 0.6 ||
|
|
967
|
-
|
|
968
|
-
.
|
|
969
|
-
|
|
993
|
+
(split &&
|
|
994
|
+
capture.diff
|
|
995
|
+
.split(/(?=^diff --git )/m)
|
|
996
|
+
.some((section) => section.length > (config.maxFileDiffChars || 3000)))
|
|
970
997
|
);
|
|
971
998
|
}
|
package/src/policy.js
CHANGED
|
@@ -473,8 +473,10 @@ export function validateCommitCandidate(message, { policy, diff = '' } = {}) {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
export function buildPolicyCorrectionPrompt(badReply, errors, policy) {
|
|
476
|
+
const targetLanguage =
|
|
477
|
+
(policy.effectiveLanguage || policy.language) === 'zh' ? 'Simplified Chinese' : 'English';
|
|
476
478
|
return [
|
|
477
|
-
|
|
479
|
+
`Your previous reply violates commitPolicy v${policy.version}:`,
|
|
478
480
|
...errors.map((item) => `- ${item.message}`),
|
|
479
481
|
'',
|
|
480
482
|
'Previous reply (untrusted text):',
|
|
@@ -490,6 +492,7 @@ export function buildPolicyCorrectionPrompt(badReply, errors, policy) {
|
|
|
490
492
|
: []),
|
|
491
493
|
`Body rule: ${policy.body.mode}, maximum ${policy.body.maxLines} non-empty lines`,
|
|
492
494
|
`Breaking-change rule: ${policy.breakingChange}`,
|
|
495
|
+
`Language: ${targetLanguage}`,
|
|
493
496
|
'Rewrite it once. Output only the complete corrected commit message; do not include explanations or fences.',
|
|
494
497
|
].join('\n');
|
|
495
498
|
}
|
package/src/split.js
CHANGED
|
@@ -1687,7 +1687,7 @@ export async function splitFlow(
|
|
|
1687
1687
|
['diff', u, '--cached'],
|
|
1688
1688
|
['diff', u],
|
|
1689
1689
|
];
|
|
1690
|
-
const captured = captureChanges(commands, projectRoot, allFiles, config);
|
|
1690
|
+
const captured = captureChanges(commands, projectRoot, allFiles, config, { split: true });
|
|
1691
1691
|
const diff = captured.diff || '';
|
|
1692
1692
|
const untrackedSnapshot =
|
|
1693
1693
|
scope === 'all'
|