@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.
- package/aeg-root/contracts/developer-reviewer.md +2 -2
- package/aeg-root/contracts/planner-developer.md +4 -4
- package/aeg-root/process.md +3 -3
- package/aeg-root/roles/developer/reference.md +3 -0
- package/aeg-root/state-machine.md +2 -2
- package/aeg-root/templates/brief-template.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +165 -65
- package/dist/checks/bin/check-branch-topology.js +169 -60
- package/dist/checks/bin/check-brief-shape.js +165 -65
- package/dist/checks/bin/check-changeset-coverage.js +342 -122
- package/dist/checks/bin/check-ci-shard-coverage.js +384 -130
- package/dist/checks/bin/check-closes-n.js +169 -60
- package/dist/checks/bin/check-coherence.js +165 -65
- package/dist/checks/bin/check-dead-branch-push.js +142 -59
- package/dist/checks/bin/check-dispatch-readiness.js +211 -81
- package/dist/checks/bin/check-doc-claims.js +165 -65
- package/dist/checks/bin/check-doc-coverage-push.js +342 -122
- package/dist/checks/bin/check-doc-coverage.js +344 -124
- package/dist/checks/bin/check-doctrine-no-procedures.js +165 -65
- package/dist/checks/bin/check-doctrine-portability.js +342 -122
- package/dist/checks/bin/check-evidence-fresh.js +376 -129
- package/dist/checks/bin/check-exec-bits.js +342 -122
- package/dist/checks/bin/check-first-push-dispatch.js +208 -78
- package/dist/checks/bin/check-issue-milestone-attach.js +142 -59
- package/dist/checks/bin/check-issue-objectives-numbering.js +165 -65
- package/dist/checks/bin/check-issue-parts-coverage.js +142 -59
- package/dist/checks/bin/check-issue-surface-globs.js +218 -88
- package/dist/checks/bin/check-issue-title-grammar.js +142 -59
- package/dist/checks/bin/check-main-branch-refusal.js +142 -59
- package/dist/checks/bin/check-no-disk-state.js +142 -59
- package/dist/checks/bin/check-pr-premise-reassert.js +165 -65
- package/dist/checks/bin/check-pr-report-density.js +142 -59
- package/dist/checks/bin/check-principal-test-plan-wait.js +165 -65
- package/dist/checks/bin/check-quoted-command.js +338 -118
- package/dist/checks/bin/check-reader-resolvable-prose.js +338 -118
- package/dist/checks/bin/check-registry-gates.js +206 -78
- package/dist/checks/bin/check-retired-vocabulary.js +338 -118
- package/dist/checks/bin/check-review-gate.js +203 -83
- package/dist/checks/bin/check-single-plan-pr.js +142 -59
- package/dist/checks/bin/check-surface-scope.js +169 -60
- package/dist/checks/bin/check-test-plan.js +165 -65
- package/dist/checks/bin/check-token-collection-wired.js +142 -59
- package/dist/checks/bin/check-workspace-escape.js +340 -120
- package/dist/checks/bin/verify-coherence.js +153 -60
- package/dist/checks/bin/verify-dispatch.js +169 -69
- package/dist/checks/bin/verify-docs.js +142 -57
- package/dist/index.js +16280 -11764
- package/dist/lib/pre-push-cache-test-run.js +791 -68
- package/dist/lib/pre-push-changed-files.js +65 -19
- package/dist/lib/pre-push-mode.js +466 -0
- package/dist/lib/pre-push-progress-dir.js +4205 -0
- package/dist/lib/pre-push-record-tests.js +446 -0
- package/dist/lib/pre-push-select-tests.js +1426 -454
- package/dist/lib/push-progress-observer.js +4213 -0
- package/package.json +11 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +18 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +17 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +13 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +1 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +77 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +221 -56
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +52 -109
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- 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
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +1 -1
- 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
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- 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
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{38kom-9c-oi65.js → 0x7u6si-ai179.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1p3vr9qts86_b.js → 2fu7mfsj4oima.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{21tunzmxjvm2a.js → 34b4ruddunn3q.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
|
@@ -44,11 +44,13 @@ export type ProseFinding = {
|
|
|
44
44
|
line: number
|
|
45
45
|
message: string
|
|
46
46
|
blocking: boolean
|
|
47
|
+
/** The id of the rule that matched. */
|
|
48
|
+
rule: string
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
|
-
*
|
|
51
|
-
* blocking finding — copied verbatim (aeg-root dropped) from the scope list
|
|
52
|
+
* The default of `proseGates.productPaths`: path prefixes under which a
|
|
53
|
+
* tranche-slug citation in product code is a blocking finding — copied verbatim (aeg-root dropped) from the scope list
|
|
52
54
|
* `retired-vocabulary.test.ts`'s `PATTERN_SCOPE[TRANCHE_SLUG_VN_PATTERN]` used
|
|
53
55
|
* to grep directly; that suite no longer greps these paths itself
|
|
54
56
|
* (`prose-product-scope.test.ts` pins this list against drift instead).
|
|
@@ -66,8 +68,8 @@ function isUnderOrEqual(path: string, prefix: string): boolean {
|
|
|
66
68
|
return path === prefix || path.startsWith(`${prefix}/`)
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
function isProductScopeFile(path: string): boolean {
|
|
70
|
-
return
|
|
71
|
+
function isProductScopeFile(path: string, productPaths: readonly string[]): boolean {
|
|
72
|
+
return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)))
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
/**
|
|
@@ -112,11 +114,7 @@ export const DEFAULT_SPEC_PATHS: readonly string[] = ['SPEC.md', 'CONTEXT.md', '
|
|
|
112
114
|
* spelling.
|
|
113
115
|
*/
|
|
114
116
|
export function normalizeSpecPath(entry: string): string {
|
|
115
|
-
|
|
116
|
-
while (out.startsWith('./')) out = out.slice(2)
|
|
117
|
-
out = out.replace(/\/{2,}/g, '/')
|
|
118
|
-
while (out.endsWith('/')) out = out.slice(0, -1)
|
|
119
|
-
return out
|
|
117
|
+
return normalizeRepoPath(entry)
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
/**
|
|
@@ -169,13 +167,17 @@ function isClaudeMdFile(path: string): boolean {
|
|
|
169
167
|
* root context document and decision records read. A caller adding
|
|
170
168
|
* configured paths passes the defaults alongside them; this parameter is the
|
|
171
169
|
* whole set, never a delta.
|
|
170
|
+
*
|
|
171
|
+
* `productPaths` is the product class's file set — `PRODUCT_SLUG_SCOPE`
|
|
172
|
+
* unless `proseGates.productPaths` replaces it.
|
|
172
173
|
*/
|
|
173
174
|
export function classifyProseFile(
|
|
174
175
|
path: string,
|
|
175
176
|
readerFacingPrefix: string,
|
|
176
177
|
readerFacingSuffix: string,
|
|
177
178
|
shipsPrefix: string = SHIPS_PREFIX,
|
|
178
|
-
specPaths: readonly string[] = DEFAULT_SPEC_PATHS
|
|
179
|
+
specPaths: readonly string[] = DEFAULT_SPEC_PATHS,
|
|
180
|
+
productPaths: readonly string[] = PRODUCT_SLUG_SCOPE
|
|
179
181
|
): ProseFileClass | null {
|
|
180
182
|
if (path.startsWith(shipsPrefix)) {
|
|
181
183
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? 'internal' : 'ships'
|
|
@@ -185,7 +187,7 @@ export function classifyProseFile(
|
|
|
185
187
|
}
|
|
186
188
|
if (isClaudeMdFile(path)) return 'internal'
|
|
187
189
|
if (isSpecFile(path, specPaths)) return 'spec'
|
|
188
|
-
if (isProductScopeFile(path)) return 'product'
|
|
190
|
+
if (isProductScopeFile(path, productPaths)) return 'product'
|
|
189
191
|
return null
|
|
190
192
|
}
|
|
191
193
|
|
|
@@ -242,10 +244,27 @@ function lineAt(content: string, index: number): number {
|
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
/** `#NNN`-shaped — a PR/Issue number cited bare, resolvable only inside this repo's own tracker. */
|
|
245
|
-
|
|
247
|
+
import {
|
|
248
|
+
DEFAULT_PROSE_RULE_SET,
|
|
249
|
+
normalizeRepoPath,
|
|
250
|
+
type ProseRuleSet,
|
|
251
|
+
type ResolvedProseRule,
|
|
252
|
+
ruleReads,
|
|
253
|
+
rulesForGroup,
|
|
254
|
+
rulesInScope
|
|
255
|
+
} from './prose-rules'
|
|
256
|
+
|
|
257
|
+
const readerRules = rulesForGroup('reader-resolvable')
|
|
258
|
+
const readerPattern = (id: string, scope = 'prose'): RegExp => {
|
|
259
|
+
const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope]
|
|
260
|
+
if (!(pattern instanceof RegExp)) throw new Error(`default prose rule ${id} has no ${scope} pattern`)
|
|
261
|
+
return pattern
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export const FORGE_NUMBER_PATTERN = readerPattern('forge-number')
|
|
246
265
|
|
|
247
266
|
/** `example-tranche-vN`-shaped — an internal tranche slug ending `-vN`. */
|
|
248
|
-
export const TRANCHE_SLUG_VN_PATTERN =
|
|
267
|
+
export const TRANCHE_SLUG_VN_PATTERN = readerPattern('tranche-slug')
|
|
249
268
|
|
|
250
269
|
/**
|
|
251
270
|
* `task 4`/`tasks 12`/`task #4`-shaped — a task's number out of a plan, which
|
|
@@ -263,7 +282,7 @@ export const TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g
|
|
|
263
282
|
* citation itself — the caller reports group 2, so the boundary character
|
|
264
283
|
* never leaks into a finding's message.
|
|
265
284
|
*/
|
|
266
|
-
export const TASK_NUMBER_PATTERN =
|
|
285
|
+
export const TASK_NUMBER_PATTERN = readerPattern('task-number')
|
|
267
286
|
|
|
268
287
|
/**
|
|
269
288
|
* Builds the legacy-slug pattern from the real archived-tranche filenames
|
|
@@ -308,6 +327,55 @@ export function specGrandfatherPaths(specGrandfather: SpecGrandfather): string[]
|
|
|
308
327
|
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather)
|
|
309
328
|
}
|
|
310
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Options every sweep below accepts as its last parameter. `rules` is the
|
|
332
|
+
* resolved rule set (`resolveProseRules`) — the shipped defaults unless the
|
|
333
|
+
* repository configured `proseGates.rules`; `productPaths` replaces
|
|
334
|
+
* `PRODUCT_SLUG_SCOPE` as the product class's file set.
|
|
335
|
+
*/
|
|
336
|
+
export type ProseSweepOptions = {
|
|
337
|
+
rules?: ProseRuleSet
|
|
338
|
+
productPaths?: readonly string[]
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** The file classes the reference sweep reads, each the scope of the same name. */
|
|
342
|
+
const REFERENCE_CLASSES: ReadonlySet<ProseFileClass> = new Set(['ships', 'reader-facing', 'product', 'spec'])
|
|
343
|
+
|
|
344
|
+
/** The reference rules for one file class, in run order: every pattern rule whose scopes name the class, plus the built-in legacy-slug rule. */
|
|
345
|
+
function referenceRulesFor(set: ProseRuleSet, cls: ProseFileClass): readonly ResolvedProseRule[] {
|
|
346
|
+
return rulesInScope(set, cls).filter((rule) => rule.group === 'reader-resolvable' && rule.id !== 'coined-term')
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Every match of `pattern` in `text`, with the cited text and its offset. A
|
|
351
|
+
* configured pattern that matches the empty string advances past it and
|
|
352
|
+
* reports nothing, so a careless rule can never loop forever.
|
|
353
|
+
*/
|
|
354
|
+
function citations(pattern: RegExp, text: string, group?: number): { cited: string; index: number }[] {
|
|
355
|
+
const out: { cited: string; index: number }[] = []
|
|
356
|
+
const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`)
|
|
357
|
+
re.lastIndex = 0
|
|
358
|
+
let match: RegExpExecArray | null = re.exec(text)
|
|
359
|
+
while (match !== null) {
|
|
360
|
+
if (match[0] === '') {
|
|
361
|
+
re.lastIndex++
|
|
362
|
+
} else {
|
|
363
|
+
const cited = group !== undefined ? (match[group] ?? match[0]) : match[0]
|
|
364
|
+
// The cited text's own offset, not the whole match's — see the line
|
|
365
|
+
// computation in `checkUnresolvableReferences`.
|
|
366
|
+
out.push({ cited, index: match.index + match[0].indexOf(cited) })
|
|
367
|
+
}
|
|
368
|
+
match = re.exec(text)
|
|
369
|
+
}
|
|
370
|
+
re.lastIndex = 0
|
|
371
|
+
return out
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** A custom rule's finding text: its own id, the matched text, and its message. */
|
|
375
|
+
function customMessage(rule: ResolvedProseRule, cited: string): string {
|
|
376
|
+
return `${rule.id}: ${rule.message} ("${cited}")`
|
|
377
|
+
}
|
|
378
|
+
|
|
311
379
|
export function checkUnresolvableReferences(
|
|
312
380
|
files: readonly ProseSourceFile[],
|
|
313
381
|
readerFacingPrefix: string,
|
|
@@ -315,43 +383,37 @@ export function checkUnresolvableReferences(
|
|
|
315
383
|
legacySlugs: readonly string[] = [],
|
|
316
384
|
shipsPrefix: string = SHIPS_PREFIX,
|
|
317
385
|
specGrandfather: SpecGrandfather = [],
|
|
318
|
-
specPaths: readonly string[] = DEFAULT_SPEC_PATHS
|
|
386
|
+
specPaths: readonly string[] = DEFAULT_SPEC_PATHS,
|
|
387
|
+
options: ProseSweepOptions = {}
|
|
319
388
|
): ProseFinding[] {
|
|
389
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET
|
|
390
|
+
const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE
|
|
320
391
|
const findings: ProseFinding[] = []
|
|
321
392
|
const legacyPattern = legacySlugPattern(legacySlugs)
|
|
322
393
|
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? (specGrandfather as readonly string[]) : [])
|
|
323
394
|
const limits = new Map<string, number>(
|
|
324
395
|
Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather as Readonly<Record<string, number>>)
|
|
325
396
|
)
|
|
326
|
-
// `group` names the capture holding the actual cited text — the plain
|
|
327
|
-
// patterns have none (report the whole match), the boundary-checked
|
|
328
|
-
// legacy-slug pattern reports its group 2 so the boundary chars around it
|
|
329
|
-
// never leak into the finding's message.
|
|
330
|
-
const patterns: { pattern: RegExp; what: string; group?: number }[] = [
|
|
331
|
-
{ pattern: FORGE_NUMBER_PATTERN, what: 'a forge number' },
|
|
332
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: 'an internal tranche slug' },
|
|
333
|
-
...(legacyPattern ? [{ pattern: legacyPattern, what: 'an internal tranche slug', group: 2 }] : [])
|
|
334
|
-
]
|
|
335
397
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
//
|
|
341
|
-
//
|
|
342
|
-
//
|
|
343
|
-
// The doctrine pages themselves are deliberately left out of it — their own
|
|
398
|
+
// Which rules run in which class is the rule set's `scopes`: by default a
|
|
399
|
+
// doctrine page and a reader-facing page carry the forge-number,
|
|
400
|
+
// tranche-slug and legacy-slug rules; product code carries the
|
|
401
|
+
// tranche-slug rule alone; a spec carries all of those plus the
|
|
402
|
+
// task-number rule, since a durable document that copies a plan's task
|
|
403
|
+
// numbers goes stale the moment the plan is renumbered. The doctrine pages
|
|
404
|
+
// are deliberately left out of the task-number rule — their own
|
|
344
405
|
// report-only sweep names a much larger standing backlog, and a rule that
|
|
345
406
|
// blocks belongs where it can be satisfied file by file.
|
|
346
|
-
const specPatterns: { pattern: RegExp; what: string; group?: number }[] = [
|
|
347
|
-
...patterns,
|
|
348
|
-
{ pattern: TASK_NUMBER_PATTERN, what: 'a task number', group: 2 }
|
|
349
|
-
]
|
|
350
|
-
|
|
351
407
|
for (const file of files) {
|
|
352
|
-
const cls = classifyProseFile(
|
|
353
|
-
|
|
354
|
-
|
|
408
|
+
const cls = classifyProseFile(
|
|
409
|
+
file.path,
|
|
410
|
+
readerFacingPrefix,
|
|
411
|
+
readerFacingSuffix,
|
|
412
|
+
shipsPrefix,
|
|
413
|
+
specPaths,
|
|
414
|
+
productPaths
|
|
415
|
+
)
|
|
416
|
+
if (!cls || !REFERENCE_CLASSES.has(cls)) continue
|
|
355
417
|
// A spec explicitly listed by path is grandfathered stock (already
|
|
356
418
|
// failing when this sweep was extended to specs) and is skipped
|
|
357
419
|
// entirely, not merely down-graded: the list shrinks as each spec's
|
|
@@ -362,35 +424,31 @@ export function checkUnresolvableReferences(
|
|
|
362
424
|
// source. A path listed with a number is not skipped: its findings are
|
|
363
425
|
// counted below and reported only once they exceed that number.
|
|
364
426
|
if (cls === 'spec' && grandfatheredWhole.has(file.path)) continue
|
|
365
|
-
const blocking = cls === 'product' || cls === 'spec'
|
|
366
427
|
const scrubbed =
|
|
367
428
|
cls === 'product' ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content)
|
|
368
|
-
// A spec is checked with the SAME rules a doctrine page is — the full
|
|
369
|
-
// reference pattern set, never the narrower product-code list — plus the
|
|
370
|
-
// task-number rule that applies to this class alone.
|
|
371
|
-
const patternsToRun = cls === 'product' ? productPatterns : cls === 'spec' ? specPatterns : patterns
|
|
372
429
|
const fileFindings: ProseFinding[] = []
|
|
373
|
-
for (const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
430
|
+
for (const rule of referenceRulesFor(set, cls)) {
|
|
431
|
+
if (!ruleReads(set, rule, file.path)) continue
|
|
432
|
+
const pattern = !rule.custom && rule.id === 'legacy-batch-name' ? legacyPattern : rule.patternFor(cls)
|
|
433
|
+
if (!pattern) continue
|
|
434
|
+
const blocking = rule.severity[cls] === 'error'
|
|
435
|
+
// A product-code finding names its class in its own message.
|
|
436
|
+
const what = cls === 'product' ? `${rule.message} in product code` : rule.message
|
|
437
|
+
for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
|
|
378
438
|
// The line is the CITED text's own line, not the whole match's. A
|
|
379
439
|
// boundary-checked pattern consumes the character before the
|
|
380
440
|
// citation, and where that character is the newline ending the
|
|
381
441
|
// previous line — a citation that opens a line — the match begins on
|
|
382
442
|
// the previous line and a finding sent the reader there instead.
|
|
383
|
-
// `indexOf` is exact for both shapes in use: the leading boundary is
|
|
384
|
-
// one character that can never itself start the cited text, and an
|
|
385
|
-
// empty boundary (start of file) resolves to offset zero.
|
|
386
|
-
const citedIndex = match.index + match[0].indexOf(cited)
|
|
387
443
|
fileFindings.push({
|
|
388
444
|
file: file.path,
|
|
389
|
-
line: lineAt(scrubbed,
|
|
390
|
-
message:
|
|
391
|
-
|
|
445
|
+
line: lineAt(scrubbed, index),
|
|
446
|
+
message: rule.custom
|
|
447
|
+
? customMessage(rule, cited)
|
|
448
|
+
: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
449
|
+
blocking,
|
|
450
|
+
rule: rule.id
|
|
392
451
|
})
|
|
393
|
-
match = pattern.exec(scrubbed)
|
|
394
452
|
}
|
|
395
453
|
}
|
|
396
454
|
const limit = cls === 'spec' ? limits.get(file.path) : undefined
|
|
@@ -461,13 +519,27 @@ export function checkUndefinedVocabulary(
|
|
|
461
519
|
glossaryTerms: readonly string[],
|
|
462
520
|
readerFacingPrefix: string,
|
|
463
521
|
readerFacingSuffix: string,
|
|
464
|
-
shipsPrefix: string = SHIPS_PREFIX
|
|
522
|
+
shipsPrefix: string = SHIPS_PREFIX,
|
|
523
|
+
options: ProseSweepOptions = {}
|
|
465
524
|
): ProseFinding[] {
|
|
466
525
|
const findings: ProseFinding[] = []
|
|
526
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET
|
|
527
|
+
// The built-in coined-term rule: switched off, it is absent from the set;
|
|
528
|
+
// narrowed, it reads only the classes its scopes still name.
|
|
529
|
+
const rule = set.rules.find((r) => !r.custom && r.id === 'coined-term')
|
|
530
|
+
if (!rule) return findings
|
|
467
531
|
|
|
468
532
|
for (const file of files) {
|
|
469
|
-
const cls = classifyProseFile(
|
|
470
|
-
|
|
533
|
+
const cls = classifyProseFile(
|
|
534
|
+
file.path,
|
|
535
|
+
readerFacingPrefix,
|
|
536
|
+
readerFacingSuffix,
|
|
537
|
+
shipsPrefix,
|
|
538
|
+
DEFAULT_SPEC_PATHS,
|
|
539
|
+
options.productPaths
|
|
540
|
+
)
|
|
541
|
+
if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls)) continue
|
|
542
|
+
if (!ruleReads(set, rule, file.path)) continue
|
|
471
543
|
const scrubbed = stripNonProse(file.path, file.content)
|
|
472
544
|
|
|
473
545
|
for (const term of glossaryTerms) {
|
|
@@ -478,7 +550,8 @@ export function checkUndefinedVocabulary(
|
|
|
478
550
|
file: file.path,
|
|
479
551
|
line,
|
|
480
552
|
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
481
|
-
blocking:
|
|
553
|
+
blocking: rule.severity[cls] === 'error',
|
|
554
|
+
rule: rule.id
|
|
482
555
|
})
|
|
483
556
|
}
|
|
484
557
|
}
|
|
@@ -493,10 +566,10 @@ export function checkUndefinedVocabulary(
|
|
|
493
566
|
* (`x-vN`) is still exactly the kind of internal citation a reader outside
|
|
494
567
|
* this repo cannot resolve.
|
|
495
568
|
*/
|
|
496
|
-
export const SOURCE_COMMENT_TRANCHE_SLUG_PATTERN =
|
|
569
|
+
export const SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern('source-comment-tranche-slug', 'comment')
|
|
497
570
|
|
|
498
571
|
/** `#NNN`-shaped, source-comment class — no upper digit-count bound (unlike `FORGE_NUMBER_PATTERN`'s `{2,4}`), since a forge's issue/PR numbering has no fixed ceiling. */
|
|
499
|
-
export const SOURCE_COMMENT_FORGE_NUMBER_PATTERN =
|
|
572
|
+
export const SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern('source-comment-forge-number', 'comment')
|
|
500
573
|
|
|
501
574
|
/**
|
|
502
575
|
* The inverse of `stripNonProse`'s `.ts`/`.tsx` half: keeps ONLY the text
|
|
@@ -627,30 +700,32 @@ export function extractComments(path: string, content: string): string {
|
|
|
627
700
|
*/
|
|
628
701
|
export function checkSourceComments(
|
|
629
702
|
files: readonly ProseSourceFile[],
|
|
630
|
-
allowlist: readonly string[] = []
|
|
703
|
+
allowlist: readonly string[] = [],
|
|
704
|
+
options: ProseSweepOptions = {}
|
|
631
705
|
): ProseFinding[] {
|
|
632
706
|
const findings: ProseFinding[] = []
|
|
633
707
|
const allowed = new Set(allowlist)
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: 'a forge-number citation' }
|
|
637
|
-
]
|
|
708
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET
|
|
709
|
+
const rules = rulesInScope(set, 'source-comment').filter((rule) => rule.group === 'reader-resolvable')
|
|
638
710
|
|
|
639
711
|
for (const file of files) {
|
|
640
712
|
if (!file.path.endsWith('.ts')) continue
|
|
641
713
|
if (allowed.has(file.path)) continue
|
|
642
714
|
const comments = extractComments(file.path, file.content)
|
|
643
|
-
for (const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
715
|
+
for (const rule of rules) {
|
|
716
|
+
if (!ruleReads(set, rule, file.path)) continue
|
|
717
|
+
const pattern = rule.patternFor('source-comment')
|
|
718
|
+
if (!pattern) continue
|
|
719
|
+
for (const { cited, index } of citations(pattern, comments)) {
|
|
647
720
|
findings.push({
|
|
648
721
|
file: file.path,
|
|
649
|
-
line: lineAt(comments,
|
|
650
|
-
message:
|
|
651
|
-
|
|
722
|
+
line: lineAt(comments, index),
|
|
723
|
+
message: rule.custom
|
|
724
|
+
? customMessage(rule, cited)
|
|
725
|
+
: `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
726
|
+
blocking: rule.severity['source-comment'] === 'error',
|
|
727
|
+
rule: rule.id
|
|
652
728
|
})
|
|
653
|
-
match = pattern.exec(comments)
|
|
654
729
|
}
|
|
655
730
|
}
|
|
656
731
|
}
|
|
@@ -666,7 +741,8 @@ export function checkReaderResolvableProse(
|
|
|
666
741
|
legacySlugs: readonly string[] = [],
|
|
667
742
|
shipsPrefix: string = SHIPS_PREFIX,
|
|
668
743
|
specGrandfather: SpecGrandfather = [],
|
|
669
|
-
specPaths: readonly string[] = DEFAULT_SPEC_PATHS
|
|
744
|
+
specPaths: readonly string[] = DEFAULT_SPEC_PATHS,
|
|
745
|
+
options: ProseSweepOptions = {}
|
|
670
746
|
): ProseFinding[] {
|
|
671
747
|
return [
|
|
672
748
|
...checkUnresolvableReferences(
|
|
@@ -676,9 +752,10 @@ export function checkReaderResolvableProse(
|
|
|
676
752
|
legacySlugs,
|
|
677
753
|
shipsPrefix,
|
|
678
754
|
specGrandfather,
|
|
679
|
-
specPaths
|
|
755
|
+
specPaths,
|
|
756
|
+
options
|
|
680
757
|
),
|
|
681
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
758
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
|
|
682
759
|
]
|
|
683
760
|
}
|
|
684
761
|
|
|
@@ -144,16 +144,14 @@ const NON_GATE_BIN_NAMES: readonly string[] = NON_GATE_BINS
|
|
|
144
144
|
* maintained rather than folded into `GATE_AUDIENCE`, because each would
|
|
145
145
|
* break an existing invariant that map enforces:
|
|
146
146
|
*
|
|
147
|
-
* - `check-dead-branch-push.ts
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* by what they actually do; forcing a `shippedAs` claim onto either to
|
|
156
|
-
* satisfy G2 would misdescribe them.
|
|
147
|
+
* - `check-dead-branch-push.ts`: its aeg-core twin (`check-push-target.ts`)
|
|
148
|
+
* is genuinely NOT the same mechanism, only a closely related one an
|
|
149
|
+
* existing row's own prose already cross-references —
|
|
150
|
+
* `check-push-target.ts` is a lower-level helper `dead-branch-push`'s row
|
|
151
|
+
* already names as `implementation` (a single-purpose forge query, not a
|
|
152
|
+
* second copy of the check). `GATE_AUDIENCE` correctly keeps it classified
|
|
153
|
+
* by what it actually does; forcing a `shippedAs` claim onto it to satisfy
|
|
154
|
+
* G2 would misdescribe it.
|
|
157
155
|
* - `check-closes-n.ts`: its twin, `verify-coherence.ts`, already ships as
|
|
158
156
|
* `coherence` (ring 0) via `GATE_AUDIENCE` — but `closes-n` is ring 1
|
|
159
157
|
* (`CLI_CHECK_RING`), and `ShippedGate` has exactly one `ring` per bin
|
|
@@ -169,8 +167,6 @@ const NON_GATE_BIN_NAMES: readonly string[] = NON_GATE_BINS
|
|
|
169
167
|
const TWIN_CANDIDATE_EXCEPTIONS: Readonly<Record<string, string>> = {
|
|
170
168
|
'apps/cli/src/checks/bin/check-dead-branch-push.ts':
|
|
171
169
|
'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
172
|
-
'apps/cli/src/checks/bin/check-issue-assignment.ts':
|
|
173
|
-
'Ring 0 "A task branch\'s first push (Issue self-assignment)" (implementation: assign-task-issue.ts)',
|
|
174
170
|
'apps/cli/src/checks/bin/check-closes-n.ts': 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
175
171
|
}
|
|
176
172
|
|
|
@@ -37,110 +37,41 @@ export type VocabFinding = {
|
|
|
37
37
|
line: number
|
|
38
38
|
pattern: string
|
|
39
39
|
message: string
|
|
40
|
+
/** The id of the rule that matched. */
|
|
41
|
+
rule: string
|
|
42
|
+
/** Whether the rule's severity for the `repository` scope is `error`. */
|
|
43
|
+
blocking: boolean
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
import {
|
|
47
|
+
DEFAULT_PROSE_RULE_SET,
|
|
48
|
+
PLAN_ON_DISK_PATTERNS,
|
|
49
|
+
type ProseRuleSet,
|
|
50
|
+
RETIRED_GLOBAL_EXEMPTIONS,
|
|
51
|
+
RETIRED_PATTERN_EXEMPTIONS,
|
|
52
|
+
ruleReads,
|
|
53
|
+
rulesForGroup,
|
|
54
|
+
rulesOfGroup,
|
|
55
|
+
TRANCHE_MODEL_FILE
|
|
56
|
+
} from './prose-rules'
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
export const RETIRED_PATTERNS: readonly string[] = [
|
|
52
|
-
// the deleted decision-id format
|
|
53
|
-
String.raw`\bD-[0-9]{3}\b`,
|
|
54
|
-
'D-(###|NNN|nnn|xxx)',
|
|
55
|
-
// the retired record as a live, writable, required artifact, every
|
|
56
|
-
// inflection but never "decision logic"
|
|
57
|
-
'decision (entry|logged)',
|
|
58
|
-
'decision-log entry',
|
|
59
|
-
'decision log entry',
|
|
60
|
-
'decision log(s|ged|ging)?([^a-z]|$)',
|
|
61
|
-
'decision-log',
|
|
62
|
-
'decision entr',
|
|
63
|
-
'decisions? (are |is )?logged',
|
|
64
|
-
'log entries',
|
|
65
|
-
String.raw`decisions\.md`,
|
|
66
|
-
'decisions-legacy',
|
|
67
|
-
'CONTRADICTION',
|
|
68
|
-
'assumes Tier 3',
|
|
69
|
-
// the lock
|
|
70
|
-
'Lock: ?YES',
|
|
71
|
-
'Lock: ?NO',
|
|
72
|
-
'lock approvals?',
|
|
73
|
-
'approves locks',
|
|
74
|
-
'Conforms to lock',
|
|
75
|
-
'Challenges lock',
|
|
76
|
-
// checks deleted with the machinery
|
|
77
|
-
'checkDecisionNumbersFresh',
|
|
78
|
-
// the role that no longer exists
|
|
79
|
-
String.raw`roles/team-leader\.md`,
|
|
80
|
-
// the wreckage a citation strip leaves when it deletes the contents of a
|
|
81
|
-
// parenthetical and not the punctuation around it — the shape is banned,
|
|
82
|
-
// not one instance of it. `()` is deliberately absent: it is an ordinary
|
|
83
|
-
// function call, and banning it would make any TypeScript source unusable.
|
|
84
|
-
String.raw`\(,`,
|
|
85
|
-
String.raw`,\)`,
|
|
86
|
-
String.raw`\(\.\)`,
|
|
87
|
-
...PLAN_ON_DISK_PATTERNS
|
|
88
|
-
]
|
|
58
|
+
const retiredRules = rulesForGroup('retired-vocabulary')
|
|
89
59
|
|
|
90
|
-
|
|
91
|
-
|
|
60
|
+
export { PLAN_ON_DISK_PATTERNS, TRANCHE_MODEL_FILE }
|
|
61
|
+
|
|
62
|
+
/** The retired mechanisms this scan bans as claims of current-ness — see the module header for what is deliberately NOT here. */
|
|
63
|
+
export const RETIRED_PATTERNS: readonly string[] = retiredRules.map((rule) => rule.patterns.repository as string)
|
|
92
64
|
|
|
93
65
|
/** Paths where a retired-vocabulary mention is legitimate: frozen archives and historical records. Substring match, same as the vitest suite's own `EXEMPT`. */
|
|
94
|
-
export const RETIRED_EXEMPT_SUBSTRINGS: readonly string[] =
|
|
95
|
-
'docs/decisions-legacy.md',
|
|
96
|
-
'apps/herald-ai/docs/',
|
|
97
|
-
'apps/vada-ai/docs/',
|
|
98
|
-
'aeg-root/tranches/completed/',
|
|
99
|
-
'packages/aeg-core/src/docs/published-prose',
|
|
100
|
-
'packages/aeg-core/src/retired-vocabulary.test.ts',
|
|
101
|
-
'packages/aeg-core/src/retired-vocabulary.ts',
|
|
102
|
-
'/fixtures/',
|
|
103
|
-
'/node_modules/',
|
|
104
|
-
'/.next/',
|
|
105
|
-
'/.turbo/'
|
|
106
|
-
]
|
|
66
|
+
export const RETIRED_EXEMPT_SUBSTRINGS: readonly string[] = RETIRED_GLOBAL_EXEMPTIONS
|
|
107
67
|
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* keep and this module's whole point is not re-deriving the list.
|
|
116
|
-
*/
|
|
117
|
-
export const PATTERN_EXEMPT: Readonly<Record<string, readonly string[]>> = {
|
|
118
|
-
[String.raw`\bD-[0-9]{3}\b`]: ['./CLAUDE.md'],
|
|
119
|
-
[String.raw`decisions\.md`]: [
|
|
120
|
-
'docs-index.md',
|
|
121
|
-
'apps/vada-ai/specs/legacy/README.md',
|
|
122
|
-
'apps/vada-ai/specs/vada-product-spec.md',
|
|
123
|
-
'apps/vada-ai/web/CLAUDE.md',
|
|
124
|
-
'apps/vada-ai/CLAUDE.md'
|
|
125
|
-
],
|
|
126
|
-
'decisions-legacy': [
|
|
127
|
-
'packages/aeg-core/src/file-classify.ts',
|
|
128
|
-
'packages/aeg-core/src/file-classify.test.ts',
|
|
129
|
-
'packages/aeg-core/src/pr-tier.test.ts',
|
|
130
|
-
'docs-index.md',
|
|
131
|
-
'.claude/skills/database/SKILL.md',
|
|
132
|
-
'.claude/skills/vada-architecture/SKILL.md',
|
|
133
|
-
'apps/vada-ai/specs/vada-byok-principles.md',
|
|
134
|
-
'apps/vada-ai/web/CLAUDE.md',
|
|
135
|
-
'apps/vada-ai/CLAUDE.md'
|
|
136
|
-
],
|
|
137
|
-
CONTRADICTION: ['apps/vada-ai/specs/vada-reviewers-spec.md'],
|
|
138
|
-
// The tranche model's own retirement section is the one place whose job is
|
|
139
|
-
// to say these existed and what replaced them. Exempted by file, for these
|
|
140
|
-
// three patterns only — every other retired class still binds that file,
|
|
141
|
-
// and its other sections carry none of the three.
|
|
142
|
-
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
143
|
-
}
|
|
68
|
+
/** Per-pattern exemptions on top of `RETIRED_EXEMPT_SUBSTRINGS`; the data lives in the shared rule module. */
|
|
69
|
+
export const PATTERN_EXEMPT: Readonly<Record<string, readonly string[]>> = RETIRED_PATTERN_EXEMPTIONS
|
|
70
|
+
|
|
71
|
+
/** Each retired default's pattern text as shipped, by id — what a finding quotes and `PATTERN_EXEMPT` is keyed by. */
|
|
72
|
+
const DEFAULT_PATTERN_OF: ReadonlyMap<string, string> = new Map(
|
|
73
|
+
retiredRules.map((rule) => [rule.id, rule.patterns.repository as string])
|
|
74
|
+
)
|
|
144
75
|
|
|
145
76
|
function lineNumbers(content: string, pattern: RegExp): number[] {
|
|
146
77
|
const out: number[] = []
|
|
@@ -152,26 +83,38 @@ function lineNumbers(content: string, pattern: RegExp): number[] {
|
|
|
152
83
|
}
|
|
153
84
|
|
|
154
85
|
/**
|
|
155
|
-
* Sweeps `files` for
|
|
156
|
-
*
|
|
157
|
-
* `
|
|
158
|
-
*
|
|
159
|
-
*
|
|
86
|
+
* Sweeps `files` for the retired group of `rules` — `RETIRED_PATTERNS` when
|
|
87
|
+
* nothing is configured. A default skips any file whose path contains one
|
|
88
|
+
* of its `RETIRED_EXEMPT_SUBSTRINGS` entries, or that pattern's own
|
|
89
|
+
* `PATTERN_EXEMPT` entry; every rule also skips the paths
|
|
90
|
+
* `proseGates.rules` exempts. Matching is per-line — case-sensitive for a
|
|
91
|
+
* default, the same semantics `grep -E` (with no `-i`) gives the vitest
|
|
92
|
+
* suite this was extracted from; a custom rule carries its own flags.
|
|
160
93
|
*/
|
|
161
|
-
export function scanRetiredVocabulary(
|
|
94
|
+
export function scanRetiredVocabulary(
|
|
95
|
+
files: readonly VocabSourceFile[],
|
|
96
|
+
rules: ProseRuleSet = DEFAULT_PROSE_RULE_SET
|
|
97
|
+
): VocabFinding[] {
|
|
162
98
|
const findings: VocabFinding[] = []
|
|
99
|
+
const retired = rulesOfGroup(rules, 'retired-vocabulary')
|
|
163
100
|
for (const file of files) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
101
|
+
for (const rule of retired) {
|
|
102
|
+
if (rule.substringExempt.some((e) => file.path.includes(e))) continue
|
|
103
|
+
if (!ruleReads(rules, rule, file.path)) continue
|
|
104
|
+
const re = rule.patternFor('repository')
|
|
105
|
+
if (!re) continue
|
|
106
|
+
const pattern = rule.custom ? re.source : (DEFAULT_PATTERN_OF.get(rule.id) ?? re.source)
|
|
107
|
+
if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e))) continue
|
|
169
108
|
for (const line of lineNumbers(file.content, re)) {
|
|
170
109
|
findings.push({
|
|
171
110
|
file: file.path,
|
|
172
111
|
line,
|
|
173
112
|
pattern,
|
|
174
|
-
message:
|
|
113
|
+
message: rule.custom
|
|
114
|
+
? `${rule.id}: ${rule.message} (matches /${pattern}/)`
|
|
115
|
+
: `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
|
|
116
|
+
rule: rule.id,
|
|
117
|
+
blocking: rule.severity.repository === 'error'
|
|
175
118
|
})
|
|
176
119
|
}
|
|
177
120
|
}
|