smart-commit-copilot-cli 0.1.7 → 0.1.9

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 (101) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +39 -15
  3. package/docs/configuration.md +82 -22
  4. package/docs/contracts.md +67 -6
  5. package/docs/getting-started.md +4 -1
  6. package/docs/publish.md +1 -1
  7. package/docs/releases/0.1.7-draft.md +8 -8
  8. package/docs/releases/0.1.8-draft.md +80 -0
  9. package/docs/releases/0.1.9-draft.md +69 -0
  10. package/docs/verification.md +1 -0
  11. package/examples/config/smart-commit.json +28 -8
  12. package/out/cliApp.js +51 -12
  13. package/out/cliApp.js.map +1 -1
  14. package/out/commands/bridge.js +117 -46
  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/protocol.js +6 -1
  19. package/out/commitMessage/protocol.js.map +1 -1
  20. package/out/config/cliArgs.js +103 -10
  21. package/out/config/cliArgs.js.map +1 -1
  22. package/out/config/constants.js +2 -1
  23. package/out/config/constants.js.map +1 -1
  24. package/out/config/env.js +79 -10
  25. package/out/config/env.js.map +1 -1
  26. package/out/config/file.js +98 -11
  27. package/out/config/file.js.map +1 -1
  28. package/out/config/legacySmartCommit.js +104 -21
  29. package/out/config/legacySmartCommit.js.map +1 -1
  30. package/out/config/merge.js +17 -3
  31. package/out/config/merge.js.map +1 -1
  32. package/out/config/schema.js +65 -10
  33. package/out/config/schema.js.map +1 -1
  34. package/out/contracts.js +152 -11
  35. package/out/contracts.js.map +1 -1
  36. package/out/git.js +108 -2
  37. package/out/git.js.map +1 -1
  38. package/out/output.js +5 -4
  39. package/out/output.js.map +1 -1
  40. package/out/pullRequest/api.js +528 -0
  41. package/out/pullRequest/api.js.map +1 -0
  42. package/out/pullRequest/client.js +17 -0
  43. package/out/pullRequest/client.js.map +1 -0
  44. package/out/pullRequest/config.js +18 -0
  45. package/out/pullRequest/config.js.map +1 -0
  46. package/out/pullRequest/contentPrompt.js +116 -0
  47. package/out/pullRequest/contentPrompt.js.map +1 -0
  48. package/out/pullRequest/contentService.js +77 -0
  49. package/out/pullRequest/contentService.js.map +1 -0
  50. package/out/pullRequest/index.js +25 -0
  51. package/out/pullRequest/index.js.map +1 -0
  52. package/out/pullRequest/platform.js +101 -0
  53. package/out/pullRequest/platform.js.map +1 -0
  54. package/out/pullRequest/redact.js +15 -0
  55. package/out/pullRequest/redact.js.map +1 -0
  56. package/out/pullRequest/workflow.js +153 -0
  57. package/out/pullRequest/workflow.js.map +1 -0
  58. package/out/renderOutput.js +29 -4
  59. package/out/renderOutput.js.map +1 -1
  60. package/out/reporting/aggregate.js +1 -1
  61. package/out/reporting/aggregate.js.map +1 -1
  62. package/out/reporting/mockProvider.js +5 -1
  63. package/out/reporting/mockProvider.js.map +1 -1
  64. package/out/reporting/openaiProvider.js +5 -1
  65. package/out/reporting/openaiProvider.js.map +1 -1
  66. package/out/reporting/prompt.js +145 -20
  67. package/out/reporting/prompt.js.map +1 -1
  68. package/out/reporting/render.js +24 -22
  69. package/out/reporting/render.js.map +1 -1
  70. package/out/reporting/timeWindow.js +101 -36
  71. package/out/reporting/timeWindow.js.map +1 -1
  72. package/out/reporting/types.js +3 -0
  73. package/out/reporting/types.js.map +1 -1
  74. package/out/review/detailLocator.js +268 -0
  75. package/out/review/detailLocator.js.map +1 -0
  76. package/out/review/index.js +4 -3
  77. package/out/review/index.js.map +1 -1
  78. package/out/review/mockProvider.js +25 -1
  79. package/out/review/mockProvider.js.map +1 -1
  80. package/out/review/parser.js +14 -1
  81. package/out/review/parser.js.map +1 -1
  82. package/out/{pullRequestSummary → stagedChangeSummary}/index.js +10 -10
  83. package/out/stagedChangeSummary/index.js.map +1 -0
  84. package/out/{pullRequestSummary → stagedChangeSummary}/mockProvider.js +5 -5
  85. package/out/stagedChangeSummary/mockProvider.js.map +1 -0
  86. package/out/stagedChangeSummary/openaiProvider.js +19 -0
  87. package/out/stagedChangeSummary/openaiProvider.js.map +1 -0
  88. package/out/{pullRequestSummary → stagedChangeSummary}/prompt.js +28 -12
  89. package/out/stagedChangeSummary/prompt.js.map +1 -0
  90. package/out/stagedChangeSummary/provider.js.map +1 -0
  91. package/out/{pullRequestSummary → stagedChangeSummary}/render.js +12 -12
  92. package/out/stagedChangeSummary/render.js.map +1 -0
  93. package/package.json +1 -1
  94. package/out/pullRequestSummary/index.js.map +0 -1
  95. package/out/pullRequestSummary/mockProvider.js.map +0 -1
  96. package/out/pullRequestSummary/openaiProvider.js +0 -19
  97. package/out/pullRequestSummary/openaiProvider.js.map +0 -1
  98. package/out/pullRequestSummary/prompt.js.map +0 -1
  99. package/out/pullRequestSummary/provider.js.map +0 -1
  100. package/out/pullRequestSummary/render.js.map +0 -1
  101. /package/out/{pullRequestSummary → stagedChangeSummary}/provider.js +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,50 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.9] - 2026-05-22
