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
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: semantic
|
|
3
|
+
description: Generate a single-line Semantic Commits subject from staged changes and the current branch name. Use when the user asks to write a semantic commit message, generate a semantic subject, summarize staged changes with a typed commit prefix, 生成 semantic 提交信息, 写 semantic 风格提交说明, or wants an Angular-style `type(scope): summary` subject that is tracked separately from Conventional Commits.
|
|
4
|
+
commit-message-protocol: semantic
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Semantic Commits
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Generate a commit message from the current git staged changes.
|
|
12
|
+
|
|
13
|
+
Requirements:
|
|
14
|
+
- Follow Semantic Commits.
|
|
15
|
+
- Use the `type(scope): summary` structure when a scope is useful.
|
|
16
|
+
- Follow the configured commit message language for the summary.
|
|
17
|
+
- Extract a Jira ID or work item ID from the current branch name when possible and prepend it to the summary.
|
|
18
|
+
- Ignore branch tokens that are clearly version numbers, release numbers, dates, or pure numeric identifiers.
|
|
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 narrowest semantic commit type.
|
|
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 the branch ticket. If the branch yields a `Key-123` token, the subject must include that exact ticket form.
|
|
59
|
+
- If no valid ticket is found, omit it.
|
|
60
|
+
|
|
61
|
+
## Type Selection
|
|
62
|
+
|
|
63
|
+
Choose the commit type from the staged change intent:
|
|
64
|
+
|
|
65
|
+
- `feat`: new feature or user-visible capability
|
|
66
|
+
- `fix`: bug fix or behavior correction
|
|
67
|
+
- `refactor`: code restructuring without behavior change
|
|
68
|
+
- `perf`: performance improvement
|
|
69
|
+
- `docs`: documentation only
|
|
70
|
+
- `test`: tests only
|
|
71
|
+
- `style`: formatting or non-functional style changes
|
|
72
|
+
- `build`: build tooling or dependency packaging changes
|
|
73
|
+
- `ci`: CI workflow or pipeline changes
|
|
74
|
+
- `chore`: routine maintenance that does not fit the types above
|
|
75
|
+
- `revert`: reverting an earlier commit
|
|
76
|
+
|
|
77
|
+
Do not guess `feat` by default. Pick the narrowest accurate type from the staged diff.
|
|
78
|
+
|
|
79
|
+
## Output Format
|
|
80
|
+
|
|
81
|
+
Always output a single-line subject only.
|
|
82
|
+
|
|
83
|
+
Subject template:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
<type>(<scope>)?: <ticket-id> <summary>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If there is no ticket:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
<type>(<scope>)?: <summary>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Subject rules:
|
|
96
|
+
- Keep it concise and specific.
|
|
97
|
+
- Follow the configured commit message language.
|
|
98
|
+
- Focus on the purpose of the staged change, not a file list.
|
|
99
|
+
- Do not end the subject with punctuation.
|
|
100
|
+
- Keep the type keyword in English.
|
|
101
|
+
|
|
102
|
+
## Examples
|
|
103
|
+
|
|
104
|
+
Branch: `feature/ABC-5690-user-center-sync`
|
|
105
|
+
Staged intent: user center integration
|
|
106
|
+
|
|
107
|
+
Output:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
feat(user-center): ABC-5690 用户中心模块数据联调
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Branch: `fix/abc-6021-order-status`
|
|
114
|
+
Staged intent: fix incorrect status mapping
|
|
115
|
+
|
|
116
|
+
Output:
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
fix(order): abc-6021 修复订单状态映射错误
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Branch: `release/1.3.0`
|
|
123
|
+
Staged intent: update README
|
|
124
|
+
|
|
125
|
+
Output:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
docs(readme): 更新接诊流程说明
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Branch: `feature/202SP5-CZGZH-SCP-7921`
|
|
132
|
+
Staged intent: add SCA security component types
|
|
133
|
+
|
|
134
|
+
Output:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
feat(sca): SCP-7921 新增 SCA 安全组件类型支持
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Branch: `feature/202-SCP-7921`
|
|
141
|
+
Staged intent: same as above
|
|
142
|
+
|
|
143
|
+
Output:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
feat(sca): SCP-7921 新增 SCA 安全组件类型支持
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Response Style
|
|
150
|
+
|
|
151
|
+
When returning the result to the user:
|
|
152
|
+
- Return the final commit message directly.
|
|
153
|
+
- If useful, add one short sentence explaining the chosen type, scope, or why the ticket was omitted.
|
|
154
|
+
- If the staged diff is ambiguous, offer 2 to 3 candidate messages and say what differs between them.
|
|
155
|
+
|
|
156
|
+
## Additional Resources
|
|
157
|
+
|
|
158
|
+
- For more examples, see [references/examples.md](references/examples.md)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
## With Jira ID and scope
|
|
4
|
+
|
|
5
|
+
Branch:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
feature/ABC-5690-user-center-sync
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Output:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
feat(user-center): 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(order): 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(readme): 更新项目接入说明
|
|
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
|
+
feat(auth): 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
|
+
docs(release): update release notes
|
|
71
|
+
```
|