smart-commit-copilot-cli 0.1.2 → 0.1.4
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 +33 -0
- package/README.md +489 -98
- package/docs/configuration.md +385 -121
- package/docs/contracts.md +26 -0
- package/docs/getting-started.md +159 -39
- package/docs/publish.md +1 -1
- package/docs/releases/0.1.3-draft.md +70 -0
- package/docs/releases/0.1.4-draft.md +54 -0
- package/out/cliApp.js +13 -0
- package/out/cliApp.js.map +1 -1
- package/out/commands/bridge.js +1 -1
- package/out/commands/bridge.js.map +1 -1
- package/out/contracts.js +1 -1
- package/out/contracts.js.map +1 -1
- package/out/passHistory/index.js +2 -3
- package/out/passHistory/index.js.map +1 -1
- package/out/passHistory/store.js +4 -5
- package/out/passHistory/store.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/package.json +1 -1
package/docs/configuration.md
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
# Configuration Guide
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This guide explains not only what each `smart-commit CLI` setting does, but also how to choose a good value for it.
|
|
4
|
+
|
|
5
|
+
If you are new to the project, read [`getting-started.md`](./getting-started.md) first. Then use this page when you start asking:
|
|
6
|
+
|
|
7
|
+
- which fields are actually required
|
|
8
|
+
- which defaults are safe
|
|
9
|
+
- which settings you should change first
|
|
10
|
+
- which settings are easy to misconfigure
|
|
11
|
+
|
|
12
|
+
## Start Here
|
|
13
|
+
|
|
14
|
+
For most first-time users, the real minimum is:
|
|
15
|
+
|
|
16
|
+
- `connection.baseUrl`
|
|
17
|
+
- `connection.apiKey`
|
|
18
|
+
- `connection.model`
|
|
19
|
+
- `git.autoCommit`
|
|
20
|
+
- `git.autoPush`
|
|
21
|
+
|
|
22
|
+
Use this as your safe starting point:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"smartCommitCli": {
|
|
27
|
+
"connection": {
|
|
28
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
29
|
+
"apiKey": "env:SMART_COMMIT_API_KEY",
|
|
30
|
+
"model": "gpt-5"
|
|
31
|
+
},
|
|
32
|
+
"git": {
|
|
33
|
+
"autoCommit": false,
|
|
34
|
+
"autoPush": false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This gives you a review-first workflow with no commit or push side effects.
|
|
4
41
|
|
|
5
42
|
## Recommended Format
|
|
6
43
|
|
|
@@ -18,15 +55,15 @@ Use the canonical JSON format:
|
|
|
18
55
|
}
|
|
19
56
|
```
|
|
20
57
|
|
|
21
|
-
Legacy `smartCommit.*` keys are still accepted for migration, but they
|
|
58
|
+
Legacy `smartCommit.*` keys are still accepted for migration, but they should be treated as compatibility input only.
|
|
22
59
|
|
|
23
|
-
##
|
|
60
|
+
## How Configuration Is Resolved
|
|
24
61
|
|
|
25
|
-
|
|
62
|
+
The CLI merges config from high to low precedence:
|
|
26
63
|
|
|
27
64
|
1. CLI arguments
|
|
28
65
|
2. environment variables
|
|
29
|
-
3. `smartCommitCli`
|
|
66
|
+
3. `smartCommitCli` in a JSON config file
|
|
30
67
|
4. legacy `smartCommit.*`
|
|
31
68
|
5. built-in defaults
|
|
32
69
|
|
|
@@ -40,6 +77,8 @@ Final result:
|
|
|
40
77
|
|
|
41
78
|
- `git.autoPush = true` from CLI
|
|
42
79
|
|
|
80
|
+
This means the command line always wins, which is useful for temporarily overriding a shared config file.
|
|
81
|
+
|
|
43
82
|
## `env:VAR_NAME` References
|
|
44
83
|
|
|
45
84
|
String values that begin with `env:` are resolved from the current process environment after merge and before validation.
|
|
@@ -62,76 +101,268 @@ Required shell setup:
|
|
|
62
101
|
export SMART_COMMIT_API_KEY="your-api-key"
|
|
63
102
|
```
|
|
64
103
|
|
|
65
|
-
|
|
104
|
+
This pattern is recommended for secrets because:
|
|
66
105
|
|
|
67
|
-
|
|
106
|
+
- the same config file can work across machines
|
|
107
|
+
- secrets stay out of committed config files
|
|
108
|
+
- `config resolve` will still show the final merged config with secret redaction
|
|
68
109
|
|
|
69
|
-
|
|
110
|
+
## The Most Important Warning
|
|
70
111
|
|
|
71
|
-
-
|
|
72
|
-
- `connection.apiKey`
|
|
73
|
-
- `connection.model`
|
|
74
|
-
- `connection.requestTimeoutMs`
|
|
75
|
-
- `connection.extraHeaders`
|
|
112
|
+
The built-in defaults are not always the safest rollout defaults.
|
|
76
113
|
|
|
77
|
-
|
|
114
|
+
In particular, the built-in config defaults are:
|
|
78
115
|
|
|
79
|
-
- `
|
|
80
|
-
- `
|
|
81
|
-
- `
|
|
82
|
-
- `review.skill.id`
|
|
83
|
-
- `review.skill.path`
|
|
84
|
-
- `review.skill.promptTuning`
|
|
116
|
+
- `git.autoStageWhenNothingStaged = true`
|
|
117
|
+
- `git.autoCommit = true`
|
|
118
|
+
- `git.autoPush = true`
|
|
85
119
|
|
|
86
|
-
|
|
120
|
+
These may be fine for a mature automated workflow, but they are too aggressive for first rollout.
|
|
87
121
|
|
|
88
|
-
|
|
89
|
-
- `score > review.threshold` passes
|
|
90
|
-
- if a review returns `score = null`, the model decision is used
|
|
122
|
+
For first use, explicitly set:
|
|
91
123
|
|
|
92
|
-
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"smartCommitCli": {
|
|
127
|
+
"git": {
|
|
128
|
+
"autoCommit": false,
|
|
129
|
+
"autoPush": false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
93
134
|
|
|
94
|
-
|
|
95
|
-
- `commitMessage.language`
|
|
96
|
-
- `commitMessage.autoGenerate`
|
|
97
|
-
- `commitMessage.hybridGenerate`
|
|
98
|
-
- `commitMessage.validation.protocol`
|
|
99
|
-
- `commitMessage.validation.pattern`
|
|
100
|
-
- `commitMessage.validation.extractTicketIdFromBranch`
|
|
101
|
-
- `commitMessage.validation.requireTicketIdInMessage`
|
|
102
|
-
- `commitMessage.skill.id`
|
|
103
|
-
- `commitMessage.skill.path`
|
|
104
|
-
- `commitMessage.skill.promptTuning`
|
|
135
|
+
## Safe Team Rollout Example
|
|
105
136
|
|
|
106
|
-
|
|
137
|
+
Recommended early team setup:
|
|
107
138
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"smartCommitCli": {
|
|
142
|
+
"connection": {
|
|
143
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
144
|
+
"apiKey": "env:SMART_COMMIT_API_KEY",
|
|
145
|
+
"model": "gpt-5"
|
|
146
|
+
},
|
|
147
|
+
"review": {
|
|
148
|
+
"threshold": 6,
|
|
149
|
+
"language": "zh"
|
|
150
|
+
},
|
|
151
|
+
"git": {
|
|
152
|
+
"autoStageWhenNothingStaged": true,
|
|
153
|
+
"autoCommit": false,
|
|
154
|
+
"autoPush": false
|
|
155
|
+
},
|
|
156
|
+
"passHistory": {
|
|
157
|
+
"enabled": true,
|
|
158
|
+
"dirPath": ".smart-commit-cli",
|
|
159
|
+
"maxEntries": 3000
|
|
160
|
+
},
|
|
161
|
+
"output": {
|
|
162
|
+
"format": "json",
|
|
163
|
+
"logLevel": "info"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
This is a practical team default because it:
|
|
170
|
+
|
|
171
|
+
- keeps the rollout safe
|
|
172
|
+
- stores successful run history
|
|
173
|
+
- stays friendly to hooks and automation
|
|
174
|
+
|
|
175
|
+
## Field-By-Field Decision Guide
|
|
176
|
+
|
|
177
|
+
This section is the main reference for how to choose values.
|
|
178
|
+
|
|
179
|
+
### `connection.*`
|
|
180
|
+
|
|
181
|
+
These settings tell the CLI how to reach your AI endpoint. `bridge` requires all three of `baseUrl`, `apiKey`, and `model`.
|
|
182
|
+
|
|
183
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
184
|
+
| --- | --- | --- | --- | --- |
|
|
185
|
+
| `connection.baseUrl` | empty string | `https://api.openai.com/v1` or your internal OpenAI-compatible gateway | Change it when you use a proxy, gateway, or non-default compatible endpoint | Leaving it empty and expecting `bridge` to work |
|
|
186
|
+
| `connection.apiKey` | empty string | `env:SMART_COMMIT_API_KEY` | Change it only if you intentionally inject secrets another way | Putting raw secrets into committed config files |
|
|
187
|
+
| `connection.model` | empty string | A model name that your chosen `baseUrl` actually serves | Change it when you switch cost, quality, or provider capabilities | Using a model name unsupported by your gateway |
|
|
188
|
+
| `connection.requestTimeoutMs` | `1000000` | Leave default first | Change it only if your provider is too slow or your requests time out unexpectedly | Setting it below `5000`, which fails validation |
|
|
189
|
+
| `connection.extraHeaders` | `{}` | Leave empty first | Add values only if your proxy or API gateway requires custom headers | Adding provider-specific headers that your endpoint does not expect |
|
|
190
|
+
|
|
191
|
+
Practical guidance:
|
|
192
|
+
|
|
193
|
+
- if you do not know what to choose, ask one question first: "What OpenAI-compatible base URL and model name does our environment support?"
|
|
194
|
+
- if you use an internal gateway, use the gateway's supported model list instead of guessing
|
|
195
|
+
|
|
196
|
+
### `review.*`
|
|
197
|
+
|
|
198
|
+
These settings control review quality, language, and pass-or-block behavior.
|
|
199
|
+
|
|
200
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
201
|
+
| --- | --- | --- | --- | --- |
|
|
202
|
+
| `review.threshold` | `6` | `6` | Lower it if you get too many false blocks; raise it if you want stricter gating | Misreading the rule: `score <= threshold` blocks, `score > threshold` passes |
|
|
203
|
+
| `review.language` | `zh` | `zh` or `en`, depending on your team | Change it when your team wants review output in a different language | Assuming it changes Git behavior instead of review text |
|
|
204
|
+
| `review.maxDiffChars` | `100000` | Leave default first | Lower it if very large diffs are too slow or costly | Setting it below `1000`, which fails validation |
|
|
205
|
+
| `review.skill.id` | `code-review` | `code-review` | Change it when your repo needs domain-specific built-in review guidance | Using an unsupported id |
|
|
206
|
+
| `review.skill.path` | empty string | Leave empty first | Set it when your team has a custom review rules file | Setting both a custom path and then wondering why the built-in id does not matter |
|
|
207
|
+
| `review.skill.promptTuning` | empty string | Leave empty first | Add a short custom instruction when a full skill file is too heavy | Putting large policy documents into a tiny tuning string |
|
|
208
|
+
|
|
209
|
+
Supported built-in review skill ids:
|
|
210
|
+
|
|
211
|
+
- `code-review`
|
|
212
|
+
- `frontend-code-review`
|
|
213
|
+
- `mobile-code-review`
|
|
214
|
+
- `python-code-review`
|
|
215
|
+
- `golang-code-review`
|
|
216
|
+
- `java-code-review`
|
|
217
|
+
- `cpp-code-review`
|
|
218
|
+
- `csharp-code-review`
|
|
219
|
+
- `rust-code-review`
|
|
220
|
+
- `php-code-review`
|
|
221
|
+
|
|
222
|
+
When to choose a custom skill path:
|
|
223
|
+
|
|
224
|
+
- your team has a fixed review checklist
|
|
225
|
+
- you need security or compliance-specific review rules
|
|
226
|
+
- you want domain rules that are too long for `promptTuning`
|
|
227
|
+
|
|
228
|
+
### `commitMessage.*`
|
|
229
|
+
|
|
230
|
+
These settings control where the commit message comes from and how it is validated.
|
|
231
|
+
|
|
232
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
233
|
+
| --- | --- | --- | --- | --- |
|
|
234
|
+
| `commitMessage.input` | empty string | Leave empty first | Set it when you already know the exact message you want | Setting it and expecting auto-generation to replace it |
|
|
235
|
+
| `commitMessage.language` | `zh` | `zh` or `en` | Change it to match your team's commit language | Mixing a team English convention with a non-English expectation |
|
|
236
|
+
| `commitMessage.autoGenerate` | `true` | `true` | Set `false` only if users always provide a message themselves | Turning it off with no provided message, which causes a commit-message-required error |
|
|
237
|
+
| `commitMessage.hybridGenerate` | `false` | `false` | Set `true` when users provide a draft and want AI to refine it | Enabling it without understanding that it uses `commitMessage.input` as a draft |
|
|
238
|
+
| `commitMessage.validation.protocol` | `none` | `none` first, then `conventional` if your team standardizes on it | Change it when your team enforces a commit style | Enabling validation before the team is ready |
|
|
239
|
+
| `commitMessage.validation.pattern` | empty string | Leave empty first | Add a JavaScript regex only when your policy needs extra format checks | Writing an invalid regex pattern |
|
|
240
|
+
| `commitMessage.validation.extractTicketIdFromBranch` | `true` | `true` if your branches contain ticket ids | Set `false` if your branch naming does not include tickets | Expecting ticket extraction from branches that have no ticket ids |
|
|
241
|
+
| `commitMessage.validation.requireTicketIdInMessage` | `false` | `false` first | Set `true` only if your process really requires ticket ids in commit messages | Enforcing it before branch naming and generation are aligned |
|
|
242
|
+
| `commitMessage.skill.id` | `conventional` | `conventional` | Change it when you prefer another built-in commit style | Using a commit skill id that does not match your validation expectations |
|
|
243
|
+
| `commitMessage.skill.path` | empty string | Leave empty first | Set it when your team has its own commit-message policy file | Assuming a custom path still validates against the built-in id set |
|
|
244
|
+
| `commitMessage.skill.promptTuning` | empty string | Leave empty first | Add light style nudges without creating a full skill file | Cramming a full handbook into one short string |
|
|
245
|
+
|
|
246
|
+
How `hybridGenerate` actually works:
|
|
247
|
+
|
|
248
|
+
- if `commitMessage.input` is present and `hybridGenerate=false`, the CLI validates and uses the provided message directly
|
|
249
|
+
- if `commitMessage.input` is present and `hybridGenerate=true`, the CLI uses your draft as input to AI and returns a refined message
|
|
250
|
+
- if `commitMessage.input` is empty and `autoGenerate=true`, the CLI generates from the diff
|
|
251
|
+
- if `commitMessage.input` is empty and `autoGenerate=false`, the CLI errors because no message source exists
|
|
252
|
+
|
|
253
|
+
Supported validation protocols:
|
|
254
|
+
|
|
255
|
+
- `none`
|
|
256
|
+
- `conventional`
|
|
257
|
+
- `semantic`
|
|
258
|
+
- `gitmoji`
|
|
259
|
+
|
|
260
|
+
Supported built-in commit message skill ids:
|
|
261
|
+
|
|
262
|
+
- `conventional`
|
|
263
|
+
- `semantic`
|
|
264
|
+
- `gitmoji`
|
|
265
|
+
|
|
266
|
+
### `git.*`
|
|
267
|
+
|
|
268
|
+
These settings control whether the CLI changes Git state.
|
|
269
|
+
|
|
270
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
271
|
+
| --- | --- | --- | --- | --- |
|
|
272
|
+
| `git.autoStageWhenNothingStaged` | `true` | `true` for convenience or `false` for stricter control | Set `false` if your team wants users to explicitly stage exact files | Forgetting it is enabled and wondering why unstaged files were included |
|
|
273
|
+
| `git.autoCommit` | `true` | `false` | Set `true` only after review-only mode is stable | Leaving the default on during first rollout |
|
|
274
|
+
| `git.autoPush` | `true` | `false` | Set `true` only after your team accepts automatic push behavior | Letting first rollout push unexpectedly |
|
|
275
|
+
| `git.pushTimeoutMs` | `90000` | Leave default first | Increase it only if pushes are slow in your environment | Setting it below `5000`, which fails validation |
|
|
276
|
+
|
|
277
|
+
Practical rollout advice:
|
|
278
|
+
|
|
279
|
+
- if you care more about safety than convenience, keep both `autoCommit` and `autoPush` off
|
|
280
|
+
- if you care more about speed than strict staging hygiene, keep `autoStageWhenNothingStaged=true`
|
|
281
|
+
|
|
282
|
+
### `passHistory.*`
|
|
112
283
|
|
|
113
|
-
|
|
284
|
+
These settings control local storage for successful run history.
|
|
114
285
|
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
286
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
287
|
+
| --- | --- | --- | --- | --- |
|
|
288
|
+
| `passHistory.enabled` | `false` | `true` if you want reporting later | Turn it on when you want local historical reporting | Forgetting to enable it and then expecting `report generate` to summarize past work |
|
|
289
|
+
| `passHistory.dirPath` | empty string | Leave empty first or set `.smart-commit-cli` explicitly | Change it only if you want a custom location | Thinking empty means broken, when it actually falls back to the repo-local default directory |
|
|
290
|
+
| `passHistory.maxEntries` | `3000` | `3000` | Change it only if you need much shorter or longer retention | Setting it to `0` or a non-integer, which fails validation |
|
|
118
291
|
|
|
119
|
-
|
|
292
|
+
If `passHistory.dirPath` is empty, the CLI automatically stores pass history under the repository's `.smart-commit-cli` directory.
|
|
120
293
|
|
|
121
|
-
|
|
122
|
-
- `reporting.weekStartsOn`
|
|
123
|
-
- `reporting.outputDirPath`
|
|
124
|
-
- `reporting.prompt`
|
|
125
|
-
- `reporting.ai.enabled`
|
|
294
|
+
### `reporting.*`
|
|
126
295
|
|
|
127
|
-
|
|
296
|
+
These settings control report generation behavior.
|
|
128
297
|
|
|
129
|
-
-
|
|
130
|
-
|
|
298
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
299
|
+
| --- | --- | --- | --- | --- |
|
|
300
|
+
| `reporting.language` | `zh` | `zh` or `en` | Change it when your team wants report output in another language | Assuming this changes review or commit-message language too |
|
|
301
|
+
| `reporting.weekStartsOn` | `monday` | `monday` | Change it to `sunday` only if your reporting convention starts weeks on Sunday | Picking a week start different from your team's reporting habit |
|
|
302
|
+
| `reporting.outputDirPath` | empty string | Leave empty first | Change it only when you want reports in a different directory | Thinking empty means invalid, when it actually falls back to the repo-local default directory |
|
|
303
|
+
| `reporting.prompt` | empty string | Leave empty first | Add it when you want reports to emphasize business outcomes or another angle | Writing a very large prompt when a short focus instruction would do |
|
|
304
|
+
| `reporting.ai.enabled` | `false` | `false` first | Enable it when you want richer AI-rendered reports instead of local-only rendering | Turning it on before confirming connection settings are valid |
|
|
305
|
+
|
|
306
|
+
If `reporting.outputDirPath` is empty, the CLI writes reports to `.smart-commit-cli/reports` under the repository root.
|
|
307
|
+
|
|
308
|
+
### `output.*`
|
|
309
|
+
|
|
310
|
+
These settings control how results are presented.
|
|
311
|
+
|
|
312
|
+
| Field | Built-in default | Recommended first value | When to change it | Common mistake |
|
|
313
|
+
| --- | --- | --- | --- | --- |
|
|
314
|
+
| `output.format` | `json` | `json` for automation, `text` for interactive terminal use | Change it based on whether a human or a script will read stdout | Using `text` in a hook or script that expects structured JSON |
|
|
315
|
+
| `output.logLevel` | `info` | `info` | Use `debug` when diagnosing behavior, `warn` when you only want warnings and errors | Leaving `debug` on in normal automation and creating noisy logs |
|
|
316
|
+
|
|
317
|
+
## Supported Value Sets
|
|
318
|
+
|
|
319
|
+
These are the validated option sets enforced by the CLI.
|
|
320
|
+
|
|
321
|
+
### Languages
|
|
322
|
+
|
|
323
|
+
Supported output and commit-message languages:
|
|
324
|
+
|
|
325
|
+
- `zh`
|
|
326
|
+
- `en`
|
|
327
|
+
- `de`
|
|
328
|
+
- `fr`
|
|
329
|
+
- `es`
|
|
330
|
+
- `it`
|
|
331
|
+
- `pt`
|
|
332
|
+
- `tr`
|
|
333
|
+
- `id`
|
|
334
|
+
- `hi`
|
|
335
|
+
- `ru`
|
|
336
|
+
- `ko`
|
|
337
|
+
- `ja`
|
|
338
|
+
|
|
339
|
+
### Commit message validation protocols
|
|
340
|
+
|
|
341
|
+
- `none`
|
|
342
|
+
- `conventional`
|
|
343
|
+
- `semantic`
|
|
344
|
+
- `gitmoji`
|
|
345
|
+
|
|
346
|
+
### Report week start
|
|
347
|
+
|
|
348
|
+
- `monday`
|
|
349
|
+
- `sunday`
|
|
350
|
+
|
|
351
|
+
### Output format
|
|
352
|
+
|
|
353
|
+
- `json`
|
|
354
|
+
- `text`
|
|
355
|
+
|
|
356
|
+
### Log levels
|
|
357
|
+
|
|
358
|
+
- `debug`
|
|
359
|
+
- `info`
|
|
360
|
+
- `warn`
|
|
361
|
+
- `error`
|
|
131
362
|
|
|
132
363
|
## Common CLI Flags
|
|
133
364
|
|
|
134
|
-
Most
|
|
365
|
+
Most practical flags:
|
|
135
366
|
|
|
136
367
|
```bash
|
|
137
368
|
--repo
|
|
@@ -175,94 +406,127 @@ SMART_COMMIT_REPORT_LANGUAGE
|
|
|
175
406
|
SMART_COMMIT_REPORT_OUTPUT_DIR
|
|
176
407
|
```
|
|
177
408
|
|
|
178
|
-
|
|
409
|
+
Useful boolean environment variables accept:
|
|
179
410
|
|
|
180
|
-
|
|
411
|
+
- `true`
|
|
412
|
+
- `false`
|
|
413
|
+
- `1`
|
|
414
|
+
- `0`
|
|
181
415
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
"git": {
|
|
191
|
-
"autoCommit": false,
|
|
192
|
-
"autoPush": false
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
416
|
+
## Command-Specific Notes
|
|
417
|
+
|
|
418
|
+
### `config resolve`
|
|
419
|
+
|
|
420
|
+
Use this command to inspect the final merged config:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
smart-commit config resolve --config ./smart-commit.json
|
|
196
424
|
```
|
|
197
425
|
|
|
198
|
-
This
|
|
426
|
+
This is the fastest way to catch:
|
|
199
427
|
|
|
200
|
-
|
|
428
|
+
- missing environment variables
|
|
429
|
+
- invalid booleans or numbers
|
|
430
|
+
- invalid protocol values
|
|
431
|
+
- invalid regex patterns
|
|
432
|
+
- unsupported skill ids
|
|
201
433
|
|
|
202
|
-
|
|
434
|
+
### `bridge`
|
|
203
435
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"autoPush": false
|
|
216
|
-
},
|
|
217
|
-
"passHistory": {
|
|
218
|
-
"enabled": true,
|
|
219
|
-
"dirPath": ".smart-commit-cli",
|
|
220
|
-
"maxEntries": 3000
|
|
221
|
-
},
|
|
222
|
-
"output": {
|
|
223
|
-
"format": "json",
|
|
224
|
-
"logLevel": "info"
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
436
|
+
`bridge` requires:
|
|
437
|
+
|
|
438
|
+
- `--repo`
|
|
439
|
+
- a valid repository path inside Git
|
|
440
|
+
- a valid connection configuration
|
|
441
|
+
- staged changes, unless auto-stage makes input available
|
|
442
|
+
|
|
443
|
+
Safest first run:
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
smart-commit bridge --repo . --config ./smart-commit.json --no-commit --no-push
|
|
228
447
|
```
|
|
229
448
|
|
|
230
|
-
|
|
449
|
+
### `report generate`
|
|
231
450
|
|
|
232
|
-
`
|
|
451
|
+
`report generate` requires:
|
|
233
452
|
|
|
234
|
-
|
|
453
|
+
- `--repo`
|
|
454
|
+
- a valid repository path inside Git
|
|
235
455
|
|
|
236
|
-
|
|
237
|
-
- your team has custom commit-message style guidance
|
|
456
|
+
Supported periods:
|
|
238
457
|
|
|
239
|
-
`
|
|
458
|
+
- `daily`
|
|
459
|
+
- `weekly`
|
|
460
|
+
- `monthly`
|
|
461
|
+
- `quarterly`
|
|
462
|
+
- `yearly`
|
|
240
463
|
|
|
241
|
-
|
|
464
|
+
If `--period` is omitted, it defaults to `weekly`.
|
|
242
465
|
|
|
243
|
-
|
|
466
|
+
## Validation Workflow
|
|
244
467
|
|
|
245
|
-
|
|
246
|
-
- `output.format = "text"` for humans in the terminal
|
|
468
|
+
Before integrating the CLI into hooks or automation, use this sequence:
|
|
247
469
|
|
|
248
|
-
|
|
470
|
+
1. create or update `smart-commit.json`
|
|
471
|
+
2. run `smart-commit config resolve --config ./smart-commit.json`
|
|
472
|
+
3. run `smart-commit bridge --repo . --config ./smart-commit.json --dry-run`
|
|
473
|
+
4. run `smart-commit bridge --repo . --config ./smart-commit.json --no-commit --no-push`
|
|
474
|
+
5. only then consider enabling auto-commit or auto-push
|
|
249
475
|
|
|
250
|
-
|
|
251
|
-
- `output.logLevel = "info"` for normal use
|
|
252
|
-
- `output.logLevel = "warn"` when you only care about warnings and errors
|
|
476
|
+
This sequence catches configuration mistakes before they become Git side effects.
|
|
253
477
|
|
|
254
|
-
##
|
|
478
|
+
## Common Mistakes
|
|
255
479
|
|
|
256
|
-
|
|
480
|
+
### I set `env:SMART_COMMIT_API_KEY`, but validation fails
|
|
481
|
+
|
|
482
|
+
Make sure the environment variable exists in the same shell session:
|
|
257
483
|
|
|
258
484
|
```bash
|
|
259
|
-
|
|
485
|
+
export SMART_COMMIT_API_KEY="your-api-key"
|
|
260
486
|
```
|
|
261
487
|
|
|
262
|
-
|
|
488
|
+
### I expected `--config` to be mandatory everywhere
|
|
263
489
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
-
|
|
490
|
+
It is recommended, but not strictly required.
|
|
491
|
+
|
|
492
|
+
If omitted, the CLI still resolves from:
|
|
493
|
+
|
|
494
|
+
- CLI flags
|
|
495
|
+
- environment variables
|
|
496
|
+
- built-in defaults
|
|
497
|
+
|
|
498
|
+
Use `--config` whenever you want predictable, reusable team configuration.
|
|
499
|
+
|
|
500
|
+
### I enabled `autoCommit` or `autoPush` too early
|
|
501
|
+
|
|
502
|
+
For first rollout, keep this block safe:
|
|
503
|
+
|
|
504
|
+
```json
|
|
505
|
+
{
|
|
506
|
+
"smartCommitCli": {
|
|
507
|
+
"git": {
|
|
508
|
+
"autoCommit": false,
|
|
509
|
+
"autoPush": false
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
Then verify the workflow in review-only mode first.
|
|
516
|
+
|
|
517
|
+
### I still do not know what to change first
|
|
518
|
+
|
|
519
|
+
Use this order:
|
|
520
|
+
|
|
521
|
+
1. make `connection.baseUrl`, `connection.apiKey`, and `connection.model` valid
|
|
522
|
+
2. set `git.autoCommit=false`
|
|
523
|
+
3. set `git.autoPush=false`
|
|
524
|
+
4. leave everything else near the defaults
|
|
525
|
+
5. only tune `review.threshold`, languages, and reporting after you have one successful run
|
|
526
|
+
|
|
527
|
+
## Where To Go Next
|
|
528
|
+
|
|
529
|
+
- safe onboarding flow: [`getting-started.md`](./getting-started.md)
|
|
530
|
+
- broader CLI overview: [`../README.md`](../README.md)
|
|
531
|
+
- integration patterns: [`integrations.md`](./integrations.md)
|
|
532
|
+
- machine-facing contracts: [`contracts.md`](./contracts.md)
|
package/docs/contracts.md
CHANGED
|
@@ -60,6 +60,22 @@ Stable top-level fields:
|
|
|
60
60
|
- `summary`
|
|
61
61
|
- `error`
|
|
62
62
|
|
|
63
|
+
Stable nested fields often used by automations:
|
|
64
|
+
|
|
65
|
+
- `passHistory.eventType`
|
|
66
|
+
- `reviewDetails`
|
|
67
|
+
|
|
68
|
+
`passHistory.eventType` semantics:
|
|
69
|
+
|
|
70
|
+
- `review_passed`
|
|
71
|
+
Review passed, but no local commit was created because automatic commit is disabled.
|
|
72
|
+
- `commit_completed`
|
|
73
|
+
Review passed and a local commit was created, but no remote push was performed.
|
|
74
|
+
- `commit_push_completed`
|
|
75
|
+
Review passed, a local commit was created, and the current branch was pushed.
|
|
76
|
+
- `null`
|
|
77
|
+
Pass history is disabled or no pass-history record was written.
|
|
78
|
+
|
|
63
79
|
Status semantics:
|
|
64
80
|
|
|
65
81
|
- `ready`
|
|
@@ -112,6 +128,15 @@ Stable top-level fields:
|
|
|
112
128
|
- `summary`
|
|
113
129
|
- `error`
|
|
114
130
|
|
|
131
|
+
Important `facts.totals` fields:
|
|
132
|
+
|
|
133
|
+
- `reviewPassed`
|
|
134
|
+
Count of successful records whose final review decision is `pass`.
|
|
135
|
+
- `commitCompleted`
|
|
136
|
+
Count of records with `eventType = "commit_completed"`.
|
|
137
|
+
- `commitPushCompleted`
|
|
138
|
+
Count of records with `eventType = "commit_push_completed"`.
|
|
139
|
+
|
|
115
140
|
`renderMode` semantics:
|
|
116
141
|
|
|
117
142
|
- `local`
|
|
@@ -125,6 +150,7 @@ Recommended automation behavior:
|
|
|
125
150
|
|
|
126
151
|
- archive or upload `outputFilePath` on success
|
|
127
152
|
- inspect `warnings` when `renderMode` is `ai-fallback-local`
|
|
153
|
+
- use `facts.totals.commitCompleted` and `facts.totals.commitPushCompleted` separately if local commit completion and remote push completion need different downstream handling
|
|
128
154
|
- fail on `status: "error"`
|
|
129
155
|
|
|
130
156
|
## Versioning Guidance
|