10
+
11
+ ### Added
12
+
13
+ - review detail locator to align review findings with diff file paths and line numbers via code snippets, message prefixes, and added-line matching
14
+ - localized report time window `displayRangeLabel` for `en`, `zh-cn`, and `zh-tw` output languages
15
+ - review response parser now extracts JSON from fenced code blocks and surrounding object text when model output is not pure JSON
16
+ - regression coverage for detail locator matching, fenced JSON review parsing, localized report windows, and full secret redaction
17
+
18
+ ### Changed
19
+
20
+ - config secret redaction now fully replaces `connection.apiKey` and `pullRequest.authToken` with `[REDACTED]` instead of partial masking that could leak trailing characters
21
+ - publish guidance now points to the `0.1.9` release draft during pre-publish review
22
+
23
+ ### Security
24
+
25
+ - rendered config output no longer exposes partial API keys or auth tokens after redaction
26
+
27
+ ## [0.1.8] - 2026-05-21
28
+
29
+ ### Added
30
+
31
+ - `smart-commit pull-request create` command for GitHub pull request and GitLab merge request creation from the current branch
32
+ - bridge auto PR/MR creation after successful push via `pullRequest.autoCreateAfterPush`
33
+ - `pull-request-create` schema target and structured `pullRequestCreation` bridge output
34
+ - GitHub/GitLab remote detection, existing PR/MR checks, remote compare data, PR/MR title and description generation, and platform API creation support
35
+ - report periods `last-week`, `last-month`, and `last-quarter`
36
+ - focused PR/MR tests for remote parsing, generated content protocol, and prompt serialization without auth material
37
+
38
+ ### Changed
39
+
40
+ - renamed staged summary configuration and output from `pullRequestSummary` to `stagedChangeSummary`; old canonical `pullRequestSummary` config is rejected
41
+ - output language defaults now use `zh-cn`; `zh` is no longer accepted in CLI flags, environment variables, config files, or legacy keys
42
+ - `connection.llmResponseCorrectionRetryCount` now defaults to `3` and validates in the `0..10` range
43
+ - `git.pushTimeoutMs` now defaults to `180000`
44
+ - diff and input budgets are split across `commitMessage.maxDiffChars`, `review.maxDiffChars`, `stagedChangeSummary.maxDiffChars`, `pullRequest.maxDiffChars`, and `reporting.maxInputChars`
45
+ - report AI input is compressed to `reporting.maxInputChars` while preserving core totals, repository names, and compression notes
46
+ - docs, example config, and schema docs now describe the staged-change-summary and PR/MR creation contracts
47
+
48
+ ### Security
49
+
50
+ - 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
51
+ - config rendering now redacts `pullRequest.authToken` in addition to `connection.apiKey`
52
+
9
53
  ## [0.1.7] - 2026-04-26
10
54
 
11
55
  ### 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,13 +420,22 @@ 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
 
420
- ### I want a pull request summary after a passing review
423
+ ### I want a staged change summary after a passing review
421
424
 
422
425
  ```bash
423
- smart-commit bridge --repo . --config ./smart-commit.json --no-commit --enable-pull-request-summary
426
+ smart-commit bridge --repo . --config ./smart-commit.json --no-commit --enable-staged-change-summary
424
427
  ```
425
428
 
426
- When enabled, `bridge` writes a Markdown PR description 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 PR summary.
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.
427
439
 
428
440
  ### I want machine-readable schemas
429
441
 
@@ -437,6 +449,7 @@ Supported schema targets:
437
449
  - `config-resolve`
438
450
  - `bridge`
439
451
  - `report-generate`
