@weareikko/code-review 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -74,7 +74,7 @@ review:
74
74
  artifacts:
75
75
  when: always
76
76
  paths:
77
- - gitlab-review.md
77
+ - code-review.md
78
78
  - review-comments.json
79
79
  - review-usage.json
80
80
  ```
@@ -83,10 +83,33 @@ review:
83
83
 
84
84
  The same reviewer also reviews **GitHub pull requests** — the engine is platform-agnostic and auto-detects GitHub from the Actions environment (`GITHUB_ACTIONS`, `GITHUB_REPOSITORY`, the `pull_request` event). Set `--platform github` to force it.
85
85
 
86
- Use the bundled composite action. It needs:
86
+ ### Reusable workflow (simplest)
87
+
88
+ The quickest way to enable reviews in a repo is the bundled reusable workflow. Add a tiny caller and let it check out the code, install the CLI, and run the review for you:
89
+
90
+ ```yml
91
+ name: code-review
92
+ on:
93
+ pull_request:
94
+
95
+ permissions:
96
+ contents: read
97
+ pull-requests: write
98
+
99
+ jobs:
100
+ review:
101
+ uses: weareikko/code-review/.github/workflows/code-review.yml@0.8.2 # pin to a release tag
102
+ secrets: inherit
103
+ ```
104
+
105
+ It reads review settings from repo/org **variables** (`CODE_REVIEW_MODEL`, `CODE_REVIEW_DEPTH`, `CODE_REVIEW_THINKING_LEVEL`, `CODE_REVIEW_VERIFY_MODEL`) and provider credentials from **secrets** named with the `CODE_REVIEW_` prefix (e.g. `CODE_REVIEW_ANTHROPIC_API_KEY`), which the CLI's env shim de-prefixes for the provider. `secrets: inherit` is required so the reusable workflow can see them. Optional `with:` inputs: `model` (overrides the `CODE_REVIEW_MODEL` variable), `version`, `node-version`, `working-directory`, `args`, and `runs-on`.
106
+
107
+ ### Composite action
108
+
109
+ For more control, use the bundled composite action directly. It needs:
87
110
 
88
111
  - **Permissions:** `pull-requests: write` (to post the review and summary) and `contents: read` (to check out the code). The default `GITHUB_TOKEN` is enough; the action reads it as `${{ github.token }}` by default.
89
- - **Full git history:** check out with `fetch-depth: 0` so the merge-base diff and commit log resolve.
112
+ - **Full git history:** the bundled checkout uses `fetch-depth: 0` so the merge-base diff and commit log resolve (tune with `fetch-depth`, or set `checkout: false` and check out yourself).
90
113
  - **A model + its key:** pass the model via the `model` input and the provider's key via the `api-key` input (or expose the provider's standard env var, e.g. `ANTHROPIC_API_KEY`, to the step).
91
114
 
92
115
  ```yml
@@ -102,9 +125,8 @@ jobs:
102
125
  review:
103
126
  runs-on: ubuntu-latest
104
127
  steps:
105
- - uses: actions/checkout@v4
106
- with:
107
- fetch-depth: 0
128
+ # Checkout (full history) is bundled — opt out with `checkout: false` if
129
+ # your job already checked out the code with its own options.
108
130
  - uses: weareikko/code-review@main # pin to a release tag in production
109
131
  with:
110
132
  model: anthropic/claude-sonnet-4-5
@@ -113,7 +135,7 @@ jobs:
113
135
  # args: --min-severity warn --dry-run
