smart-commit-copilot-cli 0.1.12 → 0.1.14

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 (99) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +90 -10
  3. package/docs/configuration.md +93 -17
  4. package/docs/contracts.md +106 -2
  5. package/docs/getting-started.md +18 -1
  6. package/docs/integrations.md +2 -0
  7. package/docs/publish.md +1 -1
  8. package/docs/release-checklist.md +1 -1
  9. package/docs/releases/0.1.13-draft.md +63 -0
  10. package/docs/releases/0.1.14-draft.md +94 -0
  11. package/docs/releases/0.1.8-draft.md +3 -3
  12. package/docs/verification.md +7 -0
  13. package/examples/config/smart-commit.json +19 -5
  14. package/out/cli.js +7 -1
  15. package/out/cli.js.map +1 -1
  16. package/out/cliApp.js +102 -8
  17. package/out/cliApp.js.map +1 -1
  18. package/out/commands/bridge.js +3 -3
  19. package/out/commands/bridge.js.map +1 -1
  20. package/out/commands/commitMessage.js +239 -0
  21. package/out/commands/commitMessage.js.map +1 -0
  22. package/out/commands/pullRequest.js +3 -3
  23. package/out/commands/pullRequest.js.map +1 -1
  24. package/out/commands/pullRequestReview.js +220 -0
  25. package/out/commands/pullRequestReview.js.map +1 -0
  26. package/out/commands/report.js +96 -18
  27. package/out/commands/report.js.map +1 -1
  28. package/out/config/cliArgs.js +96 -21
  29. package/out/config/cliArgs.js.map +1 -1
  30. package/out/config/env.js +68 -28
  31. package/out/config/env.js.map +1 -1
  32. package/out/config/file.js +456 -11
  33. package/out/config/file.js.map +1 -1
  34. package/out/config/index.js +5 -1
  35. package/out/config/index.js.map +1 -1
  36. package/out/config/legacySmartCommit.js +120 -14
  37. package/out/config/legacySmartCommit.js.map +1 -1
  38. package/out/config/merge.js +27 -11
  39. package/out/config/merge.js.map +1 -1
  40. package/out/config/schema.js +57 -7
  41. package/out/config/schema.js.map +1 -1
  42. package/out/contracts.js +244 -11
  43. package/out/contracts.js.map +1 -1
  44. package/out/git.js +101 -0
  45. package/out/git.js.map +1 -1
  46. package/out/localization.js +106 -0
  47. package/out/localization.js.map +1 -0
  48. package/out/passHistory/index.js +1 -1
  49. package/out/passHistory/index.js.map +1 -1
  50. package/out/pullRequest/api.js +39 -26
  51. package/out/pullRequest/api.js.map +1 -1
  52. package/out/pullRequest/config.js +36 -2
  53. package/out/pullRequest/config.js.map +1 -1
  54. package/out/pullRequest/index.js +6 -0
  55. package/out/pullRequest/index.js.map +1 -1
  56. package/out/pullRequest/mergeGate.js +34 -0
  57. package/out/pullRequest/mergeGate.js.map +1 -0
  58. package/out/pullRequest/platform.js +13 -0
  59. package/out/pullRequest/platform.js.map +1 -1
  60. package/out/pullRequest/reviewApi.js +424 -0
  61. package/out/pullRequest/reviewApi.js.map +1 -0
  62. package/out/pullRequest/reviewComment.js +176 -0
  63. package/out/pullRequest/reviewComment.js.map +1 -0
  64. package/out/pullRequest/reviewGate.js +43 -0
  65. package/out/pullRequest/reviewGate.js.map +1 -0
  66. package/out/pullRequest/reviewWorkflow.js +313 -0
  67. package/out/pullRequest/reviewWorkflow.js.map +1 -0
  68. package/out/pullRequest/urlParser.js +135 -0
  69. package/out/pullRequest/urlParser.js.map +1 -0
  70. package/out/pullRequest/workflow.js +17 -4
  71. package/out/pullRequest/workflow.js.map +1 -1
  72. package/out/renderOutput.js +59 -0
  73. package/out/renderOutput.js.map +1 -1
  74. package/out/reporting/aggregate.js +1 -1
  75. package/out/reporting/aggregate.js.map +1 -1
  76. package/out/reporting/index.js +2 -2
  77. package/out/reporting/index.js.map +1 -1
  78. package/out/reporting/render.js +5 -1
  79. package/out/reporting/render.js.map +1 -1
  80. package/out/reporting/timeWindow.js +52 -2
  81. package/out/reporting/timeWindow.js.map +1 -1
  82. package/out/reporting/types.js.map +1 -1
  83. package/out/review/chunkAggregate.js +53 -0
  84. package/out/review/chunkAggregate.js.map +1 -0
  85. package/out/review/detailLocator.js +19 -12
  86. package/out/review/detailLocator.js.map +1 -1
  87. package/out/review/diffReviewRunner.js +191 -0
  88. package/out/review/diffReviewRunner.js.map +1 -0
  89. package/out/review/index.js +12 -45
  90. package/out/review/index.js.map +1 -1
  91. package/out/review/mockProvider.js +55 -44
  92. package/out/review/mockProvider.js.map +1 -1
  93. package/out/review/openaiProvider.js +31 -20
  94. package/out/review/openaiProvider.js.map +1 -1
  95. package/out/review/parser.js +39 -2
  96. package/out/review/parser.js.map +1 -1
  97. package/out/review/prompt.js +180 -8
  98. package/out/review/prompt.js.map +1 -1
  99. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,41 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.14] - 2026-06-18
