@nk070281sjv/cli 2.3.8 → 2.3.11

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 (2) hide show
  1. package/dist/index.js +188 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -30779,7 +30779,7 @@ ${hint}
30779
30779
  }
30780
30780
 
30781
30781
  // src/lib/version.ts
30782
- var CLI_VERSION = true ? "2.3.8" : createRequire(import.meta.url)("../../package.json").version;
30782
+ var CLI_VERSION = true ? "2.3.11" : createRequire(import.meta.url)("../../package.json").version;
30783
30783
 
30784
30784
  // src/lib/deps.ts
30785
30785
  init_src();
@@ -38025,12 +38025,121 @@ function pipelinePrompt(context, stage, agent, promptPath, artifactPath) {
38025
38025
  }
38026
38026
  function schemaHint(stage) {
38027
38027
  if (stage === "aggregation") {
38028
- return "- AggregationJson: findings[] and dropped[].";
38028
+ return [
38029
+ "AggregationJson:",
38030
+ "- Output exactly this JSON shape inside one fenced ```ocr-json block.",
38031
+ "- Do not rename fields. Do not use markdown tables inside the JSON block.",
38032
+ "",
38033
+ "```json",
38034
+ "{",
38035
+ ' "findings": [',
38036
+ " {",
38037
+ ' "id": "agg-1",',
38038
+ ' "title": "Short finding title",',
38039
+ ' "source_findings": ["architect-1:finding-or-heading"],',
38040
+ ' "signal": "keep",',
38041
+ ' "severity": "high",',
38042
+ ' "root_cause": "Why this issue exists.",',
38043
+ ' "affected_behavior": "What user/system behavior is affected.",',
38044
+ ' "fix_direction": "Concrete direction for the fix."',
38045
+ " }",
38046
+ " ],",
38047
+ ' "dropped": [',
38048
+ " {",
38049
+ ' "source_findings": ["performance-1:finding-or-heading"],',
38050
+ ' "reason": "Why this reviewer finding is noise or duplicate."',
38051
+ " }",
38052
+ " ]",
38053
+ "}",
38054
+ "```",
38055
+ "",
38056
+ '- `signal` must be one of: "keep", "merge", "needs_validation", "likely_noise", "false_positive_candidate".',
38057
+ '- `severity` must be one of: "critical", "high", "medium", "low", "info".',
38058
+ "- `source_findings` must always be an array of non-empty strings, even for one source."
38059
+ ].join("\n");
38029
38060
  }
38030
38061
  if (stage === "validation") {
38031
- return "- ValidationJson: confirmed[], downgraded[], rejected[].";
38062
+ return [
38063
+ "ValidationJson:",
38064
+ "- Output exactly this JSON shape inside one fenced ```ocr-json block.",
38065
+ "- Do not rename fields. Do not use markdown tables inside the JSON block.",
38066
+ "",
38067
+ "```json",
38068
+ "{",
38069
+ ' "confirmed": [',
38070
+ " {",
38071
+ ' "finding_id": "agg-1",',
38072
+ ' "checked_files": ["src/main/java/example/File.java"],',
38073
+ ' "result": "confirmed",',
38074
+ ' "final_category": "blocker",',
38075
+ ' "reason": "Code evidence confirms the issue."',
38076
+ " }",
38077
+ " ],",
38078
+ ' "downgraded": [',
38079
+ " {",
38080
+ ' "finding_id": "agg-2",',
38081
+ ' "checked_files": ["src/main/java/example/File.java"],',
38082
+ ' "result": "downgraded",',
38083
+ ' "final_category": "suggestion",',
38084
+ ' "reason": "Issue is real but lower impact."',
38085
+ " }",
38086
+ " ],",
38087
+ ' "rejected": [',
38088
+ " {",
38089
+ ' "finding_id": "agg-3",',
38090
+ ' "checked_files": ["src/main/java/example/File.java"],',
38091
+ ' "result": "rejected",',
38092
+ ' "reason": "Code evidence disproves the issue."',
38093
+ " }",
38094
+ " ]",
38095
+ "}",
38096
+ "```",
38097
+ "",
38098
+ '- `final_category` must be one of: "blocker", "should_fix", "suggestion", "style".',
38099
+ "- `checked_files` must always be an array of non-empty strings."
38100
+ ].join("\n");
38032
38101
  }
38033
- return "- SynthesisJson: verdict, synthesis_counts, findings[], reviewers[].";
38102
+ return [
38103
+ "SynthesisJson:",
38104
+ "- Output exactly this JSON shape inside one fenced ```ocr-json block.",
38105
+ "- Do not rename fields. Do not use markdown tables inside the JSON block.",
38106
+ "",
38107
+ "```json",
38108
+ "{",
38109
+ ' "verdict": "REQUEST CHANGES",',
38110
+ ' "synthesis_counts": {',
38111
+ ' "blockers": 1,',
38112
+ ' "should_fix": 1,',
38113
+ ' "suggestions": 0',
38114
+ " },",
38115
+ ' "findings": [',
38116
+ " {",
38117
+ ' "title": "Short final finding title",',
38118
+ ' "category": "blocker",',
38119
+ ' "severity": "high",',
38120
+ ' "summary": "Developer-facing explanation.",',
38121
+ ' "file_path": "src/main/java/example/File.java",',
38122
+ ' "line_start": 42,',
38123
+ ' "line_end": 45,',
38124
+ ' "flagged_by": ["agg-1"],',
38125
+ ' "validation_source": "confirmed"',
38126
+ " }",
38127
+ " ],",
38128
+ ' "reviewers": [',
38129
+ " {",
38130
+ ' "type": "architect",',
38131
+ ' "instance": 1,',
38132
+ ' "findings": ["architect-1:finding-or-heading"]',
38133
+ " }",
38134
+ " ]",
38135
+ "}",
38136
+ "```",
38137
+ "",
38138
+ '- `verdict` must be one of: "APPROVE", "REQUEST CHANGES", "NEEDS DISCUSSION".',
38139
+ '- `category` must be one of: "blocker", "should_fix", "suggestion", "style".',
38140
+ '- `severity` must be one of: "critical", "high", "medium", "low", "info".',
38141
+ "- `synthesis_counts` must exactly match the categories in `findings`."
38142
+ ].join("\n");
38034
38143
  }
