@attalabs/vinaya 0.40.0 → 0.41.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 (157) hide show
  1. package/aeg-root/contracts/developer-reviewer.md +2 -2
  2. package/aeg-root/contracts/planner-developer.md +4 -4
  3. package/aeg-root/process.md +3 -3
  4. package/aeg-root/roles/developer/reference.md +3 -0
  5. package/aeg-root/state-machine.md +2 -2
  6. package/aeg-root/templates/brief-template.md +1 -1
  7. package/dist/checks/bin/check-body-bare-digits.js +165 -65
  8. package/dist/checks/bin/check-branch-topology.js +169 -60
  9. package/dist/checks/bin/check-brief-shape.js +165 -65
  10. package/dist/checks/bin/check-changeset-coverage.js +342 -122
  11. package/dist/checks/bin/check-ci-shard-coverage.js +384 -130
  12. package/dist/checks/bin/check-closes-n.js +169 -60
  13. package/dist/checks/bin/check-coherence.js +165 -65
  14. package/dist/checks/bin/check-dead-branch-push.js +142 -59
  15. package/dist/checks/bin/check-dispatch-readiness.js +211 -81
  16. package/dist/checks/bin/check-doc-claims.js +165 -65
  17. package/dist/checks/bin/check-doc-coverage-push.js +342 -122
  18. package/dist/checks/bin/check-doc-coverage.js +344 -124
  19. package/dist/checks/bin/check-doctrine-no-procedures.js +165 -65
  20. package/dist/checks/bin/check-doctrine-portability.js +342 -122
  21. package/dist/checks/bin/check-evidence-fresh.js +376 -129
  22. package/dist/checks/bin/check-exec-bits.js +342 -122
  23. package/dist/checks/bin/check-first-push-dispatch.js +208 -78
  24. package/dist/checks/bin/check-issue-milestone-attach.js +142 -59
  25. package/dist/checks/bin/check-issue-objectives-numbering.js +165 -65
  26. package/dist/checks/bin/check-issue-parts-coverage.js +142 -59
  27. package/dist/checks/bin/check-issue-surface-globs.js +218 -88
  28. package/dist/checks/bin/check-issue-title-grammar.js +142 -59
  29. package/dist/checks/bin/check-main-branch-refusal.js +142 -59
  30. package/dist/checks/bin/check-no-disk-state.js +142 -59
  31. package/dist/checks/bin/check-pr-premise-reassert.js +165 -65
  32. package/dist/checks/bin/check-pr-report-density.js +142 -59
  33. package/dist/checks/bin/check-principal-test-plan-wait.js +165 -65
  34. package/dist/checks/bin/check-quoted-command.js +338 -118
  35. package/dist/checks/bin/check-reader-resolvable-prose.js +338 -118
  36. package/dist/checks/bin/check-registry-gates.js +206 -78
  37. package/dist/checks/bin/check-retired-vocabulary.js +338 -118
  38. package/dist/checks/bin/check-review-gate.js +203 -83
  39. package/dist/checks/bin/check-single-plan-pr.js +142 -59
  40. package/dist/checks/bin/check-surface-scope.js +169 -60
  41. package/dist/checks/bin/check-test-plan.js +165 -65
  42. package/dist/checks/bin/check-token-collection-wired.js +142 -59
  43. package/dist/checks/bin/check-workspace-escape.js +340 -120
  44. package/dist/checks/bin/verify-coherence.js +153 -60
  45. package/dist/checks/bin/verify-dispatch.js +169 -69
  46. package/dist/checks/bin/verify-docs.js +142 -57
  47. package/dist/index.js +16280 -11764
  48. package/dist/lib/pre-push-cache-test-run.js +791 -68
  49. package/dist/lib/pre-push-changed-files.js +65 -19
  50. package/dist/lib/pre-push-mode.js +466 -0
  51. package/dist/lib/pre-push-progress-dir.js +4205 -0
  52. package/dist/lib/pre-push-record-tests.js +446 -0
  53. package/dist/lib/pre-push-select-tests.js +1426 -454
  54. package/dist/lib/push-progress-observer.js +4213 -0
  55. package/package.json +11 -5
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -2
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +18 -4
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +17 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +13 -17
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +1 -4
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +77 -7
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +221 -56
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +52 -109
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  95. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  130. 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
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wzfiav._.js → [root-of-the-server]__1d4eth3._.js} +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  146. 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
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  151. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{38kom-9c-oi65.js → 0x7u6si-ai179.js} +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1p3vr9qts86_b.js → 2fu7mfsj4oima.js} +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{21tunzmxjvm2a.js → 34b4ruddunn3q.js} +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  155. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
  156. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
  157. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
