@attalabs/vinaya 0.44.1 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +6 -4
  2. package/dist/checks/bin/check-body-bare-digits.js +233 -195
  3. package/dist/checks/bin/check-branch-topology.js +70 -23
  4. package/dist/checks/bin/check-brief-shape.js +233 -195
  5. package/dist/checks/bin/check-changeset-coverage.js +94 -16
  6. package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
  7. package/dist/checks/bin/check-closes-n.js +128 -34
  8. package/dist/checks/bin/check-coherence.js +336 -245
  9. package/dist/checks/bin/check-dispatch-readiness.js +3623 -463
  10. package/dist/checks/bin/check-doc-claims.js +233 -195
  11. package/dist/checks/bin/check-doc-coverage-push.js +243 -196
  12. package/dist/checks/bin/check-doc-coverage.js +243 -196
  13. package/dist/checks/bin/check-doctrine-no-procedures.js +233 -195
  14. package/dist/checks/bin/check-doctrine-portability.js +233 -195
  15. package/dist/checks/bin/check-evidence-fresh.js +9983 -1995
  16. package/dist/checks/bin/check-exec-bits.js +3 -0
  17. package/dist/checks/bin/check-first-push-dispatch.js +301 -224
  18. package/dist/checks/bin/check-issue-milestone-attach.js +65 -10
  19. package/dist/checks/bin/check-issue-objectives-numbering.js +233 -195
  20. package/dist/checks/bin/check-issue-parts-coverage.js +65 -10
  21. package/dist/checks/bin/check-issue-surface-globs.js +1032 -236
  22. package/dist/checks/bin/check-issue-title-grammar.js +5 -1
  23. package/dist/checks/bin/check-no-disk-state.js +5 -1
  24. package/dist/checks/bin/check-pr-premise-reassert.js +10 -1
  25. package/dist/checks/bin/check-pr-report-density.js +5 -1
  26. package/dist/checks/bin/check-principal-test-plan-wait.js +253 -201
  27. package/dist/checks/bin/check-quoted-command.js +233 -195
  28. package/dist/checks/bin/check-reader-resolvable-prose.js +233 -195
  29. package/dist/checks/bin/check-registry-gates.js +131 -34
  30. package/dist/checks/bin/check-retired-vocabulary.js +233 -195
  31. package/dist/checks/bin/check-review-gate.js +233 -195
  32. package/dist/checks/bin/check-single-plan-pr.js +5 -1
  33. package/dist/checks/bin/check-surface-scope.js +107 -32
  34. package/dist/checks/bin/check-test-plan.js +253 -201
  35. package/dist/checks/bin/check-token-collection-wired.js +3 -0
  36. package/dist/checks/bin/check-workspace-escape.js +3 -0
  37. package/dist/checks/bin/verify-coherence.js +237 -148
  38. package/dist/checks/bin/verify-dispatch.js +870 -66
  39. package/dist/checks/bin/verify-docs.js +13 -6
  40. package/dist/harness.js +57 -10
  41. package/dist/index.js +16617 -7187
  42. package/dist/lib/pre-push-cache-test-run.js +4487 -2170
  43. package/dist/lib/pre-push-changed-files.js +251 -12
  44. package/dist/lib/pre-push-mode.js +69 -19
  45. package/dist/lib/pre-push-progress-dir.js +10265 -2853
  46. package/dist/lib/pre-push-record-tests.js +67 -19
  47. package/dist/lib/pre-push-select-tests.js +520 -222
  48. package/dist/lib/push-progress-observer.js +9176 -1757
  49. package/dist/process.js +2 -0
  50. package/dist/programs/archive.js +8948 -1547
  51. package/dist/programs/audit.js +9176 -1772
  52. package/dist/programs/check.js +9248 -1845
  53. package/dist/programs/commit-msg.js +8984 -1583
  54. package/dist/programs/dev-review-loop.js +15612 -7634
  55. package/dist/programs/dispatch.js +9977 -2726
  56. package/dist/programs/log-emit.js +9011 -1660
  57. package/dist/programs/log-selftest.js +8908 -1507
  58. package/dist/programs/log-send.js +9081 -1594
  59. package/dist/programs/pr-report.js +9476 -1820
  60. package/dist/programs/pr-snapshot.js +8916 -1515
  61. package/dist/programs/pr-verify-evidence.js +9481 -1825
  62. package/dist/programs/pr.js +11709 -4033
  63. package/dist/programs/review-post.js +11140 -3496
  64. package/dist/programs/review-status.js +8996 -1533
  65. package/dist/programs/run-engine.js +22031 -18759
  66. package/dist/programs/sync.js +9030 -1629
  67. package/dist/programs/task-brief.js +10185 -1821
  68. package/dist/programs/task-sweep.js +9266 -1621
  69. package/dist/programs/task-tools-serve.js +77118 -16678
  70. package/dist/programs/tokens.js +8966 -1565
  71. package/dist/programs/waiver.js +8983 -1582
  72. package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
  73. package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
  74. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +3 -3
  75. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
  76. package/dist/vinaya-strict/checks/registry.ts +2 -2
  77. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
  78. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
  79. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
  80. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
  81. package/dist/vinaya-strict/executing/developer/reference.md +5 -3
  82. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
  83. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
  84. package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
  85. package/dist/vinaya-strict/process.yaml +6 -1
  86. package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  87. package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
  88. package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
  89. package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
  90. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
  91. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
  92. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
  93. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
  94. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
  95. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
  96. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
  97. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
  98. package/package.json +3 -2
  99. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  100. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  101. package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
  102. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  103. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  104. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  105. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  106. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  107. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  108. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  109. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  111. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  113. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  116. package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
  117. package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
  118. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
  119. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
  120. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
  121. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  122. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
  123. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  124. package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
  125. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
  126. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
  127. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
  128. package/vinaya-strict/artifacts/templates/brief-template.md +4 -0
  129. package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
  130. package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
  131. package/vinaya-strict/doctrine/contracts/planner-developer.md +2 -1
  132. package/vinaya-strict/doctrine/enforcement.md +4 -4
  133. package/vinaya-strict/doctrine/roles/principal.md +1 -1
  134. package/vinaya-strict/doctrine/state-machine.md +7 -2
  135. package/vinaya-strict/executing/developer/reference.md +5 -3
  136. package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  137. package/vinaya-strict/thinking/planner/doctrine.md +4 -1
  138. package/vinaya-strict/thinking/planner/reference.md +29 -8
  139. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
  140. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
  141. package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
  142. /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
  143. /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,6 +24,7 @@ var __toCommonJS = (from) => {
23
24
  return entry;
24
25
  };
25
26
  var __moduleCache;
27
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
26
28
  var __returnValue = (v) => v;
27
29
  function __exportSetter(name, newValue) {
28
30
  this[name] = __returnValue.bind(null, newValue);
@@ -47,6 +49,7 @@ var __esm = (fn, res, err) => () => {
47
49
  throw err[0];
48
50
  return res;
49
51
  };
52
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
50
53
 
51
54
  // ../../harness/kernel/gates/glob-to-regex.ts
52
55
  function globToRegex(pat) {
@@ -75,59 +78,22 @@ function globToRegex(pat) {
75
78
  }
76
79
 
77
80
  // ../../harness/kernel/log/custom.ts
78
- import { z } from "zod";
79
- var CUSTOM_EVENT_NAME_PATTERN, CUSTOM_EVENT_NAME_MAX_LENGTH = 64, CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya", CUSTOM_EVENT_MAX_FIELDS = 20, CUSTOM_FIELD_NAME_PATTERN, CUSTOM_FIELD_NAME_MAX_LENGTH = 64, CUSTOM_TEXT_MAX_LENGTH = 500, CUSTOM_WORD_PATTERN, CUSTOM_WORD_MAX_LENGTH = 64, CUSTOM_FIELD_MAX_WORDS = 50, CustomFieldTypeSchema, CustomEventDeclarationsSchema;
80
- var init_custom = __esm(() => {
81
- CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
82
- CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
83
- CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
84
- CustomFieldTypeSchema = z.union([z.enum(["text", "number", "boolean"]), z.array(z.string())]);
85
- CustomEventDeclarationsSchema = z.record(z.string(), z.object({
86
- fields: z.record(z.string(), CustomFieldTypeSchema)
87
- }).strict()).superRefine((events, ctx) => {
88
- for (const [name, declaration] of Object.entries(events)) {
89
- const refuse = (message, path = []) => {
90
- ctx.addIssue({
91
- code: z.ZodIssueCode.custom,
92
- path: [name, ...path],
93
- message: `logs.events "${name}": ${message}`
94
- });
95
- };
96
- if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
97
- refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
98
- }
99
- if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
100
- refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
101
- } else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
102
- refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
103
- }
104
- const fieldEntries = Object.entries(declaration.fields);
105
- if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
106
- refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
107
- }
108
- for (const [field, type] of fieldEntries) {
109
- if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
110
- refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
111
- }
112
- if (typeof type === "string")
113
- continue;
114
- if (type.length === 0) {
115
- refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
116
- }
117
- if (type.length > CUSTOM_FIELD_MAX_WORDS) {
118
- refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
119
- }
120
- const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
121
- if (bad.length > 0) {
122
- refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
123
- }
124
- if (new Set(type).size !== type.length) {
125
- refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
126
- }
127
- }
128
- }
129
- });
130
- });
81
+ import {
82
+ CUSTOM_EVENT_MAX_FIELDS,
83
+ CUSTOM_EVENT_NAME_MAX_LENGTH,
84
+ CUSTOM_EVENT_NAME_PATTERN,
85
+ CUSTOM_EVENT_RESERVED_NAMESPACE,
86
+ CUSTOM_FIELD_MAX_WORDS,
87
+ CUSTOM_FIELD_NAME_MAX_LENGTH,
88
+ CUSTOM_FIELD_NAME_PATTERN,
89
+ CUSTOM_TEXT_MAX_LENGTH,
90
+ CUSTOM_WORD_MAX_LENGTH,
91
+ CUSTOM_WORD_PATTERN,
92
+ CustomEventDeclarationsSchema,
93
+ checkCustomEvent,
94
+ UNRECORDABLE_FIELD_NAME
95
+ } from "@attalabs/vinaya-log-sdk";
96
+ var init_custom = () => {};
131
97
 
