@kud/ai-conventional-commit-cli 0.8.2 → 0.9.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 +12 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -196,14 +196,18 @@ var buildGenerationMessages = (opts) => {
|
|
|
196
196
|
);
|
|
197
197
|
specLines.push("Primary Output Field: commits[ ].title");
|
|
198
198
|
specLines.push("Title Format: <type>(<optional-scope>): <subject>");
|
|
199
|
-
specLines.push(
|
|
199
|
+
specLines.push(
|
|
200
|
+
"Title Length Guidance: Aim for <=50 chars ideal; absolute max 72 (do not exceed)."
|
|
201
|
+
);
|
|
200
202
|
specLines.push("Types (JSON mapping follows on next line)");
|
|
201
203
|
specLines.push("TypeMap: " + JSON.stringify(TYPE_MAP));
|
|
202
204
|
specLines.push("Scope Rules: optional; if present, lowercase kebab-case; omit when unclear.");
|
|
203
205
|
specLines.push(
|
|
204
206
|
"Subject Rules: imperative mood, present tense, no leading capital unless proper noun, no trailing period."
|
|
205
207
|
);
|
|
206
|
-
specLines.push(
|
|
208
|
+
specLines.push(
|
|
209
|
+
"Length Rule: Keep titles concise; prefer 50 or fewer chars; MUST be <=72 including type/scope."
|
|
210
|
+
);
|
|
207
211
|
specLines.push(
|
|
208
212
|
"Emoji Rule: " + (config.style === "gitmoji" || config.style === "gitmoji-pure" ? "OPTIONAL single leading gitmoji BEFORE the type only if confidently adds clarity; do not invent or stack; omit if unsure." : "Disallow all emojis and gitmoji codes; output must start directly with the type.")
|
|
209
213
|
);
|
|
@@ -487,11 +491,10 @@ var normalizeConventionalTitle = (title) => {
|
|
|
487
491
|
if (leadingEmoji) {
|
|
488
492
|
result = `${leadingEmoji} ${result}`;
|
|
489
493
|
}
|
|
490
|
-
return result
|
|
494
|
+
return result;
|
|
491
495
|
};
|
|
492
496
|
var checkCandidate = (candidate) => {
|
|
493
497
|
const errs = [];
|
|
494
|
-
if (candidate.title.length > 72) errs.push("Title exceeds 72 chars.");
|
|
495
498
|
if (!CONVENTIONAL_RE.test(candidate.title)) {
|
|
496
499
|
errs.push("Not a valid conventional commit title.");
|
|
497
500
|
}
|
|
@@ -524,14 +527,13 @@ var EMOJI_MAP = {
|
|
|
524
527
|
security: "\u{1F512}",
|
|
525
528
|
release: "\u{1F3F7}\uFE0F"
|
|
526
529
|
};
|
|
527
|
-
var MAX_LEN = 72;
|
|
528
530
|
var EMOJI_TYPE_RE = /^([\p{Emoji}\p{So}\p{Sk}])\s+(\w+)(\(.+\))?:\s+(.*)$/u;
|
|
529
531
|
var TYPE_RE = /^(\w+)(\(.+\))?:\s+(.*)$/;
|
|
530
532
|
var formatCommitTitle = (raw, opts) => {
|
|
531
533
|
const { allowGitmoji, mode = "standard" } = opts;
|
|
532
534
|
let norm = normalizeConventionalTitle(sanitizeTitle(raw, allowGitmoji));
|
|
533
535
|
if (!allowGitmoji || mode !== "gitmoji" && mode !== "gitmoji-pure") {
|
|
534
|
-
return norm
|
|
536
|
+
return norm;
|
|
535
537
|
}
|
|
536
538
|
if (mode === "gitmoji-pure") {
|
|
537
539
|
let m2 = norm.match(EMOJI_TYPE_RE);
|
|
@@ -547,11 +549,11 @@ var formatCommitTitle = (raw, opts) => {
|
|
|
547
549
|
} else if (!/^([\p{Emoji}\p{So}\p{Sk}])+:/u.test(norm)) {
|
|
548
550
|
norm = `\u{1F527}: ${norm}`;
|
|
549
551
|
}
|
|
550
|
-
return norm
|
|
552
|
+
return norm;
|
|
551
553
|
}
|
|
552
554
|
let m = norm.match(EMOJI_TYPE_RE);
|
|
553
555
|
if (m) {
|
|
554
|
-
return norm
|
|
556
|
+
return norm;
|
|
555
557
|
}
|
|
556
558
|
if (m = norm.match(TYPE_RE)) {
|
|
557
559
|
const type = m[1];
|
|
@@ -562,7 +564,7 @@ var formatCommitTitle = (raw, opts) => {
|
|
|
562
564
|
} else if (!/^([\p{Emoji}\p{So}\p{Sk}])+\s+\w+.*:/u.test(norm)) {
|
|
563
565
|
norm = `\u{1F527} chore: ${norm}`;
|
|
564
566
|
}
|
|
565
|
-
return norm
|
|
567
|
+
return norm;
|
|
566
568
|
};
|
|
567
569
|
|
|
568
570
|
// src/workflow/generate.ts
|
|
@@ -1122,7 +1124,7 @@ async function runRefine(config, options) {
|
|
|
1122
1124
|
// package.json
|
|
1123
1125
|
var package_default = {
|
|
1124
1126
|
name: "@kud/ai-conventional-commit-cli",
|
|
1125
|
-
version: "0.
|
|
1127
|
+
version: "0.9.0",
|
|
1126
1128
|
type: "module",
|
|
1127
1129
|
description: "Opinionated, style-aware AI assistant for crafting and splitting git commits (opencode-based, provider-agnostic).",
|
|
1128
1130
|
bin: {
|
package/package.json
CHANGED