@mstar-harness/cli 3.9.1 → 3.9.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.
Files changed (2) hide show
  1. package/dist/mstar-harness.js +285 -31
  2. package/package.json +1 -1
@@ -2888,12 +2888,18 @@ var REQUIRED_FIELDS = [
2888
2888
  { key: "delegation", label: "Delegation", code: "delegation" },
2889
2889
  { key: "taskCategory", label: "Task category", code: "task-category" }
2890
2890
  ];
2891
+ var REVIEW_SEAT_ROLES = ["qc-specialist", "qc-specialist-2", "qc-specialist-3", "code-reviewer", "qa-engineer"];
2892
+ var BUDGET_LABELS = ["Budget (review / QC seats)", "Budget"];
2893
+ var RETURN_SHAPE_LABELS = ["Return shape (review / QC seats)", "Return shape"];
2891
2894
  function violation2(severity, code, message, fix) {
2892
2895
  return { ok: false, severity, code, message, fix };
2893
2896
  }
2897
+ function describeAbsence(value) {
2898
+ return value === undefined ? "the field is absent" : value === "" ? "the field is empty" : value.trim().toLowerCase() === "n/a" ? 'the value is "N/A"' : undefined;
2899
+ }
2894
2900
  function parseAssignmentFields(assignmentText) {
2895
2901
  const fields = {};
2896
- for (const line of assignmentText.split(/\r?\n/)) {
2902
+ for (const line of assignmentHeaderRegion(assignmentText).split(/\r?\n/)) {
2897
2903
  const match = line.match(/^[ \t]*(?:[-*][ \t]+)?\*\*\s*([^*:]+?)\s*\*\*\s*:\s*(.*)$/) ?? line.match(/^[ \t]*(?:[-*][ \t]+)?([A-Za-z][A-Za-z -]*?)\s*:\s*(.*)$/);
2898
2904
  if (!match)
2899
2905
  continue;
@@ -2908,9 +2914,18 @@ function parseAssignmentFields(assignmentText) {
2908
2914
  fields.workingBranch = value;
2909
2915
  else if (label === "Branch policy")
2910
2916
  fields.branchPolicy = value;
2917
+ else if (BUDGET_LABELS.includes(label))
2918
+ fields.budget = value;
2919
+ else if (RETURN_SHAPE_LABELS.includes(label))
2920
+ fields.returnShape = value;
2911
2921
  }
2912
2922
  return fields;
2913
2923
  }
2924
+ var ASSIGNMENT_BODY_START_RE = /^(?:#{1,6}[ \t]+Task\b|-{3,}[ \t]*$|#[ \t])/m;
2925
+ function assignmentHeaderRegion(assignmentText) {
2926
+ const marker = assignmentText.match(ASSIGNMENT_BODY_START_RE);
2927
+ return marker !== null ? assignmentText.slice(0, marker.index) : assignmentText;
2928
+ }
2914
2929
  function requireField(violations, value, label, code) {
2915
2930
  if (value === undefined) {
2916
2931
  const v = violation2("high", `assignment.field.missing-${code}`, `missing required Assignment field: ${label}`, `add "**${label}**: <value>" to the Assignment`);
@@ -2970,6 +2985,33 @@ function validateAssignmentFields(assignmentText, opts = {}) {
2970
2985
  for (const { key, label, code } of REQUIRED_FIELDS) {
2971
2986
  requireField(violations, fields[key], label, code);
2972
2987
  }
2988
+ const role = (fields.executeAs ?? "").trim().replace(/^@/, "").toLowerCase().split(/\s+/)[0] ?? "";
2989
+ const reviewSeat = REVIEW_SEAT_ROLES.includes(role);
2990
+ const category = (fields.taskCategory ?? "").replace(/^[*_`"'\s]+/, "").toLowerCase();
2991
+ const auditRound = /^audit(?![A-Za-z0-9])/.test(category);
2992
+ if (reviewSeat || auditRound) {
2993
+ const subject = reviewSeat ? `review seat "${role}"` : `audit round (Task category: ${category})`;
2994
+ const boundingFields = [
2995
+ {
2996
+ code: "assignment.field.budget-missing",
2997
+ label: "Budget",
2998
+ fix: `add "**Budget (review / QC seats)**: <cap> \u2014 may only tighten the default in mstar-harness-core \u00a7 \u5b9a\u5411\u6267\u884c\u4e0e\u9a8c\u8bc1\u8fb9\u754c, never loosen it"`,
2999
+ value: fields.budget
3000
+ },
3001
+ {
3002
+ code: "assignment.field.return-shape-missing",
3003
+ label: "Return shape",
3004
+ fix: `add "**Return shape (review / QC seats)**: <what the seat returns and how it stops \u2014 verdict + findings shape; a clean round returns findings: [] explicitly>"`,
3005
+ value: fields.returnShape
3006
+ }
3007
+ ];
3008
+ for (const field of boundingFields) {
3009
+ const missing = describeAbsence(field.value);
3010
+ if (missing === undefined)
3011
+ continue;
3012
+ violations.push(violation2("high", field.code, `${subject} must declare a round ${field.label} \u2014 ${missing}`, field.fix));
3013
+ }
3014
+ }
2973
3015
  if (writable) {
2974
3016
  const workingPresent = fields.workingBranch !== undefined && fields.workingBranch !== "";
2975
3017
  const policyPresent = fields.branchPolicy !== undefined && fields.branchPolicy !== "";
@@ -4059,7 +4101,9 @@ function findingsCleanupGate(register, planId, opts) {
4059
4101
  const id = typeof entry.id === "string" ? entry.id : "<unnamed>";
4060
4102
  const label = `R#${id}`;
4061
4103
  if (mode === "zero-residual") {
4062
- if (entry.severity === "nit") {
4104
+ if (normalizeSeverity(entry.severity) === "critical") {
4105
+ violations.push(violation6("high", "findings.zero-residual-critical", `${label}: unresolved critical blocks approval under zero-residual \u2014 fix now or close via explicit risk acceptance`));
4106
+ } else if (entry.severity === "nit") {
4063
4107
  violations.push(violation6("medium", "findings.zero-residual-nit", `${label}: style-only nits must be fixed in-session or dropped \u2014 never left open under zero-residual`));
4064
4108
  } else if (entry.decision === "risk-accepted" || entry.lifecycle === "waived") {
4065
4109
  violations.push(violation6("medium", "findings.zero-residual-risk-accepted", `${label}: waived/risk-accepted findings must be closed/archived, not left open under zero-residual`));
@@ -8392,6 +8436,202 @@ function resolvePrReviewTier(input) {
8392
8436
  return "quick";
8393
8437
  return "default";
8394
8438
  }
8439
+ var QC_VERDICTS = ["Approve", "Request Changes", "Needs Discussion", "Unconfirmed"];
8440
+ var REPORT_FIELDS = ["report_kind", "reviewer", "reviewer_index", "plan_id", "verdict", "generated_at"];
8441
+ var REPORT_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
8442
+ var REPORT_SEVERITIES = ["Critical", "Warning", "Suggestion", "Unconfirmed"];
8443
+ var BODY_VERDICT_RE = /^[ \t]*(?:[-*+][ \t]+)?(?:#{1,6}[ \t]+)?[*_\s]*Verdict[*_\s]*:[ \t]*(.*)$/i;
8444
+ var VERDICT_DECORATION_RE = /^[*_`"'\s~]+/;
8445
+ var TRUNCATED_COVERAGE_RE = /^[ \t]*(?:[-*+][ \t]+)?(?:\*\*)?Truncated coverage(?:\*\*)?[ \t]*:/;
8446
+ var EMPTY_SECTION_RE = /^(?:\(none\)|none(?![A-Za-z])|\uff08?\u65e0\uff09?)/i;
8447
+ var LIST_ITEM_RE = /^(?:[-*][ \t]+|\d+[.)][ \t]+)(.*)$/;
8448
+ function sectionRange(lines, heading) {
8449
+ const start = lines.findIndex((line) => {
8450
+ const m = /^(#{1,6})[ \t]+(.*?)[ \t]*$/.exec(line);
8451
+ return m !== null && m[1].length === 2 && m[2] === heading;
8452
+ });
8453
+ if (start < 0)
8454
+ return;
8455
+ let end = lines.length;
8456
+ for (let i = start + 1;i < lines.length; i++) {
8457
+ if (/^##[ \t]/.test(lines[i])) {
8458
+ end = i;
8459
+ break;
8460
+ }
8461
+ }
8462
+ return [start + 1, end];
8463
+ }
8464
+ function bodyLines(lines) {
8465
+ if (lines[0]?.trim() !== "---")
8466
+ return lines;
8467
+ for (let i = 1;i < lines.length; i++) {
8468
+ if (lines[i].trim() === "---")
8469
+ return lines.slice(i + 1);
8470
+ }
8471
+ return lines;
8472
+ }
8473
+ function linesUnclosedFence(text) {
8474
+ const lines = text.replace(/^\uFEFF/, "").split(/\r?\n/);
8475
+ if (lines.length === 0 || lines[0].trim() !== "---")
8476
+ return false;
8477
+ return !lines.slice(1).some((line) => line.trim() === "---");
8478
+ }
8479
+ function tableCells(line) {
8480
+ const trimmed = line.trim();
8481
+ if (!trimmed.startsWith("|") || !trimmed.endsWith("|"))
8482
+ return;
8483
+ const cells = trimmed.slice(1, -1).split("|").map((cell) => cell.trim());
8484
+ return cells.length >= 2 ? cells : undefined;
8485
+ }
8486
+ function namesSeverity(text, severity) {
8487
+ const index = text.indexOf(severity);
8488
+ if (index < 0)
8489
+ return false;
8490
+ return !/[A-Za-z]/.test(text.charAt(index - 1)) && !/[A-Za-z]/.test(text.charAt(index + severity.length));
8491
+ }
8492
+ function summaryCounts(lines) {
8493
+ const counts = {};
8494
+ const range = sectionRange(lines, "Summary");
8495
+ if (range === undefined)
8496
+ return counts;
8497
+ for (let i = range[0];i < range[1]; i++) {
8498
+ const cells = tableCells(lines[i]);
8499
+ if (cells === undefined)
8500
+ continue;
8501
+ const values = cells.slice(1).map((cell) => /(\d+)/.exec(cell)?.[1]);
8502
+ const tail = values.filter((digits) => digits !== undefined).pop();
8503
+ if (tail === undefined)
8504
+ continue;
8505
+ for (const severity of REPORT_SEVERITIES) {
8506
+ if (!namesSeverity(cells[0], severity))
8507
+ continue;
8508
+ counts[severity] = Number(tail);
8509
+ }
8510
+ }
8511
+ return counts;
8512
+ }
8513
+ function findingsCounts(lines) {
8514
+ const counts = {};
8515
+ const range = sectionRange(lines, "Findings");
8516
+ if (range === undefined)
8517
+ return counts;
8518
+ let current;
8519
+ for (let i = range[0];i < range[1]; i++) {
8520
+ const line = lines[i];
8521
+ const heading = /^###[ \t]+(.*?)[ \t]*$/.exec(line);
8522
+ if (heading !== null) {
8523
+ current = REPORT_SEVERITIES.find((severity) => namesSeverity(heading[1], severity));
8524
+ if (current !== undefined && counts[current] === undefined)
8525
+ counts[current] = 0;
8526
+ continue;
8527
+ }
8528
+ if (current === undefined)
8529
+ continue;
8530
+ const item = LIST_ITEM_RE.exec(line);
8531
+ if (item === null || EMPTY_SECTION_RE.test(item[1].trim()))
8532
+ continue;
8533
+ counts[current] = (counts[current] ?? 0) + 1;
8534
+ }
8535
+ return counts;
8536
+ }
8537
+ function bodyVerdictPhrase(lines) {
8538
+ let phrase;
8539
+ for (const line of bodyLines(lines)) {
8540
+ const m = BODY_VERDICT_RE.exec(line);
8541
+ if (m === null)
8542
+ continue;
8543
+ const text = m[1].trim().replace(VERDICT_DECORATION_RE, "");
8544
+ phrase = text.split(/\s+/)[0] ?? "";
8545
+ for (const verdict of [...QC_VERDICTS].sort((a, b) => b.length - a.length)) {
8546
+ if (!text.startsWith(verdict))
8547
+ continue;
8548
+ const next = text.charAt(verdict.length);
8549
+ if (next === "" || !/[A-Za-z0-9]/.test(next)) {
8550
+ phrase = verdict;
8551
+ break;
8552
+ }
8553
+ }
8554
+ }
8555
+ return phrase;
8556
+ }
8557
+ function violation16(severity, code, message, fix) {
8558
+ return { ok: false, severity, code, message, fix };
8559
+ }
8560
+ function validateQcReport(text) {
8561
+ const violations = [];
8562
+ if (lines_missing_fence(text)) {
8563
+ return {
8564
+ ok: false,
8565
+ violations: [
8566
+ violation16("high", "qcreview.report.missing-frontmatter", "no `---` fenced frontmatter found - a QC seat report must open with the machine-readable frontmatter block (report-template.md \u00a7 Frontmatter)", "open the report with `---` and the fields `report_kind: qc` / `reviewer` / `reviewer_index` / `plan_id` / `verdict` / `generated_at`")
8567
+ ]
8568
+ };
8569
+ }
8570
+ const lines = text.replace(/^\uFEFF/, "").split(/\r?\n/);
8571
+ if (linesUnclosedFence(text)) {
8572
+ return {
8573
+ ok: false,
8574
+ violations: [
8575
+ violation16("high", "qcreview.report.unclosed-frontmatter", "the frontmatter `---` fence is never closed - every line after it is read as frontmatter, so the report body is not part of the document", "add a closing `---` line after the last frontmatter key (report-template.md \u00a7 Frontmatter)")
8576
+ ]
8577
+ };
8578
+ }
8579
+ const { doc } = parseReportFrontmatter(text);
8580
+ for (const field of REPORT_FIELDS) {
8581
+ const value = doc[field];
8582
+ if (value === undefined || value.trim() === "") {
8583
+ violations.push(violation16("medium", `qcreview.report.missing-${field}`, `missing required frontmatter field: ${field}`, `add "${field}: <value>" to the frontmatter block (report-template.md \u00a7 Frontmatter)`));
8584
+ }
8585
+ }
8586
+ const reportKind = doc.report_kind?.trim() ?? "";
8587
+ if (reportKind !== "" && reportKind !== "qc") {
8588
+ violations.push(violation16("medium", "qcreview.report.invalid-report-kind", `report_kind "${reportKind}" is not "qc"`, "use `report_kind: qc` for a QC seat report (a PM consolidated report is not a seat report)"));
8589
+ }
8590
+ const frontmatterVerdict = doc.verdict?.trim() ?? "";
8591
+ const frontmatterVerdictIsValid = QC_VERDICTS.includes(frontmatterVerdict);
8592
+ if (frontmatterVerdict !== "" && !frontmatterVerdictIsValid) {
8593
+ violations.push(violation16("medium", "qcreview.report.invalid-verdict", `frontmatter verdict "${frontmatterVerdict}" is not one of ${JSON.stringify(QC_VERDICTS)}`, `use one of: ${QC_VERDICTS.join(" | ")} - the vocabulary is verbatim (report-template.md \u00a7 Report body template)`));
8594
+ }
8595
+ const generatedAt = doc.generated_at?.trim() ?? "";
8596
+ if (generatedAt !== "" && !REPORT_DATE_RE.test(generatedAt)) {
8597
+ violations.push(violation16("medium", "qcreview.report.invalid-generated-at", `generated_at "${generatedAt}" must be a calendar date (YYYY-MM-DD)`, 'write `generated_at: "YYYY-MM-DD"` (report-template.md \u00a7 Frontmatter)'));
8598
+ }
8599
+ const bodyPhrase = bodyVerdictPhrase(lines);
8600
+ const bodyPhraseIsValid = bodyPhrase !== undefined && QC_VERDICTS.includes(bodyPhrase);
8601
+ if (bodyPhrase === undefined) {
8602
+ violations.push(violation16("high", "qcreview.report.missing-body-verdict", "the report body carries no verdict line (`**Verdict**: <verdict>` or `## Verdict: <verdict>`)", `add a body verdict line using one of: ${QC_VERDICTS.join(" | ")}`));
8603
+ } else if (!bodyPhraseIsValid) {
8604
+ violations.push(violation16("high", "qcreview.report.verdict-mismatch", bodyPhrase === "" ? `the body verdict line is empty - expected one of ${JSON.stringify(QC_VERDICTS)}` : `body verdict "${bodyPhrase}" is not one of ${JSON.stringify(QC_VERDICTS)}`, `start the verdict line with one of: ${QC_VERDICTS.join(" | ")}`));
8605
+ } else if (frontmatterVerdictIsValid && bodyPhrase !== frontmatterVerdict) {
8606
+ violations.push(violation16("high", "qcreview.report.verdict-mismatch", `body verdict "${bodyPhrase}" does not match the frontmatter verdict "${frontmatterVerdict}"`, "make the frontmatter verdict and the body verdict line agree on the same final verdict"));
8607
+ }
8608
+ const summary = summaryCounts(lines);
8609
+ const findings = findingsCounts(lines);
8610
+ for (const severity of REPORT_SEVERITIES) {
8611
+ const claimed = summary[severity];
8612
+ const counted = findings[severity];
8613
+ if (claimed === undefined || counted === undefined || claimed === counted)
8614
+ continue;
8615
+ violations.push(violation16("high", "qcreview.report.summary-count-mismatch", `## Summary ${severity} count ${claimed} does not match the ${counted} top-level entr${counted === 1 ? "y" : "ies"} under ## Findings (\u00a7 ${severity})`, `recount \u00a7 ${severity} and update the ## Summary row - one top-level entry per finding, detail lines indented (report-template.md \u00a7 Findings)`));
8616
+ }
8617
+ const effectiveVerdict = frontmatterVerdictIsValid ? frontmatterVerdict : bodyPhraseIsValid ? bodyPhrase : undefined;
8618
+ if (effectiveVerdict !== undefined) {
8619
+ const critical = summary.Critical;
8620
+ const warning = summary.Warning;
8621
+ const blocking = (critical ?? 0) + (warning ?? 0);
8622
+ if (effectiveVerdict === "Approve" && blocking > 0) {
8623
+ violations.push(violation16("high", "qcreview.report.verdict-contradicts-counts", `verdict "Approve" with ${blocking} Critical/Warning finding(s) in ## Summary (Critical ${critical ?? 0}, Warning ${warning ?? 0})`, 'do not Approve with open Critical/Warning findings - close them or use "Request Changes" / "Needs Discussion"'));
8624
+ }
8625
+ const unconfirmed = summary.Unconfirmed;
8626
+ if (unconfirmed !== undefined && unconfirmed > 0 && effectiveVerdict !== "Unconfirmed") {
8627
+ violations.push(violation16("high", "qcreview.report.verdict-contradicts-counts", `verdict "${effectiveVerdict}" with ${unconfirmed} Unconfirmed finding(s) in ## Summary - a failed evidence channel transmits as "Unconfirmed" (mstar-review-qc \u00a7 \u5e2d\u4f4d\u9884\u7b97\u4e0e\u622a\u65ad)`, 'set the verdict to "Unconfirmed" or re-establish the evidence channel before converging'));
8628
+ }
8629
+ if (effectiveVerdict === "Unconfirmed" && lines.some((line) => TRUNCATED_COVERAGE_RE.test(line))) {
8630
+ violations.push(violation16("high", "qcreview.report.truncation-verdict", 'the report declares `Truncated coverage:` but carries the verdict "Unconfirmed" - a budget/scope cut is not a failed evidence channel', 'keep the verdict earned for the reviewed scope and reserve "Unconfirmed" for a failed evidence channel'));
8631
+ }
8632
+ }
8633
+ return { ok: violations.length === 0, violations };
8634
+ }
8395
8635
 
8396
8636
  // src/index.ts
8397
8637
  import { execFileSync as execFileSync11 } from "child_process";
@@ -14509,16 +14749,16 @@ async function captureSddEvidence(request, argv) {
14509
14749
  const resolved = resolveSddExecutionContext2(validatedRequest.context);
14510
14750
  const cwdGate = checkSddAction2(resolved, { kind: "source", cwd: process.cwd() });
14511
14751
  if (!cwdGate.ok) {
14512
- throw gateError(`sdd evidence capture refused: ${cwdGate.violations.map((violation16) => `${violation16.code}: ${violation16.message}`).join("; ")}`);
14752
+ throw gateError(`sdd evidence capture refused: ${cwdGate.violations.map((violation17) => `${violation17.code}: ${violation17.message}`).join("; ")}`);
14513
14753
  }
14514
14754
  const launchGate = checkSddAction2(resolved, { kind: "launch", cwd: process.cwd() });
14515
14755
  if (!launchGate.ok) {
14516
- throw gateError(`sdd evidence capture refused: ${launchGate.violations.map((violation16) => `${violation16.code}: ${violation16.message}`).join("; ")}`);
14756
+ throw gateError(`sdd evidence capture refused: ${launchGate.violations.map((violation17) => `${violation17.code}: ${violation17.message}`).join("; ")}`);
14517
14757
  }
14518
14758
  const evidenceDir = join13(resolved.sddDir, "evidence");
14519
14759
  const artifactGate = checkSddAction2(resolved, { kind: "artifact", cwd: process.cwd(), target: evidenceDir });
14520
14760
  if (!artifactGate.ok) {
14521
- throw gateError(`sdd evidence capture refused: ${artifactGate.violations.map((violation16) => `${violation16.code}: ${violation16.message}`).join("; ")}`);
14761
+ throw gateError(`sdd evidence capture refused: ${artifactGate.violations.map((violation17) => `${violation17.code}: ${violation17.message}`).join("; ")}`);
14522
14762
  }
14523
14763
  const runId = randomUUID3();
14524
14764
  const runDir = join13(evidenceDir, runId);
@@ -14603,7 +14843,7 @@ async function captureSddEvidence(request, argv) {
14603
14843
  record.state = "finished";
14604
14844
  const selfGate = validateSddEvidenceRecord(record);
14605
14845
  if (!selfGate.ok) {
14606
- throw new Error(`evidence finalization produced an invalid record for ${runDir}: ${selfGate.violations.map((violation16) => `${violation16.code}: ${violation16.message}`).join("; ")}`);
14846
+ throw new Error(`evidence finalization produced an invalid record for ${runDir}: ${selfGate.violations.map((violation17) => `${violation17.code}: ${violation17.message}`).join("; ")}`);
14607
14847
  }
14608
14848
  try {
14609
14849
  writeRecordAtomic(resolved.sddDir, runDir, recordPath, record);
@@ -14822,16 +15062,16 @@ function validatePlannedDocs(plan) {
14822
15062
  for (const snapshot of plan.snapshots) {
14823
15063
  const gate3 = validateWorkflowSnapshot2(snapshot.data);
14824
15064
  if (!gate3.ok) {
14825
- for (const violation16 of gate3.violations) {
14826
- warnings.push(`[${violation16.severity}] ${violation16.code}: ${violation16.message} (planned snapshot ${snapshot.file})`);
15065
+ for (const violation17 of gate3.violations) {
15066
+ warnings.push(`[${violation17.severity}] ${violation17.code}: ${violation17.message} (planned snapshot ${snapshot.file})`);
14827
15067
  }
14828
15068
  }
14829
15069
  }
14830
15070
  if (plan.register !== null) {
14831
15071
  const gate3 = validateProjectRegister2(plan.register.data);
14832
15072
  if (!gate3.ok) {
14833
- for (const violation16 of gate3.violations) {
14834
- warnings.push(`[${violation16.severity}] ${violation16.code}: ${violation16.message} (planned register ${plan.register.file})`);
15073
+ for (const violation17 of gate3.violations) {
15074
+ warnings.push(`[${violation17.severity}] ${violation17.code}: ${violation17.message} (planned register ${plan.register.file})`);
14835
15075
  }
14836
15076
  }
14837
15077
  }
@@ -17774,10 +18014,10 @@ function resolveStatusFilePath(pathArg) {
17774
18014
  return path15.join(harnessDir, "status.json");
17775
18015
  }
17776
18016
  function printViolationList(violations) {
17777
- for (const violation16 of violations) {
17778
- console.error(` - [${violation16.severity}] ${violation16.code}: ${violation16.message}`);
17779
- if (violation16.fix)
17780
- console.error(` fix: ${violation16.fix}`);
18017
+ for (const violation17 of violations) {
18018
+ console.error(` - [${violation17.severity}] ${violation17.code}: ${violation17.message}`);
18019
+ if (violation17.fix)
18020
+ console.error(` fix: ${violation17.fix}`);
17781
18021
  }
17782
18022
  }
17783
18023
  function readSnapshotForCheck(snapshotPath) {
@@ -18154,10 +18394,10 @@ function verifyLeaseRow(row, planId, snapshotPath) {
18154
18394
  }
18155
18395
  const count = result.violations.length;
18156
18396
  console.error(import_picocolors3.default.red(`${snapshotPath}: FAIL plan ${planId} (${count} violation${count === 1 ? "" : "s"})`));
18157
- for (const violation16 of result.violations) {
18158
- console.error(` - [${violation16.severity}] ${violation16.code}: ${violation16.message}`);
18159
- if (violation16.fix)
18160
- console.error(` fix: ${violation16.fix}`);
18397
+ for (const violation17 of result.violations) {
18398
+ console.error(` - [${violation17.severity}] ${violation17.code}: ${violation17.message}`);
18399
+ if (violation17.fix)
18400
+ console.error(` fix: ${violation17.fix}`);
18161
18401
  }
18162
18402
  process.exitCode = 1;
18163
18403
  }
@@ -18339,10 +18579,10 @@ function printChecklist(label, gate3) {
18339
18579
  }
18340
18580
  const count = gate3.violations.length;
18341
18581
  console.error(import_picocolors3.default.red(`${label}: FAIL (${count} violation${count === 1 ? "" : "s"})`));
18342
- for (const violation16 of gate3.violations) {
18343
- console.error(` - [${violation16.severity}] ${violation16.code}: ${violation16.message}`);
18344
- if (violation16.fix)
18345
- console.error(` fix: ${violation16.fix}`);
18582
+ for (const violation17 of gate3.violations) {
18583
+ console.error(` - [${violation17.severity}] ${violation17.code}: ${violation17.message}`);
18584
+ if (violation17.fix)
18585
+ console.error(` fix: ${violation17.fix}`);
18346
18586
  }
18347
18587
  }
18348
18588
  iterationCommand.command("gate").description("Evaluate the phase-transition gate: prints the transition (phase-2-execute / phase-3-close / phase-4-pr-delivery) " + "plus the \xA73.1 entry and \xA73.5 exit checklists. Exit 1 when the gate verdict fails \u2014 during the Phase-3 window " + "(transition: phase-3-close) exit 1 is EXPECTED until the \xA73.4 close items (status: completed + end_date) are " + "written: the exit checklist gates Phase 4, not the Phase-3 entry. " + "--phase 6 switches to the post-merge close local-state gate (terminal snapshot, no dangling lease, root " + "status.json entry unregistered); it needs no --compass. Exit 0 pass, 1 gate fail/error, 2 usage").requiredOption("--workflow <id>", "Workflow id whose snapshot is evaluated").option("--compass <path>", "delivery-compass.md path (Phase 2\u20135 transition form; not read by --phase 6)").option("--phase <n>", "Gate form: 6 evaluates the post-merge close local-state gate (no --compass needed); omit for the Phase 2\u20135 transition form").option("--harness <path>", "Harness dir override (default: resolved {HARNESS_DIR})").option("--branch <branch>", "Current branch probe (exit \xA73.5 item 5)").option("--integration <branch>", "Spec integration branch probe (exit \xA73.5 item 5)").option("--target <branch>", "PR base branch probe (exit \xA73.5 item 6)").action((options) => {
@@ -18399,10 +18639,10 @@ iterationCommand.command("push-cadence").description("\xA75.1a push-cadence prob
18399
18639
  }
18400
18640
  const count = result.violations.length;
18401
18641
  console.error(import_picocolors3.default.red(`push blocked (${count} violation${count === 1 ? "" : "s"})`));
18402
- for (const violation16 of result.violations) {
18403
- console.error(` - [${violation16.severity}] ${violation16.code}: ${violation16.message}`);
18404
- if (violation16.fix)
18405
- console.error(` fix: ${violation16.fix}`);
18642
+ for (const violation17 of result.violations) {
18643
+ console.error(` - [${violation17.severity}] ${violation17.code}: ${violation17.message}`);
18644
+ if (violation17.fix)
18645
+ console.error(` fix: ${violation17.fix}`);
18406
18646
  }
18407
18647
  process.exitCode = 1;
18408
18648
  });
@@ -18809,7 +19049,7 @@ function cleanupProbe(input) {
18809
19049
  read = readWorkflowSnapshot(dir);
18810
19050
  } catch (error) {
18811
19051
  if (error instanceof WorkflowSnapshotValidationError) {
18812
- const detail = error.violations.map((violation16) => `${violation16.code}: ${violation16.message}`).join("; ");
19052
+ const detail = error.violations.map((violation17) => `${violation17.code}: ${violation17.message}`).join("; ");
18813
19053
  const doc = JSON.parse(fs12.readFileSync(snapshotPath, "utf8"));
18814
19054
  snapshots.push(cleanupDegradeSiblingSnapshot(doc, entry.name));
18815
19055
  console.error(import_picocolors3.default.yellow(`worktree cleanup: note: sibling snapshot ${snapshotPath} is invalid (${detail}) \u2014 its protective declarations are kept in degraded form`));
@@ -19247,10 +19487,10 @@ lintCommand.description("Lint <target> (file or dir) \u2014 exit 1 on violations
19247
19487
  violations += result.violations.length;
19248
19488
  const count = result.violations.length;
19249
19489
  console.error(import_picocolors3.default.red(`${label}: FAIL (${count} violation${count === 1 ? "" : "s"})`));
19250
- for (const violation16 of result.violations) {
19251
- console.error(` - [${violation16.severity}] ${violation16.code}: ${violation16.message}`);
19252
- if (violation16.fix)
19253
- console.error(` fix: ${violation16.fix}`);
19490
+ for (const violation17 of result.violations) {
19491
+ console.error(` - [${violation17.severity}] ${violation17.code}: ${violation17.message}`);
19492
+ if (violation17.fix)
19493
+ console.error(` fix: ${violation17.fix}`);
19254
19494
  }
19255
19495
  }
19256
19496
  if (violations > 0)
@@ -19823,6 +20063,20 @@ prReviewCommand.command("validate-report").description("Validate a saved local P
19823
20063
  failScript(error, "pr-review validate-report");
19824
20064
  }
19825
20065
  });
20066
+ var qcCommand = program2.command("qc").description("QC seat-report contract (engine-backed): frontmatter fields, verdict vocabulary, body-verdict " + "agreement, Summary/Findings count parity, truncation/verdict coherence " + "(mstar-review-qc SKILL.md \xA7 seat budgets and truncation)");
20067
+ qcCommand.command("validate-report").description("Validate a saved QC seat report against the machine-readable contract (frontmatter fields, verdict vocabulary, " + "body verdict agreement, Summary/Findings count parity, truncation/verdict coherence; exit 1 with violations printed)").argument("<file.md>", "Saved QC seat report markdown file").action((reportFile) => {
20068
+ try {
20069
+ const abs = resolveCliPath(reportFile);
20070
+ if (!fs12.existsSync(abs))
20071
+ throw new Error(`report file not found: ${abs}`);
20072
+ const gate3 = validateQcReport(fs12.readFileSync(abs, "utf8"));
20073
+ printChecklist(abs, gate3);
20074
+ if (!gate3.ok)
20075
+ process.exitCode = 1;
20076
+ } catch (error) {
20077
+ failScript(error, "qc validate-report");
20078
+ }
20079
+ });
19826
20080
  function gitSync(args, cwd) {
19827
20081
  return execFileSync11("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
19828
20082
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/cli",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "Morning Star harness CLI — installer bootstrap + mstar workflow verbs (path/status/lease/sdd/iteration/dispatch/worktree/lint/design-md/audit/compound/host/skill).",
5
5
  "license": "MIT",
6
6
  "repository": {