smart-commit-copilot-cli 0.1.13 → 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 (86) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +76 -8
  3. package/docs/configuration.md +71 -16
  4. package/docs/contracts.md +63 -1
  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 +2 -2
  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 +3 -0
  13. package/examples/config/smart-commit.json +19 -5
  14. package/out/cliApp.js +60 -10
  15. package/out/cliApp.js.map +1 -1
  16. package/out/commands/bridge.js +3 -3
  17. package/out/commands/bridge.js.map +1 -1
  18. package/out/commands/pullRequest.js +3 -3
  19. package/out/commands/pullRequest.js.map +1 -1
  20. package/out/commands/pullRequestReview.js +220 -0
  21. package/out/commands/pullRequestReview.js.map +1 -0
  22. package/out/commands/report.js +1 -1
  23. package/out/commands/report.js.map +1 -1
  24. package/out/config/cliArgs.js +96 -21
  25. package/out/config/cliArgs.js.map +1 -1
  26. package/out/config/env.js +68 -28
  27. package/out/config/env.js.map +1 -1
  28. package/out/config/file.js +456 -11
  29. package/out/config/file.js.map +1 -1
  30. package/out/config/index.js +5 -1
  31. package/out/config/index.js.map +1 -1
  32. package/out/config/legacySmartCommit.js +120 -14
  33. package/out/config/legacySmartCommit.js.map +1 -1
  34. package/out/config/merge.js +27 -11
  35. package/out/config/merge.js.map +1 -1
  36. package/out/config/schema.js +57 -7
  37. package/out/config/schema.js.map +1 -1
  38. package/out/contracts.js +157 -11
  39. package/out/contracts.js.map +1 -1
  40. package/out/git.js +101 -0
  41. package/out/git.js.map +1 -1
  42. package/out/localization.js +106 -0
  43. package/out/localization.js.map +1 -0
  44. package/out/passHistory/index.js +1 -1
  45. package/out/passHistory/index.js.map +1 -1
  46. package/out/pullRequest/api.js +14 -4
  47. package/out/pullRequest/api.js.map +1 -1
  48. package/out/pullRequest/config.js +36 -2
  49. package/out/pullRequest/config.js.map +1 -1
  50. package/out/pullRequest/index.js +6 -0
  51. package/out/pullRequest/index.js.map +1 -1
  52. package/out/pullRequest/mergeGate.js +34 -0
  53. package/out/pullRequest/mergeGate.js.map +1 -0
  54. package/out/pullRequest/platform.js +13 -0
  55. package/out/pullRequest/platform.js.map +1 -1
  56. package/out/pullRequest/reviewApi.js +424 -0
  57. package/out/pullRequest/reviewApi.js.map +1 -0
  58. package/out/pullRequest/reviewComment.js +176 -0
  59. package/out/pullRequest/reviewComment.js.map +1 -0
  60. package/out/pullRequest/reviewGate.js +43 -0
  61. package/out/pullRequest/reviewGate.js.map +1 -0
  62. package/out/pullRequest/reviewWorkflow.js +313 -0
  63. package/out/pullRequest/reviewWorkflow.js.map +1 -0
  64. package/out/pullRequest/urlParser.js +135 -0
  65. package/out/pullRequest/urlParser.js.map +1 -0
  66. package/out/pullRequest/workflow.js +3 -3
  67. package/out/pullRequest/workflow.js.map +1 -1
  68. package/out/renderOutput.js +37 -0
  69. package/out/renderOutput.js.map +1 -1
  70. package/out/review/chunkAggregate.js +53 -0
  71. package/out/review/chunkAggregate.js.map +1 -0
  72. package/out/review/detailLocator.js +19 -12
  73. package/out/review/detailLocator.js.map +1 -1
  74. package/out/review/diffReviewRunner.js +191 -0
  75. package/out/review/diffReviewRunner.js.map +1 -0
  76. package/out/review/index.js +12 -45
  77. package/out/review/index.js.map +1 -1
  78. package/out/review/mockProvider.js +55 -44
  79. package/out/review/mockProvider.js.map +1 -1
  80. package/out/review/openaiProvider.js +31 -20
  81. package/out/review/openaiProvider.js.map +1 -1
  82. package/out/review/parser.js +39 -2
  83. package/out/review/parser.js.map +1 -1
  84. package/out/review/prompt.js +180 -8
  85. package/out/review/prompt.js.map +1 -1
  86. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,25 @@ 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
