@weareikko/code-review 0.8.5 → 0.8.6

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.
@@ -166,6 +166,7 @@ var REVIEW_THREADS_QUERY = `
166
166
  pageInfo { hasNextPage endCursor }
167
167
  nodes {
168
168
  isResolved
169
+ isOutdated
169
170
  comments(first: 100) { nodes { databaseId } }
170
171
  }
171
172
  }
@@ -338,14 +339,22 @@ var GitHubClient = class {
338
339
  return parsed.data;
339
340
  }
340
341
  /**
341
- * Return the database IDs of review comments that belong to a **resolved**
342
- * review thread. GitHub's REST comment endpoints omit thread-resolution state;
343
- * it is only exposed via GraphQL `reviewThreads.isResolved`. Callers use this
344
- * set to mark normalized notes resolved so resolved threads are excluded from
345
- * summary carry-over and prior-thread context. Paginates over threads.
342
+ * Return the database IDs of review comments that belong to a **settled**
343
+ * review thread — one that is either resolved or outdated. GitHub's REST
344
+ * comment endpoints omit both states; they are only exposed via GraphQL
345
+ * `reviewThreads.isResolved` / `isOutdated`. Callers use this set to mark
346
+ * normalized notes resolved so settled threads are excluded from summary
347
+ * carry-over and prior-thread context. Paginates over threads.
348
+ *
349
+ * Outdated counts as settled because GitHub, unlike GitLab, does not
350
+ * auto-resolve a thread when the line it anchors to changes: fixing a finding
351
+ * flips the thread to outdated but leaves `isResolved` false until someone
352
+ * manually resolves it. Treating outdated as settled mirrors GitLab's
353
+ * "automatically resolve outdated diff discussions" behaviour, so a fixed
354
+ * finding stops being re-listed under "Still open from earlier reviews" (#133).
346
355
  */
347
- async listResolvedReviewCommentIds(owner, repo, pull) {
348
- const resolved = /* @__PURE__ */ new Set();
356
+ async listSettledReviewCommentIds(owner, repo, pull) {
357
+ const settled = /* @__PURE__ */ new Set();
349
358
  let cursor = null;
350
359
  let hasNext = true;
351
360
  while (hasNext) {
@@ -357,14 +366,14 @@ var GitHubClient = class {
357
366
  })).repository?.pullRequest?.reviewThreads;
358
367
  if (!threads) break;
359
368
  for (const thread of threads.nodes ?? []) {
360
- if (!thread.isResolved) continue;
361
- for (const comment of thread.comments?.nodes ?? []) if (typeof comment.databaseId === "number") resolved.add(comment.databaseId);
369
+ if (!thread.isResolved && !thread.isOutdated) continue;
370
+ for (const comment of thread.comments?.nodes ?? []) if (typeof comment.databaseId === "number") settled.add(comment.databaseId);
362
371
  }
363
372
  hasNext = threads.pageInfo?.hasNextPage ?? false;
364
373
  cursor = threads.pageInfo?.endCursor ?? null;
365
374
  if (!cursor) hasNext = false;
366
375
  }
367
- return resolved;
376
+ return settled;
368
377
  }
369
378
  };
370
379
  //#endregion
@@ -551,7 +560,7 @@ function buildSummaryBody(summary, costFooter, options = {}) {
551
560
  return `${withFooter}\n\n${buildSummaryHistoryBlock(historyEntries)}`;
552
561
  }
553
562
  function buildReviewedCommitFooter(commitSha) {
554
- return `Reviewed by ${PRODUCT_LINK} v0.8.5 for commit ${commitSha}.`;
563
+ return `Reviewed by ${PRODUCT_LINK} v0.8.6 for commit ${commitSha}.`;
555
564
  }
556
565
  function extractReviewedCommitSha(body) {
557
566
  return REVIEWED_COMMIT_FOOTER_PATTERN.exec(body)?.[1] ?? null;
@@ -3681,8 +3690,15 @@ async function loadReviewContext(cwd, skillNames = [], warn, options = {}) {
3681
3690
  ]);
3682
3691
  const skills = [...discovered];
3683
3692
  const discoveredNames = new Set(discovered.map((s) => s.name));
3684
- const named = await Promise.all(skillNames.filter((n) => !discoveredNames.has(n)).map((n) => loadNamedSkill(n, cwd, { refresh: options.refreshGitSkills })));
3685
- skills.push(...named);
3693
+ const named = await Promise.all(skillNames.filter((n) => !discoveredNames.has(n)).map(async (n) => {
3694
+ try {
3695
+ return await loadNamedSkill(n, cwd, { refresh: options.refreshGitSkills });
3696
+ } catch (error) {
3697
+ warn?.(`Skipping skill "${n}": ${formatError(error)}`);
3698
+ return null;
3699
+ }
3700
+ }));
3701
+ skills.push(...named.filter((s) => s !== null));
3686
3702
  return {
3687
3703
  conventions,
3688
3704
  reviewRules,
@@ -5199,7 +5215,7 @@ async function loadDefaultRuntime() {
5199
5215
  const [sdkNode, resources, semconv] = modules;
5200
5216
  const serviceResource = resources.resourceFromAttributes({
5201
5217
  [semconv.ATTR_SERVICE_NAME ?? "service.name"]: SERVICE_NAME,
5202
- [semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.8.5"
5218
+ [semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.8.6"
5203
5219
  });
5204
5220
  process.env.OTEL_METRICS_EXPORTER = process.env.OTEL_METRICS_EXPORTER ?? "otlp";
5205
5221
  process.env.OTEL_LOGS_EXPORTER = process.env.OTEL_LOGS_EXPORTER ?? "otlp";
@@ -5631,7 +5647,7 @@ function boldCommentTitle(body) {
5631
5647
  */
5632
5648
  function buildCommentBody(body, commitSha, confidence) {
5633
5649
  const confidenceLine = `_Confidence: ${confidence}._`;
5634
- const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.8.5 for commit ${commitSha}.</sub>`;
5650
+ const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.8.6 for commit ${commitSha}.</sub>`;
5635
5651
  return `${boldCommentTitle(body.trim())}\n\n${confidenceLine}\n\n---\n\n${footer}`;
5636
5652
  }
5637
5653
  function buildPayload(comment, body, refs, resolved) {
@@ -5795,11 +5811,14 @@ function reviewCommentPosition(comment) {
5795
5811
  * comments that render identically on GitHub, so `extractExistingFingerprints`,
5796
5812
  * `findExistingSummaryNote`, and the reviewed-commit scan all work as-is.
5797
5813
  *
5798
- * `resolvedCommentIds` carries the database ids of comments in resolved review
5799
- * threads (from the GraphQL `reviewThreads` query, since REST omits resolution),
5800
- * so each note gets a `resolved` flag mirroring GitLab's per-note field.
5814
+ * `settledCommentIds` carries the database ids of comments in settled review
5815
+ * threads — resolved or outdated (from the GraphQL `reviewThreads` query, since
5816
+ * REST omits both). Each such note gets a `resolved` flag mirroring GitLab's
5817
+ * per-note field: an outdated GitHub thread maps to `resolved: true` because
5818
+ * GitHub, unlike GitLab, does not auto-resolve a thread when its anchored line
5819
+ * changes, so treating outdated as resolved matches GitLab's behaviour (#133).
5801
5820
  */
5802
- function normalizeGitHubDiscussions(reviewComments, issueComments, resolvedCommentIds = /* @__PURE__ */ new Set()) {
5821
+ function normalizeGitHubDiscussions(reviewComments, issueComments, settledCommentIds = /* @__PURE__ */ new Set()) {
5803
5822
  const threads = /* @__PURE__ */ new Map();
5804
5823
  const order = [];
5805
5824
  for (const comment of reviewComments) {
@@ -5813,7 +5832,7 @@ function normalizeGitHubDiscussions(reviewComments, issueComments, resolvedComme
5813
5832
  notes.push({
5814
5833
  id: comment.id,
5815
5834
  body: comment.body ?? "",
5816
- resolved: resolvedCommentIds.has(comment.id),
5835
+ resolved: settledCommentIds.has(comment.id),
5817
5836
  position: reviewCommentPosition(comment)
5818
5837
  });
5819
5838
  }
@@ -5880,12 +5899,12 @@ var GitHubPlatform = class {
5880
5899
  return refs;
5881
5900
  }
5882
5901
  async getDiscussions() {
5883
- const [reviewComments, issueComments, resolvedCommentIds] = await Promise.all([
5902
+ const [reviewComments, issueComments, settledCommentIds] = await Promise.all([
5884
5903
  this.client.listReviewComments(this.owner, this.repo, this.pull),
5885
5904
  this.client.listIssueComments(this.owner, this.repo, this.pull),
5886
- this.client.listResolvedReviewCommentIds(this.owner, this.repo, this.pull)
5905
+ this.client.listSettledReviewCommentIds(this.owner, this.repo, this.pull)
5887
5906
  ]);
5888
- return normalizeGitHubDiscussions(reviewComments, issueComments, resolvedCommentIds);
5907
+ return normalizeGitHubDiscussions(reviewComments, issueComments, settledCommentIds);
5889
5908
  }
5890
5909
  buildComments(comments, diff, refs, existingFingerprints) {
5891
5910
  this.commitId = refs.head_sha;
@@ -6725,10 +6744,10 @@ async function main(argv = process.argv.slice(2)) {
6725
6744
  return;
6726
6745
  }
6727
6746
  if (argv.includes("--version") || argv.includes("-v")) {
6728
- console.log("0.8.5");
6747
+ console.log("0.8.6");
6729
6748
  return;
6730
6749
  }
6731
- process.stderr.write(`[code-review] @weareikko/code-review v0.8.5\n`);
6750
+ process.stderr.write(`[code-review] @weareikko/code-review v0.8.6\n`);
6732
6751
  assertNodeVersion();
6733
6752
  applyCodeReviewEnvPrefix();
6734
6753
  applyDefaultCacheRetention();
@@ -6751,4 +6770,4 @@ if (isDirectRun()) main().catch((error) => {
6751
6770
  //#endregion
6752
6771
  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 };
6753
6772
 
6754
- //# sourceMappingURL=cli-DmzA9PxS.js.map
6773
+ //# sourceMappingURL=cli-BbR1oftT.js.map