@jphutchins/code-review 0.1.0-alpha.68 → 0.1.0-alpha.69

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
@@ -38,10 +38,10 @@ npx @jphutchins/code-review <subcommand>
38
38
  | Subcommand | What it does |
39
39
  | --- | --- |
40
40
  | `post` | Post a complete review from findings + envelope + diff — the one-call path. The findings are listed in the sticky summary; `--inline` renders the in-diff ones as comments on the diff instead. Also renders the review into `$GITHUB_STEP_SUMMARY`: the sticky is overwritten each round, the run summary keeps each round as it stood |
41
- | `gather` | Resolve the PR from the CI head SHA and gather the review inputs (diff with git-diff fallback, PR context, prior bot review, the implementer's answers (`Review-Response:` lines and verdict tables), the CI run's job logs — the failing jobs' on a failure, the jobs that ran, up to 64, on a pass) into the directory named by `--out-dir` (default: the current directory; the shipped workflows use `$RUNNER_TEMP/gather`) |
41
+ | `gather` | Resolve the PR from the CI head SHA and gather the review inputs (diff with git-diff fallback, PR context, prior bot review, the implementer's answers (`Review-Response:` lines and verdict tables), the CI run's job logs — the failing jobs', up to 20, on a failure, the jobs that ran, up to 64, on a pass) into the directory named by `--out-dir` (default: the current directory; the shipped workflows use `$RUNNER_TEMP/gather`) |
42
42
  | `parse-command` | Resolve a PR's head from its number and parse a ChatOps trigger comment (`/code-review [24m] [$1.00] <instructions>`) into review overrides — the on-demand comment trigger |
43
43
  | `react` | Add/remove a GitHub comment reaction — the ChatOps acknowledgement (👀 on receipt, 🚀 on completion) |
44
- | `await-ci` | Wait for a PR head's CI run to conclude and emit its real conclusion + run id — so an on-demand comment review routes on the CI result (success → full, failure → mechanic) instead of reviewing blind |
44
+ | `await-ci` | Wait for a PR head's CI run to conclude and emit its real conclusion, run id and run attempt — so an on-demand comment review routes on the CI result (success → full, failure → mechanic) instead of reviewing blind |
45
45
  | `check-scope` | Validate + normalize the workflow's `scope` input (the languages/inputs the project accepts) and print the normalized list for the review prompt, or nothing when empty (the reviewer then infers scope from the README's first paragraph); a structurally malformed value is rejected rather than spliced in as-is |
46
46
  | `render` | Render the sticky-comment markdown from findings + usage + prices |
47
47
  | `inline` | Build the GitHub reviews `comments[]` payload from findings + diff (in-diff validation; strays demote to the summary) |
package/dist/index.js CHANGED
@@ -5152,6 +5152,8 @@ stacked=${String(result.stacked)}
5152
5152
  base_sha=${result.baseSha}
5153
5153
  staged_job_logs=${String(result.stagedJobLogs)}
5154
5154
  failing_jobs=${String(result.failingJobs)}
5155
+ ci_jobs_passed=${result.passedJobs === null ? "" : String(result.passedJobs.passed)}
5156
+ ci_jobs_ran=${result.passedJobs === null ? "" : String(result.passedJobs.ran)}
5155
5157
  `;
5156
5158
  }
5157
5159
  };
@@ -5189,14 +5191,17 @@ var IssueCommentCodec = t.intersection([
5189
5191
  author_association: t.union([t.string, t.null])
5190
5192
  })
5191
5193
  ]);
5192
- var JobCodec = t.type({
5193
- id: t.number,
5194
- // A null name (an API edge) degrades to a nameless entry rather than aborting the whole gather —
5195
- // the identity the reproduction steer needs is best-effort, never load-bearing.
5196
- name: t.union([t.string, t.null]),
5197
- conclusion: t.union([t.string, t.null])
5198
- });
5199
- var JOBS_JQ = ".jobs[] | {id: .id, name: .name, conclusion: .conclusion}";
5194
+ var JobCodec = t.intersection([
5195
+ t.type({
5196
+ id: t.number,
5197
+ // A null name (an API edge) degrades to a nameless entry rather than aborting the whole gather —
5198
+ // the identity the reproduction steer needs is best-effort, never load-bearing.
5199
+ name: t.union([t.string, t.null]),
5200
+ conclusion: t.union([t.string, t.null])
5201
+ }),
5202
+ t.partial({ steps: t.array(t.string) })
5203
+ ]);
5204
+ var JOBS_JQ = ".jobs[] | {id: .id, name: .name, conclusion: .conclusion, steps: [.steps[]? | .name? | strings]}";
5200
5205
  var parseRunAttempt = (raw) => {
5201
5206
  if (raw === void 0 || raw === "") return void 0;
5202
5207
  if (!/^[1-9][0-9]*$/.test(raw)) {
@@ -5433,6 +5438,7 @@ var stagePassedRun = async (repo, runId, runAttempt, outDir, ghApi) => {
5433
5438
  jobs.map((j) => ({
5434
5439
  name: j.name,
5435
5440
  conclusion: j.conclusion,
5441
+ steps: j.steps ?? [],
5436
5442
  log: logs2.get(j.id) ?? null
5437
5443
  })),
5438
5444
  null,
@@ -5464,13 +5470,19 @@ var stagePassedRun = async (repo, runId, runAttempt, outDir, ghApi) => {
5464
5470
  `
5465
5471
  );