38035
38144
 
38036
38145
  // src/lib/agent-orchestrator/review-orchestrator.ts
@@ -38646,7 +38755,9 @@ var runAgentsSubcommand = new Command("run-agents").description("Run OCR review
38646
38755
  console.log(`Progress: ocr review watch --session-id ${sessionId}`);
38647
38756
  console.log(`Status: ocr review status --session-id ${sessionId}`);
38648
38757
  console.log(`Artifacts: ${sessionDir}`);
38649
- return;
38758
+ console.log("Monitoring background review until it finishes. If OpenCode stops waiting, the background review continues.");
38759
+ const exitCode = await waitForDetachedRun(sessionDir, round);
38760
+ process.exit(exitCode);
38650
38761
  }
38651
38762
  writeRunMeta(sessionDir, round, {
38652
38763
  status: "running",
@@ -38887,6 +38998,78 @@ function renderRunAgentsProgress(event) {
38887
38998
  console.error(source_default.green("OCR pipeline complete."));
38888
38999
  }
38889
39000
  }
39001
+ async function waitForDetachedRun(sessionDir, round) {
39002
+ let lastLine2 = "";
39003
+ let stderrOffset = 0;
39004
+ while (true) {
39005
+ const stderrLogPath = join28(
39006
+ sessionDir,
39007
+ "rounds",
39008
+ `round-${round}`,
39009
+ "process-logs",
39010
+ "run-agents-worker.stderr.log"
39011
+ );
39012
+ const flushed = flushNewLogText(stderrLogPath, stderrOffset, process.stderr);
39013
+ stderrOffset = flushed.offset;
39014
+ const snapshot = readDetachedSnapshot(sessionDir, round);
39015
+ const line = formatDetachedProgress(snapshot);
39016
+ if (line !== lastLine2) {
39017
+ console.log(line);
39018
+ lastLine2 = line;
39019
+ }
39020
+ if (snapshot.status === "completed") {
39021
+ console.log(source_default.green(`OCR review complete: ${join28(sessionDir, "rounds", `round-${round}`, "final.md")}`));
39022
+ return 0;
39023
+ }
39024
+ if (snapshot.status === "failed") {
39025
+ console.error(source_default.red("OCR review failed. Inspect worker stderr and failure-summary.json if present."));
39026
+ return 1;
39027
+ }
39028
+ if (snapshot.pid && !snapshot.live && snapshot.status !== "completed") {
39029
+ console.error(source_default.red("OCR background worker is not running and did not mark the review complete."));
39030
+ return 1;
39031
+ }
39032
+ await new Promise((resolve4) => setTimeout(resolve4, 15e3));
39033
+ }
39034
+ }
39035
+ function flushNewLogText(path2, offset, stream) {
39036
+ if (!existsSync23(path2)) return { offset };
39037
+ const text = readFileSync17(path2, "utf-8");
39038
+ if (text.length <= offset) return { offset: text.length };
39039
+ stream.write(text.slice(offset));
39040
+ return { offset: text.length };
39041
+ }
39042
+ function readDetachedSnapshot(sessionDir, round) {
39043
+ const roundDir = join28(sessionDir, "rounds", `round-${round}`);
39044
+ const runMeta = readJson(join28(roundDir, "run-meta.json"));
39045
+ const processLogsDir = join28(roundDir, "process-logs");
39046
+ const metas = existsSync23(processLogsDir) ? readdirMetaFiles(processLogsDir).map((path2) => readJson(path2)).filter(isRecord3) : [];
39047
+ const reviewers = metas.filter((meta) => meta.phase === "reviews");
39048
+ const pid = typeof runMeta?.pid === "number" ? runMeta.pid : void 0;
39049
+ return {
39050
+ status: String(runMeta?.status ?? "unknown"),
39051
+ pid,
39052
+ live: pid ? isPidLive(pid) : void 0,
39053
+ completedReviews: reviewers.filter((meta) => meta.status === "completed").length,
39054
+ totalReviews: reviewers.length,
39055
+ runningReviews: reviewers.filter((meta) => meta.status === "running").map((meta) => String(meta.id)).sort(),
39056
+ pipeline: Object.fromEntries(
39057
+ ["aggregation", "validation", "synthesis"].map((phase) => [
39058
+ phase,
39059
+ String(metas.find((meta) => meta.id === phase)?.status ?? "pending")
39060
+ ])
39061
+ )
39062
+ };
39063
+ }
39064
+ function formatDetachedProgress(snapshot) {
39065
+ const running = snapshot.runningReviews.length > 0 ? snapshot.runningReviews.join(", ") : "none";
39066
+ return [
39067
+ `OCR background status: ${snapshot.status}${snapshot.pid ? ` pid=${snapshot.pid} live=${snapshot.live ? "yes" : "no"}` : ""}`,
39068
+ `reviews ${snapshot.completedReviews}/${snapshot.totalReviews || "?"} complete`,
39069
+ `running: ${running}`,
39070
+ `pipeline: aggregation=${snapshot.pipeline.aggregation}, validation=${snapshot.pipeline.validation}, synthesis=${snapshot.pipeline.synthesis}`
39071
+ ].join(" | ");
39072
+ }
38890
39073
  var CONTROL_PROMPT = "Resume this OCR review: run `ocr state status --json` and act on `next_action`, continuing forward from `current_phase` without redoing completed phases.";
38891
39074
  var reviewCommand = new Command("review").description("Run or resume an OCR review").option("--resume <workflow-id>", "Resume a prior review by its workflow session id").action(async (options) => {
38892
39075
  if (!options.resume) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nk070281sjv/cli",
3
- "version": "2.3.8",
3
+ "version": "2.3.11",
4
4
  "description": "CLI for Open Code Review - Multi-environment setup and progress tracking",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@inquirer/prompts": "^7.2.0",
40
- "@nk070281sjv/agents": "2.3.8",
40
+ "@nk070281sjv/agents": "2.3.11",
41
41
  "chalk": "^5.4.1",
42
42
  "chokidar": "^4.0.3",
43
43
  "commander": "^13.0.0",