@attalabs/vinaya 0.39.0 → 0.40.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 (151) hide show
  1. package/README.md +9 -9
  2. package/aeg-root/contracts/planner-developer.md +1 -1
  3. package/aeg-root/enforcement.md +22 -22
  4. package/aeg-root/process.md +1 -1
  5. package/aeg-root/roles/archivist.md +1 -1
  6. package/aeg-root/roles/developer/reference.md +4 -1
  7. package/aeg-root/roles/developer.md +1 -1
  8. package/aeg-root/roles/planner/reference.md +18 -5
  9. package/aeg-root/roles/principal.md +1 -1
  10. package/aeg-root/roles/reviewer.md +3 -3
  11. package/aeg-root/roles/security.md +4 -4
  12. package/aeg-root/roles/tranche-archivist.md +2 -2
  13. package/aeg-root/skills/aeg/SKILL.md +1 -1
  14. package/aeg-root/state-machine.md +8 -13
  15. package/aeg-root/templates/brief-template.md +4 -1
  16. package/aeg-root/templates/decision-record-template.md +38 -0
  17. package/aeg-root/templates/issue-rationale-template.md +1 -1
  18. package/aeg-root/tranche-model.md +1 -1
  19. package/dist/checks/bin/check-body-bare-digits.js +1867 -347
  20. package/dist/checks/bin/check-branch-topology.js +1181 -237
  21. package/dist/checks/bin/check-brief-shape.js +1911 -433
  22. package/dist/checks/bin/check-changeset-coverage.js +2144 -517
  23. package/dist/checks/bin/check-ci-shard-coverage.js +12133 -11
  24. package/dist/checks/bin/check-closes-n.js +1181 -237
  25. package/dist/checks/bin/check-coherence.js +1785 -1126
  26. package/dist/checks/bin/check-dead-branch-push.js +1154 -225
  27. package/dist/checks/bin/check-dispatch-readiness.js +2068 -436
  28. package/dist/checks/bin/check-doc-claims.js +2104 -231
  29. package/dist/checks/bin/check-doc-coverage-push.js +2181 -515
  30. package/dist/checks/bin/check-doc-coverage.js +2181 -519
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +1668 -345
  32. package/dist/checks/bin/check-doctrine-portability.js +2143 -516
  33. package/dist/checks/bin/check-evidence-fresh.js +2080 -465
  34. package/dist/checks/bin/check-exec-bits.js +2130 -503
  35. package/dist/checks/bin/check-first-push-dispatch.js +1845 -371
  36. package/dist/checks/bin/check-issue-assignment.js +712 -170
  37. package/dist/checks/bin/check-issue-milestone-attach.js +1145 -225
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +1661 -338
  39. package/dist/checks/bin/check-issue-parts-coverage.js +1145 -225
  40. package/dist/checks/bin/check-issue-surface-globs.js +1787 -369
  41. package/dist/checks/bin/check-issue-title-grammar.js +1145 -225
  42. package/dist/checks/bin/check-issue-tranche-label.js +702 -170
  43. package/dist/checks/bin/check-main-branch-refusal.js +1157 -227
  44. package/dist/checks/bin/check-no-disk-state.js +1145 -225
  45. package/dist/checks/bin/check-pr-premise-reassert.js +1661 -338
  46. package/dist/checks/bin/check-pr-report-density.js +1145 -225
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +2379 -249
  48. package/dist/checks/bin/check-quoted-command.js +2128 -501
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +2170 -517
  50. package/dist/checks/bin/check-registry-gates.js +1228 -272
  51. package/dist/checks/bin/check-retired-vocabulary.js +2153 -507
  52. package/dist/checks/bin/check-review-gate.js +1932 -350
  53. package/dist/checks/bin/check-single-plan-pr.js +1208 -229
  54. package/dist/checks/bin/check-surface-scope.js +1414 -244
  55. package/dist/checks/bin/check-test-plan.js +2381 -252
  56. package/dist/checks/bin/check-token-collection-wired.js +1145 -225
  57. package/dist/checks/bin/check-workspace-escape.js +2141 -514
  58. package/dist/checks/bin/verify-coherence.js +493 -86
  59. package/dist/checks/bin/verify-dispatch.js +512 -132
  60. package/dist/checks/bin/verify-docs.js +549 -124
  61. package/dist/index.js +22702 -17900
  62. package/dist/lib/pre-push-cache-test-run.js +1026 -233
  63. package/dist/lib/pre-push-select-tests.js +922 -173
  64. package/package.json +12 -1
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +13 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +55 -26
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +12 -1
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +22 -1
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -1
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/entry-point.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +2 -1
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +19 -2
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +593 -55
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +19 -2
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
  78. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  79. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  80. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  81. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  82. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +2 -2
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  122. 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
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0sxadt2._.js +13 -0
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +57 -0
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1ug9syi._.js → [root-of-the-server]__1wzfiav._.js} +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  138. 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
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  143. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 1p3vr9qts86_b.js} +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 21tunzmxjvm2a.js} +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 38kom-9c-oi65.js} +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__04adkz-._.js +0 -57
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +0 -13
  149. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_buildManifest.js +0 -0
  150. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_clientMiddlewareManifest.js +0 -0
  151. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_ssgManifest.js +0 -0
@@ -2,8 +2,8 @@
2
2
 
3
3
  // ../../packages/aeg-core/bin/verify-docs.ts
4
4
  import { execFileSync as execFileSync2, execSync } from "node:child_process";
5
- import { existsSync, readdirSync, readFileSync as readFileSync2 } from "node:fs";
6
- import { join } from "node:path";
5
+ import { existsSync, readdirSync, readFileSync as readFileSync3 } from "node:fs";
6
+ import { join as join2 } from "node:path";
7
7
 
8
8
  // ../../packages/aeg-core/src/docs/parse-doc.ts
9
9
  import matter from "gray-matter";