5466
5472
  }
5467
- return logs.size;
5473
+ return {
5474
+ staged: logs.size,
5475
+ passed: {
5476
+ passed: jobs.filter((j) => j.conclusion === "success").length,
5477
+ ran: ran.length
5478
+ }
5479
+ };
5468
5480
  } catch (err) {
5469
5481
  process.stderr.write(
5470
- `::warning::${annotationSafe(`the passed CI run's jobs could not be listed (${errMsg(err)}) \u2014 the review knows CI passed, not which jobs ran`)}
5482
+ `::warning::${annotationSafe(`the passed CI run's jobs could not be staged (${errMsg(err)}) \u2014 the review knows CI passed, not what its jobs reported`)}
5471
5483
  `
5472
5484
  );
5473
- return 0;
5485
+ return { staged: 0, passed: null };
5474
5486
  }
5475
5487
  };
5476
5488
  var gather = async (input, ghApi = runGhApi, gitRun = runGit, readArtifact = ghArtifactReader) => {
@@ -5577,7 +5589,7 @@ var gather = async (input, ghApi = runGhApi, gitRun = runGit, readArtifact = ghA
5577
5589
  })
5578
5590
  );
5579
5591
  const jobLogs = input.conclusion === "failure" ? await downloadFailingJobLogs(input.repo, input.runId, input.runAttempt, input.outDir, ghApi) : { staged: 0, failing: 0 };
5580
- const passedLogs = input.conclusion === "success" ? await stagePassedRun(input.repo, input.runId, input.runAttempt, input.outDir, ghApi) : 0;
5592
+ const passedRun = input.conclusion === "success" ? await stagePassedRun(input.repo, input.runId, input.runAttempt, input.outDir, ghApi) : { staged: 0, passed: null };
5581
5593
  return {
5582
5594
  kind: "gathered",
5583
5595
  pr: prNumber,
@@ -5585,8 +5597,9 @@ var gather = async (input, ghApi = runGhApi, gitRun = runGit, readArtifact = ghA
5585
5597
  diffSize: Buffer.byteLength(prDiff, "utf8"),
5586
5598
  stacked,
5587
5599
  baseSha: meta.base_sha,
5588
- stagedJobLogs: jobLogs.staged + passedLogs,
5589
- failingJobs: jobLogs.failing
5600
+ stagedJobLogs: jobLogs.staged + passedRun.staged,
5601
+ failingJobs: jobLogs.failing,
5602
+ passedJobs: passedRun.passed
5590
5603
  };
5591
5604
  };
5592
5605