smart-commit-copilot-cli 0.1.6 → 0.1.8

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +46 -4
  3. package/docs/configuration.md +99 -7
  4. package/docs/contracts.md +68 -2
  5. package/docs/getting-started.md +4 -1
  6. package/docs/publish.md +1 -1
  7. package/docs/releases/0.1.7-draft.md +55 -0
  8. package/docs/releases/0.1.8-draft.md +80 -0
  9. package/docs/roadmap.md +1 -1
  10. package/docs/verification.md +1 -0
  11. package/examples/config/smart-commit.json +32 -5
  12. package/out/cliApp.js +53 -6
  13. package/out/cliApp.js.map +1 -1
  14. package/out/commands/bridge.js +189 -6
  15. package/out/commands/bridge.js.map +1 -1
  16. package/out/commands/pullRequest.js +176 -0
  17. package/out/commands/pullRequest.js.map +1 -0
  18. package/out/commitMessage/index.js +2 -1
  19. package/out/commitMessage/index.js.map +1 -1
  20. package/out/commitMessage/prompt.js +58 -10
  21. package/out/commitMessage/prompt.js.map +1 -1
  22. package/out/commitMessage/protocol.js +168 -16
  23. package/out/commitMessage/protocol.js.map +1 -1
  24. package/out/config/cliArgs.js +114 -0
  25. package/out/config/cliArgs.js.map +1 -1
  26. package/out/config/constants.js +10 -1
  27. package/out/config/constants.js.map +1 -1
  28. package/out/config/env.js +90 -0
  29. package/out/config/env.js.map +1 -1
  30. package/out/config/file.js +113 -0
  31. package/out/config/file.js.map +1 -1
  32. package/out/config/legacySmartCommit.js +118 -9
  33. package/out/config/legacySmartCommit.js.map +1 -1
  34. package/out/config/merge.js +18 -0
  35. package/out/config/merge.js.map +1 -1
  36. package/out/config/schema.js +79 -7
  37. package/out/config/schema.js.map +1 -1
  38. package/out/contracts.js +174 -7
  39. package/out/contracts.js.map +1 -1
  40. package/out/git.js +108 -2
  41. package/out/git.js.map +1 -1
  42. package/out/output.js +4 -0
  43. package/out/output.js.map +1 -1
  44. package/out/pullRequest/api.js +528 -0
  45. package/out/pullRequest/api.js.map +1 -0
  46. package/out/pullRequest/client.js +17 -0
  47. package/out/pullRequest/client.js.map +1 -0
  48. package/out/pullRequest/config.js +18 -0
  49. package/out/pullRequest/config.js.map +1 -0
  50. package/out/pullRequest/contentPrompt.js +116 -0
  51. package/out/pullRequest/contentPrompt.js.map +1 -0
  52. package/out/pullRequest/contentService.js +77 -0
  53. package/out/pullRequest/contentService.js.map +1 -0
  54. package/out/pullRequest/index.js +25 -0
  55. package/out/pullRequest/index.js.map +1 -0
  56. package/out/pullRequest/platform.js +101 -0
  57. package/out/pullRequest/platform.js.map +1 -0
  58. package/out/pullRequest/redact.js +15 -0
  59. package/out/pullRequest/redact.js.map +1 -0
  60. package/out/pullRequest/workflow.js +153 -0
  61. package/out/pullRequest/workflow.js.map +1 -0
  62. package/out/renderOutput.js +31 -1
  63. package/out/renderOutput.js.map +1 -1
  64. package/out/reporting/aggregate.js +1 -1
  65. package/out/reporting/aggregate.js.map +1 -1
  66. package/out/reporting/mockProvider.js +5 -1
  67. package/out/reporting/mockProvider.js.map +1 -1
  68. package/out/reporting/openaiProvider.js +5 -1
  69. package/out/reporting/openaiProvider.js.map +1 -1
  70. package/out/reporting/prompt.js +145 -20
  71. package/out/reporting/prompt.js.map +1 -1
  72. package/out/reporting/render.js +24 -22
  73. package/out/reporting/render.js.map +1 -1
  74. package/out/reporting/timeWindow.js +101 -36
  75. package/out/reporting/timeWindow.js.map +1 -1
  76. package/out/reporting/types.js +3 -0
  77. package/out/reporting/types.js.map +1 -1
  78. package/out/review/mockProvider.js +25 -1
  79. package/out/review/mockProvider.js.map +1 -1
  80. package/out/stagedChangeSummary/index.js +53 -0
  81. package/out/stagedChangeSummary/index.js.map +1 -0
  82. package/out/stagedChangeSummary/mockProvider.js +24 -0
  83. package/out/stagedChangeSummary/mockProvider.js.map +1 -0
  84. package/out/stagedChangeSummary/openaiProvider.js +19 -0
  85. package/out/stagedChangeSummary/openaiProvider.js.map +1 -0
  86. package/out/stagedChangeSummary/prompt.js +138 -0
  87. package/out/stagedChangeSummary/prompt.js.map +1 -0
  88. package/out/stagedChangeSummary/provider.js +3 -0
  89. package/out/stagedChangeSummary/provider.js.map +1 -0
  90. package/out/stagedChangeSummary/render.js +74 -0
  91. package/out/stagedChangeSummary/render.js.map +1 -0
  92. package/package.json +1 -1
  93. package/src/git-commit-message-skills/conventional/SKILL.md +3 -3
  94. package/src/git-commit-message-skills/gitmoji/SKILL.md +3 -3
  95. package/src/git-commit-message-skills/semantic/SKILL.md +3 -3
