@attalabs/vinaya 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/aeg-root/contracts/planner-developer.md +1 -1
- package/aeg-root/enforcement.md +22 -22
- package/aeg-root/process.md +1 -1
- package/aeg-root/roles/archivist.md +1 -1
- package/aeg-root/roles/developer/reference.md +4 -1
- package/aeg-root/roles/developer.md +1 -1
- package/aeg-root/roles/planner/reference.md +18 -5
- package/aeg-root/roles/principal.md +1 -1
- package/aeg-root/roles/reviewer.md +3 -3
- package/aeg-root/roles/security.md +4 -4
- package/aeg-root/roles/tranche-archivist.md +2 -2
- package/aeg-root/skills/aeg/SKILL.md +1 -1
- package/aeg-root/state-machine.md +8 -13
- package/aeg-root/templates/brief-template.md +4 -1
- package/aeg-root/templates/decision-record-template.md +38 -0
- package/aeg-root/templates/issue-rationale-template.md +1 -1
- package/aeg-root/tranche-model.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +1867 -347
- package/dist/checks/bin/check-branch-topology.js +1181 -237
- package/dist/checks/bin/check-brief-shape.js +1911 -433
- package/dist/checks/bin/check-changeset-coverage.js +2144 -517
- package/dist/checks/bin/check-ci-shard-coverage.js +12133 -11
- package/dist/checks/bin/check-closes-n.js +1181 -237
- package/dist/checks/bin/check-coherence.js +1785 -1126
- package/dist/checks/bin/check-dead-branch-push.js +1154 -225
- package/dist/checks/bin/check-dispatch-readiness.js +2068 -436
- package/dist/checks/bin/check-doc-claims.js +2104 -231
- package/dist/checks/bin/check-doc-coverage-push.js +2181 -515
- package/dist/checks/bin/check-doc-coverage.js +2181 -519
- package/dist/checks/bin/check-doctrine-no-procedures.js +1668 -345
- package/dist/checks/bin/check-doctrine-portability.js +2143 -516
- package/dist/checks/bin/check-evidence-fresh.js +2080 -465
- package/dist/checks/bin/check-exec-bits.js +2130 -503
- package/dist/checks/bin/check-first-push-dispatch.js +1845 -371
- package/dist/checks/bin/check-issue-assignment.js +712 -170
- package/dist/checks/bin/check-issue-milestone-attach.js +1145 -225
- package/dist/checks/bin/check-issue-objectives-numbering.js +1661 -338
- package/dist/checks/bin/check-issue-parts-coverage.js +1145 -225
- package/dist/checks/bin/check-issue-surface-globs.js +1787 -369
- package/dist/checks/bin/check-issue-title-grammar.js +1145 -225
- package/dist/checks/bin/check-issue-tranche-label.js +702 -170
- package/dist/checks/bin/check-main-branch-refusal.js +1157 -227
- package/dist/checks/bin/check-no-disk-state.js +1145 -225
- package/dist/checks/bin/check-pr-premise-reassert.js +1661 -338
- package/dist/checks/bin/check-pr-report-density.js +1145 -225
- package/dist/checks/bin/check-principal-test-plan-wait.js +2379 -249
- package/dist/checks/bin/check-quoted-command.js +2128 -501
- package/dist/checks/bin/check-reader-resolvable-prose.js +2170 -517
- package/dist/checks/bin/check-registry-gates.js +1228 -272
- package/dist/checks/bin/check-retired-vocabulary.js +2153 -507
- package/dist/checks/bin/check-review-gate.js +1932 -350
- package/dist/checks/bin/check-single-plan-pr.js +1208 -229
- package/dist/checks/bin/check-surface-scope.js +1414 -244
- package/dist/checks/bin/check-test-plan.js +2381 -252
- package/dist/checks/bin/check-token-collection-wired.js +1145 -225
- package/dist/checks/bin/check-workspace-escape.js +2141 -514
- package/dist/checks/bin/verify-coherence.js +493 -86
- package/dist/checks/bin/verify-dispatch.js +512 -132
- package/dist/checks/bin/verify-docs.js +549 -124
- package/dist/index.js +22702 -17900
- package/dist/lib/pre-push-cache-test-run.js +1026 -233
- package/dist/lib/pre-push-select-tests.js +922 -173
- package/package.json +12 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +13 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +55 -26
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +12 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +22 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/entry-point.ts +27 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +2 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +19 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +593 -55
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +19 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +1 -1
- 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 +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 +1 -1
- 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 +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0sxadt2._.js +13 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +57 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1ug9syi._.js → [root-of-the-server]__1wzfiav._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 1p3vr9qts86_b.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 21tunzmxjvm2a.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 38kom-9c-oi65.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__04adkz-._.js +0 -57
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +0 -13
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_ssgManifest.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-reader-resolvable-prose.ts
|
|
4
|
-
import { existsSync as
|
|
5
|
-
import { extname as extname2, isAbsolute as isAbsolute2, join as
|
|
4
|
+
import { existsSync as existsSync9, readdirSync as readdirSync3, readFileSync as readFileSync9, realpathSync as realpathSync4, statSync as statSync3 } from "node:fs";
|
|
5
|
+
import { extname as extname2, isAbsolute as isAbsolute2, join as join11, relative as relative3, resolve as resolve3, sep as sep3 } from "node:path";
|
|
6
6
|
|
|
7
7
|
// ../../packages/aeg-core/src/entry-point.ts
|
|
8
8
|
import { realpathSync } from "node:fs";
|
|
@@ -43,7 +43,6 @@ var GATE_AUDIENCE = {
|
|
|
43
43
|
};
|
|
44
44
|
var NON_GATE_BINS = [
|
|
45
45
|
"archive-task",
|
|
46
|
-
"assign-task-issue",
|
|
47
46
|
"dead-branch-audit",
|
|
48
47
|
"eval-agent-compliance",
|
|
49
48
|
"open-issue",
|
|
@@ -306,6 +305,25 @@ async function runAsync(args) {
|
|
|
306
305
|
function ghApiGet(path) {
|
|
307
306
|
return JSON.parse(run(["api", path]));
|
|
308
307
|
}
|
|
308
|
+
var MAX_PER_PAGE = 100;
|
|
309
|
+
var MAX_PAGES = 100;
|
|
310
|
+
async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
311
|
+
const [base = pathWithoutPage, query = ""] = pathWithoutPage.split("?");
|
|
312
|
+
const params = new URLSearchParams(query);
|
|
313
|
+
params.set("per_page", String(MAX_PER_PAGE));
|
|
314
|
+
const all = [];
|
|
315
|
+
for (let page = 1;page <= MAX_PAGES; page++) {
|
|
316
|
+
params.set("page", String(page));
|
|
317
|
+
const args = ["api", `${base}?${params.toString()}`];
|
|
318
|
+
if (opts?.jq)
|
|
319
|
+
args.push("-q", opts.jq);
|
|
320
|
+
const batch = JSON.parse(await runAsync(args));
|
|
321
|
+
all.push(...batch);
|
|
322
|
+
if (batch.length < MAX_PER_PAGE)
|
|
323
|
+
return all;
|
|
324
|
+
}
|
|
325
|
+
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
326
|
+
}
|
|
309
327
|
function issueListByLabelArgs(owner, repo, label) {
|
|
310
328
|
return [
|
|
311
329
|
"issue",
|
|
@@ -717,6 +735,10 @@ function intentGoalForSlug(description, slug) {
|
|
|
717
735
|
function matchesLegacyMilestone(milestones, slug) {
|
|
718
736
|
return milestones.find((m) => m.title === slug) ?? null;
|
|
719
737
|
}
|
|
738
|
+
var TRANCHE_SLUG_SHAPE = /^[a-z0-9]+(?:-[a-z0-9]+)*-v\d+$/;
|
|
739
|
+
function slugShapedTitles(milestones) {
|
|
740
|
+
return milestones.map((m) => m.title).filter((t) => TRANCHE_SLUG_SHAPE.test(t));
|
|
741
|
+
}
|
|
720
742
|
function factsFromLegacyMilestone(milestone) {
|
|
721
743
|
return {
|
|
722
744
|
goal: milestone.description ?? "",
|
|
@@ -750,6 +772,90 @@ function findMilestoneForSlug(owner, repo, slug) {
|
|
|
750
772
|
return resolveLegacyFacts(legacy, issues);
|
|
751
773
|
return { goal: goalFromMilestones(milestones, slug), lifecycle: lifecycleFromIssues(issues) };
|
|
752
774
|
}
|
|
775
|
+
function trancheSlugsFromLabels(labels) {
|
|
776
|
+
const slugs = [];
|
|
777
|
+
for (const l of labels) {
|
|
778
|
+
const slug = trancheSlugOf(l.name);
|
|
779
|
+
if (slug !== null)
|
|
780
|
+
slugs.push(slug);
|
|
781
|
+
}
|
|
782
|
+
return slugs;
|
|
783
|
+
}
|
|
784
|
+
async function indexTrancheMilestonesAsync(owner, repo) {
|
|
785
|
+
const [milestones, labels] = await Promise.all([
|
|
786
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
787
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
|
|
788
|
+
]);
|
|
789
|
+
const active = [];
|
|
790
|
+
const archived = [];
|
|
791
|
+
const facts = new Map;
|
|
792
|
+
const legacySlugs = new Set(slugShapedTitles(milestones));
|
|
793
|
+
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
794
|
+
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
795
|
+
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
796
|
+
const uniqueLegacySlugs = [...legacySlugs];
|
|
797
|
+
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
798
|
+
Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
|
|
799
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
|
|
800
|
+
]);
|
|
801
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
802
|
+
const m = legacyMilestoneBySlug.get(slug);
|
|
803
|
+
if (!m)
|
|
804
|
+
return;
|
|
805
|
+
const ref = { slug, goal: m.description ?? "" };
|
|
806
|
+
const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
|
|
807
|
+
if (f.lifecycle === "complete")
|
|
808
|
+
archived.push(ref);
|
|
809
|
+
else if (f.lifecycle === "active")
|
|
810
|
+
active.push(ref);
|
|
811
|
+
facts.set(slug, f);
|
|
812
|
+
});
|
|
813
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
814
|
+
const issues = newPathIssuesBySlug[i] ?? [];
|
|
815
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
816
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
817
|
+
const f = { goal, lifecycle };
|
|
818
|
+
facts.set(slug, f);
|
|
819
|
+
if (lifecycle === "active")
|
|
820
|
+
active.push({ slug, goal });
|
|
821
|
+
else if (lifecycle === "complete")
|
|
822
|
+
archived.push({ slug, goal });
|
|
823
|
+
});
|
|
824
|
+
return { active, archived, facts, legacySlugs };
|
|
825
|
+
}
|
|
826
|
+
async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
|
|
827
|
+
const [milestones, labels, issues] = await Promise.all([
|
|
828
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
829
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`),
|
|
830
|
+
ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))
|
|
831
|
+
]);
|
|
832
|
+
const active = [];
|
|
833
|
+
const archived = [];
|
|
834
|
+
const facts = new Map;
|
|
835
|
+
const legacySlugs = new Set;
|
|
836
|
+
const legacyMilestone = slugShapedTitles(milestones).includes(slug) ? matchesLegacyMilestone(milestones, slug) : null;
|
|
837
|
+
if (legacyMilestone) {
|
|
838
|
+
legacySlugs.add(slug);
|
|
839
|
+
const ref = { slug, goal: legacyMilestone.description ?? "" };
|
|
840
|
+
const f = resolveLegacyFacts(legacyMilestone, issues);
|
|
841
|
+
if (f.lifecycle === "complete")
|
|
842
|
+
archived.push(ref);
|
|
843
|
+
else if (f.lifecycle === "active")
|
|
844
|
+
active.push(ref);
|
|
845
|
+
facts.set(slug, f);
|
|
846
|
+
} else if (trancheSlugsFromLabels(labels).includes(slug)) {
|
|
847
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
848
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
849
|
+
facts.set(slug, { goal, lifecycle });
|
|
850
|
+
if (lifecycle === "active")
|
|
851
|
+
active.push({ slug, goal });
|
|
852
|
+
else if (lifecycle === "complete")
|
|
853
|
+
archived.push({ slug, goal });
|
|
854
|
+
}
|
|
855
|
+
const openLegacyTitles = new Set(slugShapedTitles(milestones.filter((m) => m.state === "open")));
|
|
856
|
+
const otherOpenLegacySlugs = [...openLegacyTitles].filter((t) => t !== slug);
|
|
857
|
+
return { active, archived, facts, legacySlugs, otherOpenLegacySlugs };
|
|
858
|
+
}
|
|
753
859
|
|
|
754
860
|
// ../../packages/aeg-forge-state/src/derive-from-forge.ts
|
|
755
861
|
function trancheFromIssues(slug, issues, known) {
|
|
@@ -1410,6 +1516,125 @@ var graphql2 = withDefaults3(request, {
|
|
|
1410
1516
|
method: "POST",
|
|
1411
1517
|
url: "/graphql"
|
|
1412
1518
|
});
|
|
1519
|
+
|
|
1520
|
+
// ../../packages/aeg-forge-state/src/fetch-provenance.ts
|
|
1521
|
+
var PROVENANCE_PATTERN = /^###\s+AEG provenance\b/im;
|
|
1522
|
+
function provenanceMatchesIssue(text, issueNum) {
|
|
1523
|
+
if (!PROVENANCE_PATTERN.test(text))
|
|
1524
|
+
return false;
|
|
1525
|
+
const m = text.match(/^-\s*Issue:\s*#(\d+)/im);
|
|
1526
|
+
return m !== null && Number(m[1]) === issueNum;
|
|
1527
|
+
}
|
|
1528
|
+
function isPrCloser(closer) {
|
|
1529
|
+
return closer !== null && typeof closer.number === "number";
|
|
1530
|
+
}
|
|
1531
|
+
async function fetchProvenanceViaCrossReferences(issueNums, owner, repo, token) {
|
|
1532
|
+
const result = new Map;
|
|
1533
|
+
if (issueNums.length === 0)
|
|
1534
|
+
return result;
|
|
1535
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1536
|
+
const perIssue = issueNums.map((n) => `
|
|
1537
|
+
i_${n}: issue(number: ${n}) {
|
|
1538
|
+
timelineItems(first: 50, itemTypes: [CROSS_REFERENCED_EVENT]) {
|
|
1539
|
+
nodes {
|
|
1540
|
+
... on CrossReferencedEvent {
|
|
1541
|
+
source {
|
|
1542
|
+
... on PullRequest {
|
|
1543
|
+
number
|
|
1544
|
+
body
|
|
1545
|
+
comments(first: 50) { nodes { body } }
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}`).join("");
|
|
1552
|
+
const query = `query ProvenanceCrossRef($owner: String!, $repo: String!) {
|
|
1553
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1554
|
+
}
|
|
1555
|
+
}`;
|
|
1556
|
+
let response;
|
|
1557
|
+
try {
|
|
1558
|
+
response = await client(query, { owner, repo });
|
|
1559
|
+
} catch {
|
|
1560
|
+
return result;
|
|
1561
|
+
}
|
|
1562
|
+
if (!response.repository)
|
|
1563
|
+
return result;
|
|
1564
|
+
for (const n of issueNums) {
|
|
1565
|
+
const raw = response.repository[`i_${n}`];
|
|
1566
|
+
const nodes = raw?.timelineItems?.nodes ?? [];
|
|
1567
|
+
const found = nodes.some(({ source }) => {
|
|
1568
|
+
if (!source || typeof source.number !== "number")
|
|
1569
|
+
return false;
|
|
1570
|
+
const pr = source;
|
|
1571
|
+
if (provenanceMatchesIssue(pr.body ?? "", n))
|
|
1572
|
+
return true;
|
|
1573
|
+
return pr.comments.nodes.some((c) => provenanceMatchesIssue(c.body, n));
|
|
1574
|
+
});
|
|
1575
|
+
result.set(n, found);
|
|
1576
|
+
}
|
|
1577
|
+
return result;
|
|
1578
|
+
}
|
|
1579
|
+
async function fetchProvenance(issueNums, owner, repo, token) {
|
|
1580
|
+
const result = new Map;
|
|
1581
|
+
if (issueNums.length === 0)
|
|
1582
|
+
return result;
|
|
1583
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1584
|
+
const perIssue = issueNums.map((n) => `
|
|
1585
|
+
i_${n}: issue(number: ${n}) {
|
|
1586
|
+
timelineItems(last: 1, itemTypes: [CLOSED_EVENT]) {
|
|
1587
|
+
nodes {
|
|
1588
|
+
... on ClosedEvent {
|
|
1589
|
+
closer {
|
|
1590
|
+
... on PullRequest {
|
|
1591
|
+
number
|
|
1592
|
+
body
|
|
1593
|
+
comments(first: 50) {
|
|
1594
|
+
nodes { body }
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}`).join("");
|
|
1602
|
+
const query = `query Provenance($owner: String!, $repo: String!) {
|
|
1603
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1604
|
+
}
|
|
1605
|
+
}`;
|
|
1606
|
+
let response;
|
|
1607
|
+
try {
|
|
1608
|
+
response = await client(query, { owner, repo });
|
|
1609
|
+
} catch {
|
|
1610
|
+
return result;
|
|
1611
|
+
}
|
|
1612
|
+
if (!response.repository)
|
|
1613
|
+
return result;
|
|
1614
|
+
const needsFallback = [];
|
|
1615
|
+
for (const n of issueNums) {
|
|
1616
|
+
const raw = response.repository[`i_${n}`];
|
|
1617
|
+
if (!raw) {
|
|
1618
|
+
result.set(n, false);
|
|
1619
|
+
continue;
|
|
1620
|
+
}
|
|
1621
|
+
const closer = raw.timelineItems?.nodes?.[0]?.closer;
|
|
1622
|
+
const c = closer ?? null;
|
|
1623
|
+
if (!isPrCloser(c)) {
|
|
1624
|
+
needsFallback.push(n);
|
|
1625
|
+
continue;
|
|
1626
|
+
}
|
|
1627
|
+
const bodyHas = PROVENANCE_PATTERN.test(c.body ?? "");
|
|
1628
|
+
const commentHas = c.comments.nodes.some((x) => PROVENANCE_PATTERN.test(x.body));
|
|
1629
|
+
result.set(n, bodyHas || commentHas);
|
|
1630
|
+
}
|
|
1631
|
+
if (needsFallback.length > 0) {
|
|
1632
|
+
const fallback = await fetchProvenanceViaCrossReferences(needsFallback, owner, repo, token);
|
|
1633
|
+
for (const [n, found] of fallback)
|
|
1634
|
+
result.set(n, found);
|
|
1635
|
+
}
|
|
1636
|
+
return result;
|
|
1637
|
+
}
|
|
1413
1638
|
// ../../packages/aeg-forge-state/src/github-token.ts
|
|
1414
1639
|
import { execFile as execFile2 } from "node:child_process";
|
|
1415
1640
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -1639,6 +1864,84 @@ function describeError(err) {
|
|
|
1639
1864
|
return err;
|
|
1640
1865
|
return "unknown error";
|
|
1641
1866
|
}
|
|
1867
|
+
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1868
|
+
function defaultPriorTrancheArchivalDeps() {
|
|
1869
|
+
let facts = new Map;
|
|
1870
|
+
return {
|
|
1871
|
+
activeTrancheSlugs: async (excludeSlug, repo) => {
|
|
1872
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
|
|
1873
|
+
facts = index.facts;
|
|
1874
|
+
return index.active.map((m) => m.slug).filter((slug) => slug !== excludeSlug);
|
|
1875
|
+
},
|
|
1876
|
+
deriveTranche: (slug, repo) => deriveTrancheFromForge(repo.owner, repo.repo, slug, facts.get(slug)),
|
|
1877
|
+
openIssues: async (slug, repo) => (await fetchTrancheIssuesAsync(repo.owner, repo.repo, slug)).filter((issue) => issue.state === "OPEN").map((issue) => ({ number: issue.number }))
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
function reason(err) {
|
|
1881
|
+
return err instanceof Error ? err.message.split(`
|
|
1882
|
+
`)[0] ?? "failed" : String(err);
|
|
1883
|
+
}
|
|
1884
|
+
async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
|
|
1885
|
+
if (projects.length === 0)
|
|
1886
|
+
return { facts: [], infraFailure: null };
|
|
1887
|
+
let candidates;
|
|
1888
|
+
try {
|
|
1889
|
+
candidates = await deps.activeTrancheSlugs(excludeSlug, repo);
|
|
1890
|
+
} catch (err) {
|
|
1891
|
+
return {
|
|
1892
|
+
facts: [],
|
|
1893
|
+
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
const facts = [];
|
|
1897
|
+
const unreadable = [];
|
|
1898
|
+
const derived = new Map;
|
|
1899
|
+
const derive = (slug) => {
|
|
1900
|
+
let p = derived.get(slug);
|
|
1901
|
+
if (!p) {
|
|
1902
|
+
p = deps.deriveTranche(slug, repo);
|
|
1903
|
+
derived.set(slug, p);
|
|
1904
|
+
}
|
|
1905
|
+
return p;
|
|
1906
|
+
};
|
|
1907
|
+
for (const project of projects) {
|
|
1908
|
+
let found = null;
|
|
1909
|
+
let unknown = false;
|
|
1910
|
+
for (const slug of candidates) {
|
|
1911
|
+
let candidateTranche;
|
|
1912
|
+
try {
|
|
1913
|
+
candidateTranche = await derive(slug);
|
|
1914
|
+
} catch {
|
|
1915
|
+
unknown = true;
|
|
1916
|
+
unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1917
|
+
break;
|
|
1918
|
+
}
|
|
1919
|
+
if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
|
|
1920
|
+
continue;
|
|
1921
|
+
let openIssues;
|
|
1922
|
+
try {
|
|
1923
|
+
openIssues = await deps.openIssues(slug, repo);
|
|
1924
|
+
} catch {
|
|
1925
|
+
openIssues = null;
|
|
1926
|
+
}
|
|
1927
|
+
if (openIssues === null) {
|
|
1928
|
+
unknown = true;
|
|
1929
|
+
unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1930
|
+
break;
|
|
1931
|
+
}
|
|
1932
|
+
if (openIssues.length === 0) {
|
|
1933
|
+
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1934
|
+
break;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
if (!unknown)
|
|
1938
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1939
|
+
}
|
|
1940
|
+
return {
|
|
1941
|
+
facts,
|
|
1942
|
+
infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1642
1945
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1643
1946
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
1644
1947
|
const result = new Map;
|
|
@@ -1713,6 +2016,10 @@ function buildQuery(issueNumbers) {
|
|
|
1713
2016
|
}
|
|
1714
2017
|
}`;
|
|
1715
2018
|
}
|
|
2019
|
+
// ../../packages/aeg-forge-state/src/list-issue-milestones.ts
|
|
2020
|
+
function issueMilestonesFromIssues(issues) {
|
|
2021
|
+
return issues.filter((i) => i.state === "OPEN").map((i) => ({ issue: i.number, milestoneTitle: i.milestone?.title ?? null }));
|
|
2022
|
+
}
|
|
1716
2023
|
// ../../packages/aeg-forge-state/src/resolve-repo.ts
|
|
1717
2024
|
import { execFile as execFile3 } from "node:child_process";
|
|
1718
2025
|
import { promisify as promisify3 } from "node:util";
|
|
@@ -1775,7 +2082,8 @@ var ANCHOR_FIELDS = [
|
|
|
1775
2082
|
"PREMISE",
|
|
1776
2083
|
"TEST-PLAN",
|
|
1777
2084
|
"EVIDENCE",
|
|
1778
|
-
"BEYOND-SURFACE"
|
|
2085
|
+
"BEYOND-SURFACE",
|
|
2086
|
+
"LIVE"
|
|
1779
2087
|
];
|
|
1780
2088
|
function anchoredRegionBounds(body, field) {
|
|
1781
2089
|
const masked = maskCode(body);
|
|
@@ -1976,7 +2284,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
|
1976
2284
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1977
2285
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1978
2286
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
1979
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
1980
2287
|
function isPrincipal(login, principalAllowlist) {
|
|
1981
2288
|
if (login === null)
|
|
1982
2289
|
return false;
|
|
@@ -1995,6 +2302,14 @@ var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(
|
|
|
1995
2302
|
var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1996
2303
|
var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1997
2304
|
var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2305
|
+
var MANIFEST_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Manifest version:\s*(\d+)\s*$/im;
|
|
2306
|
+
var PAUSE_BOUND_RULING_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Pause-bound ruling:\s*(?:(\S+)\|(\S+)\|([0-9a-f]{64})|\(none\))\s*$/im;
|
|
2307
|
+
function extractPauseBoundRuling(comment) {
|
|
2308
|
+
const m = comment.match(PAUSE_BOUND_RULING_PATTERN);
|
|
2309
|
+
if (!m)
|
|
2310
|
+
return;
|
|
2311
|
+
return m[1] ? { rulingId: m[1], pauseId: m[2], contentDigest: m[3] } : null;
|
|
2312
|
+
}
|
|
1998
2313
|
function firstFiveLines(comment) {
|
|
1999
2314
|
return comment.split(`
|
|
2000
2315
|
`).slice(0, 5).join(`
|
|
@@ -2088,6 +2403,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2088
2403
|
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
2089
2404
|
};
|
|
2090
2405
|
}
|
|
2406
|
+
const versionMatch = latest.match(MANIFEST_VERSION_PATTERN);
|
|
2407
|
+
const pauseBoundRuling = extractPauseBoundRuling(latest);
|
|
2091
2408
|
return {
|
|
2092
2409
|
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
2093
2410
|
headSha: extractHeadSha(latest),
|
|
@@ -2096,6 +2413,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2096
2413
|
briefHash: extractBriefHash(latest),
|
|
2097
2414
|
policyDigest: extractPolicyDigest(latest),
|
|
2098
2415
|
baseSha: extractBaseSha(latest),
|
|
2416
|
+
...versionMatch ? { manifestVersion: Number.parseInt(versionMatch[1], 10) } : {},
|
|
2417
|
+
...pauseBoundRuling === undefined ? {} : { pauseBoundRuling },
|
|
2099
2418
|
findingSeverities: extractFindingSeverities(latest),
|
|
2100
2419
|
danglingNote: null
|
|
2101
2420
|
};
|
|
@@ -2106,6 +2425,16 @@ function extractCodeReviewVerdict(comments) {
|
|
|
2106
2425
|
function extractSecurityReviewVerdict(comments) {
|
|
2107
2426
|
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
2108
2427
|
}
|
|
2428
|
+
|
|
2429
|
+
// ../../packages/aeg-core/src/review-status.ts
|
|
2430
|
+
var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-(\d+)\s*-->/i;
|
|
2431
|
+
function parseDeveloperRoundMarker(body) {
|
|
2432
|
+
const m = body.match(DEVELOPER_ROUND_MARKER);
|
|
2433
|
+
if (!m)
|
|
2434
|
+
return null;
|
|
2435
|
+
const n = Number(m[1]);
|
|
2436
|
+
return Number.isFinite(n) ? n : null;
|
|
2437
|
+
}
|
|
2109
2438
|
// ../../packages/aeg-core/src/report-tokens.ts
|
|
2110
2439
|
var DASH_LOOKALIKES = {
|
|
2111
2440
|
"-": "‑",
|
|
@@ -2801,14 +3130,14 @@ function checkTestPlan(prBody) {
|
|
|
2801
3130
|
const region = located.found ? located.section : prBody;
|
|
2802
3131
|
if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
|
|
2803
3132
|
return { status: "pass", errors: [] };
|
|
2804
|
-
if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
|
|
3133
|
+
if (/\*\*\[(?:agent|principal|live)\]\*\*/.test(region))
|
|
2805
3134
|
return { status: "pass", errors: [] };
|
|
2806
3135
|
if (located.found && extractFencedBlocks(region).length > 0)
|
|
2807
3136
|
return { status: "pass", errors: [] };
|
|
2808
3137
|
return {
|
|
2809
3138
|
status: "fail",
|
|
2810
3139
|
errors: [
|
|
2811
|
-
"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
|
|
3140
|
+
"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]**`/`**[live]**`-tagged item."
|
|
2812
3141
|
]
|
|
2813
3142
|
};
|
|
2814
3143
|
}
|
|
@@ -3430,6 +3759,375 @@ function checkPrReportDensity(prBody) {
|
|
|
3430
3759
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3431
3760
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3432
3761
|
}
|
|
3762
|
+
// ../../packages/aeg-core/src/prose-rules.ts
|
|
3763
|
+
var RETIRED_GLOBAL_EXEMPTIONS = [
|
|
3764
|
+
"docs/decisions-legacy.md",
|
|
3765
|
+
"apps/herald-ai/docs/",
|
|
3766
|
+
"apps/vada-ai/docs/",
|
|
3767
|
+
"aeg-root/tranches/completed/",
|
|
3768
|
+
"packages/aeg-core/src/docs/published-prose",
|
|
3769
|
+
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
3770
|
+
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
3771
|
+
"/fixtures/",
|
|
3772
|
+
"/node_modules/",
|
|
3773
|
+
"/.next/",
|
|
3774
|
+
"/.turbo/"
|
|
3775
|
+
];
|
|
3776
|
+
var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
|
|
3777
|
+
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
3778
|
+
var RETIRED_PATTERN_EXEMPTIONS = {
|
|
3779
|
+
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
3780
|
+
[String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
|
|
3781
|
+
"docs-index.md",
|
|
3782
|
+
"apps/vada-ai/specs/legacy/README.md",
|
|
3783
|
+
"apps/vada-ai/specs/vada-product-spec.md",
|
|
3784
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3785
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3786
|
+
],
|
|
3787
|
+
"decisions-legacy": [
|
|
3788
|
+
"packages/aeg-core/src/file-classify.ts",
|
|
3789
|
+
"packages/aeg-core/src/file-classify.test.ts",
|
|
3790
|
+
"packages/aeg-core/src/pr-tier.test.ts",
|
|
3791
|
+
"docs-index.md",
|
|
3792
|
+
".claude/skills/database/SKILL.md",
|
|
3793
|
+
".claude/skills/vada-architecture/SKILL.md",
|
|
3794
|
+
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
3795
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3796
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3797
|
+
],
|
|
3798
|
+
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
3799
|
+
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
3800
|
+
};
|
|
3801
|
+
var retiredPatterns = [
|
|
3802
|
+
String.raw`\bD-[0-9]{3}\b`,
|
|
3803
|
+
"D-(###|NNN|nnn|xxx)",
|
|
3804
|
+
"decision (entry|logged)",
|
|
3805
|
+
"decision-log entry",
|
|
3806
|
+
"decision log entry",
|
|
3807
|
+
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
3808
|
+
"decision-log",
|
|
3809
|
+
"decision entr",
|
|
3810
|
+
"decisions? (are |is )?logged",
|
|
3811
|
+
"log entries",
|
|
3812
|
+
String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
|
|
3813
|
+
"decisions-legacy",
|
|
3814
|
+
"CONTRADICTION",
|
|
3815
|
+
"assumes Tier 3",
|
|
3816
|
+
"Lock: ?YES",
|
|
3817
|
+
"Lock: ?NO",
|
|
3818
|
+
"lock approvals?",
|
|
3819
|
+
"approves locks",
|
|
3820
|
+
"Conforms to lock",
|
|
3821
|
+
"Challenges lock",
|
|
3822
|
+
"checkDecisionNumbersFresh",
|
|
3823
|
+
String.raw`roles/team-leader\.md`,
|
|
3824
|
+
String.raw`\(,`,
|
|
3825
|
+
String.raw`,\)`,
|
|
3826
|
+
String.raw`\(\.\)`,
|
|
3827
|
+
...PLAN_ON_DISK_PATTERNS
|
|
3828
|
+
];
|
|
3829
|
+
var published = [
|
|
3830
|
+
["decision-id", "a decision id", /\bD-\d{3,}\b/],
|
|
3831
|
+
["section-ref", "a section reference", /§/],
|
|
3832
|
+
["forge-number", "a forge number", /#\d+/],
|
|
3833
|
+
["retired-name", "the retired public name", /\bAEG\b/],
|
|
3834
|
+
["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
|
|
3835
|
+
[
|
|
3836
|
+
"label-vocabulary",
|
|
3837
|
+
"forge label vocabulary",
|
|
3838
|
+
/(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
|
|
3839
|
+
],
|
|
3840
|
+
["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
|
|
3841
|
+
["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
|
|
3842
|
+
[
|
|
3843
|
+
"internal-path",
|
|
3844
|
+
"a repo-internal file",
|
|
3845
|
+
/(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
|
|
3846
|
+
]
|
|
3847
|
+
];
|
|
3848
|
+
var DEFAULT_PROSE_RULES = [
|
|
3849
|
+
{
|
|
3850
|
+
id: "forge-number",
|
|
3851
|
+
group: "reader-resolvable",
|
|
3852
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3853
|
+
patterns: { prose: /#[0-9]{2,4}/g },
|
|
3854
|
+
flags: ["global"],
|
|
3855
|
+
message: "a forge number",
|
|
3856
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3857
|
+
exemptions: []
|
|
3858
|
+
},
|
|
3859
|
+
{
|
|
3860
|
+
id: "tranche-slug",
|
|
3861
|
+
group: "reader-resolvable",
|
|
3862
|
+
scopes: ["ships", "reader-facing", "product", "spec"],
|
|
3863
|
+
patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
|
|
3864
|
+
flags: ["global"],
|
|
3865
|
+
message: "an internal tranche slug",
|
|
3866
|
+
severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
|
|
3867
|
+
exemptions: []
|
|
3868
|
+
},
|
|
3869
|
+
{
|
|
3870
|
+
id: "task-number",
|
|
3871
|
+
group: "reader-resolvable",
|
|
3872
|
+
scopes: ["spec"],
|
|
3873
|
+
patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
|
|
3874
|
+
flags: ["global", "ignore-case"],
|
|
3875
|
+
message: "a task number",
|
|
3876
|
+
severity: { spec: "error" },
|
|
3877
|
+
exemptions: []
|
|
3878
|
+
},
|
|
3879
|
+
{
|
|
3880
|
+
id: "source-comment-tranche-slug",
|
|
3881
|
+
group: "reader-resolvable",
|
|
3882
|
+
scopes: ["source-comment"],
|
|
3883
|
+
patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
|
|
3884
|
+
flags: ["global"],
|
|
3885
|
+
message: "a tranche-slug citation",
|
|
3886
|
+
severity: { "source-comment": "warning" },
|
|
3887
|
+
exemptions: []
|
|
3888
|
+
},
|
|
3889
|
+
{
|
|
3890
|
+
id: "source-comment-forge-number",
|
|
3891
|
+
group: "reader-resolvable",
|
|
3892
|
+
scopes: ["source-comment"],
|
|
3893
|
+
patterns: { comment: /#[0-9]{2,}/g },
|
|
3894
|
+
flags: ["global"],
|
|
3895
|
+
message: "a forge-number citation",
|
|
3896
|
+
severity: { "source-comment": "warning" },
|
|
3897
|
+
exemptions: []
|
|
3898
|
+
},
|
|
3899
|
+
{
|
|
3900
|
+
id: "legacy-batch-name",
|
|
3901
|
+
group: "reader-resolvable",
|
|
3902
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3903
|
+
patterns: {},
|
|
3904
|
+
flags: ["built-in"],
|
|
3905
|
+
message: "an internal tranche slug",
|
|
3906
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3907
|
+
exemptions: [],
|
|
3908
|
+
builtIn: true
|
|
3909
|
+
},
|
|
3910
|
+
{
|
|
3911
|
+
id: "coined-term",
|
|
3912
|
+
group: "reader-resolvable",
|
|
3913
|
+
scopes: ["ships", "reader-facing"],
|
|
3914
|
+
patterns: {},
|
|
3915
|
+
flags: ["built-in"],
|
|
3916
|
+
message: "uses coined term without defining it inline or linking the glossary",
|
|
3917
|
+
severity: { ships: "warning", "reader-facing": "warning" },
|
|
3918
|
+
exemptions: [],
|
|
3919
|
+
builtIn: true
|
|
3920
|
+
},
|
|
3921
|
+
...retiredPatterns.map((pattern, index) => ({
|
|
3922
|
+
id: `retired-vocabulary-${index + 1}`,
|
|
3923
|
+
group: "retired-vocabulary",
|
|
3924
|
+
scopes: ["repository"],
|
|
3925
|
+
patterns: { repository: pattern },
|
|
3926
|
+
flags: [],
|
|
3927
|
+
message: "retired vocabulary",
|
|
3928
|
+
severity: { repository: "error" },
|
|
3929
|
+
exemptions: RETIRED_GLOBAL_EXEMPTIONS,
|
|
3930
|
+
patternExemptions: RETIRED_PATTERN_EXEMPTIONS
|
|
3931
|
+
})),
|
|
3932
|
+
...published.map(([id, message, pattern]) => ({
|
|
3933
|
+
id,
|
|
3934
|
+
group: "published-prose",
|
|
3935
|
+
scopes: ["published"],
|
|
3936
|
+
patterns: { published: pattern },
|
|
3937
|
+
flags: [],
|
|
3938
|
+
message,
|
|
3939
|
+
severity: { published: "error" },
|
|
3940
|
+
exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
|
|
3941
|
+
}))
|
|
3942
|
+
];
|
|
3943
|
+
var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
|
|
3944
|
+
var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
|
|
3945
|
+
var RETIRED_SCOPES = ["repository"];
|
|
3946
|
+
var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
|
|
3947
|
+
function groupOfScope(scope) {
|
|
3948
|
+
if (RESOLVABLE_SCOPES.includes(scope))
|
|
3949
|
+
return "reader-resolvable";
|
|
3950
|
+
if (RETIRED_SCOPES.includes(scope))
|
|
3951
|
+
return "retired-vocabulary";
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3954
|
+
var CONFIGURED_PROSE_FLAGS = ["i", "u"];
|
|
3955
|
+
var CONFIGURED_PATTERN_MAX_LENGTH = 200;
|
|
3956
|
+
var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
|
|
3957
|
+
function allowedScopesFor(rule) {
|
|
3958
|
+
if (rule.builtIn)
|
|
3959
|
+
return rule.scopes;
|
|
3960
|
+
return rule.group === "retired-vocabulary" ? RETIRED_SCOPES : RESOLVABLE_SCOPES;
|
|
3961
|
+
}
|
|
3962
|
+
function normalizeRepoPath(entry) {
|
|
3963
|
+
let out = entry.replace(/\\/g, "/");
|
|
3964
|
+
while (out.startsWith("./"))
|
|
3965
|
+
out = out.slice(2);
|
|
3966
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3967
|
+
while (out.endsWith("/"))
|
|
3968
|
+
out = out.slice(0, -1);
|
|
3969
|
+
return out;
|
|
3970
|
+
}
|
|
3971
|
+
function isConfiguredExempt(path, exempt, repoRoot) {
|
|
3972
|
+
if (exempt.length === 0)
|
|
3973
|
+
return false;
|
|
3974
|
+
const root = repoRoot === undefined ? undefined : normalizeRepoPath(repoRoot);
|
|
3975
|
+
let rel = normalizeRepoPath(path);
|
|
3976
|
+
if (root && rel.startsWith(`${root}/`))
|
|
3977
|
+
rel = rel.slice(root.length + 1);
|
|
3978
|
+
return exempt.some((entry) => {
|
|
3979
|
+
const e = normalizeRepoPath(entry);
|
|
3980
|
+
return rel === e || rel.startsWith(`${e}/`);
|
|
3981
|
+
});
|
|
3982
|
+
}
|
|
3983
|
+
function ruleReads(set, rule, path) {
|
|
3984
|
+
return !isConfiguredExempt(path, set.exempt, set.repoRoot) && !isConfiguredExempt(path, rule.exempt, set.repoRoot);
|
|
3985
|
+
}
|
|
3986
|
+
var RESOLVABLE_RUN_ORDER = [
|
|
3987
|
+
"forge-number",
|
|
3988
|
+
"tranche-slug",
|
|
3989
|
+
"legacy-batch-name",
|
|
3990
|
+
"task-number",
|
|
3991
|
+
"source-comment-tranche-slug",
|
|
3992
|
+
"source-comment-forge-number",
|
|
3993
|
+
"coined-term"
|
|
3994
|
+
];
|
|
3995
|
+
var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
|
|
3996
|
+
function scopeDefaultSeverity(scope, sourceCommentSeverity) {
|
|
3997
|
+
if (scope === "source-comment")
|
|
3998
|
+
return sourceCommentSeverity ?? "warning";
|
|
3999
|
+
if (scope === "repository")
|
|
4000
|
+
return "error";
|
|
4001
|
+
return "warning";
|
|
4002
|
+
}
|
|
4003
|
+
function applySeverity(scopes, base, setting) {
|
|
4004
|
+
const out = {};
|
|
4005
|
+
for (const scope of scopes) {
|
|
4006
|
+
const configured = typeof setting === "string" ? setting : setting?.[scope];
|
|
4007
|
+
const value = configured ?? base[scope];
|
|
4008
|
+
if (value !== undefined)
|
|
4009
|
+
out[scope] = value;
|
|
4010
|
+
}
|
|
4011
|
+
return out;
|
|
4012
|
+
}
|
|
4013
|
+
function defaultPatternFor(rule) {
|
|
4014
|
+
const cache = new Map;
|
|
4015
|
+
return (scope) => {
|
|
4016
|
+
if (cache.has(scope))
|
|
4017
|
+
return cache.get(scope) ?? null;
|
|
4018
|
+
const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
|
|
4019
|
+
const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
|
|
4020
|
+
cache.set(scope, compiled);
|
|
4021
|
+
return compiled;
|
|
4022
|
+
};
|
|
4023
|
+
}
|
|
4024
|
+
function customPatternFor(rule, global) {
|
|
4025
|
+
const cache = new Map;
|
|
4026
|
+
return (scope) => {
|
|
4027
|
+
if (cache.has(scope))
|
|
4028
|
+
return cache.get(scope) ?? null;
|
|
4029
|
+
const source = rule.patterns?.[scope] ?? rule.pattern;
|
|
4030
|
+
const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
|
|
4031
|
+
cache.set(scope, compiled);
|
|
4032
|
+
return compiled;
|
|
4033
|
+
};
|
|
4034
|
+
}
|
|
4035
|
+
function resolveProseRules(config = undefined, options = {}) {
|
|
4036
|
+
const rules = [];
|
|
4037
|
+
const defaults = config?.defaults ?? {};
|
|
4038
|
+
for (const rule of CONFIGURABLE_DEFAULT_RULES) {
|
|
4039
|
+
const override = defaults[rule.id];
|
|
4040
|
+
if (override === "off")
|
|
4041
|
+
continue;
|
|
4042
|
+
const group = rule.group;
|
|
4043
|
+
const scopes = override?.scopes ?? rule.scopes;
|
|
4044
|
+
const base = {};
|
|
4045
|
+
for (const scope of scopes) {
|
|
4046
|
+
base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4047
|
+
}
|
|
4048
|
+
rules.push({
|
|
4049
|
+
id: rule.id,
|
|
4050
|
+
group,
|
|
4051
|
+
custom: false,
|
|
4052
|
+
builtIn: rule.builtIn === true,
|
|
4053
|
+
scopes,
|
|
4054
|
+
message: rule.message,
|
|
4055
|
+
severity: applySeverity(scopes, base, override?.severity),
|
|
4056
|
+
exempt: override?.exempt ?? [],
|
|
4057
|
+
substringExempt: rule.exemptions,
|
|
4058
|
+
reportGroup: REPORT_GROUPS[rule.id],
|
|
4059
|
+
patternFor: defaultPatternFor(rule)
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
4062
|
+
for (const rule of config?.custom ?? []) {
|
|
4063
|
+
const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
|
|
4064
|
+
const base = {};
|
|
4065
|
+
for (const scope of rule.scopes)
|
|
4066
|
+
base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4067
|
+
rules.push({
|
|
4068
|
+
id: rule.id,
|
|
4069
|
+
group,
|
|
4070
|
+
custom: true,
|
|
4071
|
+
builtIn: false,
|
|
4072
|
+
scopes: rule.scopes,
|
|
4073
|
+
message: rule.means,
|
|
4074
|
+
severity: applySeverity(rule.scopes, base, rule.severity),
|
|
4075
|
+
exempt: rule.exempt ?? [],
|
|
4076
|
+
substringExempt: [],
|
|
4077
|
+
patternFor: customPatternFor(rule, group === "reader-resolvable")
|
|
4078
|
+
});
|
|
4079
|
+
}
|
|
4080
|
+
if (options.decisionRecordsPath !== undefined)
|
|
4081
|
+
rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
|
|
4082
|
+
const order = (rule) => {
|
|
4083
|
+
const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
|
|
4084
|
+
return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
|
|
4085
|
+
};
|
|
4086
|
+
const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
|
|
4087
|
+
const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
|
|
4088
|
+
return {
|
|
4089
|
+
rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
|
|
4090
|
+
exempt: config?.exempt ?? [],
|
|
4091
|
+
repoRoot: options.repoRoot
|
|
4092
|
+
};
|
|
4093
|
+
}
|
|
4094
|
+
function rulesOfGroup(set, group) {
|
|
4095
|
+
return set.rules.filter((rule) => rule.group === group);
|
|
4096
|
+
}
|
|
4097
|
+
function rulesInScope(set, scope) {
|
|
4098
|
+
return set.rules.filter((rule) => rule.scopes.includes(scope));
|
|
4099
|
+
}
|
|
4100
|
+
var DEFAULT_PROSE_RULE_SET = resolveProseRules();
|
|
4101
|
+
var DECISION_RECORD_CITATION_ID = "decision-record-citation";
|
|
4102
|
+
var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
|
|
4103
|
+
var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
|
|
4104
|
+
function escapeRegExp(text) {
|
|
4105
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4106
|
+
}
|
|
4107
|
+
function decisionRecordCitationPattern(decisionRecordsPath) {
|
|
4108
|
+
const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
|
|
4109
|
+
return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
|
|
4110
|
+
}
|
|
4111
|
+
function decisionRecordCitationRule(decisionRecordsPath) {
|
|
4112
|
+
const folder = normalizeRepoPath(decisionRecordsPath);
|
|
4113
|
+
const pattern = decisionRecordCitationPattern(folder);
|
|
4114
|
+
const severity = {};
|
|
4115
|
+
for (const scope of DECISION_RECORD_CITATION_SCOPES)
|
|
4116
|
+
severity[scope] = "error";
|
|
4117
|
+
return {
|
|
4118
|
+
id: DECISION_RECORD_CITATION_ID,
|
|
4119
|
+
group: "reader-resolvable",
|
|
4120
|
+
custom: false,
|
|
4121
|
+
builtIn: false,
|
|
4122
|
+
scopes: DECISION_RECORD_CITATION_SCOPES,
|
|
4123
|
+
message: DECISION_RECORD_CITATION_MESSAGE,
|
|
4124
|
+
severity,
|
|
4125
|
+
exempt: [folder],
|
|
4126
|
+
substringExempt: [],
|
|
4127
|
+
patternFor: () => pattern
|
|
4128
|
+
};
|
|
4129
|
+
}
|
|
4130
|
+
|
|
3433
4131
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3434
4132
|
var PRODUCT_SLUG_SCOPE = [
|
|
3435
4133
|
"apps/cli/src",
|
|
@@ -3441,8 +4139,8 @@ var PRODUCT_SLUG_SCOPE = [
|
|
|
3441
4139
|
function isUnderOrEqual(path, prefix) {
|
|
3442
4140
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3443
4141
|
}
|
|
3444
|
-
function isProductScopeFile(path) {
|
|
3445
|
-
return
|
|
4142
|
+
function isProductScopeFile(path, productPaths) {
|
|
4143
|
+
return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)));
|
|
3446
4144
|
}
|
|
3447
4145
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3448
4146
|
function shipsArchivePrefix(shipsPrefix) {
|
|
@@ -3450,13 +4148,7 @@ function shipsArchivePrefix(shipsPrefix) {
|
|
|
3450
4148
|
}
|
|
3451
4149
|
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3452
4150
|
function normalizeSpecPath(entry) {
|
|
3453
|
-
|
|
3454
|
-
while (out.startsWith("./"))
|
|
3455
|
-
out = out.slice(2);
|
|
3456
|
-
out = out.replace(/\/{2,}/g, "/");
|
|
3457
|
-
while (out.endsWith("/"))
|
|
3458
|
-
out = out.slice(0, -1);
|
|
3459
|
-
return out;
|
|
4151
|
+
return normalizeRepoPath(entry);
|
|
3460
4152
|
}
|
|
3461
4153
|
function isSpecFile2(path, specPaths) {
|
|
3462
4154
|
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
@@ -3468,7 +4160,7 @@ function isSpecFile2(path, specPaths) {
|
|
|
3468
4160
|
function isClaudeMdFile(path) {
|
|
3469
4161
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3470
4162
|
}
|
|
3471
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4163
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS, productPaths = PRODUCT_SLUG_SCOPE) {
|
|
3472
4164
|
if (path.startsWith(shipsPrefix)) {
|
|
3473
4165
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3474
4166
|
}
|
|
@@ -3479,7 +4171,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
3479
4171
|
return "internal";
|
|
3480
4172
|
if (isSpecFile2(path, specPaths))
|
|
3481
4173
|
return "spec";
|
|
3482
|
-
if (isProductScopeFile(path))
|
|
4174
|
+
if (isProductScopeFile(path, productPaths))
|
|
3483
4175
|
return "product";
|
|
3484
4176
|
return null;
|
|
3485
4177
|
}
|
|
@@ -3504,9 +4196,16 @@ function lineAt(content, index) {
|
|
|
3504
4196
|
}
|
|
3505
4197
|
return line;
|
|
3506
4198
|
}
|
|
3507
|
-
var
|
|
3508
|
-
var
|
|
3509
|
-
|
|
4199
|
+
var readerRules = rulesForGroup("reader-resolvable");
|
|
4200
|
+
var readerPattern = (id, scope = "prose") => {
|
|
4201
|
+
const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
|
|
4202
|
+
if (!(pattern instanceof RegExp))
|
|
4203
|
+
throw new Error(`default prose rule ${id} has no ${scope} pattern`);
|
|
4204
|
+
return pattern;
|
|
4205
|
+
};
|
|
4206
|
+
var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
|
|
4207
|
+
var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
|
|
4208
|
+
var TASK_NUMBER_PATTERN = readerPattern("task-number");
|
|
3510
4209
|
function legacySlugPattern(legacySlugs) {
|
|
3511
4210
|
if (legacySlugs.length === 0)
|
|
3512
4211
|
return null;
|
|
@@ -3516,48 +4215,61 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3516
4215
|
function specGrandfatherPaths(specGrandfather) {
|
|
3517
4216
|
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3518
4217
|
}
|
|
3519
|
-
|
|
4218
|
+
var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
|
|
4219
|
+
function referenceRulesFor(set, cls) {
|
|
4220
|
+
return rulesInScope(set, cls).filter((rule) => rule.group === "reader-resolvable" && rule.id !== "coined-term");
|
|
4221
|
+
}
|
|
4222
|
+
function citations(pattern, text, group) {
|
|
4223
|
+
const out = [];
|
|
4224
|
+
const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
|
|
4225
|
+
re.lastIndex = 0;
|
|
4226
|
+
let match = re.exec(text);
|
|
4227
|
+
while (match !== null) {
|
|
4228
|
+
if (match[0] === "") {
|
|
4229
|
+
re.lastIndex++;
|
|
4230
|
+
} else {
|
|
4231
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4232
|
+
out.push({ cited, index: match.index + match[0].indexOf(cited) });
|
|
4233
|
+
}
|
|
4234
|
+
match = re.exec(text);
|
|
4235
|
+
}
|
|
4236
|
+
re.lastIndex = 0;
|
|
4237
|
+
return out;
|
|
4238
|
+
}
|
|
4239
|
+
function customMessage(rule, cited) {
|
|
4240
|
+
return `${rule.id}: ${rule.message} ("${cited}")`;
|
|
4241
|
+
}
|
|
4242
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
4243
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4244
|
+
const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE;
|
|
3520
4245
|
const findings = [];
|
|
3521
4246
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3522
4247
|
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3523
4248
|
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3524
|
-
const patterns = [
|
|
3525
|
-
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3526
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3527
|
-
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3528
|
-
];
|
|
3529
|
-
const productPatterns = [
|
|
3530
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3531
|
-
];
|
|
3532
|
-
const specPatterns = [
|
|
3533
|
-
...patterns,
|
|
3534
|
-
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3535
|
-
];
|
|
3536
4249
|
for (const file of files) {
|
|
3537
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3538
|
-
if (!cls || cls
|
|
3539
|
-
continue;
|
|
3540
|
-
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
4250
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths, productPaths);
|
|
4251
|
+
if (!cls || !REFERENCE_CLASSES.has(cls))
|
|
3541
4252
|
continue;
|
|
3542
4253
|
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3543
4254
|
continue;
|
|
3544
|
-
const blocking = cls === "product" || cls === "spec";
|
|
3545
4255
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3546
|
-
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3547
4256
|
const fileFindings = [];
|
|
3548
|
-
for (const
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
4257
|
+
for (const rule of referenceRulesFor(set, cls)) {
|
|
4258
|
+
if (!ruleReads(set, rule, file.path))
|
|
4259
|
+
continue;
|
|
4260
|
+
const pattern = !rule.custom && rule.id === "legacy-batch-name" ? legacyPattern : rule.patternFor(cls);
|
|
4261
|
+
if (!pattern)
|
|
4262
|
+
continue;
|
|
4263
|
+
const blocking = rule.severity[cls] === "error";
|
|
4264
|
+
const what = cls === "product" ? `${rule.message} in product code` : rule.message;
|
|
4265
|
+
for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
|
|
3554
4266
|
fileFindings.push({
|
|
3555
4267
|
file: file.path,
|
|
3556
|
-
line: lineAt(scrubbed,
|
|
3557
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3558
|
-
blocking
|
|
4268
|
+
line: lineAt(scrubbed, index),
|
|
4269
|
+
message: rule.custom ? customMessage(rule, cited) : `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4270
|
+
blocking,
|
|
4271
|
+
rule: rule.id
|
|
3559
4272
|
});
|
|
3560
|
-
match = pattern.exec(scrubbed);
|
|
3561
4273
|
}
|
|
3562
4274
|
}
|
|
3563
4275
|
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
@@ -3598,11 +4310,17 @@ function definesOrLinksGlossary(content, term) {
|
|
|
3598
4310
|
return true;
|
|
3599
4311
|
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3600
4312
|
}
|
|
3601
|
-
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4313
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, options = {}) {
|
|
3602
4314
|
const findings = [];
|
|
4315
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4316
|
+
const rule = set.rules.find((r) => !r.custom && r.id === "coined-term");
|
|
4317
|
+
if (!rule)
|
|
4318
|
+
return findings;
|
|
3603
4319
|
for (const file of files) {
|
|
3604
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3605
|
-
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
4320
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, DEFAULT_SPEC_PATHS, options.productPaths);
|
|
4321
|
+
if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls))
|
|
4322
|
+
continue;
|
|
4323
|
+
if (!ruleReads(set, rule, file.path))
|
|
3606
4324
|
continue;
|
|
3607
4325
|
const scrubbed = stripNonProse(file.path, file.content);
|
|
3608
4326
|
for (const term of glossaryTerms) {
|
|
@@ -3615,14 +4333,15 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
|
|
|
3615
4333
|
file: file.path,
|
|
3616
4334
|
line,
|
|
3617
4335
|
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3618
|
-
blocking:
|
|
4336
|
+
blocking: rule.severity[cls] === "error",
|
|
4337
|
+
rule: rule.id
|
|
3619
4338
|
});
|
|
3620
4339
|
}
|
|
3621
4340
|
}
|
|
3622
4341
|
return findings;
|
|
3623
4342
|
}
|
|
3624
|
-
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN =
|
|
3625
|
-
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN =
|
|
4343
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
|
|
4344
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
|
|
3626
4345
|
function extractComments(path, content) {
|
|
3627
4346
|
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3628
4347
|
return content.replace(/[^\n]/g, "");
|
|
@@ -3719,39 +4438,40 @@ function extractComments(path, content) {
|
|
|
3719
4438
|
}
|
|
3720
4439
|
return out;
|
|
3721
4440
|
}
|
|
3722
|
-
function checkSourceComments(files, allowlist = []) {
|
|
4441
|
+
function checkSourceComments(files, allowlist = [], options = {}) {
|
|
3723
4442
|
const findings = [];
|
|
3724
4443
|
const allowed = new Set(allowlist);
|
|
3725
|
-
const
|
|
3726
|
-
|
|
3727
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3728
|
-
];
|
|
4444
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4445
|
+
const rules = rulesInScope(set, "source-comment").filter((rule) => rule.group === "reader-resolvable");
|
|
3729
4446
|
for (const file of files) {
|
|
3730
4447
|
if (!file.path.endsWith(".ts"))
|
|
3731
4448
|
continue;
|
|
3732
4449
|
if (allowed.has(file.path))
|
|
3733
4450
|
continue;
|
|
3734
4451
|
const comments = extractComments(file.path, file.content);
|
|
3735
|
-
for (const
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
4452
|
+
for (const rule of rules) {
|
|
4453
|
+
if (!ruleReads(set, rule, file.path))
|
|
4454
|
+
continue;
|
|
4455
|
+
const pattern = rule.patternFor("source-comment");
|
|
4456
|
+
if (!pattern)
|
|
4457
|
+
continue;
|
|
4458
|
+
for (const { cited, index } of citations(pattern, comments)) {
|
|
3739
4459
|
findings.push({
|
|
3740
4460
|
file: file.path,
|
|
3741
|
-
line: lineAt(comments,
|
|
3742
|
-
message: `comment cites ${
|
|
3743
|
-
blocking:
|
|
4461
|
+
line: lineAt(comments, index),
|
|
4462
|
+
message: rule.custom ? customMessage(rule, cited) : `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4463
|
+
blocking: rule.severity["source-comment"] === "error",
|
|
4464
|
+
rule: rule.id
|
|
3744
4465
|
});
|
|
3745
|
-
match = pattern.exec(comments);
|
|
3746
4466
|
}
|
|
3747
4467
|
}
|
|
3748
4468
|
}
|
|
3749
4469
|
return findings;
|
|
3750
4470
|
}
|
|
3751
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4471
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
3752
4472
|
return [
|
|
3753
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3754
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4473
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths, options),
|
|
4474
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
|
|
3755
4475
|
];
|
|
3756
4476
|
}
|
|
3757
4477
|
function parseGlossaryTerms(glossaryContent) {
|
|
@@ -3954,6 +4674,17 @@ function checkDocClaims(files, fileReader) {
|
|
|
3954
4674
|
};
|
|
3955
4675
|
}
|
|
3956
4676
|
|
|
4677
|
+
// ../../packages/aeg-core/src/protected-paths.ts
|
|
4678
|
+
import { posix as posixPath } from "node:path";
|
|
4679
|
+
var PROTECTED_ADMIN_PATHS = ["vinaya.config.json", ".vinaya/doc-owners", ".github/", "aeg-root/"];
|
|
4680
|
+
function normalizeTouchedPath(path) {
|
|
4681
|
+
return posixPath.resolve("/", path.replace(/\\/g, "/")).replace(/^\/+/, "");
|
|
4682
|
+
}
|
|
4683
|
+
function isProtectedAdminPath(path) {
|
|
4684
|
+
const normalized = normalizeTouchedPath(path);
|
|
4685
|
+
return PROTECTED_ADMIN_PATHS.some((prefix) => normalized === prefix || normalized.startsWith(prefix));
|
|
4686
|
+
}
|
|
4687
|
+
|
|
3957
4688
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3958
4689
|
function hasRationaleField(body, labelPattern) {
|
|
3959
4690
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -4073,13 +4804,20 @@ function globCoversPath(glob, path) {
|
|
|
4073
4804
|
return !p.includes("/");
|
|
4074
4805
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
4075
4806
|
}
|
|
4807
|
+
function surfaceEntryResolves(entry, resolvesToFile, pinnedFiles) {
|
|
4808
|
+
if (resolvesToFile(entry))
|
|
4809
|
+
return true;
|
|
4810
|
+
const directory = entry.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
4811
|
+
return pinnedFiles.some((path) => path.startsWith(`${directory}/`));
|
|
4812
|
+
}
|
|
4076
4813
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
4077
4814
|
const surface = parseIssueSurface(body);
|
|
4078
4815
|
if (!surface.ok)
|
|
4079
4816
|
return { status: "pass", errors: [] };
|
|
4817
|
+
const pinnedFiles = boundaryPinnedFiles(body);
|
|
4080
4818
|
const errors = [];
|
|
4081
4819
|
for (const glob of surface.value.in) {
|
|
4082
|
-
if (!
|
|
4820
|
+
if (!surfaceEntryResolves(glob, resolvesToFile, pinnedFiles)) {
|
|
4083
4821
|
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
4084
4822
|
}
|
|
4085
4823
|
}
|
|
@@ -4109,6 +4847,14 @@ function recordedBeyondSurfacePaths(body) {
|
|
|
4109
4847
|
return paths;
|
|
4110
4848
|
}
|
|
4111
4849
|
function checkSurfaceScope(changedFiles, surface, recorded) {
|
|
4850
|
+
for (const path of changedFiles) {
|
|
4851
|
+
if (!isProtectedAdminPath(path))
|
|
4852
|
+
continue;
|
|
4853
|
+
const normalized = normalizeTouchedPath(path);
|
|
4854
|
+
if (!surface.in.some((glob) => globCoversPath(glob, normalized))) {
|
|
4855
|
+
return { ok: false, violation: { path, reason: "protected" } };
|
|
4856
|
+
}
|
|
4857
|
+
}
|
|
4112
4858
|
const listed = new Set(recorded);
|
|
4113
4859
|
const violation = beyondSurfacePaths(changedFiles, surface).find((entry) => !listed.has(entry.path));
|
|
4114
4860
|
return violation ? { ok: false, violation } : { ok: true };
|
|
@@ -4164,12 +4910,22 @@ function checkPartsCiteDefinedObjectives(body) {
|
|
|
4164
4910
|
}
|
|
4165
4911
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
4166
4912
|
}
|
|
4913
|
+
var ISSUE_LIVE_LINE_RE = /^-\s*\*{2}\[live\]\*{2}(.*)$/gim;
|
|
4914
|
+
function liveCommand(text) {
|
|
4915
|
+
const trimmed = text.trim();
|
|
4916
|
+
const span = /^(`+)(.+)\1$/.exec(trimmed);
|
|
4917
|
+
return span ? span[2].trim() : trimmed;
|
|
4918
|
+
}
|
|
4919
|
+
function liveItemsIn(region) {
|
|
4920
|
+
return [...region.matchAll(ISSUE_LIVE_LINE_RE)].map((m) => liveCommand(m[1] ?? "")).filter(Boolean);
|
|
4921
|
+
}
|
|
4922
|
+
function parseLiveTestPlanItems(body) {
|
|
4923
|
+
const located = locateTestPlanSection(body);
|
|
4924
|
+
return located.found ? liveItemsIn(located.section) : [];
|
|
4925
|
+
}
|
|
4167
4926
|
function isTaskIssueLabelSet(labels) {
|
|
4168
4927
|
return hasLabel("tranche", labels);
|
|
4169
4928
|
}
|
|
4170
|
-
function checkTrancheLabelPresence(_body, _labels) {
|
|
4171
|
-
return { status: "pass", errors: [] };
|
|
4172
|
-
}
|
|
4173
4929
|
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
4174
4930
|
if (!isTaskIssueLabelSet(labels))
|
|
4175
4931
|
return { status: "pass", errors: [] };
|
|
@@ -4185,6 +4941,7 @@ function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTi
|
|
|
4185
4941
|
};
|
|
4186
4942
|
}
|
|
4187
4943
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
4944
|
+
var PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" });
|
|
4188
4945
|
function isControlCodePoint(codePoint) {
|
|
4189
4946
|
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
4190
4947
|
}
|
|
@@ -4245,8 +5002,14 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
4245
5002
|
}
|
|
4246
5003
|
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
4247
5004
|
}
|
|
5005
|
+
function rationaleFieldText(text, labelPattern) {
|
|
5006
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})[^\\n]*\\n?([\\s\\S]*?)(?=\\n\\s*(?:\\*\\*[A-Z]|#{1,4}\\s)|(?![\\s\\S]))`, "im");
|
|
5007
|
+
const m = re.exec(text);
|
|
5008
|
+
return m ? m[0] : "";
|
|
5009
|
+
}
|
|
4248
5010
|
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
4249
5011
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
5012
|
+
var RATIONALE_PATH_RE_GLOBAL = /`([\w.@-]+(?:\/[\w.@-]+)+)`/g;
|
|
4250
5013
|
function normalizeEdgeId(s) {
|
|
4251
5014
|
const qualified = splitSlugQualifiedEdge(s);
|
|
4252
5015
|
return (qualified ? qualified.bareId : s).replace(/^#/, "").trim();
|
|
@@ -4254,6 +5017,15 @@ function normalizeEdgeId(s) {
|
|
|
4254
5017
|
function edgesNameEachOther(a, b) {
|
|
4255
5018
|
return a.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(b.ref)) || b.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(a.ref));
|
|
4256
5019
|
}
|
|
5020
|
+
var BOUNDARY_OUT_RE = /\bOut\s*:\s*([\s\S]*)$/im;
|
|
5021
|
+
function boundaryOutText(body) {
|
|
5022
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5023
|
+
const m = BOUNDARY_OUT_RE.exec(boundary);
|
|
5024
|
+
return m ? m[1] : "";
|
|
5025
|
+
}
|
|
5026
|
+
function namedPathsIn(text) {
|
|
5027
|
+
return [...new Set([...text.matchAll(RATIONALE_PATH_RE_GLOBAL)].map((m) => m[1]))].filter((p) => !/^https?:\/\//i.test(p));
|
|
5028
|
+
}
|
|
4257
5029
|
var FILE_EXTENSIONS = new Set([
|
|
4258
5030
|
"ts",
|
|
4259
5031
|
"tsx",
|
|
@@ -4275,6 +5047,11 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4275
5047
|
"html",
|
|
4276
5048
|
"css"
|
|
4277
5049
|
]);
|
|
5050
|
+
function boundaryPinnedFiles(body) {
|
|
5051
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5052
|
+
const excluded = new Set(namedPathsIn(boundaryOutText(body)));
|
|
5053
|
+
return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
|
|
5054
|
+
}
|
|
4278
5055
|
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4279
5056
|
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4280
5057
|
|
|
@@ -4299,7 +5076,7 @@ function isGrandfathered(isoDate) {
|
|
|
4299
5076
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
4300
5077
|
}
|
|
4301
5078
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4302
|
-
function checkA1(entries, principalAllowlist
|
|
5079
|
+
function checkA1(entries, principalAllowlist) {
|
|
4303
5080
|
const failures = [];
|
|
4304
5081
|
for (const e of entries) {
|
|
4305
5082
|
if (!e.facts)
|
|
@@ -4329,6 +5106,37 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
|
4329
5106
|
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4330
5107
|
};
|
|
4331
5108
|
}
|
|
5109
|
+
function checkA2(entries, hasProvenanceByKey) {
|
|
5110
|
+
const failures = [];
|
|
5111
|
+
for (const e of entries) {
|
|
5112
|
+
if (!e.facts)
|
|
5113
|
+
continue;
|
|
5114
|
+
if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
|
|
5115
|
+
continue;
|
|
5116
|
+
const key = `${e.trancheSlug}/${e.task.id}`;
|
|
5117
|
+
const hasProvenance = hasProvenanceByKey.get(key);
|
|
5118
|
+
if (hasProvenance === undefined)
|
|
5119
|
+
continue;
|
|
5120
|
+
if (!hasProvenance) {
|
|
5121
|
+
failures.push({
|
|
5122
|
+
code: "archived-without-provenance",
|
|
5123
|
+
issue: e.task.issue,
|
|
5124
|
+
tranche: e.trancheSlug,
|
|
5125
|
+
task: e.task.id,
|
|
5126
|
+
reason: "Closing PR has no `### AEG provenance` comment (Archivist close-out missing)",
|
|
5127
|
+
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
5128
|
+
});
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
5132
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
5133
|
+
return {
|
|
5134
|
+
check: "A2",
|
|
5135
|
+
status,
|
|
5136
|
+
failures,
|
|
5137
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
5138
|
+
};
|
|
5139
|
+
}
|
|
4332
5140
|
function checkA3(entries) {
|
|
4333
5141
|
const failures = [];
|
|
4334
5142
|
for (const e of entries) {
|
|
@@ -4544,6 +5352,33 @@ function checkL1(files, entriesBySlug) {
|
|
|
4544
5352
|
note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
|
|
4545
5353
|
};
|
|
4546
5354
|
}
|
|
5355
|
+
function checkL2(files, entriesBySlug) {
|
|
5356
|
+
const failures = [];
|
|
5357
|
+
for (const f of files) {
|
|
5358
|
+
if (!f.archived)
|
|
5359
|
+
continue;
|
|
5360
|
+
const entries = entriesBySlug.get(f.slug) ?? [];
|
|
5361
|
+
for (const e of entries) {
|
|
5362
|
+
if (!e.facts)
|
|
5363
|
+
continue;
|
|
5364
|
+
if (e.facts.issueState === "open") {
|
|
5365
|
+
failures.push({
|
|
5366
|
+
code: "premature-archive",
|
|
5367
|
+
issue: e.task.issue,
|
|
5368
|
+
tranche: f.slug,
|
|
5369
|
+
task: e.task.id,
|
|
5370
|
+
reason: `Archived tranche has open task-Issue #${e.task.issue ?? "?"} (premature archive)`
|
|
5371
|
+
});
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5375
|
+
return {
|
|
5376
|
+
check: "L2",
|
|
5377
|
+
status: "info",
|
|
5378
|
+
failures,
|
|
5379
|
+
note: failures.length > 0 ? `${failures.length} archived tranche(s) with an open task-Issue — investigate (advisory)` : undefined
|
|
5380
|
+
};
|
|
5381
|
+
}
|
|
4547
5382
|
function checkL3(files) {
|
|
4548
5383
|
const active = files.filter((f) => !f.archived);
|
|
4549
5384
|
return {
|
|
@@ -4553,6 +5388,51 @@ function checkL3(files) {
|
|
|
4553
5388
|
note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
|
|
4554
5389
|
};
|
|
4555
5390
|
}
|
|
5391
|
+
function checkL4(activeTrancheSlugs, issueMilestones) {
|
|
5392
|
+
const activeSet = new Set(activeTrancheSlugs);
|
|
5393
|
+
const failures = [];
|
|
5394
|
+
for (const f of issueMilestones) {
|
|
5395
|
+
if (!activeSet.has(f.tranche))
|
|
5396
|
+
continue;
|
|
5397
|
+
if (f.milestoneTitle === f.tranche)
|
|
5398
|
+
continue;
|
|
5399
|
+
failures.push({
|
|
5400
|
+
code: "milestone-drift",
|
|
5401
|
+
issue: f.issue,
|
|
5402
|
+
tranche: f.tranche,
|
|
5403
|
+
reason: f.milestoneTitle === null ? `Issue #${f.issue} carries ${trancheLabel(f.tranche)} (active) but has no GitHub-native milestone attached` : `Issue #${f.issue} carries ${trancheLabel(f.tranche)} (active) but is attached to Milestone "${f.milestoneTitle}" instead`
|
|
5404
|
+
});
|
|
5405
|
+
}
|
|
5406
|
+
return {
|
|
5407
|
+
check: "L4",
|
|
5408
|
+
status: "info",
|
|
5409
|
+
failures,
|
|
5410
|
+
note: failures.length > 0 ? `${failures.length} open task-Issue(s) in an active tranche whose GitHub-native milestone doesn't match their ${label("tranche")}<slug> label (cosmetic drift, advisory)` : undefined
|
|
5411
|
+
};
|
|
5412
|
+
}
|
|
5413
|
+
function checkL5(activeTrancheSlugs, entriesBySlug) {
|
|
5414
|
+
const failures = [];
|
|
5415
|
+
for (const slug of activeTrancheSlugs) {
|
|
5416
|
+
const entries = entriesBySlug.get(slug) ?? [];
|
|
5417
|
+
const withFacts = entries.filter((e) => e.facts !== undefined);
|
|
5418
|
+
if (withFacts.length === 0)
|
|
5419
|
+
continue;
|
|
5420
|
+
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
5421
|
+
if (allClosed) {
|
|
5422
|
+
failures.push({
|
|
5423
|
+
code: "tranche-not-archived",
|
|
5424
|
+
tranche: slug,
|
|
5425
|
+
reason: "Every task Issue is closed but the tranche is not recorded as complete — archive it"
|
|
5426
|
+
});
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
return {
|
|
5430
|
+
check: "L5",
|
|
5431
|
+
status: failures.length > 0 ? "fail" : "pass",
|
|
5432
|
+
failures,
|
|
5433
|
+
note: failures.length > 0 ? `${failures.length} tranche(s) whose task Issues are all closed but were never archived` : undefined
|
|
5434
|
+
};
|
|
5435
|
+
}
|
|
4556
5436
|
function extractClosesReferences(prBody) {
|
|
4557
5437
|
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#(\d+)/gi;
|
|
4558
5438
|
const stripped = stripCode(prBody);
|
|
@@ -4648,6 +5528,58 @@ function extractIssue(body) {
|
|
|
4648
5528
|
}
|
|
4649
5529
|
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4650
5530
|
import { createHash as createHash4 } from "node:crypto";
|
|
5531
|
+
|
|
5532
|
+
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
5533
|
+
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
5534
|
+
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
5535
|
+
let best = 0;
|
|
5536
|
+
for (const c of comments) {
|
|
5537
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5538
|
+
continue;
|
|
5539
|
+
const firstLine = (c.body.split(`
|
|
5540
|
+
`)[0] ?? "").trim();
|
|
5541
|
+
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
5542
|
+
if (!m)
|
|
5543
|
+
continue;
|
|
5544
|
+
const k = Number.parseInt(m[1], 10);
|
|
5545
|
+
if (k > best)
|
|
5546
|
+
best = k;
|
|
5547
|
+
}
|
|
5548
|
+
return best;
|
|
5549
|
+
}
|
|
5550
|
+
function parseRulingIdentity(rulingId) {
|
|
5551
|
+
const m = /^(issue-)?(\d+)-(\d+)$/.exec(rulingId);
|
|
5552
|
+
if (!m)
|
|
5553
|
+
return null;
|
|
5554
|
+
const ref = Number.parseInt(m[2], 10);
|
|
5555
|
+
const ordinal = Number.parseInt(m[3], 10);
|
|
5556
|
+
if (ref <= 0 || ordinal <= 0)
|
|
5557
|
+
return null;
|
|
5558
|
+
return { target: m[1] ? "issue" : "pr", ref, ordinal };
|
|
5559
|
+
}
|
|
5560
|
+
function principalRulingTextById(comments, allowlist, rulingId) {
|
|
5561
|
+
const identity = parseRulingIdentity(rulingId);
|
|
5562
|
+
if (identity === null)
|
|
5563
|
+
return null;
|
|
5564
|
+
const matches = comments.filter((c) => {
|
|
5565
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5566
|
+
return false;
|
|
5567
|
+
const m = RULING_MARKER_ORDINAL.exec((c.body.split(`
|
|
5568
|
+
`)[0] ?? "").trim());
|
|
5569
|
+
return m !== null && Number.parseInt(m[1], 10) === identity.ordinal;
|
|
5570
|
+
});
|
|
5571
|
+
if (matches.length !== 1)
|
|
5572
|
+
return null;
|
|
5573
|
+
const body = matches[0].body;
|
|
5574
|
+
const idx = body.indexOf(`
|
|
5575
|
+
`);
|
|
5576
|
+
return idx === -1 ? "" : body.slice(idx + 1).trim();
|
|
5577
|
+
}
|
|
5578
|
+
|
|
5579
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
5580
|
+
function pauseBoundRulingDigest(rulingText) {
|
|
5581
|
+
return createHash4("sha256").update(rulingText).digest("hex");
|
|
5582
|
+
}
|
|
4651
5583
|
function briefHash(brief) {
|
|
4652
5584
|
return createHash4("sha256").update(`${brief}
|
|
4653
5585
|
`).digest("hex");
|
|
@@ -4708,14 +5640,19 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4708
5640
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4709
5641
|
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4710
5642
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
5643
|
+
const legacyCurrent = current.manifestVersion === undefined;
|
|
5644
|
+
const manifestVersion = legacyCurrent ? echoed.manifestVersion === undefined || echoed.manifestVersion === null : echoed.manifestVersion === current.manifestVersion;
|
|
5645
|
+
const pauseBoundRuling = legacyCurrent ? true : Object.hasOwn(echoed, "pauseBoundRuling") && JSON.stringify(echoed.pauseBoundRuling) === JSON.stringify(current.pauseBoundRuling);
|
|
4711
5646
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4712
5647
|
return {
|
|
4713
|
-
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
5648
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && pauseBoundRuling && manifestVersion && policyDigestBound,
|
|
4714
5649
|
head,
|
|
4715
5650
|
base,
|
|
4716
5651
|
briefHash: briefHashBound,
|
|
4717
5652
|
objectivesVersion,
|
|
4718
5653
|
rulingOrdinal,
|
|
5654
|
+
pauseBoundRuling,
|
|
5655
|
+
manifestVersion,
|
|
4719
5656
|
policyDigest: policyDigestBound
|
|
4720
5657
|
};
|
|
4721
5658
|
}
|
|
@@ -4731,7 +5668,7 @@ function renderGateDeferred(deferred) {
|
|
|
4731
5668
|
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4732
5669
|
}
|
|
4733
5670
|
function checkReviewGate(input) {
|
|
4734
|
-
const principalAllowlist = input
|
|
5671
|
+
const { principalAllowlist } = input;
|
|
4735
5672
|
const waived = isWaiverLabelActorVerified({
|
|
4736
5673
|
label: WAIVER_LABEL_REVIEW,
|
|
4737
5674
|
labels: input.labels,
|
|
@@ -4770,27 +5707,33 @@ function checkReviewGate(input) {
|
|
|
4770
5707
|
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4771
5708
|
const securityClean = securityTextClean && securityPolicyClean;
|
|
4772
5709
|
const currentManifest = {
|
|
5710
|
+
...input.manifestVersion === undefined ? {} : { manifestVersion: input.manifestVersion },
|
|
4773
5711
|
headSha: input.headSha,
|
|
4774
5712
|
baseSha: input.baseSha ?? null,
|
|
4775
5713
|
briefHash: input.briefHash ?? null,
|
|
4776
5714
|
objectivesVersion: input.objectivesVersion,
|
|
4777
5715
|
rulingOrdinal: input.rulingOrdinal,
|
|
5716
|
+
pauseBoundRuling: input.pauseBoundRuling ?? null,
|
|
4778
5717
|
policyDigest: policyDigest(policy)
|
|
4779
5718
|
};
|
|
4780
5719
|
const codeReviewEchoed = {
|
|
5720
|
+
manifestVersion: codeReview.manifestVersion,
|
|
4781
5721
|
headSha: codeReview.headSha,
|
|
4782
5722
|
baseSha: codeReview.baseSha,
|
|
4783
5723
|
briefHash: codeReview.briefHash,
|
|
4784
5724
|
objectivesVersion: codeReview.objectivesVersion,
|
|
4785
5725
|
rulingOrdinal: codeReview.rulingOrdinal,
|
|
5726
|
+
pauseBoundRuling: codeReview.pauseBoundRuling,
|
|
4786
5727
|
policyDigest: codeReview.policyDigest
|
|
4787
5728
|
};
|
|
4788
5729
|
const securityEchoed = {
|
|
5730
|
+
manifestVersion: security.manifestVersion,
|
|
4789
5731
|
headSha: security.headSha,
|
|
4790
5732
|
baseSha: security.baseSha,
|
|
4791
5733
|
briefHash: security.briefHash,
|
|
4792
5734
|
objectivesVersion: security.objectivesVersion,
|
|
4793
5735
|
rulingOrdinal: security.rulingOrdinal,
|
|
5736
|
+
pauseBoundRuling: security.pauseBoundRuling,
|
|
4794
5737
|
policyDigest: security.policyDigest
|
|
4795
5738
|
};
|
|
4796
5739
|
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
@@ -4829,6 +5772,10 @@ function checkReviewGate(input) {
|
|
|
4829
5772
|
problems.push(`the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4830
5773
|
} else if (!codeReviewBinding.policyDigest) {
|
|
4831
5774
|
problems.push(`the newest code-review verdict was cast against review policy digest ${codeReview.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
5775
|
+
} else if (!codeReviewBinding.manifestVersion) {
|
|
5776
|
+
problems.push(`the newest code-review verdict echoes manifest version ${codeReview.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5777
|
+
} else if (!codeReviewBinding.pauseBoundRuling) {
|
|
5778
|
+
problems.push(`the newest code-review verdict echoes pauseBoundRuling ${renderBinding(codeReview.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4832
5779
|
}
|
|
4833
5780
|
if (!securityTextClean) {
|
|
4834
5781
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
@@ -4846,6 +5793,10 @@ function checkReviewGate(input) {
|
|
|
4846
5793
|
problems.push(`the newest security-review verdict was cast against brief hash ${security.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4847
5794
|
} else if (!securityBinding.policyDigest) {
|
|
4848
5795
|
problems.push(`the newest security-review verdict was cast against review policy digest ${security.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
5796
|
+
} else if (!securityBinding.manifestVersion) {
|
|
5797
|
+
problems.push(`the newest security-review verdict echoes manifest version ${security.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5798
|
+
} else if (!securityBinding.pauseBoundRuling) {
|
|
5799
|
+
problems.push(`the newest security-review verdict echoes pauseBoundRuling ${renderBinding(security.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4849
5800
|
}
|
|
4850
5801
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4851
5802
|
return {
|
|
@@ -4854,29 +5805,16 @@ function checkReviewGate(input) {
|
|
|
4854
5805
|
waived: false
|
|
4855
5806
|
};
|
|
4856
5807
|
}
|
|
5808
|
+
function renderBinding(binding) {
|
|
5809
|
+
if (binding === undefined)
|
|
5810
|
+
return "(absent)";
|
|
5811
|
+
return binding === null ? "(none)" : `${binding.rulingId}|${binding.pauseId}|${binding.contentDigest}`;
|
|
5812
|
+
}
|
|
4857
5813
|
var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
|
|
4858
5814
|
var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
|
|
4859
5815
|
function isChangesetsReleasePr(branch, author, expectedAuthor) {
|
|
4860
5816
|
return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
|
|
4861
5817
|
}
|
|
4862
|
-
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
4863
|
-
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
4864
|
-
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
4865
|
-
let best = 0;
|
|
4866
|
-
for (const c of comments) {
|
|
4867
|
-
if (!isPrincipal(c.author, allowlist))
|
|
4868
|
-
continue;
|
|
4869
|
-
const firstLine = (c.body.split(`
|
|
4870
|
-
`)[0] ?? "").trim();
|
|
4871
|
-
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
4872
|
-
if (!m)
|
|
4873
|
-
continue;
|
|
4874
|
-
const k = Number.parseInt(m[1], 10);
|
|
4875
|
-
if (k > best)
|
|
4876
|
-
best = k;
|
|
4877
|
-
}
|
|
4878
|
-
return best;
|
|
4879
|
-
}
|
|
4880
5818
|
// ../../packages/aeg-core/src/markdown-table.ts
|
|
4881
5819
|
function splitRow(line) {
|
|
4882
5820
|
const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
@@ -5028,7 +5966,6 @@ var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
|
5028
5966
|
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
5029
5967
|
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
5030
5968
|
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
5031
|
-
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
5032
5969
|
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
5033
5970
|
};
|
|
5034
5971
|
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
@@ -5252,72 +6189,10 @@ function compareToBaseline(current, baseline) {
|
|
|
5252
6189
|
};
|
|
5253
6190
|
}
|
|
5254
6191
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
5255
|
-
var
|
|
5256
|
-
var RETIRED_PATTERNS =
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
"decision (entry|logged)",
|
|
5260
|
-
"decision-log entry",
|
|
5261
|
-
"decision log entry",
|
|
5262
|
-
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
5263
|
-
"decision-log",
|
|
5264
|
-
"decision entr",
|
|
5265
|
-
"decisions? (are |is )?logged",
|
|
5266
|
-
"log entries",
|
|
5267
|
-
String.raw`decisions\.md`,
|
|
5268
|
-
"decisions-legacy",
|
|
5269
|
-
"CONTRADICTION",
|
|
5270
|
-
"assumes Tier 3",
|
|
5271
|
-
"Lock: ?YES",
|
|
5272
|
-
"Lock: ?NO",
|
|
5273
|
-
"lock approvals?",
|
|
5274
|
-
"approves locks",
|
|
5275
|
-
"Conforms to lock",
|
|
5276
|
-
"Challenges lock",
|
|
5277
|
-
"checkDecisionNumbersFresh",
|
|
5278
|
-
String.raw`roles/team-leader\.md`,
|
|
5279
|
-
String.raw`\(,`,
|
|
5280
|
-
String.raw`,\)`,
|
|
5281
|
-
String.raw`\(\.\)`,
|
|
5282
|
-
...PLAN_ON_DISK_PATTERNS
|
|
5283
|
-
];
|
|
5284
|
-
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
5285
|
-
var RETIRED_EXEMPT_SUBSTRINGS = [
|
|
5286
|
-
"docs/decisions-legacy.md",
|
|
5287
|
-
"apps/herald-ai/docs/",
|
|
5288
|
-
"apps/vada-ai/docs/",
|
|
5289
|
-
"aeg-root/tranches/completed/",
|
|
5290
|
-
"packages/aeg-core/src/docs/published-prose",
|
|
5291
|
-
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
5292
|
-
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
5293
|
-
"/fixtures/",
|
|
5294
|
-
"/node_modules/",
|
|
5295
|
-
"/.next/",
|
|
5296
|
-
"/.turbo/"
|
|
5297
|
-
];
|
|
5298
|
-
var PATTERN_EXEMPT = {
|
|
5299
|
-
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
5300
|
-
[String.raw`decisions\.md`]: [
|
|
5301
|
-
"docs-index.md",
|
|
5302
|
-
"apps/vada-ai/specs/legacy/README.md",
|
|
5303
|
-
"apps/vada-ai/specs/vada-product-spec.md",
|
|
5304
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5305
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5306
|
-
],
|
|
5307
|
-
"decisions-legacy": [
|
|
5308
|
-
"packages/aeg-core/src/file-classify.ts",
|
|
5309
|
-
"packages/aeg-core/src/file-classify.test.ts",
|
|
5310
|
-
"packages/aeg-core/src/pr-tier.test.ts",
|
|
5311
|
-
"docs-index.md",
|
|
5312
|
-
".claude/skills/database/SKILL.md",
|
|
5313
|
-
".claude/skills/vada-architecture/SKILL.md",
|
|
5314
|
-
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
5315
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5316
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5317
|
-
],
|
|
5318
|
-
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
5319
|
-
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
5320
|
-
};
|
|
6192
|
+
var retiredRules = rulesForGroup("retired-vocabulary");
|
|
6193
|
+
var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
|
|
6194
|
+
var PATTERN_EXEMPT = RETIRED_PATTERN_EXEMPTIONS;
|
|
6195
|
+
var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
|
|
5321
6196
|
function lineNumbers(content, pattern) {
|
|
5322
6197
|
const out = [];
|
|
5323
6198
|
const lines = content.split(`
|
|
@@ -5328,22 +6203,29 @@ function lineNumbers(content, pattern) {
|
|
|
5328
6203
|
}
|
|
5329
6204
|
return out;
|
|
5330
6205
|
}
|
|
5331
|
-
function scanRetiredVocabulary(files) {
|
|
6206
|
+
function scanRetiredVocabulary(files, rules = DEFAULT_PROSE_RULE_SET) {
|
|
5332
6207
|
const findings = [];
|
|
6208
|
+
const retired = rulesOfGroup(rules, "retired-vocabulary");
|
|
5333
6209
|
for (const file of files) {
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
6210
|
+
for (const rule of retired) {
|
|
6211
|
+
if (rule.substringExempt.some((e) => file.path.includes(e)))
|
|
6212
|
+
continue;
|
|
6213
|
+
if (!ruleReads(rules, rule, file.path))
|
|
6214
|
+
continue;
|
|
6215
|
+
const re = rule.patternFor("repository");
|
|
6216
|
+
if (!re)
|
|
6217
|
+
continue;
|
|
6218
|
+
const pattern = rule.custom ? re.source : DEFAULT_PATTERN_OF.get(rule.id) ?? re.source;
|
|
6219
|
+
if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e)))
|
|
5339
6220
|
continue;
|
|
5340
|
-
const re = new RegExp(pattern);
|
|
5341
6221
|
for (const line of lineNumbers(file.content, re)) {
|
|
5342
6222
|
findings.push({
|
|
5343
6223
|
file: file.path,
|
|
5344
6224
|
line,
|
|
5345
6225
|
pattern,
|
|
5346
|
-
message: `claims a retired AEG mechanism is still live (matches /${pattern}/)
|
|
6226
|
+
message: rule.custom ? `${rule.id}: ${rule.message} (matches /${pattern}/)` : `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
|
|
6227
|
+
rule: rule.id,
|
|
6228
|
+
blocking: rule.severity.repository === "error"
|
|
5347
6229
|
});
|
|
5348
6230
|
}
|
|
5349
6231
|
}
|
|
@@ -5367,7 +6249,7 @@ function isSelfDependency(dep, task, issue) {
|
|
|
5367
6249
|
function checkDispatchReadiness(input) {
|
|
5368
6250
|
const { trancheSlug, task } = input;
|
|
5369
6251
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
5370
|
-
const principalAllowlist = input
|
|
6252
|
+
const { principalAllowlist } = input;
|
|
5371
6253
|
const blockerDetails = [];
|
|
5372
6254
|
const push = (blockerClass, message) => {
|
|
5373
6255
|
blockerDetails.push({ class: blockerClass, message });
|
|
@@ -5459,6 +6341,16 @@ function pushesAnyBranchRef(pushRefs) {
|
|
|
5459
6341
|
return pushRefs.split(`
|
|
5460
6342
|
`).map((line) => line.trim()).filter((line) => line.length > 0).some((line) => line.split(/\s+/)[2]?.startsWith("refs/heads/") === true);
|
|
5461
6343
|
}
|
|
6344
|
+
function resolveDefaultBranch(facts) {
|
|
6345
|
+
const { originHead, hasOriginMain, hasOriginMaster } = facts;
|
|
6346
|
+
if (originHead !== null && originHead !== "")
|
|
6347
|
+
return originHead;
|
|
6348
|
+
if (hasOriginMain)
|
|
6349
|
+
return "main";
|
|
6350
|
+
if (hasOriginMaster)
|
|
6351
|
+
return "master";
|
|
6352
|
+
return null;
|
|
6353
|
+
}
|
|
5462
6354
|
function checkMainBranchRefusal(facts) {
|
|
5463
6355
|
const { currentSymbolicBranch, defaultBranch, pushRefs = null } = facts;
|
|
5464
6356
|
if (currentSymbolicBranch === null)
|
|
@@ -5719,54 +6611,61 @@ function checkFirstPushDispatchGate(input) {
|
|
|
5719
6611
|
reason: `verify-dispatch reports READY TO DISPATCH for \`${branch}\`.`
|
|
5720
6612
|
};
|
|
5721
6613
|
}
|
|
5722
|
-
// ../../packages/aeg-core/src/
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
6614
|
+
// ../../packages/aeg-core/src/live-record.ts
|
|
6615
|
+
var RECORD_LINE_RE = /^-\s*\[([ xX])\]\s*\*\*\[live\]\*\*\s+(`+) ?(.+?) ?\2(?!`)\s+—\s+(passed|failed|unverified)\s+at\s+`([^`]+)`/;
|
|
6616
|
+
function liveMarkers(body) {
|
|
6617
|
+
const masked = maskCode(body);
|
|
6618
|
+
return [...masked.matchAll(/<!--\s*AEG:LIVE:(?:START|END)\s*-->/g)].map((m) => ({
|
|
6619
|
+
start: m.index,
|
|
6620
|
+
end: m.index + m[0].length
|
|
6621
|
+
}));
|
|
6622
|
+
}
|
|
6623
|
+
var AMBIGUOUS_RECORD_LINE = {
|
|
6624
|
+
line: "- [ ] **[live]** the pull request body carries more than one `AEG:LIVE` marker pair, so the driver's record cannot be told apart",
|
|
6625
|
+
ticked: false,
|
|
6626
|
+
command: "",
|
|
6627
|
+
outcome: "failed",
|
|
6628
|
+
head: ""
|
|
6629
|
+
};
|
|
6630
|
+
function readLiveRecord(body) {
|
|
6631
|
+
const markers = liveMarkers(body).length;
|
|
6632
|
+
if (markers === 0)
|
|
6633
|
+
return [];
|
|
6634
|
+
if (markers !== 2)
|
|
6635
|
+
return [AMBIGUOUS_RECORD_LINE];
|
|
6636
|
+
const region = anchoredRegion(body, "LIVE");
|
|
6637
|
+
if (region === null)
|
|
6638
|
+
return [];
|
|
6639
|
+
const lines = [];
|
|
6640
|
+
for (const raw of region.split(`
|
|
6641
|
+
`)) {
|
|
6642
|
+
const line = raw.trim();
|
|
6643
|
+
const m = RECORD_LINE_RE.exec(line);
|
|
6644
|
+
if (!m)
|
|
6645
|
+
continue;
|
|
6646
|
+
lines.push({
|
|
6647
|
+
line,
|
|
6648
|
+
ticked: m[1].toLowerCase() === "x",
|
|
6649
|
+
command: m[3],
|
|
6650
|
+
outcome: m[4],
|
|
6651
|
+
head: m[5]
|
|
6652
|
+
});
|
|
5760
6653
|
}
|
|
5761
|
-
return
|
|
5762
|
-
action: "assign",
|
|
5763
|
-
issue,
|
|
5764
|
-
login,
|
|
5765
|
-
reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
|
|
5766
|
-
};
|
|
6654
|
+
return lines;
|
|
5767
6655
|
}
|
|
5768
6656
|
// ../../packages/aeg-core/src/test-plan-gate.ts
|
|
5769
|
-
function
|
|
6657
|
+
function gradedLiveLines(record, live) {
|
|
6658
|
+
if (live === undefined)
|
|
6659
|
+
return record.map((entry) => entry.line);
|
|
6660
|
+
const commands = new Set(live.liveCommands);
|
|
6661
|
+
const others = record.filter((entry) => !commands.has(entry.command)).map((entry) => entry.line);
|
|
6662
|
+
const graded = live.liveCommands.map((command) => {
|
|
6663
|
+
const atHead = record.filter((entry) => entry.command === command && entry.head === live.head);
|
|
6664
|
+
return (atHead.find((entry) => entry.ticked) ?? atHead[0])?.line ?? `- [ ] **[live]** \`${command}\` — no passed run recorded at \`${live.head || "an unknown head"}\``;
|
|
6665
|
+
});
|
|
6666
|
+
return [...others, ...graded];
|
|
6667
|
+
}
|
|
6668
|
+
function evaluateTestPlanGate(body, branch, live) {
|
|
5770
6669
|
if (!body) {
|
|
5771
6670
|
return {
|
|
5772
6671
|
verdict: "pass",
|
|
@@ -5777,7 +6676,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5777
6676
|
};
|
|
5778
6677
|
}
|
|
5779
6678
|
const located = locateTestPlanSection(body);
|
|
5780
|
-
|
|
6679
|
+
const liveLines = gradedLiveLines(readLiveRecord(body), live);
|
|
6680
|
+
const liveUnticked = liveLines.some((line) => /^[-*]\s+\[\s\]/.test(line));
|
|
6681
|
+
if (!located.found && !liveUnticked) {
|
|
5781
6682
|
if (parseTaskBranchIdentity(branch) !== null) {
|
|
5782
6683
|
return {
|
|
5783
6684
|
verdict: "fail",
|
|
@@ -5797,15 +6698,18 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5797
6698
|
]
|
|
5798
6699
|
};
|
|
5799
6700
|
}
|
|
5800
|
-
const section = located.section;
|
|
5801
|
-
if (/unit-tests-only/i.test(section)) {
|
|
6701
|
+
const section = located.found ? located.section : "";
|
|
6702
|
+
if (/unit-tests-only/i.test(section) && !liveUnticked) {
|
|
5802
6703
|
return {
|
|
5803
6704
|
verdict: "pass",
|
|
5804
6705
|
messages: ["Test Plan: unit-tests-only — pure-logic brief, CI unit-tests are the proof.", "PASS."]
|
|
5805
6706
|
};
|
|
5806
6707
|
}
|
|
5807
|
-
const checkboxLines =
|
|
5808
|
-
|
|
6708
|
+
const checkboxLines = [
|
|
6709
|
+
...section.split(`
|
|
6710
|
+
`).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line)),
|
|
6711
|
+
...liveLines
|
|
6712
|
+
];
|
|
5809
6713
|
if (checkboxLines.length === 0) {
|
|
5810
6714
|
return {
|
|
5811
6715
|
verdict: "pass",
|
|
@@ -5822,7 +6726,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5822
6726
|
messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
|
|
5823
6727
|
for (const line of unchecked)
|
|
5824
6728
|
messages.push(` ${line}`);
|
|
5825
|
-
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.",
|
|
6729
|
+
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.", ...liveUnticked ? [
|
|
6730
|
+
"An unticked [live] line is a live run that failed or that the review loop could not verify on its host: a later head re-runs it, or the Principal runs it and ticks the box."
|
|
6731
|
+
] : [], "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.");
|
|
5826
6732
|
return { verdict: "fail", messages };
|
|
5827
6733
|
}
|
|
5828
6734
|
messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
@@ -6011,9 +6917,11 @@ var LineageSchema = z3.object({
|
|
|
6011
6917
|
parent: z3.string().nullable()
|
|
6012
6918
|
}).strict();
|
|
6013
6919
|
var InputVersionsSchema = z3.object({
|
|
6920
|
+
manifest_version: z3.literal(2).nullable().optional(),
|
|
6014
6921
|
objectives_version: z3.string().nullable(),
|
|
6015
6922
|
brief_hash: z3.string().nullable(),
|
|
6016
6923
|
ruling_ordinal: z3.number().int().nullable(),
|
|
6924
|
+
pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
|
|
6017
6925
|
policy_digest: z3.string().nullable()
|
|
6018
6926
|
}).strict();
|
|
6019
6927
|
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
@@ -6561,17 +7469,19 @@ function buildHeader(input) {
|
|
|
6561
7469
|
parent: lineageFieldFromEnv(input.env.parent)
|
|
6562
7470
|
},
|
|
6563
7471
|
input_versions: {
|
|
7472
|
+
manifest_version: input.inputVersions?.manifestVersion ?? null,
|
|
6564
7473
|
objectives_version: input.inputVersions?.objectivesVersion ?? null,
|
|
6565
7474
|
brief_hash: input.inputVersions?.briefHash ?? null,
|
|
6566
7475
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
7476
|
+
pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
|
|
6567
7477
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6568
7478
|
},
|
|
6569
7479
|
provenance: provenanceFor(input),
|
|
6570
7480
|
work: {
|
|
6571
7481
|
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6572
7482
|
repo: input.repo,
|
|
6573
|
-
change: null,
|
|
6574
|
-
revision: null
|
|
7483
|
+
change: pr === undefined ? null : String(pr),
|
|
7484
|
+
revision: input.revision ?? null
|
|
6575
7485
|
},
|
|
6576
7486
|
flow: {
|
|
6577
7487
|
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
@@ -6759,6 +7669,12 @@ var ManifestRecordSchema = z4.object({
|
|
|
6759
7669
|
briefHash: z4.string().min(1).nullable(),
|
|
6760
7670
|
objectivesVersion: z4.string().min(1).nullable(),
|
|
6761
7671
|
rulingOrdinal: epochNumber,
|
|
7672
|
+
manifestVersion: z4.literal(2).optional(),
|
|
7673
|
+
pauseBoundRuling: z4.object({
|
|
7674
|
+
rulingId: z4.string().min(1),
|
|
7675
|
+
pauseId: z4.string().min(1),
|
|
7676
|
+
contentDigest: z4.string().min(1)
|
|
7677
|
+
}).strict().nullable().optional(),
|
|
6762
7678
|
policyDigest: z4.string().min(1),
|
|
6763
7679
|
recordedAt: isoTimestamp
|
|
6764
7680
|
}).strict();
|
|
@@ -6780,7 +7696,11 @@ var LoopStateRecordSchema = z4.object({
|
|
|
6780
7696
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6781
7697
|
repeatMemory: z4.object({
|
|
6782
7698
|
blockingFindings: z4.array(z4.string()),
|
|
6783
|
-
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
7699
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
|
|
7700
|
+
}).strict().optional(),
|
|
7701
|
+
developerHandoff: z4.object({
|
|
7702
|
+
findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
|
|
7703
|
+
failingChecks: z4.array(z4.string().min(1))
|
|
6784
7704
|
}).strict().optional(),
|
|
6785
7705
|
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6786
7706
|
taskStartedAt: isoTimestamp.optional(),
|
|
@@ -6864,6 +7784,13 @@ function packageRoot(moduleUrl) {
|
|
|
6864
7784
|
import matter2 from "gray-matter";
|
|
6865
7785
|
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
6866
7786
|
var NO_MODEL_BACKED_PATHS = new Set;
|
|
7787
|
+
// ../../packages/aeg-core/src/docs/published-prose.ts
|
|
7788
|
+
var ALLOWED_MECHANICS = rulesForGroup("published-prose")[0]?.exemptions ?? [];
|
|
7789
|
+
var PROSE_RULES = rulesForGroup("published-prose").map((rule) => ({
|
|
7790
|
+
id: rule.id,
|
|
7791
|
+
what: rule.message,
|
|
7792
|
+
pattern: rule.patterns.published
|
|
7793
|
+
}));
|
|
6867
7794
|
// ../../packages/sources/src/commands.ts
|
|
6868
7795
|
var COMMANDS = [
|
|
6869
7796
|
{
|
|
@@ -6978,6 +7905,16 @@ var COMMANDS = [
|
|
|
6978
7905
|
],
|
|
6979
7906
|
status: "shipped"
|
|
6980
7907
|
},
|
|
7908
|
+
{
|
|
7909
|
+
name: "new adr",
|
|
7910
|
+
needs: [],
|
|
7911
|
+
description: "Write the next numbered decision record into the folder decisionRecords.path names",
|
|
7912
|
+
details: [
|
|
7913
|
+
"`vinaya new adr <title>` writes `<decisionRecords.path>/NNNN-<kebab-title>.md` from the shipped decision-record template (`vinaya doctrine --template decision-record`), with status Proposed and today's date, and adds a row for it to the folder's `README.md` index page, creating that page on the first record. Numbers start at `0001` and are one past the highest number any file in the folder or any row of the index carries, so a number is never reused, even after its file is removed.",
|
|
7914
|
+
"Refuses, naming the key, while `decisionRecords.path` is unset: decision records are opt-in. The same key switches on the `decision-record-citation` writing rule — see `decisionRecords.path` in the configuration reference."
|
|
7915
|
+
],
|
|
7916
|
+
status: "shipped"
|
|
7917
|
+
},
|
|
6981
7918
|
{
|
|
6982
7919
|
name: "brief render",
|
|
6983
7920
|
needs: ["forge", "default-branch"],
|
|
@@ -6996,9 +7933,7 @@ var COMMANDS = [
|
|
|
6996
7933
|
name: "task dispatch",
|
|
6997
7934
|
needs: ["forge", "operator-seat"],
|
|
6998
7935
|
description: "Deprecated — render, pin, and post the brief on the Issue as the frozen original; start the developer",
|
|
6999
|
-
flags: [
|
|
7000
|
-
{ flag: "--agent <claude|codex|gemini>", description: "Start the developer through dispatchRole once posted" }
|
|
7001
|
-
],
|
|
7936
|
+
flags: [{ flag: "--agent <claude|codex>", description: "Start the developer through dispatchRole once posted" }],
|
|
7002
7937
|
details: [
|
|
7003
7938
|
"Renders the brief from the Issue and the tree (the same assembly `brief render` uses) and posts it once as an Issue comment whose first line is `<!-- aeg:brief:v1 -->` and whose second line is `Brief hash: <sha256>` — the hash covers only the body below those two lines, so any reader recomputes it. Refuses outright, naming the existing comment's URL, when a `v1` comment already exists on the Issue — the brief is frozen by design, never overwritten or silently reissued.",
|
|
7004
7939
|
"With `--agent`, starts the Developer through `dispatchRole` when `apps/cli/src/lib/dispatch.ts` exports it; otherwise prints the rendered brief and the manual dispatch instruction and exits `0` — a soft dependency, never a hard block.",
|
|
@@ -7023,7 +7958,7 @@ var COMMANDS = [
|
|
|
7023
7958
|
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
7024
7959
|
flags: [
|
|
7025
7960
|
{
|
|
7026
|
-
flag: "--agent <claude|codex
|
|
7961
|
+
flag: "--agent <claude|codex>",
|
|
7027
7962
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
7028
7963
|
},
|
|
7029
7964
|
{
|
|
@@ -7199,11 +8134,27 @@ var COMMANDS = [
|
|
|
7199
8134
|
status: "shipped"
|
|
7200
8135
|
},
|
|
7201
8136
|
{
|
|
7202
|
-
name: "
|
|
8137
|
+
name: "pr snapshot",
|
|
7203
8138
|
needs: ["forge"],
|
|
7204
|
-
description: "
|
|
8139
|
+
description: "CI plumbing: write a run's forge snapshot of the pull request and its task Issue, read over REST",
|
|
7205
8140
|
flags: [
|
|
7206
|
-
{
|
|
8141
|
+
{
|
|
8142
|
+
flag: "--dir",
|
|
8143
|
+
description: "The snapshot directory; its `raw/` holds the REST pull request and comment pages the read step wrote"
|
|
8144
|
+
}
|
|
8145
|
+
],
|
|
8146
|
+
details: [
|
|
8147
|
+
"Run by the generated workflows' read step, never by hand. Maps the REST pull request and its comments to the shape `gh pr view --json` prints, resolves the task Issue from the body's `Closes #N`, and reads that Issue and its comments over REST — never GraphQL.",
|
|
8148
|
+
"A check reads the snapshot only when `GITHUB_ACTIONS` is `true` and the step running it sets `VINAYA_FORGE_SNAPSHOT_DIR`; anywhere else every read goes to the forge as before. Exits 1, naming what it could not read and both token budgets, on a failed read; 2 on a usage error."
|
|
8149
|
+
],
|
|
8150
|
+
status: "shipped"
|
|
8151
|
+
},
|
|
8152
|
+
{
|
|
8153
|
+
name: "issue create",
|
|
8154
|
+
needs: ["forge"],
|
|
8155
|
+
description: "Open an issue after full brief-schema validation",
|
|
8156
|
+
flags: [
|
|
8157
|
+
{ flag: "--title", description: "Issue title (validated on task Issues)" },
|
|
7207
8158
|
{ flag: "--body-file", description: "Path to the Issue body (stream-safe; same bytes validated and sent)" },
|
|
7208
8159
|
{ flag: "--label", description: "Label(s) to apply; a `vinaya/tranche:*` label marks a task Issue" },
|
|
7209
8160
|
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the Issue" },
|
|
@@ -7318,14 +8269,14 @@ var COMMANDS = [
|
|
|
7318
8269
|
{
|
|
7319
8270
|
name: "milestone close",
|
|
7320
8271
|
needs: ["forge"],
|
|
7321
|
-
description: "Close a tranche's Milestone after verifying every labeled Issue is
|
|
8272
|
+
description: "Close a tranche's Milestone after verifying every labeled Issue is attached and every tranche it declares is complete",
|
|
7322
8273
|
flags: [
|
|
7323
8274
|
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
7324
8275
|
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
7325
8276
|
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7326
8277
|
],
|
|
7327
8278
|
details: [
|
|
7328
|
-
"Resolves the target Milestone the same legacy-or-intent-declared way Issue create auto-attach does, then refuses to close on any mismatch between the label's Issues and the Milestone's natively attached Issues — naming each unattached or foreign Issue and its repair path (`gh issue edit <n> --milestone <title>`, or `vinaya milestone adopt`) — before the PATCH ever reaches the forge."
|
|
8279
|
+
"Resolves the target Milestone the same legacy-or-intent-declared way Issue create auto-attach does, then refuses to close on any mismatch between the label's Issues and the Milestone's natively attached Issues — naming each unattached or foreign Issue and its repair path (`gh issue edit <n> --milestone <title>`, or `vinaya milestone adopt`) — before the PATCH ever reaches the forge. It also holds the Milestone open while a tranche its `### Tranche intents` section declares is not complete — naming each unfinished tranche and its lifecycle — or while that section carries no readable tranche line; a Milestone with no such section closes on attachment alone. `--validate-only` refuses with the same reasons."
|
|
7329
8280
|
],
|
|
7330
8281
|
status: "shipped"
|
|
7331
8282
|
},
|
|
@@ -7614,7 +8565,7 @@ var COMMANDS = [
|
|
|
7614
8565
|
}
|
|
7615
8566
|
],
|
|
7616
8567
|
details: [
|
|
7617
|
-
"Refuses unless HEAD is the default branch, the working tree is clean, HEAD equals `origin/<default>` (after `git fetch origin`), HEAD's commit subject starts with `Chore(release): Version packages` (unless `--allow-any-commit`), and `npm whoami` exits `0`
|
|
8568
|
+
"Refuses unless HEAD is the default branch, the working tree is clean, HEAD equals `origin/<default>` (after `git fetch origin`), HEAD's commit subject starts with `Chore(release): Version packages` (unless `--allow-any-commit`), and `npm whoami` exits `0`. Before any plan step, including under `--dry-run`, every package in `.changeset/config.json` fixed groups must have an unpublished working-tree version. Exact-version registry queries refuse with every already-published package and version; workspace read failures and registry errors other than E404 also refuse with their reason. E404 for a missing package or version counts as unpublished.",
|
|
7618
8569
|
"Then streams `bun install --frozen-lockfile`, `bun run build`, `bun run changeset:publish`, and `git push origin --tags` — a real push, so the repo's own generated pre-push hook sees it exactly as any other push would. After it, prints `npm view <pkg> version` for every tag now on HEAD, noting registry lag on `@attalabs/vinaya` (observed ~20 minutes) when it still shows the previous version.",
|
|
7619
8570
|
'This is the one procedure named in `apps/cli/specs/self-hosting.md`, "How the published version is produced" — publishing itself stays manual and human-triggered; this command only removes the hand-typed four-step recipe.'
|
|
7620
8571
|
],
|
|
@@ -7623,11 +8574,11 @@ var COMMANDS = [
|
|
|
7623
8574
|
{
|
|
7624
8575
|
name: "dispatch",
|
|
7625
8576
|
needs: ["operator-seat"],
|
|
7626
|
-
description: "Start a role's headless agent session (claude/codex
|
|
8577
|
+
description: "Start a role's headless agent session (claude/codex) with attribution set on its environment, recording the outcome through the Vinaya Log",
|
|
7627
8578
|
flags: [
|
|
7628
8579
|
{
|
|
7629
8580
|
flag: "--agent",
|
|
7630
|
-
description: "Vendor to start: `claude
|
|
8581
|
+
description: "Vendor to start: `claude` or `codex` (falls back to `dispatch.agent` in config)"
|
|
7631
8582
|
},
|
|
7632
8583
|
{ flag: "--prompt-file", description: "Path to the prompt text sent to the agent (never on argv)" },
|
|
7633
8584
|
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
@@ -7644,9 +8595,9 @@ var COMMANDS = [
|
|
|
7644
8595
|
],
|
|
7645
8596
|
details: [
|
|
7646
8597
|
"Sets `VINAYA_RUN_ID`/`VINAYA_ROLE`/`VINAYA_TASK`/`VINAYA_ROUND` on the child only — never on this process's own environment — and refuses by name, before any spawn attempt, when the named vendor binary is absent from `PATH` or present but not executable.",
|
|
7647
|
-
"Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, or `
|
|
8598
|
+
"Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, `refused`, or `usage_limit`) through the Vinaya Log's one `dispatch` family writer, `dispatchRole`. A wall-time ceiling (`dispatch.timeoutMs` in config, default one hour) sends `SIGTERM` then, after a grace window, `SIGKILL`.",
|
|
7648
8599
|
"Runs no flush of its own after the dispatch returns: every log line `dispatchRole` emits reaches its configured `logs` destination live, as it is emitted, so there is nothing left to ship in a trailing step. `--task`/`--pr` are attribution only, and remain mutually exclusive.",
|
|
7649
|
-
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude
|
|
8600
|
+
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude: `session_id`; codex: `thread_id`), parsed from its stdout, `null` on any failure. Passing that value as `--resume <id>` on a later call swaps in that vendor's own resume invocation (`claude -p -r <id> ...`; `codex exec resume <id> ...`) in place of its first-dispatch args."
|
|
7650
8601
|
],
|
|
7651
8602
|
status: "shipped"
|
|
7652
8603
|
},
|
|
@@ -7657,7 +8608,7 @@ var COMMANDS = [
|
|
|
7657
8608
|
flags: [
|
|
7658
8609
|
{ flag: "--task <n>", description: "This task's Issue number — its frozen `aeg:brief:v1` comment is the brief" },
|
|
7659
8610
|
{
|
|
7660
|
-
flag: "--agent <claude|codex
|
|
8611
|
+
flag: "--agent <claude|codex>",
|
|
7661
8612
|
description: "Vendor for every dispatch this loop makes (falls back to `dispatch.agent` in config)"
|
|
7662
8613
|
},
|
|
7663
8614
|
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
@@ -7747,29 +8698,320 @@ import { promisify as promisify4 } from "node:util";
|
|
|
7747
8698
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7748
8699
|
import { homedir } from "node:os";
|
|
7749
8700
|
import { dirname as dirname2, isAbsolute, join as join2, resolve } from "node:path";
|
|
7750
|
-
import { z as
|
|
8701
|
+
import { z as z7 } from "zod";
|
|
8702
|
+
|
|
8703
|
+
// src/checks/contract.ts
|
|
8704
|
+
var CHECK_SCHEMA_VERSION = 1;
|
|
8705
|
+
function emitCheckError(error) {
|
|
8706
|
+
process.stderr.write(`${JSON.stringify(error)}
|
|
8707
|
+
`);
|
|
8708
|
+
}
|
|
7751
8709
|
|
|
7752
8710
|
// src/lib/agent-vendors.ts
|
|
7753
8711
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
7754
8712
|
|
|
8713
|
+
// src/lib/prose-rules-config.ts
|
|
8714
|
+
import safeRegex from "safe-regex2";
|
|
8715
|
+
import { z as z6 } from "zod";
|
|
8716
|
+
var SEVERITIES = ["error", "warning"];
|
|
8717
|
+
var OVERRIDE_KEYS = ["scopes", "severity", "exempt"];
|
|
8718
|
+
var FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
|
|
8719
|
+
var CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
|
|
8720
|
+
var DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
|
|
8721
|
+
function isPlainObject3(value) {
|
|
8722
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8723
|
+
}
|
|
8724
|
+
function outsideRepositoryReason(entry) {
|
|
8725
|
+
if (entry.startsWith("/") || /^[A-Za-z]:/.test(entry))
|
|
8726
|
+
return "must be a repository-relative path, not an absolute one";
|
|
8727
|
+
if (entry.split(/[\\/]/).includes(".."))
|
|
8728
|
+
return "must stay inside the repository — no `..` segment";
|
|
8729
|
+
return null;
|
|
8730
|
+
}
|
|
8731
|
+
var RepoRelativePathSchema = z6.string().min(1).superRefine((entry, ctx) => {
|
|
8732
|
+
const reason = outsideRepositoryReason(entry);
|
|
8733
|
+
if (reason)
|
|
8734
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, message: reason });
|
|
8735
|
+
});
|
|
8736
|
+
function pathListIssues(value, path, issues) {
|
|
8737
|
+
if (!Array.isArray(value)) {
|
|
8738
|
+
issues.push({ path, message: "must be a list of repository-relative paths" });
|
|
8739
|
+
return;
|
|
8740
|
+
}
|
|
8741
|
+
value.forEach((entry, index) => {
|
|
8742
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
8743
|
+
issues.push({ path: [...path, index], message: "must be a non-empty repository-relative path" });
|
|
8744
|
+
return;
|
|
8745
|
+
}
|
|
8746
|
+
const reason = outsideRepositoryReason(entry);
|
|
8747
|
+
if (reason)
|
|
8748
|
+
issues.push({ path: [...path, index], message: reason });
|
|
8749
|
+
});
|
|
8750
|
+
}
|
|
8751
|
+
function scopeListIssues(value, path, allowed, issues) {
|
|
8752
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
8753
|
+
issues.push({ path, message: "must name at least one scope" });
|
|
8754
|
+
return null;
|
|
8755
|
+
}
|
|
8756
|
+
const scopes = [];
|
|
8757
|
+
value.forEach((scope, index) => {
|
|
8758
|
+
if (typeof scope !== "string" || !CONFIGURABLE_PROSE_SCOPES.includes(scope)) {
|
|
8759
|
+
issues.push({
|
|
8760
|
+
path: [...path, index],
|
|
8761
|
+
message: scope === "published" ? 'scope "published" is not configurable here — the published pass is configured by proseGates.published.allow' : `unknown scope ${JSON.stringify(scope)} — the scopes are: ${CONFIGURABLE_PROSE_SCOPES.join(", ")}`
|
|
8762
|
+
});
|
|
8763
|
+
return;
|
|
8764
|
+
}
|
|
8765
|
+
if (!allowed.includes(scope)) {
|
|
8766
|
+
issues.push({
|
|
8767
|
+
path: [...path, index],
|
|
8768
|
+
message: `scope "${scope}" is not one this rule can run in — it can run in: ${allowed.join(", ")}`
|
|
8769
|
+
});
|
|
8770
|
+
return;
|
|
8771
|
+
}
|
|
8772
|
+
scopes.push(scope);
|
|
8773
|
+
});
|
|
8774
|
+
return scopes;
|
|
8775
|
+
}
|
|
8776
|
+
function severityIssues(value, path, scopes, issues) {
|
|
8777
|
+
if (typeof value === "string") {
|
|
8778
|
+
if (!SEVERITIES.includes(value)) {
|
|
8779
|
+
issues.push({ path, message: `unknown severity ${JSON.stringify(value)} — use "error" or "warning"` });
|
|
8780
|
+
}
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8783
|
+
if (!isPlainObject3(value)) {
|
|
8784
|
+
issues.push({ path, message: 'must be "error", "warning", or a map from scope to one of them' });
|
|
8785
|
+
return;
|
|
8786
|
+
}
|
|
8787
|
+
for (const [scope, severity] of Object.entries(value)) {
|
|
8788
|
+
if (!scopes.includes(scope)) {
|
|
8789
|
+
issues.push({ path: [...path, scope], message: `names scope "${scope}", which this rule's scopes do not cover` });
|
|
8790
|
+
}
|
|
8791
|
+
if (typeof severity !== "string" || !SEVERITIES.includes(severity)) {
|
|
8792
|
+
issues.push({
|
|
8793
|
+
path: [...path, scope],
|
|
8794
|
+
message: `unknown severity ${JSON.stringify(severity)} — use "error" or "warning"`
|
|
8795
|
+
});
|
|
8796
|
+
}
|
|
8797
|
+
}
|
|
8798
|
+
}
|
|
8799
|
+
function patternIssues(source, flags, path, issues) {
|
|
8800
|
+
if (typeof source !== "string" || source.length === 0) {
|
|
8801
|
+
issues.push({ path, message: "must be a non-empty regular expression" });
|
|
8802
|
+
return;
|
|
8803
|
+
}
|
|
8804
|
+
if (source.length > CONFIGURED_PATTERN_MAX_LENGTH) {
|
|
8805
|
+
issues.push({
|
|
8806
|
+
path,
|
|
8807
|
+
message: `is ${source.length} characters, over the ${CONFIGURED_PATTERN_MAX_LENGTH}-character limit for a configured pattern`
|
|
8808
|
+
});
|
|
8809
|
+
return;
|
|
8810
|
+
}
|
|
8811
|
+
try {
|
|
8812
|
+
new RegExp(source, flags);
|
|
8813
|
+
} catch (err) {
|
|
8814
|
+
issues.push({ path, message: `does not compile: ${err.message}` });
|
|
8815
|
+
return;
|
|
8816
|
+
}
|
|
8817
|
+
if (!safeRegex(source, { limit: Number.MAX_SAFE_INTEGER })) {
|
|
8818
|
+
issues.push({
|
|
8819
|
+
path,
|
|
8820
|
+
message: "has star height above one (a repeated group that itself repeats), which can take exponential time — " + "safe-regex2 refuses it. The shipped defaults are not held to this limit, so a pattern copied from one of " + "them can still be refused here; rewrite it without the nested repetition."
|
|
8821
|
+
});
|
|
8822
|
+
}
|
|
8823
|
+
}
|
|
8824
|
+
function flagIssues(value, path, issues) {
|
|
8825
|
+
if (value === undefined)
|
|
8826
|
+
return "";
|
|
8827
|
+
if (typeof value !== "string") {
|
|
8828
|
+
issues.push({ path, message: 'must be a string of flags, e.g. "i"' });
|
|
8829
|
+
return "";
|
|
8830
|
+
}
|
|
8831
|
+
const seen = new Set;
|
|
8832
|
+
for (const flag of value) {
|
|
8833
|
+
if (!CONFIGURED_PROSE_FLAGS.includes(flag)) {
|
|
8834
|
+
issues.push({
|
|
8835
|
+
path,
|
|
8836
|
+
message: `unknown flag ${JSON.stringify(flag)} — only ${CONFIGURED_PROSE_FLAGS.map((f) => `"${f}"`).join(" and ")} are allowed`
|
|
8837
|
+
});
|
|
8838
|
+
return "";
|
|
8839
|
+
}
|
|
8840
|
+
if (seen.has(flag)) {
|
|
8841
|
+
issues.push({ path, message: `repeats the flag "${flag}"` });
|
|
8842
|
+
return "";
|
|
8843
|
+
}
|
|
8844
|
+
seen.add(flag);
|
|
8845
|
+
}
|
|
8846
|
+
return value;
|
|
8847
|
+
}
|
|
8848
|
+
function defaultsIssues(value, issues) {
|
|
8849
|
+
const base = ["defaults"];
|
|
8850
|
+
if (!isPlainObject3(value)) {
|
|
8851
|
+
issues.push({ path: base, message: 'must map a default rule id to "off" or an override' });
|
|
8852
|
+
return;
|
|
8853
|
+
}
|
|
8854
|
+
for (const [id, override] of Object.entries(value)) {
|
|
8855
|
+
const path = [...base, id];
|
|
8856
|
+
const rule = CONFIGURABLE_DEFAULT_RULES.find((candidate) => candidate.id === id);
|
|
8857
|
+
if (!rule) {
|
|
8858
|
+
issues.push({
|
|
8859
|
+
path,
|
|
8860
|
+
message: `unknown default rule id "${id}" — \`vinaya check --plan\` lists the rules each prose check runs`
|
|
8861
|
+
});
|
|
8862
|
+
continue;
|
|
8863
|
+
}
|
|
8864
|
+
if (override === "off")
|
|
8865
|
+
continue;
|
|
8866
|
+
if (!isPlainObject3(override)) {
|
|
8867
|
+
issues.push({ path, message: 'must be "off" or an object with any of scopes, severity, exempt' });
|
|
8868
|
+
continue;
|
|
8869
|
+
}
|
|
8870
|
+
for (const key of Object.keys(override)) {
|
|
8871
|
+
if (OVERRIDE_KEYS.includes(key))
|
|
8872
|
+
continue;
|
|
8873
|
+
issues.push({
|
|
8874
|
+
path: [...path, key],
|
|
8875
|
+
message: FIXED_DEFAULT_KEYS.includes(key) ? `a default rule's ${key} is fixed — add a custom rule under proseGates.rules.custom instead` : `unknown key "${key}" — a default rule takes only scopes, severity and exempt`
|
|
8876
|
+
});
|
|
8877
|
+
}
|
|
8878
|
+
const scopes = override.scopes === undefined ? [...rule.scopes] : scopeListIssues(override.scopes, [...path, "scopes"], allowedScopesFor(rule), issues);
|
|
8879
|
+
if (override.severity !== undefined && scopes)
|
|
8880
|
+
severityIssues(override.severity, [...path, "severity"], scopes, issues);
|
|
8881
|
+
if (override.exempt !== undefined)
|
|
8882
|
+
pathListIssues(override.exempt, [...path, "exempt"], issues);
|
|
8883
|
+
}
|
|
8884
|
+
}
|
|
8885
|
+
function customIssues(value, issues) {
|
|
8886
|
+
if (!Array.isArray(value)) {
|
|
8887
|
+
issues.push({ path: ["custom"], message: "must be a list of rules" });
|
|
8888
|
+
return;
|
|
8889
|
+
}
|
|
8890
|
+
const ids = new Set;
|
|
8891
|
+
value.forEach((rule, index) => {
|
|
8892
|
+
const path = ["custom", index];
|
|
8893
|
+
if (!isPlainObject3(rule)) {
|
|
8894
|
+
issues.push({ path, message: "must be a rule object" });
|
|
8895
|
+
return;
|
|
8896
|
+
}
|
|
8897
|
+
for (const key of Object.keys(rule)) {
|
|
8898
|
+
if (!CUSTOM_KEYS.includes(key)) {
|
|
8899
|
+
issues.push({ path: [...path, key], message: `unknown key "${key}" — a rule takes ${CUSTOM_KEYS.join(", ")}` });
|
|
8900
|
+
}
|
|
8901
|
+
}
|
|
8902
|
+
if (typeof rule.id !== "string" || rule.id.length === 0) {
|
|
8903
|
+
issues.push({ path: [...path, "id"], message: "a custom rule needs an id" });
|
|
8904
|
+
} else if (DEFAULT_IDS.has(rule.id)) {
|
|
8905
|
+
issues.push({
|
|
8906
|
+
path: [...path, "id"],
|
|
8907
|
+
message: `"${rule.id}" is a default rule id — a custom rule needs its own id; retune the default under proseGates.rules.defaults instead`
|
|
8908
|
+
});
|
|
8909
|
+
} else if (ids.has(rule.id)) {
|
|
8910
|
+
issues.push({ path: [...path, "id"], message: `"${rule.id}" is used by an earlier custom rule` });
|
|
8911
|
+
} else {
|
|
8912
|
+
ids.add(rule.id);
|
|
8913
|
+
}
|
|
8914
|
+
if (typeof rule.means !== "string" || rule.means.trim().length === 0) {
|
|
8915
|
+
issues.push({ path: [...path, "means"], message: "a custom rule needs a message (`means`)" });
|
|
8916
|
+
}
|
|
8917
|
+
let scopes = null;
|
|
8918
|
+
if (rule.scopes === undefined) {
|
|
8919
|
+
issues.push({ path: [...path, "scopes"], message: "a custom rule needs at least one scope (`scopes`)" });
|
|
8920
|
+
} else {
|
|
8921
|
+
scopes = scopeListIssues(rule.scopes, [...path, "scopes"], CONFIGURABLE_PROSE_SCOPES, issues);
|
|
8922
|
+
}
|
|
8923
|
+
if (scopes && new Set(scopes.map(groupOfScope)).size > 1) {
|
|
8924
|
+
issues.push({
|
|
8925
|
+
path: [...path, "scopes"],
|
|
8926
|
+
message: 'mixes scopes of both prose checks — "repository" belongs to retired-vocabulary and every other scope to reader-resolvable-prose; write one rule per check'
|
|
8927
|
+
});
|
|
8928
|
+
}
|
|
8929
|
+
const flags = flagIssues(rule.flags, [...path, "flags"], issues);
|
|
8930
|
+
if (rule.pattern === undefined && rule.patterns === undefined) {
|
|
8931
|
+
issues.push({
|
|
8932
|
+
path: [...path, "pattern"],
|
|
8933
|
+
message: "a custom rule needs a `pattern` or a per-scope `patterns` map"
|
|
8934
|
+
});
|
|
8935
|
+
}
|
|
8936
|
+
if (rule.pattern !== undefined)
|
|
8937
|
+
patternIssues(rule.pattern, flags, [...path, "pattern"], issues);
|
|
8938
|
+
if (rule.patterns !== undefined) {
|
|
8939
|
+
if (!isPlainObject3(rule.patterns)) {
|
|
8940
|
+
issues.push({ path: [...path, "patterns"], message: "must map a scope to a regular expression" });
|
|
8941
|
+
} else {
|
|
8942
|
+
for (const [scope, source] of Object.entries(rule.patterns)) {
|
|
8943
|
+
if (scopes && !scopes.includes(scope)) {
|
|
8944
|
+
issues.push({
|
|
8945
|
+
path: [...path, "patterns", scope],
|
|
8946
|
+
message: `names scope "${scope}", which this rule's scopes do not cover`
|
|
8947
|
+
});
|
|
8948
|
+
continue;
|
|
8949
|
+
}
|
|
8950
|
+
patternIssues(source, flags, [...path, "patterns", scope], issues);
|
|
8951
|
+
}
|
|
8952
|
+
if (rule.pattern === undefined && scopes) {
|
|
8953
|
+
for (const scope of scopes) {
|
|
8954
|
+
if (!(scope in rule.patterns)) {
|
|
8955
|
+
issues.push({
|
|
8956
|
+
path: [...path, "patterns"],
|
|
8957
|
+
message: `has no pattern for scope "${scope}" — add one, or a \`pattern\` every other scope uses`
|
|
8958
|
+
});
|
|
8959
|
+
}
|
|
8960
|
+
}
|
|
8961
|
+
}
|
|
8962
|
+
}
|
|
8963
|
+
}
|
|
8964
|
+
if (rule.severity !== undefined && scopes)
|
|
8965
|
+
severityIssues(rule.severity, [...path, "severity"], scopes, issues);
|
|
8966
|
+
if (rule.exempt !== undefined)
|
|
8967
|
+
pathListIssues(rule.exempt, [...path, "exempt"], issues);
|
|
8968
|
+
});
|
|
8969
|
+
}
|
|
8970
|
+
function proseRulesIssues(value) {
|
|
8971
|
+
const issues = [];
|
|
8972
|
+
if (!isPlainObject3(value))
|
|
8973
|
+
return [{ path: [], message: "must be an object with any of exempt, defaults, custom" }];
|
|
8974
|
+
for (const key of Object.keys(value)) {
|
|
8975
|
+
if (!["exempt", "defaults", "custom"].includes(key)) {
|
|
8976
|
+
issues.push({ path: [key], message: `unknown key "${key}" — proseGates.rules takes exempt, defaults and custom` });
|
|
8977
|
+
}
|
|
8978
|
+
}
|
|
8979
|
+
if (value.exempt !== undefined)
|
|
8980
|
+
pathListIssues(value.exempt, ["exempt"], issues);
|
|
8981
|
+
if (value.defaults !== undefined)
|
|
8982
|
+
defaultsIssues(value.defaults, issues);
|
|
8983
|
+
if (value.custom !== undefined)
|
|
8984
|
+
customIssues(value.custom, issues);
|
|
8985
|
+
return issues;
|
|
8986
|
+
}
|
|
8987
|
+
var ProseRulesSchema = z6.unknown().superRefine((value, ctx) => {
|
|
8988
|
+
for (const issue of proseRulesIssues(value)) {
|
|
8989
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, path: issue.path, message: issue.message });
|
|
8990
|
+
}
|
|
8991
|
+
}).transform((value) => value);
|
|
8992
|
+
var PublishedProseSchema = z6.object({
|
|
8993
|
+
allow: z6.array(z6.string().min(1)).optional()
|
|
8994
|
+
}).strict();
|
|
8995
|
+
|
|
7755
8996
|
// src/lib/config.ts
|
|
7756
|
-
var EnvEntrySchema =
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
8997
|
+
var EnvEntrySchema = z7.union([
|
|
8998
|
+
z7.literal(true),
|
|
8999
|
+
z7.object({ optional: z7.literal(true) }),
|
|
9000
|
+
z7.object({ anyOf: z7.array(z7.string()).min(2) }),
|
|
9001
|
+
z7.string()
|
|
7761
9002
|
]);
|
|
7762
|
-
var CheckEntrySchema =
|
|
7763
|
-
run:
|
|
7764
|
-
scope:
|
|
7765
|
-
include:
|
|
7766
|
-
args:
|
|
7767
|
-
timeoutMs:
|
|
7768
|
-
env:
|
|
7769
|
-
requiresOpenPr:
|
|
7770
|
-
ownWorkflow:
|
|
7771
|
-
principalOwed:
|
|
7772
|
-
validates:
|
|
9003
|
+
var CheckEntrySchema = z7.object({
|
|
9004
|
+
run: z7.string(),
|
|
9005
|
+
scope: z7.enum(["diff", "full"]),
|
|
9006
|
+
include: z7.array(z7.string()).optional(),
|
|
9007
|
+
args: z7.array(z7.string()).optional(),
|
|
9008
|
+
timeoutMs: z7.number().optional(),
|
|
9009
|
+
env: z7.record(z7.string(), EnvEntrySchema).optional(),
|
|
9010
|
+
requiresOpenPr: z7.boolean().optional(),
|
|
9011
|
+
ownWorkflow: z7.boolean().optional(),
|
|
9012
|
+
principalOwed: z7.literal(true).optional(),
|
|
9013
|
+
validates: z7.enum(["body", "issue"]).optional(),
|
|
9014
|
+
advisory: z7.literal(true).optional()
|
|
7773
9015
|
}).superRefine((entry, ctx) => {
|
|
7774
9016
|
if (!entry.env)
|
|
7775
9017
|
return;
|
|
@@ -7779,22 +9021,22 @@ var CheckEntrySchema = z6.object({
|
|
|
7779
9021
|
const members = value.anyOf;
|
|
7780
9022
|
if (new Set(members).size !== members.length) {
|
|
7781
9023
|
ctx.addIssue({
|
|
7782
|
-
code:
|
|
9024
|
+
code: z7.ZodIssueCode.custom,
|
|
7783
9025
|
message: `env.${key}.anyOf has duplicate members`,
|
|
7784
9026
|
path: ["env", key, "anyOf"]
|
|
7785
9027
|
});
|
|
7786
9028
|
}
|
|
7787
9029
|
if (!members.includes(key)) {
|
|
7788
9030
|
ctx.addIssue({
|
|
7789
|
-
code:
|
|
9031
|
+
code: z7.ZodIssueCode.custom,
|
|
7790
9032
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
7791
9033
|
path: ["env", key, "anyOf"]
|
|
7792
9034
|
});
|
|
7793
9035
|
}
|
|
7794
9036
|
}
|
|
7795
9037
|
});
|
|
7796
|
-
var RoleEntrySchema =
|
|
7797
|
-
contract:
|
|
9038
|
+
var RoleEntrySchema = z7.object({
|
|
9039
|
+
contract: z7.string().refine((p) => p.includes("/"), {
|
|
7798
9040
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
7799
9041
|
})
|
|
7800
9042
|
});
|
|
@@ -7818,17 +9060,17 @@ var BRIEF_BUILTINS = [
|
|
|
7818
9060
|
"briefSections",
|
|
7819
9061
|
"milestoneShape"
|
|
7820
9062
|
];
|
|
7821
|
-
var BriefSectionSchema =
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
9063
|
+
var BriefSectionSchema = z7.union([
|
|
9064
|
+
z7.object({ builtin: z7.enum(BRIEF_BUILTINS) }),
|
|
9065
|
+
z7.object({ heading: z7.string().min(1), name: z7.string().optional() }),
|
|
9066
|
+
z7.object({ field: z7.string().min(1), name: z7.string().optional() }),
|
|
9067
|
+
z7.object({ phrase: z7.string().min(1), name: z7.string().optional() })
|
|
7826
9068
|
]);
|
|
7827
|
-
var BriefSchemaSchema =
|
|
7828
|
-
pr:
|
|
7829
|
-
issue:
|
|
7830
|
-
milestone:
|
|
7831
|
-
ack:
|
|
9069
|
+
var BriefSchemaSchema = z7.object({
|
|
9070
|
+
pr: z7.object({ sections: z7.array(BriefSectionSchema) }).optional(),
|
|
9071
|
+
issue: z7.object({ sections: z7.array(BriefSectionSchema) }).optional(),
|
|
9072
|
+
milestone: z7.object({ sections: z7.array(BriefSectionSchema) }).optional(),
|
|
9073
|
+
ack: z7.array(z7.enum(BRIEF_BUILTINS)).optional()
|
|
7832
9074
|
});
|
|
7833
9075
|
function isSafeRepoRelPath(p) {
|
|
7834
9076
|
if (p.length === 0)
|
|
@@ -7837,7 +9079,7 @@ function isSafeRepoRelPath(p) {
|
|
|
7837
9079
|
return false;
|
|
7838
9080
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
7839
9081
|
}
|
|
7840
|
-
var SafeRepoRelPath =
|
|
9082
|
+
var SafeRepoRelPath = z7.string().refine(isSafeRepoRelPath, {
|
|
7841
9083
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
7842
9084
|
});
|
|
7843
9085
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -7847,22 +9089,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
7847
9089
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
7848
9090
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
7849
9091
|
});
|
|
7850
|
-
var ManagedBlockRecordSchema =
|
|
9092
|
+
var ManagedBlockRecordSchema = z7.object({
|
|
7851
9093
|
path: ManagedHookBlockPath,
|
|
7852
|
-
marker:
|
|
7853
|
-
comment:
|
|
9094
|
+
marker: z7.string(),
|
|
9095
|
+
comment: z7.enum(["hash", "html"])
|
|
7854
9096
|
});
|
|
7855
|
-
var ManagedManifestSchema =
|
|
7856
|
-
version:
|
|
7857
|
-
files:
|
|
7858
|
-
blocks:
|
|
7859
|
-
labels:
|
|
7860
|
-
agents:
|
|
9097
|
+
var ManagedManifestSchema = z7.object({
|
|
9098
|
+
version: z7.number().int().positive(),
|
|
9099
|
+
files: z7.array(SafeRepoRelPath),
|
|
9100
|
+
blocks: z7.array(ManagedBlockRecordSchema),
|
|
9101
|
+
labels: z7.array(z7.string()),
|
|
9102
|
+
agents: z7.array(z7.enum(AGENT_VENDORS)).optional()
|
|
7861
9103
|
});
|
|
7862
|
-
var ProjectEntrySchema =
|
|
7863
|
-
name:
|
|
7864
|
-
description:
|
|
7865
|
-
path:
|
|
9104
|
+
var ProjectEntrySchema = z7.object({
|
|
9105
|
+
name: z7.string().min(1),
|
|
9106
|
+
description: z7.string().min(1).optional(),
|
|
9107
|
+
path: z7.string().min(1).optional()
|
|
7866
9108
|
});
|
|
7867
9109
|
function parseTokensCollectDeclaration(value) {
|
|
7868
9110
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -7873,90 +9115,90 @@ function parseTokensCollectDeclaration(value) {
|
|
|
7873
9115
|
return null;
|
|
7874
9116
|
return { interpreter, script };
|
|
7875
9117
|
}
|
|
7876
|
-
var
|
|
7877
|
-
rings:
|
|
7878
|
-
ring1_forgeWriteInterception:
|
|
7879
|
-
ring2_asyncAudits:
|
|
9118
|
+
var VinayaConfigObjectSchema = z7.object({
|
|
9119
|
+
rings: z7.object({
|
|
9120
|
+
ring1_forgeWriteInterception: z7.boolean(),
|
|
9121
|
+
ring2_asyncAudits: z7.boolean()
|
|
7880
9122
|
}).optional(),
|
|
7881
|
-
checks:
|
|
7882
|
-
roles:
|
|
9123
|
+
checks: z7.record(z7.string(), CheckEntrySchema).optional(),
|
|
9124
|
+
roles: z7.record(z7.string(), RoleEntrySchema).optional(),
|
|
7883
9125
|
briefSchema: BriefSchemaSchema.optional(),
|
|
7884
9126
|
managed: ManagedManifestSchema.optional(),
|
|
7885
|
-
principals:
|
|
7886
|
-
releaseActor:
|
|
7887
|
-
ci:
|
|
7888
|
-
tokens:
|
|
7889
|
-
collect:
|
|
9127
|
+
principals: z7.array(z7.string()).min(1).optional(),
|
|
9128
|
+
releaseActor: z7.string().min(1).optional(),
|
|
9129
|
+
ci: z7.object({ setup: z7.string().min(1) }).optional(),
|
|
9130
|
+
tokens: z7.object({
|
|
9131
|
+
collect: z7.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
7890
9132
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
7891
9133
|
})
|
|
7892
9134
|
}).optional(),
|
|
7893
|
-
blastRadius:
|
|
7894
|
-
proseGates:
|
|
7895
|
-
doctrineRoot:
|
|
7896
|
-
readerFacingPrefix:
|
|
7897
|
-
readerFacingSuffix:
|
|
7898
|
-
legacySlugDir:
|
|
7899
|
-
sourceComments:
|
|
7900
|
-
globs:
|
|
7901
|
-
allowlist:
|
|
7902
|
-
severity:
|
|
9135
|
+
blastRadius: z7.object({ extraDomains: z7.array(z7.string()).optional() }).optional(),
|
|
9136
|
+
proseGates: z7.object({
|
|
9137
|
+
doctrineRoot: z7.string().min(1).optional(),
|
|
9138
|
+
readerFacingPrefix: z7.string().min(1).optional(),
|
|
9139
|
+
readerFacingSuffix: z7.string().min(1).optional(),
|
|
9140
|
+
legacySlugDir: z7.string().min(1).optional(),
|
|
9141
|
+
sourceComments: z7.object({
|
|
9142
|
+
globs: z7.array(z7.string().min(1)).optional(),
|
|
9143
|
+
allowlist: z7.array(z7.string().min(1)).optional(),
|
|
9144
|
+
severity: z7.enum(["warning", "error"]).optional()
|
|
7903
9145
|
}).optional(),
|
|
7904
|
-
specGrandfather:
|
|
7905
|
-
specPaths:
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
})).optional()
|
|
9146
|
+
specGrandfather: z7.union([z7.array(z7.string().min(1)), z7.record(z7.string().min(1), z7.number().int().min(0))]).optional(),
|
|
9147
|
+
specPaths: z7.array(RepoRelativePathSchema).optional(),
|
|
9148
|
+
productPaths: z7.array(RepoRelativePathSchema).optional(),
|
|
9149
|
+
published: PublishedProseSchema.optional(),
|
|
9150
|
+
rules: ProseRulesSchema.optional()
|
|
7910
9151
|
}).optional(),
|
|
7911
|
-
projects:
|
|
7912
|
-
dispatch:
|
|
7913
|
-
timeoutMs:
|
|
7914
|
-
|
|
7915
|
-
|
|
9152
|
+
projects: z7.array(ProjectEntrySchema).optional(),
|
|
9153
|
+
dispatch: z7.object({
|
|
9154
|
+
timeoutMs: z7.number().int().positive().optional(),
|
|
9155
|
+
reviewerTimeoutMs: z7.number().int().positive().optional(),
|
|
9156
|
+
killGraceMs: z7.number().int().positive().optional(),
|
|
9157
|
+
agent: z7.enum(["claude", "codex"]).optional()
|
|
7916
9158
|
}).optional(),
|
|
7917
|
-
reviewPolicy:
|
|
7918
|
-
codeReviewThreshold:
|
|
7919
|
-
securityThreshold:
|
|
7920
|
-
maxRounds:
|
|
7921
|
-
maxTaskMinutes:
|
|
9159
|
+
reviewPolicy: z7.object({
|
|
9160
|
+
codeReviewThreshold: z7.string().min(1).optional(),
|
|
9161
|
+
securityThreshold: z7.string().min(1).optional(),
|
|
9162
|
+
maxRounds: z7.number().optional(),
|
|
9163
|
+
maxTaskMinutes: z7.number().optional()
|
|
7922
9164
|
}).optional(),
|
|
7923
|
-
securityScan:
|
|
7924
|
-
command:
|
|
9165
|
+
securityScan: z7.object({
|
|
9166
|
+
command: z7.array(z7.string().min(1)).min(1)
|
|
7925
9167
|
}).optional(),
|
|
7926
|
-
gateCutovers:
|
|
7927
|
-
objectivesSinceIssue:
|
|
7928
|
-
briefSectionsSinceIssue:
|
|
7929
|
-
documentationSinceIssue:
|
|
7930
|
-
briefRulesSincePr:
|
|
7931
|
-
agentBoxesRefusedSincePr:
|
|
9168
|
+
gateCutovers: z7.object({
|
|
9169
|
+
objectivesSinceIssue: z7.number().int().nonnegative().optional(),
|
|
9170
|
+
briefSectionsSinceIssue: z7.number().int().nonnegative().optional(),
|
|
9171
|
+
documentationSinceIssue: z7.number().int().nonnegative().optional(),
|
|
9172
|
+
briefRulesSincePr: z7.number().int().nonnegative().optional(),
|
|
9173
|
+
agentBoxesRefusedSincePr: z7.number().int().nonnegative().optional()
|
|
7932
9174
|
}).optional(),
|
|
7933
|
-
planning:
|
|
7934
|
-
collisionThreshold:
|
|
9175
|
+
planning: z7.object({
|
|
9176
|
+
collisionThreshold: z7.number().int().nonnegative().optional()
|
|
7935
9177
|
}).optional(),
|
|
7936
|
-
prePush:
|
|
7937
|
-
alwaysRun:
|
|
9178
|
+
prePush: z7.object({
|
|
9179
|
+
alwaysRun: z7.array(z7.string()).optional()
|
|
7938
9180
|
}).optional(),
|
|
7939
|
-
report:
|
|
7940
|
-
commandTimeoutMs:
|
|
9181
|
+
report: z7.object({
|
|
9182
|
+
commandTimeoutMs: z7.number().int().positive().optional()
|
|
7941
9183
|
}).superRefine((report, ctx) => {
|
|
7942
9184
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
7943
9185
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
7944
9186
|
ctx.addIssue({
|
|
7945
|
-
code:
|
|
9187
|
+
code: z7.ZodIssueCode.custom,
|
|
7946
9188
|
path: ["commandTimeoutMs"],
|
|
7947
9189
|
message: "must be at most 3600000 (1 hour)"
|
|
7948
9190
|
});
|
|
7949
9191
|
}
|
|
7950
9192
|
}).optional(),
|
|
7951
|
-
logPublish:
|
|
9193
|
+
logPublish: z7.unknown().refine((v) => v === undefined, {
|
|
7952
9194
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
7953
9195
|
}),
|
|
7954
|
-
runtimeDir:
|
|
7955
|
-
logs:
|
|
7956
|
-
folder:
|
|
7957
|
-
url:
|
|
7958
|
-
headers:
|
|
7959
|
-
readHeaders:
|
|
9196
|
+
runtimeDir: z7.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
9197
|
+
logs: z7.object({
|
|
9198
|
+
folder: z7.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
9199
|
+
url: z7.string().url().optional(),
|
|
9200
|
+
headers: z7.record(z7.string()).optional(),
|
|
9201
|
+
readHeaders: z7.record(z7.string()).optional(),
|
|
7960
9202
|
events: CustomEventDeclarationsSchema.optional()
|
|
7961
9203
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
7962
9204
|
message: "logs: set at most one of folder/url"
|
|
@@ -7964,8 +9206,33 @@ var VinayaConfigSchema = z6.object({
|
|
|
7964
9206
|
message: "logs: headers requires url"
|
|
7965
9207
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
7966
9208
|
message: "logs: readHeaders requires url"
|
|
7967
|
-
}).optional()
|
|
9209
|
+
}).optional(),
|
|
9210
|
+
decisionRecords: z7.object({
|
|
9211
|
+
path: RepoRelativePathSchema
|
|
9212
|
+
}).strict().optional()
|
|
9213
|
+
});
|
|
9214
|
+
function decisionRecordsPathIssue(path, doctrineRoot) {
|
|
9215
|
+
const reason = outsideRepositoryReason(path);
|
|
9216
|
+
if (reason)
|
|
9217
|
+
return reason;
|
|
9218
|
+
const folder = normalizeSpecPath(path);
|
|
9219
|
+
if (folder === "" || folder === ".")
|
|
9220
|
+
return "must name a folder, not the repository root";
|
|
9221
|
+
const root = normalizeSpecPath(doctrineRoot ?? "aeg-root");
|
|
9222
|
+
if (folder === root || folder.startsWith(`${root}/`)) {
|
|
9223
|
+
return `must be outside the doctrine tree "${root}" — decision records belong to this repository, not to the doctrine it ships`;
|
|
9224
|
+
}
|
|
9225
|
+
return null;
|
|
9226
|
+
}
|
|
9227
|
+
var VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
|
|
9228
|
+
const path = config.decisionRecords?.path;
|
|
9229
|
+
if (path === undefined || outsideRepositoryReason(path))
|
|
9230
|
+
return;
|
|
9231
|
+
const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
|
|
9232
|
+
if (issue)
|
|
9233
|
+
ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
|
|
7968
9234
|
});
|
|
9235
|
+
var VinayaConfigShape = VinayaConfigObjectSchema.shape;
|
|
7969
9236
|
var GLOBAL_VINAYA_HOME = join2(homedir(), ".vinaya");
|
|
7970
9237
|
var GLOBAL_CONFIG_PATH = join2(GLOBAL_VINAYA_HOME, "config.json");
|
|
7971
9238
|
var LOCAL_CONFIG_FILENAME = "vinaya.config.json";
|
|
@@ -8046,9 +9313,6 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
8046
9313
|
}
|
|
8047
9314
|
return result;
|
|
8048
9315
|
}
|
|
8049
|
-
function resolvePrincipalAllowlist(config) {
|
|
8050
|
-
return config?.principals ?? PRINCIPAL_ALLOWLIST;
|
|
8051
|
-
}
|
|
8052
9316
|
function resolveReleaseActor(config) {
|
|
8053
9317
|
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
8054
9318
|
}
|
|
@@ -8184,13 +9448,14 @@ function readTrustAnchorConfigAtRef(ref) {
|
|
|
8184
9448
|
});
|
|
8185
9449
|
return Buffer.from(raw, "utf-8").toString("base64");
|
|
8186
9450
|
}
|
|
9451
|
+
var NO_TRUST_ANCHOR_REPO_MESSAGE = "could not resolve repo identity for the trust-anchor read";
|
|
8187
9452
|
function ghFetchTrustAnchorConfig() {
|
|
8188
9453
|
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
8189
9454
|
if (probeRef)
|
|
8190
9455
|
return readTrustAnchorConfigAtRef(probeRef);
|
|
8191
9456
|
const repo = trustAnchorRepo();
|
|
8192
9457
|
if (!repo)
|
|
8193
|
-
throw new Error(
|
|
9458
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
8194
9459
|
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
8195
9460
|
encoding: "utf-8",
|
|
8196
9461
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -8207,7 +9472,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
8207
9472
|
}
|
|
8208
9473
|
const repo = await trustAnchorRepoAsync();
|
|
8209
9474
|
if (!repo)
|
|
8210
|
-
throw new Error(
|
|
9475
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
8211
9476
|
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
8212
9477
|
return stdout;
|
|
8213
9478
|
}
|
|
@@ -8233,6 +9498,47 @@ function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
|
8233
9498
|
}
|
|
8234
9499
|
return parseTrustAnchorContent(base64);
|
|
8235
9500
|
}
|
|
9501
|
+
class PrincipalsUnresolvedError extends Error {
|
|
9502
|
+
kind;
|
|
9503
|
+
constructor(kind, message) {
|
|
9504
|
+
super(message);
|
|
9505
|
+
this.name = "PrincipalsUnresolvedError";
|
|
9506
|
+
this.kind = kind;
|
|
9507
|
+
}
|
|
9508
|
+
}
|
|
9509
|
+
var PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch';
|
|
9510
|
+
function fetchFailureReason(err) {
|
|
9511
|
+
const stderr = err?.stderr;
|
|
9512
|
+
const text = (typeof stderr === "string" ? stderr : stderr?.toString() ?? "").trim();
|
|
9513
|
+
return text.split(`
|
|
9514
|
+
`)[0]?.trim() || firstLine(err);
|
|
9515
|
+
}
|
|
9516
|
+
function principalsNotConfigured(why) {
|
|
9517
|
+
return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
|
|
9518
|
+
}
|
|
9519
|
+
function resolveTrustedPrincipals(fetcher = ghFetchTrustAnchorConfig) {
|
|
9520
|
+
let content;
|
|
9521
|
+
try {
|
|
9522
|
+
content = fetcher();
|
|
9523
|
+
} catch (err) {
|
|
9524
|
+
if (err?.message === NO_TRUST_ANCHOR_REPO_MESSAGE) {
|
|
9525
|
+
throw principalsNotConfigured("no repository resolves for the read");
|
|
9526
|
+
}
|
|
9527
|
+
if (isMissingFileError(err))
|
|
9528
|
+
throw principalsNotConfigured("the default branch has no vinaya.config.json");
|
|
9529
|
+
throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`);
|
|
9530
|
+
}
|
|
9531
|
+
const unusable = { why: "" };
|
|
9532
|
+
const config = parseTrustAnchorContent(content, (why) => {
|
|
9533
|
+
unusable.why = why;
|
|
9534
|
+
});
|
|
9535
|
+
if (config === null) {
|
|
9536
|
+
throw principalsNotConfigured(`vinaya.config.json on the default branch ${unusable.why ? `is unusable: ${unusable.why}` : "is empty"}`);
|
|
9537
|
+
}
|
|
9538
|
+
if (!config.principals)
|
|
9539
|
+
throw principalsNotConfigured('vinaya.config.json on the default branch sets no "principals"');
|
|
9540
|
+
return config.principals;
|
|
9541
|
+
}
|
|
8236
9542
|
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
8237
9543
|
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
8238
9544
|
let base64;
|
|
@@ -8272,12 +9578,67 @@ function loadConfig() {
|
|
|
8272
9578
|
const path = configPath();
|
|
8273
9579
|
if (!path)
|
|
8274
9580
|
return null;
|
|
9581
|
+
let text;
|
|
8275
9582
|
try {
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
9583
|
+
text = readFileSync2(path, "utf-8");
|
|
9584
|
+
} catch (err) {
|
|
9585
|
+
reportInvalidConfigOnce(path, `unreadable: ${err.message}`);
|
|
9586
|
+
return null;
|
|
9587
|
+
}
|
|
9588
|
+
let raw;
|
|
9589
|
+
try {
|
|
9590
|
+
raw = JSON.parse(text);
|
|
9591
|
+
} catch (err) {
|
|
9592
|
+
reportInvalidConfigOnce(path, `invalid JSON: ${err.message}`);
|
|
8279
9593
|
return null;
|
|
8280
9594
|
}
|
|
9595
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
9596
|
+
if (!parsed.success) {
|
|
9597
|
+
reportInvalidConfigOnce(path, schemaIssueDetail(parsed.error));
|
|
9598
|
+
return null;
|
|
9599
|
+
}
|
|
9600
|
+
return stripGlobalOnlyKeys(parsed.data, path);
|
|
9601
|
+
}
|
|
9602
|
+
function schemaIssueDetail(error) {
|
|
9603
|
+
return error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ");
|
|
9604
|
+
}
|
|
9605
|
+
var emittedInvalidConfigReports = new Set;
|
|
9606
|
+
function reportInvalidConfigOnce(path, detail) {
|
|
9607
|
+
const key = `${path}
|
|
9608
|
+
${detail}`;
|
|
9609
|
+
if (emittedInvalidConfigReports.has(key))
|
|
9610
|
+
return;
|
|
9611
|
+
emittedInvalidConfigReports.add(key);
|
|
9612
|
+
const message = `${path} is not a valid Vinaya configuration (${detail}) — falling back to built-in defaults.`;
|
|
9613
|
+
const checkName = process.env.VINAYA_CHECK_NAME;
|
|
9614
|
+
if (checkName) {
|
|
9615
|
+
emitCheckError({
|
|
9616
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9617
|
+
check: checkName,
|
|
9618
|
+
severity: "warning",
|
|
9619
|
+
message,
|
|
9620
|
+
agent_recovery_prompt: `Fix the failing keys in ${path} (${detail}) so the file parses and satisfies the configuration schema, then re-run.`,
|
|
9621
|
+
file: path
|
|
9622
|
+
});
|
|
9623
|
+
return;
|
|
9624
|
+
}
|
|
9625
|
+
console.error(`⚠ ${message}`);
|
|
9626
|
+
}
|
|
9627
|
+
function loadConfigChecked() {
|
|
9628
|
+
const path = configPath();
|
|
9629
|
+
if (!path)
|
|
9630
|
+
return { ok: true, config: null };
|
|
9631
|
+
let raw;
|
|
9632
|
+
try {
|
|
9633
|
+
raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
9634
|
+
} catch (err) {
|
|
9635
|
+
return { ok: false, path, error: `invalid JSON: ${err.message}` };
|
|
9636
|
+
}
|
|
9637
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
9638
|
+
if (!parsed.success) {
|
|
9639
|
+
return { ok: false, path, error: schemaIssueDetail(parsed.error) };
|
|
9640
|
+
}
|
|
9641
|
+
return { ok: true, config: stripGlobalOnlyKeys(parsed.data, path) };
|
|
8281
9642
|
}
|
|
8282
9643
|
var TOKENS_COLLECT_TRUST_PATH = join2(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
8283
9644
|
|
|
@@ -8314,19 +9675,123 @@ function hasDoctrineEntry(root) {
|
|
|
8314
9675
|
return existsSync3(join3(root, ...ENTRY_SEGMENTS));
|
|
8315
9676
|
}
|
|
8316
9677
|
|
|
8317
|
-
// src/checks/contract.ts
|
|
8318
|
-
var CHECK_SCHEMA_VERSION = 1;
|
|
8319
|
-
function emitCheckError(error) {
|
|
8320
|
-
process.stderr.write(`${JSON.stringify(error)}
|
|
8321
|
-
`);
|
|
8322
|
-
}
|
|
8323
|
-
|
|
8324
9678
|
// src/lib/diff-evidence.ts
|
|
8325
|
-
import { execFileSync as
|
|
8326
|
-
import { join as
|
|
9679
|
+
import { execFileSync as execFileSync9 } from "node:child_process";
|
|
9680
|
+
import { join as join10, relative as relative2, resolve as resolve2 } from "node:path";
|
|
8327
9681
|
|
|
8328
9682
|
// src/lib/forge-read.ts
|
|
8329
9683
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
9684
|
+
|
|
9685
|
+
// src/lib/forge-snapshot.ts
|
|
9686
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
9687
|
+
import { join as join4 } from "node:path";
|
|
9688
|
+
var FORGE_SNAPSHOT_DIR_ENV = "VINAYA_FORGE_SNAPSHOT_DIR";
|
|
9689
|
+
var PULL_FILE = "pull.json";
|
|
9690
|
+
var PULL_COMMENTS_FILE = "pull-comments.json";
|
|
9691
|
+
var ISSUE_FILE = "issue.json";
|
|
9692
|
+
var ISSUE_COMMENTS_FILE = "issue-comments.json";
|
|
9693
|
+
function forgeSnapshotDir(env = process.env) {
|
|
9694
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
9695
|
+
return null;
|
|
9696
|
+
const dir = env[FORGE_SNAPSHOT_DIR_ENV];
|
|
9697
|
+
return dir ? dir : null;
|
|
9698
|
+
}
|
|
9699
|
+
|
|
9700
|
+
class ForgeSnapshotIncompleteError extends Error {
|
|
9701
|
+
constructor(dir, file) {
|
|
9702
|
+
super(`the forge snapshot ${dir} has no ${file} — the pull request read that writes it did not complete, so this check refuses to read the forge in its place.`);
|
|
9703
|
+
this.name = "ForgeSnapshotIncompleteError";
|
|
9704
|
+
}
|
|
9705
|
+
}
|
|
9706
|
+
|
|
9707
|
+
class ForgeSnapshotIssueNotFoundError extends Error {
|
|
9708
|
+
constructor(issue) {
|
|
9709
|
+
super(`Issue #${issue} did not resolve (HTTP 404) when this run's forge snapshot was read.`);
|
|
9710
|
+
this.name = "ForgeSnapshotIssueNotFoundError";
|
|
9711
|
+
}
|
|
9712
|
+
}
|
|
9713
|
+
function readSnapshotFile(dir, file) {
|
|
9714
|
+
let text;
|
|
9715
|
+
try {
|
|
9716
|
+
text = readFileSync4(join4(dir, file), "utf8");
|
|
9717
|
+
} catch {
|
|
9718
|
+
throw new ForgeSnapshotIncompleteError(dir, file);
|
|
9719
|
+
}
|
|
9720
|
+
return JSON.parse(text);
|
|
9721
|
+
}
|
|
9722
|
+
function readComments(dir, file, number) {
|
|
9723
|
+
const parsed = readSnapshotFile(dir, file);
|
|
9724
|
+
if (parsed.number !== number)
|
|
9725
|
+
throw new ForgeSnapshotIncompleteError(dir, `${file} for #${number}`);
|
|
9726
|
+
return parsed.comments;
|
|
9727
|
+
}
|
|
9728
|
+
function snapshotPullRequest(number, env = process.env) {
|
|
9729
|
+
const dir = forgeSnapshotDir(env);
|
|
9730
|
+
if (dir === null)
|
|
9731
|
+
return null;
|
|
9732
|
+
const pull = readSnapshotFile(dir, PULL_FILE);
|
|
9733
|
+
return pull.number === number ? pull : null;
|
|
9734
|
+
}
|
|
9735
|
+
function snapshotIssue(number, env = process.env) {
|
|
9736
|
+
const dir = forgeSnapshotDir(env);
|
|
9737
|
+
if (dir === null)
|
|
9738
|
+
return null;
|
|
9739
|
+
const issue = readSnapshotFile(dir, ISSUE_FILE);
|
|
9740
|
+
if (issue.number !== number)
|
|
9741
|
+
return null;
|
|
9742
|
+
if ("notFound" in issue)
|
|
9743
|
+
throw new ForgeSnapshotIssueNotFoundError(number);
|
|
9744
|
+
return issue;
|
|
9745
|
+
}
|
|
9746
|
+
function snapshotComments(number, env = process.env) {
|
|
9747
|
+
const dir = forgeSnapshotDir(env);
|
|
9748
|
+
if (dir === null)
|
|
9749
|
+
return null;
|
|
9750
|
+
if (snapshotPullRequest(number, env) !== null)
|
|
9751
|
+
return readComments(dir, PULL_COMMENTS_FILE, number);
|
|
9752
|
+
if (snapshotIssue(number, env) !== null)
|
|
9753
|
+
return readComments(dir, ISSUE_COMMENTS_FILE, number);
|
|
9754
|
+
return null;
|
|
9755
|
+
}
|
|
9756
|
+
function snapshotBody(number, env = process.env) {
|
|
9757
|
+
const pull = snapshotPullRequest(number, env);
|
|
9758
|
+
if (pull !== null)
|
|
9759
|
+
return pull.body;
|
|
9760
|
+
return snapshotIssue(number, env)?.body ?? null;
|
|
9761
|
+
}
|
|
9762
|
+
function incompleteForgeSnapshot(env = process.env) {
|
|
9763
|
+
const dir = forgeSnapshotDir(env);
|
|
9764
|
+
if (dir === null)
|
|
9765
|
+
return null;
|
|
9766
|
+
for (const file of [PULL_FILE, PULL_COMMENTS_FILE, ISSUE_FILE]) {
|
|
9767
|
+
if (!existsSync4(join4(dir, file)))
|
|
9768
|
+
return new ForgeSnapshotIncompleteError(dir, file).message;
|
|
9769
|
+
}
|
|
9770
|
+
try {
|
|
9771
|
+
const issue = readSnapshotFile(dir, ISSUE_FILE);
|
|
9772
|
+
if (typeof issue.number === "number" && !("notFound" in issue) && !existsSync4(join4(dir, ISSUE_COMMENTS_FILE))) {
|
|
9773
|
+
return new ForgeSnapshotIncompleteError(dir, ISSUE_COMMENTS_FILE).message;
|
|
9774
|
+
}
|
|
9775
|
+
} catch (err) {
|
|
9776
|
+
return `the forge snapshot ${dir} has an unreadable ${ISSUE_FILE}: ${err.message}`;
|
|
9777
|
+
}
|
|
9778
|
+
return null;
|
|
9779
|
+
}
|
|
9780
|
+
function exitOnIncompleteForgeSnapshot(checkName, env = process.env) {
|
|
9781
|
+
const reason = incompleteForgeSnapshot(env);
|
|
9782
|
+
if (reason === null)
|
|
9783
|
+
return;
|
|
9784
|
+
emitCheckError({
|
|
9785
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9786
|
+
check: checkName,
|
|
9787
|
+
severity: "error",
|
|
9788
|
+
message: `${checkName}: ${reason}`,
|
|
9789
|
+
agent_recovery_prompt: `Re-run the whole workflow run so its pull request read step writes the snapshot again (its own log names the failed read), then let \`vinaya check ${checkName}\` re-run.`
|
|
9790
|
+
});
|
|
9791
|
+
process.exit(1);
|
|
9792
|
+
}
|
|
9793
|
+
|
|
9794
|
+
// src/lib/forge-read.ts
|
|
8330
9795
|
var FORGE_READ_CEILING_BYTES = 64 * 1024 * 1024;
|
|
8331
9796
|
var PAGE_SIZE = 100;
|
|
8332
9797
|
var ghRunner = (args, maxBuffer) => execFileSync4("gh", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], maxBuffer });
|
|
@@ -8349,7 +9814,7 @@ function isForgeReadOversize(err) {
|
|
|
8349
9814
|
function isBufferOverflow(err) {
|
|
8350
9815
|
return err?.code === "ENOBUFS";
|
|
8351
9816
|
}
|
|
8352
|
-
function
|
|
9817
|
+
function runBounded(runner, args, subject, usedBytes) {
|
|
8353
9818
|
const remaining = FORGE_READ_CEILING_BYTES - usedBytes;
|
|
8354
9819
|
let out;
|
|
8355
9820
|
try {
|
|
@@ -8364,31 +9829,40 @@ function run2(runner, args, subject, usedBytes) {
|
|
|
8364
9829
|
throw new ForgeReadOversizeError(subject, usedBytes + size);
|
|
8365
9830
|
return out;
|
|
8366
9831
|
}
|
|
8367
|
-
function
|
|
8368
|
-
const
|
|
8369
|
-
const comments = [];
|
|
9832
|
+
function readRestCommentRows(number, subjectLabel = `Issue ${number}`, runner = ghRunner) {
|
|
9833
|
+
const rows = [];
|
|
8370
9834
|
let used = 0;
|
|
8371
9835
|
for (let page = 1;; page++) {
|
|
8372
|
-
const out =
|
|
9836
|
+
const out = runBounded(runner, ["api", `repos/{owner}/{repo}/issues/${number}/comments?per_page=${PAGE_SIZE}&page=${page}`], subjectLabel, used);
|
|
8373
9837
|
used += Buffer.byteLength(out, "utf8");
|
|
8374
|
-
const
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
url: r.html_url ?? "",
|
|
8379
|
-
author: r.user?.login ? { login: r.user.login } : null
|
|
8380
|
-
});
|
|
8381
|
-
}
|
|
8382
|
-
if (rows.length < PAGE_SIZE)
|
|
8383
|
-
return comments;
|
|
9838
|
+
const pageRows = JSON.parse(out);
|
|
9839
|
+
rows.push(...pageRows);
|
|
9840
|
+
if (pageRows.length < PAGE_SIZE)
|
|
9841
|
+
return rows;
|
|
8384
9842
|
}
|
|
8385
9843
|
}
|
|
9844
|
+
function readIssueComments(issue, subjectLabel = `Issue ${issue}`, runner = ghRunner) {
|
|
9845
|
+
const number = resolveNumber(issue, subjectLabel, runner);
|
|
9846
|
+
const fromSnapshot = snapshotComments(number);
|
|
9847
|
+
if (fromSnapshot !== null)
|
|
9848
|
+
return fromSnapshot;
|
|
9849
|
+
return readRestCommentRows(number, subjectLabel, runner).map((r) => ({
|
|
9850
|
+
body: r.body ?? "",
|
|
9851
|
+
url: r.html_url ?? "",
|
|
9852
|
+
author: r.user?.login ? { login: r.user.login } : null
|
|
9853
|
+
}));
|
|
9854
|
+
}
|
|
8386
9855
|
function readIssueBody(issue, subjectLabel = `Issue ${issue}`, runner = ghRunner) {
|
|
8387
|
-
|
|
9856
|
+
if (forgeSnapshotDir() !== null) {
|
|
9857
|
+
const fromSnapshot = snapshotBody(resolveNumber(issue, subjectLabel, runner));
|
|
9858
|
+
if (fromSnapshot !== null)
|
|
9859
|
+
return fromSnapshot;
|
|
9860
|
+
}
|
|
9861
|
+
const out = runBounded(runner, ["issue", "view", String(issue), "--json", "body"], subjectLabel, 0);
|
|
8388
9862
|
return JSON.parse(out).body ?? "";
|
|
8389
9863
|
}
|
|
8390
9864
|
function readIssueFields(issue, fields, subjectLabel = `Issue ${issue}`, runner = ghRunner) {
|
|
8391
|
-
return JSON.parse(
|
|
9865
|
+
return JSON.parse(runBounded(runner, ["issue", "view", String(issue), "--json", fields], subjectLabel, 0));
|
|
8392
9866
|
}
|
|
8393
9867
|
function resolveNumber(issue, subjectLabel, runner) {
|
|
8394
9868
|
if (typeof issue === "number")
|
|
@@ -8399,21 +9873,71 @@ function resolveNumber(issue, subjectLabel, runner) {
|
|
|
8399
9873
|
}
|
|
8400
9874
|
|
|
8401
9875
|
// src/lib/brief-assembly.ts
|
|
8402
|
-
import { execFileSync as
|
|
8403
|
-
import { existsSync as
|
|
8404
|
-
import { join as
|
|
9876
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
9877
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2 } from "node:fs";
|
|
9878
|
+
import { join as join5 } from "node:path";
|
|
8405
9879
|
|
|
8406
9880
|
// src/checks/edge-resolve.ts
|
|
9881
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
9882
|
+
|
|
9883
|
+
// src/lib/github-rate-limit.ts
|
|
8407
9884
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
9885
|
+
var GITHUB_RATE_LIMIT_WORDING = /api rate limit (?:already )?exceeded|secondary rate limit|rate limit exceeded/i;
|
|
9886
|
+
var SECONDARY_RATE_LIMIT_WORDING = /secondary rate limit/i;
|
|
9887
|
+
function isGithubRateLimitError(text) {
|
|
9888
|
+
return GITHUB_RATE_LIMIT_WORDING.test(text);
|
|
9889
|
+
}
|
|
9890
|
+
function rateLimitBudget(errorText) {
|
|
9891
|
+
return errorText.trimStart().startsWith("GraphQL:") ? "GraphQL" : "REST";
|
|
9892
|
+
}
|
|
9893
|
+
var defaultReader = () => execFileSync5("gh", ["api", "rate_limit"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
9894
|
+
function readRateLimitReset(budget, read = defaultReader) {
|
|
9895
|
+
let parsed;
|
|
9896
|
+
try {
|
|
9897
|
+
parsed = JSON.parse(read());
|
|
9898
|
+
} catch {
|
|
9899
|
+
return null;
|
|
9900
|
+
}
|
|
9901
|
+
const resources = parsed.resources;
|
|
9902
|
+
const entry = resources?.[budget === "GraphQL" ? "graphql" : "core"];
|
|
9903
|
+
if (!entry || typeof entry.reset !== "number" || !Number.isFinite(entry.reset) || entry.reset <= 0)
|
|
9904
|
+
return null;
|
|
9905
|
+
if (typeof entry.remaining === "number" && entry.remaining > 0)
|
|
9906
|
+
return null;
|
|
9907
|
+
return entry.reset;
|
|
9908
|
+
}
|
|
9909
|
+
function formatResetUtc(epochSeconds) {
|
|
9910
|
+
const d = new Date(epochSeconds * 1000);
|
|
9911
|
+
const hh = String(d.getUTCHours()).padStart(2, "0");
|
|
9912
|
+
const mm = String(d.getUTCMinutes()).padStart(2, "0");
|
|
9913
|
+
return `${hh}:${mm} UTC`;
|
|
9914
|
+
}
|
|
9915
|
+
function rateLimitMessage(errorText, read = defaultReader) {
|
|
9916
|
+
const budget = rateLimitBudget(errorText);
|
|
9917
|
+
const reset = SECONDARY_RATE_LIMIT_WORDING.test(errorText) ? null : readRateLimitReset(budget, read);
|
|
9918
|
+
const when = reset === null ? "resets in a few minutes" : `resets at ${formatResetUtc(reset)}`;
|
|
9919
|
+
return `GitHub rate limit (${budget}), ${when}`;
|
|
9920
|
+
}
|
|
9921
|
+
function execErrorText(err) {
|
|
9922
|
+
const e = err;
|
|
9923
|
+
const stderr = e?.stderr === undefined || e.stderr === null ? "" : String(e.stderr);
|
|
9924
|
+
const message = typeof e?.message === "string" ? e.message : "";
|
|
9925
|
+
return stderr.trim() !== "" ? `${stderr}
|
|
9926
|
+
${message}` : message;
|
|
9927
|
+
}
|
|
9928
|
+
|
|
9929
|
+
// src/checks/edge-resolve.ts
|
|
8408
9930
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
8409
9931
|
var issueCache = new Map;
|
|
9932
|
+
var ISSUE_NOT_FOUND = /could not resolve to an issue/i;
|
|
8410
9933
|
function fetchIssueState(num, repo) {
|
|
8411
9934
|
const key = `${repo.owner}/${repo.repo}#${num}`;
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
9935
|
+
const cached = issueCache.get(key);
|
|
9936
|
+
if (cached)
|
|
9937
|
+
return cached;
|
|
9938
|
+
let out;
|
|
8415
9939
|
try {
|
|
8416
|
-
const raw =
|
|
9940
|
+
const raw = execFileSync6("gh", [
|
|
8417
9941
|
"issue",
|
|
8418
9942
|
"view",
|
|
8419
9943
|
String(num),
|
|
@@ -8422,9 +9946,9 @@ function fetchIssueState(num, repo) {
|
|
|
8422
9946
|
"--json",
|
|
8423
9947
|
"state,stateReason,closedByPullRequestsReferences"
|
|
8424
9948
|
], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
8425
|
-
out = JSON.parse(raw);
|
|
8426
|
-
} catch {
|
|
8427
|
-
out = null;
|
|
9949
|
+
out = { json: JSON.parse(raw), readFailed: false };
|
|
9950
|
+
} catch (err) {
|
|
9951
|
+
out = { json: null, readFailed: !ISSUE_NOT_FOUND.test(execErrorText(err)) };
|
|
8428
9952
|
}
|
|
8429
9953
|
issueCache.set(key, out);
|
|
8430
9954
|
return out;
|
|
@@ -8444,7 +9968,7 @@ var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
|
8444
9968
|
};
|
|
8445
9969
|
};
|
|
8446
9970
|
var siblingTrancheCache = new Map;
|
|
8447
|
-
function edgeFromIssueJson(num, json) {
|
|
9971
|
+
function edgeFromIssueJson(num, json, readFailed = false) {
|
|
8448
9972
|
if (json === null) {
|
|
8449
9973
|
return {
|
|
8450
9974
|
issue: num,
|
|
@@ -8453,7 +9977,8 @@ function edgeFromIssueJson(num, json) {
|
|
|
8453
9977
|
issueState: null,
|
|
8454
9978
|
stateReason: null,
|
|
8455
9979
|
closedByActor: null,
|
|
8456
|
-
resolved: true
|
|
9980
|
+
resolved: true,
|
|
9981
|
+
...readFailed ? { readFailed: true } : {}
|
|
8457
9982
|
};
|
|
8458
9983
|
}
|
|
8459
9984
|
const state = json.state === "CLOSED" ? "closed" : json.state === "OPEN" ? "open" : null;
|
|
@@ -8486,7 +10011,8 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
8486
10011
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
8487
10012
|
if (direct) {
|
|
8488
10013
|
const num = Number(direct[1]);
|
|
8489
|
-
|
|
10014
|
+
const read = fetchIssueState(num, repo);
|
|
10015
|
+
return edgeFromIssueJson(num, read.json, read.readFailed);
|
|
8490
10016
|
}
|
|
8491
10017
|
const qualified = splitSlugQualifiedEdge(id);
|
|
8492
10018
|
if (qualified) {
|
|
@@ -8520,14 +10046,26 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
8520
10046
|
resolved: false
|
|
8521
10047
|
};
|
|
8522
10048
|
}
|
|
10049
|
+
function dependsOnFactFromEdge(id, r) {
|
|
10050
|
+
return {
|
|
10051
|
+
id,
|
|
10052
|
+
issue: r.issue,
|
|
10053
|
+
merged: r.merged,
|
|
10054
|
+
resolved: r.resolved,
|
|
10055
|
+
issueState: r.issueState,
|
|
10056
|
+
stateReason: r.stateReason,
|
|
10057
|
+
closedByActor: r.closedByActor,
|
|
10058
|
+
...r.readFailed ? { readFailed: true } : {}
|
|
10059
|
+
};
|
|
10060
|
+
}
|
|
8523
10061
|
|
|
8524
10062
|
// src/lib/brief-assembly.ts
|
|
8525
10063
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
8526
|
-
var PACKAGED_TEMPLATE_PATH =
|
|
8527
|
-
var TEMPLATE_PATH =
|
|
10064
|
+
var PACKAGED_TEMPLATE_PATH = join5(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
10065
|
+
var TEMPLATE_PATH = existsSync5(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join5(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
8528
10066
|
function git(args) {
|
|
8529
10067
|
try {
|
|
8530
|
-
return
|
|
10068
|
+
return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
8531
10069
|
} catch {
|
|
8532
10070
|
return "";
|
|
8533
10071
|
}
|
|
@@ -8540,24 +10078,25 @@ function expandGlob(glob) {
|
|
|
8540
10078
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
8541
10079
|
|
|
8542
10080
|
// src/checks/registry.ts
|
|
8543
|
-
import { join as
|
|
10081
|
+
import { join as join6, relative, sep as sep2 } from "node:path";
|
|
8544
10082
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8545
10083
|
function resolveCheckBin(packageDir, moduleUrl) {
|
|
8546
10084
|
const fromPackage = relative(packageDir, fileURLToPath3(moduleUrl));
|
|
8547
10085
|
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
|
|
8548
|
-
return bundled ? { dir:
|
|
10086
|
+
return bundled ? { dir: join6(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join6(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
8549
10087
|
}
|
|
8550
10088
|
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
8551
10089
|
var BIN_DIR = CHECK_BIN.dir;
|
|
8552
10090
|
var BIN_EXT = CHECK_BIN.ext;
|
|
8553
10091
|
function bin(name) {
|
|
8554
|
-
return
|
|
10092
|
+
return join6(BIN_DIR, `${name}${BIN_EXT}`);
|
|
8555
10093
|
}
|
|
8556
10094
|
var REGISTRY = [
|
|
8557
10095
|
[
|
|
8558
10096
|
{
|
|
8559
10097
|
name: "brief-shape",
|
|
8560
10098
|
validates: "body",
|
|
10099
|
+
requiresOpenPr: true,
|
|
8561
10100
|
run: bin("check-brief-shape"),
|
|
8562
10101
|
scope: "diff",
|
|
8563
10102
|
timeoutMs: 15000,
|
|
@@ -8566,7 +10105,9 @@ var REGISTRY = [
|
|
|
8566
10105
|
BRANCH: { optional: true },
|
|
8567
10106
|
PR_NUMBER: { optional: true },
|
|
8568
10107
|
GITHUB_TOKEN: { optional: true },
|
|
8569
|
-
GH_TOKEN: { optional: true }
|
|
10108
|
+
GH_TOKEN: { optional: true },
|
|
10109
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10110
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8570
10111
|
}
|
|
8571
10112
|
},
|
|
8572
10113
|
0
|
|
@@ -8575,6 +10116,7 @@ var REGISTRY = [
|
|
|
8575
10116
|
{
|
|
8576
10117
|
name: "pr-report-density",
|
|
8577
10118
|
validates: "body",
|
|
10119
|
+
requiresOpenPr: true,
|
|
8578
10120
|
run: bin("check-pr-report-density"),
|
|
8579
10121
|
scope: "diff",
|
|
8580
10122
|
timeoutMs: 15000,
|
|
@@ -8600,7 +10142,9 @@ var REGISTRY = [
|
|
|
8600
10142
|
PR_NUMBER: { optional: true },
|
|
8601
10143
|
GITHUB_REPOSITORY: { optional: true },
|
|
8602
10144
|
GITHUB_TOKEN: { optional: true },
|
|
8603
|
-
GH_TOKEN: { optional: true }
|
|
10145
|
+
GH_TOKEN: { optional: true },
|
|
10146
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10147
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8604
10148
|
}
|
|
8605
10149
|
},
|
|
8606
10150
|
0
|
|
@@ -8624,6 +10168,7 @@ var REGISTRY = [
|
|
|
8624
10168
|
{
|
|
8625
10169
|
name: "pr-premise-reassert",
|
|
8626
10170
|
validates: "body",
|
|
10171
|
+
requiresOpenPr: true,
|
|
8627
10172
|
run: bin("check-pr-premise-reassert"),
|
|
8628
10173
|
scope: "diff",
|
|
8629
10174
|
timeoutMs: 15000,
|
|
@@ -8644,7 +10189,9 @@ var REGISTRY = [
|
|
|
8644
10189
|
BRANCH: { optional: true },
|
|
8645
10190
|
GITHUB_TOKEN: { optional: true },
|
|
8646
10191
|
GH_TOKEN: { optional: true },
|
|
8647
|
-
PREMISE_FILE: { optional: true }
|
|
10192
|
+
PREMISE_FILE: { optional: true },
|
|
10193
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10194
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8648
10195
|
}
|
|
8649
10196
|
},
|
|
8650
10197
|
0
|
|
@@ -8696,7 +10243,9 @@ var REGISTRY = [
|
|
|
8696
10243
|
PR_BODY: { optional: true },
|
|
8697
10244
|
PR_BODY_FILE: { optional: true },
|
|
8698
10245
|
GITHUB_TOKEN: { optional: true },
|
|
8699
|
-
GH_TOKEN: { optional: true }
|
|
10246
|
+
GH_TOKEN: { optional: true },
|
|
10247
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10248
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8700
10249
|
}
|
|
8701
10250
|
},
|
|
8702
10251
|
1
|
|
@@ -8712,7 +10261,13 @@ var REGISTRY = [
|
|
|
8712
10261
|
principalOwed: true,
|
|
8713
10262
|
env: {
|
|
8714
10263
|
PR_BODY: { optional: true },
|
|
8715
|
-
BRANCH: { optional: true }
|
|
10264
|
+
BRANCH: { optional: true },
|
|
10265
|
+
PULL_REQUEST_HEAD_SHA: { optional: true },
|
|
10266
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
10267
|
+
GITHUB_TOKEN: { optional: true },
|
|
10268
|
+
GH_TOKEN: { optional: true },
|
|
10269
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10270
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8716
10271
|
}
|
|
8717
10272
|
},
|
|
8718
10273
|
1
|
|
@@ -8728,7 +10283,13 @@ var REGISTRY = [
|
|
|
8728
10283
|
ownWorkflow: true,
|
|
8729
10284
|
env: {
|
|
8730
10285
|
PR_BODY: { optional: true },
|
|
8731
|
-
BRANCH: { optional: true }
|
|
10286
|
+
BRANCH: { optional: true },
|
|
10287
|
+
PULL_REQUEST_HEAD_SHA: { optional: true },
|
|
10288
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
10289
|
+
GITHUB_TOKEN: { optional: true },
|
|
10290
|
+
GH_TOKEN: { optional: true },
|
|
10291
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10292
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8732
10293
|
}
|
|
8733
10294
|
},
|
|
8734
10295
|
1
|
|
@@ -8747,7 +10308,9 @@ var REGISTRY = [
|
|
|
8747
10308
|
PR_NUMBER: { optional: true },
|
|
8748
10309
|
GITHUB_REPOSITORY: { optional: true },
|
|
8749
10310
|
GITHUB_TOKEN: { optional: true },
|
|
8750
|
-
GH_TOKEN: { optional: true }
|
|
10311
|
+
GH_TOKEN: { optional: true },
|
|
10312
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10313
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8751
10314
|
}
|
|
8752
10315
|
},
|
|
8753
10316
|
1
|
|
@@ -8787,7 +10350,9 @@ var REGISTRY = [
|
|
|
8787
10350
|
PR_NUMBER: { optional: true },
|
|
8788
10351
|
GITHUB_REPOSITORY: { optional: true },
|
|
8789
10352
|
GITHUB_TOKEN: { optional: true },
|
|
8790
|
-
GH_TOKEN: { optional: true }
|
|
10353
|
+
GH_TOKEN: { optional: true },
|
|
10354
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10355
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8791
10356
|
}
|
|
8792
10357
|
},
|
|
8793
10358
|
1
|
|
@@ -8840,12 +10405,15 @@ var REGISTRY = [
|
|
|
8840
10405
|
{
|
|
8841
10406
|
name: "doc-coverage-push",
|
|
8842
10407
|
validates: "body",
|
|
10408
|
+
advisory: true,
|
|
8843
10409
|
run: bin("check-doc-coverage-push"),
|
|
8844
10410
|
scope: "diff",
|
|
8845
10411
|
timeoutMs: 15000,
|
|
8846
10412
|
env: {
|
|
8847
10413
|
OVERRIDE_DOCS: { optional: true },
|
|
8848
10414
|
BASE_SHA: { optional: true },
|
|
10415
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10416
|
+
VINAYA_COMMIT_HOOK: { optional: true },
|
|
8849
10417
|
PR_BODY: { optional: true },
|
|
8850
10418
|
PR_BODY_FILE: { optional: true },
|
|
8851
10419
|
PR_LABELS: { optional: true },
|
|
@@ -8857,21 +10425,6 @@ var REGISTRY = [
|
|
|
8857
10425
|
},
|
|
8858
10426
|
0
|
|
8859
10427
|
],
|
|
8860
|
-
[
|
|
8861
|
-
{
|
|
8862
|
-
name: "issue-assignment",
|
|
8863
|
-
run: bin("check-issue-assignment"),
|
|
8864
|
-
scope: "full",
|
|
8865
|
-
timeoutMs: 30000,
|
|
8866
|
-
env: {
|
|
8867
|
-
AEG_REPO: { optional: true },
|
|
8868
|
-
BRANCH: { optional: true },
|
|
8869
|
-
GITHUB_TOKEN: { optional: true },
|
|
8870
|
-
GH_TOKEN: { optional: true }
|
|
8871
|
-
}
|
|
8872
|
-
},
|
|
8873
|
-
0
|
|
8874
|
-
],
|
|
8875
10428
|
[
|
|
8876
10429
|
{
|
|
8877
10430
|
name: "evidence-fresh",
|
|
@@ -8885,7 +10438,9 @@ var REGISTRY = [
|
|
|
8885
10438
|
PR_BODY: { optional: true },
|
|
8886
10439
|
BASE_SHA: { optional: true },
|
|
8887
10440
|
GITHUB_TOKEN: { optional: true },
|
|
8888
|
-
GH_TOKEN: { optional: true }
|
|
10441
|
+
GH_TOKEN: { optional: true },
|
|
10442
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10443
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8889
10444
|
}
|
|
8890
10445
|
},
|
|
8891
10446
|
1
|
|
@@ -8896,7 +10451,11 @@ var REGISTRY = [
|
|
|
8896
10451
|
run: bin("check-reader-resolvable-prose"),
|
|
8897
10452
|
scope: "full",
|
|
8898
10453
|
timeoutMs: 30000,
|
|
8899
|
-
env: {
|
|
10454
|
+
env: {
|
|
10455
|
+
BASE_SHA: { optional: true },
|
|
10456
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10457
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10458
|
+
},
|
|
8900
10459
|
include: [
|
|
8901
10460
|
"aeg-root/**/*.md",
|
|
8902
10461
|
"apps/cli/src/**",
|
|
@@ -8914,7 +10473,11 @@ var REGISTRY = [
|
|
|
8914
10473
|
run: bin("check-retired-vocabulary"),
|
|
8915
10474
|
scope: "full",
|
|
8916
10475
|
timeoutMs: 30000,
|
|
8917
|
-
env: {
|
|
10476
|
+
env: {
|
|
10477
|
+
BASE_SHA: { optional: true },
|
|
10478
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10479
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10480
|
+
},
|
|
8918
10481
|
include: ["aeg-root/**/*.md"]
|
|
8919
10482
|
},
|
|
8920
10483
|
0
|
|
@@ -8922,10 +10485,15 @@ var REGISTRY = [
|
|
|
8922
10485
|
[
|
|
8923
10486
|
{
|
|
8924
10487
|
name: "doctrine-portability",
|
|
10488
|
+
advisory: true,
|
|
8925
10489
|
run: bin("check-doctrine-portability"),
|
|
8926
10490
|
scope: "full",
|
|
8927
10491
|
timeoutMs: 30000,
|
|
8928
|
-
env: {
|
|
10492
|
+
env: {
|
|
10493
|
+
BASE_SHA: { optional: true },
|
|
10494
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10495
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10496
|
+
},
|
|
8929
10497
|
include: ["aeg-root/**/*.md"]
|
|
8930
10498
|
},
|
|
8931
10499
|
0
|
|
@@ -8958,7 +10526,11 @@ var REGISTRY = [
|
|
|
8958
10526
|
run: bin("check-exec-bits"),
|
|
8959
10527
|
scope: "diff",
|
|
8960
10528
|
timeoutMs: 30000,
|
|
8961
|
-
env: {
|
|
10529
|
+
env: {
|
|
10530
|
+
BASE_SHA: { optional: true },
|
|
10531
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10532
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10533
|
+
}
|
|
8962
10534
|
},
|
|
8963
10535
|
0
|
|
8964
10536
|
],
|
|
@@ -8968,17 +10540,26 @@ var REGISTRY = [
|
|
|
8968
10540
|
run: bin("check-ci-shard-coverage"),
|
|
8969
10541
|
scope: "diff",
|
|
8970
10542
|
timeoutMs: 15000,
|
|
8971
|
-
env: {
|
|
10543
|
+
env: {
|
|
10544
|
+
BASE_SHA: { optional: true },
|
|
10545
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10546
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10547
|
+
}
|
|
8972
10548
|
},
|
|
8973
10549
|
0
|
|
8974
10550
|
],
|
|
8975
10551
|
[
|
|
8976
10552
|
{
|
|
8977
10553
|
name: "workspace-escape",
|
|
10554
|
+
advisory: true,
|
|
8978
10555
|
run: bin("check-workspace-escape"),
|
|
8979
10556
|
scope: "full",
|
|
8980
10557
|
timeoutMs: 30000,
|
|
8981
|
-
env: {
|
|
10558
|
+
env: {
|
|
10559
|
+
BASE_SHA: { optional: true },
|
|
10560
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10561
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10562
|
+
},
|
|
8982
10563
|
include: ["aeg-root/**/*.md"]
|
|
8983
10564
|
},
|
|
8984
10565
|
0
|
|
@@ -8989,17 +10570,23 @@ var REGISTRY = [
|
|
|
8989
10570
|
run: bin("check-changeset-coverage"),
|
|
8990
10571
|
scope: "diff",
|
|
8991
10572
|
timeoutMs: 15000,
|
|
8992
|
-
env: {
|
|
10573
|
+
env: {
|
|
10574
|
+
BASE_SHA: { optional: true },
|
|
10575
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10576
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10577
|
+
}
|
|
8993
10578
|
},
|
|
8994
10579
|
0
|
|
8995
10580
|
],
|
|
8996
10581
|
[
|
|
8997
10582
|
{
|
|
8998
10583
|
name: "quoted-command",
|
|
10584
|
+
advisory: true,
|
|
8999
10585
|
run: bin("check-quoted-command"),
|
|
9000
|
-
scope: "
|
|
10586
|
+
scope: "full",
|
|
9001
10587
|
timeoutMs: 15000,
|
|
9002
|
-
env: {}
|
|
10588
|
+
env: {},
|
|
10589
|
+
include: ["aeg-root/**/*.md"]
|
|
9003
10590
|
},
|
|
9004
10591
|
0
|
|
9005
10592
|
],
|
|
@@ -9007,7 +10594,7 @@ var REGISTRY = [
|
|
|
9007
10594
|
{
|
|
9008
10595
|
name: "main-branch-refusal",
|
|
9009
10596
|
run: bin("check-main-branch-refusal"),
|
|
9010
|
-
scope: "
|
|
10597
|
+
scope: "diff",
|
|
9011
10598
|
timeoutMs: 15000,
|
|
9012
10599
|
env: { VINAYA_PUSH_REFS: { optional: true } }
|
|
9013
10600
|
},
|
|
@@ -9074,18 +10661,6 @@ var REGISTRY = [
|
|
|
9074
10661
|
},
|
|
9075
10662
|
1
|
|
9076
10663
|
],
|
|
9077
|
-
[
|
|
9078
|
-
{
|
|
9079
|
-
name: "issue-tranche-label",
|
|
9080
|
-
run: bin("check-issue-tranche-label"),
|
|
9081
|
-
validates: "issue",
|
|
9082
|
-
scope: "full",
|
|
9083
|
-
ownWorkflow: true,
|
|
9084
|
-
timeoutMs: 15000,
|
|
9085
|
-
env: { ISSUE_BODY: { optional: true }, ISSUE_LABELS: { optional: true } }
|
|
9086
|
-
},
|
|
9087
|
-
1
|
|
9088
|
-
],
|
|
9089
10664
|
[
|
|
9090
10665
|
{
|
|
9091
10666
|
name: "issue-milestone-attach",
|
|
@@ -9115,24 +10690,24 @@ import {
|
|
|
9115
10690
|
appendFileSync,
|
|
9116
10691
|
closeSync as closeSync4,
|
|
9117
10692
|
constants as fsConstants4,
|
|
9118
|
-
existsSync as
|
|
10693
|
+
existsSync as existsSync8,
|
|
9119
10694
|
fstatSync as fstatSync3,
|
|
9120
10695
|
mkdirSync as mkdirSync4,
|
|
9121
10696
|
lstatSync as lstatSync2,
|
|
9122
10697
|
openSync as openSync4,
|
|
9123
|
-
readFileSync as
|
|
10698
|
+
readFileSync as readFileSync8,
|
|
9124
10699
|
renameSync as renameSync2,
|
|
9125
|
-
writeFileSync as
|
|
10700
|
+
writeFileSync as writeFileSync4,
|
|
9126
10701
|
writeSync as writeSync3
|
|
9127
10702
|
} from "node:fs";
|
|
9128
10703
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
9129
|
-
import { dirname as dirname7, join as
|
|
10704
|
+
import { dirname as dirname7, join as join9 } from "node:path";
|
|
9130
10705
|
import { promisify as promisify5 } from "node:util";
|
|
9131
10706
|
|
|
9132
10707
|
// src/lib/run-paths.ts
|
|
9133
|
-
import { execFileSync as
|
|
9134
|
-
import { chmodSync, existsSync as
|
|
9135
|
-
import { dirname as dirname4, join as
|
|
10708
|
+
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
10709
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
10710
|
+
import { dirname as dirname4, join as join7, resolve as resolvePath } from "node:path";
|
|
9136
10711
|
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
9137
10712
|
var RUN_AREA_DIRNAMES = {
|
|
9138
10713
|
control: CONTROL_AREA_DIRNAME,
|
|
@@ -9151,7 +10726,7 @@ function repoSegment(repo) {
|
|
|
9151
10726
|
return `${repo.owner}-${repo.repo}`;
|
|
9152
10727
|
}
|
|
9153
10728
|
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
9154
|
-
return
|
|
10729
|
+
return join7(home, "runtime", repoSegment(repo));
|
|
9155
10730
|
}
|
|
9156
10731
|
function resolveRuntimeDir(input) {
|
|
9157
10732
|
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
@@ -9172,27 +10747,27 @@ function isInsideRepo(candidate, repoRoot) {
|
|
|
9172
10747
|
return target === root || target.startsWith(`${root}/`);
|
|
9173
10748
|
}
|
|
9174
10749
|
function runPath(runtimeDir, scope, location) {
|
|
9175
|
-
const dir =
|
|
10750
|
+
const dir = join7(runtimeDir, TASKS_EXECUTION_DIRNAME, scopeSegment(scope));
|
|
9176
10751
|
switch (location.area) {
|
|
9177
10752
|
case "task":
|
|
9178
|
-
return location.file ?
|
|
10753
|
+
return location.file ? join7(dir, location.file) : dir;
|
|
9179
10754
|
case "control": {
|
|
9180
|
-
const controlDir =
|
|
9181
|
-
return location.file ?
|
|
10755
|
+
const controlDir = join7(dir, RUN_AREA_DIRNAMES.control);
|
|
10756
|
+
return location.file ? join7(controlDir, location.file) : controlDir;
|
|
9182
10757
|
}
|
|
9183
10758
|
case "rounds":
|
|
9184
|
-
return
|
|
10759
|
+
return join7(dir, RUN_AREA_DIRNAMES.rounds);
|
|
9185
10760
|
case "round": {
|
|
9186
|
-
const roundDir =
|
|
9187
|
-
return location.file ?
|
|
10761
|
+
const roundDir = join7(dir, RUN_AREA_DIRNAMES.rounds, String(location.round));
|
|
10762
|
+
return location.file ? join7(roundDir, location.file) : roundDir;
|
|
9188
10763
|
}
|
|
9189
10764
|
case "developer": {
|
|
9190
|
-
const developerDir =
|
|
9191
|
-
return location.file ?
|
|
10765
|
+
const developerDir = join7(dir, RUN_AREA_DIRNAMES.rounds, String(location.round), "developer");
|
|
10766
|
+
return location.file ? join7(developerDir, location.file) : developerDir;
|
|
9192
10767
|
}
|
|
9193
10768
|
default: {
|
|
9194
|
-
const areaDir =
|
|
9195
|
-
return location.file ?
|
|
10769
|
+
const areaDir = join7(dir, RUN_AREA_DIRNAMES[location.area]);
|
|
10770
|
+
return location.file ? join7(areaDir, location.file) : areaDir;
|
|
9196
10771
|
}
|
|
9197
10772
|
}
|
|
9198
10773
|
}
|
|
@@ -9261,7 +10836,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
9261
10836
|
return null;
|
|
9262
10837
|
}
|
|
9263
10838
|
for (;; ) {
|
|
9264
|
-
if (
|
|
10839
|
+
if (existsSync6(join7(dir, ".git")))
|
|
9265
10840
|
return dir;
|
|
9266
10841
|
const parent = dirname4(dir);
|
|
9267
10842
|
if (parent === dir)
|
|
@@ -9278,7 +10853,7 @@ function resolveRepoSync() {
|
|
|
9278
10853
|
}
|
|
9279
10854
|
let url;
|
|
9280
10855
|
try {
|
|
9281
|
-
url =
|
|
10856
|
+
url = execFileSync8("git", ["remote", "get-url", "origin"], {
|
|
9282
10857
|
encoding: "utf-8",
|
|
9283
10858
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9284
10859
|
}).trim();
|
|
@@ -9305,11 +10880,11 @@ function runtimeDirForThisRepo() {
|
|
|
9305
10880
|
import {
|
|
9306
10881
|
closeSync as closeSync2,
|
|
9307
10882
|
constants as fsConstants2,
|
|
9308
|
-
existsSync as
|
|
10883
|
+
existsSync as existsSync7,
|
|
9309
10884
|
fstatSync as fstatSync2,
|
|
9310
10885
|
mkdirSync as mkdirSync2,
|
|
9311
10886
|
openSync as openSync2,
|
|
9312
|
-
readFileSync as
|
|
10887
|
+
readFileSync as readFileSync6,
|
|
9313
10888
|
readSync,
|
|
9314
10889
|
statSync,
|
|
9315
10890
|
writeSync
|
|
@@ -9346,17 +10921,17 @@ import {
|
|
|
9346
10921
|
mkdirSync as mkdirSync3,
|
|
9347
10922
|
openSync as openSync3,
|
|
9348
10923
|
linkSync,
|
|
9349
|
-
readFileSync as
|
|
10924
|
+
readFileSync as readFileSync7,
|
|
9350
10925
|
renameSync,
|
|
9351
10926
|
statSync as statSync2,
|
|
9352
10927
|
unlinkSync,
|
|
9353
10928
|
utimesSync,
|
|
9354
|
-
writeFileSync as
|
|
10929
|
+
writeFileSync as writeFileSync3,
|
|
9355
10930
|
writeSync as writeSync2
|
|
9356
10931
|
} from "node:fs";
|
|
9357
10932
|
import { randomUUID } from "node:crypto";
|
|
9358
10933
|
import { homedir as homedir2 } from "node:os";
|
|
9359
|
-
import { dirname as dirname6, join as
|
|
10934
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
9360
10935
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
9361
10936
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
9362
10937
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -9437,7 +11012,7 @@ function acquireDrainLock(lockPath) {
|
|
|
9437
11012
|
function renewDrainLock(lockPath, token) {
|
|
9438
11013
|
let holder;
|
|
9439
11014
|
try {
|
|
9440
|
-
holder =
|
|
11015
|
+
holder = readFileSync7(lockPath, "utf8").trim();
|
|
9441
11016
|
} catch (err) {
|
|
9442
11017
|
if (!isEnoent(err))
|
|
9443
11018
|
throw err;
|
|
@@ -9457,7 +11032,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
9457
11032
|
}
|
|
9458
11033
|
function releaseDrainLock(lockPath, token) {
|
|
9459
11034
|
try {
|
|
9460
|
-
const holder =
|
|
11035
|
+
const holder = readFileSync7(lockPath, "utf8").trim();
|
|
9461
11036
|
if (holder !== token)
|
|
9462
11037
|
return;
|
|
9463
11038
|
unlinkSync(lockPath);
|
|
@@ -9507,8 +11082,8 @@ function queueLines(buf) {
|
|
|
9507
11082
|
return lines;
|
|
9508
11083
|
}
|
|
9509
11084
|
function removeQueueHead(path, cut) {
|
|
9510
|
-
const remaining =
|
|
9511
|
-
|
|
11085
|
+
const remaining = readFileSync7(path);
|
|
11086
|
+
writeFileSync3(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
9512
11087
|
}
|
|
9513
11088
|
function queueBucketSize(path) {
|
|
9514
11089
|
let lstat;
|
|
@@ -9528,7 +11103,7 @@ function queueBucketSize(path) {
|
|
|
9528
11103
|
function readQueueFile(path) {
|
|
9529
11104
|
if (queueBucketSize(path) === null)
|
|
9530
11105
|
return null;
|
|
9531
|
-
return
|
|
11106
|
+
return readFileSync7(path);
|
|
9532
11107
|
}
|
|
9533
11108
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
9534
11109
|
const record = JSON.stringify({
|
|
@@ -9643,7 +11218,7 @@ async function drainRenamedAside(args, livePath, source) {
|
|
|
9643
11218
|
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
9644
11219
|
const resolved = await resolveRepo();
|
|
9645
11220
|
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
9646
|
-
const outboxRoot = () =>
|
|
11221
|
+
const outboxRoot = () => join8(GLOBAL_VINAYA_HOME, "outbox");
|
|
9647
11222
|
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
9648
11223
|
const lockPath = `${path}.flush-lock`;
|
|
9649
11224
|
const lockToken = acquireDrainLock(lockPath);
|
|
@@ -9780,7 +11355,7 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
9780
11355
|
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
9781
11356
|
unattended,
|
|
9782
11357
|
env,
|
|
9783
|
-
defaultFolder:
|
|
11358
|
+
defaultFolder: join9(await runtimeDirForRepoAsync(repo), "logs"),
|
|
9784
11359
|
repoRoot
|
|
9785
11360
|
});
|
|
9786
11361
|
}
|
|
@@ -9796,7 +11371,7 @@ function unresolvedLogDestination(env) {
|
|
|
9796
11371
|
const unattended = isUnattendedProcess(process.env);
|
|
9797
11372
|
const repoRoot = repoRootSync();
|
|
9798
11373
|
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
9799
|
-
const defaultFolder =
|
|
11374
|
+
const defaultFolder = join9(runtimeDir, "logs");
|
|
9800
11375
|
const resolved = resolveLogDestinationFrom({
|
|
9801
11376
|
localConfig,
|
|
9802
11377
|
trustAnchorConfig: null,
|
|
@@ -9809,7 +11384,7 @@ function unresolvedLogDestination(env) {
|
|
|
9809
11384
|
}
|
|
9810
11385
|
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9811
11386
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9812
|
-
return
|
|
11387
|
+
return join9(stateRoot, "fallback", `${dirName}.json`);
|
|
9813
11388
|
}
|
|
9814
11389
|
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9815
11390
|
const message = describeFolderFallback(reason);
|
|
@@ -9825,7 +11400,7 @@ function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot =
|
|
|
9825
11400
|
};
|
|
9826
11401
|
const path = folderFallbackStatePath(repo, stateRoot);
|
|
9827
11402
|
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9828
|
-
|
|
11403
|
+
writeFileSync4(path, `${JSON.stringify(record)}
|
|
9829
11404
|
`, { mode: 384 });
|
|
9830
11405
|
} catch {}
|
|
9831
11406
|
}
|
|
@@ -9840,7 +11415,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
9840
11415
|
} catch (err) {
|
|
9841
11416
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
9842
11417
|
}
|
|
9843
|
-
if (!
|
|
11418
|
+
if (!existsSync8(join9(toplevel, "aeg-root", "roles")))
|
|
9844
11419
|
return vinayaVersion;
|
|
9845
11420
|
try {
|
|
9846
11421
|
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
@@ -9941,7 +11516,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
9941
11516
|
}
|
|
9942
11517
|
function readVinayaVersion() {
|
|
9943
11518
|
try {
|
|
9944
|
-
const pkg = JSON.parse(
|
|
11519
|
+
const pkg = JSON.parse(readFileSync8(join9(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
9945
11520
|
return pkg.version ?? "unknown";
|
|
9946
11521
|
} catch {
|
|
9947
11522
|
return "unknown";
|
|
@@ -9959,7 +11534,7 @@ function safeRepoSlug(repo) {
|
|
|
9959
11534
|
function outboxPathFor(deps, repo, issue) {
|
|
9960
11535
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9961
11536
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
9962
|
-
return
|
|
11537
|
+
return join9(deps.outboxRoot(), dirName, fileName);
|
|
9963
11538
|
}
|
|
9964
11539
|
function hostFromEnv(env) {
|
|
9965
11540
|
if (env.GITHUB_ACTIONS)
|
|
@@ -10014,7 +11589,7 @@ async function resolveHeadSha(cwd) {
|
|
|
10014
11589
|
}
|
|
10015
11590
|
function defaultDeps() {
|
|
10016
11591
|
return {
|
|
10017
|
-
outboxRoot: () =>
|
|
11592
|
+
outboxRoot: () => join9(GLOBAL_VINAYA_HOME, "outbox"),
|
|
10018
11593
|
home: () => homedir3(),
|
|
10019
11594
|
hostname: () => osHostname(),
|
|
10020
11595
|
cwd: () => process.cwd(),
|
|
@@ -10059,7 +11634,7 @@ function appendHardenedLine(path, line) {
|
|
|
10059
11634
|
function reportRotationOverflow(backupPath, warn) {
|
|
10060
11635
|
let raw;
|
|
10061
11636
|
try {
|
|
10062
|
-
raw =
|
|
11637
|
+
raw = readFileSync8(backupPath, "utf8");
|
|
10063
11638
|
} catch {
|
|
10064
11639
|
return;
|
|
10065
11640
|
}
|
|
@@ -10272,12 +11847,14 @@ function createLogSink(overrides = {}) {
|
|
|
10272
11847
|
branchIssue,
|
|
10273
11848
|
eventId: randomUUID2(),
|
|
10274
11849
|
processId,
|
|
11850
|
+
revision: headSha,
|
|
11851
|
+
provenance: deps.provenance,
|
|
10275
11852
|
inputVersions: deps.inputVersions()
|
|
10276
11853
|
});
|
|
10277
11854
|
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
10278
11855
|
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
10279
11856
|
folderFallbackRecorded = true;
|
|
10280
|
-
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder),
|
|
11857
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join9(deps.home(), ".vinaya"));
|
|
10281
11858
|
}
|
|
10282
11859
|
const full = { ...e, ...header };
|
|
10283
11860
|
const parsed = LogEventSchema.safeParse(full);
|
|
@@ -10402,20 +11979,40 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
10402
11979
|
|
|
10403
11980
|
// src/lib/diff-evidence.ts
|
|
10404
11981
|
function fileDiffAgainst(ref, path) {
|
|
10405
|
-
let
|
|
11982
|
+
let committed;
|
|
10406
11983
|
try {
|
|
10407
|
-
|
|
11984
|
+
committed = execFileSync9("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
10408
11985
|
encoding: "utf8",
|
|
10409
11986
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10410
11987
|
}).trim();
|
|
10411
11988
|
} catch {
|
|
10412
11989
|
return null;
|
|
10413
11990
|
}
|
|
11991
|
+
const staged = stagedDiff(["--", path]);
|
|
11992
|
+
if (staged === null)
|
|
11993
|
+
return null;
|
|
11994
|
+
const out = [committed, staged].filter(Boolean).join(`
|
|
11995
|
+
`);
|
|
10414
11996
|
return out === "" ? null : out;
|
|
10415
11997
|
}
|
|
11998
|
+
function readsStagedDiff() {
|
|
11999
|
+
return process.env.VINAYA_COMMIT_HOOK === "1" && Boolean(process.env.GIT_INDEX_FILE);
|
|
12000
|
+
}
|
|
12001
|
+
function stagedDiff(args) {
|
|
12002
|
+
if (!readsStagedDiff())
|
|
12003
|
+
return "";
|
|
12004
|
+
try {
|
|
12005
|
+
return execFileSync9("git", ["diff", "--cached", ...args], {
|
|
12006
|
+
encoding: "utf8",
|
|
12007
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
12008
|
+
}).trim();
|
|
12009
|
+
} catch {
|
|
12010
|
+
return null;
|
|
12011
|
+
}
|
|
12012
|
+
}
|
|
10416
12013
|
function revParse(ref) {
|
|
10417
12014
|
try {
|
|
10418
|
-
return
|
|
12015
|
+
return execFileSync9("git", ["rev-parse", "--verify", ref], {
|
|
10419
12016
|
encoding: "utf8",
|
|
10420
12017
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10421
12018
|
}).trim();
|
|
@@ -10425,7 +12022,7 @@ function revParse(ref) {
|
|
|
10425
12022
|
}
|
|
10426
12023
|
function repoRoot() {
|
|
10427
12024
|
try {
|
|
10428
|
-
return
|
|
12025
|
+
return execFileSync9("git", ["rev-parse", "--show-toplevel"], {
|
|
10429
12026
|
encoding: "utf8",
|
|
10430
12027
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10431
12028
|
}).trim();
|
|
@@ -10436,7 +12033,7 @@ function repoRoot() {
|
|
|
10436
12033
|
function changedFiles(base) {
|
|
10437
12034
|
let out;
|
|
10438
12035
|
try {
|
|
10439
|
-
out =
|
|
12036
|
+
out = execFileSync9("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
10440
12037
|
encoding: "utf8",
|
|
10441
12038
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10442
12039
|
}).trim();
|
|
@@ -10446,6 +12043,13 @@ function changedFiles(base) {
|
|
|
10446
12043
|
return out === "" ? [] : out.split(`
|
|
10447
12044
|
`).map((s) => s.trim()).filter(Boolean);
|
|
10448
12045
|
}
|
|
12046
|
+
function stagedChangedFiles() {
|
|
12047
|
+
const out = stagedDiff(["--name-only"]);
|
|
12048
|
+
if (out === null)
|
|
12049
|
+
return null;
|
|
12050
|
+
return out === "" ? [] : out.split(`
|
|
12051
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
12052
|
+
}
|
|
10449
12053
|
function resolveChangedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
10450
12054
|
return resolveDiff(base)?.files ?? null;
|
|
10451
12055
|
}
|
|
@@ -10461,7 +12065,30 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
10461
12065
|
const relPaths = changedFiles(ref);
|
|
10462
12066
|
if (relPaths === null)
|
|
10463
12067
|
continue;
|
|
10464
|
-
|
|
12068
|
+
const stagedPaths = stagedChangedFiles();
|
|
12069
|
+
if (stagedPaths === null)
|
|
12070
|
+
return null;
|
|
12071
|
+
const paths = [...new Set([...relPaths, ...stagedPaths])];
|
|
12072
|
+
return { base: ref, root, files: paths.map((p) => join10(root, p)) };
|
|
12073
|
+
}
|
|
12074
|
+
return null;
|
|
12075
|
+
}
|
|
12076
|
+
function resolveAddedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
12077
|
+
if (repoRoot() === null)
|
|
12078
|
+
return null;
|
|
12079
|
+
const head = revParse("HEAD");
|
|
12080
|
+
for (const ref of new Set([base, "origin/main", "main"])) {
|
|
12081
|
+
const resolved = revParse(ref);
|
|
12082
|
+
if (resolved === null || resolved === head)
|
|
12083
|
+
continue;
|
|
12084
|
+
try {
|
|
12085
|
+
const out = execFileSync9("git", ["diff", "--name-only", "--diff-filter=A", `${ref}...HEAD`], {
|
|
12086
|
+
encoding: "utf8",
|
|
12087
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
12088
|
+
}).trim();
|
|
12089
|
+
return out === "" ? [] : out.split(`
|
|
12090
|
+
`).map((p) => p.trim()).filter(Boolean);
|
|
12091
|
+
} catch {}
|
|
10465
12092
|
}
|
|
10466
12093
|
return null;
|
|
10467
12094
|
}
|
|
@@ -10494,13 +12121,14 @@ function findingsInThisDiff(findings) {
|
|
|
10494
12121
|
|
|
10495
12122
|
// src/checks/bin/check-reader-resolvable-prose.ts
|
|
10496
12123
|
var CHECK_NAME = "reader-resolvable-prose";
|
|
10497
|
-
var
|
|
12124
|
+
var CONFIG = loadConfigChecked();
|
|
12125
|
+
var proseGates = CONFIG.ok ? CONFIG.config?.proseGates : undefined;
|
|
10498
12126
|
function resolveCheckDoctrineRoot() {
|
|
10499
12127
|
if (proseGates?.doctrineRoot !== undefined)
|
|
10500
12128
|
return proseGates.doctrineRoot;
|
|
10501
12129
|
const root = repoRoot();
|
|
10502
12130
|
if (root !== null) {
|
|
10503
|
-
const candidate =
|
|
12131
|
+
const candidate = join11(root, "aeg-root");
|
|
10504
12132
|
if (hasDoctrineEntry(candidate))
|
|
10505
12133
|
return candidate;
|
|
10506
12134
|
}
|
|
@@ -10515,13 +12143,18 @@ var SOURCE_COMMENTS_GLOBS = proseGates?.sourceComments?.globs ?? [];
|
|
|
10515
12143
|
var SOURCE_COMMENTS_ALLOWLIST = proseGates?.sourceComments?.allowlist ?? [];
|
|
10516
12144
|
var SOURCE_COMMENTS_SEVERITY = proseGates?.sourceComments?.severity ?? "warning";
|
|
10517
12145
|
var SPEC_GRANDFATHER = proseGates?.specGrandfather ?? [];
|
|
10518
|
-
var
|
|
12146
|
+
var PRODUCT_PATHS = proseGates?.productPaths ?? PRODUCT_SLUG_SCOPE;
|
|
12147
|
+
var DECISION_RECORDS_PATH = CONFIG.ok ? CONFIG.config?.decisionRecords?.path : undefined;
|
|
12148
|
+
var DECISION_RECORDS_PATHS = DECISION_RECORDS_PATH === undefined ? [] : [DECISION_RECORDS_PATH];
|
|
12149
|
+
var SPEC_PATHS = [
|
|
12150
|
+
...new Set([...DEFAULT_SPEC_PATHS, ...proseGates?.specPaths ?? [], ...DECISION_RECORDS_PATHS].map(normalizeSpecPath))
|
|
12151
|
+
];
|
|
10519
12152
|
function containedRelativePath(root, path) {
|
|
10520
12153
|
const abs = resolve3(root, path);
|
|
10521
12154
|
const lexical = relative3(resolve3(root), abs);
|
|
10522
12155
|
if (escapesRoot(lexical))
|
|
10523
12156
|
return null;
|
|
10524
|
-
if (
|
|
12157
|
+
if (existsSync9(abs) && escapesRoot(relative3(realPathOrSelf(resolve3(root)), realPathOrSelf(abs))))
|
|
10525
12158
|
return null;
|
|
10526
12159
|
return normalizeSpecPath(lexical);
|
|
10527
12160
|
}
|
|
@@ -10543,7 +12176,7 @@ function collect(dir, out = []) {
|
|
|
10543
12176
|
return out;
|
|
10544
12177
|
}
|
|
10545
12178
|
for (const name of entries) {
|
|
10546
|
-
const full =
|
|
12179
|
+
const full = join11(dir, name);
|
|
10547
12180
|
let isDir;
|
|
10548
12181
|
try {
|
|
10549
12182
|
isDir = statSync3(full).isDirectory();
|
|
@@ -10561,13 +12194,13 @@ function collect(dir, out = []) {
|
|
|
10561
12194
|
return out;
|
|
10562
12195
|
}
|
|
10563
12196
|
function readAll(paths) {
|
|
10564
|
-
return paths.map((p) => ({ path: p, content:
|
|
12197
|
+
return paths.map((p) => ({ path: p, content: readFileSync9(p, "utf8") }));
|
|
10565
12198
|
}
|
|
10566
12199
|
var PRODUCT_SCOPE_EXTENSIONS = new Set([".ts", ".tsx", ".yml", ".md"]);
|
|
10567
12200
|
function collectProductScopeFiles(root) {
|
|
10568
12201
|
const out = [];
|
|
10569
|
-
for (const prefix of
|
|
10570
|
-
const abs =
|
|
12202
|
+
for (const prefix of PRODUCT_PATHS) {
|
|
12203
|
+
const abs = join11(root, prefix);
|
|
10571
12204
|
let isDir;
|
|
10572
12205
|
try {
|
|
10573
12206
|
isDir = statSync3(abs).isDirectory();
|
|
@@ -10587,7 +12220,7 @@ function collectProductScopeFiles(root) {
|
|
|
10587
12220
|
return out;
|
|
10588
12221
|
}
|
|
10589
12222
|
function readProductFiles(root, relPaths) {
|
|
10590
|
-
return relPaths.map((rel) => ({ path: rel, content:
|
|
12223
|
+
return relPaths.map((rel) => ({ path: rel, content: readFileSync9(join11(root, rel), "utf8") }));
|
|
10591
12224
|
}
|
|
10592
12225
|
function collectSpecFiles(root, specPaths) {
|
|
10593
12226
|
const out = [];
|
|
@@ -10597,7 +12230,7 @@ function collectSpecFiles(root, specPaths) {
|
|
|
10597
12230
|
console.log(`${CHECK_NAME}: ignoring spec path "${entry}" — it resolves outside the repository under check, and this class only ever reads this repository's own files.`);
|
|
10598
12231
|
continue;
|
|
10599
12232
|
}
|
|
10600
|
-
const abs =
|
|
12233
|
+
const abs = join11(root, rel);
|
|
10601
12234
|
let isDir;
|
|
10602
12235
|
try {
|
|
10603
12236
|
isDir = statSync3(abs).isDirectory();
|
|
@@ -10614,12 +12247,12 @@ function collectSpecFiles(root, specPaths) {
|
|
|
10614
12247
|
out.push(rel);
|
|
10615
12248
|
}
|
|
10616
12249
|
}
|
|
10617
|
-
const appsDir =
|
|
12250
|
+
const appsDir = join11(root, "apps");
|
|
10618
12251
|
let appNames;
|
|
10619
12252
|
try {
|
|
10620
12253
|
appNames = readdirSync3(appsDir).filter((name) => {
|
|
10621
12254
|
try {
|
|
10622
|
-
return statSync3(
|
|
12255
|
+
return statSync3(join11(appsDir, name)).isDirectory();
|
|
10623
12256
|
} catch {
|
|
10624
12257
|
return false;
|
|
10625
12258
|
}
|
|
@@ -10628,7 +12261,7 @@ function collectSpecFiles(root, specPaths) {
|
|
|
10628
12261
|
return [...new Set(out)];
|
|
10629
12262
|
}
|
|
10630
12263
|
for (const app of appNames) {
|
|
10631
|
-
const specsDir =
|
|
12264
|
+
const specsDir = join11(appsDir, app, "specs");
|
|
10632
12265
|
let isDir;
|
|
10633
12266
|
try {
|
|
10634
12267
|
isDir = statSync3(specsDir).isDirectory();
|
|
@@ -10648,7 +12281,7 @@ function collectSpecFiles(root, specPaths) {
|
|
|
10648
12281
|
function collectSourceCommentFiles(root, globs) {
|
|
10649
12282
|
const out = [];
|
|
10650
12283
|
for (const prefix of globs) {
|
|
10651
|
-
const abs =
|
|
12284
|
+
const abs = join11(root, prefix);
|
|
10652
12285
|
let isDir;
|
|
10653
12286
|
try {
|
|
10654
12287
|
isDir = statSync3(abs).isDirectory();
|
|
@@ -10668,7 +12301,7 @@ function collectSourceCommentFiles(root, globs) {
|
|
|
10668
12301
|
return out;
|
|
10669
12302
|
}
|
|
10670
12303
|
function legacySlugs(legacySlugDir) {
|
|
10671
|
-
if (!
|
|
12304
|
+
if (!existsSync9(legacySlugDir))
|
|
10672
12305
|
return { slugs: [], dormant: true };
|
|
10673
12306
|
try {
|
|
10674
12307
|
const slugs = readdirSync3(legacySlugDir).filter((f) => f.endsWith(".md") && !f.endsWith(".tokens.md")).map((f) => f.slice(0, -3)).filter((slug) => !/-v[0-9]+$/.test(slug));
|
|
@@ -10678,7 +12311,20 @@ function legacySlugs(legacySlugDir) {
|
|
|
10678
12311
|
return { slugs: [], dormant: true };
|
|
10679
12312
|
}
|
|
10680
12313
|
}
|
|
12314
|
+
var CUSTOM_RULE_RECOVERY = "This text matches one of this repository's own writing rules (proseGates.rules.custom in vinaya.config.json); " + "the finding names the rule and what it means. Rewrite the text so it no longer matches, or, where the rule " + "should not read this file, add the path to that rule's exempt list.";
|
|
12315
|
+
var DECISION_RECORD_RECOVERY = "This text cites a decision record by its number (decision-record-citation, on while decisionRecords.path is " + "set in vinaya.config.json). A number tells a reader nothing without the folder in front of them: state the " + "decision itself in this sentence instead. Only a record inside the decision-record folder may name another " + "record, such as the one it supersedes.";
|
|
10681
12316
|
function main() {
|
|
12317
|
+
if (!CONFIG.ok) {
|
|
12318
|
+
console.log(`${CHECK_NAME}: configuration refused — sweep did not run.`);
|
|
12319
|
+
emitCheckError({
|
|
12320
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
12321
|
+
check: CHECK_NAME,
|
|
12322
|
+
severity: "error",
|
|
12323
|
+
message: `${CONFIG.path}: ${CONFIG.error}`,
|
|
12324
|
+
agent_recovery_prompt: "Fix the vinaya.config.json keys named above; every refused key is named with the reason. This check does " + "not fall back to its defaults while the configuration is malformed."
|
|
12325
|
+
});
|
|
12326
|
+
process.exit(2);
|
|
12327
|
+
}
|
|
10682
12328
|
if (DOCTRINE_ROOT === null) {
|
|
10683
12329
|
console.log(`${CHECK_NAME}: doctrine root unresolvable — sweep did not run.`);
|
|
10684
12330
|
emitCheckError({
|
|
@@ -10694,6 +12340,13 @@ function main() {
|
|
|
10694
12340
|
const shipsPaths = collect(DOCTRINE_ROOT).filter((p) => p.endsWith(".md"));
|
|
10695
12341
|
const readerFacingPaths = READER_FACING_ACTIVE && READER_FACING_SUFFIX !== null ? collect(READER_FACING_PREFIX).filter((p) => p.endsWith(READER_FACING_SUFFIX)) : [];
|
|
10696
12342
|
const productRoot = repoRoot() ?? process.cwd();
|
|
12343
|
+
const rules = resolveProseRules(proseGates?.rules, {
|
|
12344
|
+
sourceCommentSeverity: SOURCE_COMMENTS_SEVERITY,
|
|
12345
|
+
repoRoot: productRoot,
|
|
12346
|
+
decisionRecordsPath: DECISION_RECORDS_PATH
|
|
12347
|
+
});
|
|
12348
|
+
const customIds = new Set(rulesOfGroup(rules, "reader-resolvable").filter((rule) => rule.custom).map((rule) => rule.id));
|
|
12349
|
+
const isCustom = (finding) => customIds.has(finding.rule);
|
|
10697
12350
|
const productRelPaths = collectProductScopeFiles(productRoot);
|
|
10698
12351
|
const productFiles = readProductFiles(productRoot, productRelPaths);
|
|
10699
12352
|
const sourceCommentRelPaths = collectSourceCommentFiles(productRoot, SOURCE_COMMENTS_GLOBS);
|
|
@@ -10701,13 +12354,13 @@ function main() {
|
|
|
10701
12354
|
const specRelPaths = collectSpecFiles(productRoot, SPEC_PATHS);
|
|
10702
12355
|
const specFiles = readProductFiles(productRoot, specRelPaths);
|
|
10703
12356
|
const files = [...readAll([...shipsPaths, ...readerFacingPaths]), ...productFiles, ...specFiles];
|
|
10704
|
-
const glossaryPath =
|
|
10705
|
-
const glossaryTerms =
|
|
12357
|
+
const glossaryPath = join11(DOCTRINE_ROOT, "glossary.md");
|
|
12358
|
+
const glossaryTerms = existsSync9(glossaryPath) ? parseGlossaryTerms(readFileSync9(glossaryPath, "utf8")) : [];
|
|
10706
12359
|
const legacySlugDir = LEGACY_SLUG_DIR ?? `${DOCTRINE_ROOT}/tranches/completed`;
|
|
10707
12360
|
const { slugs, dormant: legacySlugsDormant } = legacySlugs(legacySlugDir);
|
|
10708
12361
|
const readerFacingPrefix = READER_FACING_ACTIVE && READER_FACING_PREFIX !== null ? `${READER_FACING_PREFIX}/` : "/no-reader-facing-surface";
|
|
10709
12362
|
const readerFacingSuffix = READER_FACING_ACTIVE && READER_FACING_SUFFIX !== null ? READER_FACING_SUFFIX : "/page.tsx";
|
|
10710
|
-
const findings = checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, slugs, shipsPrefix, SPEC_GRANDFATHER, SPEC_PATHS);
|
|
12363
|
+
const findings = checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, slugs, shipsPrefix, SPEC_GRANDFATHER, SPEC_PATHS, { rules, productPaths: PRODUCT_PATHS });
|
|
10711
12364
|
const reportable = findingsInThisDiff(findings);
|
|
10712
12365
|
if (Array.isArray(SPEC_GRANDFATHER)) {
|
|
10713
12366
|
for (const path of SPEC_GRANDFATHER) {
|
|
@@ -10721,9 +12374,9 @@ function main() {
|
|
|
10721
12374
|
});
|
|
10722
12375
|
}
|
|
10723
12376
|
}
|
|
10724
|
-
const sourceCommentFindings = checkSourceComments(sourceCommentFiles, SOURCE_COMMENTS_ALLOWLIST);
|
|
12377
|
+
const sourceCommentFindings = checkSourceComments(sourceCommentFiles, SOURCE_COMMENTS_ALLOWLIST, { rules });
|
|
10725
12378
|
const reportableSourceComments = findingsInThisDiff(sourceCommentFindings);
|
|
10726
|
-
console.log(`${CHECK_NAME}: doctrine root "${DOCTRINE_ROOT}"; reader-facing class ${READER_FACING_ACTIVE ? "ran" : "dormant — proseGates.readerFacingPrefix/readerFacingSuffix not both set"}; ` + `legacy-slug class ${legacySlugsDormant ? `dormant — ${legacySlugDir} is absent` : `ran (${slugs.length} slug(s))`}; ` + `product class ran (${productRelPaths.length} file(s) swept); ` + `spec class ran (${specRelPaths.length} file(s) swept, ${specGrandfatherPaths(SPEC_GRANDFATHER).length} grandfathered); ` + `source-comment class ${SOURCE_COMMENTS_GLOBS.length === 0 ? "dormant — proseGates.sourceComments.globs not set" : `ran (${sourceCommentRelPaths.length} file(s) swept, severity: ${SOURCE_COMMENTS_SEVERITY})`}; ` + `${findings.length + sourceCommentFindings.length} finding(s) swept, ${reportable.length + reportableSourceComments.length} in this diff`);
|
|
12379
|
+
console.log(`${CHECK_NAME}: doctrine root "${DOCTRINE_ROOT}"; reader-facing class ${READER_FACING_ACTIVE ? "ran" : "dormant — proseGates.readerFacingPrefix/readerFacingSuffix not both set"}; ` + `legacy-slug class ${legacySlugsDormant ? `dormant — ${legacySlugDir} is absent` : `ran (${slugs.length} slug(s))`}; ` + `product class ran (${productRelPaths.length} file(s) swept); ` + `spec class ran (${specRelPaths.length} file(s) swept, ${specGrandfatherPaths(SPEC_GRANDFATHER).length} grandfathered); ` + `source-comment class ${SOURCE_COMMENTS_GLOBS.length === 0 ? "dormant — proseGates.sourceComments.globs not set" : `ran (${sourceCommentRelPaths.length} file(s) swept, severity: ${SOURCE_COMMENTS_SEVERITY})`}; ` + `${rulesOfGroup(rules, "reader-resolvable").length} rule(s) (${customIds.size} custom); ` + `${findings.length + sourceCommentFindings.length} finding(s) swept, ${reportable.length + reportableSourceComments.length} in this diff`);
|
|
10727
12380
|
let hasBlocking = false;
|
|
10728
12381
|
for (const finding of reportable) {
|
|
10729
12382
|
if (finding.blocking)
|
|
@@ -10735,11 +12388,11 @@ function main() {
|
|
|
10735
12388
|
message: `${finding.file}:${finding.line}: ${finding.message}`,
|
|
10736
12389
|
file: finding.file,
|
|
10737
12390
|
line: finding.line,
|
|
10738
|
-
agent_recovery_prompt: finding.message.includes("coined term") ? "This page uses AEG/Vinaya-internal vocabulary a first-time reader cannot resolve. Either define the term " + 'inline (the same "Term — one-sentence definition" shape the glossary uses) at its first use on this page, ' + "or link to the glossary. Do not simply delete the word if the sentence needs it." : finding.blocking && !finding.message.includes("in product code") ? "This spec cites a tranche, a task number, an Issue/PR number, or names a document outside this " + "repository as its authority — a reader with no forge to resolve it against (a fork, an export, someone " + "reading this spec after the Issue is closed) gets nothing from the citation, and a copied task number " + "goes stale the moment the plan is renumbered. Rewrite the sentence to state the fact " + "plainly instead. If this spec is pre-existing backlog, list its path in " + "`proseGates.specGrandfather` with its current finding count rather than fixing it as a drive-by in an " + "unrelated PR — a listed file that gains a citation exceeds its count and fails." : finding.blocking ? "This product-code file cites an internal tranche slug a reader outside this repo cannot resolve " + "(the reader-resolvable-prose product class). Remove the citation or rewrite the comment/doc to state " + "the fact plainly instead of pointing at the tranche that did it. This finding blocks the push and CI." : "This doctrine or page cites a forge number or an internal tranche slug the reader has no tracker to " + "resolve. Rewrite the sentence to state the fact plainly instead of pointing at the citation — say " + "what was learned/decided, not where it was logged."
|
|
12391
|
+
agent_recovery_prompt: isCustom(finding) ? CUSTOM_RULE_RECOVERY : finding.rule === DECISION_RECORD_CITATION_ID ? DECISION_RECORD_RECOVERY : finding.message.includes("coined term") ? "This page uses AEG/Vinaya-internal vocabulary a first-time reader cannot resolve. Either define the term " + 'inline (the same "Term — one-sentence definition" shape the glossary uses) at its first use on this page, ' + "or link to the glossary. Do not simply delete the word if the sentence needs it." : finding.blocking && !finding.message.includes("in product code") ? "This spec cites a tranche, a task number, an Issue/PR number, or names a document outside this " + "repository as its authority — a reader with no forge to resolve it against (a fork, an export, someone " + "reading this spec after the Issue is closed) gets nothing from the citation, and a copied task number " + "goes stale the moment the plan is renumbered. Rewrite the sentence to state the fact " + "plainly instead. If this spec is pre-existing backlog, list its path in " + "`proseGates.specGrandfather` with its current finding count rather than fixing it as a drive-by in an " + "unrelated PR — a listed file that gains a citation exceeds its count and fails." : finding.blocking ? "This product-code file cites an internal tranche slug a reader outside this repo cannot resolve " + "(the reader-resolvable-prose product class). Remove the citation or rewrite the comment/doc to state " + "the fact plainly instead of pointing at the tranche that did it. This finding blocks the push and CI." : "This doctrine or page cites a forge number or an internal tranche slug the reader has no tracker to " + "resolve. Rewrite the sentence to state the fact plainly instead of pointing at the citation — say " + "what was learned/decided, not where it was logged."
|
|
10739
12392
|
});
|
|
10740
12393
|
}
|
|
10741
12394
|
for (const finding of reportableSourceComments) {
|
|
10742
|
-
const blocking =
|
|
12395
|
+
const blocking = finding.blocking;
|
|
10743
12396
|
if (blocking)
|
|
10744
12397
|
hasBlocking = true;
|
|
10745
12398
|
emitCheckError({
|
|
@@ -10749,7 +12402,7 @@ function main() {
|
|
|
10749
12402
|
message: `${finding.file}:${finding.line}: ${finding.message}`,
|
|
10750
12403
|
file: finding.file,
|
|
10751
12404
|
line: finding.line,
|
|
10752
|
-
agent_recovery_prompt: "This source comment cites a tranche name or a forge number a reader outside this repo cannot resolve. " + "Rewrite the comment to state the fact it pointed at, or, for a comment that deliberately pins historical " + "content (a test fixture), add its file path to proseGates.sourceComments.allowlist in vinaya.config.json."
|
|
12405
|
+
agent_recovery_prompt: isCustom(finding) ? CUSTOM_RULE_RECOVERY : finding.rule === DECISION_RECORD_CITATION_ID ? DECISION_RECORD_RECOVERY : "This source comment cites a tranche name or a forge number a reader outside this repo cannot resolve. " + "Rewrite the comment to state the fact it pointed at, or, for a comment that deliberately pins historical " + "content (a test fixture), add its file path to proseGates.sourceComments.allowlist in vinaya.config.json."
|
|
10753
12406
|
});
|
|
10754
12407
|
}
|
|
10755
12408
|
process.exit(hasBlocking ? 1 : 0);
|