10
+
11
+ ### Added
12
+
13
+ - `smart-commit pull-request review <url>` for reviewing existing GitHub pull requests or GitLab merge requests from a web URL
14
+ - `pullRequestReview.*` configuration for threshold, severity filters, auto-approve, auto-merge, skip-on-pass behavior, skill prompt tuning, and optional local override files
15
+ - chunked PR/MR diff review with aggregated scoring, localized fallback summaries, and diff-aware inline comment anchoring
16
+ - summary and inline comment publishing, including update-in-place for existing Smart Commit summary comments
17
+ - `pull-request-review` schema target and structured JSON output for comment, approve, and merge action state
18
+ - expanded output language support for `de`, `fr`, `es`, `it`, `pt`, `tr`, `id`, `hi`, `ru`, `ko`, and `ja`
19
+ - localized user-facing PR review messages for unanchored inline findings
20
+ - regression coverage for PR/MR URL parsing, review API helpers, comment rendering, publish gating, merge gating, chunked aggregation, and review workflow behavior
21
+
22
+ ### Changed
23
+
24
+ - the shared review engine now supports chunked execution through `diffReviewRunner` for large remote diffs
25
+ - README, configuration, contracts, integrations, getting-started, and verification docs now describe PR/MR review automation
26
+ - publish guidance now points to the `0.1.14` release draft during pre-publish review
27
+
28
+ ## [0.1.13] - 2026-05-26
29
+
30
+ ### Added
31
+
32
+ - `smart-commit commit-message generate` for standalone commit-message resolution without review, commit, push, pass-history, summaries, or PR/MR creation
33
+ - `report generate --period custom --start-date YYYY-MM-DD --end-date YYYY-MM-DD` for inclusive natural-day report windows
34
+ - `commit-message-generate` schema target and structured branch comparison `commits` data for PR/MR creation
35
+ - regression coverage for commit-message generate, custom report periods, single-commit PR title fallback, and related CLI contracts
36
+
37
+ ### Changed
38
+
39
+ - PR/MR creation reuses the sole compare-range commit subject as the title when `pullRequest.titlePrompt` is empty and exactly one commit is present
40
+ - GitHub and GitLab compare commit parsing now share structured subject/body formatting helpers
41
+ - README, configuration, contracts, and verification docs now describe `commit-message generate` and custom report periods
42
+ - publish guidance now points to the `0.1.13` release draft during pre-publish review
43
+
9
44
  ## [0.1.12] - 2026-05-25
10
45
 
11
46
  ### Added
package/README.md CHANGED
@@ -14,6 +14,7 @@ It can:
14
14
 
15
15
  - inspect staged changes
16
16
  - run AI review and gate on the result
17
+ - review existing GitHub pull requests or GitLab merge requests by URL
17
18
  - generate or validate commit messages
18
19
  - retry malformed review or commit-message responses with configurable correction passes
19
20
  - use bundled review skills, including `c-code-review`, with diff-aware generic fallback
@@ -22,6 +23,7 @@ It can:
22
23
  - generate staged change summaries after successful review, commit, or push flows
23
24
  - auto-create GitHub PRs or GitLab MRs after a successful push when configured
24
25
  - create or dry-run PR/MR content through standalone `pull-request create`
26
+ - review existing PR/MR URLs through standalone `pull-request review`
25
27
  - persist successful run history in pass history
26
28
  - generate local or AI-enhanced daily, yesterday, weekly, last-week, monthly, last-month, quarterly, last-quarter, or yearly Markdown work reports
27
29
 
@@ -59,18 +61,21 @@ At a high level, `smart-commit bridge` does this:
59
61
  | Commit | Only when review passes and `git.autoCommit=true` | Creates a local Git commit with the final commit message. | New local commit. |
60
62
  | Push | Only when commit succeeds and `git.autoPush=true` | Pushes the current branch to its configured upstream. | Remote branch update, or a push-phase runtime error. |
61
63
  | Staged change summary | Only after a successful review-only, commit-only, or push run when `stagedChangeSummary.enabled=true` | Writes a Markdown summary for the reviewed staged change. | Markdown file under the configured summary directory. |
62
- | PR/MR auto-create | Only after a successful push when `pullRequest.autoCreateAfterPush=true` | Creates or detects an existing GitHub pull request or GitLab merge request. | `pullRequestCreation` details in bridge JSON output. |
64
+ | PR/MR auto-create | Only after a successful push when `pullRequestCreation.autoCreateAfterPush=true` | Creates or detects an existing GitHub pull request or GitLab merge request. | `pullRequestCreation` details in bridge JSON output. |
63
65
  | Pass history | Only when `passHistory.enabled=true` and the configured `passHistory.writeStage` is reached | Records or upgrades the successful run to the furthest completed stage. | Local pass-history record for later reporting. |
64
66
 
65
67
  Optional follow-up commands:
66
68
 
