@attalabs/vinaya 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/aeg-root/contracts/developer-reviewer.md +2 -2
- package/aeg-root/contracts/planner-developer.md +5 -5
- package/aeg-root/enforcement.md +22 -22
- package/aeg-root/process.md +4 -4
- package/aeg-root/roles/archivist.md +1 -1
- package/aeg-root/roles/developer/reference.md +7 -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 +10 -15
- package/aeg-root/templates/brief-template.md +5 -2
- 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 +1974 -354
- package/dist/checks/bin/check-branch-topology.js +1296 -243
- package/dist/checks/bin/check-brief-shape.js +2038 -460
- package/dist/checks/bin/check-changeset-coverage.js +2411 -564
- package/dist/checks/bin/check-ci-shard-coverage.js +12391 -15
- package/dist/checks/bin/check-closes-n.js +1296 -243
- package/dist/checks/bin/check-coherence.js +1914 -1155
- package/dist/checks/bin/check-dead-branch-push.js +1242 -230
- package/dist/checks/bin/check-dispatch-readiness.js +2222 -460
- package/dist/checks/bin/check-doc-claims.js +2233 -260
- package/dist/checks/bin/check-doc-coverage-push.js +2436 -550
- package/dist/checks/bin/check-doc-coverage.js +2434 -552
- package/dist/checks/bin/check-doctrine-no-procedures.js +1776 -353
- package/dist/checks/bin/check-doctrine-portability.js +2408 -561
- package/dist/checks/bin/check-evidence-fresh.js +2370 -508
- package/dist/checks/bin/check-exec-bits.js +2407 -560
- package/dist/checks/bin/check-first-push-dispatch.js +1984 -380
- package/dist/checks/bin/check-issue-assignment.js +712 -170
- package/dist/checks/bin/check-issue-milestone-attach.js +1233 -230
- package/dist/checks/bin/check-issue-objectives-numbering.js +1769 -346
- package/dist/checks/bin/check-issue-parts-coverage.js +1233 -230
- package/dist/checks/bin/check-issue-surface-globs.js +1926 -378
- package/dist/checks/bin/check-issue-title-grammar.js +1233 -230
- package/dist/checks/bin/check-issue-tranche-label.js +702 -170
- package/dist/checks/bin/check-main-branch-refusal.js +1245 -232
- package/dist/checks/bin/check-no-disk-state.js +1233 -230
- package/dist/checks/bin/check-pr-premise-reassert.js +1769 -346
- package/dist/checks/bin/check-pr-report-density.js +1233 -230
- package/dist/checks/bin/check-principal-test-plan-wait.js +2489 -259
- package/dist/checks/bin/check-quoted-command.js +2391 -544
- package/dist/checks/bin/check-reader-resolvable-prose.js +2437 -564
- package/dist/checks/bin/check-registry-gates.js +1380 -296
- package/dist/checks/bin/check-retired-vocabulary.js +2416 -550
- package/dist/checks/bin/check-review-gate.js +2073 -371
- package/dist/checks/bin/check-single-plan-pr.js +1297 -235
- package/dist/checks/bin/check-surface-scope.js +1531 -252
- package/dist/checks/bin/check-test-plan.js +2487 -258
- package/dist/checks/bin/check-token-collection-wired.js +1233 -230
- package/dist/checks/bin/check-workspace-escape.js +2408 -561
- package/dist/checks/bin/verify-coherence.js +597 -97
- package/dist/checks/bin/verify-dispatch.js +632 -152
- package/dist/checks/bin/verify-docs.js +642 -132
- package/dist/index.js +25948 -16630
- package/dist/lib/pre-push-cache-test-run.js +1813 -297
- package/dist/lib/pre-push-changed-files.js +65 -19
- package/dist/lib/pre-push-mode.js +466 -0
- package/dist/lib/pre-push-progress-dir.js +4205 -0
- package/dist/lib/pre-push-record-tests.js +446 -0
- package/dist/lib/pre-push-select-tests.js +2353 -632
- package/dist/lib/push-progress-observer.js +4213 -0
- package/package.json +22 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +17 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +73 -30
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +29 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +35 -18
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/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 +3 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +96 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +809 -106
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +2 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +53 -93
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +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]__1ug9syi._.js → [root-of-the-server]__1d4eth3._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 0x7u6si-ai179.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 2fu7mfsj4oima.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 34b4ruddunn3q.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 → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
// ../../packages/aeg-core/bin/verify-dispatch.ts
|
|
5
5
|
import { execFile as execFile4, execFileSync as execFileSync2, spawnSync } from "child_process";
|
|
6
|
-
import { existsSync, readFileSync as
|
|
7
|
-
import { join } from "path";
|
|
6
|
+
import { existsSync, readFileSync as readFileSync3 } from "fs";
|
|
7
|
+
import { join as join2 } from "path";
|
|
8
8
|
import { promisify as promisify4 } from "util";
|
|
9
9
|
|
|
10
10
|
// ../../packages/aeg-forge-state/src/parse-rationale-deps.ts
|
|
@@ -730,29 +730,11 @@ function trancheSlugsFromLabels(labels) {
|
|
|
730
730
|
}
|
|
731
731
|
return slugs;
|
|
732
732
|
}
|
|
733
|
-
function
|
|
734
|
-
const
|
|
735
|
-
const labels = ghApiGet(`repos/${owner}/${repo}/labels?per_page=100`);
|
|
736
|
-
const slugs = new Set([...slugShapedTitles(milestones), ...trancheSlugsFromLabels(labels)]);
|
|
737
|
-
const active = [];
|
|
738
|
-
for (const slug of slugs) {
|
|
739
|
-
const legacy = matchesLegacyMilestone(milestones, slug);
|
|
740
|
-
const issues = ghIssueListByLabel(owner, repo, trancheLabel(slug));
|
|
741
|
-
if (legacy) {
|
|
742
|
-
const facts = resolveLegacyFacts(legacy, issues);
|
|
743
|
-
if (facts.lifecycle === "active")
|
|
744
|
-
active.push({ slug, goal: facts.goal });
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
if (lifecycleFromIssues(issues) === "active")
|
|
748
|
-
active.push({ slug, goal: goalFromMilestones(milestones, slug) });
|
|
749
|
-
}
|
|
750
|
-
return active;
|
|
751
|
-
}
|
|
752
|
-
async function indexTrancheMilestonesAsync(owner, repo) {
|
|
733
|
+
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
734
|
+
const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
|
|
753
735
|
const [milestones, labels] = await Promise.all([
|
|
754
|
-
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
755
|
-
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
|
|
736
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
737
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
756
738
|
]);
|
|
757
739
|
const active = [];
|
|
758
740
|
const archived = [];
|
|
@@ -763,9 +745,16 @@ async function indexTrancheMilestonesAsync(owner, repo) {
|
|
|
763
745
|
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
764
746
|
const uniqueLegacySlugs = [...legacySlugs];
|
|
765
747
|
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
766
|
-
Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
|
|
767
|
-
Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
|
|
748
|
+
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
749
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
768
750
|
]);
|
|
751
|
+
const issuesBySlug = new Map;
|
|
752
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
753
|
+
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
754
|
+
});
|
|
755
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
756
|
+
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
757
|
+
});
|
|
769
758
|
uniqueLegacySlugs.forEach((slug, i) => {
|
|
770
759
|
const m = legacyMilestoneBySlug.get(slug);
|
|
771
760
|
if (!m)
|
|
@@ -789,7 +778,14 @@ async function indexTrancheMilestonesAsync(owner, repo) {
|
|
|
789
778
|
else if (lifecycle === "complete")
|
|
790
779
|
archived.push({ slug, goal });
|
|
791
780
|
});
|
|
792
|
-
return { active, archived, facts, legacySlugs };
|
|
781
|
+
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
782
|
+
}
|
|
783
|
+
async function retryOnce(fetch) {
|
|
784
|
+
try {
|
|
785
|
+
return await fetch();
|
|
786
|
+
} catch {
|
|
787
|
+
return fetch();
|
|
788
|
+
}
|
|
793
789
|
}
|
|
794
790
|
async function tranchesAttachedToMilestone(owner, repo, milestoneNumber) {
|
|
795
791
|
const issues = await ghApiGetAllPagesAsync(`repos/${owner}/${repo}/issues?milestone=${milestoneNumber}&state=all`, { jq: "[.[] | {labels: .labels}]" });
|
|
@@ -1812,6 +1808,52 @@ function describeError(err) {
|
|
|
1812
1808
|
return err;
|
|
1813
1809
|
return "unknown error";
|
|
1814
1810
|
}
|
|
1811
|
+
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1812
|
+
function defaultPriorTrancheArchivalDeps() {
|
|
1813
|
+
return {
|
|
1814
|
+
activeTranches: async (excludeSlug, repo) => {
|
|
1815
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo, { retryFailedReads: true });
|
|
1816
|
+
return index.active.filter((m) => m.slug !== excludeSlug).map((m) => {
|
|
1817
|
+
const issues = index.issuesBySlug?.get(m.slug);
|
|
1818
|
+
if (!issues)
|
|
1819
|
+
throw new Error(`the Milestone index holds no Issue list for tranche \`${m.slug}\``);
|
|
1820
|
+
return { slug: m.slug, issues };
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
function reason(err) {
|
|
1826
|
+
return err instanceof Error ? err.message.split(`
|
|
1827
|
+
`)[0] ?? "failed" : String(err);
|
|
1828
|
+
}
|
|
1829
|
+
async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
|
|
1830
|
+
if (projects.length === 0)
|
|
1831
|
+
return { facts: [], infraFailure: null };
|
|
1832
|
+
let candidates;
|
|
1833
|
+
try {
|
|
1834
|
+
candidates = await deps.activeTranches(excludeSlug, repo);
|
|
1835
|
+
} catch (err) {
|
|
1836
|
+
return {
|
|
1837
|
+
facts: [],
|
|
1838
|
+
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
const tasksBySlug = new Map(candidates.map((c) => [c.slug, tasksFromIssues(c.issues)]));
|
|
1842
|
+
const facts = [];
|
|
1843
|
+
for (const project of projects) {
|
|
1844
|
+
let found = null;
|
|
1845
|
+
for (const { slug, issues } of candidates) {
|
|
1846
|
+
if (!(tasksBySlug.get(slug) ?? []).some((t) => t.projects.includes(project)))
|
|
1847
|
+
continue;
|
|
1848
|
+
if (!issues.some((issue) => issue.state === "OPEN")) {
|
|
1849
|
+
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1850
|
+
break;
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1854
|
+
}
|
|
1855
|
+
return { facts, infraFailure: null };
|
|
1856
|
+
}
|
|
1815
1857
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1816
1858
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
1817
1859
|
const result = new Map;
|
|
@@ -2250,7 +2292,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
|
2250
2292
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
2251
2293
|
var WAIVER_LABEL = label("waiver-docs");
|
|
2252
2294
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
2253
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
2254
2295
|
function isPrincipal(login, principalAllowlist) {
|
|
2255
2296
|
if (login === null)
|
|
2256
2297
|
return false;
|
|
@@ -2787,8 +2828,362 @@ var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"])
|
|
|
2787
2828
|
|
|
2788
2829
|
// ../../packages/aeg-core/src/doctrine-no-procedures.ts
|
|
2789
2830
|
var SHELL_LANGS = new Set(["", "sh", "bash", "shell", "console"]);
|
|
2831
|
+
// ../../packages/aeg-core/src/prose-rules.ts
|
|
2832
|
+
var RETIRED_GLOBAL_EXEMPTIONS = [
|
|
2833
|
+
"docs/decisions-legacy.md",
|
|
2834
|
+
"apps/herald-ai/docs/",
|
|
2835
|
+
"apps/vada-ai/docs/",
|
|
2836
|
+
"aeg-root/tranches/completed/",
|
|
2837
|
+
"packages/aeg-core/src/docs/published-prose",
|
|
2838
|
+
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
2839
|
+
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
2840
|
+
"/fixtures/",
|
|
2841
|
+
"/node_modules/",
|
|
2842
|
+
"/.next/",
|
|
2843
|
+
"/.turbo/"
|
|
2844
|
+
];
|
|
2845
|
+
var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
|
|
2846
|
+
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
2847
|
+
var RETIRED_PATTERN_EXEMPTIONS = {
|
|
2848
|
+
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
2849
|
+
[String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
|
|
2850
|
+
"docs-index.md",
|
|
2851
|
+
"apps/vada-ai/specs/legacy/README.md",
|
|
2852
|
+
"apps/vada-ai/specs/vada-product-spec.md",
|
|
2853
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
2854
|
+
"apps/vada-ai/CLAUDE.md"
|
|
2855
|
+
],
|
|
2856
|
+
"decisions-legacy": [
|
|
2857
|
+
"packages/aeg-core/src/file-classify.ts",
|
|
2858
|
+
"packages/aeg-core/src/file-classify.test.ts",
|
|
2859
|
+
"packages/aeg-core/src/pr-tier.test.ts",
|
|
2860
|
+
"docs-index.md",
|
|
2861
|
+
".claude/skills/database/SKILL.md",
|
|
2862
|
+
".claude/skills/vada-architecture/SKILL.md",
|
|
2863
|
+
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
2864
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
2865
|
+
"apps/vada-ai/CLAUDE.md"
|
|
2866
|
+
],
|
|
2867
|
+
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
2868
|
+
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
2869
|
+
};
|
|
2870
|
+
var retiredPatterns = [
|
|
2871
|
+
String.raw`\bD-[0-9]{3}\b`,
|
|
2872
|
+
"D-(###|NNN|nnn|xxx)",
|
|
2873
|
+
"decision (entry|logged)",
|
|
2874
|
+
"decision-log entry",
|
|
2875
|
+
"decision log entry",
|
|
2876
|
+
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
2877
|
+
"decision-log",
|
|
2878
|
+
"decision entr",
|
|
2879
|
+
"decisions? (are |is )?logged",
|
|
2880
|
+
"log entries",
|
|
2881
|
+
String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
|
|
2882
|
+
"decisions-legacy",
|
|
2883
|
+
"CONTRADICTION",
|
|
2884
|
+
"assumes Tier 3",
|
|
2885
|
+
"Lock: ?YES",
|
|
2886
|
+
"Lock: ?NO",
|
|
2887
|
+
"lock approvals?",
|
|
2888
|
+
"approves locks",
|
|
2889
|
+
"Conforms to lock",
|
|
2890
|
+
"Challenges lock",
|
|
2891
|
+
"checkDecisionNumbersFresh",
|
|
2892
|
+
String.raw`roles/team-leader\.md`,
|
|
2893
|
+
String.raw`\(,`,
|
|
2894
|
+
String.raw`,\)`,
|
|
2895
|
+
String.raw`\(\.\)`,
|
|
2896
|
+
...PLAN_ON_DISK_PATTERNS
|
|
2897
|
+
];
|
|
2898
|
+
var published = [
|
|
2899
|
+
["decision-id", "a decision id", /\bD-\d{3,}\b/],
|
|
2900
|
+
["section-ref", "a section reference", /§/],
|
|
2901
|
+
["forge-number", "a forge number", /#\d+/],
|
|
2902
|
+
["retired-name", "the retired public name", /\bAEG\b/],
|
|
2903
|
+
["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
|
|
2904
|
+
[
|
|
2905
|
+
"label-vocabulary",
|
|
2906
|
+
"forge label vocabulary",
|
|
2907
|
+
/(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
|
|
2908
|
+
],
|
|
2909
|
+
["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
|
|
2910
|
+
["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
|
|
2911
|
+
[
|
|
2912
|
+
"internal-path",
|
|
2913
|
+
"a repo-internal file",
|
|
2914
|
+
/(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
|
|
2915
|
+
]
|
|
2916
|
+
];
|
|
2917
|
+
var DEFAULT_PROSE_RULES = [
|
|
2918
|
+
{
|
|
2919
|
+
id: "forge-number",
|
|
2920
|
+
group: "reader-resolvable",
|
|
2921
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
2922
|
+
patterns: { prose: /#[0-9]{2,4}/g },
|
|
2923
|
+
flags: ["global"],
|
|
2924
|
+
message: "a forge number",
|
|
2925
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
2926
|
+
exemptions: []
|
|
2927
|
+
},
|
|
2928
|
+
{
|
|
2929
|
+
id: "tranche-slug",
|
|
2930
|
+
group: "reader-resolvable",
|
|
2931
|
+
scopes: ["ships", "reader-facing", "product", "spec"],
|
|
2932
|
+
patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
|
|
2933
|
+
flags: ["global"],
|
|
2934
|
+
message: "an internal tranche slug",
|
|
2935
|
+
severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
|
|
2936
|
+
exemptions: []
|
|
2937
|
+
},
|
|
2938
|
+
{
|
|
2939
|
+
id: "task-number",
|
|
2940
|
+
group: "reader-resolvable",
|
|
2941
|
+
scopes: ["spec"],
|
|
2942
|
+
patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
|
|
2943
|
+
flags: ["global", "ignore-case"],
|
|
2944
|
+
message: "a task number",
|
|
2945
|
+
severity: { spec: "error" },
|
|
2946
|
+
exemptions: []
|
|
2947
|
+
},
|
|
2948
|
+
{
|
|
2949
|
+
id: "source-comment-tranche-slug",
|
|
2950
|
+
group: "reader-resolvable",
|
|
2951
|
+
scopes: ["source-comment"],
|
|
2952
|
+
patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
|
|
2953
|
+
flags: ["global"],
|
|
2954
|
+
message: "a tranche-slug citation",
|
|
2955
|
+
severity: { "source-comment": "warning" },
|
|
2956
|
+
exemptions: []
|
|
2957
|
+
},
|
|
2958
|
+
{
|
|
2959
|
+
id: "source-comment-forge-number",
|
|
2960
|
+
group: "reader-resolvable",
|
|
2961
|
+
scopes: ["source-comment"],
|
|
2962
|
+
patterns: { comment: /#[0-9]{2,}/g },
|
|
2963
|
+
flags: ["global"],
|
|
2964
|
+
message: "a forge-number citation",
|
|
2965
|
+
severity: { "source-comment": "warning" },
|
|
2966
|
+
exemptions: []
|
|
2967
|
+
},
|
|
2968
|
+
{
|
|
2969
|
+
id: "legacy-batch-name",
|
|
2970
|
+
group: "reader-resolvable",
|
|
2971
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
2972
|
+
patterns: {},
|
|
2973
|
+
flags: ["built-in"],
|
|
2974
|
+
message: "an internal tranche slug",
|
|
2975
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
2976
|
+
exemptions: [],
|
|
2977
|
+
builtIn: true
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
id: "coined-term",
|
|
2981
|
+
group: "reader-resolvable",
|
|
2982
|
+
scopes: ["ships", "reader-facing"],
|
|
2983
|
+
patterns: {},
|
|
2984
|
+
flags: ["built-in"],
|
|
2985
|
+
message: "uses coined term without defining it inline or linking the glossary",
|
|
2986
|
+
severity: { ships: "warning", "reader-facing": "warning" },
|
|
2987
|
+
exemptions: [],
|
|
2988
|
+
builtIn: true
|
|
2989
|
+
},
|
|
2990
|
+
...retiredPatterns.map((pattern, index) => ({
|
|
2991
|
+
id: `retired-vocabulary-${index + 1}`,
|
|
2992
|
+
group: "retired-vocabulary",
|
|
2993
|
+
scopes: ["repository"],
|
|
2994
|
+
patterns: { repository: pattern },
|
|
2995
|
+
flags: [],
|
|
2996
|
+
message: "retired vocabulary",
|
|
2997
|
+
severity: { repository: "error" },
|
|
2998
|
+
exemptions: RETIRED_GLOBAL_EXEMPTIONS,
|
|
2999
|
+
patternExemptions: RETIRED_PATTERN_EXEMPTIONS
|
|
3000
|
+
})),
|
|
3001
|
+
...published.map(([id, message, pattern]) => ({
|
|
3002
|
+
id,
|
|
3003
|
+
group: "published-prose",
|
|
3004
|
+
scopes: ["published"],
|
|
3005
|
+
patterns: { published: pattern },
|
|
3006
|
+
flags: [],
|
|
3007
|
+
message,
|
|
3008
|
+
severity: { published: "error" },
|
|
3009
|
+
exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
|
|
3010
|
+
}))
|
|
3011
|
+
];
|
|
3012
|
+
var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
|
|
3013
|
+
var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
|
|
3014
|
+
var RETIRED_SCOPES = ["repository"];
|
|
3015
|
+
var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
|
|
3016
|
+
function groupOfScope(scope) {
|
|
3017
|
+
if (RESOLVABLE_SCOPES.includes(scope))
|
|
3018
|
+
return "reader-resolvable";
|
|
3019
|
+
if (RETIRED_SCOPES.includes(scope))
|
|
3020
|
+
return "retired-vocabulary";
|
|
3021
|
+
return;
|
|
3022
|
+
}
|
|
3023
|
+
var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
|
|
3024
|
+
function normalizeRepoPath(entry) {
|
|
3025
|
+
let out = entry.replace(/\\/g, "/");
|
|
3026
|
+
while (out.startsWith("./"))
|
|
3027
|
+
out = out.slice(2);
|
|
3028
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3029
|
+
while (out.endsWith("/"))
|
|
3030
|
+
out = out.slice(0, -1);
|
|
3031
|
+
return out;
|
|
3032
|
+
}
|
|
3033
|
+
var RESOLVABLE_RUN_ORDER = [
|
|
3034
|
+
"forge-number",
|
|
3035
|
+
"tranche-slug",
|
|
3036
|
+
"legacy-batch-name",
|
|
3037
|
+
"task-number",
|
|
3038
|
+
"source-comment-tranche-slug",
|
|
3039
|
+
"source-comment-forge-number",
|
|
3040
|
+
"coined-term"
|
|
3041
|
+
];
|
|
3042
|
+
var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
|
|
3043
|
+
function scopeDefaultSeverity(scope, sourceCommentSeverity) {
|
|
3044
|
+
if (scope === "source-comment")
|
|
3045
|
+
return sourceCommentSeverity ?? "warning";
|
|
3046
|
+
if (scope === "repository")
|
|
3047
|
+
return "error";
|
|
3048
|
+
return "warning";
|
|
3049
|
+
}
|
|
3050
|
+
function applySeverity(scopes, base, setting) {
|
|
3051
|
+
const out = {};
|
|
3052
|
+
for (const scope of scopes) {
|
|
3053
|
+
const configured = typeof setting === "string" ? setting : setting?.[scope];
|
|
3054
|
+
const value = configured ?? base[scope];
|
|
3055
|
+
if (value !== undefined)
|
|
3056
|
+
out[scope] = value;
|
|
3057
|
+
}
|
|
3058
|
+
return out;
|
|
3059
|
+
}
|
|
3060
|
+
function defaultPatternFor(rule) {
|
|
3061
|
+
const cache = new Map;
|
|
3062
|
+
return (scope) => {
|
|
3063
|
+
if (cache.has(scope))
|
|
3064
|
+
return cache.get(scope) ?? null;
|
|
3065
|
+
const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
|
|
3066
|
+
const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
|
|
3067
|
+
cache.set(scope, compiled);
|
|
3068
|
+
return compiled;
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
function customPatternFor(rule, global) {
|
|
3072
|
+
const cache = new Map;
|
|
3073
|
+
return (scope) => {
|
|
3074
|
+
if (cache.has(scope))
|
|
3075
|
+
return cache.get(scope) ?? null;
|
|
3076
|
+
const source = rule.patterns?.[scope] ?? rule.pattern;
|
|
3077
|
+
const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
|
|
3078
|
+
cache.set(scope, compiled);
|
|
3079
|
+
return compiled;
|
|
3080
|
+
};
|
|
3081
|
+
}
|
|
3082
|
+
function resolveProseRules(config = undefined, options = {}) {
|
|
3083
|
+
const rules = [];
|
|
3084
|
+
const defaults = config?.defaults ?? {};
|
|
3085
|
+
for (const rule of CONFIGURABLE_DEFAULT_RULES) {
|
|
3086
|
+
const override = defaults[rule.id];
|
|
3087
|
+
if (override === "off")
|
|
3088
|
+
continue;
|
|
3089
|
+
const group = rule.group;
|
|
3090
|
+
const scopes = override?.scopes ?? rule.scopes;
|
|
3091
|
+
const base = {};
|
|
3092
|
+
for (const scope of scopes) {
|
|
3093
|
+
base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
3094
|
+
}
|
|
3095
|
+
rules.push({
|
|
3096
|
+
id: rule.id,
|
|
3097
|
+
group,
|
|
3098
|
+
custom: false,
|
|
3099
|
+
builtIn: rule.builtIn === true,
|
|
3100
|
+
scopes,
|
|
3101
|
+
message: rule.message,
|
|
3102
|
+
severity: applySeverity(scopes, base, override?.severity),
|
|
3103
|
+
exempt: override?.exempt ?? [],
|
|
3104
|
+
substringExempt: rule.exemptions,
|
|
3105
|
+
reportGroup: REPORT_GROUPS[rule.id],
|
|
3106
|
+
patternFor: defaultPatternFor(rule)
|
|
3107
|
+
});
|
|
3108
|
+
}
|
|
3109
|
+
for (const rule of config?.custom ?? []) {
|
|
3110
|
+
const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
|
|
3111
|
+
const base = {};
|
|
3112
|
+
for (const scope of rule.scopes)
|
|
3113
|
+
base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
3114
|
+
rules.push({
|
|
3115
|
+
id: rule.id,
|
|
3116
|
+
group,
|
|
3117
|
+
custom: true,
|
|
3118
|
+
builtIn: false,
|
|
3119
|
+
scopes: rule.scopes,
|
|
3120
|
+
message: rule.means,
|
|
3121
|
+
severity: applySeverity(rule.scopes, base, rule.severity),
|
|
3122
|
+
exempt: rule.exempt ?? [],
|
|
3123
|
+
substringExempt: [],
|
|
3124
|
+
patternFor: customPatternFor(rule, group === "reader-resolvable")
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3127
|
+
if (options.decisionRecordsPath !== undefined)
|
|
3128
|
+
rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
|
|
3129
|
+
const order = (rule) => {
|
|
3130
|
+
const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
|
|
3131
|
+
return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
|
|
3132
|
+
};
|
|
3133
|
+
const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
|
|
3134
|
+
const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
|
|
3135
|
+
return {
|
|
3136
|
+
rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
|
|
3137
|
+
exempt: config?.exempt ?? [],
|
|
3138
|
+
repoRoot: options.repoRoot
|
|
3139
|
+
};
|
|
3140
|
+
}
|
|
3141
|
+
var DEFAULT_PROSE_RULE_SET = resolveProseRules();
|
|
3142
|
+
var DECISION_RECORD_CITATION_ID = "decision-record-citation";
|
|
3143
|
+
var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
|
|
3144
|
+
var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
|
|
3145
|
+
function escapeRegExp(text) {
|
|
3146
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3147
|
+
}
|
|
3148
|
+
function decisionRecordCitationPattern(decisionRecordsPath) {
|
|
3149
|
+
const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
|
|
3150
|
+
return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
|
|
3151
|
+
}
|
|
3152
|
+
function decisionRecordCitationRule(decisionRecordsPath) {
|
|
3153
|
+
const folder = normalizeRepoPath(decisionRecordsPath);
|
|
3154
|
+
const pattern = decisionRecordCitationPattern(folder);
|
|
3155
|
+
const severity = {};
|
|
3156
|
+
for (const scope of DECISION_RECORD_CITATION_SCOPES)
|
|
3157
|
+
severity[scope] = "error";
|
|
3158
|
+
return {
|
|
3159
|
+
id: DECISION_RECORD_CITATION_ID,
|
|
3160
|
+
group: "reader-resolvable",
|
|
3161
|
+
custom: false,
|
|
3162
|
+
builtIn: false,
|
|
3163
|
+
scopes: DECISION_RECORD_CITATION_SCOPES,
|
|
3164
|
+
message: DECISION_RECORD_CITATION_MESSAGE,
|
|
3165
|
+
severity,
|
|
3166
|
+
exempt: [folder],
|
|
3167
|
+
substringExempt: [],
|
|
3168
|
+
patternFor: () => pattern
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
3171
|
+
|
|
2790
3172
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
2791
3173
|
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3174
|
+
var readerRules = rulesForGroup("reader-resolvable");
|
|
3175
|
+
var readerPattern = (id, scope = "prose") => {
|
|
3176
|
+
const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
|
|
3177
|
+
if (!(pattern instanceof RegExp))
|
|
3178
|
+
throw new Error(`default prose rule ${id} has no ${scope} pattern`);
|
|
3179
|
+
return pattern;
|
|
3180
|
+
};
|
|
3181
|
+
var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
|
|
3182
|
+
var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
|
|
3183
|
+
var TASK_NUMBER_PATTERN = readerPattern("task-number");
|
|
3184
|
+
var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
|
|
3185
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
|
|
3186
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
|
|
2792
3187
|
|
|
2793
3188
|
// ../../packages/aeg-core/src/quoted-command.ts
|
|
2794
3189
|
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
@@ -3273,7 +3668,7 @@ function isGrandfathered(isoDate) {
|
|
|
3273
3668
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
3274
3669
|
}
|
|
3275
3670
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
3276
|
-
function checkA1(entries, principalAllowlist
|
|
3671
|
+
function checkA1(entries, principalAllowlist) {
|
|
3277
3672
|
const failures = [];
|
|
3278
3673
|
for (const e of entries) {
|
|
3279
3674
|
if (!e.facts)
|
|
@@ -4201,59 +4596,9 @@ function compareToBaseline(current, baseline) {
|
|
|
4201
4596
|
};
|
|
4202
4597
|
}
|
|
4203
4598
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
4204
|
-
var
|
|
4205
|
-
var RETIRED_PATTERNS =
|
|
4206
|
-
|
|
4207
|
-
"D-(###|NNN|nnn|xxx)",
|
|
4208
|
-
"decision (entry|logged)",
|
|
4209
|
-
"decision-log entry",
|
|
4210
|
-
"decision log entry",
|
|
4211
|
-
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
4212
|
-
"decision-log",
|
|
4213
|
-
"decision entr",
|
|
4214
|
-
"decisions? (are |is )?logged",
|
|
4215
|
-
"log entries",
|
|
4216
|
-
String.raw`decisions\.md`,
|
|
4217
|
-
"decisions-legacy",
|
|
4218
|
-
"CONTRADICTION",
|
|
4219
|
-
"assumes Tier 3",
|
|
4220
|
-
"Lock: ?YES",
|
|
4221
|
-
"Lock: ?NO",
|
|
4222
|
-
"lock approvals?",
|
|
4223
|
-
"approves locks",
|
|
4224
|
-
"Conforms to lock",
|
|
4225
|
-
"Challenges lock",
|
|
4226
|
-
"checkDecisionNumbersFresh",
|
|
4227
|
-
String.raw`roles/team-leader\.md`,
|
|
4228
|
-
String.raw`\(,`,
|
|
4229
|
-
String.raw`,\)`,
|
|
4230
|
-
String.raw`\(\.\)`,
|
|
4231
|
-
...PLAN_ON_DISK_PATTERNS
|
|
4232
|
-
];
|
|
4233
|
-
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
4234
|
-
var PATTERN_EXEMPT = {
|
|
4235
|
-
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
4236
|
-
[String.raw`decisions\.md`]: [
|
|
4237
|
-
"docs-index.md",
|
|
4238
|
-
"apps/vada-ai/specs/legacy/README.md",
|
|
4239
|
-
"apps/vada-ai/specs/vada-product-spec.md",
|
|
4240
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
4241
|
-
"apps/vada-ai/CLAUDE.md"
|
|
4242
|
-
],
|
|
4243
|
-
"decisions-legacy": [
|
|
4244
|
-
"packages/aeg-core/src/file-classify.ts",
|
|
4245
|
-
"packages/aeg-core/src/file-classify.test.ts",
|
|
4246
|
-
"packages/aeg-core/src/pr-tier.test.ts",
|
|
4247
|
-
"docs-index.md",
|
|
4248
|
-
".claude/skills/database/SKILL.md",
|
|
4249
|
-
".claude/skills/vada-architecture/SKILL.md",
|
|
4250
|
-
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
4251
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
4252
|
-
"apps/vada-ai/CLAUDE.md"
|
|
4253
|
-
],
|
|
4254
|
-
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
4255
|
-
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
4256
|
-
};
|
|
4599
|
+
var retiredRules = rulesForGroup("retired-vocabulary");
|
|
4600
|
+
var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
|
|
4601
|
+
var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
|
|
4257
4602
|
// ../../packages/aeg-core/src/dispatch-gate.ts
|
|
4258
4603
|
function isHandClosedByRecognizedPrincipal(dep, principalAllowlist) {
|
|
4259
4604
|
return dep.issueState === "closed" && dep.stateReason === "completed" && isPrincipal(dep.closedByActor ?? null, principalAllowlist);
|
|
@@ -4267,7 +4612,7 @@ function isSelfDependency(dep, task, issue) {
|
|
|
4267
4612
|
function checkDispatchReadiness(input) {
|
|
4268
4613
|
const { trancheSlug, task } = input;
|
|
4269
4614
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
4270
|
-
const principalAllowlist = input
|
|
4615
|
+
const { principalAllowlist } = input;
|
|
4271
4616
|
const blockerDetails = [];
|
|
4272
4617
|
const push = (blockerClass, message) => {
|
|
4273
4618
|
blockerDetails.push({ class: blockerClass, message });
|
|
@@ -4594,9 +4939,11 @@ var LineageSchema = z3.object({
|
|
|
4594
4939
|
parent: z3.string().nullable()
|
|
4595
4940
|
}).strict();
|
|
4596
4941
|
var InputVersionsSchema = z3.object({
|
|
4942
|
+
manifest_version: z3.literal(2).nullable().optional(),
|
|
4597
4943
|
objectives_version: z3.string().nullable(),
|
|
4598
4944
|
brief_hash: z3.string().nullable(),
|
|
4599
4945
|
ruling_ordinal: z3.number().int().nullable(),
|
|
4946
|
+
pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
|
|
4600
4947
|
policy_digest: z3.string().nullable()
|
|
4601
4948
|
}).strict();
|
|
4602
4949
|
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
@@ -4634,7 +4981,17 @@ var HeaderMetaV3Schema = z3.object({
|
|
|
4634
4981
|
runtime: z3.string().nullable(),
|
|
4635
4982
|
source: z3.string().nullable()
|
|
4636
4983
|
}).strict();
|
|
4637
|
-
var
|
|
4984
|
+
var HeaderMetaV4Schema = HeaderMetaV3Schema.extend({
|
|
4985
|
+
schema: z3.literal(4),
|
|
4986
|
+
process: z3.object({ id: z3.string(), version: z3.string().nullable(), digest: z3.string().nullable() }).strict(),
|
|
4987
|
+
runner: z3.object({ id: z3.string(), version: z3.string().nullable() }).strict()
|
|
4988
|
+
}).strict();
|
|
4989
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [
|
|
4990
|
+
HeaderMetaV1Schema,
|
|
4991
|
+
HeaderMetaV2Schema,
|
|
4992
|
+
HeaderMetaV3Schema,
|
|
4993
|
+
HeaderMetaV4Schema
|
|
4994
|
+
]);
|
|
4638
4995
|
var SubjectSchema = z3.object({
|
|
4639
4996
|
issue: z3.number().int().nullable(),
|
|
4640
4997
|
pr: z3.number().int().optional(),
|
|
@@ -4854,6 +5211,75 @@ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
|
4854
5211
|
round: z3.number().int(),
|
|
4855
5212
|
phase: z3.string()
|
|
4856
5213
|
}).strict(),
|
|
5214
|
+
z3.object({
|
|
5215
|
+
...loopShared,
|
|
5216
|
+
event: z3.literal("conflict_reentry"),
|
|
5217
|
+
task: z3.number().int(),
|
|
5218
|
+
pr: z3.number().int().positive(),
|
|
5219
|
+
attempt: z3.number().int().positive(),
|
|
5220
|
+
bound: z3.number().int().positive()
|
|
5221
|
+
}).strict(),
|
|
5222
|
+
z3.object({
|
|
5223
|
+
...loopShared,
|
|
5224
|
+
event: z3.literal("storage_push"),
|
|
5225
|
+
round: z3.number().int(),
|
|
5226
|
+
branch: z3.string(),
|
|
5227
|
+
head: z3.string()
|
|
5228
|
+
}).strict(),
|
|
5229
|
+
z3.object({
|
|
5230
|
+
...loopShared,
|
|
5231
|
+
event: z3.literal("local_checks_run"),
|
|
5232
|
+
round: z3.number().int(),
|
|
5233
|
+
head: z3.string().nullable(),
|
|
5234
|
+
passed: z3.boolean(),
|
|
5235
|
+
wall_ms: z3.number().nonnegative()
|
|
5236
|
+
}).strict(),
|
|
5237
|
+
z3.object({
|
|
5238
|
+
...loopShared,
|
|
5239
|
+
event: z3.literal("ready_push"),
|
|
5240
|
+
round: z3.number().int(),
|
|
5241
|
+
head: z3.string(),
|
|
5242
|
+
outcome: z3.enum(["passed", "refused"]),
|
|
5243
|
+
selected: z3.number().int().nonnegative(),
|
|
5244
|
+
failed: z3.number().int().nonnegative(),
|
|
5245
|
+
rerun: z3.boolean(),
|
|
5246
|
+
wall_ms: z3.number().nonnegative()
|
|
5247
|
+
}).strict(),
|
|
5248
|
+
z3.object({
|
|
5249
|
+
...loopShared,
|
|
5250
|
+
event: z3.literal("failed_tests_rerun"),
|
|
5251
|
+
round: z3.number().int(),
|
|
5252
|
+
head: z3.string(),
|
|
5253
|
+
rerun_of: z3.string(),
|
|
5254
|
+
failed_files: z3.number().int().nonnegative(),
|
|
5255
|
+
affected_files: z3.number().int().nonnegative(),
|
|
5256
|
+
full_count: z3.number().int().nonnegative()
|
|
5257
|
+
}).strict(),
|
|
5258
|
+
z3.object({
|
|
5259
|
+
...loopShared,
|
|
5260
|
+
event: z3.literal("pr_opened"),
|
|
5261
|
+
round: z3.number().int(),
|
|
5262
|
+
pr: z3.number().int().positive(),
|
|
5263
|
+
head: z3.string()
|
|
5264
|
+
}).strict(),
|
|
5265
|
+
z3.object({
|
|
5266
|
+
...loopShared,
|
|
5267
|
+
event: z3.literal("ci_result_read"),
|
|
5268
|
+
round: z3.number().int(),
|
|
5269
|
+
pr: z3.number().int().positive(),
|
|
5270
|
+
head: z3.string(),
|
|
5271
|
+
conclusion: z3.enum(["green", "red", "pending", "skipped"]),
|
|
5272
|
+
failing_checks: z3.array(z3.string()),
|
|
5273
|
+
wait_ms: z3.number().nonnegative()
|
|
5274
|
+
}).strict(),
|
|
5275
|
+
z3.object({
|
|
5276
|
+
...loopShared,
|
|
5277
|
+
event: z3.literal("phase_time"),
|
|
5278
|
+
round: z3.number().int(),
|
|
5279
|
+
phase: z3.enum(["developer", "local_checks", "review", "push", "ci", "other"]),
|
|
5280
|
+
step: z3.string(),
|
|
5281
|
+
wall_ms: z3.number().nonnegative()
|
|
5282
|
+
}).strict(),
|
|
4857
5283
|
z3.object({
|
|
4858
5284
|
...loopShared,
|
|
4859
5285
|
event: z3.literal("driver_exited"),
|
|
@@ -5041,7 +5467,7 @@ var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
|
5041
5467
|
]);
|
|
5042
5468
|
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
5043
5469
|
var customShared = {
|
|
5044
|
-
meta:
|
|
5470
|
+
meta: HeaderMetaSchema,
|
|
5045
5471
|
subject: SubjectSchema,
|
|
5046
5472
|
kind: z3.literal("custom"),
|
|
5047
5473
|
...envelopeTail
|
|
@@ -5128,6 +5554,12 @@ var ManifestRecordSchema = z4.object({
|
|
|
5128
5554
|
briefHash: z4.string().min(1).nullable(),
|
|
5129
5555
|
objectivesVersion: z4.string().min(1).nullable(),
|
|
5130
5556
|
rulingOrdinal: epochNumber,
|
|
5557
|
+
manifestVersion: z4.literal(2).optional(),
|
|
5558
|
+
pauseBoundRuling: z4.object({
|
|
5559
|
+
rulingId: z4.string().min(1),
|
|
5560
|
+
pauseId: z4.string().min(1),
|
|
5561
|
+
contentDigest: z4.string().min(1)
|
|
5562
|
+
}).strict().nullable().optional(),
|
|
5131
5563
|
policyDigest: z4.string().min(1),
|
|
5132
5564
|
recordedAt: isoTimestamp
|
|
5133
5565
|
}).strict();
|
|
@@ -5149,7 +5581,11 @@ var LoopStateRecordSchema = z4.object({
|
|
|
5149
5581
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
5150
5582
|
repeatMemory: z4.object({
|
|
5151
5583
|
blockingFindings: z4.array(z4.string()),
|
|
5152
|
-
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
5584
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
|
|
5585
|
+
}).strict().optional(),
|
|
5586
|
+
developerHandoff: z4.object({
|
|
5587
|
+
findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
|
|
5588
|
+
failingChecks: z4.array(z4.string().min(1))
|
|
5153
5589
|
}).strict().optional(),
|
|
5154
5590
|
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
5155
5591
|
taskStartedAt: isoTimestamp.optional(),
|
|
@@ -5204,9 +5640,68 @@ var ResolutionRecordSchema = z4.object({
|
|
|
5204
5640
|
authenticatedFrom: z4.string().min(1),
|
|
5205
5641
|
consumedAt: isoTimestamp
|
|
5206
5642
|
}).strict();
|
|
5643
|
+
var ExecutionRoundMirrorRecordSchema = z4.object({
|
|
5644
|
+
version: z4.literal(1),
|
|
5645
|
+
kind: z4.literal("execution_round"),
|
|
5646
|
+
task: taskId,
|
|
5647
|
+
repository: z4.string().min(1),
|
|
5648
|
+
threadId: z4.string().min(1),
|
|
5649
|
+
checkpointId: z4.string().min(1),
|
|
5650
|
+
round: z4.number().int().positive(),
|
|
5651
|
+
recordedAt: isoTimestamp
|
|
5652
|
+
}).strict();
|
|
5653
|
+
// ../../packages/aeg-core/src/principals-config.ts
|
|
5654
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
5655
|
+
import { join } from "node:path";
|
|
5656
|
+
var PRINCIPALS_CONFIG_FIX = 'add "principals": [...] to vinaya.config.json';
|
|
5657
|
+
function readConfigPrincipals(repoRoot = ".") {
|
|
5658
|
+
const path = join(repoRoot, "vinaya.config.json");
|
|
5659
|
+
let raw;
|
|
5660
|
+
try {
|
|
5661
|
+
raw = JSON.parse(readFileSync2(path, "utf8"));
|
|
5662
|
+
} catch (err) {
|
|
5663
|
+
const why = err instanceof Error ? err.message : String(err);
|
|
5664
|
+
return { ok: false, reason: `cannot read ${path} as JSON (${why}) — ${PRINCIPALS_CONFIG_FIX}` };
|
|
5665
|
+
}
|
|
5666
|
+
const value = raw !== null && typeof raw === "object" ? raw.principals : undefined;
|
|
5667
|
+
if (value === undefined) {
|
|
5668
|
+
return { ok: false, reason: `${path} declares no Principal list — ${PRINCIPALS_CONFIG_FIX}` };
|
|
5669
|
+
}
|
|
5670
|
+
if (!Array.isArray(value) || value.length === 0 || !value.every((p) => typeof p === "string" && p.length > 0)) {
|
|
5671
|
+
return {
|
|
5672
|
+
ok: false,
|
|
5673
|
+
reason: `${path}'s "principals" must be a non-empty array of login strings — ${PRINCIPALS_CONFIG_FIX}`
|
|
5674
|
+
};
|
|
5675
|
+
}
|
|
5676
|
+
return { ok: true, principals: value };
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5207
5679
|
// ../../packages/aeg-core/bin/verify-dispatch.ts
|
|
5208
|
-
var
|
|
5680
|
+
var DISPATCH_INVOCATION_CWD = process.cwd();
|
|
5681
|
+
function resolveTargetRoot(cwd = process.cwd(), exec = execFileSync2) {
|
|
5682
|
+
const gitRoot = (candidate) => {
|
|
5683
|
+
try {
|
|
5684
|
+
const root = exec("git", ["-C", candidate, "rev-parse", "--show-toplevel"], {
|
|
5685
|
+
encoding: "utf8",
|
|
5686
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
5687
|
+
});
|
|
5688
|
+
return typeof root === "string" && root.trim() !== "" ? root.trim() : null;
|
|
5689
|
+
} catch {
|
|
5690
|
+
return null;
|
|
5691
|
+
}
|
|
5692
|
+
};
|
|
5693
|
+
return gitRoot(cwd) ?? gitRoot(import.meta.dirname) ?? join2(import.meta.dirname, "../../..");
|
|
5694
|
+
}
|
|
5695
|
+
var REPO_ROOT = resolveTargetRoot(DISPATCH_INVOCATION_CWD);
|
|
5209
5696
|
process.chdir(REPO_ROOT);
|
|
5697
|
+
async function resolveTargetRepository(repoRoot = REPO_ROOT, exec = execFileSync2) {
|
|
5698
|
+
return resolveRepo(async () => ({
|
|
5699
|
+
stdout: String(exec("git", ["-C", repoRoot, "remote", "get-url", "origin"], {
|
|
5700
|
+
encoding: "utf8",
|
|
5701
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
5702
|
+
}))
|
|
5703
|
+
}));
|
|
5704
|
+
}
|
|
5210
5705
|
function sh(cmd, args) {
|
|
5211
5706
|
try {
|
|
5212
5707
|
return execFileSync2(cmd, args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
@@ -5556,42 +6051,6 @@ function resolvePriorTask(tranche, taskId, branchPrs, provenanceByIssue, repo) {
|
|
|
5556
6051
|
hasProvenance: prior.issue !== null ? provenanceByIssue.get(prior.issue) ?? false : false
|
|
5557
6052
|
};
|
|
5558
6053
|
}
|
|
5559
|
-
function otherActiveTrancheSlugs(excludeSlug, repo) {
|
|
5560
|
-
return listActiveTrancheSlugs(repo.owner, repo.repo).map((m) => m.slug).filter((slug) => slug !== excludeSlug);
|
|
5561
|
-
}
|
|
5562
|
-
async function resolvePriorTrancheArchival(projects, excludeSlug, repo) {
|
|
5563
|
-
const candidates = otherActiveTrancheSlugs(excludeSlug, repo);
|
|
5564
|
-
const facts = [];
|
|
5565
|
-
for (const project of projects) {
|
|
5566
|
-
let found = null;
|
|
5567
|
-
for (const slug of candidates) {
|
|
5568
|
-
const candidateTranche = await deriveTrancheFromForge(repo.owner, repo.repo, slug);
|
|
5569
|
-
const touchesProject = candidateTranche.tasks.some((t) => t.projects.includes(project));
|
|
5570
|
-
if (!touchesProject)
|
|
5571
|
-
continue;
|
|
5572
|
-
const openIssues = shJson("gh", [
|
|
5573
|
-
"issue",
|
|
5574
|
-
"list",
|
|
5575
|
-
"-R",
|
|
5576
|
-
`${repo.owner}/${repo.repo}`,
|
|
5577
|
-
"--label",
|
|
5578
|
-
trancheLabel(slug),
|
|
5579
|
-
"--state",
|
|
5580
|
-
"open",
|
|
5581
|
-
"--json",
|
|
5582
|
-
"number",
|
|
5583
|
-
"--limit",
|
|
5584
|
-
"100"
|
|
5585
|
-
]) ?? [];
|
|
5586
|
-
if (openIssues.length === 0) {
|
|
5587
|
-
found = { project, priorTrancheSlug: slug, archived: false };
|
|
5588
|
-
break;
|
|
5589
|
-
}
|
|
5590
|
-
}
|
|
5591
|
-
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
5592
|
-
}
|
|
5593
|
-
return facts;
|
|
5594
|
-
}
|
|
5595
6054
|
function computeLeftoverForBranch(branch, worktreeDir) {
|
|
5596
6055
|
const branchExistsRemote = sh("git", ["ls-remote", "--heads", "origin", branch]).length > 0;
|
|
5597
6056
|
const worktreeExistsLocal = existsSync(worktreeDir);
|
|
@@ -5607,14 +6066,14 @@ function computeLeftoverForBranch(branch, worktreeDir) {
|
|
|
5607
6066
|
return classifyLeftover({ branchExistsRemote, worktreeExistsLocal, commitsAheadOfMain });
|
|
5608
6067
|
}
|
|
5609
6068
|
function computeLeftover(trancheSlug, taskId) {
|
|
5610
|
-
return computeLeftoverForBranch(`task/${trancheSlug}/${taskId}`,
|
|
6069
|
+
return computeLeftoverForBranch(`task/${trancheSlug}/${taskId}`, join2(REPO_ROOT, ".worktrees", "task", trancheSlug, taskId));
|
|
5611
6070
|
}
|
|
5612
6071
|
function computeLeftoverForIssue(issueNumber) {
|
|
5613
6072
|
const branch = `task/issue-${issueNumber}`;
|
|
5614
|
-
return computeLeftoverForBranch(branch,
|
|
6073
|
+
return computeLeftoverForBranch(branch, join2(REPO_ROOT, ".worktrees", branch));
|
|
5615
6074
|
}
|
|
5616
|
-
function captureStreams(cmd, args) {
|
|
5617
|
-
const result = spawnSync(cmd, args, { encoding: "utf8" });
|
|
6075
|
+
function captureStreams(cmd, args, repoRoot = REPO_ROOT) {
|
|
6076
|
+
const result = spawnSync(cmd, args, { encoding: "utf8", cwd: repoRoot });
|
|
5618
6077
|
if (result.error)
|
|
5619
6078
|
return { stdout: "", stderr: "", exitCode: -1, ranAtAll: false };
|
|
5620
6079
|
return {
|
|
@@ -5654,14 +6113,14 @@ function firstStderrLine(stderr) {
|
|
|
5654
6113
|
return line.length <= LIMIT ? line : `${line.slice(0, LIMIT)}\u2026 (truncated)`;
|
|
5655
6114
|
}
|
|
5656
6115
|
function siblingTool(name) {
|
|
5657
|
-
const built =
|
|
5658
|
-
return existsSync(built) ? built :
|
|
6116
|
+
const built = join2(import.meta.dirname, `${name}.js`);
|
|
6117
|
+
return existsSync(built) ? built : join2(import.meta.dirname, `${name}.ts`);
|
|
5659
6118
|
}
|
|
5660
|
-
function currentFindingCounts() {
|
|
5661
|
-
const docs = captureStreams("bun", [siblingTool("verify-docs")]);
|
|
6119
|
+
function currentFindingCounts(repoRoot = REPO_ROOT) {
|
|
6120
|
+
const docs = captureStreams("bun", [siblingTool("verify-docs")], repoRoot);
|
|
5662
6121
|
const docsFindingCount = docs.ranAtAll ? countErrorLines(`${docs.stdout}${docs.stderr}`) : 0;
|
|
5663
6122
|
const docsUnavailable = !docs.ranAtAll || docs.exitCode !== 0 && docsFindingCount === 0;
|
|
5664
|
-
const coherence = captureStreams("bun", [siblingTool("verify-coherence"), "--json"]);
|
|
6123
|
+
const coherence = captureStreams("bun", [siblingTool("verify-coherence"), "--json"], repoRoot);
|
|
5665
6124
|
const coherenceRead = coherence.ranAtAll ? coherenceFailedCount(coherence.stdout) : null;
|
|
5666
6125
|
const coherenceFailed = typeof coherenceRead === "number" ? coherenceRead : null;
|
|
5667
6126
|
const coherenceUnavailable = !coherence.ranAtAll || coherenceFailed === null;
|
|
@@ -5688,16 +6147,25 @@ function countErrorLines(output) {
|
|
|
5688
6147
|
return output.split(`
|
|
5689
6148
|
`).filter((l) => l.trim().startsWith("\u2717")).length;
|
|
5690
6149
|
}
|
|
5691
|
-
function
|
|
6150
|
+
function principalsOrExit(mode) {
|
|
6151
|
+
const principals = readConfigPrincipals();
|
|
6152
|
+
if (!principals.ok) {
|
|
6153
|
+
console.error(`verify-dispatch${mode}: ${principals.reason}`);
|
|
6154
|
+
process.exit(1);
|
|
6155
|
+
}
|
|
6156
|
+
return principals.principals;
|
|
6157
|
+
}
|
|
6158
|
+
function resolvePremiseBriefText(comments, issueNumber, principalAllowlist) {
|
|
5692
6159
|
const normalized = comments.map((c) => ({ body: c.body, author: c.author?.login ?? null }));
|
|
5693
|
-
const briefComment = resolveNewestFrozenBrief(normalized,
|
|
6160
|
+
const briefComment = resolveNewestFrozenBrief(normalized, principalAllowlist);
|
|
5694
6161
|
if (!briefComment) {
|
|
5695
6162
|
return { ok: false, message: `not dispatched \u2014 no \`aeg:brief:v<k>\` comment on Issue #${issueNumber}.` };
|
|
5696
6163
|
}
|
|
5697
6164
|
return { ok: true, text: briefComment.content };
|
|
5698
6165
|
}
|
|
5699
6166
|
async function runPremiseModeFromIssue(trancheSlug, taskId) {
|
|
5700
|
-
const
|
|
6167
|
+
const principalAllowlist = principalsOrExit(" --premise");
|
|
6168
|
+
const repo = await resolveTargetRepository();
|
|
5701
6169
|
if (!repo) {
|
|
5702
6170
|
console.error("verify-dispatch --premise: could not resolve a GitHub repo (set AEG_REPO=owner/repo, or confirm `gh auth login`).");
|
|
5703
6171
|
process.exit(1);
|
|
@@ -5723,7 +6191,7 @@ async function runPremiseModeFromIssue(trancheSlug, taskId) {
|
|
|
5723
6191
|
"--json",
|
|
5724
6192
|
"comments"
|
|
5725
6193
|
]);
|
|
5726
|
-
const resolved = resolvePremiseBriefText(commentsJson?.comments ?? [], task.issue);
|
|
6194
|
+
const resolved = resolvePremiseBriefText(commentsJson?.comments ?? [], task.issue, principalAllowlist);
|
|
5727
6195
|
if (!resolved.ok) {
|
|
5728
6196
|
console.error(`verify-dispatch --premise: ${resolved.message}`);
|
|
5729
6197
|
process.exit(1);
|
|
@@ -5734,7 +6202,7 @@ async function runPremiseModeFromIssue(trancheSlug, taskId) {
|
|
|
5734
6202
|
console.log("verify-dispatch --premise: no `Premise:` assertions found in the dispatched brief \u2014 nothing to re-assert.");
|
|
5735
6203
|
process.exit(0);
|
|
5736
6204
|
}
|
|
5737
|
-
const result = checkPremises(assertions, (p) => existsSync(p) ?
|
|
6205
|
+
const result = checkPremises(assertions, (p) => existsSync(p) ? readFileSync3(p, "utf8") : null);
|
|
5738
6206
|
if (!result.pass) {
|
|
5739
6207
|
console.error(`
|
|
5740
6208
|
verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no longer hold:
|
|
@@ -5747,13 +6215,13 @@ verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no
|
|
|
5747
6215
|
process.exit(0);
|
|
5748
6216
|
}
|
|
5749
6217
|
function runPremiseMode(bodyFile) {
|
|
5750
|
-
const body =
|
|
6218
|
+
const body = readFileSync3(bodyFile, "utf8");
|
|
5751
6219
|
const assertions = parsePremiseBlock(body);
|
|
5752
6220
|
if (assertions.length === 0) {
|
|
5753
6221
|
console.log("verify-dispatch --premise: no `Premise:` assertions found in the body file \u2014 nothing to re-assert.");
|
|
5754
6222
|
process.exit(0);
|
|
5755
6223
|
}
|
|
5756
|
-
const result = checkPremises(assertions, (p) => existsSync(p) ?
|
|
6224
|
+
const result = checkPremises(assertions, (p) => existsSync(p) ? readFileSync3(p, "utf8") : null);
|
|
5757
6225
|
if (!result.pass) {
|
|
5758
6226
|
console.error(`
|
|
5759
6227
|
verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no longer hold:
|
|
@@ -5767,28 +6235,31 @@ verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no
|
|
|
5767
6235
|
}
|
|
5768
6236
|
function runSimulateMode(trancheSlug, taskId, bodyFile) {
|
|
5769
6237
|
const branch = `task/${trancheSlug}/${taskId}`;
|
|
5770
|
-
const body =
|
|
6238
|
+
const body = readFileSync3(bodyFile, "utf8");
|
|
5771
6239
|
const assertions = parsePremiseBlock(body);
|
|
5772
6240
|
console.log(assertions.length > 0 ? `verify-dispatch --simulate: Premise: block present (${assertions.length} assertion(s)).` : "verify-dispatch --simulate: WARNING \u2014 no `Premise:` block found in the body file (checkPremiseCoverage will fail at PR time if this task has a code surface).");
|
|
5773
6241
|
let failed = false;
|
|
5774
6242
|
const gates = [
|
|
5775
6243
|
[
|
|
5776
6244
|
"verify-brief",
|
|
5777
|
-
() => execFileSync2("bun", ["
|
|
6245
|
+
() => execFileSync2("bun", [siblingTool("verify-brief")], {
|
|
6246
|
+
cwd: REPO_ROOT,
|
|
5778
6247
|
env: { ...process.env, BRANCH: branch, PR_BODY: body },
|
|
5779
6248
|
stdio: "inherit"
|
|
5780
6249
|
})
|
|
5781
6250
|
],
|
|
5782
6251
|
[
|
|
5783
6252
|
"verify-docs --pr",
|
|
5784
|
-
() => execFileSync2("bun", ["
|
|
6253
|
+
() => execFileSync2("bun", [siblingTool("verify-docs"), "--pr"], {
|
|
6254
|
+
cwd: REPO_ROOT,
|
|
5785
6255
|
env: { ...process.env, PR_BODY: body },
|
|
5786
6256
|
stdio: "inherit"
|
|
5787
6257
|
})
|
|
5788
6258
|
],
|
|
5789
6259
|
[
|
|
5790
6260
|
"verify-docs --push (C5, via PR_BODY_FILE)",
|
|
5791
|
-
() => execFileSync2("bun", ["
|
|
6261
|
+
() => execFileSync2("bun", [siblingTool("verify-docs"), "--push"], {
|
|
6262
|
+
cwd: REPO_ROOT,
|
|
5792
6263
|
env: { ...process.env, PR_BODY_FILE: bodyFile },
|
|
5793
6264
|
stdio: "inherit"
|
|
5794
6265
|
})
|
|
@@ -5811,7 +6282,7 @@ function runSurfacesMode(surfacesArg) {
|
|
|
5811
6282
|
console.log("verify-dispatch --surfaces: no surface globs given \u2014 nothing to check.");
|
|
5812
6283
|
process.exit(0);
|
|
5813
6284
|
}
|
|
5814
|
-
const docOwnersContent = existsSync(DOC_OWNERS_PATH) ?
|
|
6285
|
+
const docOwnersContent = existsSync(DOC_OWNERS_PATH) ? readFileSync3(DOC_OWNERS_PATH, "utf8") : null;
|
|
5815
6286
|
const manifestState = classifyDocOwnersManifest(docOwnersContent);
|
|
5816
6287
|
if (manifestState === "absent") {
|
|
5817
6288
|
console.log(`verify-dispatch --surfaces: no doc-ownership manifest at ${DOC_OWNERS_PATH} \u2014 dormant, no bindings to check.`);
|
|
@@ -5840,7 +6311,7 @@ function runSurfacesMode(surfacesArg) {
|
|
|
5840
6311
|
process.exit(0);
|
|
5841
6312
|
}
|
|
5842
6313
|
function runCheckBaselineMode(baselineFile) {
|
|
5843
|
-
const baseline = JSON.parse(
|
|
6314
|
+
const baseline = JSON.parse(readFileSync3(baselineFile, "utf8"));
|
|
5844
6315
|
const current = currentFindingCounts();
|
|
5845
6316
|
const unavailable = current.filter((c) => c.unavailable);
|
|
5846
6317
|
if (unavailable.length > 0) {
|
|
@@ -5867,8 +6338,9 @@ verify-dispatch --check-baseline: within budget.`);
|
|
|
5867
6338
|
process.exit(0);
|
|
5868
6339
|
}
|
|
5869
6340
|
async function runGateMode(trancheSlug, taskId) {
|
|
6341
|
+
const principalAllowlist = principalsOrExit("");
|
|
5870
6342
|
sh("git", ["fetch", "origin", "main", "--quiet"]);
|
|
5871
|
-
const repo = await
|
|
6343
|
+
const repo = await resolveTargetRepository();
|
|
5872
6344
|
const token = await resolveGithubToken();
|
|
5873
6345
|
if (!repo || !token) {
|
|
5874
6346
|
console.error("verify-dispatch severity:infra \u2014 could not resolve a GitHub repo/token (set AEG_REPO / GITHUB_TOKEN, or `gh auth login`). Cannot evaluate forge-dependent predicates.");
|
|
@@ -5895,7 +6367,7 @@ async function runGateMode(trancheSlug, taskId) {
|
|
|
5895
6367
|
provenanceByIssue = await fetchProvenance([priorTaskRaw.issue], repo.owner, repo.repo, token);
|
|
5896
6368
|
}
|
|
5897
6369
|
const priorTask = resolvePriorTask(tranche, taskId, branchPrs, provenanceByIssue, repo);
|
|
5898
|
-
const
|
|
6370
|
+
const archival = await resolvePriorTrancheArchival(task.projects, trancheSlug, repo);
|
|
5899
6371
|
const gateResult = checkDispatchReadiness({
|
|
5900
6372
|
trancheSlug,
|
|
5901
6373
|
task,
|
|
@@ -5904,7 +6376,8 @@ async function runGateMode(trancheSlug, taskId) {
|
|
|
5904
6376
|
dependsOn,
|
|
5905
6377
|
conflictsWith,
|
|
5906
6378
|
priorTask,
|
|
5907
|
-
priorTrancheArchival
|
|
6379
|
+
priorTrancheArchival: archival.facts,
|
|
6380
|
+
principalAllowlist
|
|
5908
6381
|
});
|
|
5909
6382
|
const ambiguousEdge = await checkBareEdgeQualification(task.dependsOn, task.conflictsWith, issueJson?.milestone ?? null, repo);
|
|
5910
6383
|
const leftover = computeLeftover(trancheSlug, taskId);
|
|
@@ -5917,6 +6390,8 @@ verify-dispatch: ${trancheSlug} task ${taskId}
|
|
|
5917
6390
|
console.log(`dispatch-readiness: ${gateResult.ready ? "READY" : "NOT READY"}`);
|
|
5918
6391
|
for (const b of gateResult.blockers)
|
|
5919
6392
|
console.log(` \u2717 ${b}`);
|
|
6393
|
+
if (archival.infraFailure)
|
|
6394
|
+
console.log(` \u2717 ${archival.infraFailure}`);
|
|
5920
6395
|
if (ambiguousEdge)
|
|
5921
6396
|
console.log(` \u2717 ${ambiguousEdge}`);
|
|
5922
6397
|
console.log(`
|
|
@@ -5931,14 +6406,16 @@ baseline (informational \u2014 captured this run, not a committed file):`);
|
|
|
5931
6406
|
if (raw.diagnostic)
|
|
5932
6407
|
console.log(` \u21B3 ${raw.diagnostic}`);
|
|
5933
6408
|
}
|
|
5934
|
-
const
|
|
6409
|
+
const gateReady = gateResult.ready && archival.infraFailure === null;
|
|
6410
|
+
const overallReady = gateReady && !leftoverBlocksDispatch(leftover.verdict, { existingWork: EXISTING_WORK }) && !ambiguousEdge;
|
|
5935
6411
|
console.log(`
|
|
5936
6412
|
verify-dispatch: ${overallReady ? "READY TO DISPATCH" : "NOT READY"}`);
|
|
5937
6413
|
process.exit(overallReady ? 0 : 1);
|
|
5938
6414
|
}
|
|
5939
6415
|
async function runGateModeForIssue(issueNumber) {
|
|
6416
|
+
const principalAllowlist = principalsOrExit("");
|
|
5940
6417
|
sh("git", ["fetch", "origin", "main", "--quiet"]);
|
|
5941
|
-
const repo = await
|
|
6418
|
+
const repo = await resolveTargetRepository();
|
|
5942
6419
|
const token = await resolveGithubToken();
|
|
5943
6420
|
if (!repo || !token) {
|
|
5944
6421
|
console.error("verify-dispatch severity:infra \u2014 could not resolve a GitHub repo/token (set AEG_REPO / GITHUB_TOKEN, or `gh auth login`). Cannot evaluate forge-dependent predicates.");
|
|
@@ -5976,7 +6453,8 @@ async function runGateModeForIssue(issueNumber) {
|
|
|
5976
6453
|
dependsOn,
|
|
5977
6454
|
conflictsWith,
|
|
5978
6455
|
priorTask: null,
|
|
5979
|
-
priorTrancheArchival: []
|
|
6456
|
+
priorTrancheArchival: [],
|
|
6457
|
+
principalAllowlist
|
|
5980
6458
|
});
|
|
5981
6459
|
const ambiguousEdge = await checkBareEdgeQualification(dependsOnIds, conflictsWithIds, issueJson.milestone, repo);
|
|
5982
6460
|
const leftover = computeLeftoverForIssue(issueNumber);
|
|
@@ -6082,5 +6560,7 @@ export {
|
|
|
6082
6560
|
fetchIssueStatesBatch,
|
|
6083
6561
|
resolveConflictsWith,
|
|
6084
6562
|
resolveDependsOn,
|
|
6085
|
-
resolvePremiseBriefText
|
|
6563
|
+
resolvePremiseBriefText,
|
|
6564
|
+
resolveTargetRepository,
|
|
6565
|
+
resolveTargetRoot
|
|
6086
6566
|
};
|