package/CHANGELOG.md CHANGED
@@ -6,6 +6,48 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.8] - 2026-05-21
10
+
11
+ ### Added
12
+
13
+ - `smart-commit pull-request create` command for GitHub pull request and GitLab merge request creation from the current branch
14
+ - bridge auto PR/MR creation after successful push via `pullRequest.autoCreateAfterPush`
15
+ - `pull-request-create` schema target and structured `pullRequestCreation` bridge output
16
+ - GitHub/GitLab remote detection, existing PR/MR checks, remote compare data, PR/MR title and description generation, and platform API creation support
17
+ - report periods `last-week`, `last-month`, and `last-quarter`
18
+ - focused PR/MR tests for remote parsing, generated content protocol, and prompt serialization without auth material
19
+
20
+ ### Changed
21
+
22
+ - renamed staged summary configuration and output from `pullRequestSummary` to `stagedChangeSummary`; old canonical `pullRequestSummary` config is rejected
23
+ - output language defaults now use `zh-cn`; `zh` is no longer accepted in CLI flags, environment variables, config files, or legacy keys
24
+ - `connection.llmResponseCorrectionRetryCount` now defaults to `3` and validates in the `0..10` range
25
+ - `git.pushTimeoutMs` now defaults to `180000`
26
+ - diff and input budgets are split across `commitMessage.maxDiffChars`, `review.maxDiffChars`, `stagedChangeSummary.maxDiffChars`, `pullRequest.maxDiffChars`, and `reporting.maxInputChars`
27
+ - report AI input is compressed to `reporting.maxInputChars` while preserving core totals, repository names, and compression notes
28
+ - docs, example config, and schema docs now describe the staged-change-summary and PR/MR creation contracts
29
+
30
+ ### Security
31
+
32
+ - PR/MR auth tokens are used only for GitHub/GitLab API authentication headers and are not included in LLM prompts, generated content, config rendering, or visible error output
33
+ - config rendering now redacts `pullRequest.authToken` in addition to `connection.apiKey`
34
+
35
+ ## [0.1.7] - 2026-04-26
36
+
37
+ ### Added
38
+
39
+ - optional AI pull request summary generation after successful `bridge` runs, writing timestamped Markdown under a configurable directory or the default `.smart-commit-cli/pr-summaries`
40
+ - `pullRequestSummary.*` settings (`enabled`, `language`, `outputDirPath`, `prompt`) across CLI flags, environment variables, config files, JSON schema output, and legacy `smartCommit.*` mappings
41
+ - structured `pullRequestSummary` in bridge output (`generated`, `outputFilePath`, `provider`, `error`) plus user-facing text render lines and non-fatal warnings when generation fails after an otherwise successful run
42
+ - regression coverage for pull request summary plumbing and configuration resolution
43
+ - a dedicated `0.1.7` draft release note for the current publish target
44
+
45
+ ### Changed
46
+
47
+ - public config and bridge JSON contracts now include `pullRequestSummary` fields; `schema print --target bridge` reflects the updated shape
48
+ - built-in `conventional` and `semantic` commit-message skill docs now note extracting a Jira or work item id from the branch name when prepending to the subject
49
+ - publish guidance now points to the `0.1.7` release draft during pre-publish review
50
+
9
51
  ## [0.1.6] - 2026-04-18
10
52
 
11
53
  ### Added
package/README.md CHANGED
@@ -20,7 +20,7 @@ It can:
20
20
  - optionally create a commit
21
21
  - optionally push the current branch
22
22
  - persist successful run history
23
- - generate daily, yesterday, weekly, monthly, quarterly, or yearly Markdown work reports
23
+ - generate daily, yesterday, weekly, last-week, monthly, last-month, quarterly, last-quarter, or yearly Markdown work reports
24
24
 
25
25
  ## Who This Is For
26
26
 
@@ -279,11 +279,11 @@ Use this when you want a more realistic team default without enabling automatic
279
279
  "baseUrl": "https://api.openai.com/v1",
280
280
  "apiKey": "env:SMART_COMMIT_API_KEY",
281
281
  "model": "gpt-5",
282
- "llmResponseCorrectionRetryCount": 1
282
+ "llmResponseCorrectionRetryCount": 3
283
283
  },
284
284
  "review": {
285
285
  "threshold": 6,
286
- "language": "zh"
286
+ "language": "zh-cn"
287
287
  },