@@ -190,6 +190,347 @@ function findHeadingLine(lines, pattern) {
190
190
  return null;
191
191
  }
192
192
 
193
+ // ../../packages/aeg-core/src/prose-rules.ts
194
+ var RETIRED_GLOBAL_EXEMPTIONS = [
195
+ "docs/decisions-legacy.md",
196
+ "apps/herald-ai/docs/",
197
+ "apps/vada-ai/docs/",
198
+ "aeg-root/tranches/completed/",
199
+ "packages/aeg-core/src/docs/published-prose",
200
+ "packages/aeg-core/src/retired-vocabulary.test.ts",
201
+ "packages/aeg-core/src/retired-vocabulary.ts",
202
+ "/fixtures/",
203
+ "/node_modules/",
204
+ "/.next/",
205
+ "/.turbo/"
206
+ ];
207
+ var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
208
+ var TRANCHE_MODEL_FILE = "/tranche-model.md";
209
+ var RETIRED_PATTERN_EXEMPTIONS = {
210
+ [String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
211
+ [String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
212
+ "docs-index.md",
213
+ "apps/vada-ai/specs/legacy/README.md",
214
+ "apps/vada-ai/specs/vada-product-spec.md",
215
+ "apps/vada-ai/web/CLAUDE.md",
216
+ "apps/vada-ai/CLAUDE.md"
217
+ ],
218
+ "decisions-legacy": [
219
+ "packages/aeg-core/src/file-classify.ts",
220
+ "packages/aeg-core/src/file-classify.test.ts",
221
+ "packages/aeg-core/src/pr-tier.test.ts",
222
+ "docs-index.md",
223
+ ".claude/skills/database/SKILL.md",
224
+ ".claude/skills/vada-architecture/SKILL.md",
225
+ "apps/vada-ai/specs/vada-byok-principles.md",
226
+ "apps/vada-ai/web/CLAUDE.md",
227
+ "apps/vada-ai/CLAUDE.md"
228
+ ],
229
+ CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
230
+ ...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
231
+ };
232
+ var retiredPatterns = [
233
+ String.raw`\bD-[0-9]{3}\b`,
234
+ "D-(###|NNN|nnn|xxx)",
235
+ "decision (entry|logged)",
236
+ "decision-log entry",
237
+ "decision log entry",
238
+ "decision log(s|ged|ging)?([^a-z]|$)",
239
+ "decision-log",
240
+ "decision entr",
241
+ "decisions? (are |is )?logged",
242
+ "log entries",
243
+ String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
244
+ "decisions-legacy",
245
+ "CONTRADICTION",
246
+ "assumes Tier 3",
247
+ "Lock: ?YES",
248
+ "Lock: ?NO",
249
+ "lock approvals?",
250
+ "approves locks",
251
+ "Conforms to lock",
252
+ "Challenges lock",
253
+ "checkDecisionNumbersFresh",
254
+ String.raw`roles/team-leader\.md`,
255
+ String.raw`\(,`,
256
+ String.raw`,\)`,
257
+ String.raw`\(\.\)`,
258
+ ...PLAN_ON_DISK_PATTERNS
259
+ ];
260
+ var published = [
261
+ ["decision-id", "a decision id", /\bD-\d{3,}\b/],
262
+ ["section-ref", "a section reference", /§/],
263
+ ["forge-number", "a forge number", /#\d+/],
264
+ ["retired-name", "the retired public name", /\bAEG\b/],
265
+ ["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
266
+ [
267
+ "label-vocabulary",
268
+ "forge label vocabulary",
269
+ /(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
270
+ ],
271
+ ["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
272
+ ["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
273
+ [
274
+ "internal-path",
275
+ "a repo-internal file",
276
+ /(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
277
+ ]
278
+ ];
279
+ var DEFAULT_PROSE_RULES = [
280
+ {
281
+ id: "forge-number",
282
+ group: "reader-resolvable",
283
+ scopes: ["ships", "reader-facing", "spec"],
284
+ patterns: { prose: /#[0-9]{2,4}/g },
285
+ flags: ["global"],
286
+ message: "a forge number",
287
+ severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
288
+ exemptions: []
289
+ },
290
+ {
291
+ id: "tranche-slug",
292
+ group: "reader-resolvable",
293
+ scopes: ["ships", "reader-facing", "product", "spec"],
294
+ patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
295
+ flags: ["global"],
296
+ message: "an internal tranche slug",
297
+ severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
298
+ exemptions: []
299
+ },
300
+ {
301
+ id: "task-number",
302
+ group: "reader-resolvable",
303
+ scopes: ["spec"],
304
+ patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
305
+ flags: ["global", "ignore-case"],
306
+ message: "a task number",
307
+ severity: { spec: "error" },
308
+ exemptions: []
309
+ },
310
+ {
311
+ id: "source-comment-tranche-slug",
312
+ group: "reader-resolvable",
313
+ scopes: ["source-comment"],
314
+ patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
315
+ flags: ["global"],
316
+ message: "a tranche-slug citation",
317
+ severity: { "source-comment": "warning" },
318
+ exemptions: []
319
+ },
320
+ {
321
+ id: "source-comment-forge-number",
322
+ group: "reader-resolvable",
323
+ scopes: ["source-comment"],
324
+ patterns: { comment: /#[0-9]{2,}/g },
325
+ flags: ["global"],
326
+ message: "a forge-number citation",
327
+ severity: { "source-comment": "warning" },
328
+ exemptions: []
329
+ },
330
+ {
331
+ id: "legacy-batch-name",
332
+ group: "reader-resolvable",
333
+ scopes: ["ships", "reader-facing", "spec"],
334
+ patterns: {},
335
+ flags: ["built-in"],
336
+ message: "an internal tranche slug",
337
+ severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
338
+ exemptions: [],
339
+ builtIn: true
340
+ },
341
+ {
342
+ id: "coined-term",
343
+ group: "reader-resolvable",
344
+ scopes: ["ships", "reader-facing"],
345
+ patterns: {},
346
+ flags: ["built-in"],
347
+ message: "uses coined term without defining it inline or linking the glossary",
348
+ severity: { ships: "warning", "reader-facing": "warning" },
349
+ exemptions: [],
350
+ builtIn: true
351
+ },
352
+ ...retiredPatterns.map((pattern, index) => ({
353
+ id: `retired-vocabulary-${index + 1}`,
354
+ group: "retired-vocabulary",
355
+ scopes: ["repository"],
356
+ patterns: { repository: pattern },
357
+ flags: [],
358
+ message: "retired vocabulary",
359
+ severity: { repository: "error" },
360
+ exemptions: RETIRED_GLOBAL_EXEMPTIONS,
361
+ patternExemptions: RETIRED_PATTERN_EXEMPTIONS
362
+ })),
363
+ ...published.map(([id, message, pattern]) => ({
364
+ id,
365
+ group: "published-prose",
366
+ scopes: ["published"],
367
+ patterns: { published: pattern },
368
+ flags: [],
369
+ message,
370
+ severity: { published: "error" },
371
+ exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
372
+ }))
373
+ ];
374
+ var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
375
+ var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
376
+ var RETIRED_SCOPES = ["repository"];
377
+ var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
378
+ function groupOfScope(scope) {
379
+ if (RESOLVABLE_SCOPES.includes(scope))
380
+ return "reader-resolvable";
381
+ if (RETIRED_SCOPES.includes(scope))
382
+ return "retired-vocabulary";
383
+ return;
384
+ }
385
+ var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
386
+ function normalizeRepoPath(entry) {
387
+ let out = entry.replace(/\\/g, "/");
388
+ while (out.startsWith("./"))
389
+ out = out.slice(2);
390
+ out = out.replace(/\/{2,}/g, "/");
391
+ while (out.endsWith("/"))
392
+ out = out.slice(0, -1);
393
+ return out;
394
+ }
395
+ var RESOLVABLE_RUN_ORDER = [
396
+ "forge-number",
397
+ "tranche-slug",
398
+ "legacy-batch-name",
399
+ "task-number",
400
+ "source-comment-tranche-slug",
401
+ "source-comment-forge-number",
402
+ "coined-term"
403
+ ];
404
+ var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
405
+ function scopeDefaultSeverity(scope, sourceCommentSeverity) {
406
+ if (scope === "source-comment")
407
+ return sourceCommentSeverity ?? "warning";
408
+ if (scope === "repository")
409
+ return "error";
410
+ return "warning";
411
+ }
412
+ function applySeverity(scopes, base, setting) {
413
+ const out = {};
414
+ for (const scope of scopes) {
415
+ const configured = typeof setting === "string" ? setting : setting?.[scope];
416
+ const value = configured ?? base[scope];
417
+ if (value !== undefined)
418
+ out[scope] = value;
419
+ }
420
+ return out;
421
+ }
422
+ function defaultPatternFor(rule) {
423
+ const cache = new Map;
424
+ return (scope) => {
425
+ if (cache.has(scope))
426
+ return cache.get(scope) ?? null;
427
+ const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
428
+ const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
429
+ cache.set(scope, compiled);
430
+ return compiled;
431
+ };
432
+ }
433
+ function customPatternFor(rule, global) {
434
+ const cache = new Map;
435
+ return (scope) => {
436
+ if (cache.has(scope))
437
+ return cache.get(scope) ?? null;
438
+ const source = rule.patterns?.[scope] ?? rule.pattern;
439
+ const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
440
+ cache.set(scope, compiled);
441
+ return compiled;
442
+ };
443
+ }
444
+ function resolveProseRules(config = undefined, options = {}) {
445
+ const rules = [];
446
+ const defaults = config?.defaults ?? {};
447
+ for (const rule of CONFIGURABLE_DEFAULT_RULES) {
448
+ const override = defaults[rule.id];
449
+ if (override === "off")
450
+ continue;
451
+ const group = rule.group;
452
+ const scopes = override?.scopes ?? rule.scopes;
453
+ const base = {};
454
+ for (const scope of scopes) {
455
+ base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
456
+ }
457
+ rules.push({
458
+ id: rule.id,
459
+ group,
460
+ custom: false,
461
+ builtIn: rule.builtIn === true,
462
+ scopes,
463
+ message: rule.message,
464
+ severity: applySeverity(scopes, base, override?.severity),
465
+ exempt: override?.exempt ?? [],
466
+ substringExempt: rule.exemptions,
467
+ reportGroup: REPORT_GROUPS[rule.id],
468
+ patternFor: defaultPatternFor(rule)
469
+ });
470
+ }
471
+ for (const rule of config?.custom ?? []) {
472
+ const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
473
+ const base = {};
474
+ for (const scope of rule.scopes)
475
+ base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
476
+ rules.push({
477
+ id: rule.id,
478
+ group,
479
+ custom: true,
480
+ builtIn: false,
481
+ scopes: rule.scopes,
482
+ message: rule.means,
483
+ severity: applySeverity(rule.scopes, base, rule.severity),
484
+ exempt: rule.exempt ?? [],
485
+ substringExempt: [],
486
+ patternFor: customPatternFor(rule, group === "reader-resolvable")
487
+ });
488
+ }
489
+ if (options.decisionRecordsPath !== undefined)
490
+ rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
491
+ const order = (rule) => {
492
+ const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
493
+ return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
494
+ };
495
+ const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
496
+ const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
497
+ return {
498
+ rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
499
+ exempt: config?.exempt ?? [],
500
+ repoRoot: options.repoRoot
501
+ };
502
+ }
503
+ var DEFAULT_PROSE_RULE_SET = resolveProseRules();
504
+ var DECISION_RECORD_CITATION_ID = "decision-record-citation";
505
+ var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
506
+ var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
507
+ function escapeRegExp(text) {
508
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
509
+ }
510
+ function decisionRecordCitationPattern(decisionRecordsPath) {
511
+ const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
512
+ return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
513
+ }
514
+ function decisionRecordCitationRule(decisionRecordsPath) {
515
+ const folder = normalizeRepoPath(decisionRecordsPath);
516
+ const pattern = decisionRecordCitationPattern(folder);
517
+ const severity = {};
518
+ for (const scope of DECISION_RECORD_CITATION_SCOPES)
519
+ severity[scope] = "error";
520
+ return {
521
+ id: DECISION_RECORD_CITATION_ID,
522
+ group: "reader-resolvable",
523
+ custom: false,
524
+ builtIn: false,
525
+ scopes: DECISION_RECORD_CITATION_SCOPES,
526
+ message: DECISION_RECORD_CITATION_MESSAGE,
527
+ severity,
528
+ exempt: [folder],
529
+ substringExempt: [],
530
+ patternFor: () => pattern
531
+ };
532
+ }
533
+
193
534
  // ../../packages/aeg-core/src/docs/published-prose.ts
194
535
  var SHORT_VERSION_HEADING = "The short version";
195
536
  var SHORT_VERSION_MIN_WORDS = 150;
@@ -201,30 +542,24 @@ var CONTRACT_BLOCKS = [
201
542
  "What it does not carry",
202
543
  "How it physically runs"
203
544
  ];
204
- var ALLOWED_MECHANICS = [
205
- ".worktrees/task/<tranche>/<n>",
206
- "task/<tranche>/<n>",
207
- ".worktrees/"
208
- ];
209
- var PROSE_RULES = [
210
- { id: "decision-id", what: "a decision id", pattern: /\bD-\d{3,}\b/ },
211
- { id: "section-ref", what: "a section reference", pattern: /§/ },
212
- { id: "forge-number", what: "a forge number", pattern: /#\d+/ },
213
- { id: "retired-name", what: "the retired public name", pattern: /\bAEG\b/ },
214
- { id: "tranche-slug", what: "a tranche slug", pattern: /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/ },
215
- {
216
- id: "label-vocabulary",
217
- what: "forge label vocabulary",
218
- pattern: /(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
219
- },
220
- { id: "internal-path", what: "a repo-internal path", pattern: /\b(?:packages|apps|aeg-root|tools|scripts)\// },
221
- { id: "internal-path", what: "a repo-internal path", pattern: /\.(?:claude|husky|github)\// },
222
- {
223
- id: "internal-path",
224
- what: "a repo-internal file",
225
- pattern: /(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
226
- }
227
- ];
545
+ var ALLOWED_MECHANICS = rulesForGroup("published-prose")[0]?.exemptions ?? [];
546
+ var PROSE_RULES = rulesForGroup("published-prose").map((rule) => ({
547
+ id: rule.id,
548
+ what: rule.message,
549
+ pattern: rule.patterns.published
550
+ }));
551
+ function publishedRules(decisionRecordsPath) {
552
+ if (decisionRecordsPath === undefined)
553
+ return PROSE_RULES;
554
+ return [
555
+ ...PROSE_RULES,
556
+ {
557
+ id: DECISION_RECORD_CITATION_ID,
558
+ what: DECISION_RECORD_CITATION_MESSAGE,
559
+ pattern: decisionRecordCitationPattern(decisionRecordsPath)
560
+ }
561
+ ];
562
+ }
228
563
  function blocksFor(relPath) {
229
564
  if (relPath.startsWith("roles/"))
230
565
  return ROLE_BLOCKS;
@@ -249,9 +584,10 @@ function extractShortVersion(body) {
249
584
  function countWords(text) {
250
585
  return text.split(/\s+/).filter(Boolean).length;
251
586
  }
252
- function maskAllowedMechanics(text) {
587
+ function maskAllowedMechanics(text, allow) {
253
588
  let masked = text;
254
- for (const literal of ALLOWED_MECHANICS) {
589
+ const ordered = [...allow].sort((a, b) => b.length - a.length);
590
+ for (const literal of ordered) {
255
591
  masked = masked.split(literal).join(" ");
256
592
  }
257
593
  return masked;
@@ -280,11 +616,11 @@ function enforcementPublishedText(content) {
280
616
  }
281
617
  return out.filter((text) => text.trim().length > 0);
282
618
  }
283
- function checkReadability(where, texts, errors) {
619
+ function checkReadability(where, texts, errors, allow = ALLOWED_MECHANICS, rules = PROSE_RULES) {
284
620
  const seen = new Set;
285
621
  for (const raw of texts) {
286
- const text = maskAllowedMechanics(raw);
287
- for (const rule of PROSE_RULES) {
622
+ const text = maskAllowedMechanics(raw, allow);
623
+ for (const rule of rules) {
288
624
  const match = text.match(rule.pattern);
289
625
  if (!match)
290
626
  continue;
@@ -319,22 +655,23 @@ function checkStructure(relPath, body, blocks, errors) {
319
655
  errors.push(`C7: "${relPath}" short version is ${words} words, over the ${SHORT_VERSION_MAX_WORDS}-word ceiling — state the rule, don't summarise the reference`);
320
656
  }
321
657
  }
322
- function evaluatePublishedProse(entries, surfacedPaths = new Set) {
658
+ function evaluatePublishedProse(entries, surfacedPaths = new Set, allow = ALLOWED_MECHANICS, options = {}) {
323
659
  const errors = [];
324
660
  const notes = [];
661
+ const rules = publishedRules(options.decisionRecordsPath);
325
662
  const surfaced = entries.filter((e) => isSurfacedDoc(e.relPath, e.frontmatter, surfacedPaths));
326
663
  for (const entry of surfaced) {
327
- checkReadability(entry.relPath, [entry.frontmatter.title ?? "", entry.frontmatter.description ?? ""], errors);
664
+ checkReadability(entry.relPath, [entry.frontmatter.title ?? "", entry.frontmatter.description ?? ""], errors, allow, rules);
328
665
  const blocks = blocksFor(entry.relPath);
329
666
  if (blocks) {
330
667
  checkStructure(entry.relPath, entry.body, blocks, errors);
331
668
  const short = extractShortVersion(entry.body);
332
669
  if (short !== null)
333
- checkReadability(entry.relPath, [short], errors);
670
+ checkReadability(entry.relPath, [short], errors, allow, rules);
334
671
  continue;
335
672
  }
336
673
  if (entry.relPath === "enforcement.md") {
337
- checkReadability(entry.relPath, enforcementPublishedText(entry.body), errors);
674
+ checkReadability(entry.relPath, enforcementPublishedText(entry.body), errors, allow, rules);
338
675
  }
339
676
  }
340
677
  if (surfaced.length === 0)
@@ -1078,25 +1415,6 @@ function trancheSlugsFromLabels(labels) {
1078
1415
  }
1079
1416
  return slugs;
1080
1417
  }
1081
- function listActiveTrancheSlugs(owner, repo) {
1082
- const milestones = ghApiGet(`repos/${owner}/${repo}/milestones?state=all&per_page=100`);
1083
- const labels = ghApiGet(`repos/${owner}/${repo}/labels?per_page=100`);
1084
- const slugs = new Set([...slugShapedTitles(milestones), ...trancheSlugsFromLabels(labels)]);
1085
- const active = [];
1086
- for (const slug of slugs) {
1087
- const legacy = matchesLegacyMilestone(milestones, slug);
1088
- const issues = ghIssueListByLabel(owner, repo, trancheLabel(slug));
1089
- if (legacy) {
1090
- const facts = resolveLegacyFacts(legacy, issues);
1091
- if (facts.lifecycle === "active")
1092
- active.push({ slug, goal: facts.goal });
1093
- continue;
1094
- }
1095
- if (lifecycleFromIssues(issues) === "active")
1096
- active.push({ slug, goal: goalFromMilestones(milestones, slug) });
1097
- }
1098
- return active;
1099
- }
1100
1418
  async function indexTrancheMilestonesAsync(owner, repo) {
1101
1419
  const [milestones, labels] = await Promise.all([
1102
1420
  ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
@@ -2160,6 +2478,84 @@ function describeError(err) {
2160
2478
  return err;
2161
2479
  return "unknown error";
2162
2480
  }
2481
+ // ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
2482
+ function defaultPriorTrancheArchivalDeps() {
2483
+ let facts = new Map;
2484
+ return {
2485
+ activeTrancheSlugs: async (excludeSlug, repo) => {
2486
+ const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
2487
+ facts = index.facts;
2488
+ return index.active.map((m) => m.slug).filter((slug) => slug !== excludeSlug);
2489
+ },
2490
+ deriveTranche: (slug, repo) => deriveTrancheFromForge(repo.owner, repo.repo, slug, facts.get(slug)),
2491
+ openIssues: async (slug, repo) => (await fetchTrancheIssuesAsync(repo.owner, repo.repo, slug)).filter((issue) => issue.state === "OPEN").map((issue) => ({ number: issue.number }))
2492
+ };
2493
+ }
2494
+ function reason(err) {
2495
+ return err instanceof Error ? err.message.split(`
2496
+ `)[0] ?? "failed" : String(err);
2497
+ }
2498
+ async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
2499
+ if (projects.length === 0)
2500
+ return { facts: [], infraFailure: null };
2501
+ let candidates;
2502
+ try {
2503
+ candidates = await deps.activeTrancheSlugs(excludeSlug, repo);
2504
+ } catch (err) {
2505
+ return {
2506
+ facts: [],
2507
+ infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
2508
+ };
2509
+ }
2510
+ const facts = [];
2511
+ const unreadable = [];
2512
+ const derived = new Map;
2513
+ const derive = (slug) => {
2514
+ let p = derived.get(slug);
2515
+ if (!p) {
2516
+ p = deps.deriveTranche(slug, repo);
2517
+ derived.set(slug, p);
2518
+ }
2519
+ return p;
2520
+ };
2521
+ for (const project of projects) {
2522
+ let found = null;
2523
+ let unknown = false;
2524
+ for (const slug of candidates) {
2525
+ let candidateTranche;
2526
+ try {
2527
+ candidateTranche = await derive(slug);
2528
+ } catch {
2529
+ unknown = true;
2530
+ unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
2531
+ break;
2532
+ }
2533
+ if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
2534
+ continue;
2535
+ let openIssues;
2536
+ try {
2537
+ openIssues = await deps.openIssues(slug, repo);
2538
+ } catch {
2539
+ openIssues = null;
2540
+ }
2541
+ if (openIssues === null) {
2542
+ unknown = true;
2543
+ unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
2544
+ break;
2545
+ }
2546
+ if (openIssues.length === 0) {
2547
+ found = { project, priorTrancheSlug: slug, archived: false };
2548
+ break;
2549
+ }
2550
+ }
2551
+ if (!unknown)
2552
+ facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
2553
+ }
2554
+ return {
2555
+ facts,
2556
+ infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
2557
+ };
2558
+ }
2163
2559
  // ../../packages/aeg-forge-state/src/fetch-open-issues.ts
2164
2560
  async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
2165
2561
  const result = new Map;
@@ -2584,7 +2980,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
2584
2980
  // ../../packages/aeg-core/src/waiver-label.ts
2585
2981
  var WAIVER_LABEL = label("waiver-docs");
2586
2982
  var WAIVER_LABEL_REVIEW = label("waiver-review");
2587
- var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
2588
2983
  function isPrincipal(login, principalAllowlist) {
2589
2984
  if (login === null)
2590
2985
  return false;
@@ -3123,6 +3518,19 @@ var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"])
3123
3518
  var SHELL_LANGS = new Set(["", "sh", "bash", "shell", "console"]);
3124
3519
  // ../../packages/aeg-core/src/reader-resolvable-prose.ts
3125
3520
  var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
3521
+ var readerRules = rulesForGroup("reader-resolvable");
3522
+ var readerPattern = (id, scope = "prose") => {
3523
+ const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
3524
+ if (!(pattern instanceof RegExp))
3525
+ throw new Error(`default prose rule ${id} has no ${scope} pattern`);
3526
+ return pattern;
3527
+ };
3528
+ var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
3529
+ var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
3530
+ var TASK_NUMBER_PATTERN = readerPattern("task-number");
3531
+ var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
3532
+ var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
3533
+ var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
3126
3534
 
3127
3535
  // ../../packages/aeg-core/src/quoted-command.ts
3128
3536
  var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
@@ -3607,7 +4015,7 @@ function isGrandfathered(isoDate) {
3607
4015
  return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
3608
4016
  }
3609
4017
  var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
3610
- function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
4018
+ function checkA1(entries, principalAllowlist) {
3611
4019
  const failures = [];
3612
4020
  for (const e of entries) {
3613
4021
  if (!e.facts)
@@ -4495,59 +4903,9 @@ function compareToBaseline(current, baseline) {
4495
4903
  };
4496
4904
  }
4497
4905
  // ../../packages/aeg-core/src/retired-vocabulary.ts
4498
- var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
4499
- var RETIRED_PATTERNS = [
4500
- String.raw`\bD-[0-9]{3}\b`,
4501
- "D-(###|NNN|nnn|xxx)",
4502
- "decision (entry|logged)",
4503
- "decision-log entry",
4504
- "decision log entry",
4505
- "decision log(s|ged|ging)?([^a-z]|$)",
4506
- "decision-log",
4507
- "decision entr",
4508
- "decisions? (are |is )?logged",
4509
- "log entries",
4510
- String.raw`decisions\.md`,
4511
- "decisions-legacy",
4512
- "CONTRADICTION",
4513
- "assumes Tier 3",
4514
- "Lock: ?YES",
4515
- "Lock: ?NO",
4516
- "lock approvals?",
4517
- "approves locks",
4518
- "Conforms to lock",
4519
- "Challenges lock",
4520
- "checkDecisionNumbersFresh",
4521
- String.raw`roles/team-leader\.md`,
4522
- String.raw`\(,`,
4523
- String.raw`,\)`,
4524
- String.raw`\(\.\)`,
4525
- ...PLAN_ON_DISK_PATTERNS
4526
- ];
4527
- var TRANCHE_MODEL_FILE = "/tranche-model.md";
4528
- var PATTERN_EXEMPT = {
4529
- [String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
4530
- [String.raw`decisions\.md`]: [
4531
- "docs-index.md",
4532
- "apps/vada-ai/specs/legacy/README.md",
4533
- "apps/vada-ai/specs/vada-product-spec.md",
4534
- "apps/vada-ai/web/CLAUDE.md",
4535
- "apps/vada-ai/CLAUDE.md"
4536
- ],
4537
- "decisions-legacy": [
4538
- "packages/aeg-core/src/file-classify.ts",
4539
- "packages/aeg-core/src/file-classify.test.ts",
4540
- "packages/aeg-core/src/pr-tier.test.ts",
4541
- "docs-index.md",
4542
- ".claude/skills/database/SKILL.md",
4543
- ".claude/skills/vada-architecture/SKILL.md",
4544
- "apps/vada-ai/specs/vada-byok-principles.md",
4545
- "apps/vada-ai/web/CLAUDE.md",
4546
- "apps/vada-ai/CLAUDE.md"
4547
- ],
4548
- CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
4549
- ...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
4550
- };
4906
+ var retiredRules = rulesForGroup("retired-vocabulary");
4907
+ var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
4908
+ var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
4551
4909
  // ../../packages/aeg-core/src/dispatch-gate.ts
4552
4910
  function isHandClosedByRecognizedPrincipal(dep, principalAllowlist) {
4553
4911
  return dep.issueState === "closed" && dep.stateReason === "completed" && isPrincipal(dep.closedByActor ?? null, principalAllowlist);
@@ -4561,7 +4919,7 @@ function isSelfDependency(dep, task, issue) {
4561
4919
  function checkDispatchReadiness(input) {
4562
4920
  const { trancheSlug, task } = input;
4563
4921
  const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
4564
- const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
4922
+ const { principalAllowlist } = input;
4565
4923
  const blockerDetails = [];
4566
4924
  const push = (blockerClass, message) => {
4567
4925
  blockerDetails.push({ class: blockerClass, message });
@@ -4888,9 +5246,11 @@ var LineageSchema = z3.object({
4888
5246
  parent: z3.string().nullable()
4889
5247
  }).strict();
4890
5248
  var InputVersionsSchema = z3.object({
5249
+ manifest_version: z3.literal(2).nullable().optional(),
4891
5250
  objectives_version: z3.string().nullable(),
4892
5251
  brief_hash: z3.string().nullable(),
4893
5252
  ruling_ordinal: z3.number().int().nullable(),
5253
+ pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
4894
5254
  policy_digest: z3.string().nullable()
4895
5255
  }).strict();
4896
5256
  var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
@@ -5422,6 +5782,12 @@ var ManifestRecordSchema = z4.object({
5422
5782
  briefHash: z4.string().min(1).nullable(),
5423
5783
  objectivesVersion: z4.string().min(1).nullable(),
5424
5784
  rulingOrdinal: epochNumber,
5785
+ manifestVersion: z4.literal(2).optional(),
5786
+ pauseBoundRuling: z4.object({
5787
+ rulingId: z4.string().min(1),
5788
+ pauseId: z4.string().min(1),
5789
+ contentDigest: z4.string().min(1)
5790
+ }).strict().nullable().optional(),
5425
5791
  policyDigest: z4.string().min(1),
5426
5792
  recordedAt: isoTimestamp
5427
5793
  }).strict();
@@ -5443,7 +5809,11 @@ var LoopStateRecordSchema = z4.object({
5443
5809
  deliveredFindings: roundHeadIdentity.nullable(),
5444
5810
  repeatMemory: z4.object({
5445
5811
  blockingFindings: z4.array(z4.string()),
5446
- lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
5812
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
5813
+ }).strict().optional(),
5814
+ developerHandoff: z4.object({
5815
+ findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
5816
+ failingChecks: z4.array(z4.string().min(1))
5447
5817
  }).strict().optional(),
5448
5818
  publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
5449
5819
  taskStartedAt: isoTimestamp.optional(),
@@ -5498,8 +5868,34 @@ var ResolutionRecordSchema = z4.object({
5498
5868
  authenticatedFrom: z4.string().min(1),
5499
5869
  consumedAt: isoTimestamp
5500
5870
  }).strict();
5871
+ // ../../packages/aeg-core/src/principals-config.ts
5872
+ import { readFileSync as readFileSync2 } from "node:fs";
5873
+ import { join } from "node:path";
5874
+ var PRINCIPALS_CONFIG_FIX = 'add "principals": [...] to vinaya.config.json';
5875
+ function readConfigPrincipals(repoRoot = ".") {
5876
+ const path = join(repoRoot, "vinaya.config.json");
5877
+ let raw;
5878
+ try {
5879
+ raw = JSON.parse(readFileSync2(path, "utf8"));
5880
+ } catch (err) {
5881
+ const why = err instanceof Error ? err.message : String(err);
5882
+ return { ok: false, reason: `cannot read ${path} as JSON (${why}) — ${PRINCIPALS_CONFIG_FIX}` };
5883
+ }
5884
+ const value = raw !== null && typeof raw === "object" ? raw.principals : undefined;
5885
+ if (value === undefined) {
5886
+ return { ok: false, reason: `${path} declares no Principal list — ${PRINCIPALS_CONFIG_FIX}` };
5887
+ }
5888
+ if (!Array.isArray(value) || value.length === 0 || !value.every((p) => typeof p === "string" && p.length > 0)) {
5889
+ return {
5890
+ ok: false,
5891
+ reason: `${path}'s "principals" must be a non-empty array of login strings — ${PRINCIPALS_CONFIG_FIX}`
5892
+ };
5893
+ }
5894
+ return { ok: true, principals: value };
5895
+ }
5896
+
5501
5897
  // ../../packages/aeg-core/bin/verify-docs.ts
5502
- var REPO_ROOT = join(import.meta.dir, "../../..");
5898
+ var REPO_ROOT = join2(import.meta.dir, "../../..");
5503
5899
  process.chdir(REPO_ROOT);
5504
5900
  var args = process.argv.slice(2);
5505
5901
  var mode = args.includes("--pr") ? "pr" : args.includes("--push") ? "push" : "full";
@@ -5524,7 +5920,7 @@ function resolvePrBody() {
5524
5920
  return process.env.PR_BODY;
5525
5921
  if (process.env.PR_BODY_FILE) {
5526
5922
  try {
5527
- return readFileSync2(process.env.PR_BODY_FILE, "utf8");
5923
+ return readFileSync3(process.env.PR_BODY_FILE, "utf8");
5528
5924
  } catch {
5529
5925
  return "";
5530
5926
  }
@@ -5532,16 +5928,21 @@ function resolvePrBody() {
5532
5928
  return "";
5533
5929
  }
5534
5930
  function waiverActiveFromEnv() {
5931
+ const principals = readConfigPrincipals();
5932
+ if (!principals.ok) {
5933
+ console.error(`[verify-docs] FAILED — ${principals.reason}`);
5934
+ process.exit(1);
5935
+ }
5535
5936
  const labels = (process.env.PR_LABELS || "").split(",").map((s) => s.trim()).filter(Boolean);
5536
5937
  return isWaiverLabelActorVerified({
5537
5938
  label: WAIVER_LABEL,
5538
5939
  labels,
5539
5940
  labelActor: process.env.WAIVER_LABEL_ACTOR || null,
5540
- principalAllowlist: PRINCIPAL_ALLOWLIST
5941
+ principalAllowlist: principals.principals
5541
5942
  });
5542
5943
  }
5543
5944
  function runC5(changed, base) {
5544
- const content = existsSync(DOC_OWNERS_PATH) ? readFileSync2(DOC_OWNERS_PATH, "utf8") : null;
5945
+ const content = existsSync(DOC_OWNERS_PATH) ? readFileSync3(DOC_OWNERS_PATH, "utf8") : null;
5545
5946
  const getDiff = (path) => {
5546
5947
  const out = shFile("git", ["diff", `${base}...HEAD`, "--", path]);
5547
5948
  return out === "" ? null : out;
@@ -5589,7 +5990,7 @@ function runPrMode() {
5589
5990
  for (const p of specFiles) {
5590
5991
  if (!existsSync(p))
5591
5992
  continue;
5592
- if (!hasStatusBlock(readFileSync2(p, "utf8"))) {
5993
+ if (!hasStatusBlock(readFileSync3(p, "utf8"))) {
5593
5994
  errors.push(`C1 spec-status: ${p} is missing a \`Status:\` block (accepted values: draft, target, ratified, retired). See state-machine.md Section 5.`);
5594
5995
  }
5595
5996
  }
@@ -5632,7 +6033,7 @@ verify-docs (push mode) — push allowed, but ${errors.length} owned-doc binding
5632
6033
  }
5633
6034
  var AEG_ROOT_PREFIX = "aeg-root/";
5634
6035
  function loadDoctrine() {
5635
- const read = (p) => existsSync(p) ? readFileSync2(p, "utf8") : "";
6036
+ const read = (p) => existsSync(p) ? readFileSync3(p, "utf8") : "";
5636
6037
  const list = (glob) => sh(`git ls-files '${glob}'`).split(`
5637
6038
  `).map((s) => s.trim()).filter(Boolean);
5638
6039
  return {
@@ -5645,7 +6046,7 @@ function runC6() {
5645
6046
  const files = sh("git ls-files 'aeg-root/*.md'").split(`
5646
6047
  `).map((s) => s.trim()).filter(Boolean);
5647
6048
  const entries = files.map((filePath) => {
5648
- const raw = existsSync(filePath) ? readFileSync2(filePath, "utf8") : "";
6049
+ const raw = existsSync(filePath) ? readFileSync3(filePath, "utf8") : "";
5649
6050
  const parsed = parseDocFrontmatter(raw);
5650
6051
  return {
5651
6052
  relPath: filePath.slice(AEG_ROOT_PREFIX.length),
@@ -5661,13 +6062,35 @@ function runC6() {
5661
6062
  for (const n of result.notes)
5662
6063
  notes.push(n);
5663
6064
  }
6065
+ function configuredPublishedAllow() {
6066
+ const path = join2(REPO_ROOT, "vinaya.config.json");
6067
+ if (!existsSync(path))
6068
+ return;
6069
+ try {
6070
+ const allow = JSON.parse(readFileSync3(path, "utf8"))?.proseGates?.published?.allow;
6071
+ return Array.isArray(allow) && allow.every((entry) => typeof entry === "string") ? allow : undefined;
6072
+ } catch {
6073
+ return;
6074
+ }
6075
+ }
6076
+ function configuredDecisionRecordsPath() {
6077
+ const path = join2(REPO_ROOT, "vinaya.config.json");
6078
+ if (!existsSync(path))
6079
+ return;
6080
+ try {
6081
+ const value = JSON.parse(readFileSync3(path, "utf8"))?.decisionRecords?.path;
6082
+ return typeof value === "string" && value.length > 0 ? value : undefined;
6083
+ } catch {
6084
+ return;
6085
+ }
6086
+ }
5664
6087
  function runC7(only) {
5665
6088
  const files = sh("git ls-files 'aeg-root/*.md' 'aeg-root/roles/*.md' 'aeg-root/contracts/*.md'").split(`
5666
6089
  `).map((s) => s.trim()).filter(Boolean).filter((filePath) => only ? only.has(filePath) : true);
5667
6090
  if (files.length === 0)
5668
6091
  return;
5669
6092
  const entries = files.map((filePath) => {
5670
- const raw = existsSync(filePath) ? readFileSync2(filePath, "utf8") : "";
6093
+ const raw = existsSync(filePath) ? readFileSync3(filePath, "utf8") : "";
5671
6094
  const parsed = parseDocFrontmatter(raw);
5672
6095
  return {
5673
6096
  relPath: filePath.slice(AEG_ROOT_PREFIX.length),
@@ -5676,7 +6099,9 @@ function runC7(only) {
5676
6099
  };
5677
6100
  });
5678
6101
  const surfacedPaths = modelBackedDocPaths(deriveDiagramModel(loadDoctrine(), null, null));
5679
- const result = evaluatePublishedProse(entries, surfacedPaths);
6102
+ const result = evaluatePublishedProse(entries, surfacedPaths, configuredPublishedAllow(), {
6103
+ decisionRecordsPath: configuredDecisionRecordsPath()
6104
+ });
5680
6105
  for (const e of result.errors)
5681
6106
  errors.push(e);
5682
6107
  for (const n of result.notes)
@@ -5686,12 +6111,12 @@ var C8_PATHSPECS = ["aeg-root/*.md", "apps/*.ts", "apps/*.md", "packages/*.ts",
5686
6111
  function runC8(only) {
5687
6112
  const tracked = new Set(C8_PATHSPECS.flatMap((pathspec) => shFile("git", ["ls-files", pathspec]).split(`
5688
6113
  `)).map((s) => s.trim()).filter(Boolean));
5689
- const files = [...tracked].filter((filePath) => only ? only.has(filePath) : true).filter((filePath) => existsSync(filePath)).map((filePath) => ({ path: filePath, content: readFileSync2(filePath, "utf8") }));
6114
+ const files = [...tracked].filter((filePath) => only ? only.has(filePath) : true).filter((filePath) => existsSync(filePath)).map((filePath) => ({ path: filePath, content: readFileSync3(filePath, "utf8") }));
5690
6115
  if (files.length === 0)
5691
6116
  return;
5692
6117
  const trackedCited = new Set(shFile("git", ["ls-files"]).split(`
5693
6118
  `).map((s) => s.trim()).filter(Boolean));
5694
- const readCited = (path) => trackedCited.has(path) && existsSync(path) ? readFileSync2(path, "utf8") : null;
6119
+ const readCited = (path) => trackedCited.has(path) && existsSync(path) ? readFileSync3(path, "utf8") : null;
5695
6120
  const { findings, bindingCount } = checkDocClaims(files, readCited);
5696
6121
  for (const f of findings)
5697
6122
  errors.push(`C8 doc-claim: ${f.message}`);
@@ -5705,11 +6130,11 @@ function runFullMode() {
5705
6130
  for (const p of specs) {
5706
6131
  if (!existsSync(p))
5707
6132
  continue;
5708
- if (!hasStatusBlock(readFileSync2(p, "utf8"))) {
6133
+ if (!hasStatusBlock(readFileSync3(p, "utf8"))) {
5709
6134
  errors.push(`F1 spec-status: ${p} is missing a \`Status:\` block.`);
5710
6135
  }
5711
6136
  }
5712
- const docOwnersContent = existsSync(DOC_OWNERS_PATH) ? readFileSync2(DOC_OWNERS_PATH, "utf8") : null;
6137
+ const docOwnersContent = existsSync(DOC_OWNERS_PATH) ? readFileSync3(DOC_OWNERS_PATH, "utf8") : null;
5713
6138
  const { m1Errors, m2Notes, m3Errors, noDocRules } = checkManifestValidity(docOwnersContent, existsSync);
5714
6139
  for (const e of m1Errors)
5715
6140
  errors.push(e);