67
69
  ```bash
70
+ smart-commit commit-message generate --repo . --config ./smart-commit.json
68
71
  smart-commit pull-request create --repo . --config ./smart-commit.json --target-branch main --dry-run
69
72
  smart-commit pull-request create --repo . --config ./smart-commit.json --target-branch main
73
+ smart-commit pull-request review https://github.com/org/repo/pull/123 --config ./smart-commit.json --dry-run
70
74
  smart-commit report generate --repo . --config ./smart-commit.json --period weekly
75
+ smart-commit report generate --repo . --config ./smart-commit.json --period custom --start-date 2026-04-01 --end-date 2026-04-09
71
76
  ```
72
77
 
73
- `smart-commit pull-request create` is an independent PR/MR command. `smart-commit report generate` summarizes existing pass-history records; it is not part of every `bridge` run.
78
+ `smart-commit commit-message generate` resolves only the commit-message portion of the workflow. `smart-commit pull-request create` is an independent PR/MR command. `smart-commit pull-request review` reviews an existing PR/MR URL and can publish comments, approve, or merge based on config. `smart-commit report generate` summarizes existing pass-history records; it is not part of every `bridge` run.
74
79
 
75
80
  ## Prerequisites
76
81
 
@@ -85,7 +90,9 @@ Before you run the CLI, make sure you have:
85
90
  Important command requirements:
86
91
 
87
92
  - `smart-commit bridge` requires `--repo`
93
+ - `smart-commit commit-message generate` requires `--repo`
88
94
  - `smart-commit report generate` requires `--repo`
95
+ - `smart-commit pull-request review` requires a pull request or merge request URL
89
96
  - `smart-commit config resolve` does not require `--repo`
90
97
  - `smart-commit config resolve` can validate config structure without a complete connection block
91
98
  - `smart-commit bridge` requires a valid connection configuration
@@ -307,7 +314,7 @@ Use this when you want a more realistic team default without enabling automatic
307
314
  "passHistory": {
308
315
  "enabled": true,
309
316
  "writeStage": "review_passed",
310
- "dirPath": ".smart-commit-cli",
317
+ "outputDirPath": ".smart-commit-cli",
311
318
  "maxEntries": 3000
312
319
  },