114
136
  ```
115
137
 
116
- Inputs: `model` (required), `api-key`, `github-token` (default `${{ github.token }}`), `version` (npm dist-tag/version, default `latest`), `node-version` (default `24`), `working-directory`, and `args` (extra CLI flags forwarded verbatim).
138
+ Inputs: `model` (required), `api-key`, `github-token` (default `${{ github.token }}`), `version` (npm dist-tag/version, default `latest`), `node-version` (default `24`), `working-directory`, `args` (extra CLI flags forwarded verbatim), `checkout` (default `true` — bundled repository checkout), and `fetch-depth` (default `0` — full history, required for the merge-base diff).
117
139
 
118
140
  Prefer to run the CLI directly (no composite action)? `GITHUB_TOKEN`, `GITHUB_REPOSITORY`, and the PR number are read straight from the Actions environment:
119
141
 
@@ -155,7 +177,7 @@ Equivalently, set `CODE_REVIEW_MODEL` and the provider's key (e.g. `ANTHROPIC_AP
155
177
 
156
178
  ## Artifacts
157
179
 
158
- - `gitlab-review.md`: raw review text returned by the agent
180
+ - `code-review.md`: raw review text returned by the agent
159
181
  - `review-comments.json`: generated comment objects including:
160
182
  - parsed comment payload
161
183
  - computed fingerprints
@@ -187,7 +209,7 @@ Use these files for CI debugging and auditing.
187
209
  - If using `CI_JOB_TOKEN`, ensure your GitLab project settings allow required API access.
188
210
  - **No comments posted**
189
211
  - Check `review-comments.json` for `duplicate: true` or empty parsed comments.
190
- - Run with `--dry-run` and inspect `gitlab-review.md` formatting (`== Inline Comments ==`).
212
+ - Run with `--dry-run` and inspect `code-review.md` formatting (`== Inline Comments ==`).
191
213
 
192
214
  ## Development / release
193
215
 
@@ -470,7 +470,7 @@ function buildSummaryBody(summary, costFooter, options = {}) {
470
470
  return `${withFooter}\n\n${buildSummaryHistoryBlock(historyEntries)}`;
471
471
  }
472
472
  function buildReviewedCommitFooter(commitSha) {
473
- return `Reviewed by ${PRODUCT_LINK} v0.8.0 for commit ${commitSha}.`;
473
+ return `Reviewed by ${PRODUCT_LINK} v0.8.2 for commit ${commitSha}.`;
474
474
  }