+
9
28
  ## [0.1.13] - 2026-05-26
10
29
 
11
30
  ### 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,7 +61,7 @@ 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:
@@ -68,11 +70,12 @@ Optional follow-up commands:
68
70
  smart-commit commit-message generate --repo . --config ./smart-commit.json
69
71
  smart-commit pull-request create --repo . --config ./smart-commit.json --target-branch main --dry-run
70
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
71
74
  smart-commit report generate --repo . --config ./smart-commit.json --period weekly
72
75
  smart-commit report generate --repo . --config ./smart-commit.json --period custom --start-date 2026-04-01 --end-date 2026-04-09
73
76
  ```
74
77
 
75
- `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 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.
76
79
 
77
80
  ## Prerequisites
78
81
 
@@ -89,6 +92,7 @@ Important command requirements:
89
92
  - `smart-commit bridge` requires `--repo`
90
93
  - `smart-commit commit-message generate` requires `--repo`
91
94
  - `smart-commit report generate` requires `--repo`
95
+ - `smart-commit pull-request review` requires a pull request or merge request URL
92
96
  - `smart-commit config resolve` does not require `--repo`
93
97
  - `smart-commit config resolve` can validate config structure without a complete connection block
94
98
  - `smart-commit bridge` requires a valid connection configuration
@@ -310,7 +314,7 @@ Use this when you want a more realistic team default without enabling automatic
310
314
  "passHistory": {
311
315
  "enabled": true,
312
316
  "writeStage": "review_passed",
313
- "dirPath": ".smart-commit-cli",
317
+ "outputDirPath": ".smart-commit-cli",
314
318
  "maxEntries": 3000
315
319
  },
