@attalabs/vinaya 0.33.0 → 0.35.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 (143) hide show
  1. package/LICENSE +104 -201
  2. package/README.md +1 -1
  3. package/aeg-root/enforcement.md +1 -1
  4. package/aeg-root/glossary.md +4 -0
  5. package/aeg-root/roles/developer.md +3 -0
  6. package/aeg-root/roles/operator.md +30 -10
  7. package/aeg-root/roles/planner/reference.md +3 -2
  8. package/aeg-root/roles/planner.md +3 -1
  9. package/aeg-root/templates/brief-template.md +9 -7
  10. package/aeg-root/templates/pr-report-template.md +3 -1
  11. package/dist/checks/bin/check-body-bare-digits.js +107 -28
  12. package/dist/checks/bin/check-branch-topology.js +94 -25
  13. package/dist/checks/bin/check-brief-shape.js +113 -33
  14. package/dist/checks/bin/check-changeset-coverage.js +369 -92
  15. package/dist/checks/bin/check-closes-n.js +94 -25
  16. package/dist/checks/bin/check-coherence.js +124 -29
  17. package/dist/checks/bin/check-dead-branch-push.js +79 -25
  18. package/dist/checks/bin/check-dispatch-readiness.js +122 -28
  19. package/dist/checks/bin/check-doc-coverage-push.js +365 -88
  20. package/dist/checks/bin/check-doc-coverage.js +367 -90
  21. package/dist/checks/bin/check-doctrine-no-procedures.js +107 -28
  22. package/dist/checks/bin/check-doctrine-portability.js +366 -89
  23. package/dist/checks/bin/check-evidence-fresh.js +338 -61
  24. package/dist/checks/bin/check-exec-bits.js +363 -86
  25. package/dist/checks/bin/check-first-push-dispatch.js +122 -28
  26. package/dist/checks/bin/check-issue-assignment.js +94 -25
  27. package/dist/checks/bin/check-issue-milestone-attach.js +79 -25
  28. package/dist/checks/bin/check-issue-objectives-numbering.js +606 -26
  29. package/dist/checks/bin/check-issue-parts-coverage.js +79 -25
  30. package/dist/checks/bin/check-issue-surface-globs.js +162 -34
  31. package/dist/checks/bin/check-issue-title-grammar.js +79 -25
  32. package/dist/checks/bin/check-issue-tranche-label.js +79 -25
  33. package/dist/checks/bin/check-main-branch-refusal.js +79 -25
  34. package/dist/checks/bin/check-no-disk-state.js +79 -25
  35. package/dist/checks/bin/check-pr-premise-reassert.js +107 -28
  36. package/dist/checks/bin/check-pr-report-density.js +79 -25
  37. package/dist/checks/bin/check-principal-test-plan-wait.js +79 -25
  38. package/dist/checks/bin/check-quoted-command.js +282 -39
  39. package/dist/checks/bin/check-reader-resolvable-prose.js +333 -47
  40. package/dist/checks/bin/check-registry-gates.js +79 -25
  41. package/dist/checks/bin/check-retired-vocabulary.js +282 -39
  42. package/dist/checks/bin/check-review-gate.js +111 -31
  43. package/dist/checks/bin/check-single-plan-pr.js +79 -25
  44. package/dist/checks/bin/check-surface-scope.js +94 -25
  45. package/dist/checks/bin/check-test-plan.js +79 -25
  46. package/dist/checks/bin/check-token-collection-wired.js +79 -25
  47. package/dist/checks/bin/check-token-report.js +79 -25
  48. package/dist/checks/bin/check-workspace-escape.js +364 -87
  49. package/dist/index.js +2713 -1609
  50. package/dist/lib/pre-push-cache-test-run.js +226 -16
  51. package/dist/lib/pre-push-select-tests.js +48 -5
  52. package/package.json +2 -2
  53. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +153 -37
  54. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +87 -24
  55. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +9 -2
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +13 -3
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +7 -0
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +5 -2
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +116 -20
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +100 -4
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-cutovers.ts +49 -0
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +60 -4
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +138 -54
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +26 -3
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives-cutover-config.ts +31 -0
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +15 -6
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +122 -23
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +18 -3
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +24 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +15 -10
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +16 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +194 -0
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +312 -53
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +62 -8
  75. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  76. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  77. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  78. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  79. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  80. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  81. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  82. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +4 -4
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__18paley._.js → [root-of-the-server]__0zc_0gx._.js} +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +2 -2
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  134. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
  135. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{22s44f5k3ecmj.js → 3goaig_rysc6p.js} +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1ce2dj27_cgbj.js → 3ip5z3cf43bgo.js} +4 -4
  137. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{34hhdtbp20krb.js → 3u9emqjwpd0t9.js} +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  139. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
  140. /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
  141. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → ca66rAHI_w9D7S7ceXDvR}/_buildManifest.js +0 -0
  142. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → ca66rAHI_w9D7S7ceXDvR}/_clientMiddlewareManifest.js +0 -0
  143. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → ca66rAHI_w9D7S7ceXDvR}/_ssgManifest.js +0 -0
@@ -3,8 +3,8 @@ import { createRequire } from "node:module";
3
3
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
4
 
5
5
  // src/checks/bin/check-workspace-escape.ts
6
- import { readdirSync as readdirSync2, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
7
- import { join as join9 } from "node:path";
6
+ import { readdirSync as readdirSync3, readFileSync as readFileSync7, statSync as statSync2 } from "node:fs";
7
+ import { join as join10 } from "node:path";
8
8
  // ../../packages/aeg-core/src/gate-audience.ts
9
9
  var GATE_AUDIENCE = {
10
10
  "check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
@@ -199,8 +199,8 @@ function maskIndentedCode(body, fill) {
199
199
  var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
200
200
  var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
201
201
  var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
202
- var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
203
- var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
202
+ var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
203
+ var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
204
204
  function splitSlugQualifiedEdge(edge) {
205
205
  const m = edge.trim().match(SLUG_QUALIFIED_ID);
206
206
  if (!m)
@@ -2621,7 +2621,7 @@ function isIssueNotFoundError(err) {
2621
2621
  return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
2622
2622
  }
2623
2623
  function resolveObjectivesSource(prBody, issue, cutoverIssue) {
2624
- if (issue !== null && issue < cutoverIssue)
2624
+ if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
2625
2625
  return { kind: "none" };
2626
2626
  if (issue !== null)
2627
2627
  return { kind: "issue", issue };
@@ -2897,9 +2897,18 @@ var COMMIT_TYPES = [
2897
2897
  ];
2898
2898
  var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
2899
2899
  function checkForgeTitle(title) {
2900
- const taskStyle = /^\[[a-z0-9._-]+\] \S+ — \S/;
2900
+ const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
2901
2901
  if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
2902
2902
  return { status: "pass", errors: [] };
2903
+ const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
2904
+ if (letteredTaskId) {
2905
+ return {
2906
+ status: "fail",
2907
+ errors: [
2908
+ `brief-validation title: "${title}" names task id \`${letteredTaskId[1]}\` — task ids are whole numbers (\`1\`, \`2\`), never lettered (\`2a\`). \`vinaya task run\` and \`task dispatch\` refuse a non-numeric id, so a plan titled this way names a task that cannot be started.`
2909
+ ]
2910
+ };
2911
+ }
2903
2912
  return {
2904
2913
  status: "fail",
2905
2914
  errors: [
@@ -2932,19 +2941,31 @@ function checkNoAgentBoxes(prBody) {
2932
2941
  ]
2933
2942
  };
2934
2943
  }
2935
- function rolloutThresholdFor(message) {
2944
+ function rolloutRuleFor(message) {
2936
2945
  if (message.startsWith("brief-validation unpinned code claim:") || message.startsWith("brief-validation commands carry output:") || message.startsWith("brief-validation consumer tests:") || message.startsWith("brief-validation defeat cases:")) {
2937
- return BRIEF_RULES_SINCE_PR;
2946
+ return "briefRules";
2938
2947
  }
2939
2948
  if (message.startsWith("brief-validation no agent boxes:"))
2940
- return AGENT_BOXES_REFUSED_SINCE_PR;
2949
+ return "agentBoxes";
2941
2950
  return null;
2942
2951
  }
2943
- function partitionBriefErrorsByRollout(errors, prNumber) {
2952
+ var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
2953
+ briefRulesSincePr: BRIEF_RULES_SINCE_PR,
2954
+ agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
2955
+ };
2956
+ function rolloutThresholdFor(message, cutovers) {
2957
+ const rule = rolloutRuleFor(message);
2958
+ if (rule === "briefRules")
2959
+ return cutovers.briefRulesSincePr;
2960
+ if (rule === "agentBoxes")
2961
+ return cutovers.agentBoxesRefusedSincePr;
2962
+ return null;
2963
+ }
2964
+ function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
2944
2965
  const blocking = [];
2945
2966
  const info = [];
2946
2967
  for (const e of errors) {
2947
- const threshold = rolloutThresholdFor(e);
2968
+ const threshold = rolloutThresholdFor(e, cutovers);
2948
2969
  const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
2949
2970
  (grandfathered ? info : blocking).push(e);
2950
2971
  }
@@ -3412,8 +3433,8 @@ function checkIssueRationale(body) {
3412
3433
  return { status: errors.length > 0 ? "fail" : "pass", errors };
3413
3434
  }
3414
3435
  var OBJECTIVES_SINCE_ISSUE = 404;
3415
- function checkIssueObjectives(body, issueNumber) {
3416
- if (issueNumber !== null && issueNumber < OBJECTIVES_SINCE_ISSUE)
3436
+ function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
3437
+ if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
3417
3438
  return { status: "pass", errors: [] };
3418
3439
  const result = objectivesOf(body);
3419
3440
  if (result.ok)
@@ -3489,6 +3510,8 @@ function parseIssueSurface(body) {
3489
3510
  function globCoversPath(glob, path) {
3490
3511
  const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
3491
3512
  const p = path.replace(/\/+$/, "");
3513
+ if (g === "*")
3514
+ return !p.includes("/");
3492
3515
  return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
3493
3516
  }
3494
3517
  function checkSurfaceGlobsResolve(body, resolvesToFile) {
@@ -3858,7 +3881,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
3858
3881
  return issueToEntry.get(Number(issueMatch[1]));
3859
3882
  return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
3860
3883
  }
3861
- function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
3884
+ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
3862
3885
  const failures = [];
3863
3886
  for (const [slug, issues] of issuesBySlug) {
3864
3887
  for (const issue of issues) {
@@ -3867,7 +3890,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
3867
3890
  const errors = [
3868
3891
  ...checkIssueRationale(issue.body).errors,
3869
3892
  ...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
3870
- ...checkIssueObjectives(issue.body, issue.number).errors,
3893
+ ...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
3871
3894
  ...checkPartsCiteDefinedObjectives(issue.body).errors
3872
3895
  ];
3873
3896
  if (errors.length === 0)
@@ -4490,13 +4513,27 @@ var SHIPS_PREFIX = "aeg-root/";
4490
4513
  function shipsArchivePrefix(shipsPrefix) {
4491
4514
  return `${shipsPrefix}tranches/completed/`;
4492
4515
  }
4493
- function isSpecFile2(path) {
4494
- return path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md");
4516
+ var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
4517
+ function normalizeSpecPath(entry) {
4518
+ let out = entry.replace(/\\/g, "/");
4519
+ while (out.startsWith("./"))
4520
+ out = out.slice(2);
4521
+ out = out.replace(/\/{2,}/g, "/");
4522
+ while (out.endsWith("/"))
4523
+ out = out.slice(0, -1);
4524
+ return out;
4525
+ }
4526
+ function isSpecFile2(path, specPaths) {
4527
+ if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
4528
+ return true;
4529
+ if (!path.endsWith(".md"))
4530
+ return false;
4531
+ return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
4495
4532
  }
4496
4533
  function isClaudeMdFile(path) {
4497
4534
  return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
4498
4535
  }
4499
- function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
4536
+ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
4500
4537
  if (path.startsWith(shipsPrefix)) {
4501
4538
  return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
4502
4539
  }
@@ -4505,7 +4542,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
4505
4542
  }
4506
4543
  if (isClaudeMdFile(path))
4507
4544
  return "internal";
4508
- if (isSpecFile2(path))
4545
+ if (isSpecFile2(path, specPaths))
4509
4546
  return "spec";
4510
4547
  if (isProductScopeFile(path))
4511
4548
  return "product";
@@ -4534,13 +4571,14 @@ function lineAt(content, index) {
4534
4571
  }
4535
4572
  var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
4536
4573
  var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
4574
+ var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
4537
4575
  function legacySlugPattern(legacySlugs) {
4538
4576
  if (legacySlugs.length === 0)
4539
4577
  return null;
4540
4578
  const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
4541
4579
  return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
4542
4580
  }
4543
- function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
4581
+ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4544
4582
  const findings = [];
4545
4583
  const legacyPattern = legacySlugPattern(legacySlugs);
4546
4584
  const grandfathered = new Set(specGrandfather);
@@ -4552,8 +4590,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
4552
4590
  const productPatterns = [
4553
4591
  { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
4554
4592
  ];
4593
+ const specPatterns = [
4594
+ ...patterns,
4595
+ { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
4596
+ ];
4555
4597
  for (const file of files) {
4556
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
4598
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
4557
4599
  if (!cls || cls === "internal")
4558
4600
  continue;
4559
4601
  if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
@@ -4562,15 +4604,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
4562
4604
  continue;
4563
4605
  const blocking = cls === "product" || cls === "spec";
4564
4606
  const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
4565
- const patternsToRun = cls === "product" ? productPatterns : patterns;
4607
+ const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
4566
4608
  for (const { pattern, what, group } of patternsToRun) {
4567
4609
  pattern.lastIndex = 0;
4568
4610
  let match = pattern.exec(scrubbed);
4569
4611
  while (match !== null) {
4570
4612
  const cited = group !== undefined ? match[group] ?? match[0] : match[0];
4613
+ const citedIndex = match.index + match[0].indexOf(cited);
4571
4614
  findings.push({
4572
4615
  file: file.path,
4573
- line: lineAt(scrubbed, match.index),
4616
+ line: lineAt(scrubbed, citedIndex),
4574
4617
  message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4575
4618
  blocking
4576
4619
  });
@@ -4756,9 +4799,9 @@ function checkSourceComments(files, allowlist = []) {
4756
4799
  }
4757
4800
  return findings;
4758
4801
  }
4759
- function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
4802
+ function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4760
4803
  return [
4761
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
4804
+ ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
4762
4805
  ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
4763
4806
  ];
4764
4807
  }
@@ -5223,7 +5266,8 @@ var TaskStatusItemSchema = z.object({
5223
5266
  }).merge(ObservedSchema);
5224
5267
  var TaskStatusResultSchema = z.object({
5225
5268
  items: z.array(TaskStatusItemSchema),
5226
- nextCursor: z.string().nullable()
5269
+ nextCursor: z.string().nullable(),
5270
+ table: z.string()
5227
5271
  });
5228
5272
  var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
5229
5273
  var EscalationInputsSchema = z.object({
@@ -5567,6 +5611,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5567
5611
  }
5568
5612
  return findings;
5569
5613
  }
5614
+ // ../../packages/aeg-core/src/gate-cutovers.ts
5615
+ var NO_GATE_CUTOVERS = {
5616
+ objectivesSinceIssue: null,
5617
+ briefSectionsSinceIssue: null,
5618
+ documentationSinceIssue: null,
5619
+ briefRulesSincePr: null,
5620
+ agentBoxesRefusedSincePr: null
5621
+ };
5570
5622
  // ../../packages/aeg-core/src/dev-review-loop/types.ts
5571
5623
  var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5572
5624
  // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
@@ -6016,6 +6068,8 @@ function attemptFromEnv(value) {
6016
6068
  function provenanceFor(input) {
6017
6069
  if (input.provenance)
6018
6070
  return input.provenance;
6071
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
6072
+ return "unavailable";
6019
6073
  if (input.env.role || input.env.task)
6020
6074
  return "env_correlated";
6021
6075
  return "unavailable";
@@ -6036,7 +6090,7 @@ function buildHeader(input) {
6036
6090
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
6037
6091
  const round = roundFromEnv(input.env.round);
6038
6092
  const subject = {
6039
- issue: issueFromTask(input.env.task),
6093
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
6040
6094
  role,
6041
6095
  ...round !== undefined ? { round } : {},
6042
6096
  ...input.subject ?? {}
@@ -6317,8 +6371,8 @@ var ResolutionRecordSchema = z3.object({
6317
6371
  consumedAt: isoTimestamp
6318
6372
  }).strict();
6319
6373
  // src/lib/diff-evidence.ts
6320
- import { execFileSync as execFileSync5 } from "node:child_process";
6321
- import { join as join8, relative, resolve as resolve2 } from "node:path";
6374
+ import { execFileSync as execFileSync6 } from "node:child_process";
6375
+ import { join as join9, relative, resolve as resolve2 } from "node:path";
6322
6376
 
6323
6377
  // src/lib/config.ts
6324
6378
  import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
@@ -6480,7 +6534,12 @@ var VinayaConfigSchema = z4.object({
6480
6534
  allowlist: z4.array(z4.string().min(1)).optional(),
6481
6535
  severity: z4.enum(["warning", "error"]).optional()
6482
6536
  }).optional(),
6483
- specGrandfather: z4.array(z4.string().min(1)).optional()
6537
+ specGrandfather: z4.array(z4.string().min(1)).optional(),
6538
+ specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
6539
+ message: "must be a repository-relative path, not an absolute one"
6540
+ }).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
6541
+ message: "must stay inside the repository — no `..` segment"
6542
+ })).optional()
6484
6543
  }).optional(),
6485
6544
  projects: z4.array(ProjectEntrySchema).optional(),
6486
6545
  dispatch: z4.object({
@@ -6494,6 +6553,13 @@ var VinayaConfigSchema = z4.object({
6494
6553
  securityThreshold: z4.string().min(1).optional(),
6495
6554
  maxRounds: z4.number().optional()
6496
6555
  }).optional(),
6556
+ gateCutovers: z4.object({
6557
+ objectivesSinceIssue: z4.number().int().nonnegative().optional(),
6558
+ briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
6559
+ documentationSinceIssue: z4.number().int().nonnegative().optional(),
6560
+ briefRulesSincePr: z4.number().int().nonnegative().optional(),
6561
+ agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
6562
+ }).optional(),
6497
6563
  prePush: z4.object({
6498
6564
  alwaysRun: z4.array(z4.string()).optional()
6499
6565
  }).optional(),
@@ -6631,6 +6697,18 @@ function resolveReviewPolicy(config) {
6631
6697
  maxRounds
6632
6698
  };
6633
6699
  }
6700
+ function resolveGateCutovers(config) {
6701
+ const raw = config?.gateCutovers;
6702
+ if (!raw)
6703
+ return NO_GATE_CUTOVERS;
6704
+ return {
6705
+ objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
6706
+ briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
6707
+ documentationSinceIssue: raw.documentationSinceIssue ?? null,
6708
+ briefRulesSincePr: raw.briefRulesSincePr ?? null,
6709
+ agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
6710
+ };
6711
+ }
6634
6712
  function resolveRuntimeDirSetting(config) {
6635
6713
  return config?.runtimeDir ?? null;
6636
6714
  }
@@ -6686,7 +6764,8 @@ async function trustAnchorRepoAsync() {
6686
6764
  try {
6687
6765
  const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
6688
6766
  encoding: "utf-8",
6689
- timeout: 1e4
6767
+ timeout: 1e4,
6768
+ killSignal: "SIGKILL"
6690
6769
  });
6691
6770
  return trustAnchorRepoFromRemoteUrl(stdout);
6692
6771
  } catch {
@@ -6747,7 +6826,7 @@ async function ghFetchTrustAnchorConfigAsync() {
6747
6826
  const repo = await trustAnchorRepoAsync();
6748
6827
  if (!repo)
6749
6828
  throw new Error("could not resolve repo identity for the trust-anchor read");
6750
- const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
6829
+ const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
6751
6830
  return stdout;
6752
6831
  }
6753
6832
  function firstLine(err) {
@@ -6821,9 +6900,9 @@ function loadConfig() {
6821
6900
  var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
6822
6901
 
6823
6902
  // src/lib/brief-assembly.ts
6824
- import { execFileSync as execFileSync4 } from "node:child_process";
6825
- import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync } from "node:fs";
6826
- import { join as join3 } from "node:path";
6903
+ import { execFileSync as execFileSync5 } from "node:child_process";
6904
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
6905
+ import { join as join4 } from "node:path";
6827
6906
 
6828
6907
  // ../../packages/sources/src/commands.ts
6829
6908
  var COMMANDS = [
@@ -7329,6 +7408,10 @@ var COMMANDS = [
7329
7408
  flag: "--role <name>",
7330
7409
  description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
7331
7410
  },
7411
+ {
7412
+ flag: "--template <name>",
7413
+ description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
7414
+ },
7332
7415
  {
7333
7416
  flag: "--print",
7334
7417
  description: "Emit the resolved file's body (frontmatter stripped) instead of its path — the one-hop mode every generated skill and slash command invokes. A role file whose frontmatter carries an `ack-token` emits that token as the output's own first line."
@@ -7513,6 +7596,17 @@ var COMMANDS = [
7513
7596
  "issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
7514
7597
  ],
7515
7598
  status: "shipped"
7599
+ },
7600
+ {
7601
+ name: "log send",
7602
+ description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
7603
+ flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
7604
+ details: [
7605
+ "For a run whose events ended up on local disk instead of the configured server — an unattended run that fell back to the local folder because the trust-anchor read could not confirm its `logs.url` (a developer machine slower than the read deadline, or genuinely offline), or a retry queue holding a backlog or a `.draining.ndjson` a dead drain left behind. It moves the local folder's events into the retry queue and drains every queue for this repository through the SAME webhook delivery a live event uses.",
7606
+ "It resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — never a URL passed on the command line. A repository whose destination is a folder (or none) has nothing to send to a server and the command says so.",
7607
+ "Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
7608
+ ],
7609
+ status: "shipped"
7516
7610
  }
7517
7611
  ];
7518
7612
  // ../../packages/sources/src/forge-adapter.ts
@@ -7664,13 +7758,47 @@ function packageRoot(moduleUrl) {
7664
7758
  return dir;
7665
7759
  }
7666
7760
 
7761
+ // src/commands/doctrine.ts
7762
+ import { execFileSync as execFileSync4 } from "node:child_process";
7763
+ import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
7764
+ import { dirname as dirname3, join as join3, sep } from "node:path";
7765
+ import matter2 from "gray-matter";
7766
+ var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
7767
+ function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
7768
+ return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
7769
+ }
7770
+ function gitToplevel(cwd) {
7771
+ try {
7772
+ return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
7773
+ encoding: "utf8",
7774
+ stdio: ["ignore", "pipe", "pipe"]
7775
+ }).trim();
7776
+ } catch {
7777
+ return null;
7778
+ }
7779
+ }
7780
+ function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
7781
+ const toplevel = gitToplevel(cwd);
7782
+ if (toplevel !== null) {
7783
+ const treeRoot = join3(toplevel, "aeg-root");
7784
+ if (existsSync3(join3(treeRoot, "roles")))
7785
+ return { root: treeRoot, source: "tree" };
7786
+ }
7787
+ const fromSource = !pkg.split(sep).includes("node_modules");
7788
+ const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
7789
+ return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
7790
+ }
7791
+ function hasDoctrineEntry(root) {
7792
+ return existsSync3(join3(root, ...ENTRY_SEGMENTS));
7793
+ }
7794
+
7667
7795
  // src/lib/brief-assembly.ts
7668
7796
  var PACKAGE_ROOT = packageRoot(import.meta.url);
7669
- var PACKAGED_TEMPLATE_PATH = join3(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7670
- var TEMPLATE_PATH = existsSync3(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join3(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7797
+ var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7798
+ var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7671
7799
  function git(args) {
7672
7800
  try {
7673
- return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
7801
+ return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
7674
7802
  } catch {
7675
7803
  return "";
7676
7804
  }
@@ -7683,14 +7811,14 @@ function expandGlob(glob) {
7683
7811
  var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
7684
7812
 
7685
7813
  // src/checks/registry.ts
7686
- import { existsSync as existsSync4 } from "node:fs";
7687
- import { join as join4 } from "node:path";
7688
- var DIST_BIN_DIR = join4(packageRoot(import.meta.url), "dist", "checks", "bin");
7689
- var SRC_BIN_DIR = join4(packageRoot(import.meta.url), "src", "checks", "bin");
7690
- var BIN_DIR = existsSync4(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
7814
+ import { existsSync as existsSync5 } from "node:fs";
7815
+ import { join as join5 } from "node:path";
7816
+ var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
7817
+ var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
7818
+ var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
7691
7819
  var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
7692
7820
  function bin(name) {
7693
- return join4(BIN_DIR, `${name}${BIN_EXT}`);
7821
+ return join5(BIN_DIR, `${name}${BIN_EXT}`);
7694
7822
  }
7695
7823
  var REGISTRY = [
7696
7824
  [
@@ -8254,21 +8382,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
8254
8382
  import {
8255
8383
  closeSync as closeSync3,
8256
8384
  constants as fsConstants3,
8257
- existsSync as existsSync6,
8385
+ existsSync as existsSync7,
8258
8386
  fstatSync as fstatSync2,
8259
8387
  mkdirSync as mkdirSync3,
8260
8388
  openSync as openSync3,
8261
- readFileSync as readFileSync5,
8389
+ readFileSync as readFileSync6,
8262
8390
  renameSync as renameSync2,
8263
8391
  writeSync as writeSync2
8264
8392
  } from "node:fs";
8265
8393
  import { hostname as osHostname, homedir as homedir3 } from "node:os";
8266
- import { dirname as dirname5, join as join7 } from "node:path";
8394
+ import { dirname as dirname6, join as join8 } from "node:path";
8267
8395
  import { promisify as promisify5 } from "node:util";
8268
8396
 
8269
8397
  // src/lib/run-paths.ts
8270
- import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
8271
- import { dirname as dirname3, join as join5, resolve as resolvePath } from "node:path";
8398
+ import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
8399
+ import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
8272
8400
  var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
8273
8401
  function isSafeRepoSegment(segment) {
8274
8402
  return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
@@ -8279,7 +8407,7 @@ function repoSegment(repo) {
8279
8407
  return `${repo.owner}-${repo.repo}`;
8280
8408
  }
8281
8409
  function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
8282
- return join5(home, "runtime", repoSegment(repo));
8410
+ return join6(home, "runtime", repoSegment(repo));
8283
8411
  }
8284
8412
  function resolveRuntimeDir(input) {
8285
8413
  const local = resolveRuntimeDirSetting(input.localConfig);
@@ -8339,9 +8467,9 @@ function repoRootSync(start = process.cwd()) {
8339
8467
  return null;
8340
8468
  }
8341
8469
  for (;; ) {
8342
- if (existsSync5(join5(dir, ".git")))
8470
+ if (existsSync6(join6(dir, ".git")))
8343
8471
  return dir;
8344
- const parent = dirname3(dir);
8472
+ const parent = dirname4(dir);
8345
8473
  if (parent === dir)
8346
8474
  return null;
8347
8475
  dir = parent;
@@ -8356,7 +8484,7 @@ import {
8356
8484
  mkdirSync as mkdirSync2,
8357
8485
  openSync as openSync2,
8358
8486
  linkSync,
8359
- readFileSync as readFileSync4,
8487
+ readFileSync as readFileSync5,
8360
8488
  renameSync,
8361
8489
  statSync,
8362
8490
  unlinkSync,
@@ -8366,7 +8494,7 @@ import {
8366
8494
  } from "node:fs";
8367
8495
  import { randomUUID } from "node:crypto";
8368
8496
  import { homedir as homedir2 } from "node:os";
8369
- import { dirname as dirname4, join as join6 } from "node:path";
8497
+ import { dirname as dirname5, join as join7 } from "node:path";
8370
8498
  var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
8371
8499
  var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
8372
8500
  var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
@@ -8382,7 +8510,7 @@ function isEnoent(err) {
8382
8510
  var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
8383
8511
  function tryCreateLock(lockPath, token) {
8384
8512
  try {
8385
- mkdirSync2(dirname4(lockPath), { recursive: true, mode: 448 });
8513
+ mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
8386
8514
  const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
8387
8515
  try {
8388
8516
  writeSync(fd, `${token}
@@ -8447,7 +8575,7 @@ function acquireDrainLock(lockPath) {
8447
8575
  function renewDrainLock(lockPath, token) {
8448
8576
  let holder;
8449
8577
  try {
8450
- holder = readFileSync4(lockPath, "utf8").trim();
8578
+ holder = readFileSync5(lockPath, "utf8").trim();
8451
8579
  } catch (err) {
8452
8580
  if (!isEnoent(err))
8453
8581
  throw err;
@@ -8467,7 +8595,7 @@ function renewDrainLock(lockPath, token) {
8467
8595
  }
8468
8596
  function releaseDrainLock(lockPath, token) {
8469
8597
  try {
8470
- const holder = readFileSync4(lockPath, "utf8").trim();
8598
+ const holder = readFileSync5(lockPath, "utf8").trim();
8471
8599
  if (holder !== token)
8472
8600
  return;
8473
8601
  unlinkSync(lockPath);
@@ -8517,7 +8645,7 @@ function queueLines(buf) {
8517
8645
  return lines;
8518
8646
  }
8519
8647
  function removeQueueHead(path, cut) {
8520
- const remaining = readFileSync4(path);
8648
+ const remaining = readFileSync5(path);
8521
8649
  writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
8522
8650
  }
8523
8651
  function queueBucketSize(path) {
@@ -8538,7 +8666,7 @@ function queueBucketSize(path) {
8538
8666
  function readQueueFile(path) {
8539
8667
  if (queueBucketSize(path) === null)
8540
8668
  return null;
8541
- return readFileSync4(path);
8669
+ return readFileSync5(path);
8542
8670
  }
8543
8671
  function rejectLine(rejectedPath, reason, status, identity, raw) {
8544
8672
  const record = JSON.stringify({
@@ -8653,7 +8781,7 @@ async function drainRenamedAside(args, livePath, source) {
8653
8781
  async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
8654
8782
  const resolved = await resolveRepo();
8655
8783
  const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
8656
- const outboxRoot = () => join6(GLOBAL_VINAYA_HOME, "outbox");
8784
+ const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
8657
8785
  const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
8658
8786
  const lockPath = `${path}.flush-lock`;
8659
8787
  const lockToken = acquireDrainLock(lockPath);
@@ -8690,7 +8818,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
8690
8818
 
8691
8819
  // src/lib/log-sink.ts
8692
8820
  var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
8821
+ function describeFolderFallback(reason) {
8822
+ if (reason.kind === "anchor-unreadable") {
8823
+ return `not delivering to the configured log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json could not be read to confirm it (the trust-anchor read via `gh` was offline, " + "unauthenticated, or slower than its deadline); events are written to the local folder and can be " + "delivered later with `vinaya log send`";
8824
+ }
8825
+ return `not delivering to the working-tree log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json does not declare it, so an unattended run does not honour it (a pull request cannot " + "redirect telemetry); events are written to the local folder";
8826
+ }
8693
8827
  var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
8828
+ var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
8694
8829
  function withDeadline(work, ms, fallback) {
8695
8830
  return new Promise((resolve) => {
8696
8831
  const timer = setTimeout(() => resolve(fallback), ms);
@@ -8705,7 +8840,7 @@ function withDeadline(work, ms, fallback) {
8705
8840
  });
8706
8841
  }
8707
8842
  async function safeLoadTrustAnchorConfig() {
8708
- return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
8843
+ return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
8709
8844
  }
8710
8845
  function logsCredentialMissing(headers, env) {
8711
8846
  if (!headers)
@@ -8722,8 +8857,16 @@ function logsCredentialMissing(headers, env) {
8722
8857
  function resolveLogDestinationFrom(input) {
8723
8858
  const local = resolveLogsSetting(input.localConfig);
8724
8859
  let effective = null;
8860
+ let fallbackReason;
8725
8861
  if (input.unattended) {
8726
- effective = local ? resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig) : resolveLogsSetting(input.trustAnchorConfig);
8862
+ if (local) {
8863
+ effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
8864
+ if (effective === null && "url" in local) {
8865
+ fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
8866
+ }
8867
+ } else {
8868
+ effective = resolveLogsSetting(input.trustAnchorConfig);
8869
+ }
8727
8870
  } else {
8728
8871
  effective = local;
8729
8872
  }
@@ -8749,7 +8892,7 @@ function resolveLogDestinationFrom(input) {
8749
8892
  effective = null;
8750
8893
  }
8751
8894
  const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
8752
- return { kind: "folder", folder };
8895
+ return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
8753
8896
  }
8754
8897
  var processTrustAnchorOnce;
8755
8898
  function processTrustAnchor() {
@@ -8765,7 +8908,7 @@ async function defaultResolveLogDestination(repo, env) {
8765
8908
  trustAnchorConfig: unattended ? await processTrustAnchor() : null,
8766
8909
  unattended,
8767
8910
  env,
8768
- defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
8911
+ defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
8769
8912
  repoRoot: repoRootSync()
8770
8913
  });
8771
8914
  }
@@ -8780,7 +8923,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
8780
8923
  } catch (err) {
8781
8924
  return isEnoent2(err) ? "unknown" : vinayaVersion;
8782
8925
  }
8783
- if (!existsSync6(join7(toplevel, "aeg-root", "roles")))
8926
+ if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
8784
8927
  return vinayaVersion;
8785
8928
  try {
8786
8929
  const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
@@ -8789,9 +8932,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
8789
8932
  return vinayaVersion;
8790
8933
  }
8791
8934
  }
8935
+ var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
8936
+ function taskRefFromBranch2(branch) {
8937
+ const backlog = /^task\/issue-(\d+)$/.exec(branch);
8938
+ if (backlog) {
8939
+ const issue = Number(backlog[1]);
8940
+ return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
8941
+ }
8942
+ const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
8943
+ if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
8944
+ return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
8945
+ }
8946
+ return null;
8947
+ }
8948
+ var TRANCHE_ISSUE_LIST_LIMIT = 200;
8949
+ async function issueForTrancheTask(tranche, taskId, cwd, repo) {
8950
+ let stdout;
8951
+ try {
8952
+ ({ stdout } = await execFileAsync5("gh", [
8953
+ "issue",
8954
+ "list",
8955
+ "--state",
8956
+ "all",
8957
+ "--label",
8958
+ `vinaya/tranche:${tranche}`,
8959
+ "--json",
8960
+ "number,title,labels",
8961
+ "--limit",
8962
+ String(TRANCHE_ISSUE_LIST_LIMIT),
8963
+ ...repo === null ? [] : ["--repo", repo]
8964
+ ], {
8965
+ cwd,
8966
+ encoding: "utf8",
8967
+ maxBuffer: 8 * 1024 * 1024,
8968
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8969
+ killSignal: "SIGKILL"
8970
+ }));
8971
+ } catch {
8972
+ return null;
8973
+ }
8974
+ let issues;
8975
+ try {
8976
+ issues = JSON.parse(stdout);
8977
+ } catch {
8978
+ return null;
8979
+ }
8980
+ for (const issue of issues) {
8981
+ const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
8982
+ if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
8983
+ return issue.number;
8984
+ }
8985
+ return null;
8986
+ }
8987
+ async function confirmBacklogIssue(issue, cwd, repo) {
8988
+ let stdout;
8989
+ try {
8990
+ ({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
8991
+ cwd,
8992
+ encoding: "utf8",
8993
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8994
+ killSignal: "SIGKILL"
8995
+ }));
8996
+ } catch (err) {
8997
+ const stderr = typeof err.stderr === "string" ? err.stderr : "";
8998
+ return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
8999
+ }
9000
+ try {
9001
+ return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
9002
+ } catch {
9003
+ return "unknown";
9004
+ }
9005
+ }
9006
+ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
9007
+ let branch;
9008
+ try {
9009
+ branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
9010
+ encoding: "utf8",
9011
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
9012
+ killSignal: "SIGKILL"
9013
+ })).stdout.trim();
9014
+ } catch {
9015
+ return null;
9016
+ }
9017
+ const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
9018
+ const ref = taskRefFromBranch2(named);
9019
+ if (ref === null)
9020
+ return null;
9021
+ if (ref.kind === "tranche")
9022
+ return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
9023
+ return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
9024
+ }
8792
9025
  function readVinayaVersion() {
8793
9026
  try {
8794
- const pkg = JSON.parse(readFileSync5(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
9027
+ const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
8795
9028
  return pkg.version ?? "unknown";
8796
9029
  } catch {
8797
9030
  return "unknown";
@@ -8801,10 +9034,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
8801
9034
  function isSafeRepoSegment3(segment) {
8802
9035
  return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
8803
9036
  }
9037
+ function safeRepoSlug(repo) {
9038
+ if (repo === null)
9039
+ return null;
9040
+ return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
9041
+ }
8804
9042
  function outboxPathFor(deps, repo, issue) {
8805
9043
  const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
8806
9044
  const fileName = `${issue ?? "none"}.ndjson`;
8807
- return join7(deps.outboxRoot(), dirName, fileName);
9045
+ return join8(deps.outboxRoot(), dirName, fileName);
8808
9046
  }
8809
9047
  function hostFromEnv(env) {
8810
9048
  if (env.GITHUB_ACTIONS)
@@ -8822,9 +9060,21 @@ function defaultStderr(message) {
8822
9060
  warnedThisProcess = true;
8823
9061
  process.stderr.write(message);
8824
9062
  }
9063
+ var branchIssueFallbackEnabled = true;
9064
+ var branchIssueByCwd = new Map;
9065
+ function branchIssueRead(key, read, shared) {
9066
+ if (!shared)
9067
+ return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
9068
+ const cached = branchIssueByCwd.get(key);
9069
+ if (cached !== undefined)
9070
+ return cached;
9071
+ const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
9072
+ branchIssueByCwd.set(key, reading);
9073
+ return reading;
9074
+ }
8825
9075
  function defaultDeps() {
8826
9076
  return {
8827
- outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
9077
+ outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
8828
9078
  home: () => homedir3(),
8829
9079
  hostname: () => osHostname(),
8830
9080
  cwd: () => process.cwd(),
@@ -8849,7 +9099,7 @@ function guardedAppendOpen(path) {
8849
9099
  }
8850
9100
  function appendHardenedLine(path, line) {
8851
9101
  try {
8852
- mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
9102
+ mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
8853
9103
  const fd = guardedAppendOpen(path);
8854
9104
  if (fd === undefined)
8855
9105
  return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
@@ -8868,7 +9118,7 @@ function appendHardenedLine(path, line) {
8868
9118
  function reportRotationOverflow(backupPath, warn) {
8869
9119
  let raw;
8870
9120
  try {
8871
- raw = readFileSync5(backupPath, "utf8");
9121
+ raw = readFileSync6(backupPath, "utf8");
8872
9122
  } catch {
8873
9123
  return;
8874
9124
  }
@@ -8891,7 +9141,7 @@ function reportRotationOverflow(backupPath, warn) {
8891
9141
  }
8892
9142
  function appendLine(path, line, warn) {
8893
9143
  try {
8894
- mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
9144
+ mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
8895
9145
  let fd = guardedAppendOpen(path);
8896
9146
  if (fd === undefined) {
8897
9147
  warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
@@ -8932,7 +9182,11 @@ function appendLine(path, line, warn) {
8932
9182
  }
8933
9183
  }
8934
9184
  function createLogSink(overrides = {}) {
8935
- const deps = { ...defaultDeps(), ...overrides };
9185
+ const deps = {
9186
+ ...defaultDeps(),
9187
+ resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
9188
+ ...overrides
9189
+ };
8936
9190
  const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
8937
9191
  const processId = randomUUID2();
8938
9192
  let seq = 0;
@@ -8952,6 +9206,19 @@ function createLogSink(overrides = {}) {
8952
9206
  }
8953
9207
  return doctrineCache;
8954
9208
  };
9209
+ const readerIsReal = overrides.resolveBranchIssue === undefined;
9210
+ let ownBranchIssue;
9211
+ const branchIssueOnce = (repo) => {
9212
+ if (!branchIssueFallbackEnabled)
9213
+ return Promise.resolve(null);
9214
+ const slug = safeRepoSlug(repo);
9215
+ const read = () => deps.resolveBranchIssue(slug);
9216
+ if (readerIsReal)
9217
+ return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
9218
+ if (ownBranchIssue === undefined)
9219
+ ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
9220
+ return ownBranchIssue;
9221
+ };
8955
9222
  let resolveRepoCache;
8956
9223
  const resolveRepoOnce = () => {
8957
9224
  if (resolveRepoCache === undefined)
@@ -8974,6 +9241,7 @@ function createLogSink(overrides = {}) {
8974
9241
  };
8975
9242
  let drainChain = Promise.resolve();
8976
9243
  const pendingWrites = new Set;
9244
+ let writeChain = Promise.resolve();
8977
9245
  const scheduleWebhookDrain = (issue, url, headers) => {
8978
9246
  drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
8979
9247
  return;
@@ -8996,7 +9264,18 @@ function createLogSink(overrides = {}) {
8996
9264
  attempt: env.VINAYA_ATTEMPT,
8997
9265
  parent: env.VINAYA_PARENT_EVENT
8998
9266
  };
8999
- const written = context().then(({ repo, doctrine: doctrineValue, destination: resolvedDestination }) => {
9267
+ const write = async () => {
9268
+ const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
9269
+ if (resolvedDestination.kind === "none") {
9270
+ warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
9271
+ `);
9272
+ return;
9273
+ }
9274
+ if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
9275
+ warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
9276
+ `);
9277
+ }
9278
+ const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
9000
9279
  const header = buildHeader({
9001
9280
  now,
9002
9281
  runId,
@@ -9007,15 +9286,11 @@ function createLogSink(overrides = {}) {
9007
9286
  host,
9008
9287
  hostname: deps.hostname(),
9009
9288
  env: envFields,
9289
+ branchIssue,
9010
9290
  eventId: randomUUID2(),
9011
9291
  processId,
9012
9292
  inputVersions: deps.inputVersions()
9013
9293
  });
9014
- if (resolvedDestination.kind === "none") {
9015
- warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
9016
- `);
9017
- return;
9018
- }
9019
9294
  const full = { ...e, ...header };
9020
9295
  const parsed = LogEventSchema.safeParse(full);
9021
9296
  if (!parsed.success) {
@@ -9032,10 +9307,12 @@ function createLogSink(overrides = {}) {
9032
9307
  } else {
9033
9308
  appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
9034
9309
  }
9035
- }).catch((err) => {
9310
+ };
9311
+ const written = writeChain.then(write).catch((err) => {
9036
9312
  warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
9037
9313
  `);
9038
9314
  });
9315
+ writeChain = written;
9039
9316
  pendingWrites.add(written);
9040
9317
  written.finally(() => pendingWrites.delete(written));
9041
9318
  } catch (err) {
@@ -9111,7 +9388,7 @@ function parseChangedLineRanges(diffOutput) {
9111
9388
  function fileDiffAgainst(ref, path) {
9112
9389
  let out;
9113
9390
  try {
9114
- out = execFileSync5("git", ["diff", `${ref}...HEAD`, "--", path], {
9391
+ out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
9115
9392
  encoding: "utf8",
9116
9393
  stdio: ["ignore", "pipe", "pipe"]
9117
9394
  }).trim();
@@ -9122,7 +9399,7 @@ function fileDiffAgainst(ref, path) {
9122
9399
  }
9123
9400
  function revParse(ref) {
9124
9401
  try {
9125
- return execFileSync5("git", ["rev-parse", "--verify", ref], {
9402
+ return execFileSync6("git", ["rev-parse", "--verify", ref], {
9126
9403
  encoding: "utf8",
9127
9404
  stdio: ["ignore", "pipe", "pipe"]
9128
9405
  }).trim();
@@ -9132,7 +9409,7 @@ function revParse(ref) {
9132
9409
  }
9133
9410
  function repoRoot() {
9134
9411
  try {
9135
- return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
9412
+ return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
9136
9413
  encoding: "utf8",
9137
9414
  stdio: ["ignore", "pipe", "pipe"]
9138
9415
  }).trim();
@@ -9143,7 +9420,7 @@ function repoRoot() {
9143
9420
  function changedFiles(base) {
9144
9421
  let out;
9145
9422
  try {
9146
- out = execFileSync5("git", ["diff", "--name-only", `${base}...HEAD`], {
9423
+ out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
9147
9424
  encoding: "utf8",
9148
9425
  stdio: ["ignore", "pipe", "pipe"]
9149
9426
  }).trim();
@@ -9168,7 +9445,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
9168
9445
  const relPaths = changedFiles(ref);
9169
9446
  if (relPaths === null)
9170
9447
  continue;
9171
- return { base: ref, root, files: relPaths.map((p) => join8(root, p)) };
9448
+ return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
9172
9449
  }
9173
9450
  return null;
9174
9451
  }
@@ -9210,14 +9487,14 @@ function isTestFile(path) {
9210
9487
  function collectAllPaths(dir, out = []) {
9211
9488
  let entries;
9212
9489
  try {
9213
- entries = readdirSync2(dir);
9490
+ entries = readdirSync3(dir);
9214
9491
  } catch {
9215
9492
  return out;
9216
9493
  }
9217
9494
  for (const name of entries) {
9218
9495
  if (EXCLUDED_DIRS.has(name))
9219
9496
  continue;
9220
- const full = join9(dir, name);
9497
+ const full = join10(dir, name);
9221
9498
  let isDir;
9222
9499
  try {
9223
9500
  isDir = statSync2(full).isDirectory();
@@ -9233,7 +9510,7 @@ function collectAllPaths(dir, out = []) {
9233
9510
  function main() {
9234
9511
  const allPaths = WORKSPACE_DIRS.flatMap((d) => collectAllPaths(d)).map((p) => p.split("\\").join("/"));
9235
9512
  const knownPaths = new Set(allPaths);
9236
- const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content: readFileSync6(p, "utf8") }));
9513
+ const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content: readFileSync7(p, "utf8") }));
9237
9514
  const findings = findWorkspaceEscapes(sourceFiles, knownPaths, WORKSPACE_DIRS);
9238
9515
  const reportable = findingsInThisDiff(findings);
9239
9516
  console.log(`${CHECK_NAME}: ${sourceFiles.length} source file(s) scanned under ${WORKSPACE_DIRS.join("/")}; ${findings.length} finding(s), ${reportable.length} in this diff`);