452
+ - `pull-request-create`
440
453
 
441
454
  Examples:
442
455
 
@@ -445,6 +458,7 @@ smart-commit schema print --target config-file
445
458
  smart-commit schema print --target config-resolve
446
459
  smart-commit schema print --target bridge
447
460
  smart-commit schema print --target report-generate
461
+ smart-commit schema print --target pull-request-create
448
462
  ```
449
463
 
450
464
  ## Core Commands Reference
@@ -581,10 +595,16 @@ Most practical flags for daily use:
581
595
  --commit-message-structure
582
596
  --commit-message
583
597
  --pass-history-write-stage
584
- --enable-pull-request-summary
585
- --pull-request-summary-language
586
- --pull-request-summary-output-dir
587
- --pull-request-summary-prompt
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
588
608
  --no-commit
589
609
  --no-push
590
610
  --dry-run
@@ -618,10 +638,14 @@ SMART_COMMIT_AUTO_PUSH
618
638
  SMART_COMMIT_PASS_HISTORY_WRITE_STAGE
619
639
  SMART_COMMIT_REPORT_LANGUAGE
620
640
  SMART_COMMIT_REPORT_OUTPUT_DIR
621
- SMART_COMMIT_ENABLE_PULL_REQUEST_SUMMARY
622
- SMART_COMMIT_PULL_REQUEST_SUMMARY_LANGUAGE
623
- SMART_COMMIT_PULL_REQUEST_SUMMARY_OUTPUT_DIR
624
- SMART_COMMIT_PULL_REQUEST_SUMMARY_PROMPT
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
625
649
  ```
626
650
 
627
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,7 @@ 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
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 |
244
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 |
245
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 |
@@ -320,7 +320,7 @@ These settings control report generation behavior.
320
320
 
321
321
  | Field | Built-in default | Recommended first value | When to change it | Common mistake |
322
322
  | --- | --- | --- | --- | --- |
323
- | `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 |
324
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 |
325
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 |
326
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 |
@@ -328,18 +328,42 @@ These settings control report generation behavior.
328
328
 
329
329
  If `reporting.outputDirPath` is empty, the CLI writes reports to `.smart-commit-cli/reports` under the repository root.
330
330
 
331
- ### `pullRequestSummary.*`
331
+ ### `stagedChangeSummary.*`
332
332
 
333
- These settings control optional Markdown PR summary generation after a passing `bridge` run.
333
+ These settings control optional Markdown staged change summary generation after a passing `bridge` run.
334
334
 
335
335
  | Field | Built-in default | Recommended first value | When to change it | Common mistake |
336
336
  | --- | --- | --- | --- | --- |
337
- | `pullRequestSummary.enabled` | `false` | `false` first | Set `true` when you want a PR description after review success | Expecting it to run for dry-run, blocked review, or failed commit/push paths |
338
- | `pullRequestSummary.language` | `zh` | Match your reviewer language | Change it independently from review and commit-message language | Assuming it changes review output language |
339
- | `pullRequestSummary.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/pr-summaries` |
340
- | `pullRequestSummary.prompt` | empty string | Leave empty first | Add concise team PR template guidance | Asking it to invent tests, reviewers, links, or review findings |
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
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 PR description.
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.
343
367
 
344
368
  ### `output.*`
345
369
 
@@ -358,7 +382,8 @@ These are the validated option sets enforced by the CLI.
358
382
 
359
383
  Supported output and commit-message languages:
360
384
 
361
- - `zh`
385
+ - `zh-cn`
386
+ - `zh-tw`
362
387
  - `en`
363
388
  - `de`
364
389
  - `fr`
@@ -415,10 +440,26 @@ Most practical flags:
415
440
  --commit-message-structure
416
441
  --commit-message
417
442
  --pass-history-write-stage
418
- --enable-pull-request-summary
419
- --pull-request-summary-language
420
- --pull-request-summary-output-dir
421
- --pull-request-summary-prompt
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
422
463
  --no-commit
423
464
  --no-push
424
465
  --dry-run
@@ -452,10 +493,26 @@ SMART_COMMIT_AUTO_PUSH
452
493
  SMART_COMMIT_PASS_HISTORY_WRITE_STAGE
453
494
  SMART_COMMIT_REPORT_LANGUAGE
454
495
  SMART_COMMIT_REPORT_OUTPUT_DIR
455
- SMART_COMMIT_ENABLE_PULL_REQUEST_SUMMARY
456
- SMART_COMMIT_PULL_REQUEST_SUMMARY_LANGUAGE
457
- SMART_COMMIT_PULL_REQUEST_SUMMARY_OUTPUT_DIR
458
- SMART_COMMIT_PULL_REQUEST_SUMMARY_PROMPT
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
459
516
  ```
460
517
 
461
518
  Useful boolean environment variables accept:
