@attalabs/vinaya 0.21.0 → 0.23.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/README.md +15 -4
- package/aeg-root/contracts/archivist-tranche-archivist.md +2 -2
- package/aeg-root/contracts/brief-developer.md +1 -0
- package/aeg-root/contracts/developer-reviewer.md +3 -3
- package/aeg-root/contracts/reviewer-archivist.md +3 -3
- package/aeg-root/enforcement.md +28 -21
- package/aeg-root/process.md +8 -4
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/brief-author.md +9 -3
- package/aeg-root/roles/developer.md +63 -31
- package/aeg-root/roles/planner.md +2 -2
- package/aeg-root/roles/principal.md +14 -0
- package/aeg-root/roles/reviewer.md +32 -15
- package/aeg-root/roles/security.md +15 -5
- package/aeg-root/skills/aeg/SKILL.md +9 -5
- package/aeg-root/skills/aeg-roles/SKILL.md +2 -2
- package/aeg-root/skills/brief-authoring/SKILL.md +39 -27
- package/aeg-root/state-machine.md +9 -11
- package/aeg-root/templates/brief-template.md +6 -6
- package/aeg-root/templates/pr-report-template.md +12 -7
- package/aeg-root/tranche-model.md +9 -5
- package/dist/checks/bin/check-body-bare-digits.js +667 -148
- package/dist/checks/bin/check-branch-topology.js +714 -149
- package/dist/checks/bin/check-brief-shape.js +704 -147
- package/dist/checks/bin/check-changeset-coverage.js +1046 -166
- package/dist/checks/bin/check-closes-n.js +714 -149
- package/dist/checks/bin/check-coherence.js +729 -156
- package/dist/checks/bin/check-dead-branch-push.js +663 -144
- package/dist/checks/bin/check-dispatch-readiness.js +728 -155
- package/dist/checks/bin/check-doc-coverage-push.js +838 -261
- package/dist/checks/bin/check-doc-coverage.js +838 -261
- package/dist/checks/bin/check-doctrine-no-procedures.js +4794 -0
- package/dist/checks/bin/check-doctrine-portability.js +799 -155
- package/dist/checks/bin/check-evidence-fresh.js +1132 -206
- package/dist/checks/bin/check-exec-bits.js +4931 -0
- package/dist/checks/bin/check-first-push-dispatch.js +716 -151
- package/dist/checks/bin/check-issue-assignment.js +714 -149
- package/dist/checks/bin/check-main-branch-refusal.js +663 -144
- package/dist/checks/bin/check-no-disk-state.js +663 -144
- package/dist/checks/bin/check-pr-report-density.js +4461 -0
- package/dist/checks/bin/check-quoted-command.js +741 -166
- package/dist/checks/bin/check-reader-resolvable-prose.js +768 -173
- package/dist/checks/bin/check-registry-gates.js +726 -154
- package/dist/checks/bin/check-retired-vocabulary.js +760 -165
- package/dist/checks/bin/check-review-gate.js +783 -148
- package/dist/checks/bin/check-single-plan-pr.js +663 -144
- package/dist/checks/bin/check-test-plan.js +664 -145
- package/dist/checks/bin/check-token-collection-wired.js +665 -146
- package/dist/checks/bin/check-token-report.js +4509 -0
- package/dist/checks/bin/check-workspace-escape.js +1129 -183
- package/dist/index.js +8458 -5403
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +173 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +113 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +206 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +65 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/blast-radius-domains.ts +192 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +85 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +511 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +460 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +787 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +55 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +77 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +66 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-tranche.ts +94 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +372 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +39 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +224 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +314 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/build-doc-nav.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +136 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +29 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +48 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/nav-helpers.ts +17 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +134 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/parse-doc.ts +43 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +306 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +89 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/types.ts +33 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +170 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-source.ts +23 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +28 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/file-classify.ts +51 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +80 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +168 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +301 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +102 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +746 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +68 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +245 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +64 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/manifest-validity.ts +81 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/markdown-table.ts +76 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +119 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +240 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +50 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-ledger.ts +77 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-registry.ts +105 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +165 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +183 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +81 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +125 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +275 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +320 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +255 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-parse.ts +164 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +216 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +261 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +163 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +269 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +73 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +269 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-source.ts +14 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/status-block.ts +8 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/sum-ledger.ts +26 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +78 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +104 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +65 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +174 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +140 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/vocabulary-citation.ts +114 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +52 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +172 -0
- 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/api/coherence/route.js.nft.json +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 +2 -2
- 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/[root-of-the-server]__02a-3g8._.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]__0053k9k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0112h-k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__02c71kv._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0o771t1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0puovz5._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1hs0dcu._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0ozbaq0._.js → [root-of-the-server]__1mcitst._.js} +1 -1
- 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/_03x_w6q._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gvm3og._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0lwxg63._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-6rzip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1fqw88f._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1mrtj0f._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1n0cnq-._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_06it6s-._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_1vo08dj._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_1_cfi48._.js +1 -1
- 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 +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00pi8vhg8w6gi.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0r4i_ks9z02bw.js → 03q0q9n6-xah8.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2_k6j1o9q5nn4.js → 0jer_drkl1e4r.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1k916ih3p4nsg.js → 13g16cu00g570.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2hmannd4bjhzy.js → 1sfxfunirkcr6.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1t2kft7bxzuxn.js → 206ajg8f1a-_h.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1hfhxjy577l5d.js → 20x-t0a0v129z.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{25kbt5k-xb2a5.js → 279qq4twinc97.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{112g08xpx3kro.js → 2ka8dg687auhj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ou_81ahqw31e.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0up5x3jg-cwov.js → 2rn89uwtf2lwc.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3mqu_uhluy19i.css → 3qc67qhcvbg0o.css} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1yqs2zgvwa4p1.js → 3zugx9esh2x51.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0_jnwbarv-cqk.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ybrihl5_aocy.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3r5efmleneaco.js +0 -1
- /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{crNCHQ9uAgKOYC6DKkZma → 5xy_GA7G5KRuE3HDumIiw}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{crNCHQ9uAgKOYC6DKkZma → 5xy_GA7G5KRuE3HDumIiw}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{crNCHQ9uAgKOYC6DKkZma → 5xy_GA7G5KRuE3HDumIiw}/_ssgManifest.js +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2
4
|
|
|
3
5
|
// src/checks/bin/check-doctrine-portability.ts
|
|
4
|
-
import { execFileSync as
|
|
5
|
-
import { readdirSync, readFileSync as
|
|
6
|
-
import { join as
|
|
6
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7
|
+
import { readdirSync, readFileSync as readFileSync3, statSync } from "node:fs";
|
|
8
|
+
import { join as join3 } from "node:path";
|
|
7
9
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
10
|
var GATE_AUDIENCE = {
|
|
9
11
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -212,17 +214,18 @@ function splitIds(raw) {
|
|
|
212
214
|
return [];
|
|
213
215
|
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0 && !isEmptyMarker(s) && ID_TOKEN.test(s));
|
|
214
216
|
}
|
|
215
|
-
function resolveIds(raw
|
|
217
|
+
function resolveIds(raw) {
|
|
216
218
|
const ids = splitIds(raw);
|
|
217
219
|
const resolved = [];
|
|
220
|
+
let lastSlug = null;
|
|
218
221
|
for (const id of ids) {
|
|
219
222
|
const qualified = id.match(SLUG_QUALIFIED_ID);
|
|
220
223
|
if (qualified) {
|
|
221
|
-
lastSlug
|
|
224
|
+
lastSlug = qualified[1] ?? null;
|
|
222
225
|
resolved.push(id);
|
|
223
|
-
} else if (lastSlug
|
|
224
|
-
resolved.push(`${lastSlug
|
|
225
|
-
lastSlug
|
|
226
|
+
} else if (lastSlug) {
|
|
227
|
+
resolved.push(`${lastSlug} ${id}`);
|
|
228
|
+
lastSlug = null;
|
|
226
229
|
} else {
|
|
227
230
|
resolved.push(id);
|
|
228
231
|
}
|
|
@@ -242,12 +245,7 @@ function parseRationaleDeps(body) {
|
|
|
242
245
|
const section = extractSection(body);
|
|
243
246
|
const dependsOn = [];
|
|
244
247
|
const conflictsWith = [];
|
|
245
|
-
let current = null;
|
|
246
248
|
const assignedFields = new Set;
|
|
247
|
-
const lastSlugByField = {
|
|
248
|
-
dependsOn: { current: null },
|
|
249
|
-
conflictsWith: { current: null }
|
|
250
|
-
};
|
|
251
249
|
const spanPattern = /`([^`]*)`/g;
|
|
252
250
|
let match = spanPattern.exec(section);
|
|
253
251
|
while (match !== null) {
|
|
@@ -257,13 +255,9 @@ function parseRationaleDeps(body) {
|
|
|
257
255
|
const field = labelMatch[1]?.toLowerCase() === "conflicts-with" ? "conflictsWith" : "dependsOn";
|
|
258
256
|
if (!assignedFields.has(field)) {
|
|
259
257
|
assignedFields.add(field);
|
|
260
|
-
|
|
261
|
-
const ids = resolveIds(labelMatch[2] ?? "", lastSlugByField[field]);
|
|
258
|
+
const ids = resolveIds(labelMatch[2] ?? "");
|
|
262
259
|
pushUnique(field === "dependsOn" ? dependsOn : conflictsWith, ids);
|
|
263
260
|
}
|
|
264
|
-
} else if (current) {
|
|
265
|
-
const ids = resolveIds(content, lastSlugByField[current]);
|
|
266
|
-
pushUnique(current === "dependsOn" ? dependsOn : conflictsWith, ids);
|
|
267
261
|
}
|
|
268
262
|
match = spanPattern.exec(section);
|
|
269
263
|
}
|
|
@@ -1728,6 +1722,48 @@ function splitTableRow(row) {
|
|
|
1728
1722
|
parts.pop();
|
|
1729
1723
|
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1730
1724
|
}
|
|
1725
|
+
// ../../packages/aeg-core/src/blast-radius-domains.ts
|
|
1726
|
+
function resolveWorkspaceEntry(entry2, listDirs) {
|
|
1727
|
+
if (entry2.endsWith("/*")) {
|
|
1728
|
+
const baseDir = entry2.slice(0, -2);
|
|
1729
|
+
return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
|
|
1730
|
+
}
|
|
1731
|
+
if (entry2.includes("*"))
|
|
1732
|
+
return [];
|
|
1733
|
+
return [entry2];
|
|
1734
|
+
}
|
|
1735
|
+
// ../../packages/aeg-core/src/consumer-enumeration.ts
|
|
1736
|
+
function deriveWorkspaceMemberDirs(workspaces, listDirs) {
|
|
1737
|
+
const positive = workspaces.filter((entry2) => !entry2.startsWith("!"));
|
|
1738
|
+
const negative = workspaces.filter((entry2) => entry2.startsWith("!")).map((entry2) => entry2.slice(1));
|
|
1739
|
+
const excluded = new Set;
|
|
1740
|
+
for (const entry2 of negative) {
|
|
1741
|
+
for (const member of resolveWorkspaceEntry(entry2, listDirs))
|
|
1742
|
+
excluded.add(member);
|
|
1743
|
+
}
|
|
1744
|
+
const members = new Set;
|
|
1745
|
+
for (const entry2 of positive) {
|
|
1746
|
+
for (const member of resolveWorkspaceEntry(entry2, listDirs)) {
|
|
1747
|
+
if (!excluded.has(member))
|
|
1748
|
+
members.add(member);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
return [...members].sort();
|
|
1752
|
+
}
|
|
1753
|
+
function buildConsumersOf(workspaces, listDirs, readManifest) {
|
|
1754
|
+
const members = deriveWorkspaceMemberDirs(workspaces, listDirs);
|
|
1755
|
+
return (pkg) => {
|
|
1756
|
+
const target = `@attalabs/${pkg}`;
|
|
1757
|
+
return members.filter((dir) => {
|
|
1758
|
+
if (dir === `packages/${pkg}`)
|
|
1759
|
+
return false;
|
|
1760
|
+
const manifest = readManifest(dir);
|
|
1761
|
+
if (!manifest)
|
|
1762
|
+
return false;
|
|
1763
|
+
return target in (manifest.dependencies ?? {}) || target in (manifest.devDependencies ?? {});
|
|
1764
|
+
});
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1731
1767
|
// ../../packages/aeg-core/src/state-machine-model.ts
|
|
1732
1768
|
var FORGE_FACT_INPUTS = [
|
|
1733
1769
|
{
|
|
@@ -1793,6 +1829,156 @@ var DERIVED_STATUSES = [
|
|
|
1793
1829
|
"incoherent"
|
|
1794
1830
|
];
|
|
1795
1831
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1832
|
+
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1833
|
+
function rowFromCells(cells) {
|
|
1834
|
+
if (cells.length < 7)
|
|
1835
|
+
return null;
|
|
1836
|
+
const phase = (cells[0] ?? "").trim();
|
|
1837
|
+
if (!phase)
|
|
1838
|
+
return null;
|
|
1839
|
+
return {
|
|
1840
|
+
phase,
|
|
1841
|
+
role: (cells[1] ?? "").trim(),
|
|
1842
|
+
agentModel: (cells[2] ?? "").trim(),
|
|
1843
|
+
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1844
|
+
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1845
|
+
cost: parseCostCell(cells[5] ?? ""),
|
|
1846
|
+
date: (cells[6] ?? "").trim()
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
function parseIntCell(cell) {
|
|
1850
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1851
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1852
|
+
return null;
|
|
1853
|
+
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1854
|
+
if (!/^-?\d+$/.test(normalized))
|
|
1855
|
+
return null;
|
|
1856
|
+
return Number(normalized);
|
|
1857
|
+
}
|
|
1858
|
+
function parseCostCell(cell) {
|
|
1859
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1860
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1861
|
+
return null;
|
|
1862
|
+
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1863
|
+
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1864
|
+
return null;
|
|
1865
|
+
return Number(normalized);
|
|
1866
|
+
}
|
|
1867
|
+
function isEmDashOrDash(s) {
|
|
1868
|
+
const t = s.trim();
|
|
1869
|
+
return t === "—" || t === "-" || t === "–";
|
|
1870
|
+
}
|
|
1871
|
+
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1872
|
+
var WAIVER_LABEL = label("waiver-docs");
|
|
1873
|
+
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
1874
|
+
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
1875
|
+
function isPrincipal(login, principalAllowlist) {
|
|
1876
|
+
if (login === null)
|
|
1877
|
+
return false;
|
|
1878
|
+
const normalized = login.toLowerCase();
|
|
1879
|
+
return principalAllowlist.some((p) => p.toLowerCase() === normalized);
|
|
1880
|
+
}
|
|
1881
|
+
function isWaiverLabelActorVerified(opts) {
|
|
1882
|
+
if (!opts.labels.includes(opts.label))
|
|
1883
|
+
return false;
|
|
1884
|
+
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1888
|
+
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1889
|
+
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1890
|
+
function parseTokenReportEntries(body) {
|
|
1891
|
+
const lines = body.split(/\r?\n/);
|
|
1892
|
+
const headingIdxs = [];
|
|
1893
|
+
lines.forEach((line, i) => {
|
|
1894
|
+
if (TOKEN_REPORT_HEADING.test(line))
|
|
1895
|
+
headingIdxs.push(i);
|
|
1896
|
+
});
|
|
1897
|
+
const out = [];
|
|
1898
|
+
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1899
|
+
const start = headingIdxs[h] + 1;
|
|
1900
|
+
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1901
|
+
const section = lines.slice(start, end).join(`
|
|
1902
|
+
`);
|
|
1903
|
+
const tableRows = parseTableSection(section);
|
|
1904
|
+
if (tableRows.length > 0) {
|
|
1905
|
+
out.push(...tableRows);
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
const inlineRow = parseInlineFieldList(section);
|
|
1909
|
+
if (inlineRow)
|
|
1910
|
+
out.push(inlineRow);
|
|
1911
|
+
}
|
|
1912
|
+
return out;
|
|
1913
|
+
}
|
|
1914
|
+
function parseTableSection(section) {
|
|
1915
|
+
const lines = section.split(/\r?\n/);
|
|
1916
|
+
let i = 0;
|
|
1917
|
+
for (;i < lines.length; i++) {
|
|
1918
|
+
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1919
|
+
break;
|
|
1920
|
+
}
|
|
1921
|
+
if (i + 1 >= lines.length)
|
|
1922
|
+
return [];
|
|
1923
|
+
i += 2;
|
|
1924
|
+
const out = [];
|
|
1925
|
+
for (;i < lines.length; i++) {
|
|
1926
|
+
const trimmed = (lines[i] ?? "").trim();
|
|
1927
|
+
if (!trimmed.startsWith("|"))
|
|
1928
|
+
break;
|
|
1929
|
+
const row = rowFromCells(splitTableRow(trimmed));
|
|
1930
|
+
if (row)
|
|
1931
|
+
out.push(row);
|
|
1932
|
+
}
|
|
1933
|
+
return out;
|
|
1934
|
+
}
|
|
1935
|
+
function parseInlineFieldList(section) {
|
|
1936
|
+
const m = section.match(INLINE_FIELD_LIST);
|
|
1937
|
+
if (!m)
|
|
1938
|
+
return null;
|
|
1939
|
+
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1940
|
+
}
|
|
1941
|
+
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
1942
|
+
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1943
|
+
function firstThreeLines(comment) {
|
|
1944
|
+
return comment.split(`
|
|
1945
|
+
`).slice(0, 3).join(`
|
|
1946
|
+
`);
|
|
1947
|
+
}
|
|
1948
|
+
function extractHeadSha(comment) {
|
|
1949
|
+
const m = firstThreeLines(comment).match(HEAD_SHA_PATTERN);
|
|
1950
|
+
return m ? m[1].toLowerCase() : null;
|
|
1951
|
+
}
|
|
1952
|
+
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
1953
|
+
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
1954
|
+
if (candidates.length === 0) {
|
|
1955
|
+
return {
|
|
1956
|
+
value: `no ${missingLabel} pass was run before merge — DANGLING, see below`,
|
|
1957
|
+
headSha: null,
|
|
1958
|
+
danglingNote: `no ${missingLabel} verdict comment found on this PR`
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
const latest = candidates[candidates.length - 1];
|
|
1962
|
+
const m = firstThreeLines(latest).match(valuePattern);
|
|
1963
|
+
if (!m) {
|
|
1964
|
+
return {
|
|
1965
|
+
value: `the most recent ${missingLabel} comment's VERDICT line is not within its first three lines — DANGLING, see below`,
|
|
1966
|
+
headSha: null,
|
|
1967
|
+
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-three-line read window`
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
return {
|
|
1971
|
+
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
1972
|
+
headSha: extractHeadSha(latest),
|
|
1973
|
+
danglingNote: null
|
|
1974
|
+
};
|
|
1975
|
+
}
|
|
1976
|
+
function extractCodeReviewVerdict(comments) {
|
|
1977
|
+
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(APPROVE|REQUEST[ _-]?CHANGES|LGTM)(?![A-Za-z0-9])/im, "code-reviewer");
|
|
1978
|
+
}
|
|
1979
|
+
function extractSecurityReviewVerdict(comments) {
|
|
1980
|
+
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
1981
|
+
}
|
|
1796
1982
|
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1797
1983
|
var DASH_LOOKALIKES = {
|
|
1798
1984
|
"-": "‑",
|
|
@@ -1801,6 +1987,7 @@ var DASH_LOOKALIKES = {
|
|
|
1801
1987
|
};
|
|
1802
1988
|
var DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES));
|
|
1803
1989
|
// ../../packages/aeg-core/src/claude-code-transcript.ts
|
|
1990
|
+
import { createHash } from "node:crypto";
|
|
1804
1991
|
function summarizeTranscript(jsonl) {
|
|
1805
1992
|
const seen = new Set;
|
|
1806
1993
|
const components = {
|
|
@@ -1849,7 +2036,14 @@ function numberOr(value, fallback) {
|
|
|
1849
2036
|
function sanitizeKey(value) {
|
|
1850
2037
|
return value.replace(/[^A-Za-z0-9]+/g, "-");
|
|
1851
2038
|
}
|
|
2039
|
+
function collisionResistantKey(value) {
|
|
2040
|
+
const digest = createHash("sha256").update(value).digest("hex");
|
|
2041
|
+
return `${sanitizeKey(value)}-${digest}`;
|
|
2042
|
+
}
|
|
1852
2043
|
function transcriptPointerPath(projectDir, tmpDir) {
|
|
2044
|
+
return `${tmpDir}/claude-transcript-${collisionResistantKey(projectDir)}.txt`;
|
|
2045
|
+
}
|
|
2046
|
+
function legacyTranscriptPointerPath(projectDir, tmpDir) {
|
|
1853
2047
|
return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`;
|
|
1854
2048
|
}
|
|
1855
2049
|
function resolvePointer(explicitTranscriptPath, deps) {
|
|
@@ -1857,13 +2051,15 @@ function resolvePointer(explicitTranscriptPath, deps) {
|
|
|
1857
2051
|
return { path: explicitTranscriptPath, corroborated: true };
|
|
1858
2052
|
const projectDir = deps.env.CLAUDE_PROJECT_DIR ?? deps.cwd;
|
|
1859
2053
|
const tmpDir = deps.env.TMPDIR ?? "/tmp";
|
|
1860
|
-
const
|
|
2054
|
+
const primaryPointerPath = transcriptPointerPath(projectDir, tmpDir);
|
|
2055
|
+
const legacyPointerPath = legacyTranscriptPointerPath(projectDir, tmpDir);
|
|
1861
2056
|
const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID;
|
|
1862
|
-
|
|
2057
|
+
const pointerPath = deps.exists(primaryPointerPath) ? primaryPointerPath : deps.exists(legacyPointerPath) ? legacyPointerPath : undefined;
|
|
2058
|
+
if (!pointerPath) {
|
|
1863
2059
|
return {
|
|
1864
2060
|
pointerExisted: false,
|
|
1865
2061
|
corroborated: false,
|
|
1866
|
-
error: `No transcript pointer at ${
|
|
2062
|
+
error: `No transcript pointer at ${primaryPointerPath} (nor its pre-migration name ${legacyPointerPath}) ` + "and no --transcript given. Either this repo installs no track-transcript.sh Stop hook (lacking one " + "is not a defect — name the transcript directly instead), or no session has completed a turn yet."
|
|
1867
2063
|
};
|
|
1868
2064
|
}
|
|
1869
2065
|
let contents;
|
|
@@ -1938,28 +2134,15 @@ function isTokenCollectionWiringBroken(capability) {
|
|
|
1938
2134
|
return false;
|
|
1939
2135
|
return capability.reason !== "no-transcript-resolved";
|
|
1940
2136
|
}
|
|
2137
|
+
// ../../packages/aeg-core/src/metering-io-guard.ts
|
|
2138
|
+
import { closeSync, constants as fsConstants, fstatSync, openSync, readFileSync } from "node:fs";
|
|
2139
|
+
var GUARD_OPEN_FLAGS = fsConstants.O_RDONLY | fsConstants.O_NONBLOCK | fsConstants.O_NOFOLLOW;
|
|
1941
2140
|
// ../../packages/aeg-core/src/file-classify.ts
|
|
1942
2141
|
function isCodeFile(p) {
|
|
1943
2142
|
if (p.endsWith(".md"))
|
|
1944
2143
|
return false;
|
|
1945
2144
|
return /\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|sql|css)$/.test(p);
|
|
1946
2145
|
}
|
|
1947
|
-
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1948
|
-
var WAIVER_LABEL = label("waiver-docs");
|
|
1949
|
-
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
1950
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
1951
|
-
function isPrincipal(login, principalAllowlist) {
|
|
1952
|
-
if (login === null)
|
|
1953
|
-
return false;
|
|
1954
|
-
const normalized = login.toLowerCase();
|
|
1955
|
-
return principalAllowlist.some((p) => p.toLowerCase() === normalized);
|
|
1956
|
-
}
|
|
1957
|
-
function isWaiverLabelActorVerified(opts) {
|
|
1958
|
-
if (!opts.labels.includes(opts.label))
|
|
1959
|
-
return false;
|
|
1960
|
-
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
2146
|
// ../../packages/aeg-core/src/doc-owners.ts
|
|
1964
2147
|
var DOC_OWNERS_PATH = ".vinaya/doc-owners";
|
|
1965
2148
|
function parseDocOwners(content) {
|
|
@@ -2144,7 +2327,7 @@ function overrideActive(opts) {
|
|
|
2144
2327
|
return false;
|
|
2145
2328
|
}
|
|
2146
2329
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
2147
|
-
import { createHash } from "node:crypto";
|
|
2330
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
2148
2331
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
2149
2332
|
function isPremiseHeader(line) {
|
|
2150
2333
|
const stripped = line.replace(/[*#]/g, "").trim();
|
|
@@ -2176,6 +2359,32 @@ function parsePremiseBlock(prBody) {
|
|
|
2176
2359
|
}
|
|
2177
2360
|
return assertions;
|
|
2178
2361
|
}
|
|
2362
|
+
function premiseBlockText(prBody) {
|
|
2363
|
+
const searchIn = anchoredRegion(prBody, "PREMISE") ?? prBody;
|
|
2364
|
+
const lines = searchIn.split(/\r?\n/);
|
|
2365
|
+
let startIdx = -1;
|
|
2366
|
+
let endIdxExclusive = lines.length;
|
|
2367
|
+
for (let i = 0;i < lines.length; i++) {
|
|
2368
|
+
const line = lines[i].trim();
|
|
2369
|
+
if (startIdx === -1) {
|
|
2370
|
+
if (isPremiseHeader(line))
|
|
2371
|
+
startIdx = i;
|
|
2372
|
+
continue;
|
|
2373
|
+
}
|
|
2374
|
+
if (line === "") {
|
|
2375
|
+
endIdxExclusive = i;
|
|
2376
|
+
break;
|
|
2377
|
+
}
|
|
2378
|
+
if (!PREMISE_LINE.test(line)) {
|
|
2379
|
+
endIdxExclusive = i;
|
|
2380
|
+
break;
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
if (startIdx === -1)
|
|
2384
|
+
return null;
|
|
2385
|
+
return lines.slice(startIdx, endIdxExclusive).join(`
|
|
2386
|
+
`);
|
|
2387
|
+
}
|
|
2179
2388
|
function checkPremises(assertions, fileReader) {
|
|
2180
2389
|
const failures = [];
|
|
2181
2390
|
for (const a of assertions) {
|
|
@@ -2189,7 +2398,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
2189
2398
|
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2190
2399
|
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2191
2400
|
} else if (a.kind === "sha256") {
|
|
2192
|
-
const actual =
|
|
2401
|
+
const actual = createHash2("sha256").update(content).digest("hex");
|
|
2193
2402
|
if (actual !== a.value.toLowerCase()) {
|
|
2194
2403
|
failures.push(`premise-check: ${a.path} sha256 mismatch (brief pinned ${a.value}, file is now ${actual}) — the file changed since this brief was authored; re-dig before proceeding.`);
|
|
2195
2404
|
}
|
|
@@ -2262,15 +2471,18 @@ function testPlanRegion(prBody) {
|
|
|
2262
2471
|
return located.found ? located.section : prBody;
|
|
2263
2472
|
}
|
|
2264
2473
|
function checkTestPlan(prBody) {
|
|
2265
|
-
const
|
|
2474
|
+
const located = locateTestPlanSection(prBody);
|
|
2475
|
+
const region = located.found ? located.section : prBody;
|
|
2266
2476
|
if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
|
|
2267
2477
|
return { status: "pass", errors: [] };
|
|
2268
2478
|
if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
|
|
2269
2479
|
return { status: "pass", errors: [] };
|
|
2480
|
+
if (located.found && extractFencedBlocks(region).length > 0)
|
|
2481
|
+
return { status: "pass", errors: [] };
|
|
2270
2482
|
return {
|
|
2271
2483
|
status: "fail",
|
|
2272
2484
|
errors: [
|
|
2273
|
-
"brief-validation Test Plan: no Test Plan section found — expected `Test Plan: unit-tests-only`, or at least one `**[agent]**`/`**[principal]**`-tagged checklist item."
|
|
2485
|
+
"brief-validation Test Plan: no Test Plan section found — expected `Test Plan: unit-tests-only`, a fenced `[agent]` command list, or at least one `**[agent]**`/`**[principal]**`-tagged checklist item."
|
|
2274
2486
|
]
|
|
2275
2487
|
};
|
|
2276
2488
|
}
|
|
@@ -2393,8 +2605,162 @@ function isBriefShaped(prBody) {
|
|
|
2393
2605
|
const stripped = stripCode(prBody);
|
|
2394
2606
|
return BRIEF_SHAPE_MARKERS.filter((check) => check(stripped).status === "pass").length >= 2;
|
|
2395
2607
|
}
|
|
2608
|
+
var COMMAND_WORDS = ["export", "bun", "gh", "git", "grep", "sed", "cat", "diff", "vinaya"];
|
|
2609
|
+
var BRIEF_RULES_SINCE_PR = 394;
|
|
2610
|
+
var AGENT_BOXES_REFUSED_SINCE_PR = 396;
|
|
2611
|
+
var AGENT_BOX_LINE_RE = /^-\s*\[[ xX]\]\s*\*{2}\[agent\]\*{2}/im;
|
|
2612
|
+
function checkNoAgentBoxes(prBody) {
|
|
2613
|
+
const region = testPlanRegion(prBody);
|
|
2614
|
+
if (!AGENT_BOX_LINE_RE.test(region))
|
|
2615
|
+
return { status: "pass", errors: [] };
|
|
2616
|
+
return {
|
|
2617
|
+
status: "fail",
|
|
2618
|
+
errors: [
|
|
2619
|
+
"brief-validation no agent boxes: the Test Plan carries a checkbox `[agent]` item — an agent never ticks a box or edits a PR body (Principal ruling, 2026-09-03, after PR #395). Render the `[agent]` half as a fenced command list instead; `vinaya pr report` runs each command from the PR head and writes its actual output into the AEG:EVIDENCE block. `[principal]` checkboxes are unaffected."
|
|
2620
|
+
]
|
|
2621
|
+
};
|
|
2622
|
+
}
|
|
2623
|
+
function rolloutThresholdFor(message) {
|
|
2624
|
+
if (message.startsWith("brief-validation unpinned code claim:") || message.startsWith("brief-validation commands carry output:") || message.startsWith("brief-validation consumer tests:") || message.startsWith("brief-validation defeat cases:")) {
|
|
2625
|
+
return BRIEF_RULES_SINCE_PR;
|
|
2626
|
+
}
|
|
2627
|
+
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2628
|
+
return AGENT_BOXES_REFUSED_SINCE_PR;
|
|
2629
|
+
return null;
|
|
2630
|
+
}
|
|
2631
|
+
function partitionBriefErrorsByRollout(errors, prNumber) {
|
|
2632
|
+
const blocking = [];
|
|
2633
|
+
const info = [];
|
|
2634
|
+
for (const e of errors) {
|
|
2635
|
+
const threshold = rolloutThresholdFor(e);
|
|
2636
|
+
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2637
|
+
(grandfathered ? info : blocking).push(e);
|
|
2638
|
+
}
|
|
2639
|
+
return { blocking, info };
|
|
2640
|
+
}
|
|
2641
|
+
function extractFencedBlocks(text) {
|
|
2642
|
+
const re = /^[ \t]*(`{3,}|~{3,})([^\n]*)\n([\s\S]*?)^[ \t]*\1[ \t]*$/gm;
|
|
2643
|
+
const blocks = [];
|
|
2644
|
+
let m = re.exec(text);
|
|
2645
|
+
while (m !== null) {
|
|
2646
|
+
const lang = m[2].trim().toLowerCase().split(/\s+/)[0] ?? "";
|
|
2647
|
+
blocks.push({ start: m.index, end: m.index + m[0].length, lang, content: m[3] });
|
|
2648
|
+
m = re.exec(text);
|
|
2649
|
+
}
|
|
2650
|
+
return blocks;
|
|
2651
|
+
}
|
|
2652
|
+
function firstNonBlankLine(text) {
|
|
2653
|
+
const line = text.split(`
|
|
2654
|
+
`).find((l) => l.trim().length > 0);
|
|
2655
|
+
return line?.trim() ?? "";
|
|
2656
|
+
}
|
|
2657
|
+
var FILE_LINE_RE = /\b[\w./-]+\.(?:tsx?|jsx?|mjs|cjs|md|mdx|json|ya?ml|sh|py|toml):\d+\b/g;
|
|
2658
|
+
function checkNoUnpinnedCodeClaims(prBody) {
|
|
2659
|
+
const premiseText = premiseBlockText(prBody);
|
|
2660
|
+
const withoutPremise = premiseText ? prBody.replace(premiseText, "") : prBody;
|
|
2661
|
+
const scanned = stripCode(withoutPremise, { inlineSpans: "keep" });
|
|
2662
|
+
const matches = scanned.match(FILE_LINE_RE) ?? [];
|
|
2663
|
+
if (matches.length === 0)
|
|
2664
|
+
return { status: "pass", errors: [] };
|
|
2665
|
+
return {
|
|
2666
|
+
status: "fail",
|
|
2667
|
+
errors: matches.map((m) => `brief-validation unpinned code claim: "${m}" states a code fact by file-and-line reference outside a \`Premise:\` pin and outside a fenced code block — pin it in \`Premise:\`, or show the executed command and its output instead.`)
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
function extractNumberedSection(prBody, num) {
|
|
2671
|
+
const startRe = new RegExp(`^#{1,4}\\s*(?:\\*\\*)?${num}[a-z]?\\.\\s`, "im");
|
|
2672
|
+
const start = startRe.exec(prBody);
|
|
2673
|
+
if (!start)
|
|
2674
|
+
return null;
|
|
2675
|
+
const afterStart = start.index + start[0].length;
|
|
2676
|
+
const rest = prBody.slice(afterStart);
|
|
2677
|
+
const next = /^#{1,4}\s/m.exec(rest);
|
|
2678
|
+
return next ? rest.slice(0, next.index) : rest;
|
|
2679
|
+
}
|
|
2680
|
+
function commandWordOf(line) {
|
|
2681
|
+
return line.trim().split(/\s+/)[0] ?? "";
|
|
2682
|
+
}
|
|
2683
|
+
function isCommandBlock(content) {
|
|
2684
|
+
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
2685
|
+
}
|
|
2686
|
+
function isStep0Block(content) {
|
|
2687
|
+
return firstNonBlankLine(content).startsWith("git worktree add");
|
|
2688
|
+
}
|
|
2689
|
+
function checkCommandsCarryOutput(prBody) {
|
|
2690
|
+
const errors = [];
|
|
2691
|
+
for (const [label2, num] of [
|
|
2692
|
+
["5", 5],
|
|
2693
|
+
["6", 6]
|
|
2694
|
+
]) {
|
|
2695
|
+
const section = extractNumberedSection(prBody, num);
|
|
2696
|
+
if (!section)
|
|
2697
|
+
continue;
|
|
2698
|
+
const blocks = extractFencedBlocks(section);
|
|
2699
|
+
for (let i = 0;i < blocks.length; i++) {
|
|
2700
|
+
const block = blocks[i];
|
|
2701
|
+
if (isStep0Block(block.content) || !isCommandBlock(block.content))
|
|
2702
|
+
continue;
|
|
2703
|
+
const next = blocks[i + 1];
|
|
2704
|
+
if (!next || isCommandBlock(next.content)) {
|
|
2705
|
+
errors.push(`brief-validation commands carry output: §${label2} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
return errors.length === 0 ? { status: "pass", errors: [] } : { status: "fail", errors };
|
|
2710
|
+
}
|
|
2711
|
+
var CONSUMER_TESTS_SENTINEL_RE = /consumer-tests\s*:\s*none\s*[-—–]\s*\S/i;
|
|
2712
|
+
function packagesNamedIn(text) {
|
|
2713
|
+
const re = /\bpackages\/([A-Za-z0-9_-]+)\//g;
|
|
2714
|
+
const pkgs = new Set;
|
|
2715
|
+
let m = re.exec(text);
|
|
2716
|
+
while (m !== null) {
|
|
2717
|
+
pkgs.add(m[1]);
|
|
2718
|
+
m = re.exec(text);
|
|
2719
|
+
}
|
|
2720
|
+
return [...pkgs];
|
|
2721
|
+
}
|
|
2722
|
+
function hasTestPathForConsumer(text, consumerDir) {
|
|
2723
|
+
const escaped = consumerDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2724
|
+
const re = new RegExp(`${escaped}\\/[\\w./-]*\\.test\\.[A-Za-z0-9]+`);
|
|
2725
|
+
return re.test(text);
|
|
2726
|
+
}
|
|
2727
|
+
function checkConsumerTests(prBody, consumersOf) {
|
|
2728
|
+
const section4 = extractNumberedSection(prBody, 4);
|
|
2729
|
+
if (!section4)
|
|
2730
|
+
return { status: "pass", errors: [] };
|
|
2731
|
+
if (CONSUMER_TESTS_SENTINEL_RE.test(section4))
|
|
2732
|
+
return { status: "pass", errors: [] };
|
|
2733
|
+
const errors = [];
|
|
2734
|
+
for (const pkg of packagesNamedIn(section4)) {
|
|
2735
|
+
for (const consumerDir of consumersOf(pkg)) {
|
|
2736
|
+
if (hasTestPathForConsumer(section4, consumerDir))
|
|
2737
|
+
continue;
|
|
2738
|
+
errors.push(`brief-validation consumer tests: §4 names a path under packages/${pkg}/, and ${consumerDir} depends on @attalabs/${pkg}, but no test path under ${consumerDir} is named in §4 — name one, or add \`consumer-tests: none — <reason>\`.`);
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
return errors.length === 0 ? { status: "pass", errors: [] } : { status: "fail", errors };
|
|
2742
|
+
}
|
|
2743
|
+
var CHECK_NAME_RE = /\bcheck-[a-z0-9-]+(?:\.ts)?\b/;
|
|
2744
|
+
var FORGE_WRITE_COMMAND_RE = /\bgh\s+(?:pr|issue)\s+(?:create|merge|close|comment|edit|review)\b|\bgit\s+push\b|\bvinaya\s+pr\s+(?:create|report\s+--write)\b/i;
|
|
2745
|
+
var DEFEAT_CASES_RE = /defeat cases\s*:/i;
|
|
2746
|
+
function checkDefeatCases(prBody) {
|
|
2747
|
+
const section4 = extractNumberedSection(prBody, 4);
|
|
2748
|
+
if (!section4)
|
|
2749
|
+
return { status: "pass", errors: [] };
|
|
2750
|
+
if (!CHECK_NAME_RE.test(section4) && !FORGE_WRITE_COMMAND_RE.test(section4))
|
|
2751
|
+
return { status: "pass", errors: [] };
|
|
2752
|
+
const section6 = extractNumberedSection(prBody, 6) ?? "";
|
|
2753
|
+
if (DEFEAT_CASES_RE.test(section6))
|
|
2754
|
+
return { status: "pass", errors: [] };
|
|
2755
|
+
return {
|
|
2756
|
+
status: "fail",
|
|
2757
|
+
errors: [
|
|
2758
|
+
"brief-validation defeat cases: §4 names a check or a forge-writing command, but §6 carries no `Defeat cases:` line — name the inputs that would defeat this check, or that this command must not accidentally trigger on."
|
|
2759
|
+
]
|
|
2760
|
+
};
|
|
2761
|
+
}
|
|
2396
2762
|
function checkBriefSections(prBody, readTier, options = {}) {
|
|
2397
|
-
const { requireClosesN = true } = options;
|
|
2763
|
+
const { requireClosesN = true, consumersOf = () => [] } = options;
|
|
2398
2764
|
const results = [
|
|
2399
2765
|
checkTierField(prBody, readTier),
|
|
2400
2766
|
checkTestPlan(prBody),
|
|
@@ -2407,10 +2773,219 @@ function checkBriefSections(prBody, readTier, options = {}) {
|
|
|
2407
2773
|
checkAutonomyClause(prBody),
|
|
2408
2774
|
checkProjectField(prBody),
|
|
2409
2775
|
checkForField(prBody),
|
|
2776
|
+
checkNoUnpinnedCodeClaims(prBody),
|
|
2777
|
+
checkNoAgentBoxes(prBody),
|
|
2778
|
+
checkCommandsCarryOutput(prBody),
|
|
2779
|
+
checkConsumerTests(prBody, consumersOf),
|
|
2780
|
+
checkDefeatCases(prBody),
|
|
2410
2781
|
...requireClosesN ? [checkClosesN(prBody)] : []
|
|
2411
2782
|
];
|
|
2412
2783
|
return { errors: results.flatMap((r) => r.errors) };
|
|
2413
2784
|
}
|
|
2785
|
+
// ../../packages/aeg-core/src/doctrine-portability.ts
|
|
2786
|
+
var DEFAULT_SHIPS_PREFIX = "aeg-root/";
|
|
2787
|
+
var STATIC_PORTABLE_PREFIXES = [
|
|
2788
|
+
"roles/",
|
|
2789
|
+
"contracts/",
|
|
2790
|
+
"skills/",
|
|
2791
|
+
".github/",
|
|
2792
|
+
".vinaya/",
|
|
2793
|
+
".claude/",
|
|
2794
|
+
".git/",
|
|
2795
|
+
".husky/"
|
|
2796
|
+
];
|
|
2797
|
+
var EXEMPT_LITERALS = new Set([
|
|
2798
|
+
"path/inside/the/shipped/diff.ts",
|
|
2799
|
+
"path/inside/the/surface.ts",
|
|
2800
|
+
"apps/x/specs/..."
|
|
2801
|
+
]);
|
|
2802
|
+
var CITED_PATH_PATTERN = /^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]*)+$/;
|
|
2803
|
+
var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"]);
|
|
2804
|
+
var VENDOR_NAME_SOURCE = "\\bclaude code\\b|\\bclaude\\b|\\banthropic\\b|\\bchatgpt\\b|\\bopenai\\b|\\bgpt\\b|\\bgemini\\b|\\bcodex\\b|\\bgrok\\b|\\bdeepseek\\b|\\bopus\\b|\\bsonnet\\b|\\bhaiku\\b";
|
|
2805
|
+
var VENDOR_EXAMPLE_START = /<!--\s*AEG:VENDOR-EXAMPLE:START\s*-->/;
|
|
2806
|
+
var VENDOR_EXAMPLE_END = /<!--\s*AEG:VENDOR-EXAMPLE:END\s*-->/;
|
|
2807
|
+
function maskVendorExampleRegion(masked) {
|
|
2808
|
+
const start = VENDOR_EXAMPLE_START.exec(masked);
|
|
2809
|
+
if (!start)
|
|
2810
|
+
return masked;
|
|
2811
|
+
const afterStart = start.index + start[0].length;
|
|
2812
|
+
const end = VENDOR_EXAMPLE_END.exec(masked.slice(afterStart));
|
|
2813
|
+
if (!end)
|
|
2814
|
+
return masked;
|
|
2815
|
+
const regionEnd = afterStart + end.index + end[0].length;
|
|
2816
|
+
const region = masked.slice(start.index, regionEnd);
|
|
2817
|
+
const blanked = region.replace(/[^\n]/g, " ");
|
|
2818
|
+
return masked.slice(0, start.index) + blanked + masked.slice(regionEnd);
|
|
2819
|
+
}
|
|
2820
|
+
function extractVendorMentions(content) {
|
|
2821
|
+
const scoped = maskVendorExampleRegion(maskCode(content));
|
|
2822
|
+
const found = [];
|
|
2823
|
+
const pattern = new RegExp(VENDOR_NAME_SOURCE, "gi");
|
|
2824
|
+
let match = pattern.exec(scoped);
|
|
2825
|
+
while (match !== null) {
|
|
2826
|
+
found.push({ name: match[0], index: match.index });
|
|
2827
|
+
match = pattern.exec(scoped);
|
|
2828
|
+
}
|
|
2829
|
+
return found;
|
|
2830
|
+
}
|
|
2831
|
+
function extractCitedPaths(content) {
|
|
2832
|
+
const found = [];
|
|
2833
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
2834
|
+
let match = spanPattern.exec(content);
|
|
2835
|
+
while (match !== null) {
|
|
2836
|
+
const cited = match[1] ?? "";
|
|
2837
|
+
const topSegment = cited.slice(0, cited.indexOf("/"));
|
|
2838
|
+
if (CITED_PATH_PATTERN.test(cited) && !NON_PATH_TOP_SEGMENTS.has(topSegment)) {
|
|
2839
|
+
found.push({ cited, index: match.index });
|
|
2840
|
+
}
|
|
2841
|
+
match = spanPattern.exec(content);
|
|
2842
|
+
}
|
|
2843
|
+
return found;
|
|
2844
|
+
}
|
|
2845
|
+
function lineAtIndex(content, index) {
|
|
2846
|
+
let line = 1;
|
|
2847
|
+
for (let i = 0;i < index; i++) {
|
|
2848
|
+
if (content.charCodeAt(i) === 10)
|
|
2849
|
+
line++;
|
|
2850
|
+
}
|
|
2851
|
+
return line;
|
|
2852
|
+
}
|
|
2853
|
+
function isPortable(cited, shipsPrefix) {
|
|
2854
|
+
if (cited.startsWith(shipsPrefix))
|
|
2855
|
+
return true;
|
|
2856
|
+
return STATIC_PORTABLE_PREFIXES.some((prefix) => cited.startsWith(prefix));
|
|
2857
|
+
}
|
|
2858
|
+
function checkDoctrinePortability(files, shipsPrefix = DEFAULT_SHIPS_PREFIX) {
|
|
2859
|
+
const findings = [];
|
|
2860
|
+
for (const file of files) {
|
|
2861
|
+
if (!file.path.startsWith(shipsPrefix))
|
|
2862
|
+
continue;
|
|
2863
|
+
for (const { cited, index } of extractCitedPaths(file.content)) {
|
|
2864
|
+
if (EXEMPT_LITERALS.has(cited))
|
|
2865
|
+
continue;
|
|
2866
|
+
if (isPortable(cited, shipsPrefix))
|
|
2867
|
+
continue;
|
|
2868
|
+
findings.push({
|
|
2869
|
+
file: file.path,
|
|
2870
|
+
line: lineAtIndex(file.content, index),
|
|
2871
|
+
cited,
|
|
2872
|
+
message: `cites "${cited}", a path that only exists in the authoring repository — not portable doctrine`,
|
|
2873
|
+
kind: "path"
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
for (const { name, index } of extractVendorMentions(file.content)) {
|
|
2877
|
+
findings.push({
|
|
2878
|
+
file: file.path,
|
|
2879
|
+
line: lineAtIndex(file.content, index),
|
|
2880
|
+
cited: name,
|
|
2881
|
+
message: `names "${name}" outside the one fenced vendor-example home (an <!-- AEG:VENDOR-EXAMPLE:START --> … <!-- AEG:VENDOR-EXAMPLE:END --> pair) — portable doctrine refers to a host generically everywhere else`,
|
|
2882
|
+
kind: "vendor-name"
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return findings;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
// ../../packages/aeg-core/src/doctrine-no-procedures.ts
|
|
2890
|
+
function vendorExampleSpan(content) {
|
|
2891
|
+
const start = VENDOR_EXAMPLE_START.exec(content);
|
|
2892
|
+
if (!start)
|
|
2893
|
+
return null;
|
|
2894
|
+
const afterStart = start.index + start[0].length;
|
|
2895
|
+
const end = VENDOR_EXAMPLE_END.exec(content.slice(afterStart));
|
|
2896
|
+
if (!end)
|
|
2897
|
+
return null;
|
|
2898
|
+
return { start: start.index, end: afterStart + end.index + end[0].length };
|
|
2899
|
+
}
|
|
2900
|
+
function isCommandLine(line) {
|
|
2901
|
+
const word = line.trim().split(/\s+/)[0] ?? "";
|
|
2902
|
+
return COMMAND_WORDS.includes(word);
|
|
2903
|
+
}
|
|
2904
|
+
var SHELL_LANGS = new Set(["", "sh", "bash", "shell", "console"]);
|
|
2905
|
+
function procedureLineNumberAt(content, index) {
|
|
2906
|
+
return content.slice(0, index).split(`
|
|
2907
|
+
`).length;
|
|
2908
|
+
}
|
|
2909
|
+
function isTemplatePath(path) {
|
|
2910
|
+
return /(^|\/)templates\//.test(path);
|
|
2911
|
+
}
|
|
2912
|
+
function checkDoctrineNoProcedures(files) {
|
|
2913
|
+
const findings = [];
|
|
2914
|
+
for (const file of files) {
|
|
2915
|
+
if (isTemplatePath(file.path))
|
|
2916
|
+
continue;
|
|
2917
|
+
const span = vendorExampleSpan(file.content);
|
|
2918
|
+
for (const block of extractFencedBlocks(file.content)) {
|
|
2919
|
+
if (span && block.start >= span.start && block.end <= span.end)
|
|
2920
|
+
continue;
|
|
2921
|
+
if (!SHELL_LANGS.has(block.lang))
|
|
2922
|
+
continue;
|
|
2923
|
+
const commandLineCount = block.content.split(`
|
|
2924
|
+
`).filter(isCommandLine).length;
|
|
2925
|
+
if (commandLineCount >= 2) {
|
|
2926
|
+
findings.push({
|
|
2927
|
+
file: file.path,
|
|
2928
|
+
line: procedureLineNumberAt(file.content, block.start),
|
|
2929
|
+
message: `this fenced block has ${commandLineCount} shell-command lines — this sequence is a \`vinaya\` command, name it (or move it inside the \`AEG:VENDOR-EXAMPLE\` anchor / a \`templates/\` file).`
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
return findings;
|
|
2935
|
+
}
|
|
2936
|
+
// ../../packages/aeg-core/src/pr-report-density.ts
|
|
2937
|
+
function headingSectionBody(prBody, heading) {
|
|
2938
|
+
const headingRe = new RegExp(`^##\\s+${heading}\\s*$`, "im");
|
|
2939
|
+
const m = headingRe.exec(prBody);
|
|
2940
|
+
if (!m)
|
|
2941
|
+
return null;
|
|
2942
|
+
const start = m.index + m[0].length;
|
|
2943
|
+
const rest = prBody.slice(start);
|
|
2944
|
+
const nextHeading = /^#{1,2}\s/m.exec(rest);
|
|
2945
|
+
return nextHeading ? rest.slice(0, nextHeading.index) : rest;
|
|
2946
|
+
}
|
|
2947
|
+
function stripAnchorBlocks(sectionText) {
|
|
2948
|
+
let result = sectionText;
|
|
2949
|
+
for (const field of ["CLOSES", "PROJECT", "TIER", "PREMISE", "TEST-PLAN", "EVIDENCE"]) {
|
|
2950
|
+
for (;; ) {
|
|
2951
|
+
const bounds = anchoredRegionBounds(result, field);
|
|
2952
|
+
if (!bounds)
|
|
2953
|
+
break;
|
|
2954
|
+
result = result.slice(0, bounds.outerStart) + result.slice(bounds.outerEnd);
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
return result;
|
|
2958
|
+
}
|
|
2959
|
+
function paragraphCount(sectionText) {
|
|
2960
|
+
const stripped = stripCode(stripAnchorBlocks(sectionText)).trim();
|
|
2961
|
+
if (stripped.length === 0)
|
|
2962
|
+
return 0;
|
|
2963
|
+
return stripped.split(/\n[ \t]*\n/).map((block) => block.trim()).filter((block) => block.length > 0).length;
|
|
2964
|
+
}
|
|
2965
|
+
function checkSectionDensity(prBody, heading) {
|
|
2966
|
+
const body = headingSectionBody(prBody, heading);
|
|
2967
|
+
if (body === null)
|
|
2968
|
+
return { status: "pass", errors: [] };
|
|
2969
|
+
const count = paragraphCount(body);
|
|
2970
|
+
if (count <= 1)
|
|
2971
|
+
return { status: "pass", errors: [] };
|
|
2972
|
+
return {
|
|
2973
|
+
status: "fail",
|
|
2974
|
+
errors: [
|
|
2975
|
+
`pr-report-density ${heading}: "## ${heading}" holds ${count} paragraphs — the canonical PR-report form (aeg-root/roles/developer.md § PR body) requires exactly one. Collapse it to one paragraph; move the rest into a section of your own below the canonical four ("Add anything you want beneath the four sections", developer.md), a commit message, or the changeset — never into the AEG:EVIDENCE block, which is emitted only, never hand-typed.`
|
|
2976
|
+
]
|
|
2977
|
+
};
|
|
2978
|
+
}
|
|
2979
|
+
function checkSummaryDensity(prBody) {
|
|
2980
|
+
return checkSectionDensity(prBody, "Summary");
|
|
2981
|
+
}
|
|
2982
|
+
function checkScopeDensity(prBody) {
|
|
2983
|
+
return checkSectionDensity(prBody, "Scope");
|
|
2984
|
+
}
|
|
2985
|
+
function checkPrReportDensity(prBody) {
|
|
2986
|
+
const results = [checkSummaryDensity(prBody), checkScopeDensity(prBody)];
|
|
2987
|
+
return { errors: results.flatMap((r) => r.errors) };
|
|
2988
|
+
}
|
|
2414
2989
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
2415
2990
|
function hasRationaleField(body, labelPattern) {
|
|
2416
2991
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -2662,6 +3237,17 @@ function checkD1(entries, issueToEntry, taskToEntry) {
|
|
|
2662
3237
|
const depEntry = resolveDepEntry(dep, e.trancheSlug, issueToEntry, taskToEntry);
|
|
2663
3238
|
if (!depEntry)
|
|
2664
3239
|
continue;
|
|
3240
|
+
const sameTask = depEntry.trancheSlug === e.trancheSlug && depEntry.task.id === e.task.id;
|
|
3241
|
+
const sameIssue = depEntry.task.issue !== null && e.task.issue !== null && depEntry.task.issue === e.task.issue;
|
|
3242
|
+
if (sameTask || sameIssue) {
|
|
3243
|
+
failures.push({
|
|
3244
|
+
issue: e.task.issue,
|
|
3245
|
+
tranche: e.trancheSlug,
|
|
3246
|
+
task: e.task.id,
|
|
3247
|
+
reason: `INTERNAL: parsed a self-dependency (depends-on ${dep}) — this is a parser bug in parseRationaleDeps, not a real dependency. Please report it upstream.`
|
|
3248
|
+
});
|
|
3249
|
+
continue;
|
|
3250
|
+
}
|
|
2665
3251
|
const depFacts = depEntry.facts;
|
|
2666
3252
|
const depClosed = depFacts?.issueState === "closed";
|
|
2667
3253
|
if (!depClosed) {
|
|
@@ -2805,41 +3391,24 @@ function checkClosesN2(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
2805
3391
|
}
|
|
2806
3392
|
return { ok: true, expectedIssue };
|
|
2807
3393
|
}
|
|
2808
|
-
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2809
|
-
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2810
|
-
function extractHeadSha(comment) {
|
|
2811
|
-
const m = comment.match(HEAD_SHA_PATTERN);
|
|
2812
|
-
return m ? m[1].toLowerCase() : null;
|
|
2813
|
-
}
|
|
2814
|
-
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
2815
|
-
const clearHits = comments.filter((c) => valuePattern.test(c));
|
|
2816
|
-
if (clearHits.length > 0) {
|
|
2817
|
-
const latest = clearHits[clearHits.length - 1];
|
|
2818
|
-
const m = latest.match(valuePattern);
|
|
2819
|
-
return {
|
|
2820
|
-
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
2821
|
-
headSha: extractHeadSha(latest),
|
|
2822
|
-
danglingNote: null
|
|
2823
|
-
};
|
|
2824
|
-
}
|
|
2825
|
-
return {
|
|
2826
|
-
value: `no ${missingLabel} pass was run before merge — DANGLING, see below`,
|
|
2827
|
-
headSha: null,
|
|
2828
|
-
danglingNote: `no ${missingLabel} verdict comment found on this PR`
|
|
2829
|
-
};
|
|
2830
|
-
}
|
|
2831
|
-
function extractCodeReviewVerdict(comments) {
|
|
2832
|
-
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(APPROVE|REQUEST[ _-]?CHANGES|LGTM)(?![A-Za-z0-9])/im, "code-reviewer");
|
|
2833
|
-
}
|
|
2834
|
-
function extractSecurityReviewVerdict(comments) {
|
|
2835
|
-
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
2836
|
-
}
|
|
2837
3394
|
// ../../packages/aeg-core/src/review-gate.ts
|
|
2838
3395
|
function isBoundToHead(extraction, headSha) {
|
|
2839
3396
|
if (!extraction.headSha)
|
|
2840
3397
|
return false;
|
|
2841
3398
|
return headSha.toLowerCase().startsWith(extraction.headSha.toLowerCase());
|
|
2842
3399
|
}
|
|
3400
|
+
function isBoundByPatchIdentity(extraction, headSha, patchIdOf) {
|
|
3401
|
+
if (patchIdOf === undefined || !extraction.headSha)
|
|
3402
|
+
return false;
|
|
3403
|
+
const judged = patchIdOf(extraction.headSha);
|
|
3404
|
+
const current = patchIdOf(headSha);
|
|
3405
|
+
if (judged === null || current === null)
|
|
3406
|
+
return false;
|
|
3407
|
+
return judged === current;
|
|
3408
|
+
}
|
|
3409
|
+
function isBoundToPatch(extraction, headSha, patchIdOf) {
|
|
3410
|
+
return isBoundToHead(extraction, headSha) || isBoundByPatchIdentity(extraction, headSha, patchIdOf);
|
|
3411
|
+
}
|
|
2843
3412
|
function checkReviewGate(input) {
|
|
2844
3413
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
2845
3414
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -2855,6 +3424,8 @@ function checkReviewGate(input) {
|
|
|
2855
3424
|
waived: true
|
|
2856
3425
|
};
|
|
2857
3426
|
}
|
|
3427
|
+
const reportedMechanicalChecks = input.mechanicalChecks.filter((c) => c.bucket !== "skipping" && c.bucket !== "neutral");
|
|
3428
|
+
const mechanicalChecksClean = reportedMechanicalChecks.length > 0 && reportedMechanicalChecks.every((c) => c.bucket === "pass");
|
|
2858
3429
|
const verified = input.comments.filter((c) => isPrincipal(c.author, principalAllowlist));
|
|
2859
3430
|
const ignoredCount = input.comments.filter((c) => !isPrincipal(c.author, principalAllowlist) && c.body.includes("VERDICT")).length;
|
|
2860
3431
|
const verifiedBodies = verified.map((c) => c.body);
|
|
@@ -2862,12 +3433,12 @@ function checkReviewGate(input) {
|
|
|
2862
3433
|
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
2863
3434
|
const codeReviewClean = codeReview.value === "APPROVE";
|
|
2864
3435
|
const securityClean = security.value === "PASS";
|
|
2865
|
-
const codeReviewBound =
|
|
2866
|
-
const securityBound =
|
|
2867
|
-
if (codeReviewClean && codeReviewBound && securityClean && securityBound) {
|
|
3436
|
+
const codeReviewBound = isBoundToPatch(codeReview, input.headSha, input.patchIdOf);
|
|
3437
|
+
const securityBound = isBoundToPatch(security, input.headSha, input.patchIdOf);
|
|
3438
|
+
if (codeReviewClean && codeReviewBound && securityClean && securityBound && mechanicalChecksClean) {
|
|
2868
3439
|
return {
|
|
2869
3440
|
verdict: "pass",
|
|
2870
|
-
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.`,
|
|
3441
|
+
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}, and every reported mechanical check is green.`,
|
|
2871
3442
|
waived: false
|
|
2872
3443
|
};
|
|
2873
3444
|
}
|
|
@@ -2882,6 +3453,9 @@ function checkReviewGate(input) {
|
|
|
2882
3453
|
} else if (!securityBound) {
|
|
2883
3454
|
problems.push(`the newest security-review verdict covers ${security.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
2884
3455
|
}
|
|
3456
|
+
if (!mechanicalChecksClean) {
|
|
3457
|
+
problems.push(reportedMechanicalChecks.length === 0 ? "no mechanical checks have reported for this head yet" : `mechanical check(s) not green: ${reportedMechanicalChecks.filter((c) => c.bucket !== "pass").map((c) => `${c.name} (${c.bucket})`).join(", ")}`);
|
|
3458
|
+
}
|
|
2885
3459
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
2886
3460
|
return {
|
|
2887
3461
|
verdict: "fail",
|
|
@@ -3161,72 +3735,6 @@ function compareToBaseline(current, baseline) {
|
|
|
3161
3735
|
perTool
|
|
3162
3736
|
};
|
|
3163
3737
|
}
|
|
3164
|
-
// ../../packages/aeg-core/src/doctrine-portability.ts
|
|
3165
|
-
var DEFAULT_SHIPS_PREFIX = "aeg-root/";
|
|
3166
|
-
var STATIC_PORTABLE_PREFIXES = [
|
|
3167
|
-
"roles/",
|
|
3168
|
-
"contracts/",
|
|
3169
|
-
"skills/",
|
|
3170
|
-
".github/",
|
|
3171
|
-
".vinaya/",
|
|
3172
|
-
".claude/",
|
|
3173
|
-
".git/",
|
|
3174
|
-
".husky/"
|
|
3175
|
-
];
|
|
3176
|
-
var EXEMPT_LITERALS = new Set([
|
|
3177
|
-
"path/inside/the/shipped/diff.ts",
|
|
3178
|
-
"path/inside/the/surface.ts",
|
|
3179
|
-
"apps/x/specs/..."
|
|
3180
|
-
]);
|
|
3181
|
-
var CITED_PATH_PATTERN = /^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]*)+$/;
|
|
3182
|
-
var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"]);
|
|
3183
|
-
function extractCitedPaths(content) {
|
|
3184
|
-
const found = [];
|
|
3185
|
-
const spanPattern = /`([^`\n]+)`/g;
|
|
3186
|
-
let match = spanPattern.exec(content);
|
|
3187
|
-
while (match !== null) {
|
|
3188
|
-
const cited = match[1] ?? "";
|
|
3189
|
-
const topSegment = cited.slice(0, cited.indexOf("/"));
|
|
3190
|
-
if (CITED_PATH_PATTERN.test(cited) && !NON_PATH_TOP_SEGMENTS.has(topSegment)) {
|
|
3191
|
-
found.push({ cited, index: match.index });
|
|
3192
|
-
}
|
|
3193
|
-
match = spanPattern.exec(content);
|
|
3194
|
-
}
|
|
3195
|
-
return found;
|
|
3196
|
-
}
|
|
3197
|
-
function lineAtIndex(content, index) {
|
|
3198
|
-
let line = 1;
|
|
3199
|
-
for (let i = 0;i < index; i++) {
|
|
3200
|
-
if (content.charCodeAt(i) === 10)
|
|
3201
|
-
line++;
|
|
3202
|
-
}
|
|
3203
|
-
return line;
|
|
3204
|
-
}
|
|
3205
|
-
function isPortable(cited, shipsPrefix) {
|
|
3206
|
-
if (cited.startsWith(shipsPrefix))
|
|
3207
|
-
return true;
|
|
3208
|
-
return STATIC_PORTABLE_PREFIXES.some((prefix) => cited.startsWith(prefix));
|
|
3209
|
-
}
|
|
3210
|
-
function checkDoctrinePortability(files, shipsPrefix = DEFAULT_SHIPS_PREFIX) {
|
|
3211
|
-
const findings = [];
|
|
3212
|
-
for (const file of files) {
|
|
3213
|
-
if (!file.path.startsWith(shipsPrefix))
|
|
3214
|
-
continue;
|
|
3215
|
-
for (const { cited, index } of extractCitedPaths(file.content)) {
|
|
3216
|
-
if (EXEMPT_LITERALS.has(cited))
|
|
3217
|
-
continue;
|
|
3218
|
-
if (isPortable(cited, shipsPrefix))
|
|
3219
|
-
continue;
|
|
3220
|
-
findings.push({
|
|
3221
|
-
file: file.path,
|
|
3222
|
-
line: lineAtIndex(file.content, index),
|
|
3223
|
-
cited,
|
|
3224
|
-
message: `cites "${cited}", a path that only exists in the authoring repository — not portable doctrine`
|
|
3225
|
-
});
|
|
3226
|
-
}
|
|
3227
|
-
}
|
|
3228
|
-
return findings;
|
|
3229
|
-
}
|
|
3230
3738
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3231
3739
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3232
3740
|
function shipsArchivePrefix(shipsPrefix) {
|
|
@@ -3562,6 +4070,12 @@ function scanRetiredVocabulary(files) {
|
|
|
3562
4070
|
function isHandClosedByRecognizedPrincipal(dep, principalAllowlist) {
|
|
3563
4071
|
return dep.issueState === "closed" && dep.stateReason === "completed" && isPrincipal(dep.closedByActor ?? null, principalAllowlist);
|
|
3564
4072
|
}
|
|
4073
|
+
function isSelfDependency(dep, task, issue) {
|
|
4074
|
+
if (dep.issue !== null && issue !== null && dep.issue === issue.number)
|
|
4075
|
+
return true;
|
|
4076
|
+
const bare = dep.id.trim().replace(/^#/, "");
|
|
4077
|
+
return bare.toLowerCase() === task.id.trim().toLowerCase();
|
|
4078
|
+
}
|
|
3565
4079
|
function checkDispatchReadiness(input) {
|
|
3566
4080
|
const { trancheSlug, task } = input;
|
|
3567
4081
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
@@ -3576,6 +4090,11 @@ function checkDispatchReadiness(input) {
|
|
|
3576
4090
|
blockers.push(`dispatch-gate rationale: Issue #${input.issue.number} for ${taskLabel} fails the rationale gate (checkIssueRationale) — the Planner must complete the eight-field rationale before this task is dispatchable.`);
|
|
3577
4091
|
}
|
|
3578
4092
|
for (const dep of input.dependsOn) {
|
|
4093
|
+
if (isSelfDependency(dep, task, input.issue)) {
|
|
4094
|
+
const issueStr = input.issue !== null ? `#${input.issue.number}` : "?";
|
|
4095
|
+
blockers.push(`dispatch-gate INTERNAL: parsed a self-dependency for task ${task.id} (${issueStr}) — this is a parser bug in parseRationaleDeps, not a real dependency. Please report it upstream. Re-run once the rationale is corrected or the fix ships.`);
|
|
4096
|
+
continue;
|
|
4097
|
+
}
|
|
3579
4098
|
if (dep.resolved === false) {
|
|
3580
4099
|
blockers.push(`dispatch-gate depends-on: ${taskLabel} depends on "${dep.id}", which is UNRESOLVABLE — the resolver could not find a matching tranche/task/Issue for this edge (not a claim about merge status). Not dispatchable until the edge is corrected.`);
|
|
3581
4100
|
continue;
|
|
@@ -3815,27 +4334,27 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
3815
4334
|
};
|
|
3816
4335
|
}
|
|
3817
4336
|
const checkboxLines = section.split(`
|
|
3818
|
-
`).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]
|
|
4337
|
+
`).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line));
|
|
3819
4338
|
if (checkboxLines.length === 0) {
|
|
3820
4339
|
return {
|
|
3821
4340
|
verdict: "pass",
|
|
3822
4341
|
messages: [
|
|
3823
|
-
"Test Plan section found but has no checkbox items.",
|
|
4342
|
+
"Test Plan section found but has no `[principal]` checkbox items.",
|
|
3824
4343
|
"PASS (advisory) — the section may be empty or expressed in prose; verification is the Principal's call."
|
|
3825
4344
|
]
|
|
3826
4345
|
};
|
|
3827
4346
|
}
|
|
3828
4347
|
const unchecked = checkboxLines.filter((line) => /^[-*]\s+\[\s\]/.test(line));
|
|
3829
4348
|
const checked = checkboxLines.filter((line) => /^[-*]\s+\[[xX]\]/.test(line));
|
|
3830
|
-
const messages = [`Test Plan items: ${checked.length} ticked, ${unchecked.length} unticked.`];
|
|
4349
|
+
const messages = [`Test Plan [principal] items: ${checked.length} ticked, ${unchecked.length} unticked.`];
|
|
3831
4350
|
if (unchecked.length > 0) {
|
|
3832
|
-
messages.push("", "FAIL — the following Test Plan items are unticked:");
|
|
4351
|
+
messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
|
|
3833
4352
|
for (const line of unchecked)
|
|
3834
4353
|
messages.push(` ${line}`);
|
|
3835
|
-
messages.push("", "Per aeg-root/roles/developer.md (Verification), a PR is not mergeable while any Test Plan box is unticked.", "
|
|
4354
|
+
messages.push("", "Per aeg-root/roles/developer.md (Verification), a PR is not mergeable while any [principal] Test Plan box is unticked.", "The Principal runs the item in a real signed-in browser and ticks the box.", "Note: editing the PR body does not retrigger most workflows. If your PR body changes do not surface here, push an empty commit to re-run.");
|
|
3836
4355
|
return { verdict: "fail", messages };
|
|
3837
4356
|
}
|
|
3838
|
-
messages.push("All Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
4357
|
+
messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
3839
4358
|
return { verdict: "pass", messages };
|
|
3840
4359
|
}
|
|
3841
4360
|
// ../../packages/aeg-core/src/workspace-escape.ts
|
|
@@ -3917,7 +4436,7 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
3917
4436
|
}
|
|
3918
4437
|
// src/lib/config.ts
|
|
3919
4438
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3920
|
-
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
4439
|
+
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
3921
4440
|
import { homedir } from "node:os";
|
|
3922
4441
|
import { dirname, join, resolve } from "node:path";
|
|
3923
4442
|
import { z } from "zod";
|
|
@@ -4210,7 +4729,7 @@ function loadConfig() {
|
|
|
4210
4729
|
if (!path)
|
|
4211
4730
|
return null;
|
|
4212
4731
|
try {
|
|
4213
|
-
const raw = JSON.parse(
|
|
4732
|
+
const raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
4214
4733
|
return stripGlobalOnlyKeys(VinayaConfigSchema.parse(raw), path);
|
|
4215
4734
|
} catch {
|
|
4216
4735
|
return null;
|
|
@@ -4218,6 +4737,10 @@ function loadConfig() {
|
|
|
4218
4737
|
}
|
|
4219
4738
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
4220
4739
|
|
|
4740
|
+
// src/lib/diff-evidence.ts
|
|
4741
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
4742
|
+
import { join as join2, relative, resolve as resolve2 } from "node:path";
|
|
4743
|
+
|
|
4221
4744
|
// src/checks/contract.ts
|
|
4222
4745
|
var CHECK_SCHEMA_VERSION = 1;
|
|
4223
4746
|
function emitCheckError(error) {
|
|
@@ -4225,13 +4748,132 @@ function emitCheckError(error) {
|
|
|
4225
4748
|
`);
|
|
4226
4749
|
}
|
|
4227
4750
|
|
|
4751
|
+
// src/commands/review-post.ts
|
|
4752
|
+
function parseChangedLineRanges(diffOutput) {
|
|
4753
|
+
const result = {};
|
|
4754
|
+
let currentFile = null;
|
|
4755
|
+
for (const line of diffOutput.split(`
|
|
4756
|
+
`)) {
|
|
4757
|
+
if (line.startsWith("+++ ")) {
|
|
4758
|
+
const path = line.slice(4).trim();
|
|
4759
|
+
currentFile = path === "/dev/null" ? null : path.replace(/^b\//, "");
|
|
4760
|
+
continue;
|
|
4761
|
+
}
|
|
4762
|
+
if (line.startsWith("@@") && currentFile) {
|
|
4763
|
+
const m = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/);
|
|
4764
|
+
if (m) {
|
|
4765
|
+
const start = Number(m[1]);
|
|
4766
|
+
const count = m[2] !== undefined ? Number(m[2]) : 1;
|
|
4767
|
+
if (count > 0) {
|
|
4768
|
+
if (!result[currentFile])
|
|
4769
|
+
result[currentFile] = [];
|
|
4770
|
+
result[currentFile].push([start, start + count - 1]);
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
}
|
|
4775
|
+
return result;
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
// src/lib/diff-evidence.ts
|
|
4779
|
+
function fileDiffAgainst(ref, path) {
|
|
4780
|
+
let out;
|
|
4781
|
+
try {
|
|
4782
|
+
out = execFileSync3("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
4783
|
+
encoding: "utf8",
|
|
4784
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4785
|
+
}).trim();
|
|
4786
|
+
} catch {
|
|
4787
|
+
return null;
|
|
4788
|
+
}
|
|
4789
|
+
return out === "" ? null : out;
|
|
4790
|
+
}
|
|
4791
|
+
function revParse(ref) {
|
|
4792
|
+
try {
|
|
4793
|
+
return execFileSync3("git", ["rev-parse", "--verify", ref], {
|
|
4794
|
+
encoding: "utf8",
|
|
4795
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4796
|
+
}).trim();
|
|
4797
|
+
} catch {
|
|
4798
|
+
return null;
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
function repoRoot() {
|
|
4802
|
+
try {
|
|
4803
|
+
return execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
4804
|
+
encoding: "utf8",
|
|
4805
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4806
|
+
}).trim();
|
|
4807
|
+
} catch {
|
|
4808
|
+
return null;
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
function changedFiles(base) {
|
|
4812
|
+
let out;
|
|
4813
|
+
try {
|
|
4814
|
+
out = execFileSync3("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
4815
|
+
encoding: "utf8",
|
|
4816
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4817
|
+
}).trim();
|
|
4818
|
+
} catch {
|
|
4819
|
+
return null;
|
|
4820
|
+
}
|
|
4821
|
+
return out === "" ? [] : out.split(`
|
|
4822
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
4823
|
+
}
|
|
4824
|
+
function resolveChangedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
4825
|
+
return resolveDiff(base)?.files ?? null;
|
|
4826
|
+
}
|
|
4827
|
+
function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
4828
|
+
const root = repoRoot();
|
|
4829
|
+
if (root === null)
|
|
4830
|
+
return null;
|
|
4831
|
+
const head = revParse("HEAD");
|
|
4832
|
+
for (const ref of [base, "main"]) {
|
|
4833
|
+
const resolved = revParse(ref);
|
|
4834
|
+
if (resolved === null || resolved === head)
|
|
4835
|
+
continue;
|
|
4836
|
+
const relPaths = changedFiles(ref);
|
|
4837
|
+
if (relPaths === null)
|
|
4838
|
+
continue;
|
|
4839
|
+
return { base: ref, root, files: relPaths.map((p) => join2(root, p)) };
|
|
4840
|
+
}
|
|
4841
|
+
return null;
|
|
4842
|
+
}
|
|
4843
|
+
function changedLineRanges(ref, path) {
|
|
4844
|
+
const diff = fileDiffAgainst(ref, path);
|
|
4845
|
+
if (diff === null)
|
|
4846
|
+
return null;
|
|
4847
|
+
return parseChangedLineRanges(diff)[path] ?? null;
|
|
4848
|
+
}
|
|
4849
|
+
function lineIsInRanges(line, ranges) {
|
|
4850
|
+
return ranges.some(([start, end]) => line >= start && line <= end);
|
|
4851
|
+
}
|
|
4852
|
+
function findingsInThisDiff(findings) {
|
|
4853
|
+
const diff = resolveDiff();
|
|
4854
|
+
if (diff === null)
|
|
4855
|
+
return [...findings];
|
|
4856
|
+
const changed = new Set(diff.files);
|
|
4857
|
+
const ranges = new Map;
|
|
4858
|
+
return findings.filter((f) => {
|
|
4859
|
+
const abs = resolve2(diff.root, f.file);
|
|
4860
|
+
if (!changed.has(abs))
|
|
4861
|
+
return false;
|
|
4862
|
+
const relPath = relative(diff.root, abs);
|
|
4863
|
+
if (!ranges.has(relPath))
|
|
4864
|
+
ranges.set(relPath, changedLineRanges(diff.base, relPath));
|
|
4865
|
+
const fileRanges = ranges.get(relPath) ?? null;
|
|
4866
|
+
return fileRanges === null ? true : lineIsInRanges(f.line, fileRanges);
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
|
|
4228
4870
|
// src/checks/bin/check-doctrine-portability.ts
|
|
4229
4871
|
var CHECK_NAME = "doctrine-portability";
|
|
4230
4872
|
var DOCTRINE_ROOT = loadConfig()?.proseGates?.doctrineRoot ?? "aeg-root";
|
|
4231
4873
|
var SHIPS_PREFIX2 = `${DOCTRINE_ROOT}/`;
|
|
4232
4874
|
function git(args) {
|
|
4233
4875
|
try {
|
|
4234
|
-
return
|
|
4876
|
+
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
4235
4877
|
} catch {
|
|
4236
4878
|
return "";
|
|
4237
4879
|
}
|
|
@@ -4244,7 +4886,7 @@ function collectWorkingTree(dir, out = []) {
|
|
|
4244
4886
|
return out;
|
|
4245
4887
|
}
|
|
4246
4888
|
for (const name of entries) {
|
|
4247
|
-
const full =
|
|
4889
|
+
const full = join3(dir, name);
|
|
4248
4890
|
let isDir;
|
|
4249
4891
|
try {
|
|
4250
4892
|
isDir = statSync(full).isDirectory();
|
|
@@ -4262,7 +4904,7 @@ function collectWorkingTree(dir, out = []) {
|
|
|
4262
4904
|
return out;
|
|
4263
4905
|
}
|
|
4264
4906
|
function readWorkingTree(paths) {
|
|
4265
|
-
return paths.map((p) => ({ path: p, content:
|
|
4907
|
+
return paths.map((p) => ({ path: p, content: readFileSync3(p, "utf8") }));
|
|
4266
4908
|
}
|
|
4267
4909
|
function collectAtRef(ref, dir) {
|
|
4268
4910
|
const listing = git(["ls-tree", "-r", "--name-only", ref, "--", dir]);
|
|
@@ -4271,7 +4913,7 @@ function collectAtRef(ref, dir) {
|
|
|
4271
4913
|
return paths.map((p) => ({ path: p, content: git(["show", `${ref}:${p}`]) }));
|
|
4272
4914
|
}
|
|
4273
4915
|
function findingKey(f) {
|
|
4274
|
-
return `${f.file}:${f.cited}`;
|
|
4916
|
+
return `${f.file}:${f.kind}:${f.cited}`;
|
|
4275
4917
|
}
|
|
4276
4918
|
function newSince(baseline, current) {
|
|
4277
4919
|
const remaining = new Map;
|
|
@@ -4297,10 +4939,12 @@ function main() {
|
|
|
4297
4939
|
const currentFindings = checkDoctrinePortability(currentFiles, SHIPS_PREFIX2);
|
|
4298
4940
|
const baselineFiles = collectAtRef(base, DOCTRINE_ROOT);
|
|
4299
4941
|
const baselineFindings = checkDoctrinePortability(baselineFiles, SHIPS_PREFIX2);
|
|
4300
|
-
const newFindings = newSince(baselineFindings, currentFindings);
|
|
4942
|
+
const newFindings = findingsInThisDiff(newSince(baselineFindings, currentFindings));
|
|
4301
4943
|
const baseline = captureBaseline([{ tool: CHECK_NAME, findingCount: baselineFindings.length }], new Date().toISOString());
|
|
4302
4944
|
const comparison = compareToBaseline([{ tool: CHECK_NAME, findingCount: currentFindings.length }], baseline);
|
|
4303
4945
|
console.log(`${CHECK_NAME}: doctrine root "${DOCTRINE_ROOT}"; ${currentFiles.length} file(s) at HEAD, ${baselineFiles.length} at "${base}"; ` + `baseline ${baselineFindings.length}, current ${currentFindings.length}, delta ${comparison.delta}; ${newFindings.length} new finding(s)`);
|
|
4946
|
+
const PATH_RECOVERY_PROMPT = "This doctrine page cites a path that only resolves in the authoring repository, not in an adopter’s " + "install — an adopter cannot follow it. Rewrite the citation to a doctrine-relative path (`roles/...`, " + "`contracts/...`, `skills/...`, `aeg-root/...`) or an adopter-owned one (`.github/...`, `.vinaya/...`, " + "`.claude/...`), or state the fact without pointing at the file at all.";
|
|
4947
|
+
const VENDOR_NAME_RECOVERY_PROMPT = "This doctrine page names an AI vendor/product/agent by name outside the one sanctioned fenced home " + "(`<!-- AEG:VENDOR-EXAMPLE:START -->` … `<!-- AEG:VENDOR-EXAMPLE:END -->` in `tranche-model.md` §12). " + `Rewrite the mention to refer to the host/agent generically (e.g. "the coding agent," "this repo's ` + 'shipped reference host," "an external, independently-hosted model") instead of by product name.';
|
|
4304
4948
|
for (const finding of newFindings) {
|
|
4305
4949
|
emitCheckError({
|
|
4306
4950
|
schema: CHECK_SCHEMA_VERSION,
|
|
@@ -4309,7 +4953,7 @@ function main() {
|
|
|
4309
4953
|
message: `${finding.file}:${finding.line}: ${finding.message}`,
|
|
4310
4954
|
file: finding.file,
|
|
4311
4955
|
line: finding.line,
|
|
4312
|
-
agent_recovery_prompt:
|
|
4956
|
+
agent_recovery_prompt: finding.kind === "vendor-name" ? VENDOR_NAME_RECOVERY_PROMPT : PATH_RECOVERY_PROMPT
|
|
4313
4957
|
});
|
|
4314
4958
|
}
|
|
4315
4959
|
process.exit(0);
|