@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,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-first-push-dispatch.ts
|
|
4
|
-
import { execFileSync as
|
|
4
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
5
5
|
|
|
6
6
|
// ../../packages/aeg-core/src/entry-point.ts
|
|
7
7
|
import { realpathSync } from "node:fs";
|
|
@@ -42,7 +42,6 @@ var GATE_AUDIENCE = {
|
|
|
42
42
|
};
|
|
43
43
|
var NON_GATE_BINS = [
|
|
44
44
|
"archive-task",
|
|
45
|
-
"assign-task-issue",
|
|
46
45
|
"dead-branch-audit",
|
|
47
46
|
"eval-agent-compliance",
|
|
48
47
|
"open-issue",
|
|
@@ -305,6 +304,25 @@ async function runAsync(args) {
|
|
|
305
304
|
function ghApiGet(path) {
|
|
306
305
|
return JSON.parse(run(["api", path]));
|
|
307
306
|
}
|
|
307
|
+
var MAX_PER_PAGE = 100;
|
|
308
|
+
var MAX_PAGES = 100;
|
|
309
|
+
async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
310
|
+
const [base = pathWithoutPage, query = ""] = pathWithoutPage.split("?");
|
|
311
|
+
const params = new URLSearchParams(query);
|
|
312
|
+
params.set("per_page", String(MAX_PER_PAGE));
|
|
313
|
+
const all = [];
|
|
314
|
+
for (let page = 1;page <= MAX_PAGES; page++) {
|
|
315
|
+
params.set("page", String(page));
|
|
316
|
+
const args = ["api", `${base}?${params.toString()}`];
|
|
317
|
+
if (opts?.jq)
|
|
318
|
+
args.push("-q", opts.jq);
|
|
319
|
+
const batch = JSON.parse(await runAsync(args));
|
|
320
|
+
all.push(...batch);
|
|
321
|
+
if (batch.length < MAX_PER_PAGE)
|
|
322
|
+
return all;
|
|
323
|
+
}
|
|
324
|
+
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
325
|
+
}
|
|
308
326
|
function issueListByLabelArgs(owner, repo, label) {
|
|
309
327
|
return [
|
|
310
328
|
"issue",
|
|
@@ -716,6 +734,10 @@ function intentGoalForSlug(description, slug) {
|
|
|
716
734
|
function matchesLegacyMilestone(milestones, slug) {
|
|
717
735
|
return milestones.find((m) => m.title === slug) ?? null;
|
|
718
736
|
}
|
|
737
|
+
var TRANCHE_SLUG_SHAPE = /^[a-z0-9]+(?:-[a-z0-9]+)*-v\d+$/;
|
|
738
|
+
function slugShapedTitles(milestones) {
|
|
739
|
+
return milestones.map((m) => m.title).filter((t) => TRANCHE_SLUG_SHAPE.test(t));
|
|
740
|
+
}
|
|
719
741
|
function factsFromLegacyMilestone(milestone) {
|
|
720
742
|
return {
|
|
721
743
|
goal: milestone.description ?? "",
|
|
@@ -749,6 +771,90 @@ function findMilestoneForSlug(owner, repo, slug) {
|
|
|
749
771
|
return resolveLegacyFacts(legacy, issues);
|
|
750
772
|
return { goal: goalFromMilestones(milestones, slug), lifecycle: lifecycleFromIssues(issues) };
|
|
751
773
|
}
|
|
774
|
+
function trancheSlugsFromLabels(labels) {
|
|
775
|
+
const slugs = [];
|
|
776
|
+
for (const l of labels) {
|
|
777
|
+
const slug = trancheSlugOf(l.name);
|
|
778
|
+
if (slug !== null)
|
|
779
|
+
slugs.push(slug);
|
|
780
|
+
}
|
|
781
|
+
return slugs;
|
|
782
|
+
}
|
|
783
|
+
async function indexTrancheMilestonesAsync(owner, repo) {
|
|
784
|
+
const [milestones, labels] = await Promise.all([
|
|
785
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
786
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
|
|
787
|
+
]);
|
|
788
|
+
const active = [];
|
|
789
|
+
const archived = [];
|
|
790
|
+
const facts = new Map;
|
|
791
|
+
const legacySlugs = new Set(slugShapedTitles(milestones));
|
|
792
|
+
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
793
|
+
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
794
|
+
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
795
|
+
const uniqueLegacySlugs = [...legacySlugs];
|
|
796
|
+
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
797
|
+
Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
|
|
798
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
|
|
799
|
+
]);
|
|
800
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
801
|
+
const m = legacyMilestoneBySlug.get(slug);
|
|
802
|
+
if (!m)
|
|
803
|
+
return;
|
|
804
|
+
const ref = { slug, goal: m.description ?? "" };
|
|
805
|
+
const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
|
|
806
|
+
if (f.lifecycle === "complete")
|
|
807
|
+
archived.push(ref);
|
|
808
|
+
else if (f.lifecycle === "active")
|
|
809
|
+
active.push(ref);
|
|
810
|
+
facts.set(slug, f);
|
|
811
|
+
});
|
|
812
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
813
|
+
const issues = newPathIssuesBySlug[i] ?? [];
|
|
814
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
815
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
816
|
+
const f = { goal, lifecycle };
|
|
817
|
+
facts.set(slug, f);
|
|
818
|
+
if (lifecycle === "active")
|
|
819
|
+
active.push({ slug, goal });
|
|
820
|
+
else if (lifecycle === "complete")
|
|
821
|
+
archived.push({ slug, goal });
|
|
822
|
+
});
|
|
823
|
+
return { active, archived, facts, legacySlugs };
|
|
824
|
+
}
|
|
825
|
+
async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
|
|
826
|
+
const [milestones, labels, issues] = await Promise.all([
|
|
827
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
828
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`),
|
|
829
|
+
ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))
|
|
830
|
+
]);
|
|
831
|
+
const active = [];
|
|
832
|
+
const archived = [];
|
|
833
|
+
const facts = new Map;
|
|
834
|
+
const legacySlugs = new Set;
|
|
835
|
+
const legacyMilestone = slugShapedTitles(milestones).includes(slug) ? matchesLegacyMilestone(milestones, slug) : null;
|
|
836
|
+
if (legacyMilestone) {
|
|
837
|
+
legacySlugs.add(slug);
|
|
838
|
+
const ref = { slug, goal: legacyMilestone.description ?? "" };
|
|
839
|
+
const f = resolveLegacyFacts(legacyMilestone, issues);
|
|
840
|
+
if (f.lifecycle === "complete")
|
|
841
|
+
archived.push(ref);
|
|
842
|
+
else if (f.lifecycle === "active")
|
|
843
|
+
active.push(ref);
|
|
844
|
+
facts.set(slug, f);
|
|
845
|
+
} else if (trancheSlugsFromLabels(labels).includes(slug)) {
|
|
846
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
847
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
848
|
+
facts.set(slug, { goal, lifecycle });
|
|
849
|
+
if (lifecycle === "active")
|
|
850
|
+
active.push({ slug, goal });
|
|
851
|
+
else if (lifecycle === "complete")
|
|
852
|
+
archived.push({ slug, goal });
|
|
853
|
+
}
|
|
854
|
+
const openLegacyTitles = new Set(slugShapedTitles(milestones.filter((m) => m.state === "open")));
|
|
855
|
+
const otherOpenLegacySlugs = [...openLegacyTitles].filter((t) => t !== slug);
|
|
856
|
+
return { active, archived, facts, legacySlugs, otherOpenLegacySlugs };
|
|
857
|
+
}
|
|
752
858
|
|
|
753
859
|
// ../../packages/aeg-forge-state/src/derive-from-forge.ts
|
|
754
860
|
function trancheFromIssues(slug, issues, known) {
|
|
@@ -1409,6 +1515,125 @@ var graphql2 = withDefaults3(request, {
|
|
|
1409
1515
|
method: "POST",
|
|
1410
1516
|
url: "/graphql"
|
|
1411
1517
|
});
|
|
1518
|
+
|
|
1519
|
+
// ../../packages/aeg-forge-state/src/fetch-provenance.ts
|
|
1520
|
+
var PROVENANCE_PATTERN = /^###\s+AEG provenance\b/im;
|
|
1521
|
+
function provenanceMatchesIssue(text, issueNum) {
|
|
1522
|
+
if (!PROVENANCE_PATTERN.test(text))
|
|
1523
|
+
return false;
|
|
1524
|
+
const m = text.match(/^-\s*Issue:\s*#(\d+)/im);
|
|
1525
|
+
return m !== null && Number(m[1]) === issueNum;
|
|
1526
|
+
}
|
|
1527
|
+
function isPrCloser(closer) {
|
|
1528
|
+
return closer !== null && typeof closer.number === "number";
|
|
1529
|
+
}
|
|
1530
|
+
async function fetchProvenanceViaCrossReferences(issueNums, owner, repo, token) {
|
|
1531
|
+
const result = new Map;
|
|
1532
|
+
if (issueNums.length === 0)
|
|
1533
|
+
return result;
|
|
1534
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1535
|
+
const perIssue = issueNums.map((n) => `
|
|
1536
|
+
i_${n}: issue(number: ${n}) {
|
|
1537
|
+
timelineItems(first: 50, itemTypes: [CROSS_REFERENCED_EVENT]) {
|
|
1538
|
+
nodes {
|
|
1539
|
+
... on CrossReferencedEvent {
|
|
1540
|
+
source {
|
|
1541
|
+
... on PullRequest {
|
|
1542
|
+
number
|
|
1543
|
+
body
|
|
1544
|
+
comments(first: 50) { nodes { body } }
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}`).join("");
|
|
1551
|
+
const query = `query ProvenanceCrossRef($owner: String!, $repo: String!) {
|
|
1552
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1553
|
+
}
|
|
1554
|
+
}`;
|
|
1555
|
+
let response;
|
|
1556
|
+
try {
|
|
1557
|
+
response = await client(query, { owner, repo });
|
|
1558
|
+
} catch {
|
|
1559
|
+
return result;
|
|
1560
|
+
}
|
|
1561
|
+
if (!response.repository)
|
|
1562
|
+
return result;
|
|
1563
|
+
for (const n of issueNums) {
|
|
1564
|
+
const raw = response.repository[`i_${n}`];
|
|
1565
|
+
const nodes = raw?.timelineItems?.nodes ?? [];
|
|
1566
|
+
const found = nodes.some(({ source }) => {
|
|
1567
|
+
if (!source || typeof source.number !== "number")
|
|
1568
|
+
return false;
|
|
1569
|
+
const pr = source;
|
|
1570
|
+
if (provenanceMatchesIssue(pr.body ?? "", n))
|
|
1571
|
+
return true;
|
|
1572
|
+
return pr.comments.nodes.some((c) => provenanceMatchesIssue(c.body, n));
|
|
1573
|
+
});
|
|
1574
|
+
result.set(n, found);
|
|
1575
|
+
}
|
|
1576
|
+
return result;
|
|
1577
|
+
}
|
|
1578
|
+
async function fetchProvenance(issueNums, owner, repo, token) {
|
|
1579
|
+
const result = new Map;
|
|
1580
|
+
if (issueNums.length === 0)
|
|
1581
|
+
return result;
|
|
1582
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1583
|
+
const perIssue = issueNums.map((n) => `
|
|
1584
|
+
i_${n}: issue(number: ${n}) {
|
|
1585
|
+
timelineItems(last: 1, itemTypes: [CLOSED_EVENT]) {
|
|
1586
|
+
nodes {
|
|
1587
|
+
... on ClosedEvent {
|
|
1588
|
+
closer {
|
|
1589
|
+
... on PullRequest {
|
|
1590
|
+
number
|
|
1591
|
+
body
|
|
1592
|
+
comments(first: 50) {
|
|
1593
|
+
nodes { body }
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}`).join("");
|
|
1601
|
+
const query = `query Provenance($owner: String!, $repo: String!) {
|
|
1602
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1603
|
+
}
|
|
1604
|
+
}`;
|
|
1605
|
+
let response;
|
|
1606
|
+
try {
|
|
1607
|
+
response = await client(query, { owner, repo });
|
|
1608
|
+
} catch {
|
|
1609
|
+
return result;
|
|
1610
|
+
}
|
|
1611
|
+
if (!response.repository)
|
|
1612
|
+
return result;
|
|
1613
|
+
const needsFallback = [];
|
|
1614
|
+
for (const n of issueNums) {
|
|
1615
|
+
const raw = response.repository[`i_${n}`];
|
|
1616
|
+
if (!raw) {
|
|
1617
|
+
result.set(n, false);
|
|
1618
|
+
continue;
|
|
1619
|
+
}
|
|
1620
|
+
const closer = raw.timelineItems?.nodes?.[0]?.closer;
|
|
1621
|
+
const c = closer ?? null;
|
|
1622
|
+
if (!isPrCloser(c)) {
|
|
1623
|
+
needsFallback.push(n);
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1626
|
+
const bodyHas = PROVENANCE_PATTERN.test(c.body ?? "");
|
|
1627
|
+
const commentHas = c.comments.nodes.some((x) => PROVENANCE_PATTERN.test(x.body));
|
|
1628
|
+
result.set(n, bodyHas || commentHas);
|
|
1629
|
+
}
|
|
1630
|
+
if (needsFallback.length > 0) {
|
|
1631
|
+
const fallback = await fetchProvenanceViaCrossReferences(needsFallback, owner, repo, token);
|
|
1632
|
+
for (const [n, found] of fallback)
|
|
1633
|
+
result.set(n, found);
|
|
1634
|
+
}
|
|
1635
|
+
return result;
|
|
1636
|
+
}
|
|
1412
1637
|
// ../../packages/aeg-forge-state/src/github-token.ts
|
|
1413
1638
|
import { execFile as execFile2 } from "node:child_process";
|
|
1414
1639
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -1638,6 +1863,84 @@ function describeError(err) {
|
|
|
1638
1863
|
return err;
|
|
1639
1864
|
return "unknown error";
|
|
1640
1865
|
}
|
|
1866
|
+
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1867
|
+
function defaultPriorTrancheArchivalDeps() {
|
|
1868
|
+
let facts = new Map;
|
|
1869
|
+
return {
|
|
1870
|
+
activeTrancheSlugs: async (excludeSlug, repo) => {
|
|
1871
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
|
|
1872
|
+
facts = index.facts;
|
|
1873
|
+
return index.active.map((m) => m.slug).filter((slug) => slug !== excludeSlug);
|
|
1874
|
+
},
|
|
1875
|
+
deriveTranche: (slug, repo) => deriveTrancheFromForge(repo.owner, repo.repo, slug, facts.get(slug)),
|
|
1876
|
+
openIssues: async (slug, repo) => (await fetchTrancheIssuesAsync(repo.owner, repo.repo, slug)).filter((issue) => issue.state === "OPEN").map((issue) => ({ number: issue.number }))
|
|
1877
|
+
};
|
|
1878
|
+
}
|
|
1879
|
+
function reason(err) {
|
|
1880
|
+
return err instanceof Error ? err.message.split(`
|
|
1881
|
+
`)[0] ?? "failed" : String(err);
|
|
1882
|
+
}
|
|
1883
|
+
async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
|
|
1884
|
+
if (projects.length === 0)
|
|
1885
|
+
return { facts: [], infraFailure: null };
|
|
1886
|
+
let candidates;
|
|
1887
|
+
try {
|
|
1888
|
+
candidates = await deps.activeTrancheSlugs(excludeSlug, repo);
|
|
1889
|
+
} catch (err) {
|
|
1890
|
+
return {
|
|
1891
|
+
facts: [],
|
|
1892
|
+
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
const facts = [];
|
|
1896
|
+
const unreadable = [];
|
|
1897
|
+
const derived = new Map;
|
|
1898
|
+
const derive = (slug) => {
|
|
1899
|
+
let p = derived.get(slug);
|
|
1900
|
+
if (!p) {
|
|
1901
|
+
p = deps.deriveTranche(slug, repo);
|
|
1902
|
+
derived.set(slug, p);
|
|
1903
|
+
}
|
|
1904
|
+
return p;
|
|
1905
|
+
};
|
|
1906
|
+
for (const project of projects) {
|
|
1907
|
+
let found = null;
|
|
1908
|
+
let unknown = false;
|
|
1909
|
+
for (const slug of candidates) {
|
|
1910
|
+
let candidateTranche;
|
|
1911
|
+
try {
|
|
1912
|
+
candidateTranche = await derive(slug);
|
|
1913
|
+
} catch {
|
|
1914
|
+
unknown = true;
|
|
1915
|
+
unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1916
|
+
break;
|
|
1917
|
+
}
|
|
1918
|
+
if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
|
|
1919
|
+
continue;
|
|
1920
|
+
let openIssues;
|
|
1921
|
+
try {
|
|
1922
|
+
openIssues = await deps.openIssues(slug, repo);
|
|
1923
|
+
} catch {
|
|
1924
|
+
openIssues = null;
|
|
1925
|
+
}
|
|
1926
|
+
if (openIssues === null) {
|
|
1927
|
+
unknown = true;
|
|
1928
|
+
unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1929
|
+
break;
|
|
1930
|
+
}
|
|
1931
|
+
if (openIssues.length === 0) {
|
|
1932
|
+
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1933
|
+
break;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if (!unknown)
|
|
1937
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1938
|
+
}
|
|
1939
|
+
return {
|
|
1940
|
+
facts,
|
|
1941
|
+
infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1641
1944
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1642
1945
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
1643
1946
|
const result = new Map;
|
|
@@ -1712,6 +2015,10 @@ function buildQuery(issueNumbers) {
|
|
|
1712
2015
|
}
|
|
1713
2016
|
}`;
|
|
1714
2017
|
}
|
|
2018
|
+
// ../../packages/aeg-forge-state/src/list-issue-milestones.ts
|
|
2019
|
+
function issueMilestonesFromIssues(issues) {
|
|
2020
|
+
return issues.filter((i) => i.state === "OPEN").map((i) => ({ issue: i.number, milestoneTitle: i.milestone?.title ?? null }));
|
|
2021
|
+
}
|
|
1715
2022
|
// ../../packages/aeg-forge-state/src/resolve-repo.ts
|
|
1716
2023
|
import { execFile as execFile3 } from "node:child_process";
|
|
1717
2024
|
import { promisify as promisify3 } from "node:util";
|
|
@@ -1774,7 +2081,8 @@ var ANCHOR_FIELDS = [
|
|
|
1774
2081
|
"PREMISE",
|
|
1775
2082
|
"TEST-PLAN",
|
|
1776
2083
|
"EVIDENCE",
|
|
1777
|
-
"BEYOND-SURFACE"
|
|
2084
|
+
"BEYOND-SURFACE",
|
|
2085
|
+
"LIVE"
|
|
1778
2086
|
];
|
|
1779
2087
|
function anchoredRegionBounds(body, field) {
|
|
1780
2088
|
const masked = maskCode(body);
|
|
@@ -1975,7 +2283,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
|
1975
2283
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1976
2284
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1977
2285
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
1978
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
1979
2286
|
function isPrincipal(login, principalAllowlist) {
|
|
1980
2287
|
if (login === null)
|
|
1981
2288
|
return false;
|
|
@@ -1994,6 +2301,14 @@ var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(
|
|
|
1994
2301
|
var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1995
2302
|
var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1996
2303
|
var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2304
|
+
var MANIFEST_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Manifest version:\s*(\d+)\s*$/im;
|
|
2305
|
+
var PAUSE_BOUND_RULING_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Pause-bound ruling:\s*(?:(\S+)\|(\S+)\|([0-9a-f]{64})|\(none\))\s*$/im;
|
|
2306
|
+
function extractPauseBoundRuling(comment) {
|
|
2307
|
+
const m = comment.match(PAUSE_BOUND_RULING_PATTERN);
|
|
2308
|
+
if (!m)
|
|
2309
|
+
return;
|
|
2310
|
+
return m[1] ? { rulingId: m[1], pauseId: m[2], contentDigest: m[3] } : null;
|
|
2311
|
+
}
|
|
1997
2312
|
function firstFiveLines(comment) {
|
|
1998
2313
|
return comment.split(`
|
|
1999
2314
|
`).slice(0, 5).join(`
|
|
@@ -2087,6 +2402,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2087
2402
|
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
2088
2403
|
};
|
|
2089
2404
|
}
|
|
2405
|
+
const versionMatch = latest.match(MANIFEST_VERSION_PATTERN);
|
|
2406
|
+
const pauseBoundRuling = extractPauseBoundRuling(latest);
|
|
2090
2407
|
return {
|
|
2091
2408
|
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
2092
2409
|
headSha: extractHeadSha(latest),
|
|
@@ -2095,6 +2412,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2095
2412
|
briefHash: extractBriefHash(latest),
|
|
2096
2413
|
policyDigest: extractPolicyDigest(latest),
|
|
2097
2414
|
baseSha: extractBaseSha(latest),
|
|
2415
|
+
...versionMatch ? { manifestVersion: Number.parseInt(versionMatch[1], 10) } : {},
|
|
2416
|
+
...pauseBoundRuling === undefined ? {} : { pauseBoundRuling },
|
|
2098
2417
|
findingSeverities: extractFindingSeverities(latest),
|
|
2099
2418
|
danglingNote: null
|
|
2100
2419
|
};
|
|
@@ -2105,6 +2424,16 @@ function extractCodeReviewVerdict(comments) {
|
|
|
2105
2424
|
function extractSecurityReviewVerdict(comments) {
|
|
2106
2425
|
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
2107
2426
|
}
|
|
2427
|
+
|
|
2428
|
+
// ../../packages/aeg-core/src/review-status.ts
|
|
2429
|
+
var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-(\d+)\s*-->/i;
|
|
2430
|
+
function parseDeveloperRoundMarker(body) {
|
|
2431
|
+
const m = body.match(DEVELOPER_ROUND_MARKER);
|
|
2432
|
+
if (!m)
|
|
2433
|
+
return null;
|
|
2434
|
+
const n = Number(m[1]);
|
|
2435
|
+
return Number.isFinite(n) ? n : null;
|
|
2436
|
+
}
|
|
2108
2437
|
// ../../packages/aeg-core/src/report-tokens.ts
|
|
2109
2438
|
var DASH_LOOKALIKES = {
|
|
2110
2439
|
"-": "‑",
|
|
@@ -2800,14 +3129,14 @@ function checkTestPlan(prBody) {
|
|
|
2800
3129
|
const region = located.found ? located.section : prBody;
|
|
2801
3130
|
if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
|
|
2802
3131
|
return { status: "pass", errors: [] };
|
|
2803
|
-
if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
|
|
3132
|
+
if (/\*\*\[(?:agent|principal|live)\]\*\*/.test(region))
|
|
2804
3133
|
return { status: "pass", errors: [] };
|
|
2805
3134
|
if (located.found && extractFencedBlocks(region).length > 0)
|
|
2806
3135
|
return { status: "pass", errors: [] };
|
|
2807
3136
|
return {
|
|
2808
3137
|
status: "fail",
|
|
2809
3138
|
errors: [
|
|
2810
|
-
"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
|
|
3139
|
+
"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."
|
|
2811
3140
|
]
|
|
2812
3141
|
};
|
|
2813
3142
|
}
|
|
@@ -3429,6 +3758,375 @@ function checkPrReportDensity(prBody) {
|
|
|
3429
3758
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3430
3759
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3431
3760
|
}
|
|
3761
|
+
// ../../packages/aeg-core/src/prose-rules.ts
|
|
3762
|
+
var RETIRED_GLOBAL_EXEMPTIONS = [
|
|
3763
|
+
"docs/decisions-legacy.md",
|
|
3764
|
+
"apps/herald-ai/docs/",
|
|
3765
|
+
"apps/vada-ai/docs/",
|
|
3766
|
+
"aeg-root/tranches/completed/",
|
|
3767
|
+
"packages/aeg-core/src/docs/published-prose",
|
|
3768
|
+
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
3769
|
+
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
3770
|
+
"/fixtures/",
|
|
3771
|
+
"/node_modules/",
|
|
3772
|
+
"/.next/",
|
|
3773
|
+
"/.turbo/"
|
|
3774
|
+
];
|
|
3775
|
+
var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
|
|
3776
|
+
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
3777
|
+
var RETIRED_PATTERN_EXEMPTIONS = {
|
|
3778
|
+
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
3779
|
+
[String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
|
|
3780
|
+
"docs-index.md",
|
|
3781
|
+
"apps/vada-ai/specs/legacy/README.md",
|
|
3782
|
+
"apps/vada-ai/specs/vada-product-spec.md",
|
|
3783
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3784
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3785
|
+
],
|
|
3786
|
+
"decisions-legacy": [
|
|
3787
|
+
"packages/aeg-core/src/file-classify.ts",
|
|
3788
|
+
"packages/aeg-core/src/file-classify.test.ts",
|
|
3789
|
+
"packages/aeg-core/src/pr-tier.test.ts",
|
|
3790
|
+
"docs-index.md",
|
|
3791
|
+
".claude/skills/database/SKILL.md",
|
|
3792
|
+
".claude/skills/vada-architecture/SKILL.md",
|
|
3793
|
+
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
3794
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3795
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3796
|
+
],
|
|
3797
|
+
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
3798
|
+
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
3799
|
+
};
|
|
3800
|
+
var retiredPatterns = [
|
|
3801
|
+
String.raw`\bD-[0-9]{3}\b`,
|
|
3802
|
+
"D-(###|NNN|nnn|xxx)",
|
|
3803
|
+
"decision (entry|logged)",
|
|
3804
|
+
"decision-log entry",
|
|
3805
|
+
"decision log entry",
|
|
3806
|
+
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
3807
|
+
"decision-log",
|
|
3808
|
+
"decision entr",
|
|
3809
|
+
"decisions? (are |is )?logged",
|
|
3810
|
+
"log entries",
|
|
3811
|
+
String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
|
|
3812
|
+
"decisions-legacy",
|
|
3813
|
+
"CONTRADICTION",
|
|
3814
|
+
"assumes Tier 3",
|
|
3815
|
+
"Lock: ?YES",
|
|
3816
|
+
"Lock: ?NO",
|
|
3817
|
+
"lock approvals?",
|
|
3818
|
+
"approves locks",
|
|
3819
|
+
"Conforms to lock",
|
|
3820
|
+
"Challenges lock",
|
|
3821
|
+
"checkDecisionNumbersFresh",
|
|
3822
|
+
String.raw`roles/team-leader\.md`,
|
|
3823
|
+
String.raw`\(,`,
|
|
3824
|
+
String.raw`,\)`,
|
|
3825
|
+
String.raw`\(\.\)`,
|
|
3826
|
+
...PLAN_ON_DISK_PATTERNS
|
|
3827
|
+
];
|
|
3828
|
+
var published = [
|
|
3829
|
+
["decision-id", "a decision id", /\bD-\d{3,}\b/],
|
|
3830
|
+
["section-ref", "a section reference", /§/],
|
|
3831
|
+
["forge-number", "a forge number", /#\d+/],
|
|
3832
|
+
["retired-name", "the retired public name", /\bAEG\b/],
|
|
3833
|
+
["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
|
|
3834
|
+
[
|
|
3835
|
+
"label-vocabulary",
|
|
3836
|
+
"forge label vocabulary",
|
|
3837
|
+
/(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
|
|
3838
|
+
],
|
|
3839
|
+
["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
|
|
3840
|
+
["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
|
|
3841
|
+
[
|
|
3842
|
+
"internal-path",
|
|
3843
|
+
"a repo-internal file",
|
|
3844
|
+
/(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
|
|
3845
|
+
]
|
|
3846
|
+
];
|
|
3847
|
+
var DEFAULT_PROSE_RULES = [
|
|
3848
|
+
{
|
|
3849
|
+
id: "forge-number",
|
|
3850
|
+
group: "reader-resolvable",
|
|
3851
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3852
|
+
patterns: { prose: /#[0-9]{2,4}/g },
|
|
3853
|
+
flags: ["global"],
|
|
3854
|
+
message: "a forge number",
|
|
3855
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3856
|
+
exemptions: []
|
|
3857
|
+
},
|
|
3858
|
+
{
|
|
3859
|
+
id: "tranche-slug",
|
|
3860
|
+
group: "reader-resolvable",
|
|
3861
|
+
scopes: ["ships", "reader-facing", "product", "spec"],
|
|
3862
|
+
patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
|
|
3863
|
+
flags: ["global"],
|
|
3864
|
+
message: "an internal tranche slug",
|
|
3865
|
+
severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
|
|
3866
|
+
exemptions: []
|
|
3867
|
+
},
|
|
3868
|
+
{
|
|
3869
|
+
id: "task-number",
|
|
3870
|
+
group: "reader-resolvable",
|
|
3871
|
+
scopes: ["spec"],
|
|
3872
|
+
patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
|
|
3873
|
+
flags: ["global", "ignore-case"],
|
|
3874
|
+
message: "a task number",
|
|
3875
|
+
severity: { spec: "error" },
|
|
3876
|
+
exemptions: []
|
|
3877
|
+
},
|
|
3878
|
+
{
|
|
3879
|
+
id: "source-comment-tranche-slug",
|
|
3880
|
+
group: "reader-resolvable",
|
|
3881
|
+
scopes: ["source-comment"],
|
|
3882
|
+
patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
|
|
3883
|
+
flags: ["global"],
|
|
3884
|
+
message: "a tranche-slug citation",
|
|
3885
|
+
severity: { "source-comment": "warning" },
|
|
3886
|
+
exemptions: []
|
|
3887
|
+
},
|
|
3888
|
+
{
|
|
3889
|
+
id: "source-comment-forge-number",
|
|
3890
|
+
group: "reader-resolvable",
|
|
3891
|
+
scopes: ["source-comment"],
|
|
3892
|
+
patterns: { comment: /#[0-9]{2,}/g },
|
|
3893
|
+
flags: ["global"],
|
|
3894
|
+
message: "a forge-number citation",
|
|
3895
|
+
severity: { "source-comment": "warning" },
|
|
3896
|
+
exemptions: []
|
|
3897
|
+
},
|
|
3898
|
+
{
|
|
3899
|
+
id: "legacy-batch-name",
|
|
3900
|
+
group: "reader-resolvable",
|
|
3901
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3902
|
+
patterns: {},
|
|
3903
|
+
flags: ["built-in"],
|
|
3904
|
+
message: "an internal tranche slug",
|
|
3905
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3906
|
+
exemptions: [],
|
|
3907
|
+
builtIn: true
|
|
3908
|
+
},
|
|
3909
|
+
{
|
|
3910
|
+
id: "coined-term",
|
|
3911
|
+
group: "reader-resolvable",
|
|
3912
|
+
scopes: ["ships", "reader-facing"],
|
|
3913
|
+
patterns: {},
|
|
3914
|
+
flags: ["built-in"],
|
|
3915
|
+
message: "uses coined term without defining it inline or linking the glossary",
|
|
3916
|
+
severity: { ships: "warning", "reader-facing": "warning" },
|
|
3917
|
+
exemptions: [],
|
|
3918
|
+
builtIn: true
|
|
3919
|
+
},
|
|
3920
|
+
...retiredPatterns.map((pattern, index) => ({
|
|
3921
|
+
id: `retired-vocabulary-${index + 1}`,
|
|
3922
|
+
group: "retired-vocabulary",
|
|
3923
|
+
scopes: ["repository"],
|
|
3924
|
+
patterns: { repository: pattern },
|
|
3925
|
+
flags: [],
|
|
3926
|
+
message: "retired vocabulary",
|
|
3927
|
+
severity: { repository: "error" },
|
|
3928
|
+
exemptions: RETIRED_GLOBAL_EXEMPTIONS,
|
|
3929
|
+
patternExemptions: RETIRED_PATTERN_EXEMPTIONS
|
|
3930
|
+
})),
|
|
3931
|
+
...published.map(([id, message, pattern]) => ({
|
|
3932
|
+
id,
|
|
3933
|
+
group: "published-prose",
|
|
3934
|
+
scopes: ["published"],
|
|
3935
|
+
patterns: { published: pattern },
|
|
3936
|
+
flags: [],
|
|
3937
|
+
message,
|
|
3938
|
+
severity: { published: "error" },
|
|
3939
|
+
exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
|
|
3940
|
+
}))
|
|
3941
|
+
];
|
|
3942
|
+
var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
|
|
3943
|
+
var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
|
|
3944
|
+
var RETIRED_SCOPES = ["repository"];
|
|
3945
|
+
var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
|
|
3946
|
+
function groupOfScope(scope) {
|
|
3947
|
+
if (RESOLVABLE_SCOPES.includes(scope))
|
|
3948
|
+
return "reader-resolvable";
|
|
3949
|
+
if (RETIRED_SCOPES.includes(scope))
|
|
3950
|
+
return "retired-vocabulary";
|
|
3951
|
+
return;
|
|
3952
|
+
}
|
|
3953
|
+
var CONFIGURED_PROSE_FLAGS = ["i", "u"];
|
|
3954
|
+
var CONFIGURED_PATTERN_MAX_LENGTH = 200;
|
|
3955
|
+
var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
|
|
3956
|
+
function allowedScopesFor(rule) {
|
|
3957
|
+
if (rule.builtIn)
|
|
3958
|
+
return rule.scopes;
|
|
3959
|
+
return rule.group === "retired-vocabulary" ? RETIRED_SCOPES : RESOLVABLE_SCOPES;
|
|
3960
|
+
}
|
|
3961
|
+
function normalizeRepoPath(entry) {
|
|
3962
|
+
let out = entry.replace(/\\/g, "/");
|
|
3963
|
+
while (out.startsWith("./"))
|
|
3964
|
+
out = out.slice(2);
|
|
3965
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3966
|
+
while (out.endsWith("/"))
|
|
3967
|
+
out = out.slice(0, -1);
|
|
3968
|
+
return out;
|
|
3969
|
+
}
|
|
3970
|
+
function isConfiguredExempt(path, exempt, repoRoot) {
|
|
3971
|
+
if (exempt.length === 0)
|
|
3972
|
+
return false;
|
|
3973
|
+
const root = repoRoot === undefined ? undefined : normalizeRepoPath(repoRoot);
|
|
3974
|
+
let rel = normalizeRepoPath(path);
|
|
3975
|
+
if (root && rel.startsWith(`${root}/`))
|
|
3976
|
+
rel = rel.slice(root.length + 1);
|
|
3977
|
+
return exempt.some((entry) => {
|
|
3978
|
+
const e = normalizeRepoPath(entry);
|
|
3979
|
+
return rel === e || rel.startsWith(`${e}/`);
|
|
3980
|
+
});
|
|
3981
|
+
}
|
|
3982
|
+
function ruleReads(set, rule, path) {
|
|
3983
|
+
return !isConfiguredExempt(path, set.exempt, set.repoRoot) && !isConfiguredExempt(path, rule.exempt, set.repoRoot);
|
|
3984
|
+
}
|
|
3985
|
+
var RESOLVABLE_RUN_ORDER = [
|
|
3986
|
+
"forge-number",
|
|
3987
|
+
"tranche-slug",
|
|
3988
|
+
"legacy-batch-name",
|
|
3989
|
+
"task-number",
|
|
3990
|
+
"source-comment-tranche-slug",
|
|
3991
|
+
"source-comment-forge-number",
|
|
3992
|
+
"coined-term"
|
|
3993
|
+
];
|
|
3994
|
+
var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
|
|
3995
|
+
function scopeDefaultSeverity(scope, sourceCommentSeverity) {
|
|
3996
|
+
if (scope === "source-comment")
|
|
3997
|
+
return sourceCommentSeverity ?? "warning";
|
|
3998
|
+
if (scope === "repository")
|
|
3999
|
+
return "error";
|
|
4000
|
+
return "warning";
|
|
4001
|
+
}
|
|
4002
|
+
function applySeverity(scopes, base, setting) {
|
|
4003
|
+
const out = {};
|
|
4004
|
+
for (const scope of scopes) {
|
|
4005
|
+
const configured = typeof setting === "string" ? setting : setting?.[scope];
|
|
4006
|
+
const value = configured ?? base[scope];
|
|
4007
|
+
if (value !== undefined)
|
|
4008
|
+
out[scope] = value;
|
|
4009
|
+
}
|
|
4010
|
+
return out;
|
|
4011
|
+
}
|
|
4012
|
+
function defaultPatternFor(rule) {
|
|
4013
|
+
const cache = new Map;
|
|
4014
|
+
return (scope) => {
|
|
4015
|
+
if (cache.has(scope))
|
|
4016
|
+
return cache.get(scope) ?? null;
|
|
4017
|
+
const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
|
|
4018
|
+
const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
|
|
4019
|
+
cache.set(scope, compiled);
|
|
4020
|
+
return compiled;
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
4023
|
+
function customPatternFor(rule, global) {
|
|
4024
|
+
const cache = new Map;
|
|
4025
|
+
return (scope) => {
|
|
4026
|
+
if (cache.has(scope))
|
|
4027
|
+
return cache.get(scope) ?? null;
|
|
4028
|
+
const source = rule.patterns?.[scope] ?? rule.pattern;
|
|
4029
|
+
const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
|
|
4030
|
+
cache.set(scope, compiled);
|
|
4031
|
+
return compiled;
|
|
4032
|
+
};
|
|
4033
|
+
}
|
|
4034
|
+
function resolveProseRules(config = undefined, options = {}) {
|
|
4035
|
+
const rules = [];
|
|
4036
|
+
const defaults = config?.defaults ?? {};
|
|
4037
|
+
for (const rule of CONFIGURABLE_DEFAULT_RULES) {
|
|
4038
|
+
const override = defaults[rule.id];
|
|
4039
|
+
if (override === "off")
|
|
4040
|
+
continue;
|
|
4041
|
+
const group = rule.group;
|
|
4042
|
+
const scopes = override?.scopes ?? rule.scopes;
|
|
4043
|
+
const base = {};
|
|
4044
|
+
for (const scope of scopes) {
|
|
4045
|
+
base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4046
|
+
}
|
|
4047
|
+
rules.push({
|
|
4048
|
+
id: rule.id,
|
|
4049
|
+
group,
|
|
4050
|
+
custom: false,
|
|
4051
|
+
builtIn: rule.builtIn === true,
|
|
4052
|
+
scopes,
|
|
4053
|
+
message: rule.message,
|
|
4054
|
+
severity: applySeverity(scopes, base, override?.severity),
|
|
4055
|
+
exempt: override?.exempt ?? [],
|
|
4056
|
+
substringExempt: rule.exemptions,
|
|
4057
|
+
reportGroup: REPORT_GROUPS[rule.id],
|
|
4058
|
+
patternFor: defaultPatternFor(rule)
|
|
4059
|
+
});
|
|
4060
|
+
}
|
|
4061
|
+
for (const rule of config?.custom ?? []) {
|
|
4062
|
+
const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
|
|
4063
|
+
const base = {};
|
|
4064
|
+
for (const scope of rule.scopes)
|
|
4065
|
+
base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4066
|
+
rules.push({
|
|
4067
|
+
id: rule.id,
|
|
4068
|
+
group,
|
|
4069
|
+
custom: true,
|
|
4070
|
+
builtIn: false,
|
|
4071
|
+
scopes: rule.scopes,
|
|
4072
|
+
message: rule.means,
|
|
4073
|
+
severity: applySeverity(rule.scopes, base, rule.severity),
|
|
4074
|
+
exempt: rule.exempt ?? [],
|
|
4075
|
+
substringExempt: [],
|
|
4076
|
+
patternFor: customPatternFor(rule, group === "reader-resolvable")
|
|
4077
|
+
});
|
|
4078
|
+
}
|
|
4079
|
+
if (options.decisionRecordsPath !== undefined)
|
|
4080
|
+
rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
|
|
4081
|
+
const order = (rule) => {
|
|
4082
|
+
const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
|
|
4083
|
+
return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
|
|
4084
|
+
};
|
|
4085
|
+
const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
|
|
4086
|
+
const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
|
|
4087
|
+
return {
|
|
4088
|
+
rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
|
|
4089
|
+
exempt: config?.exempt ?? [],
|
|
4090
|
+
repoRoot: options.repoRoot
|
|
4091
|
+
};
|
|
4092
|
+
}
|
|
4093
|
+
function rulesOfGroup(set, group) {
|
|
4094
|
+
return set.rules.filter((rule) => rule.group === group);
|
|
4095
|
+
}
|
|
4096
|
+
function rulesInScope(set, scope) {
|
|
4097
|
+
return set.rules.filter((rule) => rule.scopes.includes(scope));
|
|
4098
|
+
}
|
|
4099
|
+
var DEFAULT_PROSE_RULE_SET = resolveProseRules();
|
|
4100
|
+
var DECISION_RECORD_CITATION_ID = "decision-record-citation";
|
|
4101
|
+
var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
|
|
4102
|
+
var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
|
|
4103
|
+
function escapeRegExp(text) {
|
|
4104
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4105
|
+
}
|
|
4106
|
+
function decisionRecordCitationPattern(decisionRecordsPath) {
|
|
4107
|
+
const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
|
|
4108
|
+
return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
|
|
4109
|
+
}
|
|
4110
|
+
function decisionRecordCitationRule(decisionRecordsPath) {
|
|
4111
|
+
const folder = normalizeRepoPath(decisionRecordsPath);
|
|
4112
|
+
const pattern = decisionRecordCitationPattern(folder);
|
|
4113
|
+
const severity = {};
|
|
4114
|
+
for (const scope of DECISION_RECORD_CITATION_SCOPES)
|
|
4115
|
+
severity[scope] = "error";
|
|
4116
|
+
return {
|
|
4117
|
+
id: DECISION_RECORD_CITATION_ID,
|
|
4118
|
+
group: "reader-resolvable",
|
|
4119
|
+
custom: false,
|
|
4120
|
+
builtIn: false,
|
|
4121
|
+
scopes: DECISION_RECORD_CITATION_SCOPES,
|
|
4122
|
+
message: DECISION_RECORD_CITATION_MESSAGE,
|
|
4123
|
+
severity,
|
|
4124
|
+
exempt: [folder],
|
|
4125
|
+
substringExempt: [],
|
|
4126
|
+
patternFor: () => pattern
|
|
4127
|
+
};
|
|
4128
|
+
}
|
|
4129
|
+
|
|
3432
4130
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3433
4131
|
var PRODUCT_SLUG_SCOPE = [
|
|
3434
4132
|
"apps/cli/src",
|
|
@@ -3440,8 +4138,8 @@ var PRODUCT_SLUG_SCOPE = [
|
|
|
3440
4138
|
function isUnderOrEqual(path, prefix) {
|
|
3441
4139
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3442
4140
|
}
|
|
3443
|
-
function isProductScopeFile(path) {
|
|
3444
|
-
return
|
|
4141
|
+
function isProductScopeFile(path, productPaths) {
|
|
4142
|
+
return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)));
|
|
3445
4143
|
}
|
|
3446
4144
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3447
4145
|
function shipsArchivePrefix(shipsPrefix) {
|
|
@@ -3449,13 +4147,7 @@ function shipsArchivePrefix(shipsPrefix) {
|
|
|
3449
4147
|
}
|
|
3450
4148
|
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3451
4149
|
function normalizeSpecPath(entry) {
|
|
3452
|
-
|
|
3453
|
-
while (out.startsWith("./"))
|
|
3454
|
-
out = out.slice(2);
|
|
3455
|
-
out = out.replace(/\/{2,}/g, "/");
|
|
3456
|
-
while (out.endsWith("/"))
|
|
3457
|
-
out = out.slice(0, -1);
|
|
3458
|
-
return out;
|
|
4150
|
+
return normalizeRepoPath(entry);
|
|
3459
4151
|
}
|
|
3460
4152
|
function isSpecFile2(path, specPaths) {
|
|
3461
4153
|
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
@@ -3467,7 +4159,7 @@ function isSpecFile2(path, specPaths) {
|
|
|
3467
4159
|
function isClaudeMdFile(path) {
|
|
3468
4160
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3469
4161
|
}
|
|
3470
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4162
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS, productPaths = PRODUCT_SLUG_SCOPE) {
|
|
3471
4163
|
if (path.startsWith(shipsPrefix)) {
|
|
3472
4164
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3473
4165
|
}
|
|
@@ -3478,7 +4170,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
3478
4170
|
return "internal";
|
|
3479
4171
|
if (isSpecFile2(path, specPaths))
|
|
3480
4172
|
return "spec";
|
|
3481
|
-
if (isProductScopeFile(path))
|
|
4173
|
+
if (isProductScopeFile(path, productPaths))
|
|
3482
4174
|
return "product";
|
|
3483
4175
|
return null;
|
|
3484
4176
|
}
|
|
@@ -3503,9 +4195,16 @@ function lineAt(content, index) {
|
|
|
3503
4195
|
}
|
|
3504
4196
|
return line;
|
|
3505
4197
|
}
|
|
3506
|
-
var
|
|
3507
|
-
var
|
|
3508
|
-
|
|
4198
|
+
var readerRules = rulesForGroup("reader-resolvable");
|
|
4199
|
+
var readerPattern = (id, scope = "prose") => {
|
|
4200
|
+
const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
|
|
4201
|
+
if (!(pattern instanceof RegExp))
|
|
4202
|
+
throw new Error(`default prose rule ${id} has no ${scope} pattern`);
|
|
4203
|
+
return pattern;
|
|
4204
|
+
};
|
|
4205
|
+
var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
|
|
4206
|
+
var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
|
|
4207
|
+
var TASK_NUMBER_PATTERN = readerPattern("task-number");
|
|
3509
4208
|
function legacySlugPattern(legacySlugs) {
|
|
3510
4209
|
if (legacySlugs.length === 0)
|
|
3511
4210
|
return null;
|
|
@@ -3515,48 +4214,61 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3515
4214
|
function specGrandfatherPaths(specGrandfather) {
|
|
3516
4215
|
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3517
4216
|
}
|
|
3518
|
-
|
|
4217
|
+
var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
|
|
4218
|
+
function referenceRulesFor(set, cls) {
|
|
4219
|
+
return rulesInScope(set, cls).filter((rule) => rule.group === "reader-resolvable" && rule.id !== "coined-term");
|
|
4220
|
+
}
|
|
4221
|
+
function citations(pattern, text, group) {
|
|
4222
|
+
const out = [];
|
|
4223
|
+
const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
|
|
4224
|
+
re.lastIndex = 0;
|
|
4225
|
+
let match = re.exec(text);
|
|
4226
|
+
while (match !== null) {
|
|
4227
|
+
if (match[0] === "") {
|
|
4228
|
+
re.lastIndex++;
|
|
4229
|
+
} else {
|
|
4230
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4231
|
+
out.push({ cited, index: match.index + match[0].indexOf(cited) });
|
|
4232
|
+
}
|
|
4233
|
+
match = re.exec(text);
|
|
4234
|
+
}
|
|
4235
|
+
re.lastIndex = 0;
|
|
4236
|
+
return out;
|
|
4237
|
+
}
|
|
4238
|
+
function customMessage(rule, cited) {
|
|
4239
|
+
return `${rule.id}: ${rule.message} ("${cited}")`;
|
|
4240
|
+
}
|
|
4241
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
4242
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4243
|
+
const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE;
|
|
3519
4244
|
const findings = [];
|
|
3520
4245
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3521
4246
|
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3522
4247
|
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3523
|
-
const patterns = [
|
|
3524
|
-
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3525
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3526
|
-
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3527
|
-
];
|
|
3528
|
-
const productPatterns = [
|
|
3529
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3530
|
-
];
|
|
3531
|
-
const specPatterns = [
|
|
3532
|
-
...patterns,
|
|
3533
|
-
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3534
|
-
];
|
|
3535
4248
|
for (const file of files) {
|
|
3536
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3537
|
-
if (!cls || cls
|
|
3538
|
-
continue;
|
|
3539
|
-
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
4249
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths, productPaths);
|
|
4250
|
+
if (!cls || !REFERENCE_CLASSES.has(cls))
|
|
3540
4251
|
continue;
|
|
3541
4252
|
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3542
4253
|
continue;
|
|
3543
|
-
const blocking = cls === "product" || cls === "spec";
|
|
3544
4254
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3545
|
-
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3546
4255
|
const fileFindings = [];
|
|
3547
|
-
for (const
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
4256
|
+
for (const rule of referenceRulesFor(set, cls)) {
|
|
4257
|
+
if (!ruleReads(set, rule, file.path))
|
|
4258
|
+
continue;
|
|
4259
|
+
const pattern = !rule.custom && rule.id === "legacy-batch-name" ? legacyPattern : rule.patternFor(cls);
|
|
4260
|
+
if (!pattern)
|
|
4261
|
+
continue;
|
|
4262
|
+
const blocking = rule.severity[cls] === "error";
|
|
4263
|
+
const what = cls === "product" ? `${rule.message} in product code` : rule.message;
|
|
4264
|
+
for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
|
|
3553
4265
|
fileFindings.push({
|
|
3554
4266
|
file: file.path,
|
|
3555
|
-
line: lineAt(scrubbed,
|
|
3556
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3557
|
-
blocking
|
|
4267
|
+
line: lineAt(scrubbed, index),
|
|
4268
|
+
message: rule.custom ? customMessage(rule, cited) : `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4269
|
+
blocking,
|
|
4270
|
+
rule: rule.id
|
|
3558
4271
|
});
|
|
3559
|
-
match = pattern.exec(scrubbed);
|
|
3560
4272
|
}
|
|
3561
4273
|
}
|
|
3562
4274
|
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
@@ -3597,11 +4309,17 @@ function definesOrLinksGlossary(content, term) {
|
|
|
3597
4309
|
return true;
|
|
3598
4310
|
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3599
4311
|
}
|
|
3600
|
-
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4312
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, options = {}) {
|
|
3601
4313
|
const findings = [];
|
|
4314
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4315
|
+
const rule = set.rules.find((r) => !r.custom && r.id === "coined-term");
|
|
4316
|
+
if (!rule)
|
|
4317
|
+
return findings;
|
|
3602
4318
|
for (const file of files) {
|
|
3603
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3604
|
-
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
4319
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, DEFAULT_SPEC_PATHS, options.productPaths);
|
|
4320
|
+
if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls))
|
|
4321
|
+
continue;
|
|
4322
|
+
if (!ruleReads(set, rule, file.path))
|
|
3605
4323
|
continue;
|
|
3606
4324
|
const scrubbed = stripNonProse(file.path, file.content);
|
|
3607
4325
|
for (const term of glossaryTerms) {
|
|
@@ -3614,14 +4332,15 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
|
|
|
3614
4332
|
file: file.path,
|
|
3615
4333
|
line,
|
|
3616
4334
|
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3617
|
-
blocking:
|
|
4335
|
+
blocking: rule.severity[cls] === "error",
|
|
4336
|
+
rule: rule.id
|
|
3618
4337
|
});
|
|
3619
4338
|
}
|
|
3620
4339
|
}
|
|
3621
4340
|
return findings;
|
|
3622
4341
|
}
|
|
3623
|
-
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN =
|
|
3624
|
-
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN =
|
|
4342
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
|
|
4343
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
|
|
3625
4344
|
function extractComments(path, content) {
|
|
3626
4345
|
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3627
4346
|
return content.replace(/[^\n]/g, "");
|
|
@@ -3718,39 +4437,40 @@ function extractComments(path, content) {
|
|
|
3718
4437
|
}
|
|
3719
4438
|
return out;
|
|
3720
4439
|
}
|
|
3721
|
-
function checkSourceComments(files, allowlist = []) {
|
|
4440
|
+
function checkSourceComments(files, allowlist = [], options = {}) {
|
|
3722
4441
|
const findings = [];
|
|
3723
4442
|
const allowed = new Set(allowlist);
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3726
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3727
|
-
];
|
|
4443
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4444
|
+
const rules = rulesInScope(set, "source-comment").filter((rule) => rule.group === "reader-resolvable");
|
|
3728
4445
|
for (const file of files) {
|
|
3729
4446
|
if (!file.path.endsWith(".ts"))
|
|
3730
4447
|
continue;
|
|
3731
4448
|
if (allowed.has(file.path))
|
|
3732
4449
|
continue;
|
|
3733
4450
|
const comments = extractComments(file.path, file.content);
|
|
3734
|
-
for (const
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
4451
|
+
for (const rule of rules) {
|
|
4452
|
+
if (!ruleReads(set, rule, file.path))
|
|
4453
|
+
continue;
|
|
4454
|
+
const pattern = rule.patternFor("source-comment");
|
|
4455
|
+
if (!pattern)
|
|
4456
|
+
continue;
|
|
4457
|
+
for (const { cited, index } of citations(pattern, comments)) {
|
|
3738
4458
|
findings.push({
|
|
3739
4459
|
file: file.path,
|
|
3740
|
-
line: lineAt(comments,
|
|
3741
|
-
message: `comment cites ${
|
|
3742
|
-
blocking:
|
|
4460
|
+
line: lineAt(comments, index),
|
|
4461
|
+
message: rule.custom ? customMessage(rule, cited) : `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4462
|
+
blocking: rule.severity["source-comment"] === "error",
|
|
4463
|
+
rule: rule.id
|
|
3743
4464
|
});
|
|
3744
|
-
match = pattern.exec(comments);
|
|
3745
4465
|
}
|
|
3746
4466
|
}
|
|
3747
4467
|
}
|
|
3748
4468
|
return findings;
|
|
3749
4469
|
}
|
|
3750
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4470
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
3751
4471
|
return [
|
|
3752
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3753
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4472
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths, options),
|
|
4473
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
|
|
3754
4474
|
];
|
|
3755
4475
|
}
|
|
3756
4476
|
function parseGlossaryTerms(glossaryContent) {
|
|
@@ -3953,6 +4673,17 @@ function checkDocClaims(files, fileReader) {
|
|
|
3953
4673
|
};
|
|
3954
4674
|
}
|
|
3955
4675
|
|
|
4676
|
+
// ../../packages/aeg-core/src/protected-paths.ts
|
|
4677
|
+
import { posix as posixPath } from "node:path";
|
|
4678
|
+
var PROTECTED_ADMIN_PATHS = ["vinaya.config.json", ".vinaya/doc-owners", ".github/", "aeg-root/"];
|
|
4679
|
+
function normalizeTouchedPath(path) {
|
|
4680
|
+
return posixPath.resolve("/", path.replace(/\\/g, "/")).replace(/^\/+/, "");
|
|
4681
|
+
}
|
|
4682
|
+
function isProtectedAdminPath(path) {
|
|
4683
|
+
const normalized = normalizeTouchedPath(path);
|
|
4684
|
+
return PROTECTED_ADMIN_PATHS.some((prefix) => normalized === prefix || normalized.startsWith(prefix));
|
|
4685
|
+
}
|
|
4686
|
+
|
|
3956
4687
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3957
4688
|
function hasRationaleField(body, labelPattern) {
|
|
3958
4689
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -4072,13 +4803,20 @@ function globCoversPath(glob, path) {
|
|
|
4072
4803
|
return !p.includes("/");
|
|
4073
4804
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
4074
4805
|
}
|
|
4806
|
+
function surfaceEntryResolves(entry, resolvesToFile, pinnedFiles) {
|
|
4807
|
+
if (resolvesToFile(entry))
|
|
4808
|
+
return true;
|
|
4809
|
+
const directory = entry.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
4810
|
+
return pinnedFiles.some((path) => path.startsWith(`${directory}/`));
|
|
4811
|
+
}
|
|
4075
4812
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
4076
4813
|
const surface = parseIssueSurface(body);
|
|
4077
4814
|
if (!surface.ok)
|
|
4078
4815
|
return { status: "pass", errors: [] };
|
|
4816
|
+
const pinnedFiles = boundaryPinnedFiles(body);
|
|
4079
4817
|
const errors = [];
|
|
4080
4818
|
for (const glob of surface.value.in) {
|
|
4081
|
-
if (!
|
|
4819
|
+
if (!surfaceEntryResolves(glob, resolvesToFile, pinnedFiles)) {
|
|
4082
4820
|
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.`);
|
|
4083
4821
|
}
|
|
4084
4822
|
}
|
|
@@ -4108,6 +4846,14 @@ function recordedBeyondSurfacePaths(body) {
|
|
|
4108
4846
|
return paths;
|
|
4109
4847
|
}
|
|
4110
4848
|
function checkSurfaceScope(changedFiles, surface, recorded) {
|
|
4849
|
+
for (const path of changedFiles) {
|
|
4850
|
+
if (!isProtectedAdminPath(path))
|
|
4851
|
+
continue;
|
|
4852
|
+
const normalized = normalizeTouchedPath(path);
|
|
4853
|
+
if (!surface.in.some((glob) => globCoversPath(glob, normalized))) {
|
|
4854
|
+
return { ok: false, violation: { path, reason: "protected" } };
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4111
4857
|
const listed = new Set(recorded);
|
|
4112
4858
|
const violation = beyondSurfacePaths(changedFiles, surface).find((entry) => !listed.has(entry.path));
|
|
4113
4859
|
return violation ? { ok: false, violation } : { ok: true };
|
|
@@ -4163,12 +4909,22 @@ function checkPartsCiteDefinedObjectives(body) {
|
|
|
4163
4909
|
}
|
|
4164
4910
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
4165
4911
|
}
|
|
4912
|
+
var ISSUE_LIVE_LINE_RE = /^-\s*\*{2}\[live\]\*{2}(.*)$/gim;
|
|
4913
|
+
function liveCommand(text) {
|
|
4914
|
+
const trimmed = text.trim();
|
|
4915
|
+
const span = /^(`+)(.+)\1$/.exec(trimmed);
|
|
4916
|
+
return span ? span[2].trim() : trimmed;
|
|
4917
|
+
}
|
|
4918
|
+
function liveItemsIn(region) {
|
|
4919
|
+
return [...region.matchAll(ISSUE_LIVE_LINE_RE)].map((m) => liveCommand(m[1] ?? "")).filter(Boolean);
|
|
4920
|
+
}
|
|
4921
|
+
function parseLiveTestPlanItems(body) {
|
|
4922
|
+
const located = locateTestPlanSection(body);
|
|
4923
|
+
return located.found ? liveItemsIn(located.section) : [];
|
|
4924
|
+
}
|
|
4166
4925
|
function isTaskIssueLabelSet(labels) {
|
|
4167
4926
|
return hasLabel("tranche", labels);
|
|
4168
4927
|
}
|
|
4169
|
-
function checkTrancheLabelPresence(_body, _labels) {
|
|
4170
|
-
return { status: "pass", errors: [] };
|
|
4171
|
-
}
|
|
4172
4928
|
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
4173
4929
|
if (!isTaskIssueLabelSet(labels))
|
|
4174
4930
|
return { status: "pass", errors: [] };
|
|
@@ -4184,6 +4940,7 @@ function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTi
|
|
|
4184
4940
|
};
|
|
4185
4941
|
}
|
|
4186
4942
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
4943
|
+
var PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" });
|
|
4187
4944
|
function isControlCodePoint(codePoint) {
|
|
4188
4945
|
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
4189
4946
|
}
|
|
@@ -4244,8 +5001,14 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
4244
5001
|
}
|
|
4245
5002
|
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
4246
5003
|
}
|
|
5004
|
+
function rationaleFieldText(text, labelPattern) {
|
|
5005
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})[^\\n]*\\n?([\\s\\S]*?)(?=\\n\\s*(?:\\*\\*[A-Z]|#{1,4}\\s)|(?![\\s\\S]))`, "im");
|
|
5006
|
+
const m = re.exec(text);
|
|
5007
|
+
return m ? m[0] : "";
|
|
5008
|
+
}
|
|
4247
5009
|
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;
|
|
4248
5010
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
5011
|
+
var RATIONALE_PATH_RE_GLOBAL = /`([\w.@-]+(?:\/[\w.@-]+)+)`/g;
|
|
4249
5012
|
function normalizeEdgeId(s) {
|
|
4250
5013
|
const qualified = splitSlugQualifiedEdge(s);
|
|
4251
5014
|
return (qualified ? qualified.bareId : s).replace(/^#/, "").trim();
|
|
@@ -4253,6 +5016,15 @@ function normalizeEdgeId(s) {
|
|
|
4253
5016
|
function edgesNameEachOther(a, b) {
|
|
4254
5017
|
return a.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(b.ref)) || b.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(a.ref));
|
|
4255
5018
|
}
|
|
5019
|
+
var BOUNDARY_OUT_RE = /\bOut\s*:\s*([\s\S]*)$/im;
|
|
5020
|
+
function boundaryOutText(body) {
|
|
5021
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5022
|
+
const m = BOUNDARY_OUT_RE.exec(boundary);
|
|
5023
|
+
return m ? m[1] : "";
|
|
5024
|
+
}
|
|
5025
|
+
function namedPathsIn(text) {
|
|
5026
|
+
return [...new Set([...text.matchAll(RATIONALE_PATH_RE_GLOBAL)].map((m) => m[1]))].filter((p) => !/^https?:\/\//i.test(p));
|
|
5027
|
+
}
|
|
4256
5028
|
var FILE_EXTENSIONS = new Set([
|
|
4257
5029
|
"ts",
|
|
4258
5030
|
"tsx",
|
|
@@ -4274,6 +5046,11 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4274
5046
|
"html",
|
|
4275
5047
|
"css"
|
|
4276
5048
|
]);
|
|
5049
|
+
function boundaryPinnedFiles(body) {
|
|
5050
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5051
|
+
const excluded = new Set(namedPathsIn(boundaryOutText(body)));
|
|
5052
|
+
return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
|
|
5053
|
+
}
|
|
4277
5054
|
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4278
5055
|
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4279
5056
|
|
|
@@ -4298,7 +5075,7 @@ function isGrandfathered(isoDate) {
|
|
|
4298
5075
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
4299
5076
|
}
|
|
4300
5077
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4301
|
-
function checkA1(entries, principalAllowlist
|
|
5078
|
+
function checkA1(entries, principalAllowlist) {
|
|
4302
5079
|
const failures = [];
|
|
4303
5080
|
for (const e of entries) {
|
|
4304
5081
|
if (!e.facts)
|
|
@@ -4328,6 +5105,37 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
|
4328
5105
|
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4329
5106
|
};
|
|
4330
5107
|
}
|
|
5108
|
+
function checkA2(entries, hasProvenanceByKey) {
|
|
5109
|
+
const failures = [];
|
|
5110
|
+
for (const e of entries) {
|
|
5111
|
+
if (!e.facts)
|
|
5112
|
+
continue;
|
|
5113
|
+
if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
|
|
5114
|
+
continue;
|
|
5115
|
+
const key = `${e.trancheSlug}/${e.task.id}`;
|
|
5116
|
+
const hasProvenance = hasProvenanceByKey.get(key);
|
|
5117
|
+
if (hasProvenance === undefined)
|
|
5118
|
+
continue;
|
|
5119
|
+
if (!hasProvenance) {
|
|
5120
|
+
failures.push({
|
|
5121
|
+
code: "archived-without-provenance",
|
|
5122
|
+
issue: e.task.issue,
|
|
5123
|
+
tranche: e.trancheSlug,
|
|
5124
|
+
task: e.task.id,
|
|
5125
|
+
reason: "Closing PR has no `### AEG provenance` comment (Archivist close-out missing)",
|
|
5126
|
+
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
5127
|
+
});
|
|
5128
|
+
}
|
|
5129
|
+
}
|
|
5130
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
5131
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
5132
|
+
return {
|
|
5133
|
+
check: "A2",
|
|
5134
|
+
status,
|
|
5135
|
+
failures,
|
|
5136
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
5137
|
+
};
|
|
5138
|
+
}
|
|
4331
5139
|
function checkA3(entries) {
|
|
4332
5140
|
const failures = [];
|
|
4333
5141
|
for (const e of entries) {
|
|
@@ -4543,6 +5351,33 @@ function checkL1(files, entriesBySlug) {
|
|
|
4543
5351
|
note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
|
|
4544
5352
|
};
|
|
4545
5353
|
}
|
|
5354
|
+
function checkL2(files, entriesBySlug) {
|
|
5355
|
+
const failures = [];
|
|
5356
|
+
for (const f of files) {
|
|
5357
|
+
if (!f.archived)
|
|
5358
|
+
continue;
|
|
5359
|
+
const entries = entriesBySlug.get(f.slug) ?? [];
|
|
5360
|
+
for (const e of entries) {
|
|
5361
|
+
if (!e.facts)
|
|
5362
|
+
continue;
|
|
5363
|
+
if (e.facts.issueState === "open") {
|
|
5364
|
+
failures.push({
|
|
5365
|
+
code: "premature-archive",
|
|
5366
|
+
issue: e.task.issue,
|
|
5367
|
+
tranche: f.slug,
|
|
5368
|
+
task: e.task.id,
|
|
5369
|
+
reason: `Archived tranche has open task-Issue #${e.task.issue ?? "?"} (premature archive)`
|
|
5370
|
+
});
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
return {
|
|
5375
|
+
check: "L2",
|
|
5376
|
+
status: "info",
|
|
5377
|
+
failures,
|
|
5378
|
+
note: failures.length > 0 ? `${failures.length} archived tranche(s) with an open task-Issue — investigate (advisory)` : undefined
|
|
5379
|
+
};
|
|
5380
|
+
}
|
|
4546
5381
|
function checkL3(files) {
|
|
4547
5382
|
const active = files.filter((f) => !f.archived);
|
|
4548
5383
|
return {
|
|
@@ -4552,6 +5387,51 @@ function checkL3(files) {
|
|
|
4552
5387
|
note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
|
|
4553
5388
|
};
|
|
4554
5389
|
}
|
|
5390
|
+
function checkL4(activeTrancheSlugs, issueMilestones) {
|
|
5391
|
+
const activeSet = new Set(activeTrancheSlugs);
|
|
5392
|
+
const failures = [];
|
|
5393
|
+
for (const f of issueMilestones) {
|
|
5394
|
+
if (!activeSet.has(f.tranche))
|
|
5395
|
+
continue;
|
|
5396
|
+
if (f.milestoneTitle === f.tranche)
|
|
5397
|
+
continue;
|
|
5398
|
+
failures.push({
|
|
5399
|
+
code: "milestone-drift",
|
|
5400
|
+
issue: f.issue,
|
|
5401
|
+
tranche: f.tranche,
|
|
5402
|
+
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`
|
|
5403
|
+
});
|
|
5404
|
+
}
|
|
5405
|
+
return {
|
|
5406
|
+
check: "L4",
|
|
5407
|
+
status: "info",
|
|
5408
|
+
failures,
|
|
5409
|
+
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
|
|
5410
|
+
};
|
|
5411
|
+
}
|
|
5412
|
+
function checkL5(activeTrancheSlugs, entriesBySlug) {
|
|
5413
|
+
const failures = [];
|
|
5414
|
+
for (const slug of activeTrancheSlugs) {
|
|
5415
|
+
const entries = entriesBySlug.get(slug) ?? [];
|
|
5416
|
+
const withFacts = entries.filter((e) => e.facts !== undefined);
|
|
5417
|
+
if (withFacts.length === 0)
|
|
5418
|
+
continue;
|
|
5419
|
+
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
5420
|
+
if (allClosed) {
|
|
5421
|
+
failures.push({
|
|
5422
|
+
code: "tranche-not-archived",
|
|
5423
|
+
tranche: slug,
|
|
5424
|
+
reason: "Every task Issue is closed but the tranche is not recorded as complete — archive it"
|
|
5425
|
+
});
|
|
5426
|
+
}
|
|
5427
|
+
}
|
|
5428
|
+
return {
|
|
5429
|
+
check: "L5",
|
|
5430
|
+
status: failures.length > 0 ? "fail" : "pass",
|
|
5431
|
+
failures,
|
|
5432
|
+
note: failures.length > 0 ? `${failures.length} tranche(s) whose task Issues are all closed but were never archived` : undefined
|
|
5433
|
+
};
|
|
5434
|
+
}
|
|
4555
5435
|
function extractClosesReferences(prBody) {
|
|
4556
5436
|
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#(\d+)/gi;
|
|
4557
5437
|
const stripped = stripCode(prBody);
|
|
@@ -4647,6 +5527,58 @@ function extractIssue(body) {
|
|
|
4647
5527
|
}
|
|
4648
5528
|
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4649
5529
|
import { createHash as createHash4 } from "node:crypto";
|
|
5530
|
+
|
|
5531
|
+
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
5532
|
+
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
5533
|
+
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
5534
|
+
let best = 0;
|
|
5535
|
+
for (const c of comments) {
|
|
5536
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5537
|
+
continue;
|
|
5538
|
+
const firstLine = (c.body.split(`
|
|
5539
|
+
`)[0] ?? "").trim();
|
|
5540
|
+
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
5541
|
+
if (!m)
|
|
5542
|
+
continue;
|
|
5543
|
+
const k = Number.parseInt(m[1], 10);
|
|
5544
|
+
if (k > best)
|
|
5545
|
+
best = k;
|
|
5546
|
+
}
|
|
5547
|
+
return best;
|
|
5548
|
+
}
|
|
5549
|
+
function parseRulingIdentity(rulingId) {
|
|
5550
|
+
const m = /^(issue-)?(\d+)-(\d+)$/.exec(rulingId);
|
|
5551
|
+
if (!m)
|
|
5552
|
+
return null;
|
|
5553
|
+
const ref = Number.parseInt(m[2], 10);
|
|
5554
|
+
const ordinal = Number.parseInt(m[3], 10);
|
|
5555
|
+
if (ref <= 0 || ordinal <= 0)
|
|
5556
|
+
return null;
|
|
5557
|
+
return { target: m[1] ? "issue" : "pr", ref, ordinal };
|
|
5558
|
+
}
|
|
5559
|
+
function principalRulingTextById(comments, allowlist, rulingId) {
|
|
5560
|
+
const identity = parseRulingIdentity(rulingId);
|
|
5561
|
+
if (identity === null)
|
|
5562
|
+
return null;
|
|
5563
|
+
const matches = comments.filter((c) => {
|
|
5564
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5565
|
+
return false;
|
|
5566
|
+
const m = RULING_MARKER_ORDINAL.exec((c.body.split(`
|
|
5567
|
+
`)[0] ?? "").trim());
|
|
5568
|
+
return m !== null && Number.parseInt(m[1], 10) === identity.ordinal;
|
|
5569
|
+
});
|
|
5570
|
+
if (matches.length !== 1)
|
|
5571
|
+
return null;
|
|
5572
|
+
const body = matches[0].body;
|
|
5573
|
+
const idx = body.indexOf(`
|
|
5574
|
+
`);
|
|
5575
|
+
return idx === -1 ? "" : body.slice(idx + 1).trim();
|
|
5576
|
+
}
|
|
5577
|
+
|
|
5578
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
5579
|
+
function pauseBoundRulingDigest(rulingText) {
|
|
5580
|
+
return createHash4("sha256").update(rulingText).digest("hex");
|
|
5581
|
+
}
|
|
4650
5582
|
function briefHash(brief) {
|
|
4651
5583
|
return createHash4("sha256").update(`${brief}
|
|
4652
5584
|
`).digest("hex");
|
|
@@ -4707,14 +5639,19 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4707
5639
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4708
5640
|
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4709
5641
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
5642
|
+
const legacyCurrent = current.manifestVersion === undefined;
|
|
5643
|
+
const manifestVersion = legacyCurrent ? echoed.manifestVersion === undefined || echoed.manifestVersion === null : echoed.manifestVersion === current.manifestVersion;
|
|
5644
|
+
const pauseBoundRuling = legacyCurrent ? true : Object.hasOwn(echoed, "pauseBoundRuling") && JSON.stringify(echoed.pauseBoundRuling) === JSON.stringify(current.pauseBoundRuling);
|
|
4710
5645
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4711
5646
|
return {
|
|
4712
|
-
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
5647
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && pauseBoundRuling && manifestVersion && policyDigestBound,
|
|
4713
5648
|
head,
|
|
4714
5649
|
base,
|
|
4715
5650
|
briefHash: briefHashBound,
|
|
4716
5651
|
objectivesVersion,
|
|
4717
5652
|
rulingOrdinal,
|
|
5653
|
+
pauseBoundRuling,
|
|
5654
|
+
manifestVersion,
|
|
4718
5655
|
policyDigest: policyDigestBound
|
|
4719
5656
|
};
|
|
4720
5657
|
}
|
|
@@ -4730,7 +5667,7 @@ function renderGateDeferred(deferred) {
|
|
|
4730
5667
|
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4731
5668
|
}
|
|
4732
5669
|
function checkReviewGate(input) {
|
|
4733
|
-
const principalAllowlist = input
|
|
5670
|
+
const { principalAllowlist } = input;
|
|
4734
5671
|
const waived = isWaiverLabelActorVerified({
|
|
4735
5672
|
label: WAIVER_LABEL_REVIEW,
|
|
4736
5673
|
labels: input.labels,
|
|
@@ -4769,27 +5706,33 @@ function checkReviewGate(input) {
|
|
|
4769
5706
|
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4770
5707
|
const securityClean = securityTextClean && securityPolicyClean;
|
|
4771
5708
|
const currentManifest = {
|
|
5709
|
+
...input.manifestVersion === undefined ? {} : { manifestVersion: input.manifestVersion },
|
|
4772
5710
|
headSha: input.headSha,
|
|
4773
5711
|
baseSha: input.baseSha ?? null,
|
|
4774
5712
|
briefHash: input.briefHash ?? null,
|
|
4775
5713
|
objectivesVersion: input.objectivesVersion,
|
|
4776
5714
|
rulingOrdinal: input.rulingOrdinal,
|
|
5715
|
+
pauseBoundRuling: input.pauseBoundRuling ?? null,
|
|
4777
5716
|
policyDigest: policyDigest(policy)
|
|
4778
5717
|
};
|
|
4779
5718
|
const codeReviewEchoed = {
|
|
5719
|
+
manifestVersion: codeReview.manifestVersion,
|
|
4780
5720
|
headSha: codeReview.headSha,
|
|
4781
5721
|
baseSha: codeReview.baseSha,
|
|
4782
5722
|
briefHash: codeReview.briefHash,
|
|
4783
5723
|
objectivesVersion: codeReview.objectivesVersion,
|
|
4784
5724
|
rulingOrdinal: codeReview.rulingOrdinal,
|
|
5725
|
+
pauseBoundRuling: codeReview.pauseBoundRuling,
|
|
4785
5726
|
policyDigest: codeReview.policyDigest
|
|
4786
5727
|
};
|
|
4787
5728
|
const securityEchoed = {
|
|
5729
|
+
manifestVersion: security.manifestVersion,
|
|
4788
5730
|
headSha: security.headSha,
|
|
4789
5731
|
baseSha: security.baseSha,
|
|
4790
5732
|
briefHash: security.briefHash,
|
|
4791
5733
|
objectivesVersion: security.objectivesVersion,
|
|
4792
5734
|
rulingOrdinal: security.rulingOrdinal,
|
|
5735
|
+
pauseBoundRuling: security.pauseBoundRuling,
|
|
4793
5736
|
policyDigest: security.policyDigest
|
|
4794
5737
|
};
|
|
4795
5738
|
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
@@ -4828,6 +5771,10 @@ function checkReviewGate(input) {
|
|
|
4828
5771
|
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"}`);
|
|
4829
5772
|
} else if (!codeReviewBinding.policyDigest) {
|
|
4830
5773
|
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}`);
|
|
5774
|
+
} else if (!codeReviewBinding.manifestVersion) {
|
|
5775
|
+
problems.push(`the newest code-review verdict echoes manifest version ${codeReview.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5776
|
+
} else if (!codeReviewBinding.pauseBoundRuling) {
|
|
5777
|
+
problems.push(`the newest code-review verdict echoes pauseBoundRuling ${renderBinding(codeReview.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4831
5778
|
}
|
|
4832
5779
|
if (!securityTextClean) {
|
|
4833
5780
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
@@ -4845,6 +5792,10 @@ function checkReviewGate(input) {
|
|
|
4845
5792
|
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"}`);
|
|
4846
5793
|
} else if (!securityBinding.policyDigest) {
|
|
4847
5794
|
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}`);
|
|
5795
|
+
} else if (!securityBinding.manifestVersion) {
|
|
5796
|
+
problems.push(`the newest security-review verdict echoes manifest version ${security.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5797
|
+
} else if (!securityBinding.pauseBoundRuling) {
|
|
5798
|
+
problems.push(`the newest security-review verdict echoes pauseBoundRuling ${renderBinding(security.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4848
5799
|
}
|
|
4849
5800
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4850
5801
|
return {
|
|
@@ -4853,29 +5804,16 @@ function checkReviewGate(input) {
|
|
|
4853
5804
|
waived: false
|
|
4854
5805
|
};
|
|
4855
5806
|
}
|
|
5807
|
+
function renderBinding(binding) {
|
|
5808
|
+
if (binding === undefined)
|
|
5809
|
+
return "(absent)";
|
|
5810
|
+
return binding === null ? "(none)" : `${binding.rulingId}|${binding.pauseId}|${binding.contentDigest}`;
|
|
5811
|
+
}
|
|
4856
5812
|
var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
|
|
4857
5813
|
var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
|
|
4858
5814
|
function isChangesetsReleasePr(branch, author, expectedAuthor) {
|
|
4859
5815
|
return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
|
|
4860
5816
|
}
|
|
4861
|
-
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
4862
|
-
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
4863
|
-
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
4864
|
-
let best = 0;
|
|
4865
|
-
for (const c of comments) {
|
|
4866
|
-
if (!isPrincipal(c.author, allowlist))
|
|
4867
|
-
continue;
|
|
4868
|
-
const firstLine = (c.body.split(`
|
|
4869
|
-
`)[0] ?? "").trim();
|
|
4870
|
-
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
4871
|
-
if (!m)
|
|
4872
|
-
continue;
|
|
4873
|
-
const k = Number.parseInt(m[1], 10);
|
|
4874
|
-
if (k > best)
|
|
4875
|
-
best = k;
|
|
4876
|
-
}
|
|
4877
|
-
return best;
|
|
4878
|
-
}
|
|
4879
5817
|
// ../../packages/aeg-core/src/markdown-table.ts
|
|
4880
5818
|
function splitRow(line) {
|
|
4881
5819
|
const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
@@ -5027,7 +5965,6 @@ var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
|
5027
5965
|
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
5028
5966
|
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
5029
5967
|
"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)',
|
|
5030
|
-
"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)`,
|
|
5031
5968
|
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
5032
5969
|
};
|
|
5033
5970
|
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
@@ -5251,72 +6188,10 @@ function compareToBaseline(current, baseline) {
|
|
|
5251
6188
|
};
|
|
5252
6189
|
}
|
|
5253
6190
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
5254
|
-
var
|
|
5255
|
-
var RETIRED_PATTERNS =
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
"decision (entry|logged)",
|
|
5259
|
-
"decision-log entry",
|
|
5260
|
-
"decision log entry",
|
|
5261
|
-
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
5262
|
-
"decision-log",
|
|
5263
|
-
"decision entr",
|
|
5264
|
-
"decisions? (are |is )?logged",
|
|
5265
|
-
"log entries",
|
|
5266
|
-
String.raw`decisions\.md`,
|
|
5267
|
-
"decisions-legacy",
|
|
5268
|
-
"CONTRADICTION",
|
|
5269
|
-
"assumes Tier 3",
|
|
5270
|
-
"Lock: ?YES",
|
|
5271
|
-
"Lock: ?NO",
|
|
5272
|
-
"lock approvals?",
|
|
5273
|
-
"approves locks",
|
|
5274
|
-
"Conforms to lock",
|
|
5275
|
-
"Challenges lock",
|
|
5276
|
-
"checkDecisionNumbersFresh",
|
|
5277
|
-
String.raw`roles/team-leader\.md`,
|
|
5278
|
-
String.raw`\(,`,
|
|
5279
|
-
String.raw`,\)`,
|
|
5280
|
-
String.raw`\(\.\)`,
|
|
5281
|
-
...PLAN_ON_DISK_PATTERNS
|
|
5282
|
-
];
|
|
5283
|
-
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
5284
|
-
var RETIRED_EXEMPT_SUBSTRINGS = [
|
|
5285
|
-
"docs/decisions-legacy.md",
|
|
5286
|
-
"apps/herald-ai/docs/",
|
|
5287
|
-
"apps/vada-ai/docs/",
|
|
5288
|
-
"aeg-root/tranches/completed/",
|
|
5289
|
-
"packages/aeg-core/src/docs/published-prose",
|
|
5290
|
-
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
5291
|
-
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
5292
|
-
"/fixtures/",
|
|
5293
|
-
"/node_modules/",
|
|
5294
|
-
"/.next/",
|
|
5295
|
-
"/.turbo/"
|
|
5296
|
-
];
|
|
5297
|
-
var PATTERN_EXEMPT = {
|
|
5298
|
-
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
5299
|
-
[String.raw`decisions\.md`]: [
|
|
5300
|
-
"docs-index.md",
|
|
5301
|
-
"apps/vada-ai/specs/legacy/README.md",
|
|
5302
|
-
"apps/vada-ai/specs/vada-product-spec.md",
|
|
5303
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5304
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5305
|
-
],
|
|
5306
|
-
"decisions-legacy": [
|
|
5307
|
-
"packages/aeg-core/src/file-classify.ts",
|
|
5308
|
-
"packages/aeg-core/src/file-classify.test.ts",
|
|
5309
|
-
"packages/aeg-core/src/pr-tier.test.ts",
|
|
5310
|
-
"docs-index.md",
|
|
5311
|
-
".claude/skills/database/SKILL.md",
|
|
5312
|
-
".claude/skills/vada-architecture/SKILL.md",
|
|
5313
|
-
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
5314
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5315
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5316
|
-
],
|
|
5317
|
-
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
5318
|
-
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
5319
|
-
};
|
|
6191
|
+
var retiredRules = rulesForGroup("retired-vocabulary");
|
|
6192
|
+
var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
|
|
6193
|
+
var PATTERN_EXEMPT = RETIRED_PATTERN_EXEMPTIONS;
|
|
6194
|
+
var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
|
|
5320
6195
|
function lineNumbers(content, pattern) {
|
|
5321
6196
|
const out = [];
|
|
5322
6197
|
const lines = content.split(`
|
|
@@ -5327,22 +6202,29 @@ function lineNumbers(content, pattern) {
|
|
|
5327
6202
|
}
|
|
5328
6203
|
return out;
|
|
5329
6204
|
}
|
|
5330
|
-
function scanRetiredVocabulary(files) {
|
|
6205
|
+
function scanRetiredVocabulary(files, rules = DEFAULT_PROSE_RULE_SET) {
|
|
5331
6206
|
const findings = [];
|
|
6207
|
+
const retired = rulesOfGroup(rules, "retired-vocabulary");
|
|
5332
6208
|
for (const file of files) {
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
6209
|
+
for (const rule of retired) {
|
|
6210
|
+
if (rule.substringExempt.some((e) => file.path.includes(e)))
|
|
6211
|
+
continue;
|
|
6212
|
+
if (!ruleReads(rules, rule, file.path))
|
|
6213
|
+
continue;
|
|
6214
|
+
const re = rule.patternFor("repository");
|
|
6215
|
+
if (!re)
|
|
6216
|
+
continue;
|
|
6217
|
+
const pattern = rule.custom ? re.source : DEFAULT_PATTERN_OF.get(rule.id) ?? re.source;
|
|
6218
|
+
if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e)))
|
|
5338
6219
|
continue;
|
|
5339
|
-
const re = new RegExp(pattern);
|
|
5340
6220
|
for (const line of lineNumbers(file.content, re)) {
|
|
5341
6221
|
findings.push({
|
|
5342
6222
|
file: file.path,
|
|
5343
6223
|
line,
|
|
5344
6224
|
pattern,
|
|
5345
|
-
message: `claims a retired AEG mechanism is still live (matches /${pattern}/)
|
|
6225
|
+
message: rule.custom ? `${rule.id}: ${rule.message} (matches /${pattern}/)` : `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
|
|
6226
|
+
rule: rule.id,
|
|
6227
|
+
blocking: rule.severity.repository === "error"
|
|
5346
6228
|
});
|
|
5347
6229
|
}
|
|
5348
6230
|
}
|
|
@@ -5366,7 +6248,7 @@ function isSelfDependency(dep, task, issue) {
|
|
|
5366
6248
|
function checkDispatchReadiness(input) {
|
|
5367
6249
|
const { trancheSlug, task } = input;
|
|
5368
6250
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
5369
|
-
const principalAllowlist = input
|
|
6251
|
+
const { principalAllowlist } = input;
|
|
5370
6252
|
const blockerDetails = [];
|
|
5371
6253
|
const push = (blockerClass, message) => {
|
|
5372
6254
|
blockerDetails.push({ class: blockerClass, message });
|
|
@@ -5458,6 +6340,16 @@ function pushesAnyBranchRef(pushRefs) {
|
|
|
5458
6340
|
return pushRefs.split(`
|
|
5459
6341
|
`).map((line) => line.trim()).filter((line) => line.length > 0).some((line) => line.split(/\s+/)[2]?.startsWith("refs/heads/") === true);
|
|
5460
6342
|
}
|
|
6343
|
+
function resolveDefaultBranch(facts) {
|
|
6344
|
+
const { originHead, hasOriginMain, hasOriginMaster } = facts;
|
|
6345
|
+
if (originHead !== null && originHead !== "")
|
|
6346
|
+
return originHead;
|
|
6347
|
+
if (hasOriginMain)
|
|
6348
|
+
return "main";
|
|
6349
|
+
if (hasOriginMaster)
|
|
6350
|
+
return "master";
|
|
6351
|
+
return null;
|
|
6352
|
+
}
|
|
5461
6353
|
function checkMainBranchRefusal(facts) {
|
|
5462
6354
|
const { currentSymbolicBranch, defaultBranch, pushRefs = null } = facts;
|
|
5463
6355
|
if (currentSymbolicBranch === null)
|
|
@@ -5718,54 +6610,61 @@ function checkFirstPushDispatchGate(input) {
|
|
|
5718
6610
|
reason: `verify-dispatch reports READY TO DISPATCH for \`${branch}\`.`
|
|
5719
6611
|
};
|
|
5720
6612
|
}
|
|
5721
|
-
// ../../packages/aeg-core/src/
|
|
5722
|
-
|
|
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
|
-
|
|
6613
|
+
// ../../packages/aeg-core/src/live-record.ts
|
|
6614
|
+
var RECORD_LINE_RE = /^-\s*\[([ xX])\]\s*\*\*\[live\]\*\*\s+(`+) ?(.+?) ?\2(?!`)\s+—\s+(passed|failed|unverified)\s+at\s+`([^`]+)`/;
|
|
6615
|
+
function liveMarkers(body) {
|
|
6616
|
+
const masked = maskCode(body);
|
|
6617
|
+
return [...masked.matchAll(/<!--\s*AEG:LIVE:(?:START|END)\s*-->/g)].map((m) => ({
|
|
6618
|
+
start: m.index,
|
|
6619
|
+
end: m.index + m[0].length
|
|
6620
|
+
}));
|
|
6621
|
+
}
|
|
6622
|
+
var AMBIGUOUS_RECORD_LINE = {
|
|
6623
|
+
line: "- [ ] **[live]** the pull request body carries more than one `AEG:LIVE` marker pair, so the driver's record cannot be told apart",
|
|
6624
|
+
ticked: false,
|
|
6625
|
+
command: "",
|
|
6626
|
+
outcome: "failed",
|
|
6627
|
+
head: ""
|
|
6628
|
+
};
|
|
6629
|
+
function readLiveRecord(body) {
|
|
6630
|
+
const markers = liveMarkers(body).length;
|
|
6631
|
+
if (markers === 0)
|
|
6632
|
+
return [];
|
|
6633
|
+
if (markers !== 2)
|
|
6634
|
+
return [AMBIGUOUS_RECORD_LINE];
|
|
6635
|
+
const region = anchoredRegion(body, "LIVE");
|
|
6636
|
+
if (region === null)
|
|
6637
|
+
return [];
|
|
6638
|
+
const lines = [];
|
|
6639
|
+
for (const raw of region.split(`
|
|
6640
|
+
`)) {
|
|
6641
|
+
const line = raw.trim();
|
|
6642
|
+
const m = RECORD_LINE_RE.exec(line);
|
|
6643
|
+
if (!m)
|
|
6644
|
+
continue;
|
|
6645
|
+
lines.push({
|
|
6646
|
+
line,
|
|
6647
|
+
ticked: m[1].toLowerCase() === "x",
|
|
6648
|
+
command: m[3],
|
|
6649
|
+
outcome: m[4],
|
|
6650
|
+
head: m[5]
|
|
6651
|
+
});
|
|
5759
6652
|
}
|
|
5760
|
-
return
|
|
5761
|
-
action: "assign",
|
|
5762
|
-
issue,
|
|
5763
|
-
login,
|
|
5764
|
-
reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
|
|
5765
|
-
};
|
|
6653
|
+
return lines;
|
|
5766
6654
|
}
|
|
5767
6655
|
// ../../packages/aeg-core/src/test-plan-gate.ts
|
|
5768
|
-
function
|
|
6656
|
+
function gradedLiveLines(record, live) {
|
|
6657
|
+
if (live === undefined)
|
|
6658
|
+
return record.map((entry) => entry.line);
|
|
6659
|
+
const commands = new Set(live.liveCommands);
|
|
6660
|
+
const others = record.filter((entry) => !commands.has(entry.command)).map((entry) => entry.line);
|
|
6661
|
+
const graded = live.liveCommands.map((command) => {
|
|
6662
|
+
const atHead = record.filter((entry) => entry.command === command && entry.head === live.head);
|
|
6663
|
+
return (atHead.find((entry) => entry.ticked) ?? atHead[0])?.line ?? `- [ ] **[live]** \`${command}\` — no passed run recorded at \`${live.head || "an unknown head"}\``;
|
|
6664
|
+
});
|
|
6665
|
+
return [...others, ...graded];
|
|
6666
|
+
}
|
|
6667
|
+
function evaluateTestPlanGate(body, branch, live) {
|
|
5769
6668
|
if (!body) {
|
|
5770
6669
|
return {
|
|
5771
6670
|
verdict: "pass",
|
|
@@ -5776,7 +6675,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5776
6675
|
};
|
|
5777
6676
|
}
|
|
5778
6677
|
const located = locateTestPlanSection(body);
|
|
5779
|
-
|
|
6678
|
+
const liveLines = gradedLiveLines(readLiveRecord(body), live);
|
|
6679
|
+
const liveUnticked = liveLines.some((line) => /^[-*]\s+\[\s\]/.test(line));
|
|
6680
|
+
if (!located.found && !liveUnticked) {
|
|
5780
6681
|
if (parseTaskBranchIdentity(branch) !== null) {
|
|
5781
6682
|
return {
|
|
5782
6683
|
verdict: "fail",
|
|
@@ -5796,15 +6697,18 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5796
6697
|
]
|
|
5797
6698
|
};
|
|
5798
6699
|
}
|
|
5799
|
-
const section = located.section;
|
|
5800
|
-
if (/unit-tests-only/i.test(section)) {
|
|
6700
|
+
const section = located.found ? located.section : "";
|
|
6701
|
+
if (/unit-tests-only/i.test(section) && !liveUnticked) {
|
|
5801
6702
|
return {
|
|
5802
6703
|
verdict: "pass",
|
|
5803
6704
|
messages: ["Test Plan: unit-tests-only — pure-logic brief, CI unit-tests are the proof.", "PASS."]
|
|
5804
6705
|
};
|
|
5805
6706
|
}
|
|
5806
|
-
const checkboxLines =
|
|
5807
|
-
|
|
6707
|
+
const checkboxLines = [
|
|
6708
|
+
...section.split(`
|
|
6709
|
+
`).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line)),
|
|
6710
|
+
...liveLines
|
|
6711
|
+
];
|
|
5808
6712
|
if (checkboxLines.length === 0) {
|
|
5809
6713
|
return {
|
|
5810
6714
|
verdict: "pass",
|
|
@@ -5821,7 +6725,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5821
6725
|
messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
|
|
5822
6726
|
for (const line of unchecked)
|
|
5823
6727
|
messages.push(` ${line}`);
|
|
5824
|
-
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.",
|
|
6728
|
+
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 ? [
|
|
6729
|
+
"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."
|
|
6730
|
+
] : [], "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.");
|
|
5825
6731
|
return { verdict: "fail", messages };
|
|
5826
6732
|
}
|
|
5827
6733
|
messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
@@ -6010,9 +6916,11 @@ var LineageSchema = z3.object({
|
|
|
6010
6916
|
parent: z3.string().nullable()
|
|
6011
6917
|
}).strict();
|
|
6012
6918
|
var InputVersionsSchema = z3.object({
|
|
6919
|
+
manifest_version: z3.literal(2).nullable().optional(),
|
|
6013
6920
|
objectives_version: z3.string().nullable(),
|
|
6014
6921
|
brief_hash: z3.string().nullable(),
|
|
6015
6922
|
ruling_ordinal: z3.number().int().nullable(),
|
|
6923
|
+
pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
|
|
6016
6924
|
policy_digest: z3.string().nullable()
|
|
6017
6925
|
}).strict();
|
|
6018
6926
|
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
@@ -6560,17 +7468,19 @@ function buildHeader(input) {
|
|
|
6560
7468
|
parent: lineageFieldFromEnv(input.env.parent)
|
|
6561
7469
|
},
|
|
6562
7470
|
input_versions: {
|
|
7471
|
+
manifest_version: input.inputVersions?.manifestVersion ?? null,
|
|
6563
7472
|
objectives_version: input.inputVersions?.objectivesVersion ?? null,
|
|
6564
7473
|
brief_hash: input.inputVersions?.briefHash ?? null,
|
|
6565
7474
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
7475
|
+
pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
|
|
6566
7476
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6567
7477
|
},
|
|
6568
7478
|
provenance: provenanceFor(input),
|
|
6569
7479
|
work: {
|
|
6570
7480
|
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6571
7481
|
repo: input.repo,
|
|
6572
|
-
change: null,
|
|
6573
|
-
revision: null
|
|
7482
|
+
change: pr === undefined ? null : String(pr),
|
|
7483
|
+
revision: input.revision ?? null
|
|
6574
7484
|
},
|
|
6575
7485
|
flow: {
|
|
6576
7486
|
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
@@ -6758,6 +7668,12 @@ var ManifestRecordSchema = z4.object({
|
|
|
6758
7668
|
briefHash: z4.string().min(1).nullable(),
|
|
6759
7669
|
objectivesVersion: z4.string().min(1).nullable(),
|
|
6760
7670
|
rulingOrdinal: epochNumber,
|
|
7671
|
+
manifestVersion: z4.literal(2).optional(),
|
|
7672
|
+
pauseBoundRuling: z4.object({
|
|
7673
|
+
rulingId: z4.string().min(1),
|
|
7674
|
+
pauseId: z4.string().min(1),
|
|
7675
|
+
contentDigest: z4.string().min(1)
|
|
7676
|
+
}).strict().nullable().optional(),
|
|
6761
7677
|
policyDigest: z4.string().min(1),
|
|
6762
7678
|
recordedAt: isoTimestamp
|
|
6763
7679
|
}).strict();
|
|
@@ -6779,7 +7695,11 @@ var LoopStateRecordSchema = z4.object({
|
|
|
6779
7695
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6780
7696
|
repeatMemory: z4.object({
|
|
6781
7697
|
blockingFindings: z4.array(z4.string()),
|
|
6782
|
-
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
7698
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
|
|
7699
|
+
}).strict().optional(),
|
|
7700
|
+
developerHandoff: z4.object({
|
|
7701
|
+
findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
|
|
7702
|
+
failingChecks: z4.array(z4.string().min(1))
|
|
6783
7703
|
}).strict().optional(),
|
|
6784
7704
|
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6785
7705
|
taskStartedAt: isoTimestamp.optional(),
|
|
@@ -6950,6 +7870,16 @@ var COMMANDS = [
|
|
|
6950
7870
|
],
|
|
6951
7871
|
status: "shipped"
|
|
6952
7872
|
},
|
|
7873
|
+
{
|
|
7874
|
+
name: "new adr",
|
|
7875
|
+
needs: [],
|
|
7876
|
+
description: "Write the next numbered decision record into the folder decisionRecords.path names",
|
|
7877
|
+
details: [
|
|
7878
|
+
"`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.",
|
|
7879
|
+
"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."
|
|
7880
|
+
],
|
|
7881
|
+
status: "shipped"
|
|
7882
|
+
},
|
|
6953
7883
|
{
|
|
6954
7884
|
name: "brief render",
|
|
6955
7885
|
needs: ["forge", "default-branch"],
|
|
@@ -6968,9 +7898,7 @@ var COMMANDS = [
|
|
|
6968
7898
|
name: "task dispatch",
|
|
6969
7899
|
needs: ["forge", "operator-seat"],
|
|
6970
7900
|
description: "Deprecated — render, pin, and post the brief on the Issue as the frozen original; start the developer",
|
|
6971
|
-
flags: [
|
|
6972
|
-
{ flag: "--agent <claude|codex|gemini>", description: "Start the developer through dispatchRole once posted" }
|
|
6973
|
-
],
|
|
7901
|
+
flags: [{ flag: "--agent <claude|codex>", description: "Start the developer through dispatchRole once posted" }],
|
|
6974
7902
|
details: [
|
|
6975
7903
|
"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.",
|
|
6976
7904
|
"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.",
|
|
@@ -6995,7 +7923,7 @@ var COMMANDS = [
|
|
|
6995
7923
|
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
6996
7924
|
flags: [
|
|
6997
7925
|
{
|
|
6998
|
-
flag: "--agent <claude|codex
|
|
7926
|
+
flag: "--agent <claude|codex>",
|
|
6999
7927
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
7000
7928
|
},
|
|
7001
7929
|
{
|
|
@@ -7170,6 +8098,22 @@ var COMMANDS = [
|
|
|
7170
8098
|
],
|
|
7171
8099
|
status: "shipped"
|
|
7172
8100
|
},
|
|
8101
|
+
{
|
|
8102
|
+
name: "pr snapshot",
|
|
8103
|
+
needs: ["forge"],
|
|
8104
|
+
description: "CI plumbing: write a run's forge snapshot of the pull request and its task Issue, read over REST",
|
|
8105
|
+
flags: [
|
|
8106
|
+
{
|
|
8107
|
+
flag: "--dir",
|
|
8108
|
+
description: "The snapshot directory; its `raw/` holds the REST pull request and comment pages the read step wrote"
|
|
8109
|
+
}
|
|
8110
|
+
],
|
|
8111
|
+
details: [
|
|
8112
|
+
"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.",
|
|
8113
|
+
"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."
|
|
8114
|
+
],
|
|
8115
|
+
status: "shipped"
|
|
8116
|
+
},
|
|
7173
8117
|
{
|
|
7174
8118
|
name: "issue create",
|
|
7175
8119
|
needs: ["forge"],
|
|
@@ -7290,14 +8234,14 @@ var COMMANDS = [
|
|
|
7290
8234
|
{
|
|
7291
8235
|
name: "milestone close",
|
|
7292
8236
|
needs: ["forge"],
|
|
7293
|
-
description: "Close a tranche's Milestone after verifying every labeled Issue is
|
|
8237
|
+
description: "Close a tranche's Milestone after verifying every labeled Issue is attached and every tranche it declares is complete",
|
|
7294
8238
|
flags: [
|
|
7295
8239
|
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
7296
8240
|
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
7297
8241
|
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7298
8242
|
],
|
|
7299
8243
|
details: [
|
|
7300
|
-
"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."
|
|
8244
|
+
"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."
|
|
7301
8245
|
],
|
|
7302
8246
|
status: "shipped"
|
|
7303
8247
|
},
|
|
@@ -7586,7 +8530,7 @@ var COMMANDS = [
|
|
|
7586
8530
|
}
|
|
7587
8531
|
],
|
|
7588
8532
|
details: [
|
|
7589
|
-
"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`
|
|
8533
|
+
"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.",
|
|
7590
8534
|
"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.",
|
|
7591
8535
|
'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.'
|
|
7592
8536
|
],
|
|
@@ -7595,11 +8539,11 @@ var COMMANDS = [
|
|
|
7595
8539
|
{
|
|
7596
8540
|
name: "dispatch",
|
|
7597
8541
|
needs: ["operator-seat"],
|
|
7598
|
-
description: "Start a role's headless agent session (claude/codex
|
|
8542
|
+
description: "Start a role's headless agent session (claude/codex) with attribution set on its environment, recording the outcome through the Vinaya Log",
|
|
7599
8543
|
flags: [
|
|
7600
8544
|
{
|
|
7601
8545
|
flag: "--agent",
|
|
7602
|
-
description: "Vendor to start: `claude
|
|
8546
|
+
description: "Vendor to start: `claude` or `codex` (falls back to `dispatch.agent` in config)"
|
|
7603
8547
|
},
|
|
7604
8548
|
{ flag: "--prompt-file", description: "Path to the prompt text sent to the agent (never on argv)" },
|
|
7605
8549
|
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
@@ -7616,9 +8560,9 @@ var COMMANDS = [
|
|
|
7616
8560
|
],
|
|
7617
8561
|
details: [
|
|
7618
8562
|
"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.",
|
|
7619
|
-
"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 `
|
|
8563
|
+
"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`.",
|
|
7620
8564
|
"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.",
|
|
7621
|
-
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude
|
|
8565
|
+
"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."
|
|
7622
8566
|
],
|
|
7623
8567
|
status: "shipped"
|
|
7624
8568
|
},
|
|
@@ -7629,7 +8573,7 @@ var COMMANDS = [
|
|
|
7629
8573
|
flags: [
|
|
7630
8574
|
{ flag: "--task <n>", description: "This task's Issue number — its frozen `aeg:brief:v1` comment is the brief" },
|
|
7631
8575
|
{
|
|
7632
|
-
flag: "--agent <claude|codex
|
|
8576
|
+
flag: "--agent <claude|codex>",
|
|
7633
8577
|
description: "Vendor for every dispatch this loop makes (falls back to `dispatch.agent` in config)"
|
|
7634
8578
|
},
|
|
7635
8579
|
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
@@ -7726,29 +8670,313 @@ import { promisify as promisify4 } from "node:util";
|
|
|
7726
8670
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7727
8671
|
import { homedir } from "node:os";
|
|
7728
8672
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
7729
|
-
import { z as
|
|
8673
|
+
import { z as z7 } from "zod";
|
|
7730
8674
|
|
|
7731
8675
|
// src/lib/agent-vendors.ts
|
|
7732
8676
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
7733
8677
|
|
|
8678
|
+
// src/lib/prose-rules-config.ts
|
|
8679
|
+
import safeRegex from "safe-regex2";
|
|
8680
|
+
import { z as z6 } from "zod";
|
|
8681
|
+
var SEVERITIES = ["error", "warning"];
|
|
8682
|
+
var OVERRIDE_KEYS = ["scopes", "severity", "exempt"];
|
|
8683
|
+
var FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
|
|
8684
|
+
var CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
|
|
8685
|
+
var DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
|
|
8686
|
+
function isPlainObject3(value) {
|
|
8687
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8688
|
+
}
|
|
8689
|
+
function outsideRepositoryReason(entry) {
|
|
8690
|
+
if (entry.startsWith("/") || /^[A-Za-z]:/.test(entry))
|
|
8691
|
+
return "must be a repository-relative path, not an absolute one";
|
|
8692
|
+
if (entry.split(/[\\/]/).includes(".."))
|
|
8693
|
+
return "must stay inside the repository — no `..` segment";
|
|
8694
|
+
return null;
|
|
8695
|
+
}
|
|
8696
|
+
var RepoRelativePathSchema = z6.string().min(1).superRefine((entry, ctx) => {
|
|
8697
|
+
const reason = outsideRepositoryReason(entry);
|
|
8698
|
+
if (reason)
|
|
8699
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, message: reason });
|
|
8700
|
+
});
|
|
8701
|
+
function pathListIssues(value, path, issues) {
|
|
8702
|
+
if (!Array.isArray(value)) {
|
|
8703
|
+
issues.push({ path, message: "must be a list of repository-relative paths" });
|
|
8704
|
+
return;
|
|
8705
|
+
}
|
|
8706
|
+
value.forEach((entry, index) => {
|
|
8707
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
8708
|
+
issues.push({ path: [...path, index], message: "must be a non-empty repository-relative path" });
|
|
8709
|
+
return;
|
|
8710
|
+
}
|
|
8711
|
+
const reason = outsideRepositoryReason(entry);
|
|
8712
|
+
if (reason)
|
|
8713
|
+
issues.push({ path: [...path, index], message: reason });
|
|
8714
|
+
});
|
|
8715
|
+
}
|
|
8716
|
+
function scopeListIssues(value, path, allowed, issues) {
|
|
8717
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
8718
|
+
issues.push({ path, message: "must name at least one scope" });
|
|
8719
|
+
return null;
|
|
8720
|
+
}
|
|
8721
|
+
const scopes = [];
|
|
8722
|
+
value.forEach((scope, index) => {
|
|
8723
|
+
if (typeof scope !== "string" || !CONFIGURABLE_PROSE_SCOPES.includes(scope)) {
|
|
8724
|
+
issues.push({
|
|
8725
|
+
path: [...path, index],
|
|
8726
|
+
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(", ")}`
|
|
8727
|
+
});
|
|
8728
|
+
return;
|
|
8729
|
+
}
|
|
8730
|
+
if (!allowed.includes(scope)) {
|
|
8731
|
+
issues.push({
|
|
8732
|
+
path: [...path, index],
|
|
8733
|
+
message: `scope "${scope}" is not one this rule can run in — it can run in: ${allowed.join(", ")}`
|
|
8734
|
+
});
|
|
8735
|
+
return;
|
|
8736
|
+
}
|
|
8737
|
+
scopes.push(scope);
|
|
8738
|
+
});
|
|
8739
|
+
return scopes;
|
|
8740
|
+
}
|
|
8741
|
+
function severityIssues(value, path, scopes, issues) {
|
|
8742
|
+
if (typeof value === "string") {
|
|
8743
|
+
if (!SEVERITIES.includes(value)) {
|
|
8744
|
+
issues.push({ path, message: `unknown severity ${JSON.stringify(value)} — use "error" or "warning"` });
|
|
8745
|
+
}
|
|
8746
|
+
return;
|
|
8747
|
+
}
|
|
8748
|
+
if (!isPlainObject3(value)) {
|
|
8749
|
+
issues.push({ path, message: 'must be "error", "warning", or a map from scope to one of them' });
|
|
8750
|
+
return;
|
|
8751
|
+
}
|
|
8752
|
+
for (const [scope, severity] of Object.entries(value)) {
|
|
8753
|
+
if (!scopes.includes(scope)) {
|
|
8754
|
+
issues.push({ path: [...path, scope], message: `names scope "${scope}", which this rule's scopes do not cover` });
|
|
8755
|
+
}
|
|
8756
|
+
if (typeof severity !== "string" || !SEVERITIES.includes(severity)) {
|
|
8757
|
+
issues.push({
|
|
8758
|
+
path: [...path, scope],
|
|
8759
|
+
message: `unknown severity ${JSON.stringify(severity)} — use "error" or "warning"`
|
|
8760
|
+
});
|
|
8761
|
+
}
|
|
8762
|
+
}
|
|
8763
|
+
}
|
|
8764
|
+
function patternIssues(source, flags, path, issues) {
|
|
8765
|
+
if (typeof source !== "string" || source.length === 0) {
|
|
8766
|
+
issues.push({ path, message: "must be a non-empty regular expression" });
|
|
8767
|
+
return;
|
|
8768
|
+
}
|
|
8769
|
+
if (source.length > CONFIGURED_PATTERN_MAX_LENGTH) {
|
|
8770
|
+
issues.push({
|
|
8771
|
+
path,
|
|
8772
|
+
message: `is ${source.length} characters, over the ${CONFIGURED_PATTERN_MAX_LENGTH}-character limit for a configured pattern`
|
|
8773
|
+
});
|
|
8774
|
+
return;
|
|
8775
|
+
}
|
|
8776
|
+
try {
|
|
8777
|
+
new RegExp(source, flags);
|
|
8778
|
+
} catch (err) {
|
|
8779
|
+
issues.push({ path, message: `does not compile: ${err.message}` });
|
|
8780
|
+
return;
|
|
8781
|
+
}
|
|
8782
|
+
if (!safeRegex(source, { limit: Number.MAX_SAFE_INTEGER })) {
|
|
8783
|
+
issues.push({
|
|
8784
|
+
path,
|
|
8785
|
+
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."
|
|
8786
|
+
});
|
|
8787
|
+
}
|
|
8788
|
+
}
|
|
8789
|
+
function flagIssues(value, path, issues) {
|
|
8790
|
+
if (value === undefined)
|
|
8791
|
+
return "";
|
|
8792
|
+
if (typeof value !== "string") {
|
|
8793
|
+
issues.push({ path, message: 'must be a string of flags, e.g. "i"' });
|
|
8794
|
+
return "";
|
|
8795
|
+
}
|
|
8796
|
+
const seen = new Set;
|
|
8797
|
+
for (const flag of value) {
|
|
8798
|
+
if (!CONFIGURED_PROSE_FLAGS.includes(flag)) {
|
|
8799
|
+
issues.push({
|
|
8800
|
+
path,
|
|
8801
|
+
message: `unknown flag ${JSON.stringify(flag)} — only ${CONFIGURED_PROSE_FLAGS.map((f) => `"${f}"`).join(" and ")} are allowed`
|
|
8802
|
+
});
|
|
8803
|
+
return "";
|
|
8804
|
+
}
|
|
8805
|
+
if (seen.has(flag)) {
|
|
8806
|
+
issues.push({ path, message: `repeats the flag "${flag}"` });
|
|
8807
|
+
return "";
|
|
8808
|
+
}
|
|
8809
|
+
seen.add(flag);
|
|
8810
|
+
}
|
|
8811
|
+
return value;
|
|
8812
|
+
}
|
|
8813
|
+
function defaultsIssues(value, issues) {
|
|
8814
|
+
const base = ["defaults"];
|
|
8815
|
+
if (!isPlainObject3(value)) {
|
|
8816
|
+
issues.push({ path: base, message: 'must map a default rule id to "off" or an override' });
|
|
8817
|
+
return;
|
|
8818
|
+
}
|
|
8819
|
+
for (const [id, override] of Object.entries(value)) {
|
|
8820
|
+
const path = [...base, id];
|
|
8821
|
+
const rule = CONFIGURABLE_DEFAULT_RULES.find((candidate) => candidate.id === id);
|
|
8822
|
+
if (!rule) {
|
|
8823
|
+
issues.push({
|
|
8824
|
+
path,
|
|
8825
|
+
message: `unknown default rule id "${id}" — \`vinaya check --plan\` lists the rules each prose check runs`
|
|
8826
|
+
});
|
|
8827
|
+
continue;
|
|
8828
|
+
}
|
|
8829
|
+
if (override === "off")
|
|
8830
|
+
continue;
|
|
8831
|
+
if (!isPlainObject3(override)) {
|
|
8832
|
+
issues.push({ path, message: 'must be "off" or an object with any of scopes, severity, exempt' });
|
|
8833
|
+
continue;
|
|
8834
|
+
}
|
|
8835
|
+
for (const key of Object.keys(override)) {
|
|
8836
|
+
if (OVERRIDE_KEYS.includes(key))
|
|
8837
|
+
continue;
|
|
8838
|
+
issues.push({
|
|
8839
|
+
path: [...path, key],
|
|
8840
|
+
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`
|
|
8841
|
+
});
|
|
8842
|
+
}
|
|
8843
|
+
const scopes = override.scopes === undefined ? [...rule.scopes] : scopeListIssues(override.scopes, [...path, "scopes"], allowedScopesFor(rule), issues);
|
|
8844
|
+
if (override.severity !== undefined && scopes)
|
|
8845
|
+
severityIssues(override.severity, [...path, "severity"], scopes, issues);
|
|
8846
|
+
if (override.exempt !== undefined)
|
|
8847
|
+
pathListIssues(override.exempt, [...path, "exempt"], issues);
|
|
8848
|
+
}
|
|
8849
|
+
}
|
|
8850
|
+
function customIssues(value, issues) {
|
|
8851
|
+
if (!Array.isArray(value)) {
|
|
8852
|
+
issues.push({ path: ["custom"], message: "must be a list of rules" });
|
|
8853
|
+
return;
|
|
8854
|
+
}
|
|
8855
|
+
const ids = new Set;
|
|
8856
|
+
value.forEach((rule, index) => {
|
|
8857
|
+
const path = ["custom", index];
|
|
8858
|
+
if (!isPlainObject3(rule)) {
|
|
8859
|
+
issues.push({ path, message: "must be a rule object" });
|
|
8860
|
+
return;
|
|
8861
|
+
}
|
|
8862
|
+
for (const key of Object.keys(rule)) {
|
|
8863
|
+
if (!CUSTOM_KEYS.includes(key)) {
|
|
8864
|
+
issues.push({ path: [...path, key], message: `unknown key "${key}" — a rule takes ${CUSTOM_KEYS.join(", ")}` });
|
|
8865
|
+
}
|
|
8866
|
+
}
|
|
8867
|
+
if (typeof rule.id !== "string" || rule.id.length === 0) {
|
|
8868
|
+
issues.push({ path: [...path, "id"], message: "a custom rule needs an id" });
|
|
8869
|
+
} else if (DEFAULT_IDS.has(rule.id)) {
|
|
8870
|
+
issues.push({
|
|
8871
|
+
path: [...path, "id"],
|
|
8872
|
+
message: `"${rule.id}" is a default rule id — a custom rule needs its own id; retune the default under proseGates.rules.defaults instead`
|
|
8873
|
+
});
|
|
8874
|
+
} else if (ids.has(rule.id)) {
|
|
8875
|
+
issues.push({ path: [...path, "id"], message: `"${rule.id}" is used by an earlier custom rule` });
|
|
8876
|
+
} else {
|
|
8877
|
+
ids.add(rule.id);
|
|
8878
|
+
}
|
|
8879
|
+
if (typeof rule.means !== "string" || rule.means.trim().length === 0) {
|
|
8880
|
+
issues.push({ path: [...path, "means"], message: "a custom rule needs a message (`means`)" });
|
|
8881
|
+
}
|
|
8882
|
+
let scopes = null;
|
|
8883
|
+
if (rule.scopes === undefined) {
|
|
8884
|
+
issues.push({ path: [...path, "scopes"], message: "a custom rule needs at least one scope (`scopes`)" });
|
|
8885
|
+
} else {
|
|
8886
|
+
scopes = scopeListIssues(rule.scopes, [...path, "scopes"], CONFIGURABLE_PROSE_SCOPES, issues);
|
|
8887
|
+
}
|
|
8888
|
+
if (scopes && new Set(scopes.map(groupOfScope)).size > 1) {
|
|
8889
|
+
issues.push({
|
|
8890
|
+
path: [...path, "scopes"],
|
|
8891
|
+
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'
|
|
8892
|
+
});
|
|
8893
|
+
}
|
|
8894
|
+
const flags = flagIssues(rule.flags, [...path, "flags"], issues);
|
|
8895
|
+
if (rule.pattern === undefined && rule.patterns === undefined) {
|
|
8896
|
+
issues.push({
|
|
8897
|
+
path: [...path, "pattern"],
|
|
8898
|
+
message: "a custom rule needs a `pattern` or a per-scope `patterns` map"
|
|
8899
|
+
});
|
|
8900
|
+
}
|
|
8901
|
+
if (rule.pattern !== undefined)
|
|
8902
|
+
patternIssues(rule.pattern, flags, [...path, "pattern"], issues);
|
|
8903
|
+
if (rule.patterns !== undefined) {
|
|
8904
|
+
if (!isPlainObject3(rule.patterns)) {
|
|
8905
|
+
issues.push({ path: [...path, "patterns"], message: "must map a scope to a regular expression" });
|
|
8906
|
+
} else {
|
|
8907
|
+
for (const [scope, source] of Object.entries(rule.patterns)) {
|
|
8908
|
+
if (scopes && !scopes.includes(scope)) {
|
|
8909
|
+
issues.push({
|
|
8910
|
+
path: [...path, "patterns", scope],
|
|
8911
|
+
message: `names scope "${scope}", which this rule's scopes do not cover`
|
|
8912
|
+
});
|
|
8913
|
+
continue;
|
|
8914
|
+
}
|
|
8915
|
+
patternIssues(source, flags, [...path, "patterns", scope], issues);
|
|
8916
|
+
}
|
|
8917
|
+
if (rule.pattern === undefined && scopes) {
|
|
8918
|
+
for (const scope of scopes) {
|
|
8919
|
+
if (!(scope in rule.patterns)) {
|
|
8920
|
+
issues.push({
|
|
8921
|
+
path: [...path, "patterns"],
|
|
8922
|
+
message: `has no pattern for scope "${scope}" — add one, or a \`pattern\` every other scope uses`
|
|
8923
|
+
});
|
|
8924
|
+
}
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
}
|
|
8928
|
+
}
|
|
8929
|
+
if (rule.severity !== undefined && scopes)
|
|
8930
|
+
severityIssues(rule.severity, [...path, "severity"], scopes, issues);
|
|
8931
|
+
if (rule.exempt !== undefined)
|
|
8932
|
+
pathListIssues(rule.exempt, [...path, "exempt"], issues);
|
|
8933
|
+
});
|
|
8934
|
+
}
|
|
8935
|
+
function proseRulesIssues(value) {
|
|
8936
|
+
const issues = [];
|
|
8937
|
+
if (!isPlainObject3(value))
|
|
8938
|
+
return [{ path: [], message: "must be an object with any of exempt, defaults, custom" }];
|
|
8939
|
+
for (const key of Object.keys(value)) {
|
|
8940
|
+
if (!["exempt", "defaults", "custom"].includes(key)) {
|
|
8941
|
+
issues.push({ path: [key], message: `unknown key "${key}" — proseGates.rules takes exempt, defaults and custom` });
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8944
|
+
if (value.exempt !== undefined)
|
|
8945
|
+
pathListIssues(value.exempt, ["exempt"], issues);
|
|
8946
|
+
if (value.defaults !== undefined)
|
|
8947
|
+
defaultsIssues(value.defaults, issues);
|
|
8948
|
+
if (value.custom !== undefined)
|
|
8949
|
+
customIssues(value.custom, issues);
|
|
8950
|
+
return issues;
|
|
8951
|
+
}
|
|
8952
|
+
var ProseRulesSchema = z6.unknown().superRefine((value, ctx) => {
|
|
8953
|
+
for (const issue of proseRulesIssues(value)) {
|
|
8954
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, path: issue.path, message: issue.message });
|
|
8955
|
+
}
|
|
8956
|
+
}).transform((value) => value);
|
|
8957
|
+
var PublishedProseSchema = z6.object({
|
|
8958
|
+
allow: z6.array(z6.string().min(1)).optional()
|
|
8959
|
+
}).strict();
|
|
8960
|
+
|
|
7734
8961
|
// src/lib/config.ts
|
|
7735
|
-
var EnvEntrySchema =
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
8962
|
+
var EnvEntrySchema = z7.union([
|
|
8963
|
+
z7.literal(true),
|
|
8964
|
+
z7.object({ optional: z7.literal(true) }),
|
|
8965
|
+
z7.object({ anyOf: z7.array(z7.string()).min(2) }),
|
|
8966
|
+
z7.string()
|
|
7740
8967
|
]);
|
|
7741
|
-
var CheckEntrySchema =
|
|
7742
|
-
run:
|
|
7743
|
-
scope:
|
|
7744
|
-
include:
|
|
7745
|
-
args:
|
|
7746
|
-
timeoutMs:
|
|
7747
|
-
env:
|
|
7748
|
-
requiresOpenPr:
|
|
7749
|
-
ownWorkflow:
|
|
7750
|
-
principalOwed:
|
|
7751
|
-
validates:
|
|
8968
|
+
var CheckEntrySchema = z7.object({
|
|
8969
|
+
run: z7.string(),
|
|
8970
|
+
scope: z7.enum(["diff", "full"]),
|
|
8971
|
+
include: z7.array(z7.string()).optional(),
|
|
8972
|
+
args: z7.array(z7.string()).optional(),
|
|
8973
|
+
timeoutMs: z7.number().optional(),
|
|
8974
|
+
env: z7.record(z7.string(), EnvEntrySchema).optional(),
|
|
8975
|
+
requiresOpenPr: z7.boolean().optional(),
|
|
8976
|
+
ownWorkflow: z7.boolean().optional(),
|
|
8977
|
+
principalOwed: z7.literal(true).optional(),
|
|
8978
|
+
validates: z7.enum(["body", "issue"]).optional(),
|
|
8979
|
+
advisory: z7.literal(true).optional()
|
|
7752
8980
|
}).superRefine((entry, ctx) => {
|
|
7753
8981
|
if (!entry.env)
|
|
7754
8982
|
return;
|
|
@@ -7758,22 +8986,22 @@ var CheckEntrySchema = z6.object({
|
|
|
7758
8986
|
const members = value.anyOf;
|
|
7759
8987
|
if (new Set(members).size !== members.length) {
|
|
7760
8988
|
ctx.addIssue({
|
|
7761
|
-
code:
|
|
8989
|
+
code: z7.ZodIssueCode.custom,
|
|
7762
8990
|
message: `env.${key}.anyOf has duplicate members`,
|
|
7763
8991
|
path: ["env", key, "anyOf"]
|
|
7764
8992
|
});
|
|
7765
8993
|
}
|
|
7766
8994
|
if (!members.includes(key)) {
|
|
7767
8995
|
ctx.addIssue({
|
|
7768
|
-
code:
|
|
8996
|
+
code: z7.ZodIssueCode.custom,
|
|
7769
8997
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
7770
8998
|
path: ["env", key, "anyOf"]
|
|
7771
8999
|
});
|
|
7772
9000
|
}
|
|
7773
9001
|
}
|
|
7774
9002
|
});
|
|
7775
|
-
var RoleEntrySchema =
|
|
7776
|
-
contract:
|
|
9003
|
+
var RoleEntrySchema = z7.object({
|
|
9004
|
+
contract: z7.string().refine((p) => p.includes("/"), {
|
|
7777
9005
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
7778
9006
|
})
|
|
7779
9007
|
});
|
|
@@ -7797,17 +9025,17 @@ var BRIEF_BUILTINS = [
|
|
|
7797
9025
|
"briefSections",
|
|
7798
9026
|
"milestoneShape"
|
|
7799
9027
|
];
|
|
7800
|
-
var BriefSectionSchema =
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
9028
|
+
var BriefSectionSchema = z7.union([
|
|
9029
|
+
z7.object({ builtin: z7.enum(BRIEF_BUILTINS) }),
|
|
9030
|
+
z7.object({ heading: z7.string().min(1), name: z7.string().optional() }),
|
|
9031
|
+
z7.object({ field: z7.string().min(1), name: z7.string().optional() }),
|
|
9032
|
+
z7.object({ phrase: z7.string().min(1), name: z7.string().optional() })
|
|
7805
9033
|
]);
|
|
7806
|
-
var BriefSchemaSchema =
|
|
7807
|
-
pr:
|
|
7808
|
-
issue:
|
|
7809
|
-
milestone:
|
|
7810
|
-
ack:
|
|
9034
|
+
var BriefSchemaSchema = z7.object({
|
|
9035
|
+
pr: z7.object({ sections: z7.array(BriefSectionSchema) }).optional(),
|
|
9036
|
+
issue: z7.object({ sections: z7.array(BriefSectionSchema) }).optional(),
|
|
9037
|
+
milestone: z7.object({ sections: z7.array(BriefSectionSchema) }).optional(),
|
|
9038
|
+
ack: z7.array(z7.enum(BRIEF_BUILTINS)).optional()
|
|
7811
9039
|
});
|
|
7812
9040
|
function isSafeRepoRelPath(p) {
|
|
7813
9041
|
if (p.length === 0)
|
|
@@ -7816,7 +9044,7 @@ function isSafeRepoRelPath(p) {
|
|
|
7816
9044
|
return false;
|
|
7817
9045
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
7818
9046
|
}
|
|
7819
|
-
var SafeRepoRelPath =
|
|
9047
|
+
var SafeRepoRelPath = z7.string().refine(isSafeRepoRelPath, {
|
|
7820
9048
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
7821
9049
|
});
|
|
7822
9050
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -7826,22 +9054,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
7826
9054
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
7827
9055
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
7828
9056
|
});
|
|
7829
|
-
var ManagedBlockRecordSchema =
|
|
9057
|
+
var ManagedBlockRecordSchema = z7.object({
|
|
7830
9058
|
path: ManagedHookBlockPath,
|
|
7831
|
-
marker:
|
|
7832
|
-
comment:
|
|
9059
|
+
marker: z7.string(),
|
|
9060
|
+
comment: z7.enum(["hash", "html"])
|
|
7833
9061
|
});
|
|
7834
|
-
var ManagedManifestSchema =
|
|
7835
|
-
version:
|
|
7836
|
-
files:
|
|
7837
|
-
blocks:
|
|
7838
|
-
labels:
|
|
7839
|
-
agents:
|
|
9062
|
+
var ManagedManifestSchema = z7.object({
|
|
9063
|
+
version: z7.number().int().positive(),
|
|
9064
|
+
files: z7.array(SafeRepoRelPath),
|
|
9065
|
+
blocks: z7.array(ManagedBlockRecordSchema),
|
|
9066
|
+
labels: z7.array(z7.string()),
|
|
9067
|
+
agents: z7.array(z7.enum(AGENT_VENDORS)).optional()
|
|
7840
9068
|
});
|
|
7841
|
-
var ProjectEntrySchema =
|
|
7842
|
-
name:
|
|
7843
|
-
description:
|
|
7844
|
-
path:
|
|
9069
|
+
var ProjectEntrySchema = z7.object({
|
|
9070
|
+
name: z7.string().min(1),
|
|
9071
|
+
description: z7.string().min(1).optional(),
|
|
9072
|
+
path: z7.string().min(1).optional()
|
|
7845
9073
|
});
|
|
7846
9074
|
function parseTokensCollectDeclaration(value) {
|
|
7847
9075
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -7852,90 +9080,90 @@ function parseTokensCollectDeclaration(value) {
|
|
|
7852
9080
|
return null;
|
|
7853
9081
|
return { interpreter, script };
|
|
7854
9082
|
}
|
|
7855
|
-
var
|
|
7856
|
-
rings:
|
|
7857
|
-
ring1_forgeWriteInterception:
|
|
7858
|
-
ring2_asyncAudits:
|
|
9083
|
+
var VinayaConfigObjectSchema = z7.object({
|
|
9084
|
+
rings: z7.object({
|
|
9085
|
+
ring1_forgeWriteInterception: z7.boolean(),
|
|
9086
|
+
ring2_asyncAudits: z7.boolean()
|
|
7859
9087
|
}).optional(),
|
|
7860
|
-
checks:
|
|
7861
|
-
roles:
|
|
9088
|
+
checks: z7.record(z7.string(), CheckEntrySchema).optional(),
|
|
9089
|
+
roles: z7.record(z7.string(), RoleEntrySchema).optional(),
|
|
7862
9090
|
briefSchema: BriefSchemaSchema.optional(),
|
|
7863
9091
|
managed: ManagedManifestSchema.optional(),
|
|
7864
|
-
principals:
|
|
7865
|
-
releaseActor:
|
|
7866
|
-
ci:
|
|
7867
|
-
tokens:
|
|
7868
|
-
collect:
|
|
9092
|
+
principals: z7.array(z7.string()).min(1).optional(),
|
|
9093
|
+
releaseActor: z7.string().min(1).optional(),
|
|
9094
|
+
ci: z7.object({ setup: z7.string().min(1) }).optional(),
|
|
9095
|
+
tokens: z7.object({
|
|
9096
|
+
collect: z7.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
7869
9097
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
7870
9098
|
})
|
|
7871
9099
|
}).optional(),
|
|
7872
|
-
blastRadius:
|
|
7873
|
-
proseGates:
|
|
7874
|
-
doctrineRoot:
|
|
7875
|
-
readerFacingPrefix:
|
|
7876
|
-
readerFacingSuffix:
|
|
7877
|
-
legacySlugDir:
|
|
7878
|
-
sourceComments:
|
|
7879
|
-
globs:
|
|
7880
|
-
allowlist:
|
|
7881
|
-
severity:
|
|
9100
|
+
blastRadius: z7.object({ extraDomains: z7.array(z7.string()).optional() }).optional(),
|
|
9101
|
+
proseGates: z7.object({
|
|
9102
|
+
doctrineRoot: z7.string().min(1).optional(),
|
|
9103
|
+
readerFacingPrefix: z7.string().min(1).optional(),
|
|
9104
|
+
readerFacingSuffix: z7.string().min(1).optional(),
|
|
9105
|
+
legacySlugDir: z7.string().min(1).optional(),
|
|
9106
|
+
sourceComments: z7.object({
|
|
9107
|
+
globs: z7.array(z7.string().min(1)).optional(),
|
|
9108
|
+
allowlist: z7.array(z7.string().min(1)).optional(),
|
|
9109
|
+
severity: z7.enum(["warning", "error"]).optional()
|
|
7882
9110
|
}).optional(),
|
|
7883
|
-
specGrandfather:
|
|
7884
|
-
specPaths:
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
})).optional()
|
|
9111
|
+
specGrandfather: z7.union([z7.array(z7.string().min(1)), z7.record(z7.string().min(1), z7.number().int().min(0))]).optional(),
|
|
9112
|
+
specPaths: z7.array(RepoRelativePathSchema).optional(),
|
|
9113
|
+
productPaths: z7.array(RepoRelativePathSchema).optional(),
|
|
9114
|
+
published: PublishedProseSchema.optional(),
|
|
9115
|
+
rules: ProseRulesSchema.optional()
|
|
7889
9116
|
}).optional(),
|
|
7890
|
-
projects:
|
|
7891
|
-
dispatch:
|
|
7892
|
-
timeoutMs:
|
|
7893
|
-
|
|
7894
|
-
|
|
9117
|
+
projects: z7.array(ProjectEntrySchema).optional(),
|
|
9118
|
+
dispatch: z7.object({
|
|
9119
|
+
timeoutMs: z7.number().int().positive().optional(),
|
|
9120
|
+
reviewerTimeoutMs: z7.number().int().positive().optional(),
|
|
9121
|
+
killGraceMs: z7.number().int().positive().optional(),
|
|
9122
|
+
agent: z7.enum(["claude", "codex"]).optional()
|
|
7895
9123
|
}).optional(),
|
|
7896
|
-
reviewPolicy:
|
|
7897
|
-
codeReviewThreshold:
|
|
7898
|
-
securityThreshold:
|
|
7899
|
-
maxRounds:
|
|
7900
|
-
maxTaskMinutes:
|
|
9124
|
+
reviewPolicy: z7.object({
|
|
9125
|
+
codeReviewThreshold: z7.string().min(1).optional(),
|
|
9126
|
+
securityThreshold: z7.string().min(1).optional(),
|
|
9127
|
+
maxRounds: z7.number().optional(),
|
|
9128
|
+
maxTaskMinutes: z7.number().optional()
|
|
7901
9129
|
}).optional(),
|
|
7902
|
-
securityScan:
|
|
7903
|
-
command:
|
|
9130
|
+
securityScan: z7.object({
|
|
9131
|
+
command: z7.array(z7.string().min(1)).min(1)
|
|
7904
9132
|
}).optional(),
|
|
7905
|
-
gateCutovers:
|
|
7906
|
-
objectivesSinceIssue:
|
|
7907
|
-
briefSectionsSinceIssue:
|
|
7908
|
-
documentationSinceIssue:
|
|
7909
|
-
briefRulesSincePr:
|
|
7910
|
-
agentBoxesRefusedSincePr:
|
|
9133
|
+
gateCutovers: z7.object({
|
|
9134
|
+
objectivesSinceIssue: z7.number().int().nonnegative().optional(),
|
|
9135
|
+
briefSectionsSinceIssue: z7.number().int().nonnegative().optional(),
|
|
9136
|
+
documentationSinceIssue: z7.number().int().nonnegative().optional(),
|
|
9137
|
+
briefRulesSincePr: z7.number().int().nonnegative().optional(),
|
|
9138
|
+
agentBoxesRefusedSincePr: z7.number().int().nonnegative().optional()
|
|
7911
9139
|
}).optional(),
|
|
7912
|
-
planning:
|
|
7913
|
-
collisionThreshold:
|
|
9140
|
+
planning: z7.object({
|
|
9141
|
+
collisionThreshold: z7.number().int().nonnegative().optional()
|
|
7914
9142
|
}).optional(),
|
|
7915
|
-
prePush:
|
|
7916
|
-
alwaysRun:
|
|
9143
|
+
prePush: z7.object({
|
|
9144
|
+
alwaysRun: z7.array(z7.string()).optional()
|
|
7917
9145
|
}).optional(),
|
|
7918
|
-
report:
|
|
7919
|
-
commandTimeoutMs:
|
|
9146
|
+
report: z7.object({
|
|
9147
|
+
commandTimeoutMs: z7.number().int().positive().optional()
|
|
7920
9148
|
}).superRefine((report, ctx) => {
|
|
7921
9149
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
7922
9150
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
7923
9151
|
ctx.addIssue({
|
|
7924
|
-
code:
|
|
9152
|
+
code: z7.ZodIssueCode.custom,
|
|
7925
9153
|
path: ["commandTimeoutMs"],
|
|
7926
9154
|
message: "must be at most 3600000 (1 hour)"
|
|
7927
9155
|
});
|
|
7928
9156
|
}
|
|
7929
9157
|
}).optional(),
|
|
7930
|
-
logPublish:
|
|
9158
|
+
logPublish: z7.unknown().refine((v) => v === undefined, {
|
|
7931
9159
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
7932
9160
|
}),
|
|
7933
|
-
runtimeDir:
|
|
7934
|
-
logs:
|
|
7935
|
-
folder:
|
|
7936
|
-
url:
|
|
7937
|
-
headers:
|
|
7938
|
-
readHeaders:
|
|
9161
|
+
runtimeDir: z7.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
9162
|
+
logs: z7.object({
|
|
9163
|
+
folder: z7.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
9164
|
+
url: z7.string().url().optional(),
|
|
9165
|
+
headers: z7.record(z7.string()).optional(),
|
|
9166
|
+
readHeaders: z7.record(z7.string()).optional(),
|
|
7939
9167
|
events: CustomEventDeclarationsSchema.optional()
|
|
7940
9168
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
7941
9169
|
message: "logs: set at most one of folder/url"
|
|
@@ -7943,8 +9171,33 @@ var VinayaConfigSchema = z6.object({
|
|
|
7943
9171
|
message: "logs: headers requires url"
|
|
7944
9172
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
7945
9173
|
message: "logs: readHeaders requires url"
|
|
7946
|
-
}).optional()
|
|
9174
|
+
}).optional(),
|
|
9175
|
+
decisionRecords: z7.object({
|
|
9176
|
+
path: RepoRelativePathSchema
|
|
9177
|
+
}).strict().optional()
|
|
7947
9178
|
});
|
|
9179
|
+
function decisionRecordsPathIssue(path, doctrineRoot) {
|
|
9180
|
+
const reason = outsideRepositoryReason(path);
|
|
9181
|
+
if (reason)
|
|
9182
|
+
return reason;
|
|
9183
|
+
const folder = normalizeSpecPath(path);
|
|
9184
|
+
if (folder === "" || folder === ".")
|
|
9185
|
+
return "must name a folder, not the repository root";
|
|
9186
|
+
const root = normalizeSpecPath(doctrineRoot ?? "aeg-root");
|
|
9187
|
+
if (folder === root || folder.startsWith(`${root}/`)) {
|
|
9188
|
+
return `must be outside the doctrine tree "${root}" — decision records belong to this repository, not to the doctrine it ships`;
|
|
9189
|
+
}
|
|
9190
|
+
return null;
|
|
9191
|
+
}
|
|
9192
|
+
var VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
|
|
9193
|
+
const path = config.decisionRecords?.path;
|
|
9194
|
+
if (path === undefined || outsideRepositoryReason(path))
|
|
9195
|
+
return;
|
|
9196
|
+
const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
|
|
9197
|
+
if (issue)
|
|
9198
|
+
ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
|
|
9199
|
+
});
|
|
9200
|
+
var VinayaConfigShape = VinayaConfigObjectSchema.shape;
|
|
7948
9201
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
7949
9202
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
7950
9203
|
var LOCAL_CONFIG_FILENAME = "vinaya.config.json";
|
|
@@ -8025,9 +9278,6 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
8025
9278
|
}
|
|
8026
9279
|
return result;
|
|
8027
9280
|
}
|
|
8028
|
-
function resolvePrincipalAllowlist(config) {
|
|
8029
|
-
return config?.principals ?? PRINCIPAL_ALLOWLIST;
|
|
8030
|
-
}
|
|
8031
9281
|
function resolveReleaseActor(config) {
|
|
8032
9282
|
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
8033
9283
|
}
|
|
@@ -8163,13 +9413,14 @@ function readTrustAnchorConfigAtRef(ref) {
|
|
|
8163
9413
|
});
|
|
8164
9414
|
return Buffer.from(raw, "utf-8").toString("base64");
|
|
8165
9415
|
}
|
|
9416
|
+
var NO_TRUST_ANCHOR_REPO_MESSAGE = "could not resolve repo identity for the trust-anchor read";
|
|
8166
9417
|
function ghFetchTrustAnchorConfig() {
|
|
8167
9418
|
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
8168
9419
|
if (probeRef)
|
|
8169
9420
|
return readTrustAnchorConfigAtRef(probeRef);
|
|
8170
9421
|
const repo = trustAnchorRepo();
|
|
8171
9422
|
if (!repo)
|
|
8172
|
-
throw new Error(
|
|
9423
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
8173
9424
|
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
8174
9425
|
encoding: "utf-8",
|
|
8175
9426
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -8186,7 +9437,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
8186
9437
|
}
|
|
8187
9438
|
const repo = await trustAnchorRepoAsync();
|
|
8188
9439
|
if (!repo)
|
|
8189
|
-
throw new Error(
|
|
9440
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
8190
9441
|
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
8191
9442
|
return stdout;
|
|
8192
9443
|
}
|
|
@@ -8212,6 +9463,47 @@ function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
|
8212
9463
|
}
|
|
8213
9464
|
return parseTrustAnchorContent(base64);
|
|
8214
9465
|
}
|
|
9466
|
+
class PrincipalsUnresolvedError extends Error {
|
|
9467
|
+
kind;
|
|
9468
|
+
constructor(kind, message) {
|
|
9469
|
+
super(message);
|
|
9470
|
+
this.name = "PrincipalsUnresolvedError";
|
|
9471
|
+
this.kind = kind;
|
|
9472
|
+
}
|
|
9473
|
+
}
|
|
9474
|
+
var PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch';
|
|
9475
|
+
function fetchFailureReason(err) {
|
|
9476
|
+
const stderr = err?.stderr;
|
|
9477
|
+
const text = (typeof stderr === "string" ? stderr : stderr?.toString() ?? "").trim();
|
|
9478
|
+
return text.split(`
|
|
9479
|
+
`)[0]?.trim() || firstLine(err);
|
|
9480
|
+
}
|
|
9481
|
+
function principalsNotConfigured(why) {
|
|
9482
|
+
return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
|
|
9483
|
+
}
|
|
9484
|
+
function resolveTrustedPrincipals(fetcher = ghFetchTrustAnchorConfig) {
|
|
9485
|
+
let content;
|
|
9486
|
+
try {
|
|
9487
|
+
content = fetcher();
|
|
9488
|
+
} catch (err) {
|
|
9489
|
+
if (err?.message === NO_TRUST_ANCHOR_REPO_MESSAGE) {
|
|
9490
|
+
throw principalsNotConfigured("no repository resolves for the read");
|
|
9491
|
+
}
|
|
9492
|
+
if (isMissingFileError(err))
|
|
9493
|
+
throw principalsNotConfigured("the default branch has no vinaya.config.json");
|
|
9494
|
+
throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`);
|
|
9495
|
+
}
|
|
9496
|
+
const unusable = { why: "" };
|
|
9497
|
+
const config = parseTrustAnchorContent(content, (why) => {
|
|
9498
|
+
unusable.why = why;
|
|
9499
|
+
});
|
|
9500
|
+
if (config === null) {
|
|
9501
|
+
throw principalsNotConfigured(`vinaya.config.json on the default branch ${unusable.why ? `is unusable: ${unusable.why}` : "is empty"}`);
|
|
9502
|
+
}
|
|
9503
|
+
if (!config.principals)
|
|
9504
|
+
throw principalsNotConfigured('vinaya.config.json on the default branch sets no "principals"');
|
|
9505
|
+
return config.principals;
|
|
9506
|
+
}
|
|
8215
9507
|
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
8216
9508
|
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
8217
9509
|
let base64;
|
|
@@ -8251,26 +9543,131 @@ function loadConfig() {
|
|
|
8251
9543
|
const path = configPath();
|
|
8252
9544
|
if (!path)
|
|
8253
9545
|
return null;
|
|
9546
|
+
let text;
|
|
8254
9547
|
try {
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
9548
|
+
text = readFileSync2(path, "utf-8");
|
|
9549
|
+
} catch (err) {
|
|
9550
|
+
reportInvalidConfigOnce(path, `unreadable: ${err.message}`);
|
|
8258
9551
|
return null;
|
|
8259
9552
|
}
|
|
9553
|
+
let raw;
|
|
9554
|
+
try {
|
|
9555
|
+
raw = JSON.parse(text);
|
|
9556
|
+
} catch (err) {
|
|
9557
|
+
reportInvalidConfigOnce(path, `invalid JSON: ${err.message}`);
|
|
9558
|
+
return null;
|
|
9559
|
+
}
|
|
9560
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
9561
|
+
if (!parsed.success) {
|
|
9562
|
+
reportInvalidConfigOnce(path, schemaIssueDetail(parsed.error));
|
|
9563
|
+
return null;
|
|
9564
|
+
}
|
|
9565
|
+
return stripGlobalOnlyKeys(parsed.data, path);
|
|
9566
|
+
}
|
|
9567
|
+
function schemaIssueDetail(error) {
|
|
9568
|
+
return error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ");
|
|
9569
|
+
}
|
|
9570
|
+
var emittedInvalidConfigReports = new Set;
|
|
9571
|
+
function reportInvalidConfigOnce(path, detail) {
|
|
9572
|
+
const key = `${path}
|
|
9573
|
+
${detail}`;
|
|
9574
|
+
if (emittedInvalidConfigReports.has(key))
|
|
9575
|
+
return;
|
|
9576
|
+
emittedInvalidConfigReports.add(key);
|
|
9577
|
+
const message = `${path} is not a valid Vinaya configuration (${detail}) — falling back to built-in defaults.`;
|
|
9578
|
+
const checkName = process.env.VINAYA_CHECK_NAME;
|
|
9579
|
+
if (checkName) {
|
|
9580
|
+
emitCheckError({
|
|
9581
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9582
|
+
check: checkName,
|
|
9583
|
+
severity: "warning",
|
|
9584
|
+
message,
|
|
9585
|
+
agent_recovery_prompt: `Fix the failing keys in ${path} (${detail}) so the file parses and satisfies the configuration schema, then re-run.`,
|
|
9586
|
+
file: path
|
|
9587
|
+
});
|
|
9588
|
+
return;
|
|
9589
|
+
}
|
|
9590
|
+
console.error(`⚠ ${message}`);
|
|
9591
|
+
}
|
|
9592
|
+
function loadConfigChecked() {
|
|
9593
|
+
const path = configPath();
|
|
9594
|
+
if (!path)
|
|
9595
|
+
return { ok: true, config: null };
|
|
9596
|
+
let raw;
|
|
9597
|
+
try {
|
|
9598
|
+
raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
9599
|
+
} catch (err) {
|
|
9600
|
+
return { ok: false, path, error: `invalid JSON: ${err.message}` };
|
|
9601
|
+
}
|
|
9602
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
9603
|
+
if (!parsed.success) {
|
|
9604
|
+
return { ok: false, path, error: schemaIssueDetail(parsed.error) };
|
|
9605
|
+
}
|
|
9606
|
+
return { ok: true, config: stripGlobalOnlyKeys(parsed.data, path) };
|
|
8260
9607
|
}
|
|
8261
9608
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
8262
9609
|
|
|
8263
9610
|
// src/checks/edge-resolve.ts
|
|
9611
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
9612
|
+
|
|
9613
|
+
// src/lib/github-rate-limit.ts
|
|
8264
9614
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
9615
|
+
var GITHUB_RATE_LIMIT_WORDING = /api rate limit (?:already )?exceeded|secondary rate limit|rate limit exceeded/i;
|
|
9616
|
+
var SECONDARY_RATE_LIMIT_WORDING = /secondary rate limit/i;
|
|
9617
|
+
function isGithubRateLimitError(text) {
|
|
9618
|
+
return GITHUB_RATE_LIMIT_WORDING.test(text);
|
|
9619
|
+
}
|
|
9620
|
+
function rateLimitBudget(errorText) {
|
|
9621
|
+
return errorText.trimStart().startsWith("GraphQL:") ? "GraphQL" : "REST";
|
|
9622
|
+
}
|
|
9623
|
+
var defaultReader = () => execFileSync3("gh", ["api", "rate_limit"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
9624
|
+
function readRateLimitReset(budget, read = defaultReader) {
|
|
9625
|
+
let parsed;
|
|
9626
|
+
try {
|
|
9627
|
+
parsed = JSON.parse(read());
|
|
9628
|
+
} catch {
|
|
9629
|
+
return null;
|
|
9630
|
+
}
|
|
9631
|
+
const resources = parsed.resources;
|
|
9632
|
+
const entry = resources?.[budget === "GraphQL" ? "graphql" : "core"];
|
|
9633
|
+
if (!entry || typeof entry.reset !== "number" || !Number.isFinite(entry.reset) || entry.reset <= 0)
|
|
9634
|
+
return null;
|
|
9635
|
+
if (typeof entry.remaining === "number" && entry.remaining > 0)
|
|
9636
|
+
return null;
|
|
9637
|
+
return entry.reset;
|
|
9638
|
+
}
|
|
9639
|
+
function formatResetUtc(epochSeconds) {
|
|
9640
|
+
const d = new Date(epochSeconds * 1000);
|
|
9641
|
+
const hh = String(d.getUTCHours()).padStart(2, "0");
|
|
9642
|
+
const mm = String(d.getUTCMinutes()).padStart(2, "0");
|
|
9643
|
+
return `${hh}:${mm} UTC`;
|
|
9644
|
+
}
|
|
9645
|
+
function rateLimitMessage(errorText, read = defaultReader) {
|
|
9646
|
+
const budget = rateLimitBudget(errorText);
|
|
9647
|
+
const reset = SECONDARY_RATE_LIMIT_WORDING.test(errorText) ? null : readRateLimitReset(budget, read);
|
|
9648
|
+
const when = reset === null ? "resets in a few minutes" : `resets at ${formatResetUtc(reset)}`;
|
|
9649
|
+
return `GitHub rate limit (${budget}), ${when}`;
|
|
9650
|
+
}
|
|
9651
|
+
function execErrorText(err) {
|
|
9652
|
+
const e = err;
|
|
9653
|
+
const stderr = e?.stderr === undefined || e.stderr === null ? "" : String(e.stderr);
|
|
9654
|
+
const message = typeof e?.message === "string" ? e.message : "";
|
|
9655
|
+
return stderr.trim() !== "" ? `${stderr}
|
|
9656
|
+
${message}` : message;
|
|
9657
|
+
}
|
|
9658
|
+
|
|
9659
|
+
// src/checks/edge-resolve.ts
|
|
8265
9660
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
8266
9661
|
var issueCache = new Map;
|
|
9662
|
+
var ISSUE_NOT_FOUND = /could not resolve to an issue/i;
|
|
8267
9663
|
function fetchIssueState(num, repo) {
|
|
8268
9664
|
const key = `${repo.owner}/${repo.repo}#${num}`;
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
9665
|
+
const cached = issueCache.get(key);
|
|
9666
|
+
if (cached)
|
|
9667
|
+
return cached;
|
|
9668
|
+
let out;
|
|
8272
9669
|
try {
|
|
8273
|
-
const raw =
|
|
9670
|
+
const raw = execFileSync4("gh", [
|
|
8274
9671
|
"issue",
|
|
8275
9672
|
"view",
|
|
8276
9673
|
String(num),
|
|
@@ -8279,9 +9676,9 @@ function fetchIssueState(num, repo) {
|
|
|
8279
9676
|
"--json",
|
|
8280
9677
|
"state,stateReason,closedByPullRequestsReferences"
|
|
8281
9678
|
], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
8282
|
-
out = JSON.parse(raw);
|
|
8283
|
-
} catch {
|
|
8284
|
-
out = null;
|
|
9679
|
+
out = { json: JSON.parse(raw), readFailed: false };
|
|
9680
|
+
} catch (err) {
|
|
9681
|
+
out = { json: null, readFailed: !ISSUE_NOT_FOUND.test(execErrorText(err)) };
|
|
8285
9682
|
}
|
|
8286
9683
|
issueCache.set(key, out);
|
|
8287
9684
|
return out;
|
|
@@ -8301,7 +9698,7 @@ var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
|
8301
9698
|
};
|
|
8302
9699
|
};
|
|
8303
9700
|
var siblingTrancheCache = new Map;
|
|
8304
|
-
function edgeFromIssueJson(num, json) {
|
|
9701
|
+
function edgeFromIssueJson(num, json, readFailed = false) {
|
|
8305
9702
|
if (json === null) {
|
|
8306
9703
|
return {
|
|
8307
9704
|
issue: num,
|
|
@@ -8310,7 +9707,8 @@ function edgeFromIssueJson(num, json) {
|
|
|
8310
9707
|
issueState: null,
|
|
8311
9708
|
stateReason: null,
|
|
8312
9709
|
closedByActor: null,
|
|
8313
|
-
resolved: true
|
|
9710
|
+
resolved: true,
|
|
9711
|
+
...readFailed ? { readFailed: true } : {}
|
|
8314
9712
|
};
|
|
8315
9713
|
}
|
|
8316
9714
|
const state = json.state === "CLOSED" ? "closed" : json.state === "OPEN" ? "open" : null;
|
|
@@ -8343,7 +9741,8 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
8343
9741
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
8344
9742
|
if (direct) {
|
|
8345
9743
|
const num = Number(direct[1]);
|
|
8346
|
-
|
|
9744
|
+
const read = fetchIssueState(num, repo);
|
|
9745
|
+
return edgeFromIssueJson(num, read.json, read.readFailed);
|
|
8347
9746
|
}
|
|
8348
9747
|
const qualified = splitSlugQualifiedEdge(id);
|
|
8349
9748
|
if (qualified) {
|
|
@@ -8377,12 +9776,49 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
8377
9776
|
resolved: false
|
|
8378
9777
|
};
|
|
8379
9778
|
}
|
|
9779
|
+
function dependsOnFactFromEdge(id, r) {
|
|
9780
|
+
return {
|
|
9781
|
+
id,
|
|
9782
|
+
issue: r.issue,
|
|
9783
|
+
merged: r.merged,
|
|
9784
|
+
resolved: r.resolved,
|
|
9785
|
+
issueState: r.issueState,
|
|
9786
|
+
stateReason: r.stateReason,
|
|
9787
|
+
closedByActor: r.closedByActor,
|
|
9788
|
+
...r.readFailed ? { readFailed: true } : {}
|
|
9789
|
+
};
|
|
9790
|
+
}
|
|
9791
|
+
|
|
9792
|
+
// src/checks/principals-refusal.ts
|
|
9793
|
+
function principalsUnresolvedCheckError(check, err, severity) {
|
|
9794
|
+
const recovery = err.kind === "not-configured" ? `This repository names no Principal, so nobody's verdict, waiver or Issue close can be trusted. Ask a Principal to ${PRINCIPALS_FIX} (a list of GitHub logins), then re-run \`vinaya check ${check}\`.` : severity === "error" ? `The Principal list could not be read from the forge, so this trust decision cannot be made. Confirm \`gh auth status\` passes (in CI, that the job's token is not empty) and the forge is reachable, then re-run \`vinaya check ${check}\`.` : `The Principal list could not be read from the forge, so the part of this check that needs it was not evaluated — the rest still ran. Confirm \`gh auth status\` passes and the forge is reachable, then re-run \`vinaya check ${check}\`.`;
|
|
9795
|
+
return {
|
|
9796
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9797
|
+
check,
|
|
9798
|
+
severity,
|
|
9799
|
+
message: `${check}: ${err.message}`,
|
|
9800
|
+
agent_recovery_prompt: recovery
|
|
9801
|
+
};
|
|
9802
|
+
}
|
|
9803
|
+
function refuseUnresolvedPrincipals(check, err) {
|
|
9804
|
+
if (!(err instanceof PrincipalsUnresolvedError))
|
|
9805
|
+
throw err;
|
|
9806
|
+
emitCheckError(principalsUnresolvedCheckError(check, err, "error"));
|
|
9807
|
+
process.exit(1);
|
|
9808
|
+
}
|
|
9809
|
+
function warnOnUnreadPrincipals(check, err) {
|
|
9810
|
+
if (err instanceof PrincipalsUnresolvedError && err.kind === "read-failed") {
|
|
9811
|
+
emitCheckError(principalsUnresolvedCheckError(check, err, "warning"));
|
|
9812
|
+
return;
|
|
9813
|
+
}
|
|
9814
|
+
refuseUnresolvedPrincipals(check, err);
|
|
9815
|
+
}
|
|
8380
9816
|
|
|
8381
9817
|
// src/checks/bin/check-first-push-dispatch.ts
|
|
8382
9818
|
var CHECK_NAME = "first-push-dispatch";
|
|
8383
9819
|
function git(args) {
|
|
8384
9820
|
try {
|
|
8385
|
-
return
|
|
9821
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
8386
9822
|
} catch {
|
|
8387
9823
|
return "";
|
|
8388
9824
|
}
|
|
@@ -8405,20 +9841,43 @@ function resolveRepo2() {
|
|
|
8405
9841
|
}
|
|
8406
9842
|
function prExistsFor(branch) {
|
|
8407
9843
|
try {
|
|
8408
|
-
const out =
|
|
9844
|
+
const out = execFileSync5("gh", ["pr", "list", "--head", branch, "--state", "all", "--json", "number", "--limit", "1"], {
|
|
8409
9845
|
encoding: "utf8",
|
|
8410
9846
|
stdio: ["ignore", "pipe", "ignore"]
|
|
8411
9847
|
});
|
|
8412
9848
|
const entries = JSON.parse(out);
|
|
8413
|
-
return entries.length > 0;
|
|
9849
|
+
return entries.length > 0 ? "EXISTS" : "NONE";
|
|
8414
9850
|
} catch {
|
|
8415
|
-
return
|
|
9851
|
+
return "UNKNOWN";
|
|
8416
9852
|
}
|
|
8417
9853
|
}
|
|
9854
|
+
var principalWarned = false;
|
|
9855
|
+
function warn(message, recovery) {
|
|
9856
|
+
emitCheckError({
|
|
9857
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9858
|
+
check: CHECK_NAME,
|
|
9859
|
+
severity: "warning",
|
|
9860
|
+
message: `${CHECK_NAME}: ${message}`,
|
|
9861
|
+
agent_recovery_prompt: recovery
|
|
9862
|
+
});
|
|
9863
|
+
}
|
|
9864
|
+
function firstPushArchivalReadiness(input, infraFailure) {
|
|
9865
|
+
if (infraFailure !== null)
|
|
9866
|
+
return "UNKNOWN";
|
|
9867
|
+
return checkDispatchReadiness(input).ready ? "READY" : "NOT_READY";
|
|
9868
|
+
}
|
|
8418
9869
|
async function classifyReadiness(trancheSlug, taskId) {
|
|
8419
9870
|
const repo = resolveRepo2();
|
|
8420
9871
|
if (!repo)
|
|
8421
9872
|
return "UNKNOWN";
|
|
9873
|
+
let principalAllowlist;
|
|
9874
|
+
try {
|
|
9875
|
+
principalAllowlist = resolveTrustedPrincipals();
|
|
9876
|
+
} catch (err) {
|
|
9877
|
+
warnOnUnreadPrincipals(CHECK_NAME, err);
|
|
9878
|
+
principalWarned = true;
|
|
9879
|
+
return "UNKNOWN";
|
|
9880
|
+
}
|
|
8422
9881
|
try {
|
|
8423
9882
|
const source = createForgeSource({ owner: repo.owner, repo: repo.repo });
|
|
8424
9883
|
const tranche = await source.getTranche(trancheSlug);
|
|
@@ -8457,6 +9916,7 @@ async function classifyReadiness(trancheSlug, taskId) {
|
|
|
8457
9916
|
const r = await resolveEdge(c, taskById, factsByTaskId, repo);
|
|
8458
9917
|
return { id: c, issue: r.issue, openOrInFlight: r.open };
|
|
8459
9918
|
}));
|
|
9919
|
+
const archival = await resolvePriorTrancheArchival(task.projects, trancheSlug, repo);
|
|
8460
9920
|
const input = {
|
|
8461
9921
|
trancheSlug,
|
|
8462
9922
|
task,
|
|
@@ -8465,10 +9925,10 @@ async function classifyReadiness(trancheSlug, taskId) {
|
|
|
8465
9925
|
dependsOn,
|
|
8466
9926
|
conflictsWith,
|
|
8467
9927
|
priorTask: null,
|
|
8468
|
-
priorTrancheArchival:
|
|
8469
|
-
principalAllowlist
|
|
9928
|
+
priorTrancheArchival: archival.facts,
|
|
9929
|
+
principalAllowlist
|
|
8470
9930
|
};
|
|
8471
|
-
return
|
|
9931
|
+
return firstPushArchivalReadiness(input, archival.infraFailure);
|
|
8472
9932
|
} catch {
|
|
8473
9933
|
return "UNKNOWN";
|
|
8474
9934
|
}
|
|
@@ -8479,9 +9939,18 @@ async function main() {
|
|
|
8479
9939
|
let readiness = "READY";
|
|
8480
9940
|
let prExists = false;
|
|
8481
9941
|
if (parsed) {
|
|
8482
|
-
|
|
8483
|
-
if (
|
|
9942
|
+
const found = prExistsFor(branch);
|
|
9943
|
+
if (found === "EXISTS") {
|
|
9944
|
+
prExists = true;
|
|
9945
|
+
} else if (found === "UNKNOWN") {
|
|
9946
|
+
readiness = "UNKNOWN";
|
|
9947
|
+
warn(`the forge could not say whether \`${branch}\` already has a pull request (the \`gh pr list\` read failed), so dispatch readiness was not checked and the push is allowed.`, "Confirm `gh auth status` passes and the forge is reachable, then re-run `vinaya check first-push-dispatch`.");
|
|
9948
|
+
} else {
|
|
8484
9949
|
readiness = await classifyReadiness(parsed.tranche, parsed.taskId);
|
|
9950
|
+
if (readiness === "UNKNOWN" && !principalWarned) {
|
|
9951
|
+
warn(`dispatch readiness for \`${branch}\` is unknown (the forge could not be read or the repository could not be resolved), so the push is allowed unchecked.`, "Confirm `gh auth status` passes, the forge is reachable and `origin` names the GitHub repository, then re-run `vinaya check first-push-dispatch`.");
|
|
9952
|
+
}
|
|
9953
|
+
}
|
|
8485
9954
|
}
|
|
8486
9955
|
const result = checkFirstPushDispatchGate({ branch, prExists, readiness });
|
|
8487
9956
|
if (result.verdict === "refuse") {
|
|
@@ -8496,4 +9965,9 @@ async function main() {
|
|
|
8496
9965
|
}
|
|
8497
9966
|
process.exit(0);
|
|
8498
9967
|
}
|
|
8499
|
-
|
|
9968
|
+
if (isEntryPoint(import.meta.url, "check-first-push-dispatch")) {
|
|
9969
|
+
main();
|
|
9970
|
+
}
|
|
9971
|
+
export {
|
|
9972
|
+
firstPushArchivalReadiness
|
|
9973
|
+
};
|