@quikcommit/cli 13.0.0 → 13.1.0
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/dist/index.js +62 -48
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12009,72 +12009,86 @@ async function runCommit(args) {
|
|
|
12009
12009
|
const modelDisplay = model ?? "default";
|
|
12010
12010
|
const uiCtx = buildUIContext(ui2, config2, args);
|
|
12011
12011
|
const boxStyle = args.boxStyleOverride ?? config2.ui?.box?.style ?? "gradient";
|
|
12012
|
+
const t0 = Date.now();
|
|
12013
|
+
let generatedMessage;
|
|
12014
|
+
let diagnostics;
|
|
12015
|
+
async function generateViaChunks() {
|
|
12016
|
+
const chunks = splitDiffIntoChunks(processedDiff);
|
|
12017
|
+
if (chunks.length === 0) {
|
|
12018
|
+
log.error("No parseable diff content to analyze.");
|
|
12019
|
+
process.exit(1);
|
|
12020
|
+
}
|
|
12021
|
+
if (!silent) log.step(`large diff \u2014 analyzing ${chunks.length} chunk(s) in parallel...`);
|
|
12022
|
+
const results = await Promise.allSettled(
|
|
12023
|
+
chunks.map(
|
|
12024
|
+
(chunk) => client.summarizeChunk(chunk.diff, chunk.files.filter(Boolean).join("\n") || "unknown", model)
|
|
12025
|
+
)
|
|
12026
|
+
);
|
|
12027
|
+
const summaries = [];
|
|
12028
|
+
for (const r of results) {
|
|
12029
|
+
if (r.status === "fulfilled" && r.value) {
|
|
12030
|
+
summaries.push(r.value);
|
|
12031
|
+
}
|
|
12032
|
+
}
|
|
12033
|
+
if (summaries.length === 0) {
|
|
12034
|
+
log.error("All chunk summaries failed. Check your connection and try again.");
|
|
12035
|
+
process.exit(1);
|
|
12036
|
+
}
|
|
12037
|
+
if (results.some((r) => r.status === "rejected") && !silent) {
|
|
12038
|
+
const failed = results.filter((r) => r.status === "rejected").length;
|
|
12039
|
+
log.step(`${failed}/${results.length} chunk(s) failed \u2014 continuing with partial summaries`);
|
|
12040
|
+
}
|
|
12041
|
+
const combinedSummary = summaries.join("\n\n");
|
|
12042
|
+
const finalSpinner = createStageSpinner({
|
|
12043
|
+
stage: "aiGenerate",
|
|
12044
|
+
message: `generating commit from ${chunks.length} summaries (${modelDisplay})...`,
|
|
12045
|
+
...uiCtx
|
|
12046
|
+
});
|
|
12047
|
+
if (!silent) finalSpinner.start();
|
|
12048
|
+
try {
|
|
12049
|
+
const result = await client.generateCommit(
|
|
12050
|
+
combinedSummary,
|
|
12051
|
+
changes,
|
|
12052
|
+
rules,
|
|
12053
|
+
model,
|
|
12054
|
+
recentCommits,
|
|
12055
|
+
generationHints
|
|
12056
|
+
);
|
|
12057
|
+
return result;
|
|
12058
|
+
} finally {
|
|
12059
|
+
finalSpinner.stop();
|
|
12060
|
+
}
|
|
12061
|
+
}
|
|
12012
12062
|
const spinner = createStageSpinner({
|
|
12013
12063
|
stage: "aiGenerate",
|
|
12014
12064
|
message: needsChunking ? `analyzing ${changes.trim().split("\n").length} files in chunks (${modelDisplay})...` : `generating commit (${modelDisplay})...`,
|
|
12015
12065
|
...uiCtx
|
|
12016
12066
|
});
|
|
12017
12067
|
if (!silent) spinner.start();
|
|
12018
|
-
const t0 = Date.now();
|
|
12019
|
-
let generatedMessage;
|
|
12020
|
-
let diagnostics;
|
|
12021
12068
|
try {
|
|
12022
12069
|
if (needsChunking) {
|
|
12023
|
-
const chunks = splitDiffIntoChunks(processedDiff);
|
|
12024
|
-
if (chunks.length === 0) {
|
|
12025
|
-
spinner.stop();
|
|
12026
|
-
log.error("No parseable diff content to analyze.");
|
|
12027
|
-
process.exit(1);
|
|
12028
|
-
}
|
|
12029
12070
|
spinner.stop();
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
chunks.map(
|
|
12033
|
-
(chunk) => client.summarizeChunk(chunk.diff, chunk.files.filter(Boolean).join("\n") || "unknown", model)
|
|
12034
|
-
)
|
|
12035
|
-
);
|
|
12036
|
-
const summaries = [];
|
|
12037
|
-
for (const r of results) {
|
|
12038
|
-
if (r.status === "fulfilled" && r.value) {
|
|
12039
|
-
summaries.push(r.value);
|
|
12040
|
-
}
|
|
12041
|
-
}
|
|
12042
|
-
if (summaries.length === 0) {
|
|
12043
|
-
log.error("All chunk summaries failed. Check your connection and try again.");
|
|
12044
|
-
process.exit(1);
|
|
12045
|
-
}
|
|
12046
|
-
if (results.some((r) => r.status === "rejected") && !silent) {
|
|
12047
|
-
const failed = results.filter((r) => r.status === "rejected").length;
|
|
12048
|
-
log.step(`${failed}/${results.length} chunk(s) failed \u2014 continuing with partial summaries`);
|
|
12049
|
-
}
|
|
12050
|
-
const combinedSummary = summaries.join("\n\n");
|
|
12051
|
-
const finalSpinner = createStageSpinner({
|
|
12052
|
-
stage: "aiGenerate",
|
|
12053
|
-
message: `generating commit from ${chunks.length} summaries (${modelDisplay})...`,
|
|
12054
|
-
...uiCtx
|
|
12055
|
-
});
|
|
12056
|
-
if (!silent) finalSpinner.start();
|
|
12071
|
+
({ message: generatedMessage, diagnostics } = await generateViaChunks());
|
|
12072
|
+
} else {
|
|
12057
12073
|
try {
|
|
12058
12074
|
({ message: generatedMessage, diagnostics } = await client.generateCommit(
|
|
12059
|
-
|
|
12075
|
+
processedDiff,
|
|
12060
12076
|
changes,
|
|
12061
12077
|
rules,
|
|
12062
12078
|
model,
|
|
12063
12079
|
recentCommits,
|
|
12064
12080
|
generationHints
|
|
12065
12081
|
));
|
|
12066
|
-
}
|
|
12067
|
-
|
|
12082
|
+
} catch (err) {
|
|
12083
|
+
const is413 = err instanceof Error && /too large/i.test(err.message);
|
|
12084
|
+
if (is413) {
|
|
12085
|
+
spinner.stop();
|
|
12086
|
+
if (!silent) log.step("diff too large for single request \u2014 switching to chunk mode...");
|
|
12087
|
+
({ message: generatedMessage, diagnostics } = await generateViaChunks());
|
|
12088
|
+
} else {
|
|
12089
|
+
throw err;
|
|
12090
|
+
}
|
|
12068
12091
|
}
|
|
12069
|
-
} else {
|
|
12070
|
-
({ message: generatedMessage, diagnostics } = await client.generateCommit(
|
|
12071
|
-
processedDiff,
|
|
12072
|
-
changes,
|
|
12073
|
-
rules,
|
|
12074
|
-
model,
|
|
12075
|
-
recentCommits,
|
|
12076
|
-
generationHints
|
|
12077
|
-
));
|
|
12078
12092
|
}
|
|
12079
12093
|
} finally {
|
|
12080
12094
|
spinner.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quikcommit/cli",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "AI-powered conventional commit messages",
|
|
5
5
|
"bin": {
|
|
6
6
|
"qc": "./dist/index.js"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"esbuild": "^0.28.0",
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
36
|
"vitest": "^4.1.5",
|
|
37
|
-
"@quikcommit/shared": "10.
|
|
37
|
+
"@quikcommit/shared": "10.1.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "node build.mjs",
|