288
288
  "git": {
289
289
  "autoStageWhenNothingStaged": true,
@@ -316,7 +316,7 @@ Built-in review skills are bundled with the CLI. The default `code-review` skill
316
316
 
317
317
  If you set `review.skill.path`, the CLI keeps the current file-based custom-skill behavior and loads that file as custom prompt input instead of the bundled built-in skill assets.
318
318
 
319
- `connection.llmResponseCorrectionRetryCount` controls how many extra repair or regeneration attempts the CLI may request when a review result or generated commit message fails protocol, JSON-shape, or language validation. The default is `1`, the supported range is `0..5`, and network, HTTP, timeout, or provider failures are not retried by this setting.
319
+ `connection.llmResponseCorrectionRetryCount` controls how many extra repair or regeneration attempts the CLI may request when a review result or generated commit message fails protocol, JSON-shape, or language validation. The default is `3`, the supported range is `0..10`, and network, HTTP, timeout, or provider failures are not retried by this setting.
320
320
 
321
321
  ### About the example config in this repo
322
322
 
@@ -401,8 +401,11 @@ Supported `--period` values:
401
401
  - `daily`
402
402
  - `yesterday`
403
403
  - `weekly`
404
+ - `last-week`
404
405
  - `monthly`
406
+ - `last-month`
405
407
  - `quarterly`
408
+ - `last-quarter`
406
409
  - `yearly`
407
410
 
408
411
  If you omit `--period`, it defaults to `weekly`. `yesterday` always means the previous natural local day.
@@ -417,6 +420,23 @@ smart-commit report generate --repo . --config ./smart-commit.json --period week
417
420
 
418
421
  If AI report generation fails, the CLI falls back to local Markdown generation automatically.
419
422
 
423
+ ### I want a staged change summary after a passing review
424
+
425
+ ```bash
426
+ smart-commit bridge --repo . --config ./smart-commit.json --no-commit --enable-staged-change-summary
427
+ ```
428
+
429
+ When enabled, `bridge` writes a Markdown staged change summary after the reviewed action succeeds. It runs after review-only success, after local commit success when `--no-push` is used, or after push success when auto-push is enabled. Review blocks, dry runs, and commit/push failures do not generate a staged change summary.
430
+
431
+ ### I want to create a PR or MR from the CLI
432
+
433
+ ```bash
434
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN=... \
435
+ smart-commit pull-request create --repo . --config ./smart-commit.json --target-branch main --provider auto
436
+ ```
437
+
438
+ Use `--dry-run` to compare branches and generate PR/MR content without creating it. The auth token is only used for GitHub/GitLab API headers and is redacted from config output and error text.
439
+
420
440
  ### I want machine-readable schemas
421
441
 
422
442
  ```bash
@@ -429,6 +449,7 @@ Supported schema targets:
429
449
  - `config-resolve`
430
450
  - `bridge`
431
451
  - `report-generate`
452
+ - `pull-request-create`
432
453
 
433
454
  Examples:
434
455
 
@@ -437,6 +458,7 @@ smart-commit schema print --target config-file
437
458
  smart-commit schema print --target config-resolve
438
459
  smart-commit schema print --target bridge
439
460
  smart-commit schema print --target report-generate
461
+ smart-commit schema print --target pull-request-create
440
462
  ```
441
463
 
442
464
  ## Core Commands Reference
@@ -570,8 +592,19 @@ Most practical flags for daily use:
570
592
  --review-language
571
593
  --code-review-skill-id
572
594
  --commit-language
595
+ --commit-message-structure
573
596
  --commit-message
574
597
  --pass-history-write-stage
598
+ --enable-staged-change-summary
599
+ --staged-change-summary-language
600
+ --staged-change-summary-output-dir
601
+ --staged-change-summary-prompt
602
+ --target-branch
603
+ --provider
604
+ --auth-token
605
+ --assignee
606
+ --reviewer
607
+ --label
575
608
  --no-commit
576
609
  --no-push
577
610
  --dry-run
@@ -599,11 +632,20 @@ SMART_COMMIT_LLM_RESPONSE_CORRECTION_RETRY_COUNT
599
632
  SMART_COMMIT_REVIEW_LANGUAGE
600
633
  SMART_COMMIT_CODE_REVIEW_SKILL_ID
601
634
  SMART_COMMIT_COMMIT_LANGUAGE
635
+ SMART_COMMIT_COMMIT_MESSAGE_STRUCTURE
602
636
  SMART_COMMIT_AUTO_COMMIT
603
637
  SMART_COMMIT_AUTO_PUSH
604
638
  SMART_COMMIT_PASS_HISTORY_WRITE_STAGE
605
639
  SMART_COMMIT_REPORT_LANGUAGE
606
640
  SMART_COMMIT_REPORT_OUTPUT_DIR
641
+ SMART_COMMIT_ENABLE_STAGED_CHANGE_SUMMARY
642
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_LANGUAGE
643
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_OUTPUT_DIR
644
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_PROMPT
645
+ SMART_COMMIT_AUTO_CREATE_PULL_REQUEST_AFTER_PUSH
646
+ SMART_COMMIT_PULL_REQUEST_TARGET_BRANCH
647
+ SMART_COMMIT_PULL_REQUEST_PROVIDER
648
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN
607
649
  ```
608
650
 
609
651
  ## Reporting
@@ -143,11 +143,11 @@ Recommended early team setup:
143
143
  "baseUrl": "https://api.openai.com/v1",
144
144
  "apiKey": "env:SMART_COMMIT_API_KEY",
145
145
  "model": "gpt-5",
146
- "llmResponseCorrectionRetryCount": 1
146
+ "llmResponseCorrectionRetryCount": 3
147
147
  },
148
148
  "review": {
149
149
  "threshold": 6,
150
- "language": "zh"
150
+ "language": "zh-cn"
151
151
  },
152
152
  "git": {
153
153
  "autoStageWhenNothingStaged": true,
@@ -188,7 +188,7 @@ These settings tell the CLI how to reach your AI endpoint. `bridge` requires all
188
188
  | `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 |
189
189
  | `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 |
190
190
  | `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 |
191
- | `connection.llmResponseCorrectionRetryCount` | `1` | `1` | Change it when you want `0..5` repair or regeneration retries for protocol, format, or language validation failures | Expecting it to retry provider, network, HTTP, or timeout failures |
191
+ | `connection.llmResponseCorrectionRetryCount` | `3` | `3` | Change it when you want `0..10` repair or regeneration retries for protocol, format, or language validation failures | Expecting it to retry provider, network, HTTP, or timeout failures |
192
192
  | `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 |
193
193
 
194
194
  Practical guidance:
@@ -204,7 +204,7 @@ These settings control review quality, language, and pass-or-block behavior.
204
204
  | Field | Built-in default | Recommended first value | When to change it | Common mistake |
205
205
  | --- | --- | --- | --- | --- |
206
206
  | `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 |
207
- | `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 |
207
+ | `review.language` | `zh-cn` | `zh-cn` 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 |
208
208
  | `review.maxDiffChars` | `100000` | Leave default first | Lower it if very large diffs are too slow or costly | Setting it below `1000`, which fails validation |
209
209
  | `review.skill.id` | `code-review` | `code-review` | Change it when your repo needs domain-specific built-in review guidance | Using an unsupported id |
210
210
  | `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 |
@@ -239,7 +239,8 @@ These settings control where the commit message comes from and how it is validat
239
239
  | Field | Built-in default | Recommended first value | When to change it | Common mistake |
240
240
  | --- | --- | --- | --- | --- |
241
241
  | `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 |
242
- | `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 |
242
+ | `commitMessage.language` | `zh-cn` | `zh-cn` or `en` | Change it to match your team's commit language | Mixing a team English convention with a non-English expectation |
243
+ | `commitMessage.structure` | `subjectOnly` | `subjectOnly` | Change it when your team wants optional commit bodies or footers | Expecting body/footer to be allowed while the default single-line mode is still active |
243
244
  | `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 |
244
245
  | `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 |
245
246
  | `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 |
@@ -257,6 +258,14 @@ How `hybridGenerate` actually works:
257
258
  - if `commitMessage.input` is empty and `autoGenerate=true`, the CLI generates from the diff
258
259
  - if `commitMessage.input` is empty and `autoGenerate=false`, the CLI errors because no message source exists
259
260
 
261
+ Supported commit message structures:
262
+
263
+ - `subjectOnly`: exactly one non-empty subject line
264
+ - `subjectBody`: a subject plus optional body separated by one blank line
265
+ - `subjectBodyFooter`: a subject plus optional body and optional footer/trailer lines
266
+
267
+ Protocol, language, ticket, and regex validation apply to the subject. Ticket injection from the branch preserves any accepted body or footer.
268
+
260
269
  Supported validation protocols:
261
270
 
262
271
  - `none`
@@ -311,7 +320,7 @@ These settings control report generation behavior.
311
320
 
312
321
  | Field | Built-in default | Recommended first value | When to change it | Common mistake |
313
322
  | --- | --- | --- | --- | --- |
314
- | `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 |
323
+ | `reporting.language` | `zh-cn` | `zh-cn` or `en` | Change it when your team wants report output in another language | Assuming this changes review or commit-message language too |
315
324
  | `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 |
316
325
  | `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 |
317
326
  | `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 |
@@ -319,6 +328,43 @@ These settings control report generation behavior.
319
328
 
320
329
  If `reporting.outputDirPath` is empty, the CLI writes reports to `.smart-commit-cli/reports` under the repository root.
321
330
 
331
+ ### `stagedChangeSummary.*`
332
+
333
+ These settings control optional Markdown staged change summary generation after a passing `bridge` run.
334
+
335
+ | Field | Built-in default | Recommended first value | When to change it | Common mistake |
336
+ | --- | --- | --- | --- | --- |
337
+ | `stagedChangeSummary.enabled` | `false` | `false` first | Set `true` when you want a staged change summary after review success | Expecting it to run for dry-run, blocked review, or failed commit/push paths |
338
+ | `stagedChangeSummary.language` | `zh-cn` | Match your reviewer language | Change it independently from review and commit-message language | Assuming it changes review output language |
339
+ | `stagedChangeSummary.outputDirPath` | empty string | Leave empty first | Set it when your automation needs a specific artifact location | Thinking empty means invalid; it writes under `.smart-commit-cli/staged-change-summaries` |
340
+ | `stagedChangeSummary.prompt` | empty string | Leave empty first | Add concise team PR template guidance | Asking it to invent tests, reviewers, links, or review findings |
341
+
342
+ The generated summary uses only the reviewed staged diff, commit message, branch, changed files, and run facts. Review scores, thresholds, findings, and suggestions are treated as internal gate data and are not included in the staged change summary.
343
+
344
+ ### `pullRequest.*`
345
+
346
+ These settings control GitHub pull request and GitLab merge request creation from the current branch.
347
+
348
+ | Field | Built-in default | Recommended first value | When to change it | Common mistake |
349
+ | --- | --- | --- | --- | --- |
350
+ | `pullRequest.autoCreateAfterPush` | `false` | `false` first | Set `true` when `bridge` should create a PR/MR after a successful push | Expecting it to run when push is disabled or fails |
351
+ | `pullRequest.targetBranch` | empty string | Your default integration branch | Set it in shared config when most branches target the same branch | Forgetting that `pull-request create` requires this value or `--target-branch` |
352
+ | `pullRequest.provider` | `auto` | `auto` | Use `github` or `gitlab` when remote detection is ambiguous | Setting a provider that does not match the remote host |
353
+ | `pullRequest.apiBaseUrl` | empty string | Leave empty for public GitHub/GitLab | Set it for GitHub Enterprise or self-managed GitLab | Including a trailing slash or a repository path instead of the API base |
354
+ | `pullRequest.titlePrompt` | empty string | Leave empty first | Add short team guidance for generated PR/MR titles | Putting auth tokens, reviewer names, or process notes into the title prompt |
355
+ | `pullRequest.descriptionPrompt` | empty string | Leave empty first | Add concise PR/MR template guidance | Asking it to invent tests, links, or approvals |
356
+ | `pullRequest.maxDiffChars` | `200000` | `200000` | Lower it for very large repositories or slow models | Setting it below `1000`, which fails validation |
357
+ | `pullRequest.assignees` | `[]` | `[]` | Set default assignees for created PRs/MRs | Assuming these are LLM prompt hints; they are sent to the provider API |
358
+ | `pullRequest.reviewers` | `[]` | `[]` | Set default reviewers for created PRs/MRs | Assuming every provider accepts every reviewer identifier format |
359
+ | `pullRequest.labels` | `[]` | `[]` | Apply standard labels during creation | Expecting missing provider labels to be created automatically |
360
+ | `pullRequest.milestone` | empty string | Leave empty first | Set it when your provider project uses milestones | Using a display name where the provider expects an id |
361
+ | `pullRequest.draft` | `false` | `false` | Set `true` when generated PRs/MRs should start as drafts | Expecting GitLab draft behavior to exactly match GitHub |
362
+ | `pullRequest.removeSourceBranch` | `false` | `false` | Set `true` when accepted MRs should remove the source branch | Expecting GitHub to support this GitLab-only field |
363
+ | `pullRequest.skipBranches` | `["main", "master", "develop"]` | Keep the defaults | Add protected branch names that should never auto-create PRs/MRs | Forgetting this only applies to source branch names |
364
+ | `pullRequest.authToken` | empty string | `env:SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN` | Set it when creating PRs/MRs through provider APIs | Hardcoding a token in committed config |
365
+
366
+ PR/MR auth tokens are used only for provider API authentication headers. They are redacted from resolved config, generated content, LLM prompts, and visible error output.
367
+
322
368
  ### `output.*`
323
369
 
324
370
  These settings control how results are presented.
@@ -336,7 +382,8 @@ These are the validated option sets enforced by the CLI.
336
382
 
337
383
  Supported output and commit-message languages:
338
384
 
339
- - `zh`
385
+ - `zh-cn`
386
+ - `zh-tw`
340
387
  - `en`
341
388
  - `de`
342
389
  - `fr`
@@ -390,8 +437,29 @@ Most practical flags:
390
437
  --review-language
391
438
  --code-review-skill-id
392
439
  --commit-language
440
+ --commit-message-structure
393
441
  --commit-message
394
442
  --pass-history-write-stage
443
+ --enable-staged-change-summary
444
+ --staged-change-summary-language
445
+ --staged-change-summary-max-diff-chars
446
+ --staged-change-summary-output-dir
447
+ --staged-change-summary-prompt
448
+ --auto-create-pull-request-after-push
449
+ --target-branch
450
+ --provider
451
+ --api-base-url
452
+ --auth-token
453
+ --pull-request-title-prompt
454
+ --pull-request-description-prompt
455
+ --pull-request-max-diff-chars
456
+ --assignee
457
+ --reviewer
458
+ --label
459
+ --milestone
460
+ --draft
461
+ --remove-source-branch
462
+ --skip-branch
395
463
  --no-commit
396
464
  --no-push
397
465
  --dry-run
@@ -419,11 +487,32 @@ SMART_COMMIT_LLM_RESPONSE_CORRECTION_RETRY_COUNT
419
487
  SMART_COMMIT_REVIEW_LANGUAGE
420
488
  SMART_COMMIT_CODE_REVIEW_SKILL_ID
421
489
  SMART_COMMIT_COMMIT_LANGUAGE
490
+ SMART_COMMIT_COMMIT_MESSAGE_STRUCTURE
422
491
  SMART_COMMIT_AUTO_COMMIT
423
492
  SMART_COMMIT_AUTO_PUSH
424
493
  SMART_COMMIT_PASS_HISTORY_WRITE_STAGE
425
494
  SMART_COMMIT_REPORT_LANGUAGE
426
495
  SMART_COMMIT_REPORT_OUTPUT_DIR
496
+ SMART_COMMIT_ENABLE_STAGED_CHANGE_SUMMARY
497
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_LANGUAGE
498
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_MAX_DIFF_CHARS
499
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_OUTPUT_DIR
500
+ SMART_COMMIT_STAGED_CHANGE_SUMMARY_PROMPT
501
+ SMART_COMMIT_AUTO_CREATE_PULL_REQUEST_AFTER_PUSH
502
+ SMART_COMMIT_PULL_REQUEST_TARGET_BRANCH
503
+ SMART_COMMIT_PULL_REQUEST_PROVIDER
504
+ SMART_COMMIT_PULL_REQUEST_API_BASE_URL
505
+ SMART_COMMIT_PULL_REQUEST_TITLE_PROMPT
506
+ SMART_COMMIT_PULL_REQUEST_DESCRIPTION_PROMPT
507
+ SMART_COMMIT_PULL_REQUEST_MAX_DIFF_CHARS
508
+ SMART_COMMIT_PULL_REQUEST_ASSIGNEES
509
+ SMART_COMMIT_PULL_REQUEST_REVIEWERS
510
+ SMART_COMMIT_PULL_REQUEST_LABELS
511
+ SMART_COMMIT_PULL_REQUEST_MILESTONE
512
+ SMART_COMMIT_PULL_REQUEST_DRAFT
513
+ SMART_COMMIT_PULL_REQUEST_REMOVE_SOURCE_BRANCH
514
+ SMART_COMMIT_PULL_REQUEST_SKIP_BRANCHES
515
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN
427
516
  ```
428
517
 
429
518
  Useful boolean environment variables accept:
@@ -478,8 +567,11 @@ Supported periods:
478
567
  - `daily`
479
568
  - `yesterday`
480
569
  - `weekly`
570
+ - `last-week`
481
571
  - `monthly`
572
+ - `last-month`
482
573
  - `quarterly`
574
+ - `last-quarter`
483
575
  - `yearly`
484
576
 
485
577
  If `--period` is omitted, it defaults to `weekly`. `yesterday` always uses the previous natural local day.
package/docs/contracts.md CHANGED
@@ -9,6 +9,7 @@ For formal JSON Schema output, use:
9
9
  ```bash
10
10
  smart-commit schema print --target bridge
11
11
  smart-commit schema print --target report-generate
12
+ smart-commit schema print --target pull-request-create
12
13
  ```
13
14
 
14
15
  ## Shared Rules
@@ -36,7 +37,7 @@ Stable top-level fields:
36
37
 
37
38
  Use it to validate merged config before wiring `bridge` or `report generate` into automation.
38
39
 
39
- Contract consumers can safely read newly added resolved settings such as `config.connection.llmResponseCorrectionRetryCount`, `config.passHistory.writeStage`, and `config.review.skill.id` from the returned `config` object.
40
+ Contract consumers can safely read newly added resolved settings such as `config.connection.llmResponseCorrectionRetryCount`, `config.passHistory.writeStage`, `config.review.skill.id`, `config.commitMessage.structure`, and `config.stagedChangeSummary.enabled` from the returned `config` object.
40
41
 
41
42
  ## `bridge`
42
43
 
@@ -57,6 +58,8 @@ Stable top-level fields:
57
58
  - `didPush`
58
59
  - `commitSha`
59
60
  - `passHistory`
61
+ - `stagedChangeSummary`
62
+ - `pullRequestCreation`
60
63
  - `reviewDecision`
61
64
  - `score`
62
65
  - `summary`
@@ -65,6 +68,10 @@ Stable top-level fields:
65
68
  Stable nested fields often used by automations:
66
69
 
67
70
  - `passHistory.eventType`
71
+ - `stagedChangeSummary.generated`
72
+ - `stagedChangeSummary.outputFilePath`
73
+ - `pullRequestCreation.status`
74
+ - `pullRequestCreation.url`
68
75
  - `reviewDetails`
69
76
 
70
77
  `passHistory.writeStage` controls when a pass-history record is first allowed to exist. Once a record exists, later successful stages update that same record, so `passHistory.eventType` always reflects the furthest successful stage reached by the run.
@@ -82,6 +89,21 @@ Stable nested fields often used by automations:
82
89
 
83
90
  For example, when `passHistory.writeStage = "commit_completed"`, a successful local commit can still leave `passHistory.eventType = "commit_completed"` if the later push cannot start, fails, or times out. When `passHistory.writeStage = "commit_push_completed"`, those same push failures keep `passHistory.eventType = null` because no record is written.
84
91
 
92
+ `stagedChangeSummary` is always present in bridge output. When `stagedChangeSummary.enabled = true`, the CLI attempts generation only after the review/commit/push action for that run succeeds. Generation failures are reported in `stagedChangeSummary.error` and do not change the already successful bridge exit code.
93
+
94
+ `pullRequestCreation` is always present in bridge output. When `pullRequest.autoCreateAfterPush = true`, the CLI attempts creation only after push succeeds and the source branch is not in `pullRequest.skipBranches`. Creation failures are reported in `pullRequestCreation.error` and do not change the already successful bridge exit code.
95
+
96
+ `pullRequestCreation.status` semantics:
97
+
98
+ - `skipped`
99
+ PR/MR creation was disabled, dry-run skipped it, push did not succeed, or the source branch is skipped.
100
+ - `created`
101
+ A new PR/MR was created.
102
+ - `existing`
103
+ An open PR/MR already exists for the source and target branch.
104
+ - `error`
105
+ PR/MR creation failed after the bridge commit/push flow had already succeeded.
106
+
85
107
  Status semantics:
86
108
 
87
109
  - `ready`
@@ -118,7 +140,7 @@ Command:
118
140
  smart-commit report generate --repo /path/to/repo --period weekly
119
141
  ```
120
142
 
121
- Supported `periodType` values are `daily`, `yesterday`, `weekly`, `monthly`, `quarterly`, and `yearly`.
143
+ Supported `periodType` values are `daily`, `yesterday`, `weekly`, `last-week`, `monthly`, `last-month`, `quarterly`, `last-quarter`, and `yearly`.
122
144
 
123
145
  Stable top-level fields:
124
146
 
@@ -161,6 +183,50 @@ Recommended automation behavior:
161
183
  - use `facts.totals.commitCompleted` and `facts.totals.commitPushCompleted` separately if local commit completion and remote push completion need different downstream handling
162
184
  - fail on `status: "error"`
163
185
 
186
+ ## `pull-request create`
187
+
188
+ Command:
189
+
190
+ ```bash
191
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN=... \
192
+ smart-commit pull-request create --repo /path/to/repo --config ./smart-commit.json --target-branch main
193
+ ```
194
+
195
+ Stable top-level fields:
196
+
197
+ - `schemaVersion`
198
+ - `status`
199
+ - `command`
200
+ - `repositoryPath`
201
+ - `platform`
202
+ - `sourceBranch`
203
+ - `targetBranch`
204
+ - `title`
205
+ - `url`
206
+ - `warnings`
207
+ - `dryRun`
208
+ - `config`
209
+ - `summary`
210
+ - `error`
211
+
212
+ `status` semantics:
213
+
214
+ - `created`
215
+ A new GitHub pull request or GitLab merge request was created.
216
+ - `existing`
217
+ An open PR/MR already exists for the same source and target branch.
218
+ - `ready`
219
+ Dry-run mode generated and validated PR/MR content without creating it.
220
+ - `error`
221
+ Configuration or runtime validation failed.
222
+
223
+ Recommended automation behavior:
224
+
225
+ - archive or surface `url` on `created` or `existing`
226
+ - use `--dry-run` before first enabling provider writes
227
+ - treat `warnings` as non-fatal context
228
+ - fail on `status: "error"`
229
+
164
230
  ## Versioning Guidance
165
231
 
166
232
  - treat `schemaVersion` as the primary compatibility gate
@@ -129,7 +129,7 @@ This config is intentionally conservative:
129
129
  - `autoCommit=false` prevents creating a local commit
130
130
  - `autoPush=false` prevents pushing to remote
131
131
 
132
- The built-in default for `connection.llmResponseCorrectionRetryCount` is already `1`, which means the CLI will allow one extra repair or regeneration pass when a review result or generated commit message fails local protocol validation. Set it to `0` later if you want to disable that behavior.
132
+ The built-in default for `connection.llmResponseCorrectionRetryCount` is already `3`, which means the CLI will allow one extra repair or regeneration pass when a review result or generated commit message fails local protocol validation. Set it to `0` later if you want to disable that behavior.
133
133
 
134
134
  If you want a fuller example, see `examples/config/smart-commit.json`, but do not copy its side-effect settings blindly for first use.
135
135
 
@@ -260,8 +260,11 @@ Supported periods:
260
260
  - `daily`
261
261
  - `yesterday`
262
262
  - `weekly`
263
+ - `last-week`
263
264
  - `monthly`
265
+ - `last-month`
264
266
  - `quarterly`
267
+ - `last-quarter`
265
268
  - `yearly`
266
269
 
267
270
  If `--period` is omitted, the CLI defaults to `weekly`. `yesterday` always uses the previous natural local day in local time.
package/docs/publish.md CHANGED
@@ -21,7 +21,7 @@ Current package name:
21
21
  3. Run `npm run pack:dry-run`
22
22
  4. Review [`CHANGELOG.md`](../CHANGELOG.md)
23
23
  5. Review [`docs/release-checklist.md`](./release-checklist.md)
24
- 6. Review the matching release draft in [`docs/releases/0.1.6-draft.md`](./releases/0.1.6-draft.md)
24
+ 6. Review the matching release draft in [`docs/releases/0.1.8-draft.md`](./releases/0.1.8-draft.md)
25
25
 
26
26
  ## Recommended Release Order
27
27
 
@@ -0,0 +1,55 @@
1
+ # `smart-commit-copilot-cli` 0.1.7 Draft Release Notes
2
+
3
+ ## Summary
4
+
5
+ `smart-commit-copilot-cli` 0.1.7 adds optional pull request description generation to the `bridge` workflow, alongside full configuration and contract support for automation consumers.
6
+
7
+ This release focuses on turning a successful review-and-commit run into a ready-to-paste staged change summary artifact without changing the bridge exit code when summary generation fails.
8
+
9
+ ## Highlights
10
+
11
+ - opt-in `stagedChangeSummary.enabled` with independent `language`, optional `outputDirPath`, and optional free-form `prompt` template guidance
12
+ - generation runs only after the applicable successful `bridge` outcome (review-only, commit, or push, depending on your flow); failures surface in `stagedChangeSummary.error` and optional stderr warnings
13
+ - Markdown files use a stable `smart-commit-pr-summary-*.md` naming pattern under the chosen or default output directory
14
+ - legacy `smartCommit.stagedChangeSummary*` keys map into the same resolved `stagedChangeSummary` object as other Smart Commit settings
15
+
16
+ ## Why This Release Matters
17
+
18
+ This version closes the loop for teams that open pull requests immediately after local automation:
19
+
20
+ - hooks and agents can enable one setting and receive a file path in structured JSON output
21
+ - consumers can treat summary failure as telemetry without losing a green bridge result
22
+ - configuration remains consistent with the rest of the CLI resolution order (args, env, file, defaults)
23
+
24
+ ## Notable Behavior Updates
25
+
26
+ ### Staged change summary
27
+
28
+ - when disabled, bridge output still includes `stagedChangeSummary` with `generated: false` and null file or provider fields as appropriate
29
+ - when enabled, the CLI uses the same AI connection as review and commit-message generation; empty or invalid model output is reported without failing the bridge
30
+ - text output includes whether a file was written and any error string for operator visibility
31
+
32
+ ### Commit message skills
33
+
34
+ - bundled `conventional` and `semantic` skill documentation now explicitly calls out extracting Jira or work item identifiers from the branch when present
35
+
36
+ ## Verification Coverage Added Or Strengthened
37
+
38
+ The project now has stronger regression protection for:
39
+
40
+ 1. `stagedChangeSummary` defaults and legacy key mapping in config resolution
41
+ 2. bridge JSON shape and schema output for the new fields
42
+ 3. mock-provider success and empty-output failure paths for staged change summary generation
43
+
44
+ ## Suggested Upgrade Path
45
+
46
+ 1. update to `0.1.7`
47
+ 2. run `npm test`
48
+ 3. run `npm run smoke:test`
49
+ 4. run `npm run pack:dry-run`
50
+ 5. publish only after all three checks pass
51
+
52
+ ## Known Follow-Up Areas
53
+
54
+ - richer provider options or templates if teams need multiple PR formats per repository
55
+ - deeper integration tests against real OpenAI-compatible endpoints if mock coverage is not enough for your release bar
@@ -0,0 +1,80 @@
1
+ # `smart-commit-copilot-cli` 0.1.8 Draft Release Notes
2
+
3
+ ## Summary
4
+
5
+ `smart-commit-copilot-cli` 0.1.8 brings the CLI up to the latest Smart Commit workflow semantics for staged change summaries, PR/MR creation, stricter language handling, and reporting windows.
6
+
7
+ This release is focused on CLI-native PR/MR automation: create a GitHub pull request or GitLab merge request directly with `smart-commit pull-request create`, or let `bridge` attempt PR/MR creation automatically after a successful push.
8
+
9
+ ## Highlights
10
+
11
+ - new `smart-commit pull-request create` command with GitHub and GitLab support
12
+ - bridge output now includes `pullRequestCreation` and can auto-create after push when `pullRequest.autoCreateAfterPush=true`
13
+ - staged summary config/output is now `stagedChangeSummary`; old canonical `pullRequestSummary` config is rejected
14
+ - output language defaults now use `zh-cn`, with strict support for `zh-cn` and `zh-tw`; legacy `zh` is rejected
15
+ - response correction retry default is now `3`, with a validated `0..10` range
16
+ - reporting now supports `last-week`, `last-month`, and `last-quarter`
17
+ - AI report facts are compressed to `reporting.maxInputChars` with a clear compression note
18
+
19
+ ## Security Notes
20
+
21
+ PR/MR auth tokens are only used for GitHub/GitLab API authentication headers.
22
+
23
+ They are not included in:
24
+
25
+ - LLM prompts or messages
26
+ - generated PR/MR content
27
+ - report or summary facts
28
+ - rendered config output
29
+ - visible error messages
30
+
31
+ Use `SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN` or `pullRequest.authToken: "env:VAR_NAME"` for normal use.
32
+
33
+ ## Notable Behavior Updates
34
+
35
+ ### PR/MR creation
36
+
37
+ - `smart-commit pull-request create` supports `--repo`, `--target-branch`, `--provider`, `--api-base-url`, `--auth-token`, `--draft`, `--assignee`, `--reviewer`, `--label`, `--milestone`, `--remove-source-branch`, `--skip-branch`, `--dry-run`, and `--output`
38
+ - existing open PRs/MRs are detected and returned as `existing` instead of creating duplicates
39
+ - dry runs compare branches and generate content without sending the create request
40
+ - bridge auto-create runs only after push success; failures are reported without changing the successful commit/push exit code
41
+
42
+ ### Configuration and contracts
43
+
44
+ - new `pullRequest.*` config covers auto-create, target branch, provider, API base URL, token, prompts, metadata, and skip branches
45
+ - bridge output fields are now `stagedChangeSummary` and `pullRequestCreation`
46
+ - `schema print --target pull-request-create` exposes the new command output contract
47
+ - old canonical `pullRequestSummary` is not parsed or emitted
48
+
49
+ ### Reporting and language
50
+
51
+ - `report generate --period` now accepts `last-week`, `last-month`, and `last-quarter`
52
+ - Chinese language selection is explicit: use `zh-cn` for Simplified Chinese or `zh-tw` for Traditional Chinese
53
+ - Traditional Chinese prompts explicitly prevent Simplified Chinese output
54
+
55
+ ## Verification Coverage Added Or Strengthened
56
+
57
+ The project now has stronger regression protection for:
58
+
59
+ 1. strict rejection of legacy `zh` across flags, env, config files, and legacy keys
60
+ 2. rejection of canonical `pullRequestSummary` and acceptance of `stagedChangeSummary`
61
+ 3. PR/MR platform detection and generated content protocol handling
62
+ 4. PR/MR prompt serialization without auth token or auth header material
63
+ 5. report period expansion and report-facts compression
64
+ 6. bridge staged summary and PR/MR creation contract fields
65
+
66
+ ## Suggested Upgrade Path
67
+
68
+ 1. update to `0.1.8`
69
+ 2. replace any `zh` config value with `zh-cn` or `zh-tw`
70
+ 3. replace canonical `pullRequestSummary` config with `stagedChangeSummary`
71
+ 4. configure `pullRequest.targetBranch` or pass `--target-branch` when creating PRs/MRs
72
+ 5. use `SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN` or `authToken: "env:VAR_NAME"` for PR/MR API auth
73
+ 6. run `npm test`
74
+ 7. run `npm run smoke:test`
75
+ 8. run `npm run pack:dry-run`
76
+
77
+ ## Known Follow-Up Areas
78
+
79
+ - broader integration coverage against real GitHub/GitLab test repositories
80
+ - richer PR/MR template controls if teams need provider-specific conventions beyond prompt tuning
package/docs/roadmap.md CHANGED
@@ -27,7 +27,7 @@ Focus:
27
27
 
28
28
  Expected stability:
29
29
 
30
- - `schemaVersion: "1.0.0"` machine contracts should remain stable unless there is a strong reason to break them
30
+ - `schemaVersion: "1.1.0"` machine contracts should remain stable unless there is a strong reason to break them
31
31
  - `smartCommitCli` remains the canonical config namespace
32
32
  - legacy `smartCommit.*` remains compatibility-only
33
33