316
320
  "output": {
@@ -397,7 +401,7 @@ For first use, do not copy those values blindly. Start with `false` for both and
397
401
  "passHistory": {
398
402
  "enabled": true,
399
403
  "writeStage": "review_passed",
400
- "dirPath": ".smart-commit-cli",
404
+ "outputDirPath": ".smart-commit-cli",
401
405
  "maxEntries": 3000
402
406
  },
403
407
  "reporting": {
@@ -418,10 +422,14 @@ For first use, do not copy those values blindly. Start with `false` for both and
418
422
  "prompt": ""
419
423
  },
420
424
  "pullRequest": {
421
- "autoCreateAfterPush": false,
422
- "targetBranch": "",
423
425
  "provider": "auto",
424
426
  "apiBaseUrl": "",
427
+ "authToken": "env:SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN"
428
+ },
429
+ "pullRequestCreation": {
430
+ "autoCreateAfterPush": false,
431
+ "configFilePath": "",
432
+ "targetBranch": "",
425
433
  "titlePrompt": "",
426
434
  "descriptionPrompt": "",
427
435
  "maxDiffChars": 200000,
@@ -431,8 +439,18 @@ For first use, do not copy those values blindly. Start with `false` for both and
431
439
  "milestone": "",
432
440
  "draft": false,
433
441
  "removeSourceBranch": false,
434
- "skipBranches": ["main", "master", "develop"],
435
- "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
436
454
  },
437
455
  "output": {
438
456
  "format": "json",
@@ -550,6 +568,15 @@ smart-commit pull-request create --repo . --config ./smart-commit.json --target-
550
568
 
551
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.
552
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
+
553
580
  ### I want machine-readable schemas
554
581
 
555
582
  ```bash
@@ -561,8 +588,10 @@ Supported schema targets:
561
588
  - `config-file`
562
589
  - `config-resolve`
563
590
  - `bridge`
591
+ - `commit-message-generate`
564
592
  - `report-generate`
565
593
  - `pull-request-create`
594
+ - `pull-request-review`
566
595
 
567
596
  Examples:
568
597
 
@@ -570,8 +599,10 @@ Examples:
570
599
  smart-commit schema print --target config-file
571
600
  smart-commit schema print --target config-resolve
572
601
  smart-commit schema print --target bridge
602
+ smart-commit schema print --target commit-message-generate
573
603
  smart-commit schema print --target report-generate
574
604
  smart-commit schema print --target pull-request-create
605
+ smart-commit schema print --target pull-request-review
575
606
  ```
576
607
 
577
608
  ## Core Commands Reference
@@ -615,6 +646,12 @@ smart-commit bridge --repo . --config ./smart-commit.json
615
646
  smart-commit report generate --repo . --config ./smart-commit.json --period weekly
616
647
  ```
617
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
+
618
655
  ### Print a schema
619
656
 
620
657
  ```bash
@@ -767,6 +804,7 @@ Pass history:
767
804
  --enable-pass-history <true|false>
768
805
  --pass-history-write-stage <review_passed|commit_completed|commit_push_completed>
769
806
  --pass-history-dir <path>
807
+ --pass-history-output-dir <path>
770
808
  --pass-history-max-entries <number>
771
809
  ```
772
810
 
@@ -828,6 +866,20 @@ Pull request / merge request:
828
866
  --pull-request-skip-branch <branch>
829
867
  ```
830
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
+
831
883
  Repeat `--assignee`, `--reviewer`, `--label`, or `--skip-branch` to pass multiple values.
832
884
 
833
885
  ## Environment Variables Reference
@@ -884,6 +936,7 @@ SMART_COMMIT_PUSH_TIMEOUT_MS
884
936
  SMART_COMMIT_ENABLE_PASS_HISTORY
885
937
  SMART_COMMIT_PASS_HISTORY_WRITE_STAGE
886
938
  SMART_COMMIT_PASS_HISTORY_DIR
939
+ SMART_COMMIT_PASS_HISTORY_OUTPUT_DIR
887
940
  SMART_COMMIT_PASS_HISTORY_MAX_ENTRIES
888
941
  ```
889
942
 
@@ -928,6 +981,21 @@ SMART_COMMIT_PULL_REQUEST_SKIP_BRANCHES
928
981
  SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN
929
982
  ```
930
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
+
931
999
  ## Reporting
932
1000
 
933
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.
@@ -455,6 +483,11 @@ Most practical flags:
455
483
  --pull-request-title-prompt
456
484
  --pull-request-description-prompt
457
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
458
491
  --assignee
459
492
  --reviewer
460
493
  --label
@@ -509,6 +542,11 @@ SMART_COMMIT_PULL_REQUEST_API_BASE_URL
509
542
  SMART_COMMIT_PULL_REQUEST_TITLE_PROMPT
510
543
  SMART_COMMIT_PULL_REQUEST_DESCRIPTION_PROMPT
511
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
512
550
  SMART_COMMIT_PULL_REQUEST_ASSIGNEES
513
551
  SMART_COMMIT_PULL_REQUEST_REVIEWERS
514
552
  SMART_COMMIT_PULL_REQUEST_LABELS
@@ -597,6 +635,23 @@ Supported periods:
597
635
 
598
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.
599
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
+ ```
652
+
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.
654
+
600
655
  ## Validation Workflow
601
656
 
602
657
  Before integrating the CLI into hooks or automation, use this sequence:
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,6 +135,65 @@ 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
+
135
197
  ## `commit-message generate`
136
198
 
137
199
  Command:
@@ -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
 
@@ -8,6 +8,7 @@ If you have not run the CLI manually yet, start with [`getting-started.md`](./ge
8
8
 
9
9
  - Prefer `bridge` as the enforcement entrypoint for hooks and agents
10
10
  - Prefer `report generate` as the reporting entrypoint for scheduled or post-task automation
11
+ - Prefer `pull-request review` when the automation target is an existing GitHub PR or GitLab MR URL
11
12
  - Parse JSON output instead of scraping stderr
12
13
  - Gate logic on `schemaVersion`, `status`, and `error.code`
13
14
  - Keep hook integrations in `--no-commit --no-push` mode unless you explicitly want the CLI to own Git side effects
@@ -58,6 +59,7 @@ Recommended behavior:
58
59
  For custom agents, CI bots, or local automation runners:
59
60
 
60
61
  - spawn `smart-commit bridge` or `smart-commit report generate`
62
+ - spawn `smart-commit pull-request review <url>` when you already have a remote PR/MR URL
61
63
  - parse stdout as JSON
62
64
  - check `schemaVersion`
63
65
  - branch behavior on `status`
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.13-draft.md`](./releases/0.1.13-draft.md)
24
+ 6. Review the matching release draft in [`docs/releases/0.1.14-draft.md`](./releases/0.1.14-draft.md)
25
25
 
26
26
  ## Recommended Release Order
27
27
 
@@ -15,7 +15,7 @@ Use this checklist before the first public release and for later release candida
15
15
  - Run `npm test`
16
16
  - Run `npm run smoke:test`
17
17
  - Run `npm run pack:dry-run`
18
- - Run `smart-commit schema print --target bridge` and spot-check the output
18
+ - Run `smart-commit schema print --target bridge` and `smart-commit schema print --target pull-request-review` and spot-check the output
19
19
  - Run `smart-commit config resolve` against the example config
20
20
  - Confirm GitHub Actions CI passes on the target branch
21
21
 
@@ -10,7 +10,7 @@ This release focuses on letting operators generate commit messages or date-bound
10
10
 
11
11
  - `smart-commit commit-message generate` resolves commit messages from staged changes without review, commit, push, or PR/MR side effects
12
12
  - `report generate --period custom --start-date YYYY-MM-DD --end-date YYYY-MM-DD` supports inclusive natural-day reporting ranges
13
- - PR/MR creation can reuse a single compare-range commit subject as the title when `pullRequest.titlePrompt` is empty
13
+ - PR/MR creation can reuse a single compare-range commit subject as the title when `pullRequestCreation.titlePrompt` is empty
14
14
  - `commit-message-generate` schema target and expanded verification docs for the new command surface
15
15
 
16
16
  ## Why This Release Matters
@@ -38,7 +38,7 @@ This version improves composability for automation and day-to-day CLI use:
38
38
 
39
39
  ### PR/MR title fallback
40
40
 
41
- - when `pullRequest.titlePrompt` is empty and the remote compare range contains exactly one commit, the generated title is replaced with that commit subject
41
+ - when `pullRequestCreation.titlePrompt` is empty and the remote compare range contains exactly one commit, the generated title is replaced with that commit subject
42
42
  - multi-commit ranges and custom title prompts continue to use model-generated titles
43
43
 
44
44
  ## Verification Coverage Added Or Strengthened
@@ -0,0 +1,94 @@
1
+ # `smart-commit-copilot-cli` 0.1.14 Draft Release Notes
2
+
3
+ ## Summary
4
+
5
+ `smart-commit-copilot-cli` 0.1.14 adds standalone GitHub pull request and GitLab merge request review, with optional comment publishing, approval, and merge automation.
6
+
7
+ This release extends the existing staged-change review engine to remote PR/MR URLs, so hooks, CI jobs, and agents can review already-open changes without running `bridge`.
8
+
9
+ ## Highlights
10
+
11
+ - `smart-commit pull-request review <url>` reviews an existing GitHub PR or GitLab MR from its web URL
12
+ - `pullRequestReview.*` config controls threshold, severity filters, auto-approve, auto-merge, skip-on-pass behavior, and optional local override files
13
+ - large PR/MR diffs can run in chunked review mode with aggregated scoring and localized fallback summaries
14
+ - summary and inline comments are published with diff anchoring; unanchored findings fall back to the summary comment with localized user notes
15
+ - `schema print --target pull-request-review` exposes the new command output contract
16
+ - output language support now includes `de`, `fr`, `es`, `it`, `pt`, `tr`, `id`, `hi`, `ru`, `ko`, and `ja` in addition to `zh-cn`, `zh-tw`, and `en`
17
+
18
+ ## Why This Release Matters
19
+
20
+ This version closes the loop between local staged review and remote PR/MR automation:
21
+
22
+ - teams can reuse the same review policy for pre-commit checks and post-push PR/MR review
23
+ - CI or bot workflows can comment, approve, or merge based on structured JSON output and explicit gating rules
24
+ - large diffs remain reviewable through chunked execution instead of failing or truncating silently
25
+ - operators get clearer localized messaging when inline anchoring is not possible
26
+
27
+ ## Security Notes
28
+
29
+ PR/MR auth tokens are only used for GitHub/GitLab API authentication headers.
30
+
31
+ They are not included in:
32
+
33
+ - LLM prompts or messages
34
+ - generated review comments
35
+ - rendered config output
36
+ - visible error messages
37
+
38
+ Use `SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN` or `pullRequest.authToken: "env:VAR_NAME"` for normal use.
39
+
40
+ ## Notable Behavior Updates
41
+
42
+ ### PR/MR review command
43
+
44
+ - `smart-commit pull-request review <url>` supports `--config`, `--dry-run`, `--output`, and `pullRequestReview.*` CLI overrides
45
+ - dry-run still fetches the PR/MR and runs the model review, but skips comment publishing, approval, and merge
46
+ - JSON output reports review mode, chunk count, summary source, inline publish counts, and approve/merge action state
47
+ - GitHub and GitLab URLs are parsed from common web and API forms
48
+
49
+ ### Review publishing and gating
50
+
51
+ - summary comments are filtered by `pullRequestReview.summarySeverities`
52
+ - inline comments are filtered by `pullRequestReview.commentSeverities`
53
+ - passing reviews can skip summary and/or inline comments through `skipSummaryOnPass` and `skipCommentOnPass`
54
+ - `autoApprove` and `autoMerge` run only after score-based pass evaluation and merge-gate checks
55
+ - existing Smart Commit summary comments can be updated instead of creating duplicates
56
+
57
+ ### Chunked review and localization
58
+
59
+ - when a PR/MR diff exceeds the configured `review.maxDiffChars`, review runs in chunked mode and aggregates chunk results
60
+ - unanchored inline findings are reported in the summary comment with localized operator notes
61
+ - PR review user-facing phrases now localize across the expanded output-language set
62
+
63
+ ### Configuration and contracts
64
+
65
+ - `pullRequestReview.configFilePath` accepts a comma-separated local fallback list and loads only review-specific overrides
66
+ - `config resolve`, README, configuration, contracts, integrations, getting-started, and verification docs now describe the PR/MR review surface
67
+
68
+ ## Verification Coverage Added Or Strengthened
69
+
70
+ The project now has stronger regression protection for:
71
+
72
+ 1. PR/MR URL parsing for GitHub and GitLab
73
+ 2. review API helpers for diff fetch, summary/inline comment publish, approve, and merge
74
+ 3. summary and inline comment rendering, severity filtering, and publish gating
75
+ 4. merge-gate evaluation and end-to-end PR/MR review workflow behavior
76
+ 5. chunked diff review aggregation and localized unanchored-finding messages
77
+ 6. CLI routing, schema output, and config validation for `pull-request review`
78
+
79
+ ## Suggested Upgrade Path
80
+
81
+ 1. update to `0.1.14`
82
+ 2. configure `SMART_COMMIT_PULL_REQUEST_AUTH_TOKEN` or `pullRequest.authToken: "env:VAR_NAME"`
83
+ 3. dry-run `smart-commit pull-request review <url> --config ./smart-commit.json --dry-run`
84
+ 4. review `pullRequestReview.*` thresholds, severity filters, and auto-approve/auto-merge settings
85
+ 5. run `npm test`
86
+ 6. run `npm run smoke:test`
87
+ 7. run `npm run pack:dry-run`
88
+ 8. publish only after all three checks pass
89
+
90
+ ## Known Follow-Up Areas
91
+
92
+ - broader integration coverage against real GitHub/GitLab test repositories
93
+ - optional smoke-test coverage for `pull-request review --dry-run` in temporary repositories
94
+ - richer provider-specific merge constraints if teams need branch-protection-aware automation