@@ -44,6 +44,12 @@
44
44
  */
45
45
 
46
46
  import { findHeadingLine, findTable } from '../markdown-table'
47
+ import {
48
+ DECISION_RECORD_CITATION_ID,
49
+ DECISION_RECORD_CITATION_MESSAGE,
50
+ decisionRecordCitationPattern,
51
+ rulesForGroup
52
+ } from '../prose-rules'
47
53
  import { isSurfacedDoc } from './surfaced-manifest'
48
54
  import type { DocFrontmatter } from './types'
49
55
 
@@ -71,13 +77,10 @@ export const CONTRACT_BLOCKS = [
71
77
  /**
72
78
  * Protocol facts that must survive every readability rule. Masked out of the
73
79
  * text before scanning, longest first, so a repo-internal-path rule can never
74
- * claim the branch convention.
80
+ * claim the branch convention. The default of `proseGates.published.allow`;
81
+ * a configured list replaces it.
75
82
  */
76
- export const ALLOWED_MECHANICS: readonly string[] = [
77
- '.worktrees/task/<tranche>/<n>',
78
- 'task/<tranche>/<n>',
79
- '.worktrees/'
80
- ]
83
+ export const ALLOWED_MECHANICS: readonly string[] = rulesForGroup('published-prose')[0]?.exemptions ?? []
81
84
 
82
85
  export type PublishedProseEntry = {
83
86
  /** Path relative to `aeg-root/`, e.g. `roles/developer.md`. */
@@ -88,6 +91,9 @@ export type PublishedProseEntry = {
88
91
 
89
92
  export type PublishedProseResult = { errors: string[]; notes: string[] }
90
93
 
94
+ /** `decisionRecordsPath` is `decisionRecords.path`; absent, the decision-record citation rule does not run. */
95
+ export type PublishedProseOptions = { decisionRecordsPath?: string }
96
+
91
97
  type ProseRule = { id: string; what: string; pattern: RegExp }
92
98
 
93
99
  /**
@@ -96,33 +102,28 @@ type ProseRule = { id: string; what: string; pattern: RegExp }
96
102
  * English word ("Project:", the PR-body field) from being read as the deleted
97
103
  * `project:*` label family.
98
104
  */
99
- const PROSE_RULES: ProseRule[] = [
100
- { id: 'decision-id', what: 'a decision id', pattern: /\bD-\d{3,}\b/ },
101
- { id: 'section-ref', what: 'a section reference', pattern: /§/ },
102
- { id: 'forge-number', what: 'a forge number', pattern: /#\d+/ },
103
- { id: 'retired-name', what: 'the retired public name', pattern: /\bAEG\b/ },
104
- { id: 'tranche-slug', what: 'a tranche slug', pattern: /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/ },
105
- {
106
- id: 'label-vocabulary',
107
- what: 'forge label vocabulary',
108
- // Every entry here is CUMULATIVE — a retired namespace stays banned after
109
- // the objects carrying it are gone, because a published page naming it is
110
- // just as unreadable to a stranger as one naming the current grammar (see
111
- // the module header). `aeg:` is retired and still listed for that reason,
112
- // and `iteration:` joins it: the rename to `tranche:` ADDS an alternative,
113
- // it does not substitute one. Substituting is how a rename silently
114
- // narrows this gate — the forge still carried `vinaya/iteration:*` labels
115
- // when the rename landed, and a page naming one would have passed.
116
- pattern: /(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
117
- },
118
- { id: 'internal-path', what: 'a repo-internal path', pattern: /\b(?:packages|apps|aeg-root|tools|scripts)\// },
119
- { id: 'internal-path', what: 'a repo-internal path', pattern: /\.(?:claude|husky|github)\// },
120
- {
121
- id: 'internal-path',
122
- what: 'a repo-internal file',
123
- pattern: /(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
124
- }
125
- ]
105
+ const PROSE_RULES: ProseRule[] = rulesForGroup('published-prose').map((rule) => ({
106
+ id: rule.id,
107
+ what: rule.message,
108
+ pattern: rule.patterns.published as RegExp
109
+ }))
110
+
111
+ /**
112
+ * The rules the published pass runs: the shipped ones, plus the
113
+ * decision-record citation rule while `decisionRecords.path` is set — and
114
+ * only then.
115
+ */
116
+ function publishedRules(decisionRecordsPath: string | undefined): ProseRule[] {
117
+ if (decisionRecordsPath === undefined) return PROSE_RULES
118
+ return [
119
+ ...PROSE_RULES,
120
+ {
121
+ id: DECISION_RECORD_CITATION_ID,
122
+ what: DECISION_RECORD_CITATION_MESSAGE,
123
+ pattern: decisionRecordCitationPattern(decisionRecordsPath)
124
+ }
125
+ ]
126
+ }
126
127
 
127
128
  /** The doc kinds this check governs, and the block set each answers with. */
128
129
  function blocksFor(relPath: string): readonly string[] | null {
@@ -196,9 +197,12 @@ export function countWords(text: string): number {
196
197
  return text.split(/\s+/).filter(Boolean).length
197
198
  }
198
199
 
199
- function maskAllowedMechanics(text: string): string {
200
+ function maskAllowedMechanics(text: string, allow: readonly string[]): string {
200
201
  let masked = text
201
- for (const literal of ALLOWED_MECHANICS) {
202
+ // Longest first, whatever order the list was written in, so a shorter
203
+ // literal can never cut a longer one apart before it is masked.
204
+ const ordered = [...allow].sort((a, b) => b.length - a.length)
205
+ for (const literal of ordered) {
202
206
  masked = masked.split(literal).join(' ')
203
207
  }
204
208
  return masked
@@ -243,17 +247,28 @@ export function enforcementPublishedText(content: string): string[] {
243
247
  * never sees it. A whole published page was unguarded on that technicality;
244
248
  * `actions.test.ts` closes it by running this over every entry.
245
249
  */
246
- export function readabilityErrors(where: string, texts: string[]): string[] {
250
+ export function readabilityErrors(
251
+ where: string,
252
+ texts: string[],
253
+ allow: readonly string[] = ALLOWED_MECHANICS,
254
+ options: PublishedProseOptions = {}
255
+ ): string[] {
247
256
  const errors: string[] = []
248
- checkReadability(where, texts, errors)
257
+ checkReadability(where, texts, errors, allow, publishedRules(options.decisionRecordsPath))
249
258
  return errors
250
259
  }
251
260
 
252
- function checkReadability(where: string, texts: string[], errors: string[]): void {
261
+ function checkReadability(
262
+ where: string,
263
+ texts: string[],
264
+ errors: string[],
265
+ allow: readonly string[] = ALLOWED_MECHANICS,
266
+ rules: readonly ProseRule[] = PROSE_RULES
267
+ ): void {
253
268
  const seen = new Set<string>()
254
269
  for (const raw of texts) {
255
- const text = maskAllowedMechanics(raw)
256
- for (const rule of PROSE_RULES) {
270
+ const text = maskAllowedMechanics(raw, allow)
271
+ for (const rule of rules) {
257
272
  const match = text.match(rule.pattern)
258
273
  if (!match) continue
259
274
  const token = (match[0] ?? '').trim()
@@ -300,14 +315,18 @@ function checkStructure(relPath: string, body: string, blocks: readonly string[]
300
315
  * Runs both checks over the published set only. `entries` may hold every doc
301
316
  * under `aeg-root/`; `surfacedPaths` (the model-backed allowlist) is what
302
317
  * narrows it, so this check can never publish-check a doc the site does not
303
- * publish, nor miss one it does.
318
+ * publish, nor miss one it does. `allow` is `proseGates.published.allow`
319
+ * when a repository configures it.
304
320
  */
305
321
  export function evaluatePublishedProse(
306
322
  entries: PublishedProseEntry[],
307
- surfacedPaths: ReadonlySet<string> = new Set()
323
+ surfacedPaths: ReadonlySet<string> = new Set(),
324
+ allow: readonly string[] = ALLOWED_MECHANICS,
325
+ options: PublishedProseOptions = {}
308
326
  ): PublishedProseResult {
309
327
  const errors: string[] = []
310
328
  const notes: string[] = []
329
+ const rules = publishedRules(options.decisionRecordsPath)
311
330
 
312
331
  const surfaced = entries.filter((e) => isSurfacedDoc(e.relPath, e.frontmatter, surfacedPaths))
313
332
 
@@ -316,17 +335,23 @@ export function evaluatePublishedProse(
316
335
  // entry, `description` is the page metadata. Checking only the body left
317
336
  // both unguarded — a citation in a title reaches a reader exactly as
318
337
  // surely as one in a paragraph.
319
- checkReadability(entry.relPath, [entry.frontmatter.title ?? '', entry.frontmatter.description ?? ''], errors)
338
+ checkReadability(
339
+ entry.relPath,
340
+ [entry.frontmatter.title ?? '', entry.frontmatter.description ?? ''],
341
+ errors,
342
+ allow,
343
+ rules
344
+ )
320
345
 
321
346
  const blocks = blocksFor(entry.relPath)
322
347
  if (blocks) {
323
348
  checkStructure(entry.relPath, entry.body, blocks, errors)
324
349
  const short = extractShortVersion(entry.body)
325
- if (short !== null) checkReadability(entry.relPath, [short], errors)
350
+ if (short !== null) checkReadability(entry.relPath, [short], errors, allow, rules)
326
351
  continue
327
352
  }
328
353
  if (entry.relPath === 'enforcement.md') {
329
- checkReadability(entry.relPath, enforcementPublishedText(entry.body), errors)
354
+ checkReadability(entry.relPath, enforcementPublishedText(entry.body), errors, allow, rules)
330
355
  }
331
356
  }
332
357
 
@@ -137,7 +137,6 @@ export const CLI_CHECK_RING: Readonly<Record<string, 0 | 1 | 2>> = {
137
137
  'dead-branch-push': 0,
138
138
  'first-push-dispatch': 0,
139
139
  'doc-coverage-push': 0,
140
- 'issue-assignment': 0,
141
140
  'evidence-fresh': 1,
142
141
  'reader-resolvable-prose': 0,
143
142
  'doc-claims': 0,
@@ -152,13 +151,12 @@ export const CLI_CHECK_RING: Readonly<Record<string, 0 | 1 | 2>> = {
152
151
  'main-branch-refusal': 0,
153
152
  'token-collection-wired': 0,
154
153
  'pr-premise-reassert': 0,
155
- // The six write-only rules named apart — `ownWorkflow: true`
154
+ // The five write-only rules named apart — `ownWorkflow: true`
156
155
  // each, same ring reasoning as `review-gate`/`body-bare-digits` above.
157
156
  'issue-title-grammar': 1,
158
157
  'issue-objectives-numbering': 1,
159
158
  'issue-parts-coverage': 1,
160
159
  'issue-surface-globs': 1,
161
- 'issue-tranche-label': 1,
162
160
  'issue-milestone-attach': 1
163
161
  }
164
162
 
@@ -169,7 +167,6 @@ export const CLI_CHECK_RING: Readonly<Record<string, 0 | 1 | 2>> = {
169
167
  */
170
168
  export const NON_GATE_BINS = [
171
169
  'archive-task',
172
- 'assign-task-issue',
173
170
  'dead-branch-audit',
174
171
  'eval-agent-compliance',
175
172
  'open-issue',
@@ -79,7 +79,6 @@ export type { C5Result, DocAck, DocNeutral, DocOwnersBinding, DocOwnersManifestS
79
79
  export {
80
80
  isPrincipal,
81
81
  isWaiverLabelActorVerified,
82
- PRINCIPAL_ALLOWLIST,
83
82
  WAIVER_LABEL,
84
83
  WAIVER_LABEL_REVIEW
85
84
  } from './waiver-label'
@@ -224,6 +223,7 @@ export {
224
223
  export type { MergedPrFacts } from './archive-task'
225
224
  export {
226
225
  extractCodeReviewVerdict,
226
+ extractPauseBoundRuling,
227
227
  extractSecurityReviewVerdict,
228
228
  parseFindingState,
229
229
  VERDICT_MARKER_SOURCE
@@ -237,7 +237,13 @@ export {
237
237
  isReviewGateExemptBranch
238
238
  } from './review-gate'
239
239
  export type { ReviewGateComment, ReviewGateInput, ReviewGateResult, ReviewGateVerdict } from './review-gate'
240
- export { newestPrincipalRulingAuthor, newestPrincipalRulingOrdinal, principalRulingMarker } from './ruling-ordinal'
240
+ export {
241
+ newestPrincipalRulingAuthor,
242
+ newestPrincipalRulingOrdinal,
243
+ parseRulingIdentity,
244
+ principalRulingMarker,
245
+ principalRulingTextById
246
+ } from './ruling-ordinal'
241
247
  export type { RulingComment } from './ruling-ordinal'
242
248
  export {
243
249
  briefHash,
@@ -251,11 +257,15 @@ export {
251
257
  isBoundToPolicy,
252
258
  isBoundToRulings,
253
259
  manifestAsEchoed,
260
+ pauseBoundRulingDigest,
261
+ pauseBoundRulingFromResolution,
254
262
  policyDigest
255
263
  } from './review-input-manifest'
256
264
  export type {
265
+ ConsumedResolution,
257
266
  EchoedManifest,
258
267
  ManifestBindingResult,
268
+ PauseBoundRuling,
259
269
  ReviewInputManifest,
260
270
  ReviewInputManifestFacts
261
271
  } from './review-input-manifest'
@@ -287,11 +297,15 @@ export {
287
297
  checkPartsCoverageAndSequence,
288
298
  checkPinnedFileImportersCovered,
289
299
  decidePinnedFileImporters,
300
+ checkPinnedFileChecksDecided,
301
+ decidePinnedFileChecks,
290
302
  surfaceForcedSet,
291
303
  checkNewTestFilesCoverShards,
292
304
  checkNewLoopFilesCoverInvariantMap,
293
305
  checkDocumentationReadable,
294
306
  checkDocumentationPathsExist,
307
+ classifyDocumentationSource,
308
+ REQUIRED_SOURCE_MISSING_REASONS,
295
309
  isNonPublicHost,
296
310
  documentationUrls,
297
311
  type DocumentationProbe,
@@ -302,8 +316,8 @@ export {
302
316
  checkRationaleSurfaceCoverage,
303
317
  checkSurfaceExcludesBoundDoc,
304
318
  checkSurfaceGlobsResolve,
319
+ surfaceEntryResolves,
305
320
  checkSurfaceOverlap,
306
- checkTrancheLabelPresence,
307
321
  checkTestPlanDeveloperRunnable,
308
322
  checkSurfaceScope,
309
323
  beyondSurfacePaths,
@@ -324,7 +338,8 @@ export {
324
338
  parseIssuePremises,
325
339
  parseIssueStopConditions,
326
340
  parseIssueSurface,
327
- parseIssueTestPlan
341
+ parseIssueTestPlan,
342
+ parseLiveTestPlanItems
328
343
  } from './issue-validation'
329
344
  export type {
330
345
  CommandReferenceEntry,
@@ -334,18 +349,25 @@ export type {
334
349
  FrozenSection,
335
350
  IssueDocumentation,
336
351
  IssueDocumentationSource,
352
+ RequiredSourceLocator,
353
+ RequiredSourceMissingReason,
337
354
  IssuePart,
338
355
  IssuePremise,
339
356
  IssueSectionResult,
340
357
  IssueSurface,
341
358
  IssueTestPlan,
342
359
  PinnedFileImporters,
360
+ PinnedFileCheck,
361
+ PinnedFileChecks,
362
+ PinnedCheckDecision,
363
+ PinnedFileCheckDecisions,
343
364
  PinnedImporterDecision,
344
365
  PinnedFileDecisions,
345
366
  SurfaceForcedSet,
346
367
  ForcedCompanion,
347
368
  BeyondSurfacePath,
348
369
  SurfaceScopeResult,
370
+ ProtectedPathViolation,
349
371
  ProjectPath,
350
372
  TaskFileFacts,
351
373
  TaskIssueFacts,
@@ -429,7 +451,13 @@ export {
429
451
  stripNonProse,
430
452
  TASK_NUMBER_PATTERN
431
453
  } from './reader-resolvable-prose'
432
- export type { ProseFileClass, ProseFinding, ProseSourceFile, SpecGrandfather } from './reader-resolvable-prose'
454
+ export type {
455
+ ProseFileClass,
456
+ ProseFinding,
457
+ ProseSourceFile,
458
+ ProseSweepOptions,
459
+ SpecGrandfather
460
+ } from './reader-resolvable-prose'
433
461
  export {
434
462
  checkQuotedCommandStaleness,
435
463
  evaluateCitedQuotes,
@@ -444,6 +472,36 @@ export {
444
472
  scanRetiredVocabulary
445
473
  } from './retired-vocabulary'
446
474
  export type { VocabFinding, VocabSourceFile } from './retired-vocabulary'
475
+ export {
476
+ allowedScopesFor,
477
+ CONFIGURABLE_DEFAULT_RULES,
478
+ CONFIGURABLE_PROSE_SCOPES,
479
+ CONFIGURED_PATTERN_MAX_LENGTH,
480
+ CONFIGURED_PROSE_FLAGS,
481
+ DECISION_RECORD_CITATION_ID,
482
+ DECISION_RECORD_CITATION_SCOPES,
483
+ DEFAULT_PROSE_RULE_SET,
484
+ DEFAULT_PROSE_RULES,
485
+ decisionRecordCitationPattern,
486
+ decisionRecordCitationRule,
487
+ groupOfScope,
488
+ RESOLVABLE_SCOPES,
489
+ RETIRED_SCOPES,
490
+ resolveProseRules,
491
+ rulesForGroup,
492
+ rulesOfGroup
493
+ } from './prose-rules'
494
+ export type {
495
+ CustomProseRule,
496
+ DefaultProseRule,
497
+ ProseCheckGroup,
498
+ ProseRuleOverride,
499
+ ProseRuleSet,
500
+ ProseRuleSeverity,
501
+ ProseRuleSeveritySetting,
502
+ ProseRulesConfig,
503
+ ResolvedProseRule
504
+ } from './prose-rules'
447
505
  export { checkLocalAnchorCoverage } from './local-anchor-coverage'
448
506
  export type {
449
507
  AnchorCoverageFinding,
@@ -472,7 +530,7 @@ export { isNewDiskStateFile } from './no-disk-state'
472
530
  export type { DiskStateFileStatus } from './no-disk-state'
473
531
  export { checkDirectMainPush } from './direct-main-push'
474
532
  export type { DirectMainPushFact, DirectMainPushResult } from './direct-main-push'
475
- export { checkMainBranchRefusal } from './main-branch-refusal'
533
+ export { checkMainBranchRefusal, resolveDefaultBranch } from './main-branch-refusal'
476
534
  export type { MainBranchRefusalFinding, MainBranchRefusalReason } from './main-branch-refusal'
477
535
  export { ensureLabelExists, LABEL_COLOR } from './ensure-label'
478
536
  export type { LabelExistenceIo } from './ensure-label'
@@ -580,8 +638,17 @@ export { decideIssueAssignment } from './issue-assignment'
580
638
  export type { IssueAssignmentDecision, IssueAssignmentInput } from './issue-assignment'
581
639
  export { locateTestPlanSection } from './test-plan-section'
582
640
  export type { TestPlanSection } from './test-plan-section'
641
+ export {
642
+ carryLiveRecord,
643
+ type LiveRecordEntry,
644
+ type LiveRecordLine,
645
+ readLiveRecord,
646
+ renderLiveRecordBlock,
647
+ renderLiveRecordLine,
648
+ withLiveRecord
649
+ } from './live-record'
583
650
  export { evaluateTestPlanGate } from './test-plan-gate'
584
- export type { TestPlanGateResult, TestPlanGateVerdict } from './test-plan-gate'
651
+ export type { LiveGateInputs, TestPlanGateResult, TestPlanGateVerdict } from './test-plan-gate'
585
652
  export {
586
653
  AEG_BLOCKED_LABEL,
587
654
  buildBranchName,
@@ -647,6 +714,7 @@ export {
647
714
  parseSummaryConfidenceRows,
648
715
  PUBLISHED_MARKER_LINE,
649
716
  reconstructRounds,
717
+ recordDeveloperAttempt,
650
718
  renderPhaseBreakdown,
651
719
  renderPublishedMarker,
652
720
  renderTaskBudgetDetail,
@@ -855,3 +923,5 @@ export type {
855
923
  TransitionInput,
856
924
  TransitionRecord
857
925
  } from './control-store'
926
+
927
+ export { isProtectedAdminPath, normalizeTouchedPath, PROTECTED_ADMIN_PATHS } from './protected-paths'
@@ -1,78 +1,46 @@
1
- import { parseTaskBranch } from './first-push-dispatch-gate'
2
-
3
1
  /**
4
- * First-push Issue self-assignment. Pure — no `fs`, no `gh`/`git` shell-outs. The CLI shim
5
- * (`bin/assign-task-issue.ts`, wired into `.husky/pre-push`) gathers the
6
- * facts — does the remote ref already exist, which Issue does the topology
7
- * row name, who is currently assigned, who is the authenticated pusher —
8
- * and this evaluator decides whether to assign.
2
+ * Issue self-assignment at task-run start. Pure — no `fs`, no `gh`/`git`
3
+ * shell-outs. The CLI's writer (`assignIssueAtRunStart`,
4
+ * `apps/cli/src/lib/dispatch-task.ts`, called by `runTask` once the run's
5
+ * Issue is resolved and the live-driver refusal has passed) gathers the
6
+ * facts — who is currently assigned, who `gh` is authenticated as — and this
7
+ * evaluator decides whether to assign.
9
8
  *
10
9
  * Produces the signal Studio's dispatch-visibility chip
11
- * renders: `facts.assigned = assigneesCount > 0`. Assignment had never been
12
- * mechanized anywhere — it happened only when the Principal remembered to
13
- * assign by hand, so a genuinely in-flight task (a real task: two real
14
- * commits pushed) looked identical to an untouched one. The task branch's
15
- * FIRST real push is the earliest genuine "in flight" evidence (assigning
16
- * at brief-authoring time would reintroduce the false positive task 26 was
17
- * built to avoid), so that is the moment this fires.
10
+ * renders: `facts.assigned = assigneesCount > 0`. Without it, assignment
11
+ * happened only when the Principal remembered to assign by hand, so a
12
+ * genuinely in-flight task looked identical to an untouched one. A task run
13
+ * starting is the moment a task genuinely goes in flight, so that is the
14
+ * moment this fires; "first" means the run starts and the Issue has no
15
+ * assignee yet.
18
16
  *
19
17
  * Every guard skips rather than errors — this is a visibility nicety, never
20
18
  * a gate. In particular: `assignees`/`login` arriving as `null` (a failed
21
19
  * `gh` call) means "no signal", and no-signal means no action — never a
22
- * guess, never a block.
20
+ * guess, never a block. Such a skip is marked `missingFact` so the caller
21
+ * can warn about it, unlike the silent already-assigned no-op.
23
22
  */
24
23
 
25
24
  export type IssueAssignmentInput = {
26
- /** The branch being pushed. */
27
- branch: string
28
- /**
29
- * Whether the remote ref already exists — from the pre-push stdin's
30
- * remote-sha (all zeros = the ref is being created by this push, i.e.
31
- * genuinely the first push). A force-push to an existing branch keeps a
32
- * non-zero remote-sha and therefore never re-triggers; deleting and
33
- * recreating the remote branch re-presents a zero sha, which the
34
- * already-assigned no-op below absorbs.
35
- */
36
- remoteRefExists: boolean
37
- /** The topology row's Issue number, or `null` when the row or its Issue cell could not be resolved. */
38
- issue: number | null
25
+ /** The task's Issue number. */
26
+ issue: number
39
27
  /** Current assignee logins on the Issue, or `null` when the fetch failed. */
40
28
  assignees: string[] | null
41
- /** The authenticated `gh` login — the actual pusher — or `null` when unresolvable. Never a hardcoded fallback. */
29
+ /** The authenticated `gh` login, or `null` when unresolvable. Never a hardcoded fallback. */
42
30
  login: string | null
43
31
  }
44
32
 
45
33
  export type IssueAssignmentDecision =
46
34
  | { action: 'assign'; issue: number; login: string; reason: string }
47
- | { action: 'skip'; reason: string }
35
+ | { action: 'skip'; missingFact: boolean; reason: string }
48
36
 
49
37
  export function decideIssueAssignment(input: IssueAssignmentInput): IssueAssignmentDecision {
50
- const { branch, remoteRefExists, issue, assignees, login } = input
51
-
52
- if (parseTaskBranch(branch) === null) {
53
- return {
54
- action: 'skip',
55
- reason: `Branch \`${branch}\` is not a task/<tranche>/<n> branch — Issue self-assignment only applies to task branches.`
56
- }
57
- }
58
-
59
- if (remoteRefExists) {
60
- return {
61
- action: 'skip',
62
- reason: `Branch \`${branch}\` already exists on the remote — not its first push, nothing to assign.`
63
- }
64
- }
65
-
66
- if (issue === null) {
67
- return {
68
- action: 'skip',
69
- reason: `No Issue resolved for \`${branch}\` from its topology row — skipping self-assignment (the gate owns refusing an unplanned branch).`
70
- }
71
- }
38
+ const { issue, assignees, login } = input
72
39
 
73
40
  if (assignees === null) {
74
41
  return {
75
42
  action: 'skip',
43
+ missingFact: true,
76
44
  reason: `Could not read Issue #${issue}'s current assignees — skipping rather than risking a double-assign (fail-open, never a guess).`
77
45
  }
78
46
  }
@@ -80,6 +48,7 @@ export function decideIssueAssignment(input: IssueAssignmentInput): IssueAssignm
80
48
  if (assignees.length > 0) {
81
49
  return {
82
50
  action: 'skip',
51
+ missingFact: false,
83
52
  reason: `Issue #${issue} is already assigned (${assignees.join(', ')}) — no-op.`
84
53
  }
85
54
  }
@@ -87,8 +56,9 @@ export function decideIssueAssignment(input: IssueAssignmentInput): IssueAssignm
87
56
  if (login === null) {
88
57
  return {
89
58
  action: 'skip',
59
+ missingFact: true,
90
60
  reason:
91
- 'Could not resolve the authenticated `gh` login — never assigning anyone other than the actual pusher, so skipping.'
61
+ 'Could not resolve the identity `gh` is authenticated as — never assigning anyone other than that identity, so skipping.'
92
62
  }
93
63
  }
94
64
 
@@ -96,6 +66,6 @@ export function decideIssueAssignment(input: IssueAssignmentInput): IssueAssignm
96
66
  action: 'assign',
97
67
  issue,
98
68
  login,
99
- reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
69
+ reason: `Task run starting on unassigned Issue #${issue} — assigning it to @${login} (the authenticated identity).`
100
70
  }
101
71
  }