313
320
  "output": {
@@ -394,7 +401,7 @@ For first use, do not copy those values blindly. Start with `false` for both and
394
401
  "passHistory": {
395
402
  "enabled": true,
396
403
  "writeStage": "review_passed",
397
- "dirPath": ".smart-commit-cli",
404
+ "outputDirPath": ".smart-commit-cli",
398
405
  "maxEntries": 3000
399
406
  },
400
407
  "reporting": {
@@ -415,10 +422,14 @@ For first use, do not copy those values blindly. Start with `false` for both and
415
422
  "prompt": ""
416
423
  },
417
424
  "pullRequest": {
418
- "autoCreateAfterPush": false,
419
- "targetBranch": "",
420
425
  "provider": "auto",
421
426
  "apiBaseUrl": "",
427
+ "authToken": "env:SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN"
428
+ },
429
+ "pullRequestCreation": {
430
+ "autoCreateAfterPush": false,
431
+ "configFilePath": "",
432
+ "targetBranch": "",
422
433
  "titlePrompt": "",
423
434
  "descriptionPrompt": "",
424
435
  "maxDiffChars": 200000,
@@ -428,8 +439,18 @@ For first use, do not copy those values blindly. Start with `false` for both and
428
439
  "milestone": "",
429
440
  "draft": false,
430
441
  "removeSourceBranch": false,
431
- "skipBranches": ["main", "master", "develop"],
432
- "authToken": "env:SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN"
442
+ "skipBranches": ["main", "master", "develop"]
443
+ },
444
+ "pullRequestReview": {
445
+ "configFilePath": "",
446
+ "threshold": 6,
447
+ "autoApprove": true,
448
+ "autoMerge": false,
449
+ "summarySeverities": ["P0", "P1", "P2"],
450
+ "commentSeverities": ["P0", "P1"],
451
+ "skillPromptTuning": "",
452
+ "skipSummaryOnPass": true,
453
+ "skipCommentOnPass": true
433
454
  },
434
455
  "output": {
435
456
  "format": "json",
@@ -547,6 +568,15 @@ smart-commit pull-request create --repo . --config ./smart-commit.json --target-
547
568
 
548
569
  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.
549
570
 
571
+ ### I want to review an existing PR or MR
572
+
573
+ ```bash
574
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN=... \
575
+ smart-commit pull-request review https://github.com/org/repo/pull/123 --config ./smart-commit.json
576
+ ```
577
+
578
+ This command reads the remote PR/MR, runs review against its diff, and can publish inline comments, approve, or merge when configured. Use `--dry-run` to keep it read-only for platform actions.
579
+
550
580
  ### I want machine-readable schemas
551
581
 
552
582
  ```bash
@@ -558,8 +588,10 @@ Supported schema targets:
558
588
  - `config-file`
559
589
  - `config-resolve`
560
590
  - `bridge`
591
+ - `commit-message-generate`
561
592
  - `report-generate`
562
593
  - `pull-request-create`
594
+ - `pull-request-review`
563
595
 
564
596
  Examples:
565
597
 
@@ -567,8 +599,10 @@ Examples:
567
599
  smart-commit schema print --target config-file
568
600
  smart-commit schema print --target config-resolve
569
601
  smart-commit schema print --target bridge
602
+ smart-commit schema print --target commit-message-generate
570
603
  smart-commit schema print --target report-generate
571
604
  smart-commit schema print --target pull-request-create
605
+ smart-commit schema print --target pull-request-review
572
606
  ```
573
607
 
574
608
  ## Core Commands Reference
@@ -612,6 +646,12 @@ smart-commit bridge --repo . --config ./smart-commit.json
612
646
  smart-commit report generate --repo . --config ./smart-commit.json --period weekly
613
647
  ```
614
648
 
649
+ ### Review an existing PR or MR
650
+
651
+ ```bash
652
+ smart-commit pull-request review https://github.com/org/repo/pull/123 --config ./smart-commit.json
653
+ ```
654
+
615
655
  ### Print a schema
616
656
 
617
657
  ```bash
@@ -667,6 +707,13 @@ Typical interpretation:
667
707
  - `3`: config error
668
708
  - `4`: runtime error
669
709
 
710
+ ### `commit-message generate`
711
+
712
+ - `0`: success
713
+ - `2`: blocked preflight, such as no changes or no staged diff with auto-stage disabled
714
+ - `3`: config error
715
+ - `4`: runtime error
716
+
670
717
  ## Configuration Rules
671
718
 
672
719
  Config precedence from high to low:
@@ -757,13 +804,16 @@ Pass history:
757
804
  --enable-pass-history <true|false>
758
805
  --pass-history-write-stage <review_passed|commit_completed|commit_push_completed>
759
806
  --pass-history-dir <path>
807
+ --pass-history-output-dir <path>
760
808
  --pass-history-max-entries <number>
761
809
  ```
762
810
 
763
811
  Reporting:
764
812
 
765
813
  ```bash
766
- --period <daily|yesterday|weekly|last-week|monthly|last-month|quarterly|last-quarter|yearly>
814
+ --period <daily|yesterday|weekly|last-week|monthly|last-month|quarterly|last-quarter|yearly|custom>
815
+ --start-date <YYYY-MM-DD>
816
+ --end-date <YYYY-MM-DD>
767
817
  --report-language <zh-cn|zh-tw|en|...>
768
818
  --report-week-starts-on <monday|sunday>
769
819
  --report-output-dir <path>
@@ -773,7 +823,7 @@ Reporting:
773
823
  --no-report-ai
774
824
  ```
775
825
 
776
- `--period` belongs to `report generate`; it is not a global config override for `bridge`.
826
+ `--period` belongs to `report generate`; it is not a global config override for `bridge`. Use `--period custom --start-date YYYY-MM-DD --end-date YYYY-MM-DD` for an inclusive natural-day range.
777
827
 
778
828
  Staged change summary:
779
829
 
@@ -816,6 +866,20 @@ Pull request / merge request:
816
866
  --pull-request-skip-branch <branch>
817
867
  ```
818
868
 
869
+ Pull request review:
870
+
871
+ ```bash
872
+ --pull-request-review-config-file <path1,path2,...>
873
+ --pull-request-review-threshold <number>
874
+ --pull-request-review-auto-approve <true|false>
875
+ --pull-request-review-auto-merge <true|false>
876
+ --pull-request-review-summary-severities <P0,P1,P2,P3>
877
+ --pull-request-review-comment-severities <P0,P1,P2,P3>
878
+ --pull-request-review-skill-prompt-tuning <text>
879
+ --pull-request-review-skip-summary-on-pass <true|false>
880
+ --pull-request-review-skip-comment-on-pass <true|false>
881
+ ```
882
+
819
883
  Repeat `--assignee`, `--reviewer`, `--label`, or `--skip-branch` to pass multiple values.
820
884
 
821
885
  ## Environment Variables Reference
@@ -872,6 +936,7 @@ SMART_COMMIT_PUSH_TIMEOUT_MS
872
936
  SMART_COMMIT_ENABLE_PASS_HISTORY
873
937
  SMART_COMMIT_PASS_HISTORY_WRITE_STAGE
874
938
  SMART_COMMIT_PASS_HISTORY_DIR
939
+ SMART_COMMIT_PASS_HISTORY_OUTPUT_DIR
875
940
  SMART_COMMIT_PASS_HISTORY_MAX_ENTRIES
876
941
  ```
877
942
 
@@ -916,6 +981,21 @@ SMART_COMMIT_PULL_REQUEST_SKIP_BRANCHES
916
981
  SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN
917
982
  ```
918
983
 
984
+ Pull request review:
985
+
986
+ ```bash
987
+ SMART_COMMIT_PULL_REQUEST_REVIEW_CONFIG_FILE
988
+ SMART_COMMIT_PULL_REQUEST_REVIEW_CONFIG_FILE_PATH
989
+ SMART_COMMIT_PULL_REQUEST_REVIEW_THRESHOLD
990
+ SMART_COMMIT_PULL_REQUEST_REVIEW_AUTO_APPROVE
991
+ SMART_COMMIT_PULL_REQUEST_REVIEW_AUTO_MERGE
992
+ SMART_COMMIT_PULL_REQUEST_REVIEW_SUMMARY_SEVERITIES
993
+ SMART_COMMIT_PULL_REQUEST_REVIEW_COMMENT_SEVERITIES
994
+ SMART_COMMIT_PULL_REQUEST_REVIEW_SKILL_PROMPT_TUNING
995
+ SMART_COMMIT_PULL_REQUEST_REVIEW_SKIP_SUMMARY_ON_PASS
996
+ SMART_COMMIT_PULL_REQUEST_REVIEW_SKIP_COMMENT_ON_PASS
997
+ ```
998
+
919
999
  ## Reporting
920
1000
 
921
1001
  If `passHistory.enabled=true`, successful bridge runs are written to local history and can be summarized later:
@@ -157,7 +157,7 @@ Recommended early team setup:
157
157
  "passHistory": {
158
158
  "enabled": true,
159
159
  "writeStage": "review_passed",
160
- "dirPath": ".smart-commit-cli",
160
+ "outputDirPath": ".smart-commit-cli",
161
161
  "maxEntries": 3000
162
162
  },
163
163
  "output": {
@@ -303,10 +303,28 @@ These settings control local storage for successful run history.
303
303
  | --- | --- | --- | --- | --- |
304
304
  | `passHistory.enabled` | `false` | `true` if you want reporting later | Turn it on when you want local historical reporting | Forgetting to enable it and then expecting `report generate` to summarize past work |
305
305
  | `passHistory.writeStage` | `review_passed` | `review_passed` | Change it when you want pass-history records to start only after commit or push success | Assuming it changes the stored `eventType`, when it actually changes the earliest write point |
306
- | `passHistory.dirPath` | empty string | Leave empty first or set `.smart-commit-cli` explicitly | Change it only if you want a custom location | Thinking empty means broken, when it actually falls back to the repo-local default directory |
306
+ | `passHistory.outputDirPath` | empty string | Leave empty first or set `.smart-commit-cli` explicitly | Change it only if you want a custom location | Thinking empty means broken, when it actually falls back to the repo-local default directory |
307
307
  | `passHistory.maxEntries` | `3000` | `3000` | Change it only if you need much shorter or longer retention | Setting it to `0` or a non-integer, which fails validation |
308
308
 
309
- If `passHistory.dirPath` is empty, the CLI automatically stores pass history under the repository's `.smart-commit-cli` directory.
309
+ If `passHistory.outputDirPath` is empty, the CLI automatically stores pass history under the repository's `.smart-commit-cli` directory.
310
+
311
+ ### `pullRequestReview.*`
312
+
313
+ These settings control the standalone `pull-request review` command.
314
+
315
+ | Field | Built-in default | Recommended first value | When to change it | Common mistake |
316
+ | --- | --- | --- | --- | --- |
317
+ | `pullRequestReview.configFilePath` | empty string | Leave empty first, or point it at a comma-separated local fallback list | Change it when you want a local PR/MR review config file to override shared config | Putting shared PR auth fields here or expecting it to support `pullRequestReview.configFilePath` inside the local file |
318
+ | `pullRequestReview.threshold` | `6` | `6` | Lower it if reviews block too often; raise it if you want stricter gating | Forgetting the pass rule is still score-based |
319
+ | `pullRequestReview.autoApprove` | `true` | `true` | Disable it when you want review comments without approval side effects | Assuming it is only about UI decoration |
320
+ | `pullRequestReview.autoMerge` | `false` | `false` | Enable it only when your platform flow and merge gate are ready | Assuming approval alone implies merge |
321
+ | `pullRequestReview.summarySeverities` | `["P0", "P1", "P2"]` | Keep default first | Narrow it when you want the summary comment to focus on fewer severities | Expecting all severities to appear regardless of the filter |
322
+ | `pullRequestReview.commentSeverities` | `["P0", "P1"]` | Keep default first | Broaden it when you want more inline noise | Assuming summary and inline filters are linked |
323
+ | `pullRequestReview.skillPromptTuning` | empty string | Leave empty first | Add a short prompt tweak when the built-in review skill needs local context | Dropping in a full policy essay |
324
+ | `pullRequestReview.skipSummaryOnPass` | `true` | `true` | Set `false` when you want a summary comment even on passing reviews | Expecting it to affect inline comments too |
325
+ | `pullRequestReview.skipCommentOnPass` | `true` | `true` | Set `false` when you want inline comments even on passing reviews | Expecting it to affect the summary comment too |
326
+
327
+ `pullRequestReview.configFilePath` accepts a comma-separated list of local file paths. The CLI picks the first existing file, then loads only `pullRequestReview` settings from it. The local file may use the canonical `smartCommitCli.pullRequestReview` shape or legacy `smartCommit.pullRequestReview*` keys, but it must not include shared connection or PR auth settings.
310
328
 
311
329
  `passHistory.writeStage` means "the earliest successful stage that is allowed to create a record." After a record exists, later successful stages update the same record instead of appending duplicates, so the stored `eventType` always shows the furthest successful stage reached by that run.
312
330
 
@@ -343,28 +361,38 @@ The generated summary uses only the reviewed staged diff, commit message, branch
343
361
 
344
362
  ### `pullRequest.*`
345
363
 
346
- These settings control GitHub pull request and GitLab merge request creation from the current branch.
364
+ These settings are shared by PR/MR creation and PR/MR review.
347
365
 
348
366
  | Field | Built-in default | Recommended first value | When to change it | Common mistake |
349
367
  | --- | --- | --- | --- | --- |
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
368
  | `pullRequest.provider` | `auto` | `auto` | Use `github` or `gitlab` when remote detection is ambiguous | Setting a provider that does not match the remote host |
353
369
  | `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
370
  | `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
371
 
366
372
  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
373
 
374
+ ### `pullRequestCreation.*`
375
+
376
+ These settings control GitHub pull request and GitLab merge request creation from the current branch.
377
+
378
+ | Field | Built-in default | Recommended first value | When to change it | Common mistake |
379
+ | --- | --- | --- | --- | --- |
380
+ | `pullRequestCreation.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 |
381
+ | `pullRequestCreation.configFilePath` | empty string | Leave empty first, or point it at a comma-separated local fallback list | Change it when you want a local PR/MR creation config file to override creation settings | Putting shared PR auth fields here or expecting it to support `pullRequestCreation.configFilePath` inside the local file |
382
+ | `pullRequestCreation.targetBranch` | empty string | Your default integration branch | Set it when most branches target the same branch | Forgetting that `pull-request create` requires this value or `--target-branch` |
383
+ | `pullRequestCreation.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 |
384
+ | `pullRequestCreation.descriptionPrompt` | empty string | Leave empty first | Add concise PR/MR template guidance | Asking it to invent tests, links, or approvals |
385
+ | `pullRequestCreation.maxDiffChars` | `200000` | `200000` | Lower it for very large repositories or slow models | Setting it below `1000`, which fails validation |
386
+ | `pullRequestCreation.assignees` | `[]` | `[]` | Set default assignees for created PRs/MRs | Assuming these are LLM prompt hints; they are sent to the provider API |
387
+ | `pullRequestCreation.reviewers` | `[]` | `[]` | Set default reviewers for created PRs/MRs | Assuming every provider accepts every reviewer identifier format |
388
+ | `pullRequestCreation.labels` | `[]` | `[]` | Apply standard labels during creation | Expecting missing provider labels to be created automatically |
389
+ | `pullRequestCreation.milestone` | empty string | Leave empty first | Set it when your provider project uses milestones | Using a display name where the provider expects an id |
390
+ | `pullRequestCreation.draft` | `false` | `false` | Set `true` when generated PRs/MRs should start as drafts | Expecting GitLab draft behavior to exactly match GitHub |
391
+ | `pullRequestCreation.removeSourceBranch` | `false` | `false` | Set `true` when accepted MRs should remove the source branch | Expecting GitHub to support this GitLab-only field |
392
+ | `pullRequestCreation.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 |
393
+
394
+ `pullRequestCreation.configFilePath` accepts a comma-separated list of local file paths. The CLI picks the first existing file, then loads only `pullRequestCreation` settings from it. The local file may use the canonical `smartCommitCli.pullRequestCreation` shape or legacy `smartCommit.pullRequestCreation*` keys, but it must not include shared connection or PR auth settings.
395
+
368
396
  ### `output.*`
369
397
 
370
398
  These settings control how results are presented.
@@ -439,6 +467,8 @@ Most practical flags:
439
467
  --commit-language
440
468
  --commit-message-structure
441
469
  --commit-message
470
+ --auto-generate-commit-message
471
+ --hybrid-generate-commit-message
442
472
  --pass-history-write-stage
443
473
  --enable-staged-change-summary
444
474
  --staged-change-summary-language
@@ -453,6 +483,11 @@ Most practical flags:
453
483
  --pull-request-title-prompt
454
484
  --pull-request-description-prompt
455
485
  --pull-request-max-diff-chars
486
+ --pull-request-review-threshold
487
+ --pull-request-review-auto-approve
488
+ --pull-request-review-auto-merge
489
+ --pull-request-review-summary-severities
490
+ --pull-request-review-comment-severities
456
491
  --assignee
457
492
  --reviewer
458
493
  --label
@@ -469,6 +504,8 @@ Common reporting flags:
469
504
 
470
505
  ```bash
471
506
  --period
507
+ --start-date
508
+ --end-date
472
509
  --report-language
473
510
  --report-output-dir
474
511
  --report-ai
@@ -505,6 +542,11 @@ SMART_COMMIT_PULL_REQUEST_API_BASE_URL
505
542
  SMART_COMMIT_PULL_REQUEST_TITLE_PROMPT
506
543
  SMART_COMMIT_PULL_REQUEST_DESCRIPTION_PROMPT
507
544
  SMART_COMMIT_PULL_REQUEST_MAX_DIFF_CHARS
545
+ SMART_COMMIT_PULL_REQUEST_REVIEW_THRESHOLD
546
+ SMART_COMMIT_PULL_REQUEST_REVIEW_AUTO_APPROVE
547
+ SMART_COMMIT_PULL_REQUEST_REVIEW_AUTO_MERGE
548
+ SMART_COMMIT_PULL_REQUEST_REVIEW_SUMMARY_SEVERITIES
549
+ SMART_COMMIT_PULL_REQUEST_REVIEW_COMMENT_SEVERITIES
508
550
  SMART_COMMIT_PULL_REQUEST_ASSIGNEES
509
551
  SMART_COMMIT_PULL_REQUEST_REVIEWERS
510
552
  SMART_COMMIT_PULL_REQUEST_LABELS
@@ -555,6 +597,22 @@ Safest first run:
555
597
  smart-commit bridge --repo . --config ./smart-commit.json --no-commit --no-push
556
598
  ```
557
599
 
600
+ ### `commit-message generate`
601
+
602
+ `commit-message generate` requires:
603
+
604
+ - `--repo`
605
+ - a valid repository path inside Git
606
+ - staged changes, unless auto-stage makes input available
607
+ - a valid connection configuration only when the command must call the model
608
+
609
+ It resolves and validates the commit message only. It does not run review, create a commit, push, write pass history, generate staged-change summaries, or create PR/MR records.
610
+
611
+ ```bash
612
+ smart-commit commit-message generate --repo . --config ./smart-commit.json
613
+ smart-commit commit-message generate --repo . --commit-message "feat: keep provided message" --auto-generate-commit-message=false
614
+ ```
615
+
558
616
  ### `report generate`
559
617
 
560
618
  `report generate` requires:
@@ -573,8 +631,26 @@ Supported periods:
573
631
  - `quarterly`
574
632
  - `last-quarter`
575
633
  - `yearly`
634
+ - `custom`
635
+
636
+ If `--period` is omitted, it defaults to `weekly`. `yesterday` always uses the previous natural local day. For custom ranges, use `--period custom --start-date YYYY-MM-DD --end-date YYYY-MM-DD`; the range is inclusive by natural local day.
637
+
638
+ ### `pull-request review`
639
+
640
+ `pull-request review` requires:
641
+
642
+ - a GitHub pull request URL or GitLab merge request URL
643
+ - `pullRequest.authToken`
644
+ - a valid connection configuration
645
+
646
+ It loads the remote PR/MR diff, reviews it with inline anchoring enabled, and may publish summary comments, inline comments, approvals, or merges according to `pullRequestReview.*`.
647
+
648
+ ```bash
649
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN=... \
650
+ smart-commit pull-request review https://github.com/org/repo/pull/123 --config ./smart-commit.json --dry-run
651
+ ```
576
652
 
577
- If `--period` is omitted, it defaults to `weekly`. `yesterday` always uses the previous natural local day.
653
+ Use `--dry-run` for first checks. Dry-run still reads the PR/MR and runs the model review, but skips provider writes such as comments, approval, and merge.
578
654
 
579
655
  ## Validation Workflow
580
656
 
package/docs/contracts.md CHANGED
@@ -8,8 +8,10 @@ For formal JSON Schema output, use:
8
8
 
9
9
  ```bash
10
10
  smart-commit schema print --target bridge
11
+ smart-commit schema print --target commit-message-generate
11
12
  smart-commit schema print --target report-generate
12
13
  smart-commit schema print --target pull-request-create
14
+ smart-commit schema print --target pull-request-review
13
15
  ```
14
16
 
15
17
  ## Shared Rules
@@ -38,6 +40,7 @@ Stable top-level fields:
38
40
  Use it to validate merged config before wiring `bridge` or `report generate` into automation.
39
41
 
40
42
  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.
43
+ They can also read shared PR/MR settings from `config.pullRequest.provider`, `config.pullRequest.apiBaseUrl`, and `config.pullRequest.authToken`; creation settings from `config.pullRequestCreation.*`; and review settings such as `config.pullRequestReview.configFilePath`, `config.pullRequestReview.threshold`, `config.pullRequestReview.autoApprove`, `config.pullRequestReview.autoMerge`, `config.pullRequestReview.summarySeverities`, `config.pullRequestReview.commentSeverities`, `config.pullRequestReview.skillPromptTuning`, `config.pullRequestReview.skipSummaryOnPass`, and `config.pullRequestReview.skipCommentOnPass`.
41
44
 
42
45
  ## `bridge`
43
46
 
@@ -91,7 +94,7 @@ For example, when `passHistory.writeStage = "commit_completed"`, a successful lo
91
94
 
92
95
  `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
96
 
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.
97
+ `pullRequestCreation` is always present in bridge output. When `pullRequestCreation.autoCreateAfterPush = true`, the CLI attempts creation only after push succeeds and the source branch is not in `pullRequestCreation.skipBranches`. Creation failures are reported in `pullRequestCreation.error` and do not change the already successful bridge exit code.
95
98
 
96
99
  `pullRequestCreation.status` semantics:
97
100
 
@@ -132,15 +135,115 @@ Recommended automation behavior:
132
135
  - stop on `blocked` and surface `error.code` plus `summary`
133
136
  - fail on `error`
134
137
 
138
+ ## `pull-request review`
139
+
140
+ Command:
141
+
142
+ ```bash
143
+ SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN=... \
144
+ smart-commit pull-request review https://github.com/org/repo/pull/123 --config ./smart-commit.json
145
+ ```
146
+
147
+ Stable top-level fields:
148
+
149
+ - `schemaVersion`
150
+ - `status`
151
+ - `command`
152
+ - `repositoryPath`
153
+ - `url`
154
+ - `platform`
155
+ - `number`
156
+ - `title`
157
+ - `webUrl`
158
+ - `isDraft`
159
+ - `score`
160
+ - `threshold`
161
+ - `passed`
162
+ - `reviewMode`
163
+ - `chunkCount`
164
+ - `summarySource`
165
+ - `details`
166
+ - `summaryCommentAction`
167
+ - `inlineCommentAction`
168
+ - `inlinePosted`
169
+ - `inlineSkipped`
170
+ - `inlineFailed`
171
+ - `inlineUnanchored`
172
+ - `approve`
173
+ - `merge`
174
+ - `warnings`
175
+ - `logs`
176
+ - `dryRun`
177
+ - `config`
178
+ - `summary`
179
+ - `error`
180
+
181
+ `status` semantics:
182
+
183
+ - `passed`
184
+ The review completed and passed the configured threshold.
185
+ - `blocked`
186
+ The review completed but did not pass the configured threshold.
187
+ - `error`
188
+ Configuration or runtime validation failed.
189
+
190
+ Recommended automation behavior:
191
+
192
+ - use `--dry-run` for first validation
193
+ - inspect `inlinePosted`, `inlineSkipped`, `inlineFailed`, and `inlineUnanchored` when publishing inline comments matters
194
+ - inspect `approve` and `merge` before assuming the provider side effect happened
195
+ - fail on `status: "error"`
196
+
197
+ ## `commit-message generate`
198
+
199
+ Command:
200
+
201
+ ```bash
202
+ smart-commit commit-message generate --repo /path/to/repo
203
+ ```
204
+
205
+ This command resolves the final commit message without running review, commit, push, pass-history writes, staged-change summaries, or PR/MR creation.
206
+
207
+ Stable top-level fields:
208
+
209
+ - `schemaVersion`
210
+ - `status`
211
+ - `command`
212
+ - `repositoryPath`
213
+ - `branchName`
214
+ - `commitMessage`
215
+ - `commitMessageSource`
216
+ - `commitMessageProvider`
217
+ - `changedFiles`
218
+ - `fullDiffChars`
219
+ - `autoStaged`
220
+ - `config`
221
+ - `summary`
222
+ - `error`
223
+
224
+ `status` semantics:
225
+
226
+ - `generated`
227
+ A commit message was generated from the staged diff.
228
+ - `provided`
229
+ A provided commit message was validated and returned without model generation.
230
+ - `hybrid`
231
+ A provided draft was refined by the model.
232
+ - `blocked`
233
+ Preflight could not proceed because there were no changes or no staged diff.
234
+ - `error`
235
+ Configuration or runtime validation failed.
236
+
135
237
  ## `report generate`
136
238
 
137
239
  Command:
138
240
 
139
241
  ```bash
140
242
  smart-commit report generate --repo /path/to/repo --period weekly
243
+ smart-commit report generate --repo /path/to/repo --period custom --start-date 2026-04-01 --end-date 2026-04-09
141
244
  ```
142
245
 
143
- Supported `periodType` values are `daily`, `yesterday`, `weekly`, `last-week`, `monthly`, `last-month`, `quarterly`, `last-quarter`, and `yearly`.
246
+ Supported `periodType` values are `daily`, `yesterday`, `weekly`, `last-week`, `monthly`, `last-month`, `quarterly`, `last-quarter`, `yearly`, and `custom`.
144
247
 
145
248
  Stable top-level fields:
146
249
 
@@ -149,6 +252,7 @@ Stable top-level fields:
149
252
  - `command`
150
253
  - `repositoryPath`
151
254
  - `periodType`
255
+ - `periodSelection`
152
256
  - `passHistoryFilePath`
153
257
  - `outputFilePath`
154
258
  - `renderMode`
@@ -33,6 +33,7 @@ Important command requirements:
33
33
 
34
34
  - `bridge` requires `--repo`
35
35
  - `report generate` requires `--repo`
36
+ - `pull-request review` requires a PR/MR URL
36
37
  - `config resolve` does not require `--repo`
37
38
  - `bridge` requires a valid connection config
38
39
 
@@ -284,6 +285,21 @@ smart-commit report generate --repo . --config ./smart-commit.json --period week
284
285
 
285
286
  If AI report generation fails, the CLI falls back to local Markdown generation automatically.
286
287
 
288
+ ## Optional: Review An Existing PR Or MR
289
+
290
+ After the staged-change workflow is working, you can use the same review engine against a remote GitHub pull request or GitLab merge request.
291
+
292
+ ```bash
293
+ export SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN="your-provider-token"
294
+
295
+ smart-commit pull-request review \
296
+ https://github.com/org/repo/pull/123 \
297
+ --config ./smart-commit.json \
298
+ --dry-run
299
+ ```
300
+
301
+ Dry-run still reads the PR/MR and runs the model review, but it skips comments, approval, and merge. Remove `--dry-run` only after `pullRequestReview.*` and provider permissions are set the way you want.
302
+
287
303
  ## Suggested First Rollout
288
304
 
289
305
  For a new repository or team, use this order:
@@ -294,7 +310,8 @@ For a new repository or team, use this order:
294
310
  4. wire the same review-only command into Husky, Cursor hooks, or scripts
295
311
  5. enable pass history
296
312
  6. add reporting
297
- 7. only then consider automatic commit or push
313
+ 7. optionally dry-run `pull-request review` against a test PR/MR
314
+ 8. only then consider automatic commit, push, approval, or merge automation
298
315
 
299
316
  This rollout keeps the first adoption phase safe while still validating the full workflow.
300
317