@attalabs/vinaya 0.22.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 +13 -3
- 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 +26 -20
- 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 +1 -1
- 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 +10 -7
- package/aeg-root/tranche-model.md +6 -2
- package/dist/checks/bin/check-body-bare-digits.js +552 -139
- package/dist/checks/bin/check-branch-topology.js +603 -144
- package/dist/checks/bin/check-brief-shape.js +593 -142
- package/dist/checks/bin/check-changeset-coverage.js +935 -161
- package/dist/checks/bin/check-closes-n.js +603 -144
- package/dist/checks/bin/check-coherence.js +614 -147
- package/dist/checks/bin/check-dead-branch-push.js +552 -139
- package/dist/checks/bin/check-dispatch-readiness.js +612 -145
- package/dist/checks/bin/check-doc-coverage-push.js +689 -218
- package/dist/checks/bin/check-doc-coverage.js +689 -218
- package/dist/checks/bin/check-doctrine-no-procedures.js +4794 -0
- package/dist/checks/bin/check-doctrine-portability.js +684 -146
- package/dist/checks/bin/check-evidence-fresh.js +994 -174
- package/dist/checks/bin/check-exec-bits.js +4931 -0
- package/dist/checks/bin/check-first-push-dispatch.js +603 -144
- package/dist/checks/bin/check-issue-assignment.js +603 -144
- package/dist/checks/bin/check-main-branch-refusal.js +552 -139
- package/dist/checks/bin/check-no-disk-state.js +552 -139
- package/dist/checks/bin/check-pr-report-density.js +4461 -0
- package/dist/checks/bin/check-quoted-command.js +621 -155
- package/dist/checks/bin/check-reader-resolvable-prose.js +617 -154
- package/dist/checks/bin/check-registry-gates.js +595 -144
- package/dist/checks/bin/check-retired-vocabulary.js +617 -154
- package/dist/checks/bin/check-review-gate.js +670 -141
- package/dist/checks/bin/check-single-plan-pr.js +552 -139
- package/dist/checks/bin/check-test-plan.js +553 -140
- package/dist/checks/bin/check-token-collection-wired.js +552 -139
- package/dist/checks/bin/check-token-report.js +552 -139
- package/dist/checks/bin/check-workspace-escape.js +985 -145
- package/dist/index.js +8500 -5518
- 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]__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]__069-_41._.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/_1fqw88f._.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/node_modules_1vo08dj._.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 +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{37hnluhzj9bei.js → 0jer_drkl1e4r.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{267o-tsrnuwnv.js → 20x-t0a0v129z.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1hufpuody6vjv.js → 2ou_81ahqw31e.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- /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/{Fmyc42qzLwFcWWHLLNy-G → 5xy_GA7G5KRuE3HDumIiw}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Fmyc42qzLwFcWWHLLNy-G → 5xy_GA7G5KRuE3HDumIiw}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Fmyc42qzLwFcWWHLLNy-G → 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-changeset-coverage.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 } from "node:fs";
|
|
8
|
+
import { join as join3, relative as relative2 } 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
|
{
|
|
@@ -1832,6 +1868,22 @@ function isEmDashOrDash(s) {
|
|
|
1832
1868
|
const t = s.trim();
|
|
1833
1869
|
return t === "—" || t === "-" || t === "–";
|
|
1834
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
|
+
|
|
1835
1887
|
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1836
1888
|
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1837
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;
|
|
@@ -1886,6 +1938,47 @@ function parseInlineFieldList(section) {
|
|
|
1886
1938
|
return null;
|
|
1887
1939
|
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1888
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
|
+
}
|
|
1889
1982
|
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1890
1983
|
var DASH_LOOKALIKES = {
|
|
1891
1984
|
"-": "‑",
|
|
@@ -2050,22 +2143,6 @@ function isCodeFile(p) {
|
|
|
2050
2143
|
return false;
|
|
2051
2144
|
return /\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|sql|css)$/.test(p);
|
|
2052
2145
|
}
|
|
2053
|
-
// ../../packages/aeg-core/src/waiver-label.ts
|
|
2054
|
-
var WAIVER_LABEL = label("waiver-docs");
|
|
2055
|
-
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
2056
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
2057
|
-
function isPrincipal(login, principalAllowlist) {
|
|
2058
|
-
if (login === null)
|
|
2059
|
-
return false;
|
|
2060
|
-
const normalized = login.toLowerCase();
|
|
2061
|
-
return principalAllowlist.some((p) => p.toLowerCase() === normalized);
|
|
2062
|
-
}
|
|
2063
|
-
function isWaiverLabelActorVerified(opts) {
|
|
2064
|
-
if (!opts.labels.includes(opts.label))
|
|
2065
|
-
return false;
|
|
2066
|
-
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
2146
|
// ../../packages/aeg-core/src/doc-owners.ts
|
|
2070
2147
|
var DOC_OWNERS_PATH = ".vinaya/doc-owners";
|
|
2071
2148
|
function parseDocOwners(content) {
|
|
@@ -2282,6 +2359,32 @@ function parsePremiseBlock(prBody) {
|
|
|
2282
2359
|
}
|
|
2283
2360
|
return assertions;
|
|
2284
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
|
+
}
|
|
2285
2388
|
function checkPremises(assertions, fileReader) {
|
|
2286
2389
|
const failures = [];
|
|
2287
2390
|
for (const a of assertions) {
|
|
@@ -2368,15 +2471,18 @@ function testPlanRegion(prBody) {
|
|
|
2368
2471
|
return located.found ? located.section : prBody;
|
|
2369
2472
|
}
|
|
2370
2473
|
function checkTestPlan(prBody) {
|
|
2371
|
-
const
|
|
2474
|
+
const located = locateTestPlanSection(prBody);
|
|
2475
|
+
const region = located.found ? located.section : prBody;
|
|
2372
2476
|
if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
|
|
2373
2477
|
return { status: "pass", errors: [] };
|
|
2374
2478
|
if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
|
|
2375
2479
|
return { status: "pass", errors: [] };
|
|
2480
|
+
if (located.found && extractFencedBlocks(region).length > 0)
|
|
2481
|
+
return { status: "pass", errors: [] };
|
|
2376
2482
|
return {
|
|
2377
2483
|
status: "fail",
|
|
2378
2484
|
errors: [
|
|
2379
|
-
"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."
|
|
2380
2486
|
]
|
|
2381
2487
|
};
|
|
2382
2488
|
}
|
|
@@ -2499,8 +2605,162 @@ function isBriefShaped(prBody) {
|
|
|
2499
2605
|
const stripped = stripCode(prBody);
|
|
2500
2606
|
return BRIEF_SHAPE_MARKERS.filter((check) => check(stripped).status === "pass").length >= 2;
|
|
2501
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
|
+
}
|
|
2502
2762
|
function checkBriefSections(prBody, readTier, options = {}) {
|
|
2503
|
-
const { requireClosesN = true } = options;
|
|
2763
|
+
const { requireClosesN = true, consumersOf = () => [] } = options;
|
|
2504
2764
|
const results = [
|
|
2505
2765
|
checkTierField(prBody, readTier),
|
|
2506
2766
|
checkTestPlan(prBody),
|
|
@@ -2513,10 +2773,219 @@ function checkBriefSections(prBody, readTier, options = {}) {
|
|
|
2513
2773
|
checkAutonomyClause(prBody),
|
|
2514
2774
|
checkProjectField(prBody),
|
|
2515
2775
|
checkForField(prBody),
|
|
2776
|
+
checkNoUnpinnedCodeClaims(prBody),
|
|
2777
|
+
checkNoAgentBoxes(prBody),
|
|
2778
|
+
checkCommandsCarryOutput(prBody),
|
|
2779
|
+
checkConsumerTests(prBody, consumersOf),
|
|
2780
|
+
checkDefeatCases(prBody),
|
|
2516
2781
|
...requireClosesN ? [checkClosesN(prBody)] : []
|
|
2517
2782
|
];
|
|
2518
2783
|
return { errors: results.flatMap((r) => r.errors) };
|
|
2519
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
|
+
}
|
|
2520
2989
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
2521
2990
|
function hasRationaleField(body, labelPattern) {
|
|
2522
2991
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -2768,6 +3237,17 @@ function checkD1(entries, issueToEntry, taskToEntry) {
|
|
|
2768
3237
|
const depEntry = resolveDepEntry(dep, e.trancheSlug, issueToEntry, taskToEntry);
|
|
2769
3238
|
if (!depEntry)
|
|
2770
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
|
+
}
|
|
2771
3251
|
const depFacts = depEntry.facts;
|
|
2772
3252
|
const depClosed = depFacts?.issueState === "closed";
|
|
2773
3253
|
if (!depClosed) {
|
|
@@ -2911,41 +3391,24 @@ function checkClosesN2(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
2911
3391
|
}
|
|
2912
3392
|
return { ok: true, expectedIssue };
|
|
2913
3393
|
}
|
|
2914
|
-
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2915
|
-
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2916
|
-
function extractHeadSha(comment) {
|
|
2917
|
-
const m = comment.match(HEAD_SHA_PATTERN);
|
|
2918
|
-
return m ? m[1].toLowerCase() : null;
|
|
2919
|
-
}
|
|
2920
|
-
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
2921
|
-
const clearHits = comments.filter((c) => valuePattern.test(c));
|
|
2922
|
-
if (clearHits.length > 0) {
|
|
2923
|
-
const latest = clearHits[clearHits.length - 1];
|
|
2924
|
-
const m = latest.match(valuePattern);
|
|
2925
|
-
return {
|
|
2926
|
-
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
2927
|
-
headSha: extractHeadSha(latest),
|
|
2928
|
-
danglingNote: null
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
return {
|
|
2932
|
-
value: `no ${missingLabel} pass was run before merge — DANGLING, see below`,
|
|
2933
|
-
headSha: null,
|
|
2934
|
-
danglingNote: `no ${missingLabel} verdict comment found on this PR`
|
|
2935
|
-
};
|
|
2936
|
-
}
|
|
2937
|
-
function extractCodeReviewVerdict(comments) {
|
|
2938
|
-
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(APPROVE|REQUEST[ _-]?CHANGES|LGTM)(?![A-Za-z0-9])/im, "code-reviewer");
|
|
2939
|
-
}
|
|
2940
|
-
function extractSecurityReviewVerdict(comments) {
|
|
2941
|
-
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
2942
|
-
}
|
|
2943
3394
|
// ../../packages/aeg-core/src/review-gate.ts
|
|
2944
3395
|
function isBoundToHead(extraction, headSha) {
|
|
2945
3396
|
if (!extraction.headSha)
|
|
2946
3397
|
return false;
|
|
2947
3398
|
return headSha.toLowerCase().startsWith(extraction.headSha.toLowerCase());
|
|
2948
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
|
+
}
|
|
2949
3412
|
function checkReviewGate(input) {
|
|
2950
3413
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
2951
3414
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -2961,6 +3424,8 @@ function checkReviewGate(input) {
|
|
|
2961
3424
|
waived: true
|
|
2962
3425
|
};
|
|
2963
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");
|
|
2964
3429
|
const verified = input.comments.filter((c) => isPrincipal(c.author, principalAllowlist));
|
|
2965
3430
|
const ignoredCount = input.comments.filter((c) => !isPrincipal(c.author, principalAllowlist) && c.body.includes("VERDICT")).length;
|
|
2966
3431
|
const verifiedBodies = verified.map((c) => c.body);
|
|
@@ -2968,12 +3433,12 @@ function checkReviewGate(input) {
|
|
|
2968
3433
|
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
2969
3434
|
const codeReviewClean = codeReview.value === "APPROVE";
|
|
2970
3435
|
const securityClean = security.value === "PASS";
|
|
2971
|
-
const codeReviewBound =
|
|
2972
|
-
const securityBound =
|
|
2973
|
-
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) {
|
|
2974
3439
|
return {
|
|
2975
3440
|
verdict: "pass",
|
|
2976
|
-
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.`,
|
|
2977
3442
|
waived: false
|
|
2978
3443
|
};
|
|
2979
3444
|
}
|
|
@@ -2988,6 +3453,9 @@ function checkReviewGate(input) {
|
|
|
2988
3453
|
} else if (!securityBound) {
|
|
2989
3454
|
problems.push(`the newest security-review verdict covers ${security.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
2990
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
|
+
}
|
|
2991
3459
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
2992
3460
|
return {
|
|
2993
3461
|
verdict: "fail",
|
|
@@ -3267,72 +3735,6 @@ function compareToBaseline(current, baseline) {
|
|
|
3267
3735
|
perTool
|
|
3268
3736
|
};
|
|
3269
3737
|
}
|
|
3270
|
-
// ../../packages/aeg-core/src/doctrine-portability.ts
|
|
3271
|
-
var DEFAULT_SHIPS_PREFIX = "aeg-root/";
|
|
3272
|
-
var STATIC_PORTABLE_PREFIXES = [
|
|
3273
|
-
"roles/",
|
|
3274
|
-
"contracts/",
|
|
3275
|
-
"skills/",
|
|
3276
|
-
".github/",
|
|
3277
|
-
".vinaya/",
|
|
3278
|
-
".claude/",
|
|
3279
|
-
".git/",
|
|
3280
|
-
".husky/"
|
|
3281
|
-
];
|
|
3282
|
-
var EXEMPT_LITERALS = new Set([
|
|
3283
|
-
"path/inside/the/shipped/diff.ts",
|
|
3284
|
-
"path/inside/the/surface.ts",
|
|
3285
|
-
"apps/x/specs/..."
|
|
3286
|
-
]);
|
|
3287
|
-
var CITED_PATH_PATTERN = /^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]*)+$/;
|
|
3288
|
-
var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"]);
|
|
3289
|
-
function extractCitedPaths(content) {
|
|
3290
|
-
const found = [];
|
|
3291
|
-
const spanPattern = /`([^`\n]+)`/g;
|
|
3292
|
-
let match = spanPattern.exec(content);
|
|
3293
|
-
while (match !== null) {
|
|
3294
|
-
const cited = match[1] ?? "";
|
|
3295
|
-
const topSegment = cited.slice(0, cited.indexOf("/"));
|
|
3296
|
-
if (CITED_PATH_PATTERN.test(cited) && !NON_PATH_TOP_SEGMENTS.has(topSegment)) {
|
|
3297
|
-
found.push({ cited, index: match.index });
|
|
3298
|
-
}
|
|
3299
|
-
match = spanPattern.exec(content);
|
|
3300
|
-
}
|
|
3301
|
-
return found;
|
|
3302
|
-
}
|
|
3303
|
-
function lineAtIndex(content, index) {
|
|
3304
|
-
let line = 1;
|
|
3305
|
-
for (let i = 0;i < index; i++) {
|
|
3306
|
-
if (content.charCodeAt(i) === 10)
|
|
3307
|
-
line++;
|
|
3308
|
-
}
|
|
3309
|
-
return line;
|
|
3310
|
-
}
|
|
3311
|
-
function isPortable(cited, shipsPrefix) {
|
|
3312
|
-
if (cited.startsWith(shipsPrefix))
|
|
3313
|
-
return true;
|
|
3314
|
-
return STATIC_PORTABLE_PREFIXES.some((prefix) => cited.startsWith(prefix));
|
|
3315
|
-
}
|
|
3316
|
-
function checkDoctrinePortability(files, shipsPrefix = DEFAULT_SHIPS_PREFIX) {
|
|
3317
|
-
const findings = [];
|
|
3318
|
-
for (const file of files) {
|
|
3319
|
-
if (!file.path.startsWith(shipsPrefix))
|
|
3320
|
-
continue;
|
|
3321
|
-
for (const { cited, index } of extractCitedPaths(file.content)) {
|
|
3322
|
-
if (EXEMPT_LITERALS.has(cited))
|
|
3323
|
-
continue;
|
|
3324
|
-
if (isPortable(cited, shipsPrefix))
|
|
3325
|
-
continue;
|
|
3326
|
-
findings.push({
|
|
3327
|
-
file: file.path,
|
|
3328
|
-
line: lineAtIndex(file.content, index),
|
|
3329
|
-
cited,
|
|
3330
|
-
message: `cites "${cited}", a path that only exists in the authoring repository — not portable doctrine`
|
|
3331
|
-
});
|
|
3332
|
-
}
|
|
3333
|
-
}
|
|
3334
|
-
return findings;
|
|
3335
|
-
}
|
|
3336
3738
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3337
3739
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3338
3740
|
function shipsArchivePrefix(shipsPrefix) {
|
|
@@ -3668,6 +4070,12 @@ function scanRetiredVocabulary(files) {
|
|
|
3668
4070
|
function isHandClosedByRecognizedPrincipal(dep, principalAllowlist) {
|
|
3669
4071
|
return dep.issueState === "closed" && dep.stateReason === "completed" && isPrincipal(dep.closedByActor ?? null, principalAllowlist);
|
|
3670
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
|
+
}
|
|
3671
4079
|
function checkDispatchReadiness(input) {
|
|
3672
4080
|
const { trancheSlug, task } = input;
|
|
3673
4081
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
@@ -3682,6 +4090,11 @@ function checkDispatchReadiness(input) {
|
|
|
3682
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.`);
|
|
3683
4091
|
}
|
|
3684
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
|
+
}
|
|
3685
4098
|
if (dep.resolved === false) {
|
|
3686
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.`);
|
|
3687
4100
|
continue;
|
|
@@ -3921,27 +4334,27 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
3921
4334
|
};
|
|
3922
4335
|
}
|
|
3923
4336
|
const checkboxLines = section.split(`
|
|
3924
|
-
`).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));
|
|
3925
4338
|
if (checkboxLines.length === 0) {
|
|
3926
4339
|
return {
|
|
3927
4340
|
verdict: "pass",
|
|
3928
4341
|
messages: [
|
|
3929
|
-
"Test Plan section found but has no checkbox items.",
|
|
4342
|
+
"Test Plan section found but has no `[principal]` checkbox items.",
|
|
3930
4343
|
"PASS (advisory) — the section may be empty or expressed in prose; verification is the Principal's call."
|
|
3931
4344
|
]
|
|
3932
4345
|
};
|
|
3933
4346
|
}
|
|
3934
4347
|
const unchecked = checkboxLines.filter((line) => /^[-*]\s+\[\s\]/.test(line));
|
|
3935
4348
|
const checked = checkboxLines.filter((line) => /^[-*]\s+\[[xX]\]/.test(line));
|
|
3936
|
-
const messages = [`Test Plan items: ${checked.length} ticked, ${unchecked.length} unticked.`];
|
|
4349
|
+
const messages = [`Test Plan [principal] items: ${checked.length} ticked, ${unchecked.length} unticked.`];
|
|
3937
4350
|
if (unchecked.length > 0) {
|
|
3938
|
-
messages.push("", "FAIL — the following Test Plan items are unticked:");
|
|
4351
|
+
messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
|
|
3939
4352
|
for (const line of unchecked)
|
|
3940
4353
|
messages.push(` ${line}`);
|
|
3941
|
-
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.");
|
|
3942
4355
|
return { verdict: "fail", messages };
|
|
3943
4356
|
}
|
|
3944
|
-
messages.push("All Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
4357
|
+
messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
3945
4358
|
return { verdict: "pass", messages };
|
|
3946
4359
|
}
|
|
3947
4360
|
// ../../packages/aeg-core/src/workspace-escape.ts
|
|
@@ -4022,12 +4435,351 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
4022
4435
|
return findings;
|
|
4023
4436
|
}
|
|
4024
4437
|
// src/lib/diff-evidence.ts
|
|
4438
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
4439
|
+
import { join as join2, relative, resolve as resolve2 } from "node:path";
|
|
4440
|
+
|
|
4441
|
+
// src/lib/config.ts
|
|
4025
4442
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
4026
|
-
import {
|
|
4443
|
+
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
4444
|
+
import { homedir } from "node:os";
|
|
4445
|
+
import { dirname, join, resolve } from "node:path";
|
|
4446
|
+
import { z } from "zod";
|
|
4447
|
+
|
|
4448
|
+
// src/lib/agent-vendors.ts
|
|
4449
|
+
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
4450
|
+
|
|
4451
|
+
// src/lib/config.ts
|
|
4452
|
+
var EnvEntrySchema = z.union([
|
|
4453
|
+
z.literal(true),
|
|
4454
|
+
z.object({ optional: z.literal(true) }),
|
|
4455
|
+
z.object({ anyOf: z.array(z.string()).min(2) }),
|
|
4456
|
+
z.string()
|
|
4457
|
+
]);
|
|
4458
|
+
var CheckEntrySchema = z.object({
|
|
4459
|
+
run: z.string(),
|
|
4460
|
+
scope: z.enum(["diff", "full"]),
|
|
4461
|
+
include: z.array(z.string()).optional(),
|
|
4462
|
+
args: z.array(z.string()).optional(),
|
|
4463
|
+
timeoutMs: z.number().optional(),
|
|
4464
|
+
env: z.record(z.string(), EnvEntrySchema).optional(),
|
|
4465
|
+
requiresOpenPr: z.boolean().optional(),
|
|
4466
|
+
ownWorkflow: z.boolean().optional()
|
|
4467
|
+
}).superRefine((entry2, ctx) => {
|
|
4468
|
+
if (!entry2.env)
|
|
4469
|
+
return;
|
|
4470
|
+
for (const [key, value] of Object.entries(entry2.env)) {
|
|
4471
|
+
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
4472
|
+
continue;
|
|
4473
|
+
const members = value.anyOf;
|
|
4474
|
+
if (new Set(members).size !== members.length) {
|
|
4475
|
+
ctx.addIssue({
|
|
4476
|
+
code: z.ZodIssueCode.custom,
|
|
4477
|
+
message: `env.${key}.anyOf has duplicate members`,
|
|
4478
|
+
path: ["env", key, "anyOf"]
|
|
4479
|
+
});
|
|
4480
|
+
}
|
|
4481
|
+
if (!members.includes(key)) {
|
|
4482
|
+
ctx.addIssue({
|
|
4483
|
+
code: z.ZodIssueCode.custom,
|
|
4484
|
+
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
4485
|
+
path: ["env", key, "anyOf"]
|
|
4486
|
+
});
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
});
|
|
4490
|
+
var RoleEntrySchema = z.object({
|
|
4491
|
+
contract: z.string().refine((p) => p.includes("/"), {
|
|
4492
|
+
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
4493
|
+
})
|
|
4494
|
+
});
|
|
4495
|
+
var BRIEF_BUILTINS = [
|
|
4496
|
+
"tier",
|
|
4497
|
+
"testPlan",
|
|
4498
|
+
"testPlanExclusivity",
|
|
4499
|
+
"principalPlaceholder",
|
|
4500
|
+
"surfaceMap",
|
|
4501
|
+
"docUpdateList",
|
|
4502
|
+
"worktreeStep0",
|
|
4503
|
+
"stopConditions",
|
|
4504
|
+
"autonomyClause",
|
|
4505
|
+
"project",
|
|
4506
|
+
"for",
|
|
4507
|
+
"closesN",
|
|
4508
|
+
"premiseCoverage",
|
|
4509
|
+
"issueRationale",
|
|
4510
|
+
"milestoneShape"
|
|
4511
|
+
];
|
|
4512
|
+
var BriefSectionSchema = z.union([
|
|
4513
|
+
z.object({ builtin: z.enum(BRIEF_BUILTINS) }),
|
|
4514
|
+
z.object({ heading: z.string().min(1), name: z.string().optional() }),
|
|
4515
|
+
z.object({ field: z.string().min(1), name: z.string().optional() }),
|
|
4516
|
+
z.object({ phrase: z.string().min(1), name: z.string().optional() })
|
|
4517
|
+
]);
|
|
4518
|
+
var BriefSchemaSchema = z.object({
|
|
4519
|
+
pr: z.object({ sections: z.array(BriefSectionSchema) }).optional(),
|
|
4520
|
+
issue: z.object({ sections: z.array(BriefSectionSchema) }).optional(),
|
|
4521
|
+
milestone: z.object({ sections: z.array(BriefSectionSchema) }).optional(),
|
|
4522
|
+
ack: z.array(z.enum(BRIEF_BUILTINS)).optional()
|
|
4523
|
+
});
|
|
4524
|
+
function isSafeRepoRelPath(p) {
|
|
4525
|
+
if (p.length === 0)
|
|
4526
|
+
return false;
|
|
4527
|
+
if (p.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(p))
|
|
4528
|
+
return false;
|
|
4529
|
+
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
4530
|
+
}
|
|
4531
|
+
var SafeRepoRelPath = z.string().refine(isSafeRepoRelPath, {
|
|
4532
|
+
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
4533
|
+
});
|
|
4534
|
+
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
4535
|
+
function isCanonicalHookBlockPath(p) {
|
|
4536
|
+
return CANONICAL_HOOK_BLOCK_PREFIXES.some((prefix) => p.startsWith(prefix) && p.length > prefix.length);
|
|
4537
|
+
}
|
|
4538
|
+
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
4539
|
+
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
4540
|
+
});
|
|
4541
|
+
var ManagedBlockRecordSchema = z.object({
|
|
4542
|
+
path: ManagedHookBlockPath,
|
|
4543
|
+
marker: z.string(),
|
|
4544
|
+
comment: z.enum(["hash", "html"])
|
|
4545
|
+
});
|
|
4546
|
+
var ManagedManifestSchema = z.object({
|
|
4547
|
+
version: z.number().int().positive(),
|
|
4548
|
+
files: z.array(SafeRepoRelPath),
|
|
4549
|
+
blocks: z.array(ManagedBlockRecordSchema),
|
|
4550
|
+
labels: z.array(z.string()),
|
|
4551
|
+
agents: z.array(z.enum(AGENT_VENDORS)).optional()
|
|
4552
|
+
});
|
|
4553
|
+
var ProjectEntrySchema = z.object({
|
|
4554
|
+
name: z.string().min(1),
|
|
4555
|
+
description: z.string().min(1).optional(),
|
|
4556
|
+
path: z.string().min(1).optional()
|
|
4557
|
+
});
|
|
4558
|
+
function parseTokensCollectDeclaration(value) {
|
|
4559
|
+
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
4560
|
+
if (!m)
|
|
4561
|
+
return null;
|
|
4562
|
+
const [, interpreter, script] = m;
|
|
4563
|
+
if (!isSafeRepoRelPath(script))
|
|
4564
|
+
return null;
|
|
4565
|
+
return { interpreter, script };
|
|
4566
|
+
}
|
|
4567
|
+
var VinayaConfigSchema = z.object({
|
|
4568
|
+
rings: z.object({
|
|
4569
|
+
ring1_forgeWriteInterception: z.boolean(),
|
|
4570
|
+
ring2_asyncAudits: z.boolean()
|
|
4571
|
+
}).optional(),
|
|
4572
|
+
checks: z.record(z.string(), CheckEntrySchema).optional(),
|
|
4573
|
+
roles: z.record(z.string(), RoleEntrySchema).optional(),
|
|
4574
|
+
briefSchema: BriefSchemaSchema.optional(),
|
|
4575
|
+
managed: ManagedManifestSchema.optional(),
|
|
4576
|
+
principals: z.array(z.string()).min(1).optional(),
|
|
4577
|
+
releaseActor: z.string().min(1).optional(),
|
|
4578
|
+
ci: z.object({ setup: z.string().min(1) }).optional(),
|
|
4579
|
+
tokens: z.object({
|
|
4580
|
+
collect: z.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
4581
|
+
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
4582
|
+
})
|
|
4583
|
+
}).optional(),
|
|
4584
|
+
blastRadius: z.object({ extraDomains: z.array(z.string()).optional() }).optional(),
|
|
4585
|
+
proseGates: z.object({
|
|
4586
|
+
doctrineRoot: z.string().min(1).optional(),
|
|
4587
|
+
readerFacingPrefix: z.string().min(1).optional(),
|
|
4588
|
+
readerFacingSuffix: z.string().min(1).optional(),
|
|
4589
|
+
legacySlugDir: z.string().min(1).optional()
|
|
4590
|
+
}).optional(),
|
|
4591
|
+
projects: z.array(ProjectEntrySchema).optional()
|
|
4592
|
+
});
|
|
4593
|
+
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
4594
|
+
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
4595
|
+
var LOCAL_CONFIG_FILENAME = "vinaya.config.json";
|
|
4596
|
+
function findLocalConfig() {
|
|
4597
|
+
let dir = process.cwd();
|
|
4598
|
+
while (true) {
|
|
4599
|
+
const candidate = join(dir, LOCAL_CONFIG_FILENAME);
|
|
4600
|
+
if (existsSync(candidate))
|
|
4601
|
+
return candidate;
|
|
4602
|
+
if (existsSync(join(dir, ".git")))
|
|
4603
|
+
return null;
|
|
4604
|
+
const parent = dirname(dir);
|
|
4605
|
+
if (parent === dir)
|
|
4606
|
+
return null;
|
|
4607
|
+
dir = parent;
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
function configPath() {
|
|
4611
|
+
const local = findLocalConfig();
|
|
4612
|
+
if (local)
|
|
4613
|
+
return local;
|
|
4614
|
+
if (existsSync(GLOBAL_CONFIG_PATH))
|
|
4615
|
+
return GLOBAL_CONFIG_PATH;
|
|
4616
|
+
return null;
|
|
4617
|
+
}
|
|
4618
|
+
function globalChecksIgnoredWarning(path) {
|
|
4619
|
+
return `${path}: "checks" registration in the global config is ignored — checks may only be registered from a repo-local vinaya.config.json.`;
|
|
4620
|
+
}
|
|
4621
|
+
function globalPrincipalsIgnoredWarning(path) {
|
|
4622
|
+
return `${path}: "principals" in the global config is ignored — principals may only be declared from a repo-local vinaya.config.json.`;
|
|
4623
|
+
}
|
|
4624
|
+
function globalRolesIgnoredWarning(path) {
|
|
4625
|
+
return `${path}: "roles" registration in the global config is ignored — roles may only be registered from a repo-local vinaya.config.json.`;
|
|
4626
|
+
}
|
|
4627
|
+
function globalReleaseActorIgnoredWarning(path) {
|
|
4628
|
+
return `${path}: "releaseActor" in the global config is ignored — releaseActor may only be declared from a repo-local vinaya.config.json.`;
|
|
4629
|
+
}
|
|
4630
|
+
function globalTokensCollectIgnoredWarning(path) {
|
|
4631
|
+
return `${path}: "tokens" in the global config is ignored — tokens.collect may only be declared from a repo-local vinaya.config.json.`;
|
|
4632
|
+
}
|
|
4633
|
+
function stripGlobalOnlyKeys(config, path) {
|
|
4634
|
+
if (path !== GLOBAL_CONFIG_PATH)
|
|
4635
|
+
return config;
|
|
4636
|
+
let result = config;
|
|
4637
|
+
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
4638
|
+
console.error(`⚠ ${globalChecksIgnoredWarning(path)}`);
|
|
4639
|
+
result = { ...result, checks: undefined };
|
|
4640
|
+
}
|
|
4641
|
+
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
4642
|
+
console.error(`⚠ ${globalRolesIgnoredWarning(path)}`);
|
|
4643
|
+
result = { ...result, roles: undefined };
|
|
4644
|
+
}
|
|
4645
|
+
if (result.principals && result.principals.length > 0) {
|
|
4646
|
+
console.error(`⚠ ${globalPrincipalsIgnoredWarning(path)}`);
|
|
4647
|
+
result = { ...result, principals: undefined };
|
|
4648
|
+
}
|
|
4649
|
+
if (result.releaseActor) {
|
|
4650
|
+
console.error(`⚠ ${globalReleaseActorIgnoredWarning(path)}`);
|
|
4651
|
+
result = { ...result, releaseActor: undefined };
|
|
4652
|
+
}
|
|
4653
|
+
if (result.tokens) {
|
|
4654
|
+
console.error(`⚠ ${globalTokensCollectIgnoredWarning(path)}`);
|
|
4655
|
+
result = { ...result, tokens: undefined };
|
|
4656
|
+
}
|
|
4657
|
+
return result;
|
|
4658
|
+
}
|
|
4659
|
+
function resolvePrincipalAllowlist(config) {
|
|
4660
|
+
return config?.principals ?? PRINCIPAL_ALLOWLIST;
|
|
4661
|
+
}
|
|
4662
|
+
function resolveReleaseActor(config) {
|
|
4663
|
+
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
4664
|
+
}
|
|
4665
|
+
function trustAnchorRepo() {
|
|
4666
|
+
const wellFormed = (slug) => /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
4667
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
4668
|
+
if (fromRunner) {
|
|
4669
|
+
const validated = wellFormed(fromRunner);
|
|
4670
|
+
if (validated)
|
|
4671
|
+
return validated;
|
|
4672
|
+
}
|
|
4673
|
+
try {
|
|
4674
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
4675
|
+
encoding: "utf-8",
|
|
4676
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4677
|
+
}).trim();
|
|
4678
|
+
const m = url.match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
4679
|
+
return m?.[1] && m[2] ? wellFormed(`${m[1]}/${m[2]}`) : null;
|
|
4680
|
+
} catch {
|
|
4681
|
+
return null;
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
function ghFetchTrustAnchorConfig() {
|
|
4685
|
+
const repo = trustAnchorRepo();
|
|
4686
|
+
if (!repo)
|
|
4687
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
4688
|
+
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
4689
|
+
encoding: "utf-8",
|
|
4690
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4691
|
+
});
|
|
4692
|
+
}
|
|
4693
|
+
function firstLine(err) {
|
|
4694
|
+
return err?.message?.split(`
|
|
4695
|
+
`)[0] ?? "unknown error";
|
|
4696
|
+
}
|
|
4697
|
+
function isMissingFileError(err) {
|
|
4698
|
+
const stderr = err?.stderr;
|
|
4699
|
+
const haystack = [
|
|
4700
|
+
err?.message ?? "",
|
|
4701
|
+
typeof stderr === "string" ? stderr : stderr?.toString() ?? ""
|
|
4702
|
+
].join(`
|
|
4703
|
+
`);
|
|
4704
|
+
return /\b404\b|not found/i.test(haystack);
|
|
4705
|
+
}
|
|
4706
|
+
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
4707
|
+
const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
4708
|
+
`);
|
|
4709
|
+
let base64;
|
|
4710
|
+
try {
|
|
4711
|
+
base64 = fetcher().trim();
|
|
4712
|
+
} catch (err) {
|
|
4713
|
+
if (!isMissingFileError(err))
|
|
4714
|
+
warn(firstLine(err));
|
|
4715
|
+
return null;
|
|
4716
|
+
}
|
|
4717
|
+
if (!base64)
|
|
4718
|
+
return null;
|
|
4719
|
+
try {
|
|
4720
|
+
const raw = Buffer.from(base64, "base64").toString("utf-8");
|
|
4721
|
+
const parsed = VinayaConfigSchema.safeParse(JSON.parse(raw));
|
|
4722
|
+
if (parsed.success)
|
|
4723
|
+
return parsed.data;
|
|
4724
|
+
warn("it did not satisfy the config schema");
|
|
4725
|
+
return null;
|
|
4726
|
+
} catch {
|
|
4727
|
+
warn("it was not readable as JSON");
|
|
4728
|
+
return null;
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
function loadConfig() {
|
|
4732
|
+
const path = configPath();
|
|
4733
|
+
if (!path)
|
|
4734
|
+
return null;
|
|
4735
|
+
try {
|
|
4736
|
+
const raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
4737
|
+
return stripGlobalOnlyKeys(VinayaConfigSchema.parse(raw), path);
|
|
4738
|
+
} catch {
|
|
4739
|
+
return null;
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
4743
|
+
|
|
4744
|
+
// src/checks/contract.ts
|
|
4745
|
+
var CHECK_SCHEMA_VERSION = 1;
|
|
4746
|
+
function emitCheckError(error) {
|
|
4747
|
+
process.stderr.write(`${JSON.stringify(error)}
|
|
4748
|
+
`);
|
|
4749
|
+
}
|
|
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
|
|
4027
4779
|
function fileDiffAgainst(ref, path) {
|
|
4028
4780
|
let out;
|
|
4029
4781
|
try {
|
|
4030
|
-
out =
|
|
4782
|
+
out = execFileSync3("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
4031
4783
|
encoding: "utf8",
|
|
4032
4784
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4033
4785
|
}).trim();
|
|
@@ -4038,7 +4790,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
4038
4790
|
}
|
|
4039
4791
|
function revParse(ref) {
|
|
4040
4792
|
try {
|
|
4041
|
-
return
|
|
4793
|
+
return execFileSync3("git", ["rev-parse", "--verify", ref], {
|
|
4042
4794
|
encoding: "utf8",
|
|
4043
4795
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4044
4796
|
}).trim();
|
|
@@ -4048,7 +4800,7 @@ function revParse(ref) {
|
|
|
4048
4800
|
}
|
|
4049
4801
|
function repoRoot() {
|
|
4050
4802
|
try {
|
|
4051
|
-
return
|
|
4803
|
+
return execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
4052
4804
|
encoding: "utf8",
|
|
4053
4805
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4054
4806
|
}).trim();
|
|
@@ -4059,7 +4811,7 @@ function repoRoot() {
|
|
|
4059
4811
|
function changedFiles(base) {
|
|
4060
4812
|
let out;
|
|
4061
4813
|
try {
|
|
4062
|
-
out =
|
|
4814
|
+
out = execFileSync3("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
4063
4815
|
encoding: "utf8",
|
|
4064
4816
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4065
4817
|
}).trim();
|
|
@@ -4070,6 +4822,9 @@ function changedFiles(base) {
|
|
|
4070
4822
|
`).map((s) => s.trim()).filter(Boolean);
|
|
4071
4823
|
}
|
|
4072
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") {
|
|
4073
4828
|
const root = repoRoot();
|
|
4074
4829
|
if (root === null)
|
|
4075
4830
|
return null;
|
|
@@ -4081,16 +4836,35 @@ function resolveChangedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
|
4081
4836
|
const relPaths = changedFiles(ref);
|
|
4082
4837
|
if (relPaths === null)
|
|
4083
4838
|
continue;
|
|
4084
|
-
return relPaths.map((p) =>
|
|
4839
|
+
return { base: ref, root, files: relPaths.map((p) => join2(root, p)) };
|
|
4085
4840
|
}
|
|
4086
4841
|
return null;
|
|
4087
4842
|
}
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
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
|
+
});
|
|
4094
4868
|
}
|
|
4095
4869
|
|
|
4096
4870
|
// src/checks/changeset-coverage-logic.ts
|
|
@@ -4163,7 +4937,7 @@ function evaluateChangesetCoverage(fixedGroup, changedFiles2, isReleaseBranch) {
|
|
|
4163
4937
|
var CHECK_NAME = "changeset-coverage";
|
|
4164
4938
|
function git(args) {
|
|
4165
4939
|
try {
|
|
4166
|
-
return
|
|
4940
|
+
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
4167
4941
|
} catch {
|
|
4168
4942
|
return "";
|
|
4169
4943
|
}
|
|
@@ -4173,7 +4947,7 @@ function toPosix(p) {
|
|
|
4173
4947
|
}
|
|
4174
4948
|
function readPackageJson(path) {
|
|
4175
4949
|
try {
|
|
4176
|
-
const parsed = JSON.parse(
|
|
4950
|
+
const parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
4177
4951
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
4178
4952
|
} catch {
|
|
4179
4953
|
return null;
|
|
@@ -4194,18 +4968,18 @@ function childDirs(absoluteDir) {
|
|
|
4194
4968
|
function candidateMemberDirs(root, pattern) {
|
|
4195
4969
|
if (pattern.endsWith("/*")) {
|
|
4196
4970
|
const prefix = pattern.slice(0, -2);
|
|
4197
|
-
return childDirs(
|
|
4971
|
+
return childDirs(join3(root, prefix)).map((name) => `${prefix}/${name}`);
|
|
4198
4972
|
}
|
|
4199
4973
|
if (!pattern.includes("*"))
|
|
4200
4974
|
return [pattern];
|
|
4201
4975
|
return [];
|
|
4202
4976
|
}
|
|
4203
4977
|
function resolveWorkspaceMembers(root) {
|
|
4204
|
-
const rootPkg = readPackageJson(
|
|
4978
|
+
const rootPkg = readPackageJson(join3(root, "package.json"));
|
|
4205
4979
|
const members = new Map;
|
|
4206
4980
|
for (const pattern of workspacePatterns(rootPkg)) {
|
|
4207
4981
|
for (const dir of candidateMemberDirs(root, pattern)) {
|
|
4208
|
-
const pkg = readPackageJson(
|
|
4982
|
+
const pkg = readPackageJson(join3(root, dir, "package.json"));
|
|
4209
4983
|
const name = pkg?.name;
|
|
4210
4984
|
const files = pkg?.files;
|
|
4211
4985
|
if (typeof name !== "string" || !Array.isArray(files))
|
|
@@ -4216,7 +4990,7 @@ function resolveWorkspaceMembers(root) {
|
|
|
4216
4990
|
return members;
|
|
4217
4991
|
}
|
|
4218
4992
|
function fixedGroupNames(root) {
|
|
4219
|
-
const pkg = readPackageJson(
|
|
4993
|
+
const pkg = readPackageJson(join3(root, ".changeset", "config.json"));
|
|
4220
4994
|
const fixed = pkg?.fixed;
|
|
4221
4995
|
if (!Array.isArray(fixed))
|
|
4222
4996
|
return [];
|
|
@@ -4238,7 +5012,7 @@ function main() {
|
|
|
4238
5012
|
if (changedAbs.length === 0) {
|
|
4239
5013
|
process.exit(0);
|
|
4240
5014
|
}
|
|
4241
|
-
const changedFiles2 = changedAbs.map((p) => toPosix(
|
|
5015
|
+
const changedFiles2 = changedAbs.map((p) => toPosix(relative2(root, p)));
|
|
4242
5016
|
const branch = git(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
4243
5017
|
const isReleaseBranch = branch === CHANGESET_RELEASE_BRANCH;
|
|
4244
5018
|
const workspaceMembers = resolveWorkspaceMembers(root);
|