smart-commit-copilot-cli 0.1.1 → 0.1.3
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 +43 -0
- package/README.md +18 -1
- package/docs/configuration.md +17 -1
- package/docs/contracts.md +26 -0
- package/docs/getting-started.md +11 -0
- package/docs/publish.md +13 -6
- package/docs/release-checklist.md +3 -1
- package/docs/releases/0.1.1-draft.md +1 -0
- package/docs/releases/0.1.2-draft.md +73 -0
- package/docs/releases/0.1.3-draft.md +69 -0
- package/docs/verification.md +2 -0
- package/examples/config/smart-commit.json +1 -1
- package/out/commands/bridge.js +13 -5
- package/out/commands/bridge.js.map +1 -1
- package/out/commitMessage/index.js +1 -0
- package/out/commitMessage/index.js.map +1 -1
- package/out/commitMessage/openaiProvider.js +4 -2
- package/out/commitMessage/openaiProvider.js.map +1 -1
- package/out/commitMessage/prompt.js +36 -0
- package/out/commitMessage/prompt.js.map +1 -1
- package/out/config/schema.js +1 -1
- package/out/contracts.js +18 -2
- package/out/contracts.js.map +1 -1
- package/out/passHistory/index.js +14 -15
- package/out/passHistory/index.js.map +1 -1
- package/out/passHistory/store.js +16 -17
- package/out/passHistory/store.js.map +1 -1
- package/out/promptContext.js +68 -2
- package/out/promptContext.js.map +1 -1
- package/out/renderOutput.js +24 -0
- package/out/renderOutput.js.map +1 -1
- package/out/reporting/aggregate.js +2 -1
- package/out/reporting/aggregate.js.map +1 -1
- package/out/reporting/render.js +3 -0
- package/out/reporting/render.js.map +1 -1
- package/out/reporting/types.js.map +1 -1
- package/out/review/mockProvider.js +13 -0
- package/out/review/mockProvider.js.map +1 -1
- package/out/review/parser.js +4 -4
- package/out/review/parser.js.map +1 -1
- package/out/review/prompt.js +4 -0
- package/out/review/prompt.js.map +1 -1
- package/package.json +2 -1
- package/src/git-commit-message-skills/conventional/SKILL.md +156 -0
- package/src/git-commit-message-skills/conventional/references/examples.md +57 -0
- package/src/git-commit-message-skills/gitmoji/SKILL.md +157 -0
- package/src/git-commit-message-skills/gitmoji/references/examples.md +71 -0
- package/src/git-commit-message-skills/semantic/SKILL.md +158 -0
- package/src/git-commit-message-skills/semantic/references/examples.md +71 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/reporting/render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,4EAaC;AAED,kDAYC;AAED,0CAKC;AAED,
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/reporting/render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,4EAaC;AAED,kDAYC;AAED,0CAKC;AAED,4DAsFC;AAED,8CAGC;AArID,qDAAuC;AACvC,gDAAkC;AAGrB,QAAA,6BAA6B,GAAG,SAAS,CAAC;AAEvD,SAAgB,gCAAgC,CAAC,KAGhD;IACC,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IACzD,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,mBAAmB,EAAE,qCAA6B,CAAC,CAAC;IACjI,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,OAAO,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;QACvC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;QACnC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAC5D,CAAC;AAED,SAAgB,mBAAmB,CAAC,UAA4B,EAAE,MAAY,IAAI,IAAI,EAAE;IACtF,MAAM,KAAK,GAAG;QACZ,GAAG,CAAC,WAAW,EAAE;QACjB,MAAM,CAAC,GAAG,CAAC,Q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AE,CAAC,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reporting/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reporting/types.ts"],"names":[],"mappings":";;;AAyFa,QAAA,mBAAmB,GAAgC;IAC9D,OAAO;IACP,QAAQ;IACR,SAAS;IACT,WAAW;IACX,QAAQ;CACA,CAAC"}
|
|
@@ -23,6 +23,19 @@ function createMockReviewProvider(config = {}) {
|
|
|
23
23
|
]
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
+
if (mode === "block-high-score") {
|
|
27
|
+
return JSON.stringify({
|
|
28
|
+
score: Math.max(input.threshold + 1, 9),
|
|
29
|
+
decision: "block",
|
|
30
|
+
summary: `Mock review reported issues but still assigned a high score (${summaryHint}).`,
|
|
31
|
+
details: [
|
|
32
|
+
{
|
|
33
|
+
severity: "P2",
|
|
34
|
+
message: "Mock non-blocking issue."
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
26
39
|
if (mode === "na") {
|
|
27
40
|
return JSON.stringify({
|
|
28
41
|
score: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockProvider.js","sourceRoot":"","sources":["../../src/review/mockProvider.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"mockProvider.js","sourceRoot":"","sources":["../../src/review/mockProvider.ts"],"names":[],"mappings":";;AAGA,4DAsEC;AAtED,SAAgB,wBAAwB,CAAC,SAA4B,EAAE;IACrE,OAAO;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AS,CAAC;oBACpB,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,MAAM;oBAChB,OAAO,EAAE,wEAAwE,WAAW,IAAI;oBAChG,OAAO,EAAE,EAAE;iBACZ,CAAC,CAAC;YACL,CAAC;YAED,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC;gBACvC,QAAQ,EAAE,MAAM;gBAChB,OAAO,EAAE,sCAAsC,WAAW,IAAI;gBAC9D,OAAO,EAAE,EAAE;aACZ,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,YAAY,CAAC,KAA2B,EAAE,eAAuB,EAAE,MAAgB;YACvF,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC;YACxH,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC;gBACvC,QAAQ,EAAE,MAAM;gBAChB,OAAO,EAAE,wCAAwC,WAAW,IAAI;gBAChE,OAAO,EAAE;oBACP;wBACE,QAAQ,EAAE,OAAO;wBACjB,OAAO,EAAE,0BAA0B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;qBACxD;iBACF;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/out/review/parser.js
CHANGED
|
@@ -42,13 +42,13 @@ function validateReviewResult(result, threshold) {
|
|
|
42
42
|
if (result.score !== null && (result.score < 0 || result.score > 10)) {
|
|
43
43
|
issues.push("score must be between 0 and 10");
|
|
44
44
|
}
|
|
45
|
-
if (result.decision === "pass" && result.score !== null && result.score <= threshold) {
|
|
46
|
-
issues.push(`pass decision conflicts with score ${result.score} at threshold ${threshold}`);
|
|
47
|
-
}
|
|
48
45
|
return issues;
|
|
49
46
|
}
|
|
50
47
|
function shouldBlockReviewResult(result, threshold) {
|
|
51
|
-
|
|
48
|
+
if (result.score === null) {
|
|
49
|
+
return result.decision === "block";
|
|
50
|
+
}
|
|
51
|
+
return result.score <= threshold;
|
|
52
52
|
}
|
|
53
53
|
function parseReviewScore(value) {
|
|
54
54
|
if (value === null || value === "N/A") {
|
package/out/review/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/review/parser.ts"],"names":[],"mappings":";;AAWA,kDA6BC;AAED,
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/review/parser.ts"],"names":[],"mappings":";;AAWA,kDA6BC;AAED,oDAgBC;AAED,0DASC;AA5DD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnF,SAAgB,mBAAmB,CAAC,GAAW,EAAE,QAAgB;IAC/D,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,OAA4B,CAAC;IAEjC,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAwB,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,QA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ACX,CAAC;QAED,MAAM,QAAQ,GACZ,OAAO,WAAW,KAAK,QAAQ,IAAI,eAAe,CAAC,GAAG,CAAC,WAA6B,CAAC;YACnF,CAAC,CAAE,WAA8B;YACjC,CAAC,CAAC,OAAO,CAAC;QACd,MAAM,QAAQ,GAAG,UAAU,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QACzH,MAAM,UAAU,GACd,YAAY,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;YAC9F,CAAC,CAAC,IAAI,CAAC,UAAU;YACjB,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO,CAAC,IAAI,CAAC;YACX,QAAQ;YACR,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE;YAC1B,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/out/review/prompt.js
CHANGED
|
@@ -11,6 +11,8 @@ function buildReviewMessages(input, options = {}) {
|
|
|
11
11
|
"Return strict JSON only.",
|
|
12
12
|
'The JSON shape must be: {"score": number|null, "decision": "pass"|"block", "summary": string, "details": Array<{ "severity": "P0"|"P1"|"P2"|"P3"|"OTHER", "message": string, "filePath"?: string, "lineNumber"?: number }>}.',
|
|
13
13
|
"Use the provided threshold to decide whether the change should pass or block.",
|
|
14
|
+
"When score is numeric, score compared with threshold is the final pass/block standard, so decision must match the score-based outcome.",
|
|
15
|
+
'Use decision alone only when score is null.',
|
|
14
16
|
...(options.promptAugmentation?.length ? ["", ...options.promptAugmentation] : [])
|
|
15
17
|
].join(" ")
|
|
16
18
|
},
|
|
@@ -38,6 +40,8 @@ function buildReviewRepairMessages(input, invalidResponse, issues, options = {})
|
|
|
38
40
|
"You are repairing a malformed code review response.",
|
|
39
41
|
"Return strict JSON only.",
|
|
40
42
|
'The JSON shape must be: {"score": number|null, "decision": "pass"|"block", "summary": string, "details": Array<{ "severity": "P0"|"P1"|"P2"|"P3"|"OTHER", "message": string, "filePath"?: string, "lineNumber"?: number }>}.',
|
|
43
|
+
"When score is numeric, score compared with threshold is the final pass/block standard, so decision must match the score-based outcome.",
|
|
44
|
+
'Use decision alone only when score is null.',
|
|
41
45
|
...(options.promptAugmentation?.length ? ["", ...options.promptAugmentation] : [])
|
|
42
46
|
].join(" ")
|
|
43
47
|
},
|
package/out/review/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/review/prompt.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/review/prompt.ts"],"names":[],"mappings":";;AAEA,kDAgCC;AAED,8DAkCC;AApED,SAAgB,mBAAmB,CACjC,KAA2B,EAC3B,UAAsD,EAAE;IAExD,OAAO;QACL;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,iCAAiC;gBACjC,0BAA0B;gBAC1B,8NAA8N;gBAC9N,+EAA+E;gBAC/E,wIAAwI;gBACxI,6CAA6C;gBAC7C,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACnF,CAAC,IAAI,CAAC,GAAG,CAAC;SACZ;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,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C,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-commit-copilot-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI for AI-assisted commit review, commit message generation, Git workflow automation, and work reports.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"out",
|
|
13
|
+
"src/git-commit-message-skills",
|
|
13
14
|
"README.md",
|
|
14
15
|
"CHANGELOG.md",
|
|
15
16
|
"docs",
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: conventional
|
|
3
|
+
description: Generate a single-line Conventional Commits subject from staged changes and the current branch name. Use when the user asks to write a commit message, generate a commit message, summarize staged changes, write a git commit subject, 根据暂存区生成提交信息, 生成 commit message, 写提交说明, or produce a commit subject based on the git staging area, branch name, Jira ID, or work item ID.
|
|
4
|
+
commit-message-protocol: conventional
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Conventional Commits
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Generate a commit message from the current git staged changes.
|
|
12
|
+
|
|
13
|
+
Requirements:
|
|
14
|
+
- Follow Conventional Commits.
|
|
15
|
+
- Follow the configured commit message language for the summary.
|
|
16
|
+
- Extract a Jira ID or work item ID from the current branch name when possible and prepend it to the summary.
|
|
17
|
+
- Ignore branch tokens that are clearly version numbers, release numbers, dates, or pure numeric identifiers.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. Confirm there are staged changes before drafting the message.
|
|
22
|
+
2. Read the staged diff, not the full working tree, and summarize only what is staged.
|
|
23
|
+
3. Read the current branch name.
|
|
24
|
+
4. Extract a ticket-like identifier from the branch name.
|
|
25
|
+
5. Choose the best Conventional Commit type.
|
|
26
|
+
6. Generate a concise subject line.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
Use git commands that inspect only the staged area:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git branch --show-current
|
|
34
|
+
git diff --cached --name-only
|
|
35
|
+
git diff --cached --stat
|
|
36
|
+
git diff --cached
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If there are no staged changes, do not invent a message. Tell the user there is nothing staged to commit.
|
|
40
|
+
|
|
41
|
+
## Ticket Extraction
|
|
42
|
+
|
|
43
|
+
Extract a meaningful ticket-like token from the branch name.
|
|
44
|
+
|
|
45
|
+
Preferred pattern:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
[A-Za-z][A-Za-z0-9]+-\d+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Rules:
|
|
52
|
+
- If the branch contains **multiple** substrings that match this pattern, use the **last** match. Prefix segments are often release or iteration noise; the real work item ID is usually at the end (for example `...-CZGZH-SCP-7921` → `SCP-7921`).
|
|
53
|
+
- Keep the extracted ticket exactly as it appears in the branch name.
|
|
54
|
+
- The pattern requires a **leading letter** in the key, so a numeric prefix such as `202-` before the key is not treated as the project key (for example `feature/202-SCP-7921` → `SCP-7921`).
|
|
55
|
+
- Ignore tokens that look like versions or releases when interpreting the branch, for example `1.2.3`, `v2.0.1`, `2026.03`, `release-1.0.0`.
|
|
56
|
+
- Ignore pure numbers such as `1234`.
|
|
57
|
+
- **Do not** substitute unrelated acronyms from the diff or summary (for example `SCA`) for the branch ticket. If the branch yields a `Key-123` token, the subject must include that exact ticket form.
|
|
58
|
+
- If no valid ticket is found, omit it.
|
|
59
|
+
|
|
60
|
+
## Type Selection
|
|
61
|
+
|
|
62
|
+
Choose the commit type from the staged change intent:
|
|
63
|
+
|
|
64
|
+
- `feat`: new feature or user-visible capability
|
|
65
|
+
- `fix`: bug fix or behavior correction
|
|
66
|
+
- `refactor`: code restructuring without behavior change
|
|
67
|
+
- `perf`: performance improvement
|
|
68
|
+
- `docs`: documentation only
|
|
69
|
+
- `test`: tests only
|
|
70
|
+
- `style`: formatting or non-functional style changes
|
|
71
|
+
- `build`: build tooling or dependency packaging changes
|
|
72
|
+
- `ci`: CI workflow or pipeline changes
|
|
73
|
+
- `chore`: routine maintenance that does not fit the types above
|
|
74
|
+
- `revert`: reverting an earlier commit
|
|
75
|
+
|
|
76
|
+
Do not guess `feat` by default. Pick the narrowest accurate type from the staged diff.
|
|
77
|
+
|
|
78
|
+
## Output Format
|
|
79
|
+
|
|
80
|
+
Always output a single-line subject only.
|
|
81
|
+
|
|
82
|
+
Subject template:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
<type>: <ticket-id> <summary>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If there is no ticket:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
<type>: <summary>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Subject rules:
|
|
95
|
+
- Keep it concise and specific.
|
|
96
|
+
- Follow the configured commit message language.
|
|
97
|
+
- Focus on the purpose of the staged change, not a file list.
|
|
98
|
+
- Do not end the subject with punctuation.
|
|
99
|
+
|
|
100
|
+
## Examples
|
|
101
|
+
|
|
102
|
+
Branch: `feature/ABC-5690-user-center-sync`
|
|
103
|
+
Staged intent: user center integration
|
|
104
|
+
|
|
105
|
+
Output:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
feat: ABC-5690 用户中心模块数据联调
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Branch: `fix/abc-6021-order-status`
|
|
112
|
+
Staged intent: fix incorrect status mapping
|
|
113
|
+
|
|
114
|
+
Output:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
fix: abc-6021 修复订单状态映射错误
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Branch: `release/1.3.0`
|
|
121
|
+
Staged intent: update README
|
|
122
|
+
|
|
123
|
+
Output:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
docs: 更新接诊流程说明
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Branch: `feature/202SP5-CZGZH-SCP-7921`
|
|
130
|
+
Staged intent: add SCA security component types
|
|
131
|
+
|
|
132
|
+
Output:
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
feat: SCP-7921 新增 SCA 安全组件类型支持
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Branch: `feature/202-SCP-7921`
|
|
139
|
+
Staged intent: same as above
|
|
140
|
+
|
|
141
|
+
Output:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
feat: SCP-7921 新增 SCA 安全组件类型支持
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Response Style
|
|
148
|
+
|
|
149
|
+
When returning the result to the user:
|
|
150
|
+
- Return the final commit message directly.
|
|
151
|
+
- If useful, add one short sentence explaining the chosen type or why the ticket was omitted.
|
|
152
|
+
- If the staged diff is ambiguous, offer 2 to 3 candidate messages and say what differs between them.
|
|
153
|
+
|
|
154
|
+
## Additional Resources
|
|
155
|
+
|
|
156
|
+
- For more examples, see [references/examples.md](references/examples.md)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
## With Jira ID
|
|
4
|
+
|
|
5
|
+
Branch:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
feature/ABC-5690-user-center-sync
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Output:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
feat: ABC-5690 用户中心模块数据联调
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Lowercase ticket in branch
|
|
18
|
+
|
|
19
|
+
Branch:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
fix/abc-6021-order-status
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Output:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
fix: abc-6021 修复订单状态映射错误
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## No ticket in branch
|
|
32
|
+
|
|
33
|
+
Branch:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
chore/update-readme
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Output:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
docs: 更新项目接入说明
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Version-like branch should be ignored
|
|
46
|
+
|
|
47
|
+
Branch:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
release/1.3.0
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Output:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
docs: 更新发版说明
|
|
57
|
+
```
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitmoji
|
|
3
|
+
description: Generate a single-line Gitmoji commit subject from staged changes and the current branch name. Use when the user asks to write a gitmoji commit message, generate a gitmoji subject, 生成 gitmoji 提交信息, 写 gitmoji 风格提交说明, or wants a commit message with an emoji prefix instead of a typed commit prefix such as Conventional Commits or Semantic Commits.
|
|
4
|
+
commit-message-protocol: gitmoji
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Gitmoji Commit Message
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Generate a single-line Gitmoji commit subject from the current staged changes.
|
|
12
|
+
|
|
13
|
+
Requirements:
|
|
14
|
+
- Follow the configured commit message language for the summary.
|
|
15
|
+
- Start the subject with one Gitmoji emoji that best matches the staged change intent.
|
|
16
|
+
- Extract a Jira ID or work item ID from the current branch name when possible and place it after the emoji.
|
|
17
|
+
- Ignore branch tokens that are clearly version numbers, release numbers, dates, or pure numeric identifiers.
|
|
18
|
+
- Do not output a typed commit prefix such as `feat:` or `fix:`.
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
1. Confirm there are staged changes before drafting the message.
|
|
23
|
+
2. Read the staged diff, not the full working tree, and summarize only what is staged.
|
|
24
|
+
3. Read the current branch name.
|
|
25
|
+
4. Extract a ticket-like identifier from the branch name.
|
|
26
|
+
5. Choose the Gitmoji that best matches the staged change intent.
|
|
27
|
+
6. Generate a concise subject line.
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
Use git commands that inspect only the staged area:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git branch --show-current
|
|
35
|
+
git diff --cached --name-only
|
|
36
|
+
git diff --cached --stat
|
|
37
|
+
git diff --cached
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If there are no staged changes, do not invent a message. Tell the user there is nothing staged to commit.
|
|
41
|
+
|
|
42
|
+
## Ticket Extraction
|
|
43
|
+
|
|
44
|
+
Extract a meaningful ticket-like token from the branch name.
|
|
45
|
+
|
|
46
|
+
Preferred pattern:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
[A-Za-z][A-Za-z0-9]+-\d+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Rules:
|
|
53
|
+
- If the branch contains **multiple** substrings that match this pattern, use the **last** match. Prefix segments are often release or iteration noise; the real work item ID is usually at the end (for example `...-CZGZH-SCP-7921` → `SCP-7921`).
|
|
54
|
+
- Keep the extracted ticket exactly as it appears in the branch name.
|
|
55
|
+
- The pattern requires a **leading letter** in the key, so a numeric prefix such as `202-` before the key is not treated as the project key (for example `feature/202-SCP-7921` → `SCP-7921`).
|
|
56
|
+
- Ignore tokens that look like versions or releases when interpreting the branch, for example `1.2.3`, `v2.0.1`, `2026.03`, `release-1.0.0`.
|
|
57
|
+
- Ignore pure numbers such as `1234`.
|
|
58
|
+
- **Do not** substitute unrelated acronyms from the diff or summary (for example `SCA`) for the branch ticket. If the branch yields a `Key-123` token, the subject must include that exact ticket form after the Gitmoji.
|
|
59
|
+
- If no valid ticket is found, omit it.
|
|
60
|
+
|
|
61
|
+
## Gitmoji Selection
|
|
62
|
+
|
|
63
|
+
Choose the narrowest Gitmoji that matches the staged change intent:
|
|
64
|
+
|
|
65
|
+
- `✨` new feature or user-visible capability
|
|
66
|
+
- `🐛` bug fix or behavior correction
|
|
67
|
+
- `♻️` refactoring without behavior change
|
|
68
|
+
- `📝` documentation only
|
|
69
|
+
- `✅` tests only
|
|
70
|
+
- `🚀` performance improvement
|
|
71
|
+
- `🔧` tooling, configuration, or maintenance changes
|
|
72
|
+
- `🔥` removing obsolete code or files
|
|
73
|
+
- `🚑️` urgent production fix
|
|
74
|
+
- `💄` UI or style-only adjustments
|
|
75
|
+
|
|
76
|
+
Do not default to `✨`. Match the actual staged diff.
|
|
77
|
+
|
|
78
|
+
## Output Format
|
|
79
|
+
|
|
80
|
+
Always output a single-line subject only.
|
|
81
|
+
|
|
82
|
+
Subject template with ticket:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
<gitmoji> <ticket-id> <summary>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Subject template without ticket:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
<gitmoji> <summary>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Subject rules:
|
|
95
|
+
- Keep it concise and specific.
|
|
96
|
+
- Follow the configured commit message language.
|
|
97
|
+
- Focus on the purpose of the staged change, not a file list.
|
|
98
|
+
- Do not end the subject with punctuation.
|
|
99
|
+
- Do not add extra labels, explanations, or markdown.
|
|
100
|
+
|
|
101
|
+
## Examples
|
|
102
|
+
|
|
103
|
+
Branch: `feature/ABC-5690-user-center-sync`
|
|
104
|
+
Staged intent: user center integration
|
|
105
|
+
|
|
106
|
+
Output:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
✨ ABC-5690 用户中心模块数据联调
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Branch: `fix/abc-6021-order-status`
|
|
113
|
+
Staged intent: fix incorrect status mapping
|
|
114
|
+
|
|
115
|
+
Output:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
🐛 abc-6021 修复订单状态映射错误
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Branch: `chore/update-readme`
|
|
122
|
+
Staged intent: update README
|
|
123
|
+
|
|
124
|
+
Output:
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
📝 更新项目接入说明
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Branch: `feature/202SP5-CZGZH-SCP-7921`
|
|
131
|
+
Staged intent: add SCA security component types
|
|
132
|
+
|
|
133
|
+
Output:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
✨ SCP-7921 新增 SCA 安全组件类型支持
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Branch: `feature/202-SCP-7921`
|
|
140
|
+
Staged intent: same as above
|
|
141
|
+
|
|
142
|
+
Output:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
✨ SCP-7921 新增 SCA 安全组件类型支持
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Response Style
|
|
149
|
+
|
|
150
|
+
When returning the result to the user:
|
|
151
|
+
- Return the final commit message directly.
|
|
152
|
+
- If useful, add one short sentence explaining the chosen Gitmoji or why the ticket was omitted.
|
|
153
|
+
- If the staged diff is ambiguous, offer 2 to 3 candidate messages and say what differs between them.
|
|
154
|
+
|
|
155
|
+
## Additional Resources
|
|
156
|
+
|
|
157
|
+
- For more examples, see [references/examples.md](references/examples.md)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
## With Jira ID
|
|
4
|
+
|
|
5
|
+
Branch:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
feature/ABC-5690-user-center-sync
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Output:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
✨ ABC-5690 用户中心模块数据联调
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Lowercase ticket in branch
|
|
18
|
+
|
|
19
|
+
Branch:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
fix/abc-6021-order-status
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Output:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
🐛 abc-6021 修复订单状态映射错误
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## No ticket in branch
|
|
32
|
+
|
|
33
|
+
Branch:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
chore/update-readme
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Output:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
📝 更新项目接入说明
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## English summary
|
|
46
|
+
|
|
47
|
+
Branch:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
feature/ABC-123-login-flow
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Output:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
✨ ABC-123 add login flow
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Version-like branch should be ignored
|
|
60
|
+
|
|
61
|
+
Branch:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
release/1.3.0
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Output:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
📝 update release notes
|
|
71
|
+
```
|