475
475
  function extractReviewedCommitSha(body) {
476
476
  return REVIEWED_COMMIT_FOOTER_PATTERN.exec(body)?.[1] ?? null;
@@ -1125,7 +1125,7 @@ function resolveConfig(argv = process.argv.slice(2), env = process.env) {
1125
1125
  decomposeHintLines,
1126
1126
  diffContext,
1127
1127
  retrieveSkipped: toBoolean(args.retrieveSkipped) || toBoolean(env.CODE_REVIEW_RETRIEVE_SKIPPED),
1128
- reviewFile: String(args.reviewFile ?? "gitlab-review.md"),
1128
+ reviewFile: String(args.reviewFile ?? "code-review.md"),
1129
1129
  output: String(args.output ?? "review-comments.json"),
1130
1130
  dryRun: toBoolean(args.dryRun),
1131
1131
  noPost: toBoolean(args.noPost),
@@ -4836,7 +4836,7 @@ async function loadDefaultRuntime() {
4836
4836
  const [sdkNode, resources, semconv] = modules;
4837
4837
  const serviceResource = resources.resourceFromAttributes({
4838
4838
  [semconv.ATTR_SERVICE_NAME ?? "service.name"]: SERVICE_NAME,
4839
- [semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.8.0"
4839
+ [semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.8.2"
4840
4840
  });
4841
4841
  process.env.OTEL_METRICS_EXPORTER = process.env.OTEL_METRICS_EXPORTER ?? "otlp";
4842
4842
  process.env.OTEL_LOGS_EXPORTER = process.env.OTEL_LOGS_EXPORTER ?? "otlp";
@@ -5268,7 +5268,7 @@ function boldCommentTitle(body) {
5268
5268
  */
5269
5269
  function buildCommentBody(body, commitSha, confidence) {
5270
5270
  const confidenceLine = `_Confidence: ${confidence}._`;
5271
- const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.8.0 for commit ${commitSha}.</sub>`;
5271
+ const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.8.2 for commit ${commitSha}.</sub>`;
5272
5272
  return `${boldCommentTitle(body.trim())}\n\n${confidenceLine}\n\n---\n\n${footer}`;
5273
5273
  }
5274
5274
  function buildPayload(comment, body, refs, resolved) {
@@ -5999,7 +5999,7 @@ Options:
5999
5999
  (env: CODE_REVIEW_VERIFY_MODEL)
6000
6000
  --posting-mode <mode> direct (sequential discussions) or draft (atomic bulk publish)
6001
6001
  (default: direct)
6002
- --review-file <path> Raw code-review output file (default: gitlab-review.md)
6002
+ --review-file <path> Raw code-review output file (default: code-review.md)
6003
6003
  --output <path> Generated payload artifact (default: review-comments.json)
6004
6004
  --cwd <path> Working directory (default: process.cwd())
6005
6005
  --dry-run Generate artifacts and skip posting
@@ -6346,10 +6346,10 @@ async function main(argv = process.argv.slice(2)) {
6346
6346
  return;
6347
6347
  }
6348
6348
  if (argv.includes("--version") || argv.includes("-v")) {
6349
- console.log("0.8.0");
6349
+ console.log("0.8.2");
6350
6350
  return;
6351
6351
  }
6352
- process.stderr.write(`[code-review] @weareikko/code-review v0.8.0\n`);
6352
+ process.stderr.write(`[code-review] @weareikko/code-review v0.8.2\n`);
6353
6353
  assertNodeVersion();
6354
6354
  applyCodeReviewEnvPrefix();
6355
6355
  applyDefaultCacheRetention();
@@ -6372,4 +6372,4 @@ if (isDirectRun()) main().catch((error) => {
6372
6372
  //#endregion
6373
6373
  export { normalizeBody as $, SUMMARY_HISTORY_END as A, buildSummaryHistoryEntries as B, createDiagnosticContext as C, traceDiagnosticPhase as D, traceDiagnostic as E, SUMMARY_MARKER as F, findExistingSummaryNoteId as G, extractSummaryHistoryEntries as H, buildArchivedSummaryEntry as I, upsertSummaryNote as J, stripSummaryHistory as K, buildReviewedCommitFooter as L, SUMMARY_HISTORY_ENTRY_START as M, SUMMARY_HISTORY_LIMIT as N, normalizeSeverity as O, SUMMARY_HISTORY_START as P, fingerprints as Q, buildSizeNoticeBlock as R, DIAGNOSTIC_CHANNEL_PREFIX as S, diagnosticChannels as T, findExistingReviewedCommitSha as U, extractReviewedCommitSha as V, findExistingSummaryNote as W, extractDiffHunkContext as X, appendFingerprintMarkers as Y, extractExistingFingerprints as Z, resolveNpmSkillDir as _, main as a, parseReviewMarkdownWithWarnings as b, buildGeneratedComments as c, startOtelBridge as d, sha256 as et, filterDiff as f, parseSkillSpec as g, loadNamedSkill as h, formatUsageLine as i, SUMMARY_HISTORY_ENTRY_END as j, toGitLabReviewSeverity as k, buildPayload as l, gitSkillCacheKey as m, formatPerModelUsage as n, run as o, runReview as p, stripSummaryMarker as q, formatSkillsFooter as r, withHttpStamping as s, countPostedBySeverity as t, isOtelEnabled as u, resolveSkillCacheDir as v, createDiagnosticRunId as w, DIAGNOSTIC_CHANNEL_NAMES as x, parseReviewMarkdown as y, buildSummaryBody as z };
6374
6374
 
6375
- //# sourceMappingURL=cli-w8sz3CYl.js.map
6375
+ //# sourceMappingURL=cli-DBkaU14C.js.map