@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
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/checks/bin/check-changeset-coverage.ts
4
- import { execFileSync as execFileSync6 } from "node:child_process";
5
- import { readdirSync as readdirSync2, readFileSync as readFileSync6 } from "node:fs";
6
- import { join as join9, relative as relative2 } from "node:path";
4
+ import { execFileSync as execFileSync7 } from "node:child_process";
5
+ import { readdirSync as readdirSync3, readFileSync as readFileSync7 } from "node:fs";
6
+ import { join as join10, relative as relative2 } from "node:path";
7
7
  // ../../packages/aeg-core/src/gate-audience.ts
8
8
  var GATE_AUDIENCE = {
9
9
  "check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
@@ -198,8 +198,8 @@ function maskIndentedCode(body, fill) {
198
198
  var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
199
199
  var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
200
200
  var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
201
- var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
202
- var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
201
+ var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
202
+ var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
203
203
  function splitSlugQualifiedEdge(edge) {
204
204
  const m = edge.trim().match(SLUG_QUALIFIED_ID);
205
205
  if (!m)
@@ -2620,7 +2620,7 @@ function isIssueNotFoundError(err) {
2620
2620
  return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
2621
2621
  }
2622
2622
  function resolveObjectivesSource(prBody, issue, cutoverIssue) {
2623
- if (issue !== null && issue < cutoverIssue)
2623
+ if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
2624
2624
  return { kind: "none" };
2625
2625
  if (issue !== null)
2626
2626
  return { kind: "issue", issue };
@@ -2896,9 +2896,18 @@ var COMMIT_TYPES = [
2896
2896
  ];
2897
2897
  var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
2898
2898
  function checkForgeTitle(title) {
2899
- const taskStyle = /^\[[a-z0-9._-]+\] \S+ — \S/;
2899
+ const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
2900
2900
  if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
2901
2901
  return { status: "pass", errors: [] };
2902
+ const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
2903
+ if (letteredTaskId) {
2904
+ return {
2905
+ status: "fail",
2906
+ errors: [
2907
+ `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.`
2908
+ ]
2909
+ };
2910
+ }
2902
2911
  return {
2903
2912
  status: "fail",
2904
2913
  errors: [
@@ -2931,19 +2940,31 @@ function checkNoAgentBoxes(prBody) {
2931
2940
  ]
2932
2941
  };
2933
2942
  }
2934
- function rolloutThresholdFor(message) {
2943
+ function rolloutRuleFor(message) {
2935
2944
  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:")) {
2936
- return BRIEF_RULES_SINCE_PR;
2945
+ return "briefRules";
2937
2946
  }
2938
2947
  if (message.startsWith("brief-validation no agent boxes:"))
2939
- return AGENT_BOXES_REFUSED_SINCE_PR;
2948
+ return "agentBoxes";
2940
2949
  return null;
2941
2950
  }
2942
- function partitionBriefErrorsByRollout(errors, prNumber) {
2951
+ var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
2952
+ briefRulesSincePr: BRIEF_RULES_SINCE_PR,
2953
+ agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
2954
+ };
2955
+ function rolloutThresholdFor(message, cutovers) {
2956
+ const rule = rolloutRuleFor(message);
2957
+ if (rule === "briefRules")
2958
+ return cutovers.briefRulesSincePr;
2959
+ if (rule === "agentBoxes")
2960
+ return cutovers.agentBoxesRefusedSincePr;
2961
+ return null;
2962
+ }
2963
+ function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
2943
2964
  const blocking = [];
2944
2965
  const info = [];
2945
2966
  for (const e of errors) {
2946
- const threshold = rolloutThresholdFor(e);
2967
+ const threshold = rolloutThresholdFor(e, cutovers);
2947
2968
  const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
2948
2969
  (grandfathered ? info : blocking).push(e);
2949
2970
  }
@@ -3411,8 +3432,8 @@ function checkIssueRationale(body) {
3411
3432
  return { status: errors.length > 0 ? "fail" : "pass", errors };
3412
3433
  }
3413
3434
  var OBJECTIVES_SINCE_ISSUE = 404;
3414
- function checkIssueObjectives(body, issueNumber) {
3415
- if (issueNumber !== null && issueNumber < OBJECTIVES_SINCE_ISSUE)
3435
+ function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
3436
+ if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
3416
3437
  return { status: "pass", errors: [] };
3417
3438
  const result = objectivesOf(body);
3418
3439
  if (result.ok)
@@ -3488,6 +3509,8 @@ function parseIssueSurface(body) {
3488
3509
  function globCoversPath(glob, path) {
3489
3510
  const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
3490
3511
  const p = path.replace(/\/+$/, "");
3512
+ if (g === "*")
3513
+ return !p.includes("/");
3491
3514
  return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
3492
3515
  }
3493
3516
  function checkSurfaceGlobsResolve(body, resolvesToFile) {
@@ -3857,7 +3880,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
3857
3880
  return issueToEntry.get(Number(issueMatch[1]));
3858
3881
  return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
3859
3882
  }
3860
- function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
3883
+ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
3861
3884
  const failures = [];
3862
3885
  for (const [slug, issues] of issuesBySlug) {
3863
3886
  for (const issue of issues) {
@@ -3866,7 +3889,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
3866
3889
  const errors = [
3867
3890
  ...checkIssueRationale(issue.body).errors,
3868
3891
  ...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
3869
- ...checkIssueObjectives(issue.body, issue.number).errors,
3892
+ ...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
3870
3893
  ...checkPartsCiteDefinedObjectives(issue.body).errors
3871
3894
  ];
3872
3895
  if (errors.length === 0)
@@ -4489,13 +4512,27 @@ var SHIPS_PREFIX = "aeg-root/";
4489
4512
  function shipsArchivePrefix(shipsPrefix) {
4490
4513
  return `${shipsPrefix}tranches/completed/`;
4491
4514
  }
4492
- function isSpecFile2(path) {
4493
- return path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md");
4515
+ var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
4516
+ function normalizeSpecPath(entry) {
4517
+ let out = entry.replace(/\\/g, "/");
4518
+ while (out.startsWith("./"))
4519
+ out = out.slice(2);
4520
+ out = out.replace(/\/{2,}/g, "/");
4521
+ while (out.endsWith("/"))
4522
+ out = out.slice(0, -1);
4523
+ return out;
4524
+ }
4525
+ function isSpecFile2(path, specPaths) {
4526
+ if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
4527
+ return true;
4528
+ if (!path.endsWith(".md"))
4529
+ return false;
4530
+ return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
4494
4531
  }
4495
4532
  function isClaudeMdFile(path) {
4496
4533
  return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
4497
4534
  }
4498
- function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
4535
+ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
4499
4536
  if (path.startsWith(shipsPrefix)) {
4500
4537
  return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
4501
4538
  }
@@ -4504,7 +4541,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
4504
4541
  }
4505
4542
  if (isClaudeMdFile(path))
4506
4543
  return "internal";
4507
- if (isSpecFile2(path))
4544
+ if (isSpecFile2(path, specPaths))
4508
4545
  return "spec";
4509
4546
  if (isProductScopeFile(path))
4510
4547
  return "product";
@@ -4533,13 +4570,14 @@ function lineAt(content, index) {
4533
4570
  }
4534
4571
  var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
4535
4572
  var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
4573
+ var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
4536
4574
  function legacySlugPattern(legacySlugs) {
4537
4575
  if (legacySlugs.length === 0)
4538
4576
  return null;
4539
4577
  const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
4540
4578
  return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
4541
4579
  }
4542
- function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
4580
+ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4543
4581
  const findings = [];
4544
4582
  const legacyPattern = legacySlugPattern(legacySlugs);
4545
4583
  const grandfathered = new Set(specGrandfather);
@@ -4551,8 +4589,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
4551
4589
  const productPatterns = [
4552
4590
  { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
4553
4591
  ];
4592
+ const specPatterns = [
4593
+ ...patterns,
4594
+ { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
4595
+ ];
4554
4596
  for (const file of files) {
4555
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
4597
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
4556
4598
  if (!cls || cls === "internal")
4557
4599
  continue;
4558
4600
  if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
@@ -4561,15 +4603,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
4561
4603
  continue;
4562
4604
  const blocking = cls === "product" || cls === "spec";
4563
4605
  const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
4564
- const patternsToRun = cls === "product" ? productPatterns : patterns;
4606
+ const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
4565
4607
  for (const { pattern, what, group } of patternsToRun) {
4566
4608
  pattern.lastIndex = 0;
4567
4609
  let match = pattern.exec(scrubbed);
4568
4610
  while (match !== null) {
4569
4611
  const cited = group !== undefined ? match[group] ?? match[0] : match[0];
4612
+ const citedIndex = match.index + match[0].indexOf(cited);
4570
4613
  findings.push({
4571
4614
  file: file.path,
4572
- line: lineAt(scrubbed, match.index),
4615
+ line: lineAt(scrubbed, citedIndex),
4573
4616
  message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4574
4617
  blocking
4575
4618
  });
@@ -4755,9 +4798,9 @@ function checkSourceComments(files, allowlist = []) {
4755
4798
  }
4756
4799
  return findings;
4757
4800
  }
4758
- function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
4801
+ function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4759
4802
  return [
4760
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
4803
+ ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
4761
4804
  ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
4762
4805
  ];
4763
4806
  }
@@ -5222,7 +5265,8 @@ var TaskStatusItemSchema = z.object({
5222
5265
  }).merge(ObservedSchema);
5223
5266
  var TaskStatusResultSchema = z.object({
5224
5267
  items: z.array(TaskStatusItemSchema),
5225
- nextCursor: z.string().nullable()
5268
+ nextCursor: z.string().nullable(),
5269
+ table: z.string()
5226
5270
  });
5227
5271
  var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
5228
5272
  var EscalationInputsSchema = z.object({
@@ -5566,6 +5610,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5566
5610
  }
5567
5611
  return findings;
5568
5612
  }
5613
+ // ../../packages/aeg-core/src/gate-cutovers.ts
5614
+ var NO_GATE_CUTOVERS = {
5615
+ objectivesSinceIssue: null,
5616
+ briefSectionsSinceIssue: null,
5617
+ documentationSinceIssue: null,
5618
+ briefRulesSincePr: null,
5619
+ agentBoxesRefusedSincePr: null
5620
+ };
5569
5621
  // ../../packages/aeg-core/src/dev-review-loop/types.ts
5570
5622
  var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5571
5623
  // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
@@ -6015,6 +6067,8 @@ function attemptFromEnv(value) {
6015
6067
  function provenanceFor(input) {
6016
6068
  if (input.provenance)
6017
6069
  return input.provenance;
6070
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
6071
+ return "unavailable";
6018
6072
  if (input.env.role || input.env.task)
6019
6073
  return "env_correlated";
6020
6074
  return "unavailable";
@@ -6035,7 +6089,7 @@ function buildHeader(input) {
6035
6089
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
6036
6090
  const round = roundFromEnv(input.env.round);
6037
6091
  const subject = {
6038
- issue: issueFromTask(input.env.task),
6092
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
6039
6093
  role,
6040
6094
  ...round !== undefined ? { round } : {},
6041
6095
  ...input.subject ?? {}
@@ -6316,8 +6370,8 @@ var ResolutionRecordSchema = z3.object({
6316
6370
  consumedAt: isoTimestamp
6317
6371
  }).strict();
6318
6372
  // src/lib/diff-evidence.ts
6319
- import { execFileSync as execFileSync5 } from "node:child_process";
6320
- import { join as join8, relative, resolve as resolve2 } from "node:path";
6373
+ import { execFileSync as execFileSync6 } from "node:child_process";
6374
+ import { join as join9, relative, resolve as resolve2 } from "node:path";
6321
6375
 
6322
6376
  // src/lib/config.ts
6323
6377
  import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
@@ -6479,7 +6533,12 @@ var VinayaConfigSchema = z4.object({
6479
6533
  allowlist: z4.array(z4.string().min(1)).optional(),
6480
6534
  severity: z4.enum(["warning", "error"]).optional()
6481
6535
  }).optional(),
6482
- specGrandfather: z4.array(z4.string().min(1)).optional()
6536
+ specGrandfather: z4.array(z4.string().min(1)).optional(),
6537
+ specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
6538
+ message: "must be a repository-relative path, not an absolute one"
6539
+ }).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
6540
+ message: "must stay inside the repository — no `..` segment"
6541
+ })).optional()
6483
6542
  }).optional(),
6484
6543
  projects: z4.array(ProjectEntrySchema).optional(),
6485
6544
  dispatch: z4.object({
@@ -6493,6 +6552,13 @@ var VinayaConfigSchema = z4.object({
6493
6552
  securityThreshold: z4.string().min(1).optional(),
6494
6553
  maxRounds: z4.number().optional()
6495
6554
  }).optional(),
6555
+ gateCutovers: z4.object({
6556
+ objectivesSinceIssue: z4.number().int().nonnegative().optional(),
6557
+ briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
6558
+ documentationSinceIssue: z4.number().int().nonnegative().optional(),
6559
+ briefRulesSincePr: z4.number().int().nonnegative().optional(),
6560
+ agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
6561
+ }).optional(),
6496
6562
  prePush: z4.object({
6497
6563
  alwaysRun: z4.array(z4.string()).optional()
6498
6564
  }).optional(),
@@ -6630,6 +6696,18 @@ function resolveReviewPolicy(config) {
6630
6696
  maxRounds
6631
6697
  };
6632
6698
  }
6699
+ function resolveGateCutovers(config) {
6700
+ const raw = config?.gateCutovers;
6701
+ if (!raw)
6702
+ return NO_GATE_CUTOVERS;
6703
+ return {
6704
+ objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
6705
+ briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
6706
+ documentationSinceIssue: raw.documentationSinceIssue ?? null,
6707
+ briefRulesSincePr: raw.briefRulesSincePr ?? null,
6708
+ agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
6709
+ };
6710
+ }
6633
6711
  function resolveRuntimeDirSetting(config) {
6634
6712
  return config?.runtimeDir ?? null;
6635
6713
  }
@@ -6685,7 +6763,8 @@ async function trustAnchorRepoAsync() {
6685
6763
  try {
6686
6764
  const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
6687
6765
  encoding: "utf-8",
6688
- timeout: 1e4
6766
+ timeout: 1e4,
6767
+ killSignal: "SIGKILL"
6689
6768
  });
6690
6769
  return trustAnchorRepoFromRemoteUrl(stdout);
6691
6770
  } catch {
@@ -6746,7 +6825,7 @@ async function ghFetchTrustAnchorConfigAsync() {
6746
6825
  const repo = await trustAnchorRepoAsync();
6747
6826
  if (!repo)
6748
6827
  throw new Error("could not resolve repo identity for the trust-anchor read");
6749
- const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
6828
+ const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
6750
6829
  return stdout;
6751
6830
  }
6752
6831
  function firstLine(err) {
@@ -6820,9 +6899,9 @@ function loadConfig() {
6820
6899
  var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
6821
6900
 
6822
6901
  // src/lib/brief-assembly.ts
6823
- import { execFileSync as execFileSync4 } from "node:child_process";
6824
- import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync } from "node:fs";
6825
- import { join as join3 } from "node:path";
6902
+ import { execFileSync as execFileSync5 } from "node:child_process";
6903
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
6904
+ import { join as join4 } from "node:path";
6826
6905
 
6827
6906
  // ../../packages/sources/src/commands.ts
6828
6907
  var COMMANDS = [
@@ -7328,6 +7407,10 @@ var COMMANDS = [
7328
7407
  flag: "--role <name>",
7329
7408
  description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
7330
7409
  },
7410
+ {
7411
+ flag: "--template <name>",
7412
+ description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
7413
+ },
7331
7414
  {
7332
7415
  flag: "--print",
7333
7416
  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."
@@ -7512,6 +7595,17 @@ var COMMANDS = [
7512
7595
  "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)."
7513
7596
  ],
7514
7597
  status: "shipped"
7598
+ },
7599
+ {
7600
+ name: "log send",
7601
+ description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
7602
+ flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
7603
+ details: [
7604
+ "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.",
7605
+ "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.",
7606
+ "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."
7607
+ ],
7608
+ status: "shipped"
7515
7609
  }
7516
7610
  ];
7517
7611
  // ../../packages/sources/src/forge-adapter.ts
@@ -7663,13 +7757,47 @@ function packageRoot(moduleUrl) {
7663
7757
  return dir;
7664
7758
  }
7665
7759
 
7760
+ // src/commands/doctrine.ts
7761
+ import { execFileSync as execFileSync4 } from "node:child_process";
7762
+ import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
7763
+ import { dirname as dirname3, join as join3, sep } from "node:path";
7764
+ import matter2 from "gray-matter";
7765
+ var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
7766
+ function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
7767
+ return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
7768
+ }
7769
+ function gitToplevel(cwd) {
7770
+ try {
7771
+ return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
7772
+ encoding: "utf8",
7773
+ stdio: ["ignore", "pipe", "pipe"]
7774
+ }).trim();
7775
+ } catch {
7776
+ return null;
7777
+ }
7778
+ }
7779
+ function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
7780
+ const toplevel = gitToplevel(cwd);
7781
+ if (toplevel !== null) {
7782
+ const treeRoot = join3(toplevel, "aeg-root");
7783
+ if (existsSync3(join3(treeRoot, "roles")))
7784
+ return { root: treeRoot, source: "tree" };
7785
+ }
7786
+ const fromSource = !pkg.split(sep).includes("node_modules");
7787
+ const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
7788
+ return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
7789
+ }
7790
+ function hasDoctrineEntry(root) {
7791
+ return existsSync3(join3(root, ...ENTRY_SEGMENTS));
7792
+ }
7793
+
7666
7794
  // src/lib/brief-assembly.ts
7667
7795
  var PACKAGE_ROOT = packageRoot(import.meta.url);
7668
- var PACKAGED_TEMPLATE_PATH = join3(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7669
- var TEMPLATE_PATH = existsSync3(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join3(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7796
+ var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7797
+ var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7670
7798
  function git(args) {
7671
7799
  try {
7672
- return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
7800
+ return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
7673
7801
  } catch {
7674
7802
  return "";
7675
7803
  }
@@ -7682,14 +7810,14 @@ function expandGlob(glob) {
7682
7810
  var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
7683
7811
 
7684
7812
  // src/checks/registry.ts
7685
- import { existsSync as existsSync4 } from "node:fs";
7686
- import { join as join4 } from "node:path";
7687
- var DIST_BIN_DIR = join4(packageRoot(import.meta.url), "dist", "checks", "bin");
7688
- var SRC_BIN_DIR = join4(packageRoot(import.meta.url), "src", "checks", "bin");
7689
- var BIN_DIR = existsSync4(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
7813
+ import { existsSync as existsSync5 } from "node:fs";
7814
+ import { join as join5 } from "node:path";
7815
+ var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
7816
+ var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
7817
+ var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
7690
7818
  var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
7691
7819
  function bin(name) {
7692
- return join4(BIN_DIR, `${name}${BIN_EXT}`);
7820
+ return join5(BIN_DIR, `${name}${BIN_EXT}`);
7693
7821
  }
7694
7822
  var REGISTRY = [
7695
7823
  [
@@ -8253,21 +8381,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
8253
8381
  import {
8254
8382
  closeSync as closeSync3,
8255
8383
  constants as fsConstants3,
8256
- existsSync as existsSync6,
8384
+ existsSync as existsSync7,
8257
8385
  fstatSync as fstatSync2,
8258
8386
  mkdirSync as mkdirSync3,
8259
8387
  openSync as openSync3,
8260
- readFileSync as readFileSync5,
8388
+ readFileSync as readFileSync6,
8261
8389
  renameSync as renameSync2,
8262
8390
  writeSync as writeSync2
8263
8391
  } from "node:fs";
8264
8392
  import { hostname as osHostname, homedir as homedir3 } from "node:os";
8265
- import { dirname as dirname5, join as join7 } from "node:path";
8393
+ import { dirname as dirname6, join as join8 } from "node:path";
8266
8394
  import { promisify as promisify5 } from "node:util";
8267
8395
 
8268
8396
  // src/lib/run-paths.ts
8269
- import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
8270
- import { dirname as dirname3, join as join5, resolve as resolvePath } from "node:path";
8397
+ import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
8398
+ import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
8271
8399
  var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
8272
8400
  function isSafeRepoSegment(segment) {
8273
8401
  return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
@@ -8278,7 +8406,7 @@ function repoSegment(repo) {
8278
8406
  return `${repo.owner}-${repo.repo}`;
8279
8407
  }
8280
8408
  function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
8281
- return join5(home, "runtime", repoSegment(repo));
8409
+ return join6(home, "runtime", repoSegment(repo));
8282
8410
  }
8283
8411
  function resolveRuntimeDir(input) {
8284
8412
  const local = resolveRuntimeDirSetting(input.localConfig);
@@ -8338,9 +8466,9 @@ function repoRootSync(start = process.cwd()) {
8338
8466
  return null;
8339
8467
  }
8340
8468
  for (;; ) {
8341
- if (existsSync5(join5(dir, ".git")))
8469
+ if (existsSync6(join6(dir, ".git")))
8342
8470
  return dir;
8343
- const parent = dirname3(dir);
8471
+ const parent = dirname4(dir);
8344
8472
  if (parent === dir)
8345
8473
  return null;
8346
8474
  dir = parent;
@@ -8355,7 +8483,7 @@ import {
8355
8483
  mkdirSync as mkdirSync2,
8356
8484
  openSync as openSync2,
8357
8485
  linkSync,
8358
- readFileSync as readFileSync4,
8486
+ readFileSync as readFileSync5,
8359
8487
  renameSync,
8360
8488
  statSync,
8361
8489
  unlinkSync,
@@ -8365,7 +8493,7 @@ import {
8365
8493
  } from "node:fs";
8366
8494
  import { randomUUID } from "node:crypto";
8367
8495
  import { homedir as homedir2 } from "node:os";
8368
- import { dirname as dirname4, join as join6 } from "node:path";
8496
+ import { dirname as dirname5, join as join7 } from "node:path";
8369
8497
  var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
8370
8498
  var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
8371
8499
  var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
@@ -8381,7 +8509,7 @@ function isEnoent(err) {
8381
8509
  var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
8382
8510
  function tryCreateLock(lockPath, token) {
8383
8511
  try {
8384
- mkdirSync2(dirname4(lockPath), { recursive: true, mode: 448 });
8512
+ mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
8385
8513
  const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
8386
8514
  try {
8387
8515
  writeSync(fd, `${token}
@@ -8446,7 +8574,7 @@ function acquireDrainLock(lockPath) {
8446
8574
  function renewDrainLock(lockPath, token) {
8447
8575
  let holder;
8448
8576
  try {
8449
- holder = readFileSync4(lockPath, "utf8").trim();
8577
+ holder = readFileSync5(lockPath, "utf8").trim();
8450
8578
  } catch (err) {
8451
8579
  if (!isEnoent(err))
8452
8580
  throw err;
@@ -8466,7 +8594,7 @@ function renewDrainLock(lockPath, token) {
8466
8594
  }
8467
8595
  function releaseDrainLock(lockPath, token) {
8468
8596
  try {
8469
- const holder = readFileSync4(lockPath, "utf8").trim();
8597
+ const holder = readFileSync5(lockPath, "utf8").trim();
8470
8598
  if (holder !== token)
8471
8599
  return;
8472
8600
  unlinkSync(lockPath);
@@ -8516,7 +8644,7 @@ function queueLines(buf) {
8516
8644
  return lines;
8517
8645
  }
8518
8646
  function removeQueueHead(path, cut) {
8519
- const remaining = readFileSync4(path);
8647
+ const remaining = readFileSync5(path);
8520
8648
  writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
8521
8649
  }
8522
8650
  function queueBucketSize(path) {
@@ -8537,7 +8665,7 @@ function queueBucketSize(path) {
8537
8665
  function readQueueFile(path) {
8538
8666
  if (queueBucketSize(path) === null)
8539
8667
  return null;
8540
- return readFileSync4(path);
8668
+ return readFileSync5(path);
8541
8669
  }
8542
8670
  function rejectLine(rejectedPath, reason, status, identity, raw) {
8543
8671
  const record = JSON.stringify({
@@ -8652,7 +8780,7 @@ async function drainRenamedAside(args, livePath, source) {
8652
8780
  async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
8653
8781
  const resolved = await resolveRepo();
8654
8782
  const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
8655
- const outboxRoot = () => join6(GLOBAL_VINAYA_HOME, "outbox");
8783
+ const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
8656
8784
  const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
8657
8785
  const lockPath = `${path}.flush-lock`;
8658
8786
  const lockToken = acquireDrainLock(lockPath);
@@ -8689,7 +8817,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
8689
8817
 
8690
8818
  // src/lib/log-sink.ts
8691
8819
  var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
8820
+ function describeFolderFallback(reason) {
8821
+ if (reason.kind === "anchor-unreadable") {
8822
+ 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`";
8823
+ }
8824
+ 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";
8825
+ }
8692
8826
  var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
8827
+ var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
8693
8828
  function withDeadline(work, ms, fallback) {
8694
8829
  return new Promise((resolve) => {
8695
8830
  const timer = setTimeout(() => resolve(fallback), ms);
@@ -8704,7 +8839,7 @@ function withDeadline(work, ms, fallback) {
8704
8839
  });
8705
8840
  }
8706
8841
  async function safeLoadTrustAnchorConfig() {
8707
- return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
8842
+ return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
8708
8843
  }
8709
8844
  function logsCredentialMissing(headers, env) {
8710
8845
  if (!headers)
@@ -8721,8 +8856,16 @@ function logsCredentialMissing(headers, env) {
8721
8856
  function resolveLogDestinationFrom(input) {
8722
8857
  const local = resolveLogsSetting(input.localConfig);
8723
8858
  let effective = null;
8859
+ let fallbackReason;
8724
8860
  if (input.unattended) {
8725
- effective = local ? resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig) : resolveLogsSetting(input.trustAnchorConfig);
8861
+ if (local) {
8862
+ effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
8863
+ if (effective === null && "url" in local) {
8864
+ fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
8865
+ }
8866
+ } else {
8867
+ effective = resolveLogsSetting(input.trustAnchorConfig);
8868
+ }
8726
8869
  } else {
8727
8870
  effective = local;
8728
8871
  }
@@ -8748,7 +8891,7 @@ function resolveLogDestinationFrom(input) {
8748
8891
  effective = null;
8749
8892
  }
8750
8893
  const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
8751
- return { kind: "folder", folder };
8894
+ return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
8752
8895
  }
8753
8896
  var processTrustAnchorOnce;
8754
8897
  function processTrustAnchor() {
@@ -8764,7 +8907,7 @@ async function defaultResolveLogDestination(repo, env) {
8764
8907
  trustAnchorConfig: unattended ? await processTrustAnchor() : null,
8765
8908
  unattended,
8766
8909
  env,
8767
- defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
8910
+ defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
8768
8911
  repoRoot: repoRootSync()
8769
8912
  });
8770
8913
  }
@@ -8779,7 +8922,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
8779
8922
  } catch (err) {
8780
8923
  return isEnoent2(err) ? "unknown" : vinayaVersion;
8781
8924
  }
8782
- if (!existsSync6(join7(toplevel, "aeg-root", "roles")))
8925
+ if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
8783
8926
  return vinayaVersion;
8784
8927
  try {
8785
8928
  const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
@@ -8788,9 +8931,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
8788
8931
  return vinayaVersion;
8789
8932
  }
8790
8933
  }
8934
+ var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
8935
+ function taskRefFromBranch2(branch) {
8936
+ const backlog = /^task\/issue-(\d+)$/.exec(branch);
8937
+ if (backlog) {
8938
+ const issue = Number(backlog[1]);
8939
+ return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
8940
+ }
8941
+ const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
8942
+ if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
8943
+ return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
8944
+ }
8945
+ return null;
8946
+ }
8947
+ var TRANCHE_ISSUE_LIST_LIMIT = 200;
8948
+ async function issueForTrancheTask(tranche, taskId, cwd, repo) {
8949
+ let stdout;
8950
+ try {
8951
+ ({ stdout } = await execFileAsync5("gh", [
8952
+ "issue",
8953
+ "list",
8954
+ "--state",
8955
+ "all",
8956
+ "--label",
8957
+ `vinaya/tranche:${tranche}`,
8958
+ "--json",
8959
+ "number,title,labels",
8960
+ "--limit",
8961
+ String(TRANCHE_ISSUE_LIST_LIMIT),
8962
+ ...repo === null ? [] : ["--repo", repo]
8963
+ ], {
8964
+ cwd,
8965
+ encoding: "utf8",
8966
+ maxBuffer: 8 * 1024 * 1024,
8967
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8968
+ killSignal: "SIGKILL"
8969
+ }));
8970
+ } catch {
8971
+ return null;
8972
+ }
8973
+ let issues;
8974
+ try {
8975
+ issues = JSON.parse(stdout);
8976
+ } catch {
8977
+ return null;
8978
+ }
8979
+ for (const issue of issues) {
8980
+ const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
8981
+ if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
8982
+ return issue.number;
8983
+ }
8984
+ return null;
8985
+ }
8986
+ async function confirmBacklogIssue(issue, cwd, repo) {
8987
+ let stdout;
8988
+ try {
8989
+ ({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
8990
+ cwd,
8991
+ encoding: "utf8",
8992
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8993
+ killSignal: "SIGKILL"
8994
+ }));
8995
+ } catch (err) {
8996
+ const stderr = typeof err.stderr === "string" ? err.stderr : "";
8997
+ return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
8998
+ }
8999
+ try {
9000
+ return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
9001
+ } catch {
9002
+ return "unknown";
9003
+ }
9004
+ }
9005
+ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
9006
+ let branch;
9007
+ try {
9008
+ branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
9009
+ encoding: "utf8",
9010
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
9011
+ killSignal: "SIGKILL"
9012
+ })).stdout.trim();
9013
+ } catch {
9014
+ return null;
9015
+ }
9016
+ const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
9017
+ const ref = taskRefFromBranch2(named);
9018
+ if (ref === null)
9019
+ return null;
9020
+ if (ref.kind === "tranche")
9021
+ return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
9022
+ return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
9023
+ }
8791
9024
  function readVinayaVersion() {
8792
9025
  try {
8793
- const pkg = JSON.parse(readFileSync5(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
9026
+ const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
8794
9027
  return pkg.version ?? "unknown";
8795
9028
  } catch {
8796
9029
  return "unknown";
@@ -8800,10 +9033,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
8800
9033
  function isSafeRepoSegment3(segment) {
8801
9034
  return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
8802
9035
  }
9036
+ function safeRepoSlug(repo) {
9037
+ if (repo === null)
9038
+ return null;
9039
+ return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
9040
+ }
8803
9041
  function outboxPathFor(deps, repo, issue) {
8804
9042
  const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
8805
9043
  const fileName = `${issue ?? "none"}.ndjson`;
8806
- return join7(deps.outboxRoot(), dirName, fileName);
9044
+ return join8(deps.outboxRoot(), dirName, fileName);
8807
9045
  }
8808
9046
  function hostFromEnv(env) {
8809
9047
  if (env.GITHUB_ACTIONS)
@@ -8821,9 +9059,21 @@ function defaultStderr(message) {
8821
9059
  warnedThisProcess = true;
8822
9060
  process.stderr.write(message);
8823
9061
  }
9062
+ var branchIssueFallbackEnabled = true;
9063
+ var branchIssueByCwd = new Map;
9064
+ function branchIssueRead(key, read, shared) {
9065
+ if (!shared)
9066
+ return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
9067
+ const cached = branchIssueByCwd.get(key);
9068
+ if (cached !== undefined)
9069
+ return cached;
9070
+ const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
9071
+ branchIssueByCwd.set(key, reading);
9072
+ return reading;
9073
+ }
8824
9074
  function defaultDeps() {
8825
9075
  return {
8826
- outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
9076
+ outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
8827
9077
  home: () => homedir3(),
8828
9078
  hostname: () => osHostname(),
8829
9079
  cwd: () => process.cwd(),
@@ -8848,7 +9098,7 @@ function guardedAppendOpen(path) {
8848
9098
  }
8849
9099
  function appendHardenedLine(path, line) {
8850
9100
  try {
8851
- mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
9101
+ mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
8852
9102
  const fd = guardedAppendOpen(path);
8853
9103
  if (fd === undefined)
8854
9104
  return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
@@ -8867,7 +9117,7 @@ function appendHardenedLine(path, line) {
8867
9117
  function reportRotationOverflow(backupPath, warn) {
8868
9118
  let raw;
8869
9119
  try {
8870
- raw = readFileSync5(backupPath, "utf8");
9120
+ raw = readFileSync6(backupPath, "utf8");
8871
9121
  } catch {
8872
9122
  return;
8873
9123
  }
@@ -8890,7 +9140,7 @@ function reportRotationOverflow(backupPath, warn) {
8890
9140
  }
8891
9141
  function appendLine(path, line, warn) {
8892
9142
  try {
8893
- mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
9143
+ mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
8894
9144
  let fd = guardedAppendOpen(path);
8895
9145
  if (fd === undefined) {
8896
9146
  warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
@@ -8931,7 +9181,11 @@ function appendLine(path, line, warn) {
8931
9181
  }
8932
9182
  }
8933
9183
  function createLogSink(overrides = {}) {
8934
- const deps = { ...defaultDeps(), ...overrides };
9184
+ const deps = {
9185
+ ...defaultDeps(),
9186
+ resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
9187
+ ...overrides
9188
+ };
8935
9189
  const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
8936
9190
  const processId = randomUUID2();
8937
9191
  let seq = 0;
@@ -8951,6 +9205,19 @@ function createLogSink(overrides = {}) {
8951
9205
  }
8952
9206
  return doctrineCache;
8953
9207
  };
9208
+ const readerIsReal = overrides.resolveBranchIssue === undefined;
9209
+ let ownBranchIssue;
9210
+ const branchIssueOnce = (repo) => {
9211
+ if (!branchIssueFallbackEnabled)
9212
+ return Promise.resolve(null);
9213
+ const slug = safeRepoSlug(repo);
9214
+ const read = () => deps.resolveBranchIssue(slug);
9215
+ if (readerIsReal)
9216
+ return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
9217
+ if (ownBranchIssue === undefined)
9218
+ ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
9219
+ return ownBranchIssue;
9220
+ };
8954
9221
  let resolveRepoCache;
8955
9222
  const resolveRepoOnce = () => {
8956
9223
  if (resolveRepoCache === undefined)
@@ -8973,6 +9240,7 @@ function createLogSink(overrides = {}) {
8973
9240
  };
8974
9241
  let drainChain = Promise.resolve();
8975
9242
  const pendingWrites = new Set;
9243
+ let writeChain = Promise.resolve();
8976
9244
  const scheduleWebhookDrain = (issue, url, headers) => {
8977
9245
  drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
8978
9246
  return;
@@ -8995,7 +9263,18 @@ function createLogSink(overrides = {}) {
8995
9263
  attempt: env.VINAYA_ATTEMPT,
8996
9264
  parent: env.VINAYA_PARENT_EVENT
8997
9265
  };
8998
- const written = context().then(({ repo, doctrine: doctrineValue, destination: resolvedDestination }) => {
9266
+ const write = async () => {
9267
+ const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
9268
+ if (resolvedDestination.kind === "none") {
9269
+ warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
9270
+ `);
9271
+ return;
9272
+ }
9273
+ if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
9274
+ warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
9275
+ `);
9276
+ }
9277
+ const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
8999
9278
  const header = buildHeader({
9000
9279
  now,
9001
9280
  runId,
@@ -9006,15 +9285,11 @@ function createLogSink(overrides = {}) {
9006
9285
  host,
9007
9286
  hostname: deps.hostname(),
9008
9287
  env: envFields,
9288
+ branchIssue,
9009
9289
  eventId: randomUUID2(),
9010
9290
  processId,
9011
9291
  inputVersions: deps.inputVersions()
9012
9292
  });
9013
- if (resolvedDestination.kind === "none") {
9014
- warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
9015
- `);
9016
- return;
9017
- }
9018
9293
  const full = { ...e, ...header };
9019
9294
  const parsed = LogEventSchema.safeParse(full);
9020
9295
  if (!parsed.success) {
@@ -9031,10 +9306,12 @@ function createLogSink(overrides = {}) {
9031
9306
  } else {
9032
9307
  appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
9033
9308
  }
9034
- }).catch((err) => {
9309
+ };
9310
+ const written = writeChain.then(write).catch((err) => {
9035
9311
  warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
9036
9312
  `);
9037
9313
  });
9314
+ writeChain = written;
9038
9315
  pendingWrites.add(written);
9039
9316
  written.finally(() => pendingWrites.delete(written));
9040
9317
  } catch (err) {
@@ -9110,7 +9387,7 @@ function parseChangedLineRanges(diffOutput) {
9110
9387
  function fileDiffAgainst(ref, path) {
9111
9388
  let out;
9112
9389
  try {
9113
- out = execFileSync5("git", ["diff", `${ref}...HEAD`, "--", path], {
9390
+ out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
9114
9391
  encoding: "utf8",
9115
9392
  stdio: ["ignore", "pipe", "pipe"]
9116
9393
  }).trim();
@@ -9121,7 +9398,7 @@ function fileDiffAgainst(ref, path) {
9121
9398
  }
9122
9399
  function revParse(ref) {
9123
9400
  try {
9124
- return execFileSync5("git", ["rev-parse", "--verify", ref], {
9401
+ return execFileSync6("git", ["rev-parse", "--verify", ref], {
9125
9402
  encoding: "utf8",
9126
9403
  stdio: ["ignore", "pipe", "pipe"]
9127
9404
  }).trim();
@@ -9131,7 +9408,7 @@ function revParse(ref) {
9131
9408
  }
9132
9409
  function repoRoot() {
9133
9410
  try {
9134
- return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
9411
+ return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
9135
9412
  encoding: "utf8",
9136
9413
  stdio: ["ignore", "pipe", "pipe"]
9137
9414
  }).trim();
@@ -9142,7 +9419,7 @@ function repoRoot() {
9142
9419
  function changedFiles(base) {
9143
9420
  let out;
9144
9421
  try {
9145
- out = execFileSync5("git", ["diff", "--name-only", `${base}...HEAD`], {
9422
+ out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
9146
9423
  encoding: "utf8",
9147
9424
  stdio: ["ignore", "pipe", "pipe"]
9148
9425
  }).trim();
@@ -9167,7 +9444,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
9167
9444
  const relPaths = changedFiles(ref);
9168
9445
  if (relPaths === null)
9169
9446
  continue;
9170
- return { base: ref, root, files: relPaths.map((p) => join8(root, p)) };
9447
+ return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
9171
9448
  }
9172
9449
  return null;
9173
9450
  }
@@ -9268,7 +9545,7 @@ function evaluateChangesetCoverage(fixedGroup, changedFiles, isReleaseBranch) {
9268
9545
  var CHECK_NAME = "changeset-coverage";
9269
9546
  function git2(args) {
9270
9547
  try {
9271
- return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
9548
+ return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
9272
9549
  } catch {
9273
9550
  return "";
9274
9551
  }
@@ -9285,7 +9562,7 @@ function toPosix(p) {
9285
9562
  }
9286
9563
  function readPackageJson(path) {
9287
9564
  try {
9288
- const parsed = JSON.parse(readFileSync6(path, "utf8"));
9565
+ const parsed = JSON.parse(readFileSync7(path, "utf8"));
9289
9566
  return parsed && typeof parsed === "object" ? parsed : null;
9290
9567
  } catch {
9291
9568
  return null;
@@ -9298,7 +9575,7 @@ function workspacePatterns(pkg) {
9298
9575
  }
9299
9576
  function childDirs(absoluteDir) {
9300
9577
  try {
9301
- return readdirSync2(absoluteDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "node_modules" && !e.name.startsWith(".")).map((e) => e.name);
9578
+ return readdirSync3(absoluteDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "node_modules" && !e.name.startsWith(".")).map((e) => e.name);
9302
9579
  } catch {
9303
9580
  return [];
9304
9581
  }
@@ -9306,18 +9583,18 @@ function childDirs(absoluteDir) {
9306
9583
  function candidateMemberDirs(root, pattern) {
9307
9584
  if (pattern.endsWith("/*")) {
9308
9585
  const prefix = pattern.slice(0, -2);
9309
- return childDirs(join9(root, prefix)).map((name) => `${prefix}/${name}`);
9586
+ return childDirs(join10(root, prefix)).map((name) => `${prefix}/${name}`);
9310
9587
  }
9311
9588
  if (!pattern.includes("*"))
9312
9589
  return [pattern];
9313
9590
  return [];
9314
9591
  }
9315
9592
  function resolveWorkspaceMembers(root) {
9316
- const rootPkg = readPackageJson(join9(root, "package.json"));
9593
+ const rootPkg = readPackageJson(join10(root, "package.json"));
9317
9594
  const members = new Map;
9318
9595
  for (const pattern of workspacePatterns(rootPkg)) {
9319
9596
  for (const dir of candidateMemberDirs(root, pattern)) {
9320
- const pkg = readPackageJson(join9(root, dir, "package.json"));
9597
+ const pkg = readPackageJson(join10(root, dir, "package.json"));
9321
9598
  const name = pkg?.name;
9322
9599
  const files = pkg?.files;
9323
9600
  if (typeof name !== "string" || !Array.isArray(files))
@@ -9328,7 +9605,7 @@ function resolveWorkspaceMembers(root) {
9328
9605
  return members;
9329
9606
  }
9330
9607
  function fixedGroupNames(root) {
9331
- const pkg = readPackageJson(join9(root, ".changeset", "config.json"));
9608
+ const pkg = readPackageJson(join10(root, ".changeset", "config.json"));
9332
9609
  const fixed = pkg?.fixed;
9333
9610
  if (!Array.isArray(fixed))
9334
9611
  return [];