132
98
  // ../../harness/kernel/gates/checks/contract.ts
133
99
  function emitCheckError(error) {
@@ -474,14 +440,15 @@ ${detail}`;
474
440
  return null;
475
441
  }
476
442
  }
477
- function loadTrustAnchorConfig(fetcher = fetchTrustAnchorConfig) {
443
+ function loadTrustAnchorConfig(fetcher = fetchTrustAnchorConfig, loadOptions = {}) {
444
+ const warn = loadOptions.quiet ? () => {} : warnTrustAnchorFallback;
478
445
  let base64;
479
446
  try {
480
447
  base64 = fetcher();
481
448
  } catch (err) {
482
- return trustAnchorFetchFailed(err);
449
+ return trustAnchorFetchFailed(err, warn);
483
450
  }
484
- return parseTrustAnchorContent(base64);
451
+ return parseTrustAnchorContent(base64, warn);
485
452
  }
486
453
  function loadTrustAnchorConfigOrThrow(fetcher = fetchTrustAnchorConfig) {
487
454
  let base64;
@@ -540,9 +507,9 @@ var installed = null, NO_CONFIG_PROVIDER_MESSAGE = "no configuration provider is
540
507
 
541
508
  // ../../harness/kernel/config/schema/config-schema.ts
542
509
  import { isAbsolute } from "node:path";
543
- import { z as z2 } from "zod";
510
+ import { z } from "zod";
544
511
  function checkEntrySchema(fields) {
545
- return z2.object(fields).superRefine((entry, ctx) => {
512
+ return z.object(fields).superRefine((entry, ctx) => {
546
513
  const env = entry.env;
547
514
  if (!env)
548
515
  return;
@@ -552,14 +519,14 @@ function checkEntrySchema(fields) {
552
519
  const members = value.anyOf;
553
520
  if (new Set(members).size !== members.length) {
554
521
  ctx.addIssue({
555
- code: z2.ZodIssueCode.custom,
522
+ code: z.ZodIssueCode.custom,
556
523
  message: `env.${key}.anyOf has duplicate members`,
557
524
  path: ["env", key, "anyOf"]
558
525
  });
559
526
  }
560
527
  if (!members.includes(key)) {
561
528
  ctx.addIssue({
562
- code: z2.ZodIssueCode.custom,
529
+ code: z.ZodIssueCode.custom,
563
530
  message: `env.${key}.anyOf must include "${key}" itself as a member`,
564
531
  path: ["env", key, "anyOf"]
565
532
  });
@@ -582,26 +549,31 @@ function hookBlockPathRule(prefixes) {
582
549
  return { isCanonical, schema };
583
550
  }
584
551
  function managedManifestSchemas(agentVendors, hookBlockPrefixes) {
585
- const block = z2.object({
552
+ const block = z.object({
586
553
  path: hookBlockPathRule(hookBlockPrefixes).schema,
587
- marker: z2.string(),
588
- comment: z2.enum(["hash", "html"])
554
+ marker: z.string(),
555
+ comment: z.enum(["hash", "html"])
589
556
  });
590
- const manifest = z2.object({
591
- version: z2.number().int().positive(),
592
- files: z2.array(SafeRepoRelPath),
593
- blocks: z2.array(block),
594
- labels: z2.array(z2.string()),
595
- agents: z2.array(z2.enum(agentVendors)).optional()
557
+ const manifest = z.object({
558
+ version: z.number().int().positive(),
559
+ files: z.array(SafeRepoRelPath),
560
+ blocks: z.array(block),
561
+ labels: z.array(z.string()),
562
+ agents: z.array(z.enum(agentVendors)).optional()
596
563
  });
597
564
  return { block, manifest };
598
565
  }
599
566
  function logsSchema(events) {
600
- return z2.object({
601
- folder: z2.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
602
- url: z2.string().url().optional(),
603
- headers: z2.record(z2.string()).optional(),
604
- readHeaders: z2.record(z2.string()).optional(),
567
+ return z.object({
568
+ folder: z.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
569
+ url: z.string().url().optional(),
570
+ otlp: z.object({
571
+ url: z.string().url().regex(/^https?:\/\//i),
572
+ headers: z.record(z.string()).optional()
573
+ }).strict().optional(),
574
+ headers: z.record(z.string()).optional(),
575
+ readHeaders: z.record(z.string()).optional(),
576
+ keepDays: z.number({ invalid_type_error: "must be a whole number of days" }).int({ message: "must be a whole number of days" }).min(1, { message: "must be at least 1" }).optional(),
605
577
  events: events.optional()
606
578
  }).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
607
579
  message: "logs: set at most one of folder/url"
@@ -609,22 +581,22 @@ function logsSchema(events) {
609
581
  message: "logs: headers requires url"
610
582
  }).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
611
583
  message: "logs: readHeaders requires url"
612
- }).or(z2.literal(false)).optional();
584
+ }).or(z.literal(false)).optional();
613
585
  }
614
586
  function kernelConfigFragment(leaves) {
615
587
  return {
616
- rings: z2.object({
617
- ring1_forgeWriteInterception: z2.boolean(),
618
- ring2_asyncAudits: z2.boolean()
588
+ rings: z.object({
589
+ ring1_forgeWriteInterception: z.boolean(),
590
+ ring2_asyncAudits: z.boolean()
619
591
  }).optional(),
620
- checks: z2.record(z2.string(), checkEntrySchema(leaves.checkEntryFields)).optional(),
592
+ checks: z.record(z.string(), checkEntrySchema(leaves.checkEntryFields)).optional(),
621
593
  managed: managedManifestSchemas(leaves.agentVendors, leaves.hookBlockPrefixes).manifest.optional(),
622
- ci: z2.object({ setup: z2.string().min(1) }).optional(),
623
- logPublish: z2.unknown().refine((v) => v === undefined, {
594
+ ci: z.object({ setup: z.string().min(1) }).optional(),
595
+ logPublish: z.unknown().refine((v) => v === undefined, {
624
596
  message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
625
597
  }),
626
- runtimeDir: z2.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
627
- runner: z2.enum(["standalone", "atta-engine"]).optional(),
598
+ runtimeDir: z.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
599
+ runner: z.enum(["standalone", "atta-engine"]).optional(),
628
600
  logs: logsSchema(leaves.logEvents)
629
601
  };
630
602
  }
@@ -664,25 +636,25 @@ function resolveLogsHeaderValues(headers, env) {
664
636
  }
665
637
  var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath, KERNEL_CONFIG_REFINEMENTS;
666
638
  var init_config_schema = __esm(() => {
667
- EnvEntrySchema = z2.union([
668
- z2.literal(true),
669
- z2.object({ optional: z2.literal(true) }),
670
- z2.object({ anyOf: z2.array(z2.string()).min(2) }),
671
- z2.string()
639
+ EnvEntrySchema = z.union([
640
+ z.literal(true),
641
+ z.object({ optional: z.literal(true) }),
642
+ z.object({ anyOf: z.array(z.string()).min(2) }),
643
+ z.string()
672
644
  ]);
673
645
  KERNEL_CHECK_ENTRY_FIELDS = {
674
- run: z2.string(),
675
- scope: z2.enum(["diff", "full"]),
676
- include: z2.array(z2.string()).optional(),
677
- args: z2.array(z2.string()).optional(),
678
- timeoutMs: z2.number().optional(),
679
- env: z2.record(z2.string(), EnvEntrySchema).optional(),
680
- requiresOpenPr: z2.boolean().optional(),
681
- ownWorkflow: z2.boolean().optional(),
682
- validates: z2.enum(["body", "issue"]).optional(),
683
- advisory: z2.literal(true).optional()
646
+ run: z.string(),
647
+ scope: z.enum(["diff", "full"]),
648
+ include: z.array(z.string()).optional(),
649
+ args: z.array(z.string()).optional(),
650
+ timeoutMs: z.number().optional(),
651
+ env: z.record(z.string(), EnvEntrySchema).optional(),
652
+ requiresOpenPr: z.boolean().optional(),
653
+ ownWorkflow: z.boolean().optional(),
654
+ validates: z.enum(["body", "issue"]).optional(),
655
+ advisory: z.literal(true).optional()
684
656
  };
685
- SafeRepoRelPath = z2.string().refine(isSafeRepoRelPath, {
657
+ SafeRepoRelPath = z.string().refine(isSafeRepoRelPath, {
686
658
  message: "must be a repo-root-relative path with no `..` segment or absolute root"
687
659
  });
688
660
  KERNEL_CONFIG_REFINEMENTS = [];
@@ -759,6 +731,7 @@ var init_doctrine_map = __esm(() => {
759
731
  { key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
760
732
  { key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
761
733
  { key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
734
+ { key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
762
735
  { key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
763
736
  { key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
764
737
  { key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
@@ -1118,7 +1091,7 @@ function commentMarkerFamily(name) {
1118
1091
  function anchorAlternation(spellings) {
1119
1092
  return `(?:${spellings.map((spelling) => spelling.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`;
1120
1093
  }
1121
- var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
1094
+ var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DOCUMENTATION_EDIT_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
1122
1095
  var init_legacy_markers = __esm(() => {
1123
1096
  REGION_PREFIX = { old: "AEG", current: "VINAYA" };
1124
1097
  PROVENANCE_HEADING = {
@@ -1140,6 +1113,7 @@ var init_legacy_markers = __esm(() => {
1140
1113
  LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
1141
1114
  PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
1142
1115
  OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
1116
+ DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
1143
1117
  DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
1144
1118
  COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
1145
1119
  COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
@@ -1665,6 +1639,17 @@ var init_protected_paths = __esm(() => {
1665
1639
  ];
1666
1640
  });
1667
1641
 
1642
+ // ../../harness/processes/vinaya-strict/tools/task-contract/test-plan-proof.ts
1643
+ var ID_LIST, LINE_IDS_RE, ITEM_IDS_SPAN_RE;
1644
+ var init_test_plan_proof = __esm(() => {
1645
+ init_brief_validation();
1646
+ init_objectives();
1647
+ init_test_plan_section();
1648
+ ID_LIST = String.raw`O\d+(?:\s*,\s*O\d+)*`;
1649
+ LINE_IDS_RE = new RegExp(String.raw`\(\s*(${ID_LIST})\s*\)\s*$`);
1650
+ ITEM_IDS_SPAN_RE = new RegExp(String.raw`(?<!\`)(\`+)\s*\(?\s*(${ID_LIST})\s*\)?\s*\1(?!\`)`, "g");
1651
+ });
1652
+
1668
1653
  // ../../harness/processes/vinaya-strict/tools/task-contract/issue-validation.ts
1669
1654
  var DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale", SINGLE_FIX_OPTIONAL_FIELDS, TYPE_LABEL_IDS, DOC_PATH_RE, DOC_PATH_RE_GLOBAL, DEFAULT_COLLISION_THRESHOLD = 3, FILE_EXTENSIONS, CI_SHARD_DIR = "apps/cli/tests/ci-shards", CI_SHARD_PROBE;
1670
1655
  var init_issue_validation = __esm(() => {
@@ -1680,11 +1665,13 @@ var init_issue_validation = __esm(() => {
1680
1665
  init_derive_section7();
1681
1666
  init_doctrine_map();
1682
1667
  init_objectives();
1668
+ init_waiver_label();
1683
1669
  init_issue_documentation();
1684
1670
  init_touched_path();
1685
1671
  init_protected_paths();
1686
1672
  init_quoted_command();
1687
1673
  init_test_plan_section();
1674
+ init_test_plan_proof();
1688
1675
  SINGLE_FIX_OPTIONAL_FIELDS = new Set([
1689
1676
  "Sizing",
1690
1677
  "Project(s) + blast radius",
@@ -1756,7 +1743,7 @@ var init_review_gate = __esm(() => {
1756
1743
 
1757
1744
  // ../../harness/processes/vinaya-strict/tools/prose-rules-config.ts
1758
1745
  import safeRegex from "safe-regex2";
1759
- import { z as z3 } from "zod";
1746
+ import { z as z2 } from "zod";
1760
1747
  function isPlainObject(value) {
1761
1748
  return typeof value === "object" && value !== null && !Array.isArray(value);
1762
1749
  }
@@ -2026,18 +2013,18 @@ var init_prose_rules_config = __esm(() => {
2026
2013
  FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
2027
2014
  CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
2028
2015
  DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
2029
- RepoRelativePathSchema = z3.string().min(1).superRefine((entry, ctx) => {
2016
+ RepoRelativePathSchema = z2.string().min(1).superRefine((entry, ctx) => {
2030
2017
  const reason = outsideRepositoryReason(entry);
2031
2018
  if (reason)
2032
- ctx.addIssue({ code: z3.ZodIssueCode.custom, message: reason });
2019
+ ctx.addIssue({ code: z2.ZodIssueCode.custom, message: reason });
2033
2020
  });
2034
- ProseRulesSchema = z3.unknown().superRefine((value, ctx) => {
2021
+ ProseRulesSchema = z2.unknown().superRefine((value, ctx) => {
2035
2022
  for (const issue of proseRulesIssues(value)) {
2036
- ctx.addIssue({ code: z3.ZodIssueCode.custom, path: issue.path, message: issue.message });
2023
+ ctx.addIssue({ code: z2.ZodIssueCode.custom, path: issue.path, message: issue.message });
2037
2024
  }
2038
2025
  }).transform((value) => value);
2039
- PublishedProseSchema = z3.object({
2040
- allow: z3.array(z3.string().min(1)).optional()
2026
+ PublishedProseSchema = z2.object({
2027
+ allow: z2.array(z2.string().min(1)).optional()
2041
2028
  }).strict();
2042
2029
  });
2043
2030
 
@@ -2052,10 +2039,13 @@ var exports_vinaya_config_section = {};
2052
2039
  __export(exports_vinaya_config_section, {
2053
2040
  BRIEF_BUILTINS: () => BRIEF_BUILTINS,
2054
2041
  CANONICAL_HOOK_BLOCK_PREFIXES: () => CANONICAL_HOOK_BLOCK_PREFIXES,
2042
+ DEFAULT_REVIEW_AGENT: () => DEFAULT_REVIEW_AGENT,
2043
+ DEFAULT_REVIEW_ROUND_LIMIT: () => DEFAULT_REVIEW_ROUND_LIMIT,
2055
2044
  LOCAL_OVERRIDABLE_KEYS: () => LOCAL_OVERRIDABLE_KEYS,
2056
2045
  LOCAL_OVERRIDE_FILENAME: () => LOCAL_OVERRIDE_FILENAME,
2057
2046
  PRINCIPALS_FIX: () => PRINCIPALS_FIX,
2058
2047
  PrincipalsUnresolvedError: () => PrincipalsUnresolvedError,
2048
+ REVIEW_AGENT_SETTINGS: () => REVIEW_AGENT_SETTINGS,
2059
2049
  VINAYA_CHECK_ENTRY_FIELDS: () => VINAYA_CHECK_ENTRY_FIELDS,
2060
2050
  VINAYA_CONFIG_FILENAME: () => VINAYA_CONFIG_FILENAME,
2061
2051
  VINAYA_CONFIG_FRAGMENT: () => VINAYA_CONFIG_FRAGMENT,
@@ -2077,7 +2067,9 @@ __export(exports_vinaya_config_section, {
2077
2067
  resolveGateCutovers: () => resolveGateCutovers,
2078
2068
  resolveLocalPacingOverride: () => resolveLocalPacingOverride,
2079
2069
  resolveReleaseActor: () => resolveReleaseActor,
2070
+ resolveReviewAgent: () => resolveReviewAgent,
2080
2071
  resolveReviewPolicy: () => resolveReviewPolicy,
2072
+ resolveReviewRoundLimit: () => resolveReviewRoundLimit,
2081
2073
  resolveSecurityScanCommand: () => resolveSecurityScanCommand,
2082
2074
  tokensCollectTrustKey: () => tokensCollectTrustKey,
2083
2075
  trustAnchorFallbackWarning: () => trustAnchorFallbackWarning,
@@ -2088,7 +2080,7 @@ import { execFileSync as execFileSync3 } from "node:child_process";
2088
2080
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
2089
2081
  import { homedir } from "node:os";
2090
2082
  import { dirname as dirname2, join as join2 } from "node:path";
2091
- import { z as z4 } from "zod";
2083
+ import { z as z3 } from "zod";
2092
2084
  function isDefaultedAgentVendorPath(path, manifest) {
2093
2085
  if (manifest.agents !== undefined)
2094
2086
  return false;
@@ -2122,7 +2114,7 @@ function decisionRecordsOutsideDoctrine(config, ctx) {
2122
2114
  return;
2123
2115
  const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
2124
2116
  if (issue)
2125
- ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
2117
+ ctx.addIssue({ code: z3.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
2126
2118
  }
2127
2119
  function globalPrincipalsIgnoredWarning(path) {
2128
2120
  return `${path}: "principals" in the global config is ignored — principals may only be declared from a repo-local vinaya.config.json.`;
@@ -2226,6 +2218,12 @@ function resolveGateCutovers(config) {
2226
2218
  function resolveCollisionThreshold(config) {
2227
2219
  return config?.planning?.collisionThreshold ?? DEFAULT_COLLISION_THRESHOLD;
2228
2220
  }
2221
+ function resolveReviewRoundLimit(config) {
2222
+ return config?.planning?.reviewRoundLimit ?? DEFAULT_REVIEW_ROUND_LIMIT;
2223
+ }
2224
+ function resolveReviewAgent(config) {
2225
+ return config?.planning?.reviewAgent ?? DEFAULT_REVIEW_AGENT;
2226
+ }
2229
2227
  function principalsNotConfigured(why) {
2230
2228
  return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
2231
2229
  }
@@ -2240,7 +2238,7 @@ function createTrustedPrincipalsResolver(reads) {
2240
2238
  }
2241
2239
  if (isMissingFileError(err))
2242
2240
  throw principalsNotConfigured("the default branch has no vinaya.config.json");
2243
- throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`);
2241
+ throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`, { cause: err });
2244
2242
  }
2245
2243
  const unusable = { why: "" };
2246
2244
  const config = reads.parse(content, (why) => {
@@ -2300,7 +2298,7 @@ function trustTokensCollectCommand(repoGitCommonDir, interpreter, script, script
2300
2298
  store[key] = { interpreter, script, scriptBlobHash, trustedAt: new Date().toISOString() };
2301
2299
  writeTokensCollectTrustStore(storePath, store);
2302
2300
  }
2303
- var VINAYA_HOME, VINAYA_GLOBAL_CONFIG_FILENAME = "config.json", VINAYA_CONFIG_FILENAME = "vinaya.config.json", CANONICAL_HOOK_BLOCK_PREFIXES, VINAYA_CHECK_ENTRY_FIELDS, AGENTS_SKILLS_PREFIX = ".agents/skills/", CLAUDE_SKILLS_PREFIX = ".claude/skills/vinaya-", RoleEntrySchema, MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000, BRIEF_BUILTINS, BriefSectionSchema, BriefSchemaSchema, ProjectEntrySchema, VINAYA_CONFIG_FRAGMENT, LOCAL_OVERRIDE_FILENAME = "vinaya.config.local.json", LOCAL_OVERRIDABLE_KEYS, PrincipalsUnresolvedError, PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch', TOKENS_COLLECT_TRUST_PATH, VINAYA_GLOBAL_ONLY_KEYS, VINAYA_CONFIG_SECTION;
2301
+ var VINAYA_HOME, VINAYA_GLOBAL_CONFIG_FILENAME = "config.json", VINAYA_CONFIG_FILENAME = "vinaya.config.json", CANONICAL_HOOK_BLOCK_PREFIXES, VINAYA_CHECK_ENTRY_FIELDS, AGENTS_SKILLS_PREFIX = ".agents/skills/", CLAUDE_SKILLS_PREFIX = ".claude/skills/vinaya-", RoleEntrySchema, MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000, BRIEF_BUILTINS, BriefSectionSchema, BriefSchemaSchema, ProjectEntrySchema, VINAYA_CONFIG_FRAGMENT, LOCAL_OVERRIDE_FILENAME = "vinaya.config.local.json", LOCAL_OVERRIDABLE_KEYS, DEFAULT_REVIEW_ROUND_LIMIT = 2, REVIEW_AGENT_SETTINGS, DEFAULT_REVIEW_AGENT = "same", PrincipalsUnresolvedError, PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch', TOKENS_COLLECT_TRUST_PATH, VINAYA_GLOBAL_ONLY_KEYS, VINAYA_CONFIG_SECTION;
2304
2302
  var init_vinaya_config_section = __esm(() => {
2305
2303
  init_review_policy();
2306
2304
  init_issue_validation();
@@ -2314,10 +2312,10 @@ var init_vinaya_config_section = __esm(() => {
2314
2312
  VINAYA_HOME = join2(homedir(), ".vinaya");
2315
2313
  CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
2316
2314
  VINAYA_CHECK_ENTRY_FIELDS = {
2317
- principalOwed: z4.literal(true).optional()
2315
+ principalOwed: z3.literal(true).optional()
2318
2316
  };
2319
- RoleEntrySchema = z4.object({
2320
- contract: z4.string().refine((p) => p.includes("/"), {
2317
+ RoleEntrySchema = z3.object({
2318
+ contract: z3.string().refine((p) => p.includes("/"), {
2321
2319
  message: 'must be a path (contain at least one "/"), not a bare filename'
2322
2320
  })
2323
2321
  });
@@ -2340,102 +2338,104 @@ var init_vinaya_config_section = __esm(() => {
2340
2338
  "briefSections",
2341
2339
  "milestoneShape"
2342
2340
  ];
2343
- BriefSectionSchema = z4.union([
2344
- z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
2345
- z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
2346
- z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
2347
- z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
2341
+ BriefSectionSchema = z3.union([
2342
+ z3.object({ builtin: z3.enum(BRIEF_BUILTINS) }),
2343
+ z3.object({ heading: z3.string().min(1), name: z3.string().optional() }),
2344
+ z3.object({ field: z3.string().min(1), name: z3.string().optional() }),
2345
+ z3.object({ phrase: z3.string().min(1), name: z3.string().optional() })
2348
2346
  ]);
2349
- BriefSchemaSchema = z4.object({
2350
- pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2351
- issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2352
- milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2353
- ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
2347
+ BriefSchemaSchema = z3.object({
2348
+ pr: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
2349
+ issue: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
2350
+ milestone: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
2351
+ ack: z3.array(z3.enum(BRIEF_BUILTINS)).optional()
2354
2352
  });
2355
- ProjectEntrySchema = z4.object({
2356
- name: z4.string().min(1),
2357
- description: z4.string().min(1).optional(),
2358
- path: z4.string().min(1).optional()
2353
+ ProjectEntrySchema = z3.object({
2354
+ name: z3.string().min(1),
2355
+ description: z3.string().min(1).optional(),
2356
+ path: z3.string().min(1).optional()
2359
2357
  });
2360
2358
  VINAYA_CONFIG_FRAGMENT = {
2361
- roles: z4.record(z4.string(), RoleEntrySchema).optional(),
2359
+ roles: z3.record(z3.string(), RoleEntrySchema).optional(),
2362
2360
  briefSchema: BriefSchemaSchema.optional(),
2363
- principals: z4.array(z4.string()).min(1).optional(),
2364
- releaseActor: z4.string().min(1).optional(),
2365
- tokens: z4.object({
2366
- collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
2361
+ principals: z3.array(z3.string()).min(1).optional(),
2362
+ releaseActor: z3.string().min(1).optional(),
2363
+ tokens: z3.object({
2364
+ collect: z3.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
2367
2365
  message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
2368
2366
  })
2369
2367
  }).optional(),
2370
- blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
2371
- proseGates: z4.object({
2372
- doctrineRoot: z4.string().min(1).optional(),
2373
- readerFacingPrefix: z4.string().min(1).optional(),
2374
- readerFacingSuffix: z4.string().min(1).optional(),
2375
- legacySlugDir: z4.string().min(1).optional(),
2376
- sourceComments: z4.object({
2377
- globs: z4.array(z4.string().min(1)).optional(),
2378
- allowlist: z4.array(z4.string().min(1)).optional(),
2379
- severity: z4.enum(["warning", "error"]).optional()
2368
+ blastRadius: z3.object({ extraDomains: z3.array(z3.string()).optional() }).optional(),
2369
+ proseGates: z3.object({
2370
+ doctrineRoot: z3.string().min(1).optional(),
2371
+ readerFacingPrefix: z3.string().min(1).optional(),
2372
+ readerFacingSuffix: z3.string().min(1).optional(),
2373
+ legacySlugDir: z3.string().min(1).optional(),
2374
+ sourceComments: z3.object({
2375
+ globs: z3.array(z3.string().min(1)).optional(),
2376
+ allowlist: z3.array(z3.string().min(1)).optional(),
2377
+ severity: z3.enum(["warning", "error"]).optional()
2380
2378
  }).optional(),
2381
- specGrandfather: z4.union([z4.array(z4.string().min(1)), z4.record(z4.string().min(1), z4.number().int().min(0))]).optional(),
2382
- specPaths: z4.array(RepoRelativePathSchema).optional(),
2383
- productPaths: z4.array(RepoRelativePathSchema).optional(),
2379
+ specGrandfather: z3.union([z3.array(z3.string().min(1)), z3.record(z3.string().min(1), z3.number().int().min(0))]).optional(),
2380
+ specPaths: z3.array(RepoRelativePathSchema).optional(),
2381
+ productPaths: z3.array(RepoRelativePathSchema).optional(),
2384
2382
  published: PublishedProseSchema.optional(),
2385
2383
  rules: ProseRulesSchema.optional()
2386
2384
  }).optional(),
2387
- projects: z4.array(ProjectEntrySchema).optional(),
2388
- dispatch: z4.object({
2389
- timeoutMs: z4.number().int().positive().optional(),
2390
- reviewerTimeoutMs: z4.number().int().positive().optional(),
2391
- killGraceMs: z4.number().int().positive().optional(),
2392
- agent: z4.enum(["claude", "codex"]).optional()
2385
+ projects: z3.array(ProjectEntrySchema).optional(),
2386
+ dispatch: z3.object({
2387
+ timeoutMs: z3.number().int().positive().optional(),
2388
+ reviewerTimeoutMs: z3.number().int().positive().optional(),
2389
+ killGraceMs: z3.number().int().positive().optional(),
2390
+ agent: z3.enum(["claude", "codex"]).optional()
2393
2391
  }).optional(),
2394
- reviewPolicy: z4.object({
2395
- codeReviewThreshold: z4.string().min(1).optional(),
2396
- securityThreshold: z4.string().min(1).optional(),
2397
- maxRounds: z4.number().optional(),
2398
- maxTaskMinutes: z4.number().optional(),
2399
- readyPushTimeoutMinutes: z4.number().optional()
2392
+ reviewPolicy: z3.object({
2393
+ codeReviewThreshold: z3.string().min(1).optional(),
2394
+ securityThreshold: z3.string().min(1).optional(),
2395
+ maxRounds: z3.number().optional(),
2396
+ maxTaskMinutes: z3.number().optional(),
2397
+ readyPushTimeoutMinutes: z3.number().optional()
2400
2398
  }).optional(),
2401
- securityScan: z4.object({
2402
- command: z4.array(z4.string().min(1)).min(1)
2399
+ securityScan: z3.object({
2400
+ command: z3.array(z3.string().min(1)).min(1)
2403
2401
  }).optional(),
2404
- gateCutovers: z4.object({
2405
- objectivesSinceIssue: z4.number().int().nonnegative().optional(),
2406
- briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
2407
- documentationSinceIssue: z4.number().int().nonnegative().optional(),
2408
- briefRulesSincePr: z4.number().int().nonnegative().optional(),
2409
- agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
2402
+ gateCutovers: z3.object({
2403
+ objectivesSinceIssue: z3.number().int().nonnegative().optional(),
2404
+ briefSectionsSinceIssue: z3.number().int().nonnegative().optional(),
2405
+ documentationSinceIssue: z3.number().int().nonnegative().optional(),
2406
+ briefRulesSincePr: z3.number().int().nonnegative().optional(),
2407
+ agentBoxesRefusedSincePr: z3.number().int().nonnegative().optional()
2410
2408
  }).optional(),
2411
- planning: z4.object({
2412
- collisionThreshold: z4.number().int().nonnegative().optional()
2409
+ planning: z3.object({
2410
+ collisionThreshold: z3.number().int().nonnegative().optional(),
2411
+ reviewRoundLimit: z3.number().int().positive().optional(),
2412
+ reviewAgent: z3.enum(["same", "different"]).optional()
2413
2413
  }).optional(),
2414
- prePush: z4.object({
2415
- alwaysRun: z4.array(z4.string()).optional(),
2416
- readyTests: z4.object({
2417
- mode: z4.literal("ci"),
2418
- workflow: z4.literal(".github/workflows/ci.yml"),
2419
- check: z4.literal("Vinaya CI")
2414
+ prePush: z3.object({
2415
+ alwaysRun: z3.array(z3.string()).optional(),
2416
+ readyTests: z3.object({
2417
+ mode: z3.literal("ci"),
2418
+ workflow: z3.literal(".github/workflows/ci.yml"),
2419
+ check: z3.literal("Vinaya CI")
2420
2420
  }).strict().optional(),
2421
- requiredCi: z4.object({
2422
- workflow: z4.literal(".github/workflows/ci.yml"),
2423
- check: z4.literal("Vinaya CI")
2421
+ requiredCi: z3.object({
2422
+ workflow: z3.literal(".github/workflows/ci.yml"),
2423
+ check: z3.literal("Vinaya CI")
2424
2424
  }).strict().optional()
2425
2425
  }).optional(),
2426
- report: z4.object({
2427
- commandTimeoutMs: z4.number().int().positive().optional()
2426
+ report: z3.object({
2427
+ commandTimeoutMs: z3.number().int().positive().optional()
2428
2428
  }).superRefine((report, ctx) => {
2429
2429
  const commandTimeoutMs = report.commandTimeoutMs;
2430
2430
  if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
2431
2431
  ctx.addIssue({
2432
- code: z4.ZodIssueCode.custom,
2432
+ code: z3.ZodIssueCode.custom,
2433
2433
  path: ["commandTimeoutMs"],
2434
2434
  message: "must be at most 3600000 (1 hour)"
2435
2435
  });
2436
2436
  }
2437
2437
  }).optional(),
2438
- decisionRecords: z4.object({
2438
+ decisionRecords: z3.object({
2439
2439
  path: RepoRelativePathSchema
2440
2440
  }).strict().optional()
2441
2441
  };
@@ -2444,10 +2444,11 @@ var init_vinaya_config_section = __esm(() => {
2444
2444
  "reviewPolicy.maxTaskMinutes",
2445
2445
  "reviewPolicy.readyPushTimeoutMinutes"
2446
2446
  ];
2447
+ REVIEW_AGENT_SETTINGS = ["same", "different"];
2447
2448
  PrincipalsUnresolvedError = class PrincipalsUnresolvedError extends Error {
2448
2449
  kind;
2449
- constructor(kind, message) {
2450
- super(message);
2450
+ constructor(kind, message, options) {
2451
+ super(message, options);
2451
2452
  this.name = "PrincipalsUnresolvedError";
2452
2453
  this.kind = kind;
2453
2454
  }
@@ -2491,7 +2492,7 @@ var init_vinaya_config_section = __esm(() => {
2491
2492
  });
2492
2493
 
2493
2494
  // ../../harness/processes/vinaya-strict/integration/config/compose.ts
2494
- import { z as z5 } from "zod";
2495
+ import { z as z4 } from "zod";
2495
2496
  function globalChecksIgnoredWarning(path) {
2496
2497
  return `${path}: "checks" registration in the global config is ignored — checks may only be registered from a repo-local vinaya.config.json.`;
2497
2498
  }
@@ -2563,7 +2564,7 @@ var init_compose = __esm(() => {
2563
2564
  "logs",
2564
2565
  "decisionRecords"
2565
2566
  ];
2566
- VinayaConfigObjectSchema = z5.object(orderedShape(CONFIG_KEY_ORDER, KERNEL_FRAGMENT, VINAYA_CONFIG_SECTION.fragment));
2567
+ VinayaConfigObjectSchema = z4.object(orderedShape(CONFIG_KEY_ORDER, KERNEL_FRAGMENT, VINAYA_CONFIG_SECTION.fragment));
2567
2568
  VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
2568
2569
  for (const refine of KERNEL_CONFIG_REFINEMENTS)
2569
2570
  refine(config, ctx);
@@ -2611,25 +2612,17 @@ var init_compose = __esm(() => {
2611
2612
  vinayaConfigProvider = {
2612
2613
  homeDir: VINAYA_HOME,
2613
2614
  loadConfig: () => loadConfig(),
2614
- loadTrustAnchorConfig: () => loadTrustAnchorConfig(),
2615
+ loadTrustAnchorConfig: (options) => loadTrustAnchorConfig(undefined, options),
2615
2616
  loadTrustAnchorConfigAsync: (fetcher, options) => loadTrustAnchorConfigAsync(fetcher, options)
2616
2617
  };
2617
2618
  installVinayaConfigProvider();
2618
2619
  });
2619
2620
 
2620
- // ../../harness/processes/vinaya-strict/integration/pre-push-select-tests.ts
2621
- init_compose();
2622
- import { existsSync as existsSync4 } from "node:fs";
2623
-
2624
2621
  // ../../harness/kernel/gates/ring0-hooks/pre-push/pre-push-failed-tests.ts
2625
2622
  import { execFileSync as execFileSync4 } from "node:child_process";
2626
2623
  import { createHash as createHash2 } from "node:crypto";
2627
2624
  import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
2628
2625
  import { dirname as dirname3, isAbsolute as isAbsolute2, join as join3 } from "node:path";
2629
- var FAILED_TESTS_RECORD = "vinaya/pre-push-failed-tests.json";
2630
- var LAST_PUSH_RESULT = "vinaya/pre-push-last-result.json";
2631
- var SELECTION_NOTE = "vinaya/pre-push-selection.json";
2632
- var TEST_SELECTION_COMPLETE = "vinaya-test-selection-complete ";
2633
2626
  function completedTestSelection(log, cwd, expected) {
2634
2627
  const completed = new Set;
2635
2628
  let batch = [];
@@ -2740,17 +2733,6 @@ function parseRecord(text) {
2740
2733
  return null;
2741
2734
  }
2742
2735
  }
2743
- var PASSING_RECORD_VERSION = 2;
2744
- var SELECTION_POLICY = {
2745
- name: "pre-push-since-green",
2746
- version: 1,
2747
- depth: "one",
2748
- testTimeoutMs: 30000,
2749
- rootConfigFile: "vinaya.config.json"
2750
- };
2751
- var VERIFICATION_LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
2752
- var VERIFICATION_INPUT_FILES = ["vinaya.config.json", "package.json", "bunfig.toml", ...VERIFICATION_LOCKFILES];
2753
- var VERIFICATION_ENV_KEYS = ["BUN_ENV", "CI", "NODE_ENV", "NODE_OPTIONS", "TZ"];
2754
2736
  function parsePassingRecord(text) {
2755
2737
  if (!text)
2756
2738
  return null;
@@ -2991,6 +2973,24 @@ function verificationInputsDirty(repoRoot) {
2991
2973
  const out = git(repoRoot, ["status", "--porcelain", "--", ...VERIFICATION_INPUT_FILES]);
2992
2974
  return out === null ? null : out !== "";
2993
2975
  }
2976
+ var FAILED_TESTS_RECORD = "vinaya/pre-push-failed-tests.json", LAST_PUSH_RESULT = "vinaya/pre-push-last-result.json", SELECTION_NOTE = "vinaya/pre-push-selection.json", TEST_SELECTION_COMPLETE = "vinaya-test-selection-complete ", PASSING_RECORD_VERSION = 2, SELECTION_POLICY, VERIFICATION_LOCKFILES, VERIFICATION_INPUT_FILES, VERIFICATION_ENV_KEYS;
2977
+ var init_pre_push_failed_tests = __esm(() => {
2978
+ SELECTION_POLICY = {
2979
+ name: "pre-push-since-green",
2980
+ version: 1,
2981
+ depth: "one",
2982
+ testTimeoutMs: 30000,
2983
+ rootConfigFile: "vinaya.config.json"
2984
+ };
2985
+ VERIFICATION_LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
2986
+ VERIFICATION_INPUT_FILES = ["vinaya.config.json", "package.json", "bunfig.toml", ...VERIFICATION_LOCKFILES];
2987
+ VERIFICATION_ENV_KEYS = ["BUN_ENV", "CI", "NODE_ENV", "NODE_OPTIONS", "TZ"];
2988
+ });
2989
+
2990
+ // ../../harness/processes/vinaya-strict/integration/pre-push-select-tests.ts
2991
+ init_compose();
2992
+ init_pre_push_failed_tests();
2993
+ import { existsSync as existsSync5 } from "node:fs";
2994
2994
 
2995
2995
  // ../../packages/test-selection/src/changed-names.ts
2996
2996
  var ALL_NAMES = "all";
@@ -3156,15 +3156,33 @@ function parseHunkRanges(patch) {
3156
3156
  // ../../packages/test-selection/src/hunk-classes.ts
3157
3157
  var LOAD_ERROR_CODES = new Set([2300, 2392, 2393, 2440, 2448, 2449, 2450, 2451]);
3158
3158
  // ../../packages/test-selection/src/compiler-graph.ts
3159
- import { createRequire } from "node:module";
3159
+ import { createHash as createHash3 } from "node:crypto";
3160
+ import { readdirSync, readFileSync as readFileSync4, realpathSync as realpathSync2 } from "node:fs";
3161
+ import { createRequire as createRequire2 } from "node:module";
3160
3162
  import { dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
3163
+
3164
+ // ../../packages/test-selection/src/path-aliases.ts
3165
+ function resolveAliasedSpecifier(specifier, table) {
3166
+ if (!table)
3167
+ return null;
3168
+ let best = null;
3169
+ for (const alias of table) {
3170
+ if (!specifier.startsWith(alias.prefix) || specifier.length === alias.prefix.length)
3171
+ continue;
3172
+ if (!best || alias.prefix.length > best.prefix.length)
3173
+ best = alias;
3174
+ }
3175
+ return best ? `${best.directory}${specifier.slice(best.prefix.length)}` : null;
3176
+ }
3177
+
3178
+ // ../../packages/test-selection/src/compiler-graph.ts
3161
3179
  function loadTypeScript(repoRoot) {
3162
3180
  return loadTypeScriptFrom([join4(repoRoot, "package.json"), import.meta.url]);
3163
3181
  }
3164
3182
  function loadTypeScriptFrom(anchors) {
3165
3183
  for (const from of anchors) {
3166
3184
  try {
3167
- const loaded = createRequire(from)("typescript");
3185
+ const loaded = createRequire2(from)("typescript");
3168
3186
  if (loaded && typeof loaded.createProgram === "function" && loaded.ScriptTarget)
3169
3187
  return loaded;
3170
3188
  } catch {}
@@ -3183,6 +3201,8 @@ function graphCompilerOptions(ts, input) {
3183
3201
  const paths = {};
3184
3202
  for (const [specifier, entry] of input.entrypoints)
3185
3203
  paths[specifier] = [entry];
3204
+ for (const alias of input.pathAliases ?? [])
3205
+ paths[`${alias.prefix}*`] = [join4(input.repoRoot, alias.directory, "*")];
3186
3206
  return {
3187
3207
  baseUrl: input.repoRoot,
3188
3208
  paths,
@@ -3219,7 +3239,109 @@ function viewCompilerHost(ts, options, root, view) {
3219
3239
  }
3220
3240
  };
3221
3241
  }
3242
+ var REUSED_GRAPH_SLOTS = 2;
3243
+ var reusedGraphs = [];
3244
+ var compilerIdentities = new WeakMap;
3245
+ var compilersSeen = 0;
3246
+ function compilerIdentity(ts) {
3247
+ let id = compilerIdentities.get(ts);
3248
+ if (id === undefined) {
3249
+ id = ++compilersSeen;
3250
+ compilerIdentities.set(ts, id);
3251
+ }
3252
+ return id;
3253
+ }
3254
+ function readRootFile(view, file) {
3255
+ if (view)
3256
+ return view.readFile(file);
3257
+ try {
3258
+ return readFileSync4(file, "utf8");
3259
+ } catch {
3260
+ return;
3261
+ }
3262
+ }
3263
+ function nodeModulesLinks(files) {
3264
+ const folders = new Set;
3265
+ for (const file of files) {
3266
+ let folder = dirname4(file);
3267
+ while (!folders.has(folder)) {
3268
+ folders.add(folder);
3269
+ const parent = dirname4(folder);
3270
+ if (parent === folder)
3271
+ break;
3272
+ folder = parent;
3273
+ }
3274
+ }
3275
+ const links = [];
3276
+ const scan = (folder, scoped) => {
3277
+ let entries;
3278
+ try {
3279
+ entries = readdirSync(folder, { withFileTypes: true });
3280
+ } catch {
3281
+ return;
3282
+ }
3283
+ entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
3284
+ for (const entry of entries) {
3285
+ const path = join4(folder, entry.name);
3286
+ if (entry.isSymbolicLink()) {
3287
+ let target;
3288
+ try {
3289
+ target = realpathSync2(path);
3290
+ } catch {
3291
+ target = "(dangling)";
3292
+ }
3293
+ links.push(`${path} -> ${target}`);
3294
+ } else if (!scoped && entry.isDirectory() && entry.name.startsWith("@")) {
3295
+ scan(path, true);
3296
+ }
3297
+ }
3298
+ };
3299
+ for (const folder of [...folders].sort()) {
3300
+ if (folder.split("/").includes("node_modules"))
3301
+ continue;
3302
+ scan(join4(folder, "node_modules"), false);
3303
+ }
3304
+ return links;
3305
+ }
3306
+ function reuseKey(ts, input) {
3307
+ if (input.workspaceKey === undefined)
3308
+ return null;
3309
+ const hash = createHash3("sha256");
3310
+ const part = (text) => {
3311
+ hash.update(`${text.length}:${text}`);
3312
+ };
3313
+ part(String(compilerIdentity(ts)));
3314
+ part(input.repoRoot);
3315
+ part(input.host ? "view" : "disk");
3316
+ part(input.workspaceKey);
3317
+ part(JSON.stringify([...input.entrypoints]));
3318
+ part(JSON.stringify(input.pathAliases ?? []));
3319
+ part(String(input.files.length));
3320
+ for (const file of input.files) {
3321
+ part(file);
3322
+ const text = readRootFile(input.host, file);
3323
+ part(text === undefined ? "(absent)" : `=${text}`);
3324
+ }
3325
+ if (!input.host)
3326
+ for (const link of nodeModulesLinks(input.files))
3327
+ part(link);
3328
+ return hash.digest("hex");
3329
+ }
3222
3330
  function buildCompilerGraph(ts, input) {
3331
+ const key = reuseKey(ts, input);
3332
+ if (key !== null) {
3333
+ const hit = reusedGraphs.find((entry) => entry.key === key);
3334
+ if (hit) {
3335
+ reusedGraphs = [hit, ...reusedGraphs.filter((entry) => entry !== hit)];
3336
+ return { edges: hit.edges, programMs: 0 };
3337
+ }
3338
+ }
3339
+ const built = buildFreshCompilerGraph(ts, input);
3340
+ if (key !== null)
3341
+ reusedGraphs = [{ key, edges: built.edges }, ...reusedGraphs].slice(0, REUSED_GRAPH_SLOTS);
3342
+ return built;
3343
+ }
3344
+ function buildFreshCompilerGraph(ts, input) {
3223
3345
  const { files, packageOfFile, packageOfBareSpecifier } = input;
3224
3346
  const fileSet = new Set(files);
3225
3347
  const options = graphCompilerOptions(ts, input);
@@ -3307,12 +3429,14 @@ ${specifier}`;
3307
3429
  if (!fileSet.has(file))
3308
3430
  continue;
3309
3431
  const ownPackage = packageOfFile(file);
3432
+ const isPathLike = (specifier) => specifier.startsWith(".") || resolveAliasedSpecifier(specifier, input.pathAliases) !== null;
3310
3433
  const moduleScope = [];
3311
3434
  const reexport = [];
3312
3435
  const resolveWithLiteral = (specifier, into) => {
3313
3436
  const target = resolveToWorkspaceFile(specifier, file);
3314
- if (specifier.startsWith(".")) {
3315
- const literal = resolve2(dirname4(file), specifier);
3437
+ const aliased = resolveAliasedSpecifier(specifier, input.pathAliases);
3438
+ if (specifier.startsWith(".") || aliased !== null) {
3439
+ const literal = aliased !== null ? resolve2(input.repoRoot, aliased) : resolve2(dirname4(file), specifier);
3316
3440
  if (literal !== target && fileSet.has(literal))
3317
3441
  into.push(`${ALL_PREFIX}${literal}`);
3318
3442
  }
@@ -3326,7 +3450,7 @@ ${specifier}`;
3326
3450
  }
3327
3451
  };
3328
3452
  const coarse = (specifier, target, into) => {
3329
- if (!specifier.startsWith(".")) {
3453
+ if (!isPathLike(specifier)) {
3330
3454
  const pkg = packageOfBareSpecifier(specifier);
3331
3455
  if (pkg)
3332
3456
  into.push(`${EXTERNAL_PREFIX}${pkg}`);
@@ -3393,7 +3517,7 @@ ${specifier}`;
3393
3517
  if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)) {
3394
3518
  const specifier = statement.moduleSpecifier.text;
3395
3519
  const target = resolveWithLiteral(specifier, moduleScope);
3396
- if (!target && specifier.startsWith("."))
3520
+ if (!target && isPathLike(specifier))
3397
3521
  continue;
3398
3522
  const clause = statement.importClause;
3399
3523
  if (!clause) {
@@ -3416,7 +3540,7 @@ ${specifier}`;
3416
3540
  continue;
3417
3541
  const specifier = statement.moduleSpecifier.text;
3418
3542
  const target = resolveWithLiteral(specifier, reexport);
3419
- if (!target && specifier.startsWith("."))
3543
+ if (!target && isPathLike(specifier))
3420
3544
  continue;
3421
3545
  if (!statement.exportClause || !ts.isNamedExports(statement.exportClause)) {
3422
3546
  coarse(specifier, target, reexport);
@@ -3528,8 +3652,8 @@ var CLONE_CALLS = new Set(["clone", "clone3", "fork", "vfork"]);
3528
3652
  var OPEN_CALLS = new Set(["open", "openat", "openat2", "creat"]);
3529
3653
  var GIT_PATH_READERS = new Set(["show", "cat-file", "rev-parse"]);
3530
3654
  // ../../packages/test-selection/src/selector.ts
3531
- import { readdirSync, readFileSync as readFileSync4, statSync } from "node:fs";
3532
- import { dirname as dirname7, extname, isAbsolute as isAbsolute5, join as join7, resolve as resolve5 } from "node:path";
3655
+ import { readdirSync as readdirSync2, readFileSync as readFileSync5, statSync } from "node:fs";
3656
+ import { basename as basename2, dirname as dirname7, extname, isAbsolute as isAbsolute5, join as join7, resolve as resolve5 } from "node:path";
3533
3657
 
3534
3658
  // ../../packages/test-selection/src/scanner-inputs.ts
3535
3659
  import { dirname as dirname5, isAbsolute as isAbsolute3, join as join5, resolve as resolve3 } from "node:path";
@@ -3902,7 +4026,7 @@ function diskTree(root) {
3902
4026
  root,
3903
4027
  readDir: (path) => {
3904
4028
  try {
3905
- return readdirSync(path);
4029
+ return readdirSync2(path);
3906
4030
  } catch {
3907
4031
  return null;
3908
4032
  }
@@ -3916,7 +4040,7 @@ function diskTree(root) {
3916
4040
  },
3917
4041
  readFile: (path) => {
3918
4042
  try {
3919
- return readFileSync4(path, "utf8");
4043
+ return readFileSync5(path, "utf8");
3920
4044
  } catch {
3921
4045
  return null;
3922
4046
  }
@@ -4046,6 +4170,10 @@ function resolveRelativeImport(fromFile, specifier, knownFiles) {
4046
4170
  return null;
4047
4171
  return resolveFileCandidate(resolve5(dirname7(fromFile), specifier), knownFiles);
4048
4172
  }
4173
+ function resolveAliasedImport(root, specifier, table, knownFiles) {
4174
+ const path = resolveAliasedSpecifier(specifier, table);
4175
+ return path === null ? null : resolveFileCandidate(join7(root, path), knownFiles);
4176
+ }
4049
4177
  function isBunTestScript(script) {
4050
4178
  if (!script)
4051
4179
  return true;
@@ -4101,11 +4229,108 @@ function deriveEntrypoints(dir, pkg, knownFiles) {
4101
4229
  add(".", pkg.main);
4102
4230
  return out;
4103
4231
  }
4232
+ var yamlEscapes = new Map([
4233
+ ["0", "\x00"],
4234
+ ["a", "\x07"],
4235
+ ["b", "\b"],
4236
+ ["t", "\t"],
4237
+ ["\t", "\t"],
4238
+ ["n", `
4239
+ `],
4240
+ ["v", "\v"],
4241
+ ["f", "\f"],
4242
+ ["r", "\r"],
4243
+ ["e", "\x1B"],
4244
+ [" ", " "],
4245
+ ['"', '"'],
4246
+ ["/", "/"],
4247
+ ["\\", "\\"],
4248
+ ["N", "…"],
4249
+ ["_", " "],
4250
+ ["L", "\u2028"],
4251
+ ["P", "\u2029"]
4252
+ ]);
4253
+ function decodeDoubleQuotedPattern(text) {
4254
+ let pattern = "";
4255
+ let offset = 0;
4256
+ for (const match of text.matchAll(/\\(?:x([\da-fA-F]{2})|u([\da-fA-F]{4})|U([\da-fA-F]{8})|([^\n])?)/g)) {
4257
+ pattern += text.slice(offset, match.index);
4258
+ const hex = match[1] ?? match[2] ?? match[3];
4259
+ if (hex !== undefined) {
4260
+ const codePoint = Number.parseInt(hex, 16);
4261
+ if (codePoint > 1114111)
4262
+ return null;
4263
+ pattern += String.fromCodePoint(codePoint);
4264
+ } else {
4265
+ const decoded = yamlEscapes.get(match[4] ?? "");
4266
+ if (decoded === undefined)
4267
+ return null;
4268
+ pattern += decoded;
4269
+ }
4270
+ offset = match.index + match[0].length;
4271
+ }
4272
+ return pattern + text.slice(offset);
4273
+ }
4274
+ function workspacePatternScalar(text, inline) {
4275
+ if (text.startsWith("'") || text.startsWith('"')) {
4276
+ const quoted = /^(?:'((?:[^']|'')*)'|"((?:[^"\\]|\\.)*)")/.exec(text);
4277
+ if (!quoted)
4278
+ return null;
4279
+ const pattern = quoted[1]?.replace(/''/g, "'") ?? decodeDoubleQuotedPattern(quoted[2] ?? "");
4280
+ if (pattern === null)
4281
+ return null;
4282
+ return { pattern, rest: text.slice(quoted[0].length).trimStart() };
4283
+ }
4284
+ const scalar = inline ? /^[^,[\]]*/.exec(text)?.[0] ?? "" : text;
4285
+ const comment = /(?:^|\s)#/.exec(scalar);
4286
+ const pattern = scalar.slice(0, comment?.index ?? scalar.length).trimEnd();
4287
+ if (!pattern || /:(?:\s|$)/.test(pattern) || /^(?:[[{|>]|[-?:](?:\s|$))/.test(pattern))
4288
+ return null;
4289
+ return { pattern, rest: comment ? scalar.slice(comment.index).trimStart() : text.slice(scalar.length) };
4290
+ }
4291
+ function pnpmWorkspacePatterns(content) {
4292
+ const lines = content.split(/\r?\n/);
4293
+ const index = lines.findIndex((line) => /^packages:(?:\s|$)/.test(line));
4294
+ if (index === -1)
4295
+ return [];
4296
+ const value = lines[index]?.slice("packages:".length).trim() ?? "";
4297
+ const patterns = [];
4298
+ if (value.startsWith("[")) {
4299
+ let rest = value.slice(1).trimStart();
4300
+ while (!/^\]\s*(?:#.*)?$/.test(rest)) {
4301
+ const item = workspacePatternScalar(rest, true);
4302
+ if (!item)
4303
+ return [];
4304
+ patterns.push(item.pattern);
4305
+ if (item.rest.startsWith("]"))
4306
+ rest = item.rest;
4307
+ else if (item.rest.startsWith(","))
4308
+ rest = item.rest.slice(1).trimStart();
4309
+ else
4310
+ return [];
4311
+ }
4312
+ } else if (value === "" || value.startsWith("#")) {
4313
+ for (const line of lines.slice(index + 1)) {
4314
+ if (/^\s*(?:#.*)?$/.test(line))
4315
+ continue;
4316
+ const entry = /^\s*-\s+/.exec(line);
4317
+ if (!entry)
4318
+ break;
4319
+ const item = workspacePatternScalar(line.slice(entry[0].length), false);
4320
+ if (!item || item.rest && !item.rest.startsWith("#"))
4321
+ break;
4322
+ patterns.push(item.pattern);
4323
+ }
4324
+ }
4325
+ return patterns;
4326
+ }
4104
4327
  function readWorkspacePatterns(tree) {
4105
4328
  try {
4106
4329
  const rootPkg = JSON.parse(tree.readFile(join7(tree.root, "package.json")) ?? "");
4107
4330
  const declared = Array.isArray(rootPkg.workspaces) ? rootPkg.workspaces : rootPkg.workspaces?.packages ?? [];
4108
- return declared.filter((entry) => typeof entry === "string");
4331
+ const manifestPatterns = declared.filter((entry) => typeof entry === "string");
4332
+ const pnpmPatterns = pnpmWorkspacePatterns(tree.readFile(join7(tree.root, "pnpm-workspace.yaml")) ?? "");
4333
+ return [...manifestPatterns, ...pnpmPatterns.filter((entry) => !manifestPatterns.includes(entry))];
4109
4334
  } catch {
4110
4335
  return null;
4111
4336
  }
@@ -4293,6 +4518,8 @@ function resolveSpecifierToFile(ctx, fromFile, specifier) {
4293
4518
  const knownFiles = pkgDir ? ctx.knownFilesByPkgDir.get(pkgDir) : undefined;
4294
4519
  return knownFiles ? resolveRelativeImport(fromFile, specifier, knownFiles) : null;
4295
4520
  }
4521
+ if (ctx.isAliased(specifier))
4522
+ return ctx.resolveAlias(specifier);
4296
4523
  return ctx.packageOfBareSpecifier(specifier)?.entry ?? null;
4297
4524
  }
4298
4525
  function resolveExportedName(ctx, file, name, stack) {
@@ -4341,7 +4568,7 @@ function resolveThroughTable(ctx, file, name, table, stack) {
4341
4568
  const ownHopDeps = () => {
4342
4569
  const out = new Set;
4343
4570
  for (const record of table.ownImports) {
4344
- if (record.specifier.startsWith(".")) {
4571
+ if (record.specifier.startsWith(".") || ctx.isAliased(record.specifier)) {
4345
4572
  const resolved = resolveSpecifierToFile(ctx, file, record.specifier);
4346
4573
  if (resolved)
4347
4574
  out.add(resolved);
@@ -4461,6 +4688,8 @@ function buildSelectionGraph(tree, options) {
4461
4688
  resultCache,
4462
4689
  knownFilesByPkgDir,
4463
4690
  packageDirOf: (file) => sortedPkgDirs.find((d) => file.startsWith(`${d}/`)) ?? null,
4691
+ isAliased: (specifier) => resolveAliasedSpecifier(specifier, options.pathAliases) !== null,
4692
+ resolveAlias: (specifier) => resolveAliasedImport(repoRoot, specifier, options.pathAliases, allSourceFiles),
4464
4693
  packageOfBareSpecifier: (specifier) => {
4465
4694
  const m = matchPackage(specifier);
4466
4695
  return m ? { name: m.pkg.name, entry: m.pkg.entrypoints.get(m.subpath) ?? null } : null;
@@ -4478,11 +4707,13 @@ function buildSelectionGraph(tree, options) {
4478
4707
  }
4479
4708
  }
4480
4709
  const graph = buildCompilerGraph(graphTypescript, {
4710
+ workspaceKey: JSON.stringify(packages.map((pkg) => [pkg.name, pkg.dir, tree.readFile(join7(pkg.dir, "package.json"))])),
4481
4711
  repoRoot,
4482
4712
  files: [...allSourceFiles],
4483
4713
  packageOfFile: (f) => fileToPackage.get(f) ?? null,
4484
4714
  packageOfBareSpecifier: (specifier) => matchPackage(specifier)?.pkg.name ?? null,
4485
4715
  entrypoints,
4716
+ ...options.pathAliases ? { pathAliases: options.pathAliases } : {},
4486
4717
  ...tree.host ? { host: tree.host } : {}
4487
4718
  });
4488
4719
  for (const [node, deps] of graph.edges)
@@ -4507,6 +4738,12 @@ function buildSelectionGraph(tree, options) {
4507
4738
  deps.push(resolved);
4508
4739
  continue;
4509
4740
  }
4741
+ if (ctx.isAliased(specifier)) {
4742
+ const resolved = ctx.resolveAlias(specifier);
4743
+ if (resolved)
4744
+ deps.push(resolved);
4745
+ continue;
4746
+ }
4510
4747
  const match = matchPackage(specifier);
4511
4748
  if (!match)
4512
4749
  continue;
@@ -4654,7 +4891,8 @@ function selectAffectedFiles(tree, changedFiles, options = {}) {
4654
4891
  repoTreeScanners: options.repoTreeScanners ?? depthOneDefault,
4655
4892
  spawnDetection: options.spawnDetection ?? depthOneDefault,
4656
4893
  spawnPrograms: options.spawnPrograms ?? [],
4657
- isTest: isTestFile
4894
+ isTest: isTestFile,
4895
+ ...options.pathAliases ? { pathAliases: options.pathAliases } : {}
4658
4896
  });
4659
4897
  const { packages, pkgFiles, edges, readSource } = graph;
4660
4898
  const changeFacts = changeFactsFor(graph, absChanged, options.affectedNames ?? new Map);
@@ -4815,6 +5053,7 @@ function reaches(start, edges, changed, maxDepth = Number.POSITIVE_INFINITY) {
4815
5053
  }
4816
5054
  return null;
4817
5055
  }
5056
+ var DEPENDENCY_LISTS = new Set(["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]);
4818
5057
 
4819
5058
  // ../../packages/test-selection/src/recorder.ts
4820
5059
  var RECORDER_TIME_LIMIT_MS = 15 * 60000;
@@ -4931,6 +5170,53 @@ function showBlob(repoRoot, ref, relative) {
4931
5170
  }
4932
5171
  }
4933
5172
 
5173
+ // ../../harness/kernel/imports/alias-table.ts
5174
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
5175
+ import { join as join9, posix } from "node:path";
5176
+ var BASE_CONFIG_PATH = "packages/typescript-config/base.json";
5177
+ function parseAliasTable(configText, configPath = BASE_CONFIG_PATH) {
5178
+ let document;
5179
+ try {
5180
+ document = JSON.parse(configText);
5181
+ } catch {
5182
+ return [];
5183
+ }
5184
+ const options = document?.compilerOptions;
5185
+ const paths = options?.paths;
5186
+ if (!paths || typeof paths !== "object" || Array.isArray(paths))
5187
+ return [];
5188
+ const out = [];
5189
+ for (const [key, targets] of Object.entries(paths)) {
5190
+ if (!key.endsWith("/*") || !Array.isArray(targets) || targets.length !== 1)
5191
+ continue;
5192
+ const target = targets[0];
5193
+ if (typeof target !== "string" || !target.endsWith("/*"))
5194
+ continue;
5195
+ const directory = posix.normalize(posix.join(posix.dirname(configPath), target.slice(0, -1))).replace(/\/$/, "");
5196
+ if (directory === "" || directory === "." || directory.startsWith(".."))
5197
+ continue;
5198
+ out.push({ prefix: key.slice(0, -1), directory: `${directory}/` });
5199
+ }
5200
+ return out;
5201
+ }
5202
+ var cache = new Map;
5203
+ function readAliasTable(repoRoot) {
5204
+ const file = join9(repoRoot, BASE_CONFIG_PATH);
5205
+ try {
5206
+ if (!existsSync4(file))
5207
+ return [];
5208
+ const text = readFileSync6(file, "utf8");
5209
+ const held = cache.get(file);
5210
+ if (held && held.text === text)
5211
+ return held.table;
5212
+ const table = parseAliasTable(text, BASE_CONFIG_PATH);
5213
+ cache.set(file, { text, table });
5214
+ return table;
5215
+ } catch {
5216
+ return [];
5217
+ }
5218
+ }
5219
+
4934
5220
  // ../../harness/kernel/gates/ring0-hooks/pre-push/cli-spawn-tests.ts
4935
5221
  var CLI_SPAWN_BINARY = "bun";
4936
5222
 
@@ -5054,7 +5340,16 @@ var SCANNER_DECLARATIONS = [
5054
5340
  ],
5055
5341
  trigger: "listed-files"
5056
5342
  },
5057
- { test: "apps/cli/tests/import-boundary.test.ts", roots: ["apps/cli/"], trigger: "content" },
5343
+ {
5344
+ test: "apps/cli/tests/import-boundary.test.ts",
5345
+ roots: [
5346
+ "apps/cli/",
5347
+ "apps/log-server/package.json",
5348
+ "apps/vinaya-portal/package.json",
5349
+ "apps/vinaya-studio/package.json"
5350
+ ],
5351
+ trigger: "content"
5352
+ },
5058
5353
  {
5059
5354
  test: "harness/processes/vinaya-strict/integration/log/client/log-entry-paths.test.ts",
5060
5355
  roots: [".github/workflows/", ".vinaya/hooks/", ".claude/settings.json", "vinaya.config.json"],
@@ -5122,7 +5417,8 @@ var SCANNER_DECLARATIONS = [
5122
5417
  trigger: "content"
5123
5418
  },
5124
5419
  { test: "harness/processes/vinaya-strict/checks/no-binary-sources.test.ts", roots: ["."], trigger: "content" },
5125
- { test: "harness/processes/vinaya-strict/checks/retired-vocabulary.test.ts", roots: ["."], trigger: "content" }
5420
+ { test: "harness/processes/vinaya-strict/checks/retired-vocabulary.test.ts", roots: ["."], trigger: "content" },
5421
+ { test: "harness/processes/vinaya-strict/tools/reader-resolvable-prose.test.ts", roots: ["."], trigger: "content" }
5126
5422
  ];
5127
5423
  // ../../harness/processes/vinaya-strict/integration/repository-verification.ts
5128
5424
  var DEFAULT_CLI_ENTRYPOINT = "apps/cli/src/index.ts";
@@ -5130,7 +5426,9 @@ var DEFAULT_CONFIG_LOADER = "harness/processes/vinaya-strict/integration/config/
5130
5426
  var ROOT_CONFIG_FILENAME = "vinaya.config.json";
5131
5427
  function selectAffectedTestFiles(repoRoot, changedFiles, options = {}) {
5132
5428
  const cliEntrypoint = options.cliEntrypoint ?? DEFAULT_CLI_ENTRYPOINT;
5429
+ const pathAliases = readAliasTable(repoRoot);
5133
5430
  return selectAffectedFiles(diskTree(repoRoot), changedFiles, {
5431
+ ...pathAliases.length > 0 ? { pathAliases } : {},
5134
5432
  ...options.alwaysRun ? { alwaysRun: options.alwaysRun } : {},
5135
5433
  ...options.addedOrRenamed ? { addedOrRenamed: options.addedOrRenamed } : {},
5136
5434
  ...options.removed ? { removed: options.removed } : {},
@@ -5192,7 +5490,7 @@ function main() {
5192
5490
  context: computeVerificationContext(repoRoot)?.digest ?? null,
5193
5491
  inputsClean: verificationInputsDirty(repoRoot) === false,
5194
5492
  isAncestor: (ancestor) => isAncestor(repoRoot, ancestor, head),
5195
- exists: existsSync4,
5493
+ exists: existsSync5,
5196
5494
  changedBetween: (from) => changedBetween(repoRoot, from, head),
5197
5495
  isAlwaysRun: (path) => alwaysRun.some((re) => re.test(path.slice(repoRoot.length + 1))),
5198
5496
  sinceGreen: (from) => {