@@ -510,8 +567,11 @@ Supported periods:
510
567
  - `daily`
511
568
  - `yesterday`
512
569
  - `weekly`
570
+ - `last-week`
513
571
  - `monthly`
572
+ - `last-month`
514
573
  - `quarterly`
574
+ - `last-quarter`
515
575
  - `yearly`
516
576
 
517
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`, `config.review.skill.id`, `config.commitMessage.structure`, and `config.pullRequestSummary.enabled` 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,7 +58,8 @@ Stable top-level fields:
57
58
  - `didPush`
58
59
  - `commitSha`
59
60
  - `passHistory`
60
- - `pullRequestSummary`
61
+ - `stagedChangeSummary`
62
+ - `pullRequestCreation`
61
63
  - `reviewDecision`
62
64
  - `score`
63
65
  - `summary`
@@ -66,8 +68,10 @@ Stable top-level fields:
66
68
  Stable nested fields often used by automations:
67
69
 
68
70
  - `passHistory.eventType`
69
- - `pullRequestSummary.generated`
70
- - `pullRequestSummary.outputFilePath`
71
+ - `stagedChangeSummary.generated`
72
+ - `stagedChangeSummary.outputFilePath`
73
+ - `pullRequestCreation.status`
74
+ - `pullRequestCreation.url`
71
75
  - `reviewDetails`
72
76
 
73
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.
@@ -85,7 +89,20 @@ Stable nested fields often used by automations:
85
89
 
86
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.
87
91
 
88
- `pullRequestSummary` is always present in bridge output. When `pullRequestSummary.enabled = true`, the CLI attempts generation only after the review/commit/push action for that run succeeds. Generation failures are reported in `pullRequestSummary.error` and do not change the already successful bridge exit code.
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.
89
106
 
90
107
  Status semantics:
91
108
 
@@ -123,7 +140,7 @@ Command:
123
140
  smart-commit report generate --repo /path/to/repo --period weekly
124
141
  ```
125
142
 
126
- 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`.
127
144
 
128
145
  Stable top-level fields:
129
146
 
@@ -166,6 +183,50 @@ Recommended automation behavior:
166
183
  - use `facts.totals.commitCompleted` and `facts.totals.commitPushCompleted` separately if local commit completion and remote push completion need different downstream handling
167
184
  - fail on `status: "error"`
168
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
+
169
230
  ## Versioning Guidance
170
231
 
171
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.7-draft.md`](./releases/0.1.7-draft.md)
24
+ 6. Review the matching release draft in [`docs/releases/0.1.9-draft.md`](./releases/0.1.9-draft.md)
25
25
 
26
26
  ## Recommended Release Order
27
27
 
@@ -4,14 +4,14 @@
4
4
 
5
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
6
 
7
- This release focuses on turning a successful review-and-commit run into a ready-to-paste PR summary artifact without changing the bridge exit code when summary generation fails.
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
8
 
9
9
  ## Highlights
10
10
 
11
- - opt-in `pullRequestSummary.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 `pullRequestSummary.error` and optional stderr warnings
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
13
  - Markdown files use a stable `smart-commit-pr-summary-*.md` naming pattern under the chosen or default output directory
14
- - legacy `smartCommit.pullRequestSummary*` keys map into the same resolved `pullRequestSummary` object as other Smart Commit settings
14
+ - legacy `smartCommit.stagedChangeSummary*` keys map into the same resolved `stagedChangeSummary` object as other Smart Commit settings
15
15
 
16
16
  ## Why This Release Matters
17
17
 
@@ -23,9 +23,9 @@ This version closes the loop for teams that open pull requests immediately after
23
23
 
24
24
  ## Notable Behavior Updates
25
25
 
26
- ### Pull request summary
26
+ ### Staged change summary
27
27
 
28
- - when disabled, bridge output still includes `pullRequestSummary` with `generated: false` and null file or provider fields as appropriate
28
+ - when disabled, bridge output still includes `stagedChangeSummary` with `generated: false` and null file or provider fields as appropriate
29
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
30
  - text output includes whether a file was written and any error string for operator visibility
31
31
 
@@ -37,9 +37,9 @@ This version closes the loop for teams that open pull requests immediately after
37
37
 
38
38
  The project now has stronger regression protection for:
39
39
 
40
- 1. `pullRequestSummary` defaults and legacy key mapping in config resolution
40
+ 1. `stagedChangeSummary` defaults and legacy key mapping in config resolution
41
41
  2. bridge JSON shape and schema output for the new fields
42
- 3. mock-provider success and empty-output failure paths for pull request summary generation
42
+ 3. mock-provider success and empty-output failure paths for staged change summary generation
43
43
 
44
44
  ## Suggested Upgrade Path
45
45
 
@@ -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