@attalabs/vinaya 0.44.0 → 0.47.0

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 (144) hide show
  1. package/README.md +6 -4
  2. package/dist/checks/bin/check-body-bare-digits.js +262 -201
  3. package/dist/checks/bin/check-branch-topology.js +70 -23
  4. package/dist/checks/bin/check-brief-shape.js +262 -201
  5. package/dist/checks/bin/check-changeset-coverage.js +94 -16
  6. package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
  7. package/dist/checks/bin/check-closes-n.js +157 -40
  8. package/dist/checks/bin/check-coherence.js +365 -251
  9. package/dist/checks/bin/check-dispatch-readiness.js +3654 -469
  10. package/dist/checks/bin/check-doc-claims.js +262 -201
  11. package/dist/checks/bin/check-doc-coverage-push.js +272 -202
  12. package/dist/checks/bin/check-doc-coverage.js +272 -202
  13. package/dist/checks/bin/check-doctrine-no-procedures.js +262 -201
  14. package/dist/checks/bin/check-doctrine-portability.js +262 -201
  15. package/dist/checks/bin/check-evidence-fresh.js +10138 -2126
  16. package/dist/checks/bin/check-exec-bits.js +3 -0
  17. package/dist/checks/bin/check-first-push-dispatch.js +330 -230
  18. package/dist/checks/bin/check-issue-milestone-attach.js +94 -16
  19. package/dist/checks/bin/check-issue-objectives-numbering.js +262 -201
  20. package/dist/checks/bin/check-issue-parts-coverage.js +94 -16
  21. package/dist/checks/bin/check-issue-surface-globs.js +1062 -242
  22. package/dist/checks/bin/check-issue-title-grammar.js +21 -5
  23. package/dist/checks/bin/check-no-disk-state.js +5 -1
  24. package/dist/checks/bin/check-pr-premise-reassert.js +22 -2
  25. package/dist/checks/bin/check-pr-report-density.js +5 -1
  26. package/dist/checks/bin/check-principal-test-plan-wait.js +282 -207
  27. package/dist/checks/bin/check-quoted-command.js +262 -201
  28. package/dist/checks/bin/check-reader-resolvable-prose.js +262 -201
  29. package/dist/checks/bin/check-registry-gates.js +131 -34
  30. package/dist/checks/bin/check-retired-vocabulary.js +262 -201
  31. package/dist/checks/bin/check-review-gate.js +262 -201
  32. package/dist/checks/bin/check-single-plan-pr.js +5 -1
  33. package/dist/checks/bin/check-surface-scope.js +136 -38
  34. package/dist/checks/bin/check-test-plan.js +282 -207
  35. package/dist/checks/bin/check-token-collection-wired.js +3 -0
  36. package/dist/checks/bin/check-workspace-escape.js +3 -0
  37. package/dist/checks/bin/verify-coherence.js +237 -148
  38. package/dist/checks/bin/verify-dispatch.js +870 -66
  39. package/dist/checks/bin/verify-docs.js +13 -6
  40. package/dist/harness.js +57 -10
  41. package/dist/index.js +16670 -7196
  42. package/dist/lib/pre-push-cache-test-run.js +4488 -2170
  43. package/dist/lib/pre-push-changed-files.js +251 -12
  44. package/dist/lib/pre-push-mode.js +69 -19
  45. package/dist/lib/pre-push-progress-dir.js +10265 -2853
  46. package/dist/lib/pre-push-record-tests.js +67 -19
  47. package/dist/lib/pre-push-select-tests.js +520 -222
  48. package/dist/lib/push-progress-observer.js +9176 -1757
  49. package/dist/process.js +2 -0
  50. package/dist/programs/archive.js +8948 -1547
  51. package/dist/programs/audit.js +9176 -1772
  52. package/dist/programs/check.js +9248 -1845
  53. package/dist/programs/commit-msg.js +8984 -1583
  54. package/dist/programs/dev-review-loop.js +15621 -7626
  55. package/dist/programs/dispatch.js +9977 -2726
  56. package/dist/programs/log-emit.js +9011 -1660
  57. package/dist/programs/log-selftest.js +8908 -1507
  58. package/dist/programs/log-send.js +9081 -1594
  59. package/dist/programs/pr-report.js +9477 -1820
  60. package/dist/programs/pr-snapshot.js +8916 -1515
  61. package/dist/programs/pr-verify-evidence.js +9482 -1825
  62. package/dist/programs/pr.js +11773 -4082
  63. package/dist/programs/review-post.js +11141 -3496
  64. package/dist/programs/review-status.js +8997 -1533
  65. package/dist/programs/run-engine.js +22149 -18798
  66. package/dist/programs/sync.js +9030 -1629
  67. package/dist/programs/task-brief.js +10234 -1827
  68. package/dist/programs/task-sweep.js +9267 -1621
  69. package/dist/programs/task-tools-serve.js +77141 -16659
  70. package/dist/programs/tokens.js +8966 -1565
  71. package/dist/programs/waiver.js +8983 -1582
  72. package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
  73. package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
  74. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +17 -10
  75. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
  76. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/premise-check.d.ts +14 -0
  77. package/dist/vinaya-strict/checks/registry.ts +2 -2
  78. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
  79. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
  80. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
  81. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
  82. package/dist/vinaya-strict/executing/developer/reference.md +5 -3
  83. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
  84. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
  85. package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
  86. package/dist/vinaya-strict/process.yaml +6 -1
  87. package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  88. package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
  89. package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
  90. package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
  91. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
  92. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
  93. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
  94. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
  95. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
  96. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
  97. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
  98. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
  99. package/package.json +3 -2
  100. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  101. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  102. package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
  103. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  105. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  106. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  107. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  108. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  109. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  111. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  113. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  114. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  117. package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
  118. package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
  119. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
  120. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
  121. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
  122. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  123. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
  124. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  125. package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
  126. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
  127. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
  128. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
  129. package/vinaya-strict/artifacts/templates/brief-template.md +6 -0
  130. package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
  131. package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
  132. package/vinaya-strict/doctrine/contracts/planner-developer.md +4 -3
  133. package/vinaya-strict/doctrine/enforcement.md +4 -4
  134. package/vinaya-strict/doctrine/roles/principal.md +1 -1
  135. package/vinaya-strict/doctrine/state-machine.md +7 -2
  136. package/vinaya-strict/executing/developer/reference.md +5 -3
  137. package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  138. package/vinaya-strict/thinking/planner/doctrine.md +4 -1
  139. package/vinaya-strict/thinking/planner/reference.md +30 -9
  140. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
  141. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
  142. package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
  143. /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
  144. /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,6 +24,7 @@ var __toCommonJS = (from) => {
23
24
  return entry;
24
25
  };
25
26
  var __moduleCache;
27
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
26
28
  var __returnValue = (v) => v;
27
29
  function __exportSetter(name, newValue) {
28
30
  this[name] = __returnValue.bind(null, newValue);
@@ -47,6 +49,7 @@ var __esm = (fn, res, err) => () => {
47
49
  throw err[0];
48
50
  return res;
49
51
  };
52
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
50
53
 
51
54
  // ../../harness/processes/vinaya-strict/tools/task-contract/forge/parse-rationale-deps.ts
52
55
  function splitSlugQualifiedEdge(edge) {
@@ -392,6 +395,23 @@ async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
392
395
  }
393
396
  throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
394
397
  }
398
+ async function ghLabelIssueCountsAsync(owner, repo, labelQuery) {
399
+ const stdout = await runAsync([
400
+ "api",
401
+ "graphql",
402
+ "--paginate",
403
+ "-f",
404
+ `query=${LABEL_ISSUE_COUNTS_QUERY.replace("$labelQuery", JSON.stringify(labelQuery))}`,
405
+ "-f",
406
+ `owner=${owner}`,
407
+ "-f",
408
+ `name=${repo}`,
409
+ "--jq",
410
+ ".data.repository.labels.nodes[] | {name, open: .open.totalCount, total: .all.totalCount}"
411
+ ]);
412
+ return stdout.split(`
413
+ `).filter((line) => line.trim() !== "").map((line) => JSON.parse(line));
414
+ }
395
415
  function issueListByLabelArgs(owner, repo, label) {
396
416
  return [
397
417
  "issue",
@@ -425,7 +445,14 @@ async function ghIssueListByAnyLabelAsync(owner, repo, labels) {
425
445
  const perLabel = await Promise.all(labels.map((l) => ghIssueListByLabelAsync(owner, repo, l)));
426
446
  return dedupeByNumber(perLabel.flat());
427
447
  }
428
- var execFileAsync, systemEnv, MAX_PER_PAGE = 100, MAX_PAGES = 100;
448
+ var execFileAsync, systemEnv, MAX_PER_PAGE = 100, MAX_PAGES = 100, LABEL_ISSUE_COUNTS_QUERY = `query($owner: String!, $name: String!, $endCursor: String) {
449
+ repository(owner: $owner, name: $name) {
450
+ labels(first: 100, after: $endCursor, query: $labelQuery) {
451
+ pageInfo { hasNextPage endCursor }
452
+ nodes { name open: issues(states: OPEN) { totalCount } all: issues { totalCount } }
453
+ }
454
+ }
455
+ }`;
429
456
  var init_gh = __esm(() => {
430
457
  execFileAsync = promisify(execFile);
431
458
  systemEnv = {
@@ -766,7 +793,7 @@ function commentMarkerFamily(name) {
766
793
  function anchorAlternation(spellings) {
767
794
  return `(?:${spellings.map((spelling) => spelling.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`;
768
795
  }
769
- var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
796
+ var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DOCUMENTATION_EDIT_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
770
797
  var init_legacy_markers = __esm(() => {
771
798
  REGION_PREFIX = { old: "AEG", current: "VINAYA" };
772
799
  PROVENANCE_HEADING = {
@@ -788,6 +815,7 @@ var init_legacy_markers = __esm(() => {
788
815
  LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
789
816
  PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
790
817
  OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
818
+ DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
791
819
  DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
792
820
  COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
793
821
  COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
@@ -949,6 +977,15 @@ function parsePremiseBlock(prBody) {
949
977
  }
950
978
  return assertions;
951
979
  }
980
+ function declaresNewFilesOnly(prBody) {
981
+ const searchIn = anchoredRegion(prBody, "PREMISE", REGION_PREFIXES) ?? prBody;
982
+ const lines = searchIn.split(/\r?\n/).map((l) => l.trim());
983
+ const header = lines.findIndex(isPremiseHeader);
984
+ if (header === -1)
985
+ return false;
986
+ const first = lines.slice(header + 1).find((l) => l !== "");
987
+ return first === NEW_FILES_ONLY_PREMISE && parsePremiseBlock(prBody).length === 0;
988
+ }
952
989
  function premiseBlockText(prBody) {
953
990
  const searchIn = anchoredRegion(prBody, "PREMISE", REGION_PREFIXES) ?? prBody;
954
991
  const lines = searchIn.split(/\r?\n/);
@@ -996,7 +1033,7 @@ function checkPremises(assertions, fileReader) {
996
1033
  }
997
1034
  return { pass: failures.length === 0, failures };
998
1035
  }
999
- var ASSERTION_KINDS, PREMISE_LINE;
1036
+ var ASSERTION_KINDS, NEW_FILES_ONLY_PREMISE = "- (no pin — every file this task names is new, so no existing content can be pinned)", PREMISE_LINE;
1000
1037
  var init_premise_check = __esm(() => {
1001
1038
  init_anchored_region();
1002
1039
  init_legacy_markers();
@@ -1138,13 +1175,16 @@ function checkSurfaceMap(prBody) {
1138
1175
  function checkDocUpdateList(prBody) {
1139
1176
  return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
1140
1177
  }
1141
- function checkWorktreeStep0(prBody) {
1142
- if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
1178
+ function checkWorktreeStep0(body) {
1179
+ const prBody = body.replaceAll(`\r
1180
+ `, `
1181
+ `);
1182
+ if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody) || /\*\*Step 0 \(mandatory, verbatim\):\*\*\n\n```\n(?:npm ci|pnpm install --frozen-lockfile|yarn install --frozen-lockfile)\n```/.test(prBody))
1143
1183
  return { status: "pass", errors: [] };
1144
1184
  return {
1145
1185
  status: "fail",
1146
1186
  errors: [
1147
- "brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
1187
+ "brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or frozen-lockfile install (`bun install --frozen-lockfile`, `npm ci`, `pnpm install --frozen-lockfile`, `yarn install --frozen-lockfile`) found in the PR body."
1148
1188
  ]
1149
1189
  };
1150
1190
  }
@@ -1586,6 +1626,7 @@ var init_doctrine_map = __esm(() => {
1586
1626
  { key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
1587
1627
  { key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
1588
1628
  { key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
1629
+ { key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
1589
1630
  { key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
1590
1631
  { key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
1591
1632
  { key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
@@ -2708,7 +2749,13 @@ function isMechanicallyNeutralDiff(diffText, path) {
2708
2749
  }
2709
2750
  return sawChange;
2710
2751
  }
2711
- function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff) {
2752
+ function prBodyGiven(env = process.env) {
2753
+ return env.PR_BODY !== undefined || env.PR_BODY_FILE !== undefined;
2754
+ }
2755
+ function owedNeutralNotes(result) {
2756
+ return result.notes.filter((n) => n.startsWith(DOC_NEUTRAL_OWED_PREFIX));
2757
+ }
2758
+ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff, bodyGiven = true) {
2712
2759
  const out = { errors: [], notes: [] };
2713
2760
  if (docOwnersContent === null)
2714
2761
  return out;
@@ -2748,24 +2795,28 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
2748
2795
  }
2749
2796
  if (changed.includes(pointerPath))
2750
2797
  continue;
2798
+ const evidenced = () => getDiff !== undefined && matchedFiles.every((f) => {
2799
+ const diff = getDiff(f);
2800
+ return diff !== null && isMechanicallyNeutralDiff(diff, f);
2801
+ });
2751
2802
  const declared = neutrals.find((n) => n.surface === b.pointer);
2752
2803
  if (declared) {
2753
- const evidenced = getDiff !== undefined && matchedFiles.every((f) => {
2754
- const diff = getDiff(f);
2755
- return diff !== null && isMechanicallyNeutralDiff(diff, f);
2756
- });
2757
- if (evidenced) {
2804
+ if (evidenced()) {
2758
2805
  out.notes.push(`C5 doc-neutral: ${b.pointer} not required for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — declared neutral ("${declared.note}"), diff of ${matchedFiles.join(", ")} confirmed comment/whitespace-only.`);
2759
2806
  continue;
2760
2807
  }
2761
2808
  out.errors.push(`C5 doc-neutral-unverified: ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}) declared \`Doc-neutral: ${b.pointer} — ${declared.note}\`, but the diff of ${matchedFiles.join(", ")} contains changes beyond comments/whitespace. Update ${pointerPath}, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
2762
2809
  continue;
2763
2810
  }
2811
+ if (!bodyGiven && evidenced()) {
2812
+ out.notes.push(`${DOC_NEUTRAL_OWED_PREFIX} ${b.pointer} not required in this run for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — no pull request body was given, and the diff of ${matchedFiles.join(", ")} is comment/whitespace-only. The pull request body owes \`Doc-neutral: ${b.pointer} — <why>\`.`);
2813
+ continue;
2814
+ }
2764
2815
  out.errors.push(`C5 doc-coverage: code change matched ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}), but ${pointerPath} is not in the PR diff. Update it, declare \`Doc-neutral: ${b.pointer} — <why>\` if the change is genuinely mechanically-neutral, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
2765
2816
  }
2766
2817
  return out;
2767
2818
  }
2768
- var DOC_OWNERS_PATH = ".vinaya/doc-owners", SEPARATOR, LANGUAGE_COMMENT_PREFIXES;
2819
+ var DOC_OWNERS_PATH = ".vinaya/doc-owners", SEPARATOR, LANGUAGE_COMMENT_PREFIXES, DOC_NEUTRAL_OWED_PREFIX = "C5 doc-neutral-owed:";
2769
2820
  var init_doc_owners = __esm(() => {
2770
2821
  init_file_classify();
2771
2822
  init_waiver_label();
@@ -2820,6 +2871,20 @@ var init_protected_paths = __esm(() => {
2820
2871
  ];
2821
2872
  });
2822
2873
 
2874
+ // ../../harness/processes/vinaya-strict/tools/task-contract/test-plan-proof.ts
2875
+ function stripObjectiveIdSpans(text) {
2876
+ return text.replace(ITEM_IDS_SPAN_RE, "").trim();
2877
+ }
2878
+ var ID_LIST, LINE_IDS_RE, ITEM_IDS_SPAN_RE;
2879
+ var init_test_plan_proof = __esm(() => {
2880
+ init_brief_validation();
2881
+ init_objectives();
2882
+ init_test_plan_section();
2883
+ ID_LIST = String.raw`O\d+(?:\s*,\s*O\d+)*`;
2884
+ LINE_IDS_RE = new RegExp(String.raw`\(\s*(${ID_LIST})\s*\)\s*$`);
2885
+ ITEM_IDS_SPAN_RE = new RegExp(String.raw`(?<!\`)(\`+)\s*\(?\s*(${ID_LIST})\s*\)?\s*\1(?!\`)`, "g");
2886
+ });
2887
+
2823
2888
  // ../../harness/processes/vinaya-strict/tools/task-contract/issue-validation.ts
2824
2889
  function hasRationaleField(body, labelPattern) {
2825
2890
  const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
@@ -3018,7 +3083,7 @@ function checkPartsCiteDefinedObjectives(body) {
3018
3083
  return { status: errors.length > 0 ? "fail" : "pass", errors };
3019
3084
  }
3020
3085
  function liveCommand(text) {
3021
- const trimmed = text.trim();
3086
+ const trimmed = stripObjectiveIdSpans(text);
3022
3087
  const span = /^(`+)(.+)\1$/.exec(trimmed);
3023
3088
  return span ? span[2].trim() : trimmed;
3024
3089
  }
@@ -3127,9 +3192,19 @@ function namedPathsIn(text) {
3127
3192
  function boundaryPinnedFiles(body) {
3128
3193
  const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
3129
3194
  const excluded = new Set(namedPathsIn(boundaryOutText(body)));
3130
- return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
3195
+ const named = [...namedPathsIn(boundary), ...rootFilesPinnedIn(boundary)];
3196
+ return [...new Set(named)].filter((p) => looksLikeFilePath(p) && !excluded.has(p));
3131
3197
  }
3132
- var RATIONALE_FIELDS, DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale", SINGLE_FIX_OPTIONAL_FIELDS, OBJECTIVES_SINCE_ISSUE = 404, PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3, ISSUE_PART_LINE_RE, ISSUE_LIVE_LINE_RE, TYPE_LABEL_IDS, PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" }), MESSAGE_VALUE_COUNT_MAX = 5, MESSAGE_VALUE_MAX = 64, DOC_PATH_RE, DOC_PATH_RE_GLOBAL, RATIONALE_PATH_RE_GLOBAL, DEFAULT_COLLISION_THRESHOLD = 3, BOUNDARY_OUT_RE, FILE_EXTENSIONS, CI_SHARD_DIR = "apps/cli/tests/ci-shards", CI_SHARD_PROBE;
3198
+ function rootFilesPinnedIn(boundary) {
3199
+ const start = boundary.search(/\bPinned files\s*:/i);
3200
+ if (start === -1)
3201
+ return [];
3202
+ const clause = boundary.slice(start);
3203
+ const out = BOUNDARY_OUT_RE.exec(clause);
3204
+ const pinned = out ? clause.slice(0, out.index) : clause;
3205
+ return [...pinned.matchAll(ROOT_FILE_RE_GLOBAL)].map((m) => m[1]);
3206
+ }
3207
+ var RATIONALE_FIELDS, DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale", SINGLE_FIX_OPTIONAL_FIELDS, OBJECTIVES_SINCE_ISSUE = 404, PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3, ISSUE_PART_LINE_RE, ISSUE_LIVE_LINE_RE, TYPE_LABEL_IDS, PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" }), MESSAGE_VALUE_COUNT_MAX = 5, MESSAGE_VALUE_MAX = 64, DOC_PATH_RE, DOC_PATH_RE_GLOBAL, RATIONALE_PATH_RE_GLOBAL, DEFAULT_COLLISION_THRESHOLD = 3, BOUNDARY_OUT_RE, FILE_EXTENSIONS, ROOT_FILE_RE_GLOBAL, CI_SHARD_DIR = "apps/cli/tests/ci-shards", CI_SHARD_PROBE;
3133
3208
  var init_issue_validation = __esm(() => {
3134
3209
  init_parse_rationale_deps();
3135
3210
  init_labels();
@@ -3143,11 +3218,13 @@ var init_issue_validation = __esm(() => {
3143
3218
  init_derive_section7();
3144
3219
  init_doctrine_map();
3145
3220
  init_objectives();
3221
+ init_waiver_label();
3146
3222
  init_issue_documentation();
3147
3223
  init_touched_path();
3148
3224
  init_protected_paths();
3149
3225
  init_quoted_command();
3150
3226
  init_test_plan_section();
3227
+ init_test_plan_proof();
3151
3228
  RATIONALE_FIELDS = [
3152
3229
  { name: "Boundary", pattern: "Boundary" },
3153
3230
  { name: "Sizing", pattern: "Sizing" },
@@ -3191,6 +3268,7 @@ var init_issue_validation = __esm(() => {
3191
3268
  "html",
3192
3269
  "css"
3193
3270
  ]);
3271
+ ROOT_FILE_RE_GLOBAL = /`([\w.@-]+\.(?:md|mdx|txt|json|jsonc|ts|tsx|js|jsx|mjs|cjs|mts|cts|yml|yaml|toml|lock|html|css|scss|sh|py|rb|go|rs|xml|ini|cfg|conf))`/g;
3194
3272
  CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
3195
3273
  });
3196
3274
 
@@ -3202,59 +3280,22 @@ function emitCheckError(error) {
3202
3280
  var CHECK_SCHEMA_VERSION = 1;
3203
3281
 
3204
3282
  // ../../harness/kernel/log/custom.ts
3205
- import { z } from "zod";
3206
- var CUSTOM_EVENT_NAME_PATTERN, CUSTOM_EVENT_NAME_MAX_LENGTH = 64, CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya", CUSTOM_EVENT_MAX_FIELDS = 20, CUSTOM_FIELD_NAME_PATTERN, CUSTOM_FIELD_NAME_MAX_LENGTH = 64, CUSTOM_TEXT_MAX_LENGTH = 500, CUSTOM_WORD_PATTERN, CUSTOM_WORD_MAX_LENGTH = 64, CUSTOM_FIELD_MAX_WORDS = 50, CustomFieldTypeSchema, CustomEventDeclarationsSchema;
3207
- var init_custom = __esm(() => {
3208
- CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
3209
- CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
3210
- CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
3211
- CustomFieldTypeSchema = z.union([z.enum(["text", "number", "boolean"]), z.array(z.string())]);
3212
- CustomEventDeclarationsSchema = z.record(z.string(), z.object({
3213
- fields: z.record(z.string(), CustomFieldTypeSchema)
3214
- }).strict()).superRefine((events, ctx) => {
3215
- for (const [name, declaration] of Object.entries(events)) {
3216
- const refuse = (message, path = []) => {
3217
- ctx.addIssue({
3218
- code: z.ZodIssueCode.custom,
3219
- path: [name, ...path],
3220
- message: `logs.events "${name}": ${message}`
3221
- });
3222
- };
3223
- if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
3224
- refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
3225
- }
3226
- if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
3227
- refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
3228
- } else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
3229
- refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
3230
- }
3231
- const fieldEntries = Object.entries(declaration.fields);
3232
- if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
3233
- refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
3234
- }
3235
- for (const [field, type] of fieldEntries) {
3236
- if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
3237
- refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
3238
- }
3239
- if (typeof type === "string")
3240
- continue;
3241
- if (type.length === 0) {
3242
- refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
3243
- }
3244
- if (type.length > CUSTOM_FIELD_MAX_WORDS) {
3245
- refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
3246
- }
3247
- const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
3248
- if (bad.length > 0) {
3249
- refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
3250
- }
3251
- if (new Set(type).size !== type.length) {
3252
- refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
3253
- }
3254
- }
3255
- }
3256
- });
3257
- });
3283
+ import {
3284
+ CUSTOM_EVENT_MAX_FIELDS,
3285
+ CUSTOM_EVENT_NAME_MAX_LENGTH,
3286
+ CUSTOM_EVENT_NAME_PATTERN,
3287
+ CUSTOM_EVENT_RESERVED_NAMESPACE,
3288
+ CUSTOM_FIELD_MAX_WORDS,
3289
+ CUSTOM_FIELD_NAME_MAX_LENGTH,
3290
+ CUSTOM_FIELD_NAME_PATTERN,
3291
+ CUSTOM_TEXT_MAX_LENGTH,
3292
+ CUSTOM_WORD_MAX_LENGTH,
3293
+ CUSTOM_WORD_PATTERN,
3294
+ CustomEventDeclarationsSchema,
3295
+ checkCustomEvent,
3296
+ UNRECORDABLE_FIELD_NAME
3297
+ } from "@attalabs/vinaya-log-sdk";
3298
+ var init_custom = () => {};
3258
3299
 
3259
3300
  // ../../harness/kernel/adapters/agents/agent-vendors.ts
3260
3301
  var AGENT_VENDORS;
@@ -3594,14 +3635,15 @@ ${detail}`;
3594
3635
  return null;
3595
3636
  }
3596
3637
  }
3597
- function loadTrustAnchorConfig(fetcher = fetchTrustAnchorConfig) {
3638
+ function loadTrustAnchorConfig(fetcher = fetchTrustAnchorConfig, loadOptions = {}) {
3639
+ const warn = loadOptions.quiet ? () => {} : warnTrustAnchorFallback;
3598
3640
  let base64;
3599
3641
  try {
3600
3642
  base64 = fetcher();
3601
3643
  } catch (err) {
3602
- return trustAnchorFetchFailed(err);
3644
+ return trustAnchorFetchFailed(err, warn);
3603
3645
  }
3604
- return parseTrustAnchorContent(base64);
3646
+ return parseTrustAnchorContent(base64, warn);
3605
3647
  }
3606
3648
  function loadTrustAnchorConfigOrThrow(fetcher = fetchTrustAnchorConfig) {
3607
3649
  let base64;
@@ -3660,9 +3702,9 @@ var installed = null, NO_CONFIG_PROVIDER_MESSAGE = "no configuration provider is
3660
3702
 
3661
3703
  // ../../harness/kernel/config/schema/config-schema.ts
3662
3704
  import { isAbsolute } from "node:path";
3663
- import { z as z2 } from "zod";
3705
+ import { z } from "zod";
3664
3706
  function checkEntrySchema(fields) {
3665
- return z2.object(fields).superRefine((entry, ctx) => {
3707
+ return z.object(fields).superRefine((entry, ctx) => {
3666
3708
  const env = entry.env;
3667
3709
  if (!env)
3668
3710
  return;
@@ -3672,14 +3714,14 @@ function checkEntrySchema(fields) {
3672
3714
  const members = value.anyOf;
3673
3715
  if (new Set(members).size !== members.length) {
3674
3716
  ctx.addIssue({
3675
- code: z2.ZodIssueCode.custom,
3717
+ code: z.ZodIssueCode.custom,
3676
3718
  message: `env.${key}.anyOf has duplicate members`,
3677
3719
  path: ["env", key, "anyOf"]
3678
3720
  });
3679
3721
  }
3680
3722
  if (!members.includes(key)) {
3681
3723
  ctx.addIssue({
3682
- code: z2.ZodIssueCode.custom,
3724
+ code: z.ZodIssueCode.custom,
3683
3725
  message: `env.${key}.anyOf must include "${key}" itself as a member`,
3684
3726
  path: ["env", key, "anyOf"]
3685
3727
  });
@@ -3702,26 +3744,31 @@ function hookBlockPathRule(prefixes) {
3702
3744
  return { isCanonical, schema };
3703
3745
  }
3704
3746
  function managedManifestSchemas(agentVendors, hookBlockPrefixes) {
3705
- const block = z2.object({
3747
+ const block = z.object({
3706
3748
  path: hookBlockPathRule(hookBlockPrefixes).schema,
3707
- marker: z2.string(),
3708
- comment: z2.enum(["hash", "html"])
3749
+ marker: z.string(),
3750
+ comment: z.enum(["hash", "html"])
3709
3751
  });
3710
- const manifest = z2.object({
3711
- version: z2.number().int().positive(),
3712
- files: z2.array(SafeRepoRelPath),
3713
- blocks: z2.array(block),
3714
- labels: z2.array(z2.string()),
3715
- agents: z2.array(z2.enum(agentVendors)).optional()
3752
+ const manifest = z.object({
3753
+ version: z.number().int().positive(),
3754
+ files: z.array(SafeRepoRelPath),
3755
+ blocks: z.array(block),
3756
+ labels: z.array(z.string()),
3757
+ agents: z.array(z.enum(agentVendors)).optional()
3716
3758
  });
3717
3759
  return { block, manifest };
3718
3760
  }
3719
3761
  function logsSchema(events) {
3720
- return z2.object({
3721
- folder: z2.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
3722
- url: z2.string().url().optional(),
3723
- headers: z2.record(z2.string()).optional(),
3724
- readHeaders: z2.record(z2.string()).optional(),
3762
+ return z.object({
3763
+ folder: z.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
3764
+ url: z.string().url().optional(),
3765
+ otlp: z.object({
3766
+ url: z.string().url().regex(/^https?:\/\//i),
3767
+ headers: z.record(z.string()).optional()
3768
+ }).strict().optional(),
3769
+ headers: z.record(z.string()).optional(),
3770
+ readHeaders: z.record(z.string()).optional(),
3771
+ keepDays: z.number({ invalid_type_error: "must be a whole number of days" }).int({ message: "must be a whole number of days" }).min(1, { message: "must be at least 1" }).optional(),
3725
3772
  events: events.optional()
3726
3773
  }).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
3727
3774
  message: "logs: set at most one of folder/url"
@@ -3729,22 +3776,22 @@ function logsSchema(events) {
3729
3776
  message: "logs: headers requires url"
3730
3777
  }).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
3731
3778
  message: "logs: readHeaders requires url"
3732
- }).or(z2.literal(false)).optional();
3779
+ }).or(z.literal(false)).optional();
3733
3780
  }
3734
3781
  function kernelConfigFragment(leaves) {
3735
3782
  return {
3736
- rings: z2.object({
3737
- ring1_forgeWriteInterception: z2.boolean(),
3738
- ring2_asyncAudits: z2.boolean()
3783
+ rings: z.object({
3784
+ ring1_forgeWriteInterception: z.boolean(),
3785
+ ring2_asyncAudits: z.boolean()
3739
3786
  }).optional(),
3740
- checks: z2.record(z2.string(), checkEntrySchema(leaves.checkEntryFields)).optional(),
3787
+ checks: z.record(z.string(), checkEntrySchema(leaves.checkEntryFields)).optional(),
3741
3788
  managed: managedManifestSchemas(leaves.agentVendors, leaves.hookBlockPrefixes).manifest.optional(),
3742
- ci: z2.object({ setup: z2.string().min(1) }).optional(),
3743
- logPublish: z2.unknown().refine((v) => v === undefined, {
3789
+ ci: z.object({ setup: z.string().min(1) }).optional(),
3790
+ logPublish: z.unknown().refine((v) => v === undefined, {
3744
3791
  message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
3745
3792
  }),
3746
- runtimeDir: z2.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
3747
- runner: z2.enum(["standalone", "atta-engine"]).optional(),
3793
+ runtimeDir: z.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
3794
+ runner: z.enum(["standalone", "atta-engine"]).optional(),
3748
3795
  logs: logsSchema(leaves.logEvents)
3749
3796
  };
3750
3797
  }
@@ -3784,25 +3831,25 @@ function resolveLogsHeaderValues(headers, env) {
3784
3831
  }
3785
3832
  var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath, KERNEL_CONFIG_REFINEMENTS;
3786
3833
  var init_config_schema = __esm(() => {
3787
- EnvEntrySchema = z2.union([
3788
- z2.literal(true),
3789
- z2.object({ optional: z2.literal(true) }),
3790
- z2.object({ anyOf: z2.array(z2.string()).min(2) }),
3791
- z2.string()
3834
+ EnvEntrySchema = z.union([
3835
+ z.literal(true),
3836
+ z.object({ optional: z.literal(true) }),
3837
+ z.object({ anyOf: z.array(z.string()).min(2) }),
3838
+ z.string()
3792
3839
  ]);
3793
3840
  KERNEL_CHECK_ENTRY_FIELDS = {
3794
- run: z2.string(),
3795
- scope: z2.enum(["diff", "full"]),
3796
- include: z2.array(z2.string()).optional(),
3797
- args: z2.array(z2.string()).optional(),
3798
- timeoutMs: z2.number().optional(),
3799
- env: z2.record(z2.string(), EnvEntrySchema).optional(),
3800
- requiresOpenPr: z2.boolean().optional(),
3801
- ownWorkflow: z2.boolean().optional(),
3802
- validates: z2.enum(["body", "issue"]).optional(),
3803
- advisory: z2.literal(true).optional()
3841
+ run: z.string(),
3842
+ scope: z.enum(["diff", "full"]),
3843
+ include: z.array(z.string()).optional(),
3844
+ args: z.array(z.string()).optional(),
3845
+ timeoutMs: z.number().optional(),
3846
+ env: z.record(z.string(), EnvEntrySchema).optional(),
3847
+ requiresOpenPr: z.boolean().optional(),
3848
+ ownWorkflow: z.boolean().optional(),
3849
+ validates: z.enum(["body", "issue"]).optional(),
3850
+ advisory: z.literal(true).optional()
3804
3851
  };
3805
- SafeRepoRelPath = z2.string().refine(isSafeRepoRelPath, {
3852
+ SafeRepoRelPath = z.string().refine(isSafeRepoRelPath, {
3806
3853
  message: "must be a repo-root-relative path with no `..` segment or absolute root"
3807
3854
  });
3808
3855
  KERNEL_CONFIG_REFINEMENTS = [];
@@ -4370,7 +4417,7 @@ var init_review_gate = __esm(() => {
4370
4417
 
4371
4418
  // ../../harness/processes/vinaya-strict/tools/prose-rules-config.ts
4372
4419
  import safeRegex from "safe-regex2";
4373
- import { z as z3 } from "zod";
4420
+ import { z as z2 } from "zod";
4374
4421
  function isPlainObject3(value) {
4375
4422
  return typeof value === "object" && value !== null && !Array.isArray(value);
4376
4423
  }
@@ -4640,18 +4687,18 @@ var init_prose_rules_config = __esm(() => {
4640
4687
  FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
4641
4688
  CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
4642
4689
  DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
4643
- RepoRelativePathSchema = z3.string().min(1).superRefine((entry, ctx) => {
4690
+ RepoRelativePathSchema = z2.string().min(1).superRefine((entry, ctx) => {
4644
4691
  const reason = outsideRepositoryReason(entry);
4645
4692
  if (reason)
4646
- ctx.addIssue({ code: z3.ZodIssueCode.custom, message: reason });
4693
+ ctx.addIssue({ code: z2.ZodIssueCode.custom, message: reason });
4647
4694
  });
4648
- ProseRulesSchema = z3.unknown().superRefine((value, ctx) => {
4695
+ ProseRulesSchema = z2.unknown().superRefine((value, ctx) => {
4649
4696
  for (const issue of proseRulesIssues(value)) {
4650
- ctx.addIssue({ code: z3.ZodIssueCode.custom, path: issue.path, message: issue.message });
4697
+ ctx.addIssue({ code: z2.ZodIssueCode.custom, path: issue.path, message: issue.message });
4651
4698
  }
4652
4699
  }).transform((value) => value);
4653
- PublishedProseSchema = z3.object({
4654
- allow: z3.array(z3.string().min(1)).optional()
4700
+ PublishedProseSchema = z2.object({
4701
+ allow: z2.array(z2.string().min(1)).optional()
4655
4702
  }).strict();
4656
4703
  });
4657
4704
 
@@ -4666,10 +4713,13 @@ var exports_vinaya_config_section = {};
4666
4713
  __export(exports_vinaya_config_section, {
4667
4714
  BRIEF_BUILTINS: () => BRIEF_BUILTINS,
4668
4715
  CANONICAL_HOOK_BLOCK_PREFIXES: () => CANONICAL_HOOK_BLOCK_PREFIXES,
4716
+ DEFAULT_REVIEW_AGENT: () => DEFAULT_REVIEW_AGENT,
4717
+ DEFAULT_REVIEW_ROUND_LIMIT: () => DEFAULT_REVIEW_ROUND_LIMIT,
4669
4718
  LOCAL_OVERRIDABLE_KEYS: () => LOCAL_OVERRIDABLE_KEYS,
4670
4719
  LOCAL_OVERRIDE_FILENAME: () => LOCAL_OVERRIDE_FILENAME,
4671
4720
  PRINCIPALS_FIX: () => PRINCIPALS_FIX,
4672
4721
  PrincipalsUnresolvedError: () => PrincipalsUnresolvedError,
4722
+ REVIEW_AGENT_SETTINGS: () => REVIEW_AGENT_SETTINGS,
4673
4723
  VINAYA_CHECK_ENTRY_FIELDS: () => VINAYA_CHECK_ENTRY_FIELDS,
4674
4724
  VINAYA_CONFIG_FILENAME: () => VINAYA_CONFIG_FILENAME,
4675
4725
  VINAYA_CONFIG_FRAGMENT: () => VINAYA_CONFIG_FRAGMENT,
@@ -4691,7 +4741,9 @@ __export(exports_vinaya_config_section, {
4691
4741
  resolveGateCutovers: () => resolveGateCutovers,
4692
4742
  resolveLocalPacingOverride: () => resolveLocalPacingOverride,
4693
4743
  resolveReleaseActor: () => resolveReleaseActor,
4744
+ resolveReviewAgent: () => resolveReviewAgent,
4694
4745
  resolveReviewPolicy: () => resolveReviewPolicy,
4746
+ resolveReviewRoundLimit: () => resolveReviewRoundLimit,
4695
4747
  resolveSecurityScanCommand: () => resolveSecurityScanCommand,
4696
4748
  tokensCollectTrustKey: () => tokensCollectTrustKey,
4697
4749
  trustAnchorFallbackWarning: () => trustAnchorFallbackWarning,
@@ -4702,7 +4754,7 @@ import { execFileSync as execFileSync4 } from "node:child_process";
4702
4754
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
4703
4755
  import { homedir } from "node:os";
4704
4756
  import { dirname as dirname2, join as join2 } from "node:path";
4705
- import { z as z4 } from "zod";
4757
+ import { z as z3 } from "zod";
4706
4758
  function isDefaultedAgentVendorPath(path, manifest) {
4707
4759
  if (manifest.agents !== undefined)
4708
4760
  return false;
@@ -4736,7 +4788,7 @@ function decisionRecordsOutsideDoctrine(config, ctx) {
4736
4788
  return;
4737
4789
  const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
4738
4790
  if (issue)
4739
- ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
4791
+ ctx.addIssue({ code: z3.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
4740
4792
  }
4741
4793
  function globalPrincipalsIgnoredWarning(path) {
4742
4794
  return `${path}: "principals" in the global config is ignored — principals may only be declared from a repo-local vinaya.config.json.`;
@@ -4840,6 +4892,12 @@ function resolveGateCutovers(config) {
4840
4892
  function resolveCollisionThreshold(config) {
4841
4893
  return config?.planning?.collisionThreshold ?? DEFAULT_COLLISION_THRESHOLD;
4842
4894
  }
4895
+ function resolveReviewRoundLimit(config) {
4896
+ return config?.planning?.reviewRoundLimit ?? DEFAULT_REVIEW_ROUND_LIMIT;
4897
+ }
4898
+ function resolveReviewAgent(config) {
4899
+ return config?.planning?.reviewAgent ?? DEFAULT_REVIEW_AGENT;
4900
+ }
4843
4901
  function principalsNotConfigured(why) {
4844
4902
  return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
4845
4903
  }
@@ -4854,7 +4912,7 @@ function createTrustedPrincipalsResolver(reads) {
4854
4912
  }
4855
4913
  if (isMissingFileError(err))
4856
4914
  throw principalsNotConfigured("the default branch has no vinaya.config.json");
4857
- throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`);
4915
+ throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`, { cause: err });
4858
4916
  }
4859
4917
  const unusable = { why: "" };
4860
4918
  const config = reads.parse(content, (why) => {
@@ -4914,7 +4972,7 @@ function trustTokensCollectCommand(repoGitCommonDir, interpreter, script, script
4914
4972
  store[key] = { interpreter, script, scriptBlobHash, trustedAt: new Date().toISOString() };
4915
4973
  writeTokensCollectTrustStore(storePath, store);
4916
4974
  }
4917
- var VINAYA_HOME, VINAYA_GLOBAL_CONFIG_FILENAME = "config.json", VINAYA_CONFIG_FILENAME = "vinaya.config.json", CANONICAL_HOOK_BLOCK_PREFIXES, VINAYA_CHECK_ENTRY_FIELDS, AGENTS_SKILLS_PREFIX = ".agents/skills/", CLAUDE_SKILLS_PREFIX = ".claude/skills/vinaya-", RoleEntrySchema, MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000, BRIEF_BUILTINS, BriefSectionSchema, BriefSchemaSchema, ProjectEntrySchema, VINAYA_CONFIG_FRAGMENT, LOCAL_OVERRIDE_FILENAME = "vinaya.config.local.json", LOCAL_OVERRIDABLE_KEYS, PrincipalsUnresolvedError, PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch', TOKENS_COLLECT_TRUST_PATH, VINAYA_GLOBAL_ONLY_KEYS, VINAYA_CONFIG_SECTION;
4975
+ var VINAYA_HOME, VINAYA_GLOBAL_CONFIG_FILENAME = "config.json", VINAYA_CONFIG_FILENAME = "vinaya.config.json", CANONICAL_HOOK_BLOCK_PREFIXES, VINAYA_CHECK_ENTRY_FIELDS, AGENTS_SKILLS_PREFIX = ".agents/skills/", CLAUDE_SKILLS_PREFIX = ".claude/skills/vinaya-", RoleEntrySchema, MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000, BRIEF_BUILTINS, BriefSectionSchema, BriefSchemaSchema, ProjectEntrySchema, VINAYA_CONFIG_FRAGMENT, LOCAL_OVERRIDE_FILENAME = "vinaya.config.local.json", LOCAL_OVERRIDABLE_KEYS, DEFAULT_REVIEW_ROUND_LIMIT = 2, REVIEW_AGENT_SETTINGS, DEFAULT_REVIEW_AGENT = "same", PrincipalsUnresolvedError, PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch', TOKENS_COLLECT_TRUST_PATH, VINAYA_GLOBAL_ONLY_KEYS, VINAYA_CONFIG_SECTION;
4918
4976
  var init_vinaya_config_section = __esm(() => {
4919
4977
  init_review_policy();
4920
4978
  init_issue_validation();
@@ -4928,10 +4986,10 @@ var init_vinaya_config_section = __esm(() => {
4928
4986
  VINAYA_HOME = join2(homedir(), ".vinaya");
4929
4987
  CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
4930
4988
  VINAYA_CHECK_ENTRY_FIELDS = {
4931
- principalOwed: z4.literal(true).optional()
4989
+ principalOwed: z3.literal(true).optional()
4932
4990
  };
4933
- RoleEntrySchema = z4.object({
4934
- contract: z4.string().refine((p) => p.includes("/"), {
4991
+ RoleEntrySchema = z3.object({
4992
+ contract: z3.string().refine((p) => p.includes("/"), {
4935
4993
  message: 'must be a path (contain at least one "/"), not a bare filename'
4936
4994
  })
4937
4995
  });
@@ -4954,102 +5012,104 @@ var init_vinaya_config_section = __esm(() => {
4954
5012
  "briefSections",
4955
5013
  "milestoneShape"
4956
5014
  ];
4957
- BriefSectionSchema = z4.union([
4958
- z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
4959
- z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
4960
- z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
4961
- z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
5015
+ BriefSectionSchema = z3.union([
5016
+ z3.object({ builtin: z3.enum(BRIEF_BUILTINS) }),
5017
+ z3.object({ heading: z3.string().min(1), name: z3.string().optional() }),
5018
+ z3.object({ field: z3.string().min(1), name: z3.string().optional() }),
5019
+ z3.object({ phrase: z3.string().min(1), name: z3.string().optional() })
4962
5020
  ]);
4963
- BriefSchemaSchema = z4.object({
4964
- pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
4965
- issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
4966
- milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
4967
- ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
5021
+ BriefSchemaSchema = z3.object({
5022
+ pr: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
5023
+ issue: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
5024
+ milestone: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
5025
+ ack: z3.array(z3.enum(BRIEF_BUILTINS)).optional()
4968
5026
  });
4969
- ProjectEntrySchema = z4.object({
4970
- name: z4.string().min(1),
4971
- description: z4.string().min(1).optional(),
4972
- path: z4.string().min(1).optional()
5027
+ ProjectEntrySchema = z3.object({
5028
+ name: z3.string().min(1),
5029
+ description: z3.string().min(1).optional(),
5030
+ path: z3.string().min(1).optional()
4973
5031
  });
4974
5032
  VINAYA_CONFIG_FRAGMENT = {
4975
- roles: z4.record(z4.string(), RoleEntrySchema).optional(),
5033
+ roles: z3.record(z3.string(), RoleEntrySchema).optional(),
4976
5034
  briefSchema: BriefSchemaSchema.optional(),
4977
- principals: z4.array(z4.string()).min(1).optional(),
4978
- releaseActor: z4.string().min(1).optional(),
4979
- tokens: z4.object({
4980
- collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
5035
+ principals: z3.array(z3.string()).min(1).optional(),
5036
+ releaseActor: z3.string().min(1).optional(),
5037
+ tokens: z3.object({
5038
+ collect: z3.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
4981
5039
  message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
4982
5040
  })
4983
5041
  }).optional(),
4984
- blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
4985
- proseGates: z4.object({
4986
- doctrineRoot: z4.string().min(1).optional(),
4987
- readerFacingPrefix: z4.string().min(1).optional(),
4988
- readerFacingSuffix: z4.string().min(1).optional(),
4989
- legacySlugDir: z4.string().min(1).optional(),
4990
- sourceComments: z4.object({
4991
- globs: z4.array(z4.string().min(1)).optional(),
4992
- allowlist: z4.array(z4.string().min(1)).optional(),
4993
- severity: z4.enum(["warning", "error"]).optional()
5042
+ blastRadius: z3.object({ extraDomains: z3.array(z3.string()).optional() }).optional(),
5043
+ proseGates: z3.object({
5044
+ doctrineRoot: z3.string().min(1).optional(),
5045
+ readerFacingPrefix: z3.string().min(1).optional(),
5046
+ readerFacingSuffix: z3.string().min(1).optional(),
5047
+ legacySlugDir: z3.string().min(1).optional(),
5048
+ sourceComments: z3.object({
5049
+ globs: z3.array(z3.string().min(1)).optional(),
5050
+ allowlist: z3.array(z3.string().min(1)).optional(),
5051
+ severity: z3.enum(["warning", "error"]).optional()
4994
5052
  }).optional(),
4995
- specGrandfather: z4.union([z4.array(z4.string().min(1)), z4.record(z4.string().min(1), z4.number().int().min(0))]).optional(),
4996
- specPaths: z4.array(RepoRelativePathSchema).optional(),
4997
- productPaths: z4.array(RepoRelativePathSchema).optional(),
5053
+ specGrandfather: z3.union([z3.array(z3.string().min(1)), z3.record(z3.string().min(1), z3.number().int().min(0))]).optional(),
5054
+ specPaths: z3.array(RepoRelativePathSchema).optional(),
5055
+ productPaths: z3.array(RepoRelativePathSchema).optional(),
4998
5056
  published: PublishedProseSchema.optional(),
4999
5057
  rules: ProseRulesSchema.optional()
5000
5058
  }).optional(),
5001
- projects: z4.array(ProjectEntrySchema).optional(),
5002
- dispatch: z4.object({
5003
- timeoutMs: z4.number().int().positive().optional(),
5004
- reviewerTimeoutMs: z4.number().int().positive().optional(),
5005
- killGraceMs: z4.number().int().positive().optional(),
5006
- agent: z4.enum(["claude", "codex"]).optional()
5059
+ projects: z3.array(ProjectEntrySchema).optional(),
5060
+ dispatch: z3.object({
5061
+ timeoutMs: z3.number().int().positive().optional(),
5062
+ reviewerTimeoutMs: z3.number().int().positive().optional(),
5063
+ killGraceMs: z3.number().int().positive().optional(),
5064
+ agent: z3.enum(["claude", "codex"]).optional()
5007
5065
  }).optional(),
5008
- reviewPolicy: z4.object({
5009
- codeReviewThreshold: z4.string().min(1).optional(),
5010
- securityThreshold: z4.string().min(1).optional(),
5011
- maxRounds: z4.number().optional(),
5012
- maxTaskMinutes: z4.number().optional(),
5013
- readyPushTimeoutMinutes: z4.number().optional()
5066
+ reviewPolicy: z3.object({
5067
+ codeReviewThreshold: z3.string().min(1).optional(),
5068
+ securityThreshold: z3.string().min(1).optional(),
5069
+ maxRounds: z3.number().optional(),
5070
+ maxTaskMinutes: z3.number().optional(),
5071
+ readyPushTimeoutMinutes: z3.number().optional()
5014
5072
  }).optional(),
5015
- securityScan: z4.object({
5016
- command: z4.array(z4.string().min(1)).min(1)
5073
+ securityScan: z3.object({
5074
+ command: z3.array(z3.string().min(1)).min(1)
5017
5075
  }).optional(),
5018
- gateCutovers: z4.object({
5019
- objectivesSinceIssue: z4.number().int().nonnegative().optional(),
5020
- briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
5021
- documentationSinceIssue: z4.number().int().nonnegative().optional(),
5022
- briefRulesSincePr: z4.number().int().nonnegative().optional(),
5023
- agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
5076
+ gateCutovers: z3.object({
5077
+ objectivesSinceIssue: z3.number().int().nonnegative().optional(),
5078
+ briefSectionsSinceIssue: z3.number().int().nonnegative().optional(),
5079
+ documentationSinceIssue: z3.number().int().nonnegative().optional(),
5080
+ briefRulesSincePr: z3.number().int().nonnegative().optional(),
5081
+ agentBoxesRefusedSincePr: z3.number().int().nonnegative().optional()
5024
5082
  }).optional(),
5025
- planning: z4.object({
5026
- collisionThreshold: z4.number().int().nonnegative().optional()
5083
+ planning: z3.object({
5084
+ collisionThreshold: z3.number().int().nonnegative().optional(),
5085
+ reviewRoundLimit: z3.number().int().positive().optional(),
5086
+ reviewAgent: z3.enum(["same", "different"]).optional()
5027
5087
  }).optional(),
5028
- prePush: z4.object({
5029
- alwaysRun: z4.array(z4.string()).optional(),
5030
- readyTests: z4.object({
5031
- mode: z4.literal("ci"),
5032
- workflow: z4.literal(".github/workflows/ci.yml"),
5033
- check: z4.literal("Vinaya CI")
5088
+ prePush: z3.object({
5089
+ alwaysRun: z3.array(z3.string()).optional(),
5090
+ readyTests: z3.object({
5091
+ mode: z3.literal("ci"),
5092
+ workflow: z3.literal(".github/workflows/ci.yml"),
5093
+ check: z3.literal("Vinaya CI")
5034
5094
  }).strict().optional(),
5035
- requiredCi: z4.object({
5036
- workflow: z4.literal(".github/workflows/ci.yml"),
5037
- check: z4.literal("Vinaya CI")
5095
+ requiredCi: z3.object({
5096
+ workflow: z3.literal(".github/workflows/ci.yml"),
5097
+ check: z3.literal("Vinaya CI")
5038
5098
  }).strict().optional()
5039
5099
  }).optional(),
5040
- report: z4.object({
5041
- commandTimeoutMs: z4.number().int().positive().optional()
5100
+ report: z3.object({
5101
+ commandTimeoutMs: z3.number().int().positive().optional()
5042
5102
  }).superRefine((report, ctx) => {
5043
5103
  const commandTimeoutMs = report.commandTimeoutMs;
5044
5104
  if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
5045
5105
  ctx.addIssue({
5046
- code: z4.ZodIssueCode.custom,
5106
+ code: z3.ZodIssueCode.custom,
5047
5107
  path: ["commandTimeoutMs"],
5048
5108
  message: "must be at most 3600000 (1 hour)"
5049
5109
  });
5050
5110
  }
5051
5111
  }).optional(),
5052
- decisionRecords: z4.object({
5112
+ decisionRecords: z3.object({
5053
5113
  path: RepoRelativePathSchema
5054
5114
  }).strict().optional()
5055
5115
  };
@@ -5058,10 +5118,11 @@ var init_vinaya_config_section = __esm(() => {
5058
5118
  "reviewPolicy.maxTaskMinutes",
5059
5119
  "reviewPolicy.readyPushTimeoutMinutes"
5060
5120
  ];
5121
+ REVIEW_AGENT_SETTINGS = ["same", "different"];
5061
5122
  PrincipalsUnresolvedError = class PrincipalsUnresolvedError extends Error {
5062
5123
  kind;
5063
- constructor(kind, message) {
5064
- super(message);
5124
+ constructor(kind, message, options) {
5125
+ super(message, options);
5065
5126
  this.name = "PrincipalsUnresolvedError";
5066
5127
  this.kind = kind;
5067
5128
  }
@@ -5105,7 +5166,7 @@ var init_vinaya_config_section = __esm(() => {
5105
5166
  });
5106
5167
 
5107
5168
  // ../../harness/processes/vinaya-strict/integration/config/compose.ts
5108
- import { z as z5 } from "zod";
5169
+ import { z as z4 } from "zod";
5109
5170
  function globalChecksIgnoredWarning(path) {
5110
5171
  return `${path}: "checks" registration in the global config is ignored — checks may only be registered from a repo-local vinaya.config.json.`;
5111
5172
  }
@@ -5177,7 +5238,7 @@ var init_compose = __esm(() => {
5177
5238
  "logs",
5178
5239
  "decisionRecords"
5179
5240
  ];
5180
- VinayaConfigObjectSchema = z5.object(orderedShape(CONFIG_KEY_ORDER, KERNEL_FRAGMENT, VINAYA_CONFIG_SECTION.fragment));
5241
+ VinayaConfigObjectSchema = z4.object(orderedShape(CONFIG_KEY_ORDER, KERNEL_FRAGMENT, VINAYA_CONFIG_SECTION.fragment));
5181
5242
  VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
5182
5243
  for (const refine of KERNEL_CONFIG_REFINEMENTS)
5183
5244
  refine(config, ctx);
@@ -5228,12 +5289,18 @@ var init_compose = __esm(() => {
5228
5289
  vinayaConfigProvider = {
5229
5290
  homeDir: VINAYA_HOME,
5230
5291
  loadConfig: () => loadConfig(),
5231
- loadTrustAnchorConfig: () => loadTrustAnchorConfig(),
5292
+ loadTrustAnchorConfig: (options) => loadTrustAnchorConfig(undefined, options),
5232
5293
  loadTrustAnchorConfigAsync: (fetcher, options) => loadTrustAnchorConfigAsync(fetcher, options)
5233
5294
  };
5234
5295
  installVinayaConfigProvider();
5235
5296
  });
5236
5297
 
5298
+ // ../../harness/kernel/gates/checks/registry.ts
5299
+ function installCheckRegistry(checks) {
5300
+ registry = checks;
5301
+ }
5302
+ var registry;
5303
+
5237
5304
  // src/lib/package-root.ts
5238
5305
  import { existsSync as existsSync3 } from "node:fs";
5239
5306
  import { dirname as dirname3, join as join3 } from "node:path";
@@ -5255,10 +5322,614 @@ function cliPackageRoot() {
5255
5322
  }
5256
5323
  var init_package_root = () => {};
5257
5324
 
5325
+ // ../../harness/processes/vinaya-strict/checks/registry.ts
5326
+ import { join as join4, relative, sep } from "node:path";
5327
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
5328
+ function resolveCheckBin(packageDir, moduleUrl) {
5329
+ const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
5330
+ const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep}`);
5331
+ return bundled ? { dir: join4(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join4(packageDir, "..", "..", "harness/processes/vinaya-strict/checks/bin"), ext: ".ts" };
5332
+ }
5333
+ function bin(name) {
5334
+ return join4(BIN_DIR, `${name}${BIN_EXT}`);
5335
+ }
5336
+ function coreCheckRegistry() {
5337
+ return REGISTRY.map(([spec]) => spec);
5338
+ }
5339
+ var CHECK_BIN, BIN_DIR, BIN_EXT, REGISTRY, CORE_CHECK_RING;
5340
+ var init_registry = __esm(() => {
5341
+ init_package_root();
5342
+ init_doctrine_map();
5343
+ CHECK_BIN = resolveCheckBin(cliPackageRoot(), import.meta.url);
5344
+ BIN_DIR = CHECK_BIN.dir;
5345
+ BIN_EXT = CHECK_BIN.ext;
5346
+ REGISTRY = [
5347
+ [
5348
+ {
5349
+ name: "brief-shape",
5350
+ validates: "body",
5351
+ requiresOpenPr: true,
5352
+ run: bin("check-brief-shape"),
5353
+ scope: "diff",
5354
+ timeoutMs: 15000,
5355
+ env: {
5356
+ PR_BODY: { optional: true },
5357
+ BRANCH: { optional: true },
5358
+ PR_NUMBER: { optional: true },
5359
+ GITHUB_TOKEN: { optional: true },
5360
+ GH_TOKEN: { optional: true },
5361
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5362
+ GITHUB_ACTIONS: { optional: true }
5363
+ }
5364
+ },
5365
+ 0
5366
+ ],
5367
+ [
5368
+ {
5369
+ name: "pr-report-density",
5370
+ validates: "body",
5371
+ requiresOpenPr: true,
5372
+ run: bin("check-pr-report-density"),
5373
+ scope: "diff",
5374
+ timeoutMs: 15000,
5375
+ env: {
5376
+ PR_BODY: { optional: true }
5377
+ }
5378
+ },
5379
+ 0
5380
+ ],
5381
+ [
5382
+ {
5383
+ name: "doc-coverage",
5384
+ validates: "body",
5385
+ run: bin("check-doc-coverage"),
5386
+ scope: "diff",
5387
+ timeoutMs: 15000,
5388
+ env: {
5389
+ BASE_SHA: { optional: true },
5390
+ GIT_INDEX_FILE: { optional: true },
5391
+ VINAYA_COMMIT_HOOK: { optional: true },
5392
+ PR_BODY: { optional: true },
5393
+ PR_BODY_FILE: { optional: true },
5394
+ PR_NUMBER: { optional: true },
5395
+ GITHUB_REPOSITORY: { optional: true },
5396
+ GITHUB_TOKEN: { optional: true },
5397
+ GH_TOKEN: { optional: true },
5398
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5399
+ GITHUB_ACTIONS: { optional: true }
5400
+ }
5401
+ },
5402
+ 0
5403
+ ],
5404
+ [
5405
+ {
5406
+ name: "coherence",
5407
+ run: bin("check-coherence"),
5408
+ scope: "full",
5409
+ timeoutMs: 30000,
5410
+ env: {
5411
+ VINAYA_REPO: { optional: true },
5412
+ BRANCH: { optional: true },
5413
+ GITHUB_TOKEN: { optional: true },
5414
+ GH_TOKEN: { optional: true }
5415
+ }
5416
+ },
5417
+ 0
5418
+ ],
5419
+ [
5420
+ {
5421
+ name: "pr-premise-reassert",
5422
+ validates: "body",
5423
+ requiresOpenPr: true,
5424
+ run: bin("check-pr-premise-reassert"),
5425
+ scope: "diff",
5426
+ timeoutMs: 15000,
5427
+ env: {
5428
+ PR_BODY: { optional: true }
5429
+ }
5430
+ },
5431
+ 0
5432
+ ],
5433
+ [
5434
+ {
5435
+ name: "dispatch-readiness",
5436
+ run: bin("check-dispatch-readiness"),
5437
+ scope: "full",
5438
+ timeoutMs: 30000,
5439
+ env: {
5440
+ VINAYA_REPO: { optional: true },
5441
+ BRANCH: { optional: true },
5442
+ GITHUB_TOKEN: { optional: true },
5443
+ GH_TOKEN: { optional: true },
5444
+ PREMISE_FILE: { optional: true },
5445
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5446
+ GITHUB_ACTIONS: { optional: true }
5447
+ }
5448
+ },
5449
+ 0
5450
+ ],
5451
+ [
5452
+ {
5453
+ name: "closes-n",
5454
+ validates: "body",
5455
+ run: bin("check-closes-n"),
5456
+ scope: "diff",
5457
+ timeoutMs: 15000,
5458
+ requiresOpenPr: true,
5459
+ env: {
5460
+ BRANCH: { optional: true },
5461
+ PR_BODY: { optional: true },
5462
+ VINAYA_REPO: { optional: true },
5463
+ GITHUB_TOKEN: { optional: true },
5464
+ GH_TOKEN: { optional: true }
5465
+ }
5466
+ },
5467
+ 1
5468
+ ],
5469
+ [
5470
+ {
5471
+ name: "single-plan-pr",
5472
+ run: bin("check-single-plan-pr"),
5473
+ scope: "diff",
5474
+ timeoutMs: 15000,
5475
+ env: {
5476
+ BASE_SHA: { optional: true },
5477
+ PR_NUMBER: { optional: true },
5478
+ GITHUB_TOKEN: { optional: true },
5479
+ GH_TOKEN: { optional: true }
5480
+ }
5481
+ },
5482
+ 0
5483
+ ],
5484
+ [
5485
+ {
5486
+ name: "surface-scope",
5487
+ run: bin("check-surface-scope"),
5488
+ scope: "diff",
5489
+ timeoutMs: 15000,
5490
+ requiresOpenPr: true,
5491
+ env: {
5492
+ VINAYA_REPO: { optional: true },
5493
+ BASE_SHA: { optional: true },
5494
+ BRANCH: { optional: true },
5495
+ PR_BODY: { optional: true },
5496
+ PR_BODY_FILE: { optional: true },
5497
+ GITHUB_TOKEN: { optional: true },
5498
+ GH_TOKEN: { optional: true },
5499
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5500
+ GITHUB_ACTIONS: { optional: true }
5501
+ }
5502
+ },
5503
+ 1
5504
+ ],
5505
+ [
5506
+ {
5507
+ name: "test-plan",
5508
+ validates: "body",
5509
+ run: bin("check-test-plan"),
5510
+ scope: "diff",
5511
+ timeoutMs: 15000,
5512
+ requiresOpenPr: true,
5513
+ principalOwed: true,
5514
+ env: {
5515
+ PR_BODY: { optional: true },
5516
+ BRANCH: { optional: true },
5517
+ PULL_REQUEST_HEAD_SHA: { optional: true },
5518
+ GITHUB_REPOSITORY: { optional: true },
5519
+ GITHUB_TOKEN: { optional: true },
5520
+ GH_TOKEN: { optional: true },
5521
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5522
+ GITHUB_ACTIONS: { optional: true }
5523
+ }
5524
+ },
5525
+ 1
5526
+ ],
5527
+ [
5528
+ {
5529
+ name: "principal-test-plan-wait",
5530
+ validates: "body",
5531
+ run: bin("check-principal-test-plan-wait"),
5532
+ scope: "diff",
5533
+ timeoutMs: 15000,
5534
+ requiresOpenPr: true,
5535
+ ownWorkflow: true,
5536
+ env: {
5537
+ PR_BODY: { optional: true },
5538
+ BRANCH: { optional: true },
5539
+ PULL_REQUEST_HEAD_SHA: { optional: true },
5540
+ GITHUB_REPOSITORY: { optional: true },
5541
+ GITHUB_TOKEN: { optional: true },
5542
+ GH_TOKEN: { optional: true },
5543
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5544
+ GITHUB_ACTIONS: { optional: true }
5545
+ }
5546
+ },
5547
+ 1
5548
+ ],
5549
+ [
5550
+ {
5551
+ name: "body-bare-digits",
5552
+ validates: "body",
5553
+ run: bin("check-body-bare-digits"),
5554
+ scope: "diff",
5555
+ timeoutMs: 15000,
5556
+ requiresOpenPr: true,
5557
+ ownWorkflow: true,
5558
+ env: {
5559
+ PR_BODY: { optional: true },
5560
+ PR_NUMBER: { optional: true },
5561
+ GITHUB_REPOSITORY: { optional: true },
5562
+ GITHUB_TOKEN: { optional: true },
5563
+ GH_TOKEN: { optional: true },
5564
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5565
+ GITHUB_ACTIONS: { optional: true }
5566
+ }
5567
+ },
5568
+ 1
5569
+ ],
5570
+ [
5571
+ {
5572
+ name: "no-disk-state",
5573
+ run: bin("check-no-disk-state"),
5574
+ scope: "diff",
5575
+ timeoutMs: 15000,
5576
+ env: { BASE_SHA: { optional: true } }
5577
+ },
5578
+ 0
5579
+ ],
5580
+ [
5581
+ {
5582
+ name: "registry-gates",
5583
+ run: bin("check-registry-gates"),
5584
+ scope: "full",
5585
+ timeoutMs: 30000,
5586
+ env: {
5587
+ VINAYA_REPO: { optional: true },
5588
+ GITHUB_TOKEN: { optional: true },
5589
+ GH_TOKEN: { optional: true }
5590
+ }
5591
+ },
5592
+ 0
5593
+ ],
5594
+ [
5595
+ {
5596
+ name: "review-gate",
5597
+ run: bin("check-review-gate"),
5598
+ scope: "full",
5599
+ timeoutMs: 30000,
5600
+ ownWorkflow: true,
5601
+ env: {
5602
+ PR_NUMBER: { optional: true },
5603
+ GITHUB_REPOSITORY: { optional: true },
5604
+ GITHUB_TOKEN: { optional: true },
5605
+ GH_TOKEN: { optional: true },
5606
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5607
+ GITHUB_ACTIONS: { optional: true }
5608
+ }
5609
+ },
5610
+ 1
5611
+ ],
5612
+ [
5613
+ {
5614
+ name: "branch-topology",
5615
+ run: bin("check-branch-topology"),
5616
+ scope: "full",
5617
+ timeoutMs: 30000,
5618
+ env: {
5619
+ BRANCH: { optional: true },
5620
+ VINAYA_REPO: { optional: true },
5621
+ GITHUB_TOKEN: { optional: true },
5622
+ GH_TOKEN: { optional: true }
5623
+ }
5624
+ },
5625
+ 0
5626
+ ],
5627
+ [
5628
+ {
5629
+ name: "dead-branch-push",
5630
+ run: bin("check-dead-branch-push"),
5631
+ scope: "full",
5632
+ timeoutMs: 30000,
5633
+ env: {
5634
+ BRANCH: { optional: true },
5635
+ GITHUB_TOKEN: { optional: true },
5636
+ GH_TOKEN: { optional: true }
5637
+ }
5638
+ },
5639
+ 0
5640
+ ],
5641
+ [
5642
+ {
5643
+ name: "first-push-dispatch",
5644
+ run: bin("check-first-push-dispatch"),
5645
+ scope: "full",
5646
+ timeoutMs: 30000,
5647
+ env: {
5648
+ BRANCH: { optional: true },
5649
+ VINAYA_REPO: { optional: true },
5650
+ GITHUB_TOKEN: { optional: true },
5651
+ GH_TOKEN: { optional: true }
5652
+ }
5653
+ },
5654
+ 0
5655
+ ],
5656
+ [
5657
+ {
5658
+ name: "doc-coverage-push",
5659
+ validates: "body",
5660
+ advisory: true,
5661
+ run: bin("check-doc-coverage-push"),
5662
+ scope: "diff",
5663
+ timeoutMs: 15000,
5664
+ env: {
5665
+ OVERRIDE_DOCS: { optional: true },
5666
+ BASE_SHA: { optional: true },
5667
+ GIT_INDEX_FILE: { optional: true },
5668
+ VINAYA_COMMIT_HOOK: { optional: true },
5669
+ PR_BODY: { optional: true },
5670
+ PR_BODY_FILE: { optional: true },
5671
+ PR_LABELS: { optional: true },
5672
+ WAIVER_LABEL_ACTOR: { optional: true },
5673
+ GITHUB_REPOSITORY: { optional: true },
5674
+ GITHUB_TOKEN: { optional: true },
5675
+ GH_TOKEN: { optional: true }
5676
+ }
5677
+ },
5678
+ 0
5679
+ ],
5680
+ [
5681
+ {
5682
+ name: "evidence-fresh",
5683
+ validates: "body",
5684
+ run: bin("check-evidence-fresh"),
5685
+ scope: "diff",
5686
+ timeoutMs: 15000,
5687
+ requiresOpenPr: true,
5688
+ env: {
5689
+ PR_NUMBER: { optional: true },
5690
+ PR_BODY: { optional: true },
5691
+ BASE_SHA: { optional: true },
5692
+ GITHUB_TOKEN: { optional: true },
5693
+ GH_TOKEN: { optional: true },
5694
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
5695
+ GITHUB_ACTIONS: { optional: true }
5696
+ }
5697
+ },
5698
+ 1
5699
+ ],
5700
+ [
5701
+ {
5702
+ name: "reader-resolvable-prose",
5703
+ run: bin("check-reader-resolvable-prose"),
5704
+ scope: "full",
5705
+ timeoutMs: 30000,
5706
+ env: {
5707
+ BASE_SHA: { optional: true },
5708
+ GIT_INDEX_FILE: { optional: true },
5709
+ VINAYA_COMMIT_HOOK: { optional: true }
5710
+ },
5711
+ include: [...DOCTRINE_REPO_PATHS, "apps/cli/src/**", ".github/workflows/**", ".vinaya/**", "apps/cli/README.md"]
5712
+ },
5713
+ 0
5714
+ ],
5715
+ [
5716
+ {
5717
+ name: "retired-vocabulary",
5718
+ run: bin("check-retired-vocabulary"),
5719
+ scope: "full",
5720
+ timeoutMs: 30000,
5721
+ env: {
5722
+ BASE_SHA: { optional: true },
5723
+ GIT_INDEX_FILE: { optional: true },
5724
+ VINAYA_COMMIT_HOOK: { optional: true }
5725
+ },
5726
+ include: [...DOCTRINE_REPO_PATHS]
5727
+ },
5728
+ 0
5729
+ ],
5730
+ [
5731
+ {
5732
+ name: "doctrine-portability",
5733
+ advisory: true,
5734
+ run: bin("check-doctrine-portability"),
5735
+ scope: "full",
5736
+ timeoutMs: 30000,
5737
+ env: {
5738
+ BASE_SHA: { optional: true },
5739
+ GIT_INDEX_FILE: { optional: true },
5740
+ VINAYA_COMMIT_HOOK: { optional: true }
5741
+ },
5742
+ include: [...DOCTRINE_REPO_PATHS]
5743
+ },
5744
+ 0
5745
+ ],
5746
+ [
5747
+ {
5748
+ name: "doctrine-no-procedures",
5749
+ run: bin("check-doctrine-no-procedures"),
5750
+ scope: "full",
5751
+ timeoutMs: 30000,
5752
+ env: {},
5753
+ include: [...DOCTRINE_REPO_PATHS]
5754
+ },
5755
+ 0
5756
+ ],
5757
+ [
5758
+ {
5759
+ name: "doc-claims",
5760
+ run: bin("check-doc-claims"),
5761
+ scope: "full",
5762
+ timeoutMs: 30000,
5763
+ env: {},
5764
+ include: [...DOCTRINE_REPO_PATHS, "apps/**/*.ts", "apps/**/*.md", "packages/**/*.ts", "packages/**/*.md"]
5765
+ },
5766
+ 0
5767
+ ],
5768
+ [
5769
+ {
5770
+ name: "exec-bits",
5771
+ run: bin("check-exec-bits"),
5772
+ scope: "diff",
5773
+ timeoutMs: 30000,
5774
+ env: {
5775
+ BASE_SHA: { optional: true },
5776
+ GIT_INDEX_FILE: { optional: true },
5777
+ VINAYA_COMMIT_HOOK: { optional: true }
5778
+ }
5779
+ },
5780
+ 0
5781
+ ],
5782
+ [
5783
+ {
5784
+ name: "ci-shard-coverage",
5785
+ run: bin("check-ci-shard-coverage"),
5786
+ scope: "diff",
5787
+ timeoutMs: 15000,
5788
+ env: {
5789
+ BASE_SHA: { optional: true },
5790
+ GIT_INDEX_FILE: { optional: true },
5791
+ VINAYA_COMMIT_HOOK: { optional: true }
5792
+ }
5793
+ },
5794
+ 0
5795
+ ],
5796
+ [
5797
+ {
5798
+ name: "workspace-escape",
5799
+ advisory: true,
5800
+ run: bin("check-workspace-escape"),
5801
+ scope: "full",
5802
+ timeoutMs: 30000,
5803
+ env: {
5804
+ BASE_SHA: { optional: true },
5805
+ GIT_INDEX_FILE: { optional: true },
5806
+ VINAYA_COMMIT_HOOK: { optional: true }
5807
+ },
5808
+ include: [...DOCTRINE_REPO_PATHS]
5809
+ },
5810
+ 0
5811
+ ],
5812
+ [
5813
+ {
5814
+ name: "changeset-coverage",
5815
+ run: bin("check-changeset-coverage"),
5816
+ scope: "diff",
5817
+ timeoutMs: 15000,
5818
+ env: {
5819
+ BASE_SHA: { optional: true },
5820
+ GIT_INDEX_FILE: { optional: true },
5821
+ VINAYA_COMMIT_HOOK: { optional: true }
5822
+ }
5823
+ },
5824
+ 0
5825
+ ],
5826
+ [
5827
+ {
5828
+ name: "quoted-command",
5829
+ advisory: true,
5830
+ run: bin("check-quoted-command"),
5831
+ scope: "full",
5832
+ timeoutMs: 15000,
5833
+ env: {},
5834
+ include: [...DOCTRINE_REPO_PATHS]
5835
+ },
5836
+ 0
5837
+ ],
5838
+ [
5839
+ {
5840
+ name: "main-branch-refusal",
5841
+ run: bin("check-main-branch-refusal"),
5842
+ scope: "diff",
5843
+ timeoutMs: 15000,
5844
+ env: { VINAYA_PUSH_REFS: { optional: true } }
5845
+ },
5846
+ 0
5847
+ ],
5848
+ [
5849
+ {
5850
+ name: "token-collection-wired",
5851
+ run: bin("check-token-collection-wired"),
5852
+ scope: "full",
5853
+ timeoutMs: 15000,
5854
+ env: {
5855
+ CLAUDE_PROJECT_DIR: { optional: true },
5856
+ CLAUDE_CODE_SESSION_ID: { optional: true }
5857
+ }
5858
+ },
5859
+ 0
5860
+ ],
5861
+ [
5862
+ {
5863
+ name: "issue-title-grammar",
5864
+ run: bin("check-issue-title-grammar"),
5865
+ validates: "issue",
5866
+ scope: "full",
5867
+ ownWorkflow: true,
5868
+ timeoutMs: 15000,
5869
+ env: { ISSUE_TITLE: { optional: true } }
5870
+ },
5871
+ 1
5872
+ ],
5873
+ [
5874
+ {
5875
+ name: "issue-objectives-numbering",
5876
+ run: bin("check-issue-objectives-numbering"),
5877
+ validates: "issue",
5878
+ scope: "full",
5879
+ ownWorkflow: true,
5880
+ timeoutMs: 15000,
5881
+ env: { ISSUE_BODY: { optional: true }, ISSUE_NUMBER: { optional: true } }
5882
+ },
5883
+ 1
5884
+ ],
5885
+ [
5886
+ {
5887
+ name: "issue-parts-coverage",
5888
+ run: bin("check-issue-parts-coverage"),
5889
+ validates: "issue",
5890
+ scope: "full",
5891
+ ownWorkflow: true,
5892
+ timeoutMs: 15000,
5893
+ env: { ISSUE_BODY: { optional: true } }
5894
+ },
5895
+ 1
5896
+ ],
5897
+ [
5898
+ {
5899
+ name: "issue-surface-globs",
5900
+ run: bin("check-issue-surface-globs"),
5901
+ validates: "issue",
5902
+ scope: "full",
5903
+ ownWorkflow: true,
5904
+ timeoutMs: 15000,
5905
+ env: { ISSUE_BODY: { optional: true } }
5906
+ },
5907
+ 1
5908
+ ],
5909
+ [
5910
+ {
5911
+ name: "issue-milestone-attach",
5912
+ run: bin("check-issue-milestone-attach"),
5913
+ validates: "issue",
5914
+ scope: "full",
5915
+ ownWorkflow: true,
5916
+ timeoutMs: 15000,
5917
+ env: {
5918
+ ISSUE_LABELS: { optional: true },
5919
+ CURRENT_MILESTONE_TITLE: { optional: true },
5920
+ RESOLVED_MILESTONE_TITLE: { optional: true }
5921
+ }
5922
+ },
5923
+ 1
5924
+ ]
5925
+ ];
5926
+ CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
5927
+ });
5928
+
5258
5929
  // ../../harness/processes/vinaya-strict/tools/doctrine/resolve-doctrine.ts
5259
5930
  import { execFileSync as execFileSync5 } from "node:child_process";
5260
5931
  import { existsSync as existsSync4 } from "node:fs";
5261
- import { dirname as dirname4, join as join4, sep } from "node:path";
5932
+ import { dirname as dirname4, join as join5, sep as sep2 } from "node:path";
5262
5933
  function gitToplevel(cwd) {
5263
5934
  try {
5264
5935
  return execFileSync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
@@ -5275,16 +5946,16 @@ function resolveDoctrineRoot(pkg = cliPackageRoot(), cwd = process.cwd()) {
5275
5946
  function resolveDoctrineRootInfo(pkg = cliPackageRoot(), cwd = process.cwd()) {
5276
5947
  const toplevel = gitToplevel(cwd);
5277
5948
  if (toplevel !== null) {
5278
- const treeRoot = join4(toplevel, DOCTRINE_TREE);
5949
+ const treeRoot = join5(toplevel, DOCTRINE_TREE);
5279
5950
  if (hasDoctrineEntry(treeRoot))
5280
5951
  return { root: treeRoot, source: "tree" };
5281
5952
  }
5282
- const fromSource = !pkg.split(sep).includes("node_modules");
5283
- const bundleRoot = fromSource ? join4(dirname4(dirname4(pkg)), DOCTRINE_TREE) : join4(pkg, BUNDLED_DOCTRINE_DIR);
5953
+ const fromSource = !pkg.split(sep2).includes("node_modules");
5954
+ const bundleRoot = fromSource ? join5(dirname4(dirname4(pkg)), DOCTRINE_TREE) : join5(pkg, BUNDLED_DOCTRINE_DIR);
5284
5955
  return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
5285
5956
  }
5286
5957
  function hasDoctrineEntry(root) {
5287
- return existsSync4(join4(root, ...ENTRY_SEGMENTS));
5958
+ return existsSync4(join5(root, ...ENTRY_SEGMENTS));
5288
5959
  }
5289
5960
  var ENTRY_SEGMENTS;
5290
5961
  var init_resolve_doctrine = __esm(() => {
@@ -5295,7 +5966,7 @@ var init_resolve_doctrine = __esm(() => {
5295
5966
 
5296
5967
  // ../../harness/processes/vinaya-strict/tools/self-host.ts
5297
5968
  import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
5298
- import { join as join5, sep as sep2 } from "node:path";
5969
+ import { join as join6, sep as sep3 } from "node:path";
5299
5970
  function readPackageJson(path) {
5300
5971
  try {
5301
5972
  const parsed = JSON.parse(readFileSync3(path, "utf-8"));
@@ -5305,7 +5976,7 @@ function readPackageJson(path) {
5305
5976
  }
5306
5977
  }
5307
5978
  function resolveAuthorRepoSourceEntry(ownPackageRoot, cwd = process.cwd()) {
5308
- if (!ownPackageRoot.split(sep2).includes("node_modules"))
5979
+ if (!ownPackageRoot.split(sep3).includes("node_modules"))
5309
5980
  return null;
5310
5981
  const info = resolveDoctrineRootInfo(undefined, cwd);
5311
5982
  if (info?.source !== "tree")
@@ -5313,10 +5984,10 @@ function resolveAuthorRepoSourceEntry(ownPackageRoot, cwd = process.cwd()) {
5313
5984
  const toplevel = gitToplevel(cwd);
5314
5985
  if (toplevel === null)
5315
5986
  return null;
5316
- const cliPkg = readPackageJson(join5(toplevel, "apps", "cli", "package.json"));
5987
+ const cliPkg = readPackageJson(join6(toplevel, "apps", "cli", "package.json"));
5317
5988
  if (cliPkg?.name !== VINAYA_PACKAGE_NAME)
5318
5989
  return null;
5319
- const sourceEntry = join5(toplevel, "apps", "cli", "src", "index.ts");
5990
+ const sourceEntry = join6(toplevel, "apps", "cli", "src", "index.ts");
5320
5991
  return existsSync5(sourceEntry) ? sourceEntry : null;
5321
5992
  }
5322
5993
  var VINAYA_PACKAGE_NAME = "@attalabs/vinaya";
@@ -5349,7 +6020,7 @@ function readIssueCheckEnv(env = process.env) {
5349
6020
  init_issue_documentation();
5350
6021
  import { execFileSync as execFileSync6 } from "node:child_process";
5351
6022
  import { existsSync as existsSync6, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
5352
- import { join as join6 } from "node:path";
6023
+ import { join as join7 } from "node:path";
5353
6024
 
5354
6025
  // ../../harness/processes/vinaya-strict/tools/task-contract/blast-radius-domains.ts
5355
6026
  init_legacy_paths();
@@ -5401,7 +6072,60 @@ init_issue_validation();
5401
6072
 
5402
6073
  // ../../harness/processes/vinaya-strict/tools/task-contract/brief-render.ts
5403
6074
  init_brief_validation();
6075
+
6076
+ // ../../harness/processes/vinaya-strict/tools/task-contract/issue-sections.ts
6077
+ init_anchored_region();
6078
+ var ISSUE_SECTIONS = [
6079
+ { heading: "Objectives", disposition: "carried", briefPart: "## Objectives" },
6080
+ { heading: "Documentation", disposition: "carried", briefPart: "## Documentation" },
6081
+ { heading: "Premises", disposition: "carried", briefPart: "## Premises" },
6082
+ { heading: "Surface", disposition: "carried", briefPart: "## 4. Technical surface map" },
6083
+ { heading: "Parts", disposition: "carried", briefPart: "## 6. Numbered parts" },
6084
+ { heading: "Test plan", disposition: "carried", briefPart: "## 9. Test Plan" },
6085
+ { heading: "Stop conditions", disposition: "carried", briefPart: "## 10. Stop conditions" },
6086
+ { heading: "Origin", disposition: "stays-on-issue" },
6087
+ { heading: "Check decisions", disposition: "carried", briefPart: "## Check decisions" },
6088
+ { heading: "Covering checks", disposition: "carried", briefPart: "## Check decisions" }
6089
+ ];
6090
+ var RATIONALE_FIELD_SPECS = [
6091
+ { key: "boundary", name: "Boundary", pattern: "Boundary", readByBrief: true },
6092
+ { key: "sizing", name: "Sizing", pattern: "Sizing", readByBrief: false },
6093
+ {
6094
+ key: "blastRadius",
6095
+ name: "Project(s) + blast radius",
6096
+ pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius",
6097
+ readByBrief: false
6098
+ },
6099
+ {
6100
+ key: "dependencyRationale",
6101
+ name: "Dependency rationale",
6102
+ pattern: "Dependency rationale|Depends[- ]on",
6103
+ readByBrief: true
6104
+ },
6105
+ { key: "trapsToAvoid", name: "Traps to avoid", pattern: "Traps", readByBrief: true },
6106
+ {
6107
+ key: "suggestedAgentClass",
6108
+ name: "Suggested agent-class",
6109
+ pattern: "(?:Suggested\\s+)?agent-class",
6110
+ readByBrief: true
6111
+ },
6112
+ { key: "stopAndEscalate", name: "Stop-and-escalate", pattern: "Stop-and-escalate", readByBrief: true },
6113
+ { key: "docsToKeepCoherent", name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7", readByBrief: true }
6114
+ ];
6115
+ function rationaleFieldPattern(key) {
6116
+ const spec = RATIONALE_FIELD_SPECS.find((f) => f.key === key);
6117
+ if (spec === undefined)
6118
+ throw new Error(`unknown rationale field ${key}`);
6119
+ return spec.pattern;
6120
+ }
6121
+ var normalize2 = (heading) => heading.trim().replace(/[:\s]+$/, "").toLowerCase();
6122
+ var KNOWN_HEADINGS = new Set(ISSUE_SECTIONS.map((s) => normalize2(s.heading)));
6123
+ var FIELD_AS_HEADING_RES = RATIONALE_FIELD_SPECS.map((f) => new RegExp(`^(?:${f.pattern})(?![\\w-])`, "i"));
6124
+ var FIELD_IN_SECTION_RES = RATIONALE_FIELD_SPECS.map((f) => new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${f.pattern})`, "im"));
6125
+
6126
+ // ../../harness/processes/vinaya-strict/tools/task-contract/brief-render.ts
5404
6127
  init_derive_section7();
6128
+ init_premise_check();
5405
6129
  init_issue_validation();
5406
6130
  init_objectives();
5407
6131
 
@@ -5431,6 +6155,16 @@ function overrideActive(opts) {
5431
6155
  return false;
5432
6156
  }
5433
6157
 
6158
+ // ../../harness/processes/vinaya-strict/tools/task-contract/brief-render.ts
6159
+ var RATIONALE_FIELD_PATTERNS = {
6160
+ boundary: rationaleFieldPattern("boundary"),
6161
+ dependencyRationale: rationaleFieldPattern("dependencyRationale"),
6162
+ trapsToAvoid: rationaleFieldPattern("trapsToAvoid"),
6163
+ suggestedAgentClass: rationaleFieldPattern("suggestedAgentClass"),
6164
+ stopAndEscalate: rationaleFieldPattern("stopAndEscalate")
6165
+ };
6166
+ var DOCS_TO_KEEP_COHERENT_PATTERN = rationaleFieldPattern("docsToKeepCoherent");
6167
+
5434
6168
  // ../../node_modules/universal-user-agent/index.js
5435
6169
  function getUserAgent() {
5436
6170
  if (typeof navigator === "object" && "userAgent" in navigator) {
@@ -6312,10 +7046,23 @@ function describeError(err) {
6312
7046
 
6313
7047
  // ../../harness/processes/vinaya-strict/tools/task-contract/forge/fetch-open-issues.ts
6314
7048
  init_labels();
6315
- async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
7049
+ function failureReason(err, token) {
7050
+ const message = err instanceof Error ? err.message : String(err);
7051
+ if (token.length > 0 && message.includes(token))
7052
+ return null;
7053
+ return message;
7054
+ }
7055
+ async function fetchOpenIssuesByLabel(slugs, owner, repo, token, onFailedRead) {
7056
+ const read = await readOpenIssuesByLabel(slugs, owner, repo, token);
7057
+ if (read.ok)
7058
+ return read.issues;
7059
+ onFailedRead?.(read.reason);
7060
+ return new Map;
7061
+ }
7062
+ async function readOpenIssuesByLabel(slugs, owner, repo, token) {
6316
7063
  const result = new Map;
6317
7064
  if (slugs.length === 0)
6318
- return result;
7065
+ return { ok: true, issues: result };
6319
7066
  const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
6320
7067
  const toAlias = (slug) => `tranche_${slug.replace(/-/g, "_")}`;
6321
7068
  const perSlug = slugs.map((slug) => `
@@ -6329,11 +7076,12 @@ async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
6329
7076
  let response;
6330
7077
  try {
6331
7078
  response = await client(query, { owner, repo });
6332
- } catch {
6333
- return result;
7079
+ } catch (err) {
7080
+ return { ok: false, reason: failureReason(err, token) };
7081
+ }
7082
+ if (!response.repository) {
7083
+ return { ok: false, reason: `the repository ${owner}/${repo} is not visible to the token` };
6334
7084
  }
6335
- if (!response.repository)
6336
- return result;
6337
7085
  for (const slug of slugs) {
6338
7086
  const conn = response.repository[toAlias(slug)];
6339
7087
  const issues = (conn?.nodes ?? []).map((n) => ({
@@ -6343,7 +7091,7 @@ async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
6343
7091
  }));
6344
7092
  result.set(slug, issues);
6345
7093
  }
6346
- return result;
7094
+ return { ok: true, issues: result };
6347
7095
  }
6348
7096
 
6349
7097
  // ../../harness/processes/vinaya-strict/tools/task-contract/brief-assembly.ts
@@ -6360,6 +7108,9 @@ function siblingsSharingConflictEdge(subject, siblings) {
6360
7108
  function isHandClosedByRecognizedPrincipal(dep, principalAllowlist) {
6361
7109
  return dep.issueState === "closed" && dep.stateReason === "completed" && isPrincipal(dep.closedByActor ?? null, principalAllowlist);
6362
7110
  }
7111
+ function issueReadFailedMessage(prefix, issueNumber, error) {
7112
+ return `${prefix} issue-read-failed: the forge could not be read for Issue #${issueNumber}, so whether it exists is unknown — this is not a claim that the Issue is missing. gh reported: ${error}`;
7113
+ }
6363
7114
  function isSelfDependency(dep, task, issue) {
6364
7115
  if (dep.issue !== null && issue !== null && dep.issue === issue.number)
6365
7116
  return true;
@@ -6376,6 +7127,8 @@ function checkDispatchReadiness(input) {
6376
7127
  };
6377
7128
  if (task.issue === null) {
6378
7129
  push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} has no Issue (#TBD or blank) in the topology — not dispatchable until the Planner cuts the Issue.`);
7130
+ } else if (input.issueReadFailed !== undefined) {
7131
+ push("issue-read-failed", issueReadFailedMessage("dispatch-gate", task.issue, input.issueReadFailed));
6379
7132
  } else if (input.issue === null) {
6380
7133
  push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} names Issue #${task.issue}, but it does not resolve to a real GitHub Issue (phantom reference).`);
6381
7134
  }
@@ -6475,6 +7228,19 @@ function lifecycleFromIssues(issues) {
6475
7228
  return "planned";
6476
7229
  return issues.some((i) => i.state === "OPEN") ? "active" : "complete";
6477
7230
  }
7231
+ function lifecycleFromCounts(open, total) {
7232
+ if (total === 0)
7233
+ return "planned";
7234
+ return open > 0 ? "active" : "complete";
7235
+ }
7236
+ function resolveLegacyFactsFromCounts(milestone, open, total) {
7237
+ if (milestone.state === "closed" && total > 0) {
7238
+ return { goal: milestone.description ?? "", lifecycle: lifecycleFromCounts(open, total) };
7239
+ }
7240
+ return factsFromLegacyMilestone(milestone);
7241
+ }
7242
+ var TRANCHE_LABEL_QUERY = "vinaya/tranche:";
7243
+ var ACTIVE_ISSUE_READ_CONCURRENCY = 4;
6478
7244
  function goalFromMilestones(milestones, slug) {
6479
7245
  for (const m of milestones) {
6480
7246
  const goal = intentGoalForSlug(m.description ?? "", slug);
@@ -6502,10 +7268,20 @@ function trancheSlugsFromLabels(labels) {
6502
7268
  }
6503
7269
  async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
6504
7270
  const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
6505
- const [milestones, labels] = await Promise.all([
7271
+ const [milestones, labels, counts] = await Promise.all([
6506
7272
  read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
6507
- read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
7273
+ read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)),
7274
+ read(() => ghLabelIssueCountsAsync(owner, repo, TRANCHE_LABEL_QUERY))
6508
7275
  ]);
7276
+ const countsByLabel = new Map(counts.map((c) => [c.name, c]));
7277
+ const uncounted = trancheSlugsFromLabels(labels).map((slug) => trancheLabel(slug)).filter((label) => !countsByLabel.has(label));
7278
+ if (uncounted.length > 0) {
7279
+ throw new Error(`the label Issue-count query returned no count for ${uncounted.join(", ")}`);
7280
+ }
7281
+ const lifecycleOf = (slug) => {
7282
+ const c = countsByLabel.get(trancheLabel(slug));
7283
+ return lifecycleFromCounts(c?.open ?? 0, c?.total ?? 0);
7284
+ };
6509
7285
  const active = [];
6510
7286
  const archived = [];
6511
7287
  const facts = new Map;
@@ -6513,33 +7289,21 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
6513
7289
  const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
6514
7290
  const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
6515
7291
  const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
6516
- const uniqueLegacySlugs = [...legacySlugs];
6517
- const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
6518
- Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
6519
- Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
6520
- ]);
6521
- const issuesBySlug = new Map;
6522
- uniqueLegacySlugs.forEach((slug, i) => {
6523
- issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
6524
- });
6525
- uniqueNewPathSlugs.forEach((slug, i) => {
6526
- issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
6527
- });
6528
- uniqueLegacySlugs.forEach((slug, i) => {
7292
+ for (const slug of legacySlugs) {
6529
7293
  const m = legacyMilestoneBySlug.get(slug);
6530
7294
  if (!m)
6531
- return;
7295
+ continue;
6532
7296
  const ref = { slug, goal: m.description ?? "" };
6533
- const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
7297
+ const c = countsByLabel.get(trancheLabel(slug));
7298
+ const f = resolveLegacyFactsFromCounts(m, c?.open ?? 0, c?.total ?? 0);
6534
7299
  if (f.lifecycle === "complete")
6535
7300
  archived.push(ref);
6536
7301
  else if (f.lifecycle === "active")
6537
7302
  active.push(ref);
6538
7303
  facts.set(slug, f);
6539
- });
6540
- uniqueNewPathSlugs.forEach((slug, i) => {
6541
- const issues = newPathIssuesBySlug[i] ?? [];
6542
- const lifecycle = lifecycleFromIssues(issues);
7304
+ }
7305
+ for (const slug of uniqueNewPathSlugs) {
7306
+ const lifecycle = lifecycleOf(slug);
6543
7307
  const goal = goalFromMilestones(milestones, slug);
6544
7308
  const f = { goal, lifecycle };
6545
7309
  facts.set(slug, f);
@@ -6547,7 +7311,16 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
6547
7311
  active.push({ slug, goal });
6548
7312
  else if (lifecycle === "complete")
6549
7313
  archived.push({ slug, goal });
6550
- });
7314
+ }
7315
+ const issuesBySlug = new Map;
7316
+ const activeSlugs = active.map((r) => r.slug);
7317
+ for (let i = 0;i < activeSlugs.length; i += ACTIVE_ISSUE_READ_CONCURRENCY) {
7318
+ const batch = activeSlugs.slice(i, i + ACTIVE_ISSUE_READ_CONCURRENCY);
7319
+ const lists = await Promise.all(batch.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))));
7320
+ batch.forEach((slug, j) => {
7321
+ issuesBySlug.set(slug, lists[j] ?? []);
7322
+ });
7323
+ }
6551
7324
  return { active, archived, facts, legacySlugs, issuesBySlug };
6552
7325
  }
6553
7326
  async function retryOnce(fetch) {
@@ -6806,6 +7579,49 @@ function dependsOnFactFromEdge(id, r) {
6806
7579
 
6807
7580
  // ../../harness/processes/vinaya-strict/tools/task-contract/brief-assembly.ts
6808
7581
  init_compose();
7582
+ init_registry();
7583
+
7584
+ // ../../harness/kernel/gates/checks/resolver.ts
7585
+ var NAMESPACE_SEGMENT = /^[a-z0-9][a-z0-9-]*$/;
7586
+ var RESERVED_PREFIX = "vinaya";
7587
+ function isValidNamespacedKey(key) {
7588
+ const parts = key.split("/");
7589
+ if (parts.length !== 2)
7590
+ return false;
7591
+ const [prefix, rest] = parts;
7592
+ if (!prefix || !rest)
7593
+ return false;
7594
+ if (!NAMESPACE_SEGMENT.test(prefix) || !NAMESPACE_SEGMENT.test(rest))
7595
+ return false;
7596
+ if (prefix === RESERVED_PREFIX)
7597
+ return false;
7598
+ return true;
7599
+ }
7600
+ function resolveChecks(core, configChecks) {
7601
+ const resolved = core.map((spec) => ({ name: spec.name, state: "default", source: "core", spec }));
7602
+ const failures = [];
7603
+ if (!configChecks)
7604
+ return { resolved, failures };
7605
+ const indexByName = new Map(resolved.map((entry, index) => [entry.name, index]));
7606
+ for (const [key, entry] of Object.entries(configChecks)) {
7607
+ const coreIndex = indexByName.get(key);
7608
+ if (coreIndex !== undefined) {
7609
+ resolved[coreIndex] = {
7610
+ name: key,
7611
+ state: "overridden",
7612
+ source: "config",
7613
+ spec: { name: key, ...entry }
7614
+ };
7615
+ continue;
7616
+ }
7617
+ if (isValidNamespacedKey(key)) {
7618
+ resolved.push({ name: key, state: "additive", source: "config", spec: { name: key, ...entry } });
7619
+ continue;
7620
+ }
7621
+ failures.push({ key, reason: 'bare key has no "/" and matches no core check id' });
7622
+ }
7623
+ return { resolved, failures };
7624
+ }
6809
7625
 
6810
7626
  // ../../harness/processes/vinaya-strict/tools/own-version.ts
6811
7627
  init_package_root();
@@ -6816,8 +7632,8 @@ init_self_host();
6816
7632
  init_doctrine_map();
6817
7633
  var PACKAGE_ROOT = cliPackageRoot();
6818
7634
  var BRIEF_TEMPLATE_SOURCE = doctrineSource("templates/brief-template.md");
6819
- var PACKAGED_TEMPLATE_PATH = join6(PACKAGE_ROOT, BUNDLED_DOCTRINE_DIR, BRIEF_TEMPLATE_SOURCE);
6820
- var TEMPLATE_PATH = existsSync6(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join6(PACKAGE_ROOT, "..", "..", DOCTRINE_TREE, BRIEF_TEMPLATE_SOURCE);
7635
+ var PACKAGED_TEMPLATE_PATH = join7(PACKAGE_ROOT, BUNDLED_DOCTRINE_DIR, BRIEF_TEMPLATE_SOURCE);
7636
+ var TEMPLATE_PATH = existsSync6(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join7(PACKAGE_ROOT, "..", "..", DOCTRINE_TREE, BRIEF_TEMPLATE_SOURCE);
6821
7637
  function git(args) {
6822
7638
  try {
6823
7639
  return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
@@ -6830,6 +7646,10 @@ function expandGlob(glob) {
6830
7646
  return out.split(`
6831
7647
  `).map((s) => s.trim()).filter(Boolean);
6832
7648
  }
7649
+ var WAITING_BLOCKER_CLASSES = new Set([
7650
+ "depends-on-not-merged",
7651
+ "conflicts-with"
7652
+ ]);
6833
7653
  var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
6834
7654
 
6835
7655
  // ../../harness/processes/vinaya-strict/checks/bin/check-issue-surface-globs.ts