smart-commit-copilot-cli 0.1.3 → 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 +13 -0
- package/README.md +484 -108
- package/docs/configuration.md +381 -127
- package/docs/getting-started.md +153 -42
- package/docs/publish.md +1 -1
- package/docs/releases/0.1.3-draft.md +1 -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/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,47 +1,274 @@
|
|
|
1
1
|
# smart-commit CLI
|
|
2
2
|
|
|
3
|
-
`smart-commit CLI` is a shell-first tool for
|
|
3
|
+
`smart-commit CLI` is a shell-first tool for AI-assisted commit review, commit-message generation, optional Git execution, and local reporting.
|
|
4
4
|
|
|
5
|
-
Use it when you want
|
|
5
|
+
Use it when you want one repeatable workflow that can run from:
|
|
6
|
+
|
|
7
|
+
- your terminal
|
|
8
|
+
- shell scripts
|
|
9
|
+
- Git hooks
|
|
10
|
+
- IDE hooks
|
|
11
|
+
- external agents
|
|
6
12
|
|
|
7
13
|
It can:
|
|
8
14
|
|
|
9
15
|
- inspect staged changes
|
|
16
|
+
- run AI review and gate on the result
|
|
10
17
|
- generate or validate commit messages
|
|
11
|
-
-
|
|
12
|
-
- optionally
|
|
13
|
-
- persist
|
|
14
|
-
- generate work reports
|
|
18
|
+
- optionally create a commit
|
|
19
|
+
- optionally push the current branch
|
|
20
|
+
- persist successful run history
|
|
21
|
+
- generate Markdown work reports
|
|
22
|
+
|
|
23
|
+
## Who This Is For
|
|
24
|
+
|
|
25
|
+
This tool is a good fit if you want to:
|
|
26
|
+
|
|
27
|
+
- review staged changes before committing
|
|
28
|
+
- standardize commit messages
|
|
29
|
+
- run the same workflow locally and in automation
|
|
30
|
+
- keep a lightweight history of successful review and commit runs
|
|
31
|
+
- generate periodic reports from local pass history
|
|
32
|
+
|
|
33
|
+
If you are using this for the first time, start with review-only mode and keep Git side effects disabled until you trust the workflow.
|
|
34
|
+
|
|
35
|
+
## What Happens In A Typical Run
|
|
36
|
+
|
|
37
|
+
At a high level, `smart-commit bridge` does this:
|
|
38
|
+
|
|
39
|
+
1. loads config from CLI flags, environment variables, config file, and defaults
|
|
40
|
+
2. resolves `env:VAR_NAME` references such as `env:SMART_COMMIT_API_KEY`
|
|
41
|
+
3. verifies the target `--repo` path is inside a Git repository
|
|
42
|
+
4. reads the staged diff, or auto-stages if your config allows it
|
|
43
|
+
5. runs AI review
|
|
44
|
+
6. generates or validates the commit message
|
|
45
|
+
7. optionally commits and pushes
|
|
46
|
+
8. optionally records the successful run into pass history
|
|
47
|
+
|
|
48
|
+
```mermaid
|
|
49
|
+
flowchart TD
|
|
50
|
+
InstallCli[InstallCLI] --> PrepareConfig[PrepareConfig]
|
|
51
|
+
PrepareConfig --> ResolveConfig[RunConfigResolve]
|
|
52
|
+
ResolveConfig --> StageChanges[StageChanges]
|
|
53
|
+
StageChanges --> DryRun[RunBridgeDryRun]
|
|
54
|
+
DryRun --> ReviewOnly[RunReviewOnly]
|
|
55
|
+
ReviewOnly --> FullRun[OptionalFullRun]
|
|
56
|
+
FullRun --> ReportGenerate[OptionalReportGenerate]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Prerequisites
|
|
60
|
+
|
|
61
|
+
Before you run the CLI, make sure you have:
|
|
62
|
+
|
|
63
|
+
- `Node.js >= 20`
|
|
64
|
+
- `git` available in your shell
|
|
65
|
+
- a Git repository to operate on
|
|
66
|
+
- staged changes for `bridge`, unless auto-stage is enabled
|
|
67
|
+
- an OpenAI-compatible API endpoint, model, and API key for AI-backed commands
|
|
68
|
+
|
|
69
|
+
Important command requirements:
|
|
70
|
+
|
|
71
|
+
- `smart-commit bridge` requires `--repo`
|
|
72
|
+
- `smart-commit report generate` requires `--repo`
|
|
73
|
+
- `smart-commit config resolve` does not require `--repo`
|
|
74
|
+
- `smart-commit config resolve` can validate config structure without a complete connection block
|
|
75
|
+
- `smart-commit bridge` requires a valid connection configuration
|
|
76
|
+
|
|
77
|
+
## Install
|
|
15
78
|
|
|
16
|
-
Install
|
|
79
|
+
Install globally:
|
|
17
80
|
|
|
18
81
|
```bash
|
|
19
82
|
npm install -g smart-commit-copilot-cli
|
|
20
83
|
```
|
|
21
84
|
|
|
22
|
-
|
|
85
|
+
Then verify:
|
|
23
86
|
|
|
24
87
|
```bash
|
|
25
88
|
smart-commit --help
|
|
26
89
|
```
|
|
27
90
|
|
|
28
|
-
Or use `npx`
|
|
91
|
+
Or use `npx` without a global install:
|
|
29
92
|
|
|
30
93
|
```bash
|
|
31
94
|
npx smart-commit-copilot-cli --help
|
|
32
95
|
```
|
|
33
96
|
|
|
34
|
-
|
|
97
|
+
If you are working from a repository checkout of this project:
|
|
35
98
|
|
|
36
|
-
|
|
99
|
+
```bash
|
|
100
|
+
npm install
|
|
101
|
+
npm run build
|
|
102
|
+
node out/cli.js --help
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 5-Minute Quick Start
|
|
106
|
+
|
|
107
|
+
This section is the safest first-use path for a real repository.
|
|
108
|
+
|
|
109
|
+
### 1. Export your API key
|
|
37
110
|
|
|
38
111
|
```bash
|
|
39
112
|
export SMART_COMMIT_API_KEY="your-api-key"
|
|
40
113
|
```
|
|
41
114
|
|
|
42
|
-
|
|
115
|
+
Why this matters:
|
|
116
|
+
|
|
117
|
+
- the config examples below use `env:SMART_COMMIT_API_KEY`
|
|
118
|
+
- environment references are resolved before validation
|
|
119
|
+
- if the variable is missing, `bridge` cannot start
|
|
120
|
+
|
|
121
|
+
### 2. Create a minimal config file
|
|
122
|
+
|
|
123
|
+
Create `smart-commit.json` in your target repository:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"smartCommitCli": {
|
|
128
|
+
"connection": {
|
|
129
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
130
|
+
"apiKey": "env:SMART_COMMIT_API_KEY",
|
|
131
|
+
"model": "gpt-5"
|
|
132
|
+
},
|
|
133
|
+
"git": {
|
|
134
|
+
"autoCommit": false,
|
|
135
|
+
"autoPush": false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The three connection fields are the most important:
|
|
142
|
+
|
|
143
|
+
- `connection.baseUrl`: your OpenAI-compatible API base URL
|
|
144
|
+
- `connection.apiKey`: your API key, usually referenced through `env:...`
|
|
145
|
+
- `connection.model`: the model name sent to that endpoint
|
|
146
|
+
|
|
147
|
+
This minimal config is intentionally safe:
|
|
148
|
+
|
|
149
|
+
- `autoCommit=false` prevents local commits
|
|
150
|
+
- `autoPush=false` prevents remote pushes
|
|
151
|
+
|
|
152
|
+
### 3. Validate the merged config first
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
smart-commit config resolve --config ./smart-commit.json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Why start here:
|
|
159
|
+
|
|
160
|
+
- it shows the final merged config after CLI args, env vars, file config, and defaults
|
|
161
|
+
- it redacts secrets in output
|
|
162
|
+
- it catches validation problems before the CLI touches Git or the network
|
|
163
|
+
|
|
164
|
+
For a more readable terminal view:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
smart-commit config resolve --config ./smart-commit.json --output text
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
What you should expect:
|
|
171
|
+
|
|
172
|
+
- a valid merged config
|
|
173
|
+
- no missing environment variable errors
|
|
174
|
+
- no invalid booleans, regex patterns, or protocol settings
|
|
175
|
+
|
|
176
|
+
### 4. Stage a change
|
|
177
|
+
|
|
178
|
+
`bridge` works on staged content.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
git add -A
|
|
182
|
+
git status --short
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If nothing is staged and `autoStageWhenNothingStaged` is disabled, `bridge` will block.
|
|
186
|
+
|
|
187
|
+
### 5. Run a safe preflight
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
smart-commit bridge --repo . --config ./smart-commit.json --dry-run
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Why this step matters:
|
|
194
|
+
|
|
195
|
+
- it verifies the repo path
|
|
196
|
+
- it checks whether the repo is inside Git
|
|
197
|
+
- it checks whether staged diff input exists
|
|
198
|
+
- it validates that commit-message logic can be resolved
|
|
199
|
+
- it confirms the bridge input is ready
|
|
200
|
+
|
|
201
|
+
What you should expect:
|
|
202
|
+
|
|
203
|
+
- `status: "ready"` when the bridge can run
|
|
204
|
+
- `status: "blocked"` when the repo is valid but required input is missing
|
|
205
|
+
- `status: "error"` when config or runtime setup is invalid
|
|
206
|
+
|
|
207
|
+
For a terminal-friendly version:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
smart-commit bridge --repo . --config ./smart-commit.json --dry-run --output text
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 6. Run review-only mode
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
smart-commit bridge --repo . --config ./smart-commit.json --no-commit --no-push
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
This is the recommended first real run because it:
|
|
220
|
+
|
|
221
|
+
- runs review
|
|
222
|
+
- runs commit-message logic
|
|
223
|
+
- returns structured output
|
|
224
|
+
- avoids Git side effects
|
|
225
|
+
|
|
226
|
+
What you should expect:
|
|
227
|
+
|
|
228
|
+
- `status: "passed"` if the review passes
|
|
229
|
+
- `status: "blocked"` if the review blocks or required input is missing
|
|
230
|
+
- `status: "error"` if execution fails
|
|
231
|
+
|
|
232
|
+
When the review returns a numeric score, the final pass or block result is determined by comparing that score with `review.threshold`.
|
|
233
|
+
|
|
234
|
+
### Shortest safe path
|
|
235
|
+
|
|
236
|
+
If you want the shortest sequence to first success:
|
|
237
|
+
|
|
238
|
+
1. install `smart-commit-copilot-cli`
|
|
239
|
+
2. export `SMART_COMMIT_API_KEY`
|
|
240
|
+
3. create `smart-commit.json`
|
|
241
|
+
4. run `smart-commit config resolve`
|
|
242
|
+
5. run `smart-commit bridge --dry-run`
|
|
243
|
+
6. run `smart-commit bridge --no-commit --no-push`
|
|
244
|
+
|
|
245
|
+
## Configuration Examples
|
|
246
|
+
|
|
247
|
+
### Minimal practical config
|
|
248
|
+
|
|
249
|
+
Use this when you want the smallest useful starting point:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"smartCommitCli": {
|
|
254
|
+
"connection": {
|
|
255
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
256
|
+
"apiKey": "env:SMART_COMMIT_API_KEY",
|
|
257
|
+
"model": "gpt-5"
|
|
258
|
+
},
|
|
259
|
+
"git": {
|
|
260
|
+
"autoCommit": false,
|
|
261
|
+
"autoPush": false
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
This gives you a safe review-first setup.
|
|
268
|
+
|
|
269
|
+
### Safer team rollout config
|
|
43
270
|
|
|
44
|
-
|
|
271
|
+
Use this when you want a more realistic team default without enabling automatic commit or push:
|
|
45
272
|
|
|
46
273
|
```json
|
|
47
274
|
{
|
|
@@ -55,17 +282,6 @@ Create `smart-commit.json` in your repository:
|
|
|
55
282
|
"threshold": 6,
|
|
56
283
|
"language": "zh"
|
|
57
284
|
},
|
|
58
|
-
"commitMessage": {
|
|
59
|
-
"language": "zh",
|
|
60
|
-
"autoGenerate": true,
|
|
61
|
-
"hybridGenerate": false,
|
|
62
|
-
"validation": {
|
|
63
|
-
"protocol": "none",
|
|
64
|
-
"pattern": "",
|
|
65
|
-
"extractTicketIdFromBranch": true,
|
|
66
|
-
"requireTicketIdInMessage": false
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
285
|
"git": {
|
|
70
286
|
"autoStageWhenNothingStaged": true,
|
|
71
287
|
"autoCommit": false,
|
|
@@ -76,15 +292,6 @@ Create `smart-commit.json` in your repository:
|
|
|
76
292
|
"dirPath": ".smart-commit-cli",
|
|
77
293
|
"maxEntries": 3000
|
|
78
294
|
},
|
|
79
|
-
"reporting": {
|
|
80
|
-
"language": "zh",
|
|
81
|
-
"weekStartsOn": "monday",
|
|
82
|
-
"outputDirPath": ".smart-commit-cli/reports",
|
|
83
|
-
"prompt": "",
|
|
84
|
-
"ai": {
|
|
85
|
-
"enabled": false
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
295
|
"output": {
|
|
89
296
|
"format": "json",
|
|
90
297
|
"logLevel": "info"
|
|
@@ -93,73 +300,142 @@ Create `smart-commit.json` in your repository:
|
|
|
93
300
|
}
|
|
94
301
|
```
|
|
95
302
|
|
|
96
|
-
|
|
303
|
+
This is usually the best starting point for teams because it:
|
|
304
|
+
|
|
305
|
+
- keeps the workflow review-first
|
|
306
|
+
- allows local history for reporting
|
|
307
|
+
- stays safe for hooks and automation
|
|
308
|
+
|
|
309
|
+
### About the example config in this repo
|
|
310
|
+
|
|
311
|
+
This repository ships a fuller example at `examples/config/smart-commit.json`.
|
|
312
|
+
|
|
313
|
+
That example is useful for learning the whole config surface, but note that it enables:
|
|
314
|
+
|
|
315
|
+
- `git.autoCommit = true`
|
|
316
|
+
- `git.autoPush = true`
|
|
317
|
+
|
|
318
|
+
For first use, do not copy those values blindly. Start with `false` for both and enable them later only if you want the CLI to own those Git side effects.
|
|
319
|
+
|
|
320
|
+
## Choose The Right Command
|
|
321
|
+
|
|
322
|
+
Instead of memorizing every command, use this section by intent.
|
|
323
|
+
|
|
324
|
+
### I want to verify my config
|
|
97
325
|
|
|
98
326
|
```bash
|
|
99
327
|
smart-commit config resolve --config ./smart-commit.json
|
|
100
328
|
```
|
|
101
329
|
|
|
102
|
-
|
|
330
|
+
Use this when you want to:
|
|
331
|
+
|
|
332
|
+
- inspect the merged config
|
|
333
|
+
- confirm env var resolution
|
|
334
|
+
- catch validation issues early
|
|
335
|
+
|
|
336
|
+
Good to know:
|
|
103
337
|
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
338
|
+
- `--config` is recommended, not required
|
|
339
|
+
- if you omit `--config`, the CLI uses CLI flags, env vars, and built-in defaults
|
|
340
|
+
- `config resolve` is the safest first command
|
|
107
341
|
|
|
108
|
-
|
|
342
|
+
### I want to see whether `bridge` is ready
|
|
109
343
|
|
|
110
344
|
```bash
|
|
111
|
-
smart-commit
|
|
345
|
+
smart-commit bridge --repo . --config ./smart-commit.json --dry-run
|
|
112
346
|
```
|
|
113
347
|
|
|
114
|
-
|
|
348
|
+
Use this when you want to:
|
|
115
349
|
|
|
116
|
-
|
|
350
|
+
- validate repo and staged diff readiness
|
|
351
|
+
- confirm commit-message logic can resolve
|
|
352
|
+
- avoid a real AI review or Git side effects
|
|
353
|
+
|
|
354
|
+
### I want review only, with no commit or push
|
|
117
355
|
|
|
118
356
|
```bash
|
|
119
|
-
|
|
357
|
+
smart-commit bridge --repo . --config ./smart-commit.json --no-commit --no-push
|
|
120
358
|
```
|
|
121
359
|
|
|
122
|
-
|
|
360
|
+
Use this when you want to:
|
|
361
|
+
|
|
362
|
+
- review staged changes
|
|
363
|
+
- generate or validate a commit message
|
|
364
|
+
- integrate with hooks safely
|
|
365
|
+
- onboard the CLI without touching Git history
|
|
366
|
+
|
|
367
|
+
### I want a full bridge run
|
|
123
368
|
|
|
124
369
|
```bash
|
|
125
|
-
smart-commit bridge --repo . --config ./smart-commit.json
|
|
370
|
+
smart-commit bridge --repo . --config ./smart-commit.json
|
|
126
371
|
```
|
|
127
372
|
|
|
128
|
-
|
|
373
|
+
Use this only when your config intentionally allows the desired side effects.
|
|
129
374
|
|
|
130
|
-
|
|
131
|
-
- current directory is inside Git
|
|
132
|
-
- staged diff exists, or whether auto-stage would happen
|
|
133
|
-
- commit message can be resolved
|
|
134
|
-
- bridge input is ready for execution
|
|
375
|
+
Depending on config, the CLI may:
|
|
135
376
|
|
|
136
|
-
|
|
377
|
+
- review only
|
|
378
|
+
- review and create a local commit
|
|
379
|
+
- review, commit, and push
|
|
137
380
|
|
|
138
|
-
|
|
381
|
+
### I want to generate a report
|
|
139
382
|
|
|
140
383
|
```bash
|
|
141
|
-
smart-commit
|
|
384
|
+
smart-commit report generate --repo . --config ./smart-commit.json --period weekly
|
|
142
385
|
```
|
|
143
386
|
|
|
144
|
-
|
|
387
|
+
Supported `--period` values:
|
|
145
388
|
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
389
|
+
- `daily`
|
|
390
|
+
- `weekly`
|
|
391
|
+
- `monthly`
|
|
392
|
+
- `quarterly`
|
|
393
|
+
- `yearly`
|
|
150
394
|
|
|
151
|
-
|
|
395
|
+
If you omit `--period`, it defaults to `weekly`.
|
|
152
396
|
|
|
153
|
-
If
|
|
397
|
+
If `passHistory.enabled=true`, successful bridge runs are written locally and later summarized into a Markdown report.
|
|
154
398
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
399
|
+
Optional AI-enhanced reporting:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
smart-commit report generate --repo . --config ./smart-commit.json --period weekly --report-ai
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
If AI report generation fails, the CLI falls back to local Markdown generation automatically.
|
|
406
|
+
|
|
407
|
+
### I want machine-readable schemas
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
smart-commit schema print --target bridge
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Supported schema targets:
|
|
414
|
+
|
|
415
|
+
- `config-file`
|
|
416
|
+
- `config-resolve`
|
|
417
|
+
- `bridge`
|
|
418
|
+
- `report-generate`
|
|
419
|
+
|
|
420
|
+
Examples:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
smart-commit schema print --target config-file
|
|
424
|
+
smart-commit schema print --target config-resolve
|
|
425
|
+
smart-commit schema print --target bridge
|
|
426
|
+
smart-commit schema print --target report-generate
|
|
427
|
+
```
|
|
161
428
|
|
|
162
|
-
## Core Commands
|
|
429
|
+
## Core Commands Reference
|
|
430
|
+
|
|
431
|
+
### Help and version
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
smart-commit --help
|
|
435
|
+
smart-commit help
|
|
436
|
+
smart-commit --version
|
|
437
|
+
smart-commit version
|
|
438
|
+
```
|
|
163
439
|
|
|
164
440
|
### Resolve config
|
|
165
441
|
|
|
@@ -191,7 +467,7 @@ smart-commit bridge --repo . --config ./smart-commit.json
|
|
|
191
467
|
smart-commit report generate --repo . --config ./smart-commit.json --period weekly
|
|
192
468
|
```
|
|
193
469
|
|
|
194
|
-
### Print
|
|
470
|
+
### Print a schema
|
|
195
471
|
|
|
196
472
|
```bash
|
|
197
473
|
smart-commit schema print --target bridge
|
|
@@ -199,13 +475,13 @@ smart-commit schema print --target bridge
|
|
|
199
475
|
|
|
200
476
|
## Output Modes
|
|
201
477
|
|
|
202
|
-
Default
|
|
478
|
+
Default output is machine-facing JSON:
|
|
203
479
|
|
|
204
480
|
```bash
|
|
205
481
|
smart-commit bridge --repo . --config ./smart-commit.json
|
|
206
482
|
```
|
|
207
483
|
|
|
208
|
-
For a
|
|
484
|
+
For a human-friendly terminal summary:
|
|
209
485
|
|
|
210
486
|
```bash
|
|
211
487
|
smart-commit bridge --repo . --config ./smart-commit.json --output text
|
|
@@ -213,8 +489,38 @@ smart-commit bridge --repo . --config ./smart-commit.json --output text
|
|
|
213
489
|
|
|
214
490
|
Recommended usage:
|
|
215
491
|
|
|
216
|
-
- use
|
|
217
|
-
- use text for
|
|
492
|
+
- use `json` for hooks, agents, and scripts
|
|
493
|
+
- use `text` for local debugging
|
|
494
|
+
|
|
495
|
+
For machine integrations, the usual pattern is:
|
|
496
|
+
|
|
497
|
+
- call `smart-commit bridge` or `smart-commit report generate`
|
|
498
|
+
- consume stdout as JSON
|
|
499
|
+
- branch on `schemaVersion`, `status`, and `error.code`
|
|
500
|
+
|
|
501
|
+
## Exit Codes
|
|
502
|
+
|
|
503
|
+
These are especially useful in shell scripts, hooks, and automation.
|
|
504
|
+
|
|
505
|
+
### `bridge`
|
|
506
|
+
|
|
507
|
+
- `0`: success
|
|
508
|
+
- `2`: blocked
|
|
509
|
+
- `3`: config error
|
|
510
|
+
- `4`: runtime error
|
|
511
|
+
|
|
512
|
+
Typical interpretation:
|
|
513
|
+
|
|
514
|
+
- `0` means the run completed successfully
|
|
515
|
+
- `2` means the change set or review result blocked progress
|
|
516
|
+
- `3` means your config or CLI input is invalid
|
|
517
|
+
- `4` means runtime execution failed
|
|
518
|
+
|
|
519
|
+
### `report generate`
|
|
520
|
+
|
|
521
|
+
- `0`: success
|
|
522
|
+
- `3`: config error
|
|
523
|
+
- `4`: runtime error
|
|
218
524
|
|
|
219
525
|
## Configuration Rules
|
|
220
526
|
|
|
@@ -233,29 +539,57 @@ Special rule:
|
|
|
233
539
|
Canonical format:
|
|
234
540
|
|
|
235
541
|
- `smartCommitCli` is the recommended long-term format
|
|
236
|
-
- legacy `smartCommit.*` is
|
|
542
|
+
- legacy `smartCommit.*` is still accepted for migration
|
|
237
543
|
|
|
238
|
-
##
|
|
544
|
+
## Common CLI Flags
|
|
239
545
|
|
|
240
|
-
|
|
546
|
+
Most practical flags for daily use:
|
|
241
547
|
|
|
242
|
-
|
|
548
|
+
```bash
|
|
549
|
+
--repo
|
|
550
|
+
--config
|
|
551
|
+
--output
|
|
552
|
+
--base-url
|
|
553
|
+
--api-key
|
|
554
|
+
--model
|
|
555
|
+
--threshold
|
|
556
|
+
--review-language
|
|
557
|
+
--commit-language
|
|
558
|
+
--commit-message
|
|
559
|
+
--no-commit
|
|
560
|
+
--no-push
|
|
561
|
+
--dry-run
|
|
562
|
+
```
|
|
243
563
|
|
|
244
|
-
|
|
245
|
-
- editor or IDE hook workflows
|
|
246
|
-
- external agent workflows
|
|
247
|
-
- local automation scripts
|
|
248
|
-
- CI or scheduled reporting flows
|
|
564
|
+
Common reporting flags:
|
|
249
565
|
|
|
250
|
-
|
|
566
|
+
```bash
|
|
567
|
+
--period
|
|
568
|
+
--report-language
|
|
569
|
+
--report-output-dir
|
|
570
|
+
--report-ai
|
|
571
|
+
```
|
|
251
572
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
573
|
+
## Common Environment Variables
|
|
574
|
+
|
|
575
|
+
Most practical ones:
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
SMART_COMMIT_API_KEY
|
|
579
|
+
SMART_COMMIT_BASE_URL
|
|
580
|
+
SMART_COMMIT_MODEL
|
|
581
|
+
SMART_COMMIT_THRESHOLD
|
|
582
|
+
SMART_COMMIT_REVIEW_LANGUAGE
|
|
583
|
+
SMART_COMMIT_COMMIT_LANGUAGE
|
|
584
|
+
SMART_COMMIT_AUTO_COMMIT
|
|
585
|
+
SMART_COMMIT_AUTO_PUSH
|
|
586
|
+
SMART_COMMIT_REPORT_LANGUAGE
|
|
587
|
+
SMART_COMMIT_REPORT_OUTPUT_DIR
|
|
588
|
+
```
|
|
255
589
|
|
|
256
590
|
## Reporting
|
|
257
591
|
|
|
258
|
-
If `passHistory.enabled=true`, successful runs are written to local history and can be summarized later:
|
|
592
|
+
If `passHistory.enabled=true`, successful bridge runs are written to local history and can be summarized later:
|
|
259
593
|
|
|
260
594
|
```bash
|
|
261
595
|
smart-commit report generate --repo . --config ./smart-commit.json --period weekly
|
|
@@ -263,38 +597,27 @@ smart-commit report generate --repo . --config ./smart-commit.json --period week
|
|
|
263
597
|
|
|
264
598
|
Successful bridge runs are categorized in pass history as:
|
|
265
599
|
|
|
266
|
-
- `review_passed
|
|
267
|
-
|
|
268
|
-
- `
|
|
269
|
-
A local commit was created, but automatic push is disabled.
|
|
270
|
-
- `commit_push_completed`
|
|
271
|
-
A local commit was created and the current branch was pushed.
|
|
600
|
+
- `review_passed`: review passed, but automatic commit is disabled
|
|
601
|
+
- `commit_completed`: a local commit was created, but automatic push is disabled
|
|
602
|
+
- `commit_push_completed`: a local commit was created and the current branch was pushed
|
|
272
603
|
|
|
273
604
|
Report summaries use these records to show:
|
|
274
605
|
|
|
275
606
|
- total successful review passes
|
|
276
607
|
- local commit completions
|
|
277
|
-
- commit
|
|
608
|
+
- commit and push completions
|
|
278
609
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
smart-commit report generate --repo . --config ./smart-commit.json --period weekly --report-ai
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
If AI generation fails, the CLI falls back to local Markdown automatically.
|
|
286
|
-
|
|
287
|
-
## Troubleshooting
|
|
610
|
+
## Common First-Time Mistakes
|
|
288
611
|
|
|
289
612
|
### `connection.apiKey references missing environment variable`
|
|
290
613
|
|
|
291
|
-
Your config contains:
|
|
614
|
+
Your config contains something like:
|
|
292
615
|
|
|
293
616
|
```json
|
|
294
617
|
"apiKey": "env:SMART_COMMIT_API_KEY"
|
|
295
618
|
```
|
|
296
619
|
|
|
297
|
-
but the environment variable is not set.
|
|
620
|
+
but the environment variable is not set in the current shell.
|
|
298
621
|
|
|
299
622
|
Fix:
|
|
300
623
|
|
|
@@ -304,7 +627,13 @@ export SMART_COMMIT_API_KEY="your-api-key"
|
|
|
304
627
|
|
|
305
628
|
### `--repo is required`
|
|
306
629
|
|
|
307
|
-
`bridge` and `report generate` require a repository path or a path inside a Git repository.
|
|
630
|
+
`bridge` and `report generate` require a repository path, or a path inside a Git repository.
|
|
631
|
+
|
|
632
|
+
Typical fix:
|
|
633
|
+
|
|
634
|
+
```bash
|
|
635
|
+
smart-commit bridge --repo . --config ./smart-commit.json --dry-run
|
|
636
|
+
```
|
|
308
637
|
|
|
309
638
|
### No staged diff found
|
|
310
639
|
|
|
@@ -321,12 +650,59 @@ git add -A
|
|
|
321
650
|
smart-commit bridge --repo . --config ./smart-commit.json --dry-run
|
|
322
651
|
```
|
|
323
652
|
|
|
653
|
+
### I expected the config file to be auto-loaded
|
|
654
|
+
|
|
655
|
+
If you omit `--config`, the CLI does not magically discover every possible file name. It uses CLI flags, environment variables, and built-in defaults.
|
|
656
|
+
|
|
657
|
+
If you want a specific config file to participate in resolution, pass it explicitly:
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
smart-commit config resolve --config ./smart-commit.json
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### I accidentally enabled auto-commit or auto-push too early
|
|
664
|
+
|
|
665
|
+
If your config or env vars enable `git.autoCommit` or `git.autoPush`, `bridge` may create side effects during a full run.
|
|
666
|
+
|
|
667
|
+
For first rollout, keep these disabled:
|
|
668
|
+
|
|
669
|
+
```json
|
|
670
|
+
{
|
|
671
|
+
"smartCommitCli": {
|
|
672
|
+
"git": {
|
|
673
|
+
"autoCommit": false,
|
|
674
|
+
"autoPush": false
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
Then use:
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
smart-commit bridge --repo . --config ./smart-commit.json --no-commit --no-push
|
|
684
|
+
```
|
|
685
|
+
|
|
324
686
|
## Recommended First Rollout
|
|
325
687
|
|
|
326
|
-
|
|
688
|
+
For a new team or repository, use this order:
|
|
689
|
+
|
|
690
|
+
1. create a minimal or safer team config
|
|
327
691
|
2. run `smart-commit config resolve`
|
|
328
692
|
3. run `smart-commit bridge --dry-run`
|
|
329
693
|
4. run `smart-commit bridge --no-commit --no-push`
|
|
330
|
-
5. embed the same command into your automation flow
|
|
694
|
+
5. embed the same review-only command into your hook or automation flow
|
|
331
695
|
6. enable pass history
|
|
332
696
|
7. add reporting
|
|
697
|
+
8. only then consider automatic commit or push
|
|
698
|
+
|
|
699
|
+
This sequence keeps the first rollout safe while still letting you validate the entire workflow.
|
|
700
|
+
|
|
701
|
+
## Where To Go Deeper
|
|
702
|
+
|
|
703
|
+
For deeper detail after the first successful run:
|
|
704
|
+
|
|
705
|
+
- getting started from source: [`docs/getting-started.md`](./docs/getting-started.md)
|
|
706
|
+
- configuration details: [`docs/configuration.md`](./docs/configuration.md)
|
|
707
|
+
- integration patterns: [`docs/integrations.md`](./docs/integrations.md)
|
|
708
|
+
- machine-facing contracts: [`docs/contracts.md`](./docs/contracts.md)
|