@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
|
@@ -39,7 +39,6 @@ var GATE_AUDIENCE = {
|
|
|
39
39
|
};
|
|
40
40
|
var NON_GATE_BINS = [
|
|
41
41
|
"archive-task",
|
|
42
|
-
"assign-task-issue",
|
|
43
42
|
"dead-branch-audit",
|
|
44
43
|
"eval-agent-compliance",
|
|
45
44
|
"open-issue",
|
|
@@ -302,6 +301,25 @@ async function runAsync(args) {
|
|
|
302
301
|
function ghApiGet(path) {
|
|
303
302
|
return JSON.parse(run(["api", path]));
|
|
304
303
|
}
|
|
304
|
+
var MAX_PER_PAGE = 100;
|
|
305
|
+
var MAX_PAGES = 100;
|
|
306
|
+
async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
307
|
+
const [base = pathWithoutPage, query = ""] = pathWithoutPage.split("?");
|
|
308
|
+
const params = new URLSearchParams(query);
|
|
309
|
+
params.set("per_page", String(MAX_PER_PAGE));
|
|
310
|
+
const all = [];
|
|
311
|
+
for (let page = 1;page <= MAX_PAGES; page++) {
|
|
312
|
+
params.set("page", String(page));
|
|
313
|
+
const args = ["api", `${base}?${params.toString()}`];
|
|
314
|
+
if (opts?.jq)
|
|
315
|
+
args.push("-q", opts.jq);
|
|
316
|
+
const batch = JSON.parse(await runAsync(args));
|
|
317
|
+
all.push(...batch);
|
|
318
|
+
if (batch.length < MAX_PER_PAGE)
|
|
319
|
+
return all;
|
|
320
|
+
}
|
|
321
|
+
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
322
|
+
}
|
|
305
323
|
function issueListByLabelArgs(owner, repo, label) {
|
|
306
324
|
return [
|
|
307
325
|
"issue",
|
|
@@ -713,6 +731,10 @@ function intentGoalForSlug(description, slug) {
|
|
|
713
731
|
function matchesLegacyMilestone(milestones, slug) {
|
|
714
732
|
return milestones.find((m) => m.title === slug) ?? null;
|
|
715
733
|
}
|
|
734
|
+
var TRANCHE_SLUG_SHAPE = /^[a-z0-9]+(?:-[a-z0-9]+)*-v\d+$/;
|
|
735
|
+
function slugShapedTitles(milestones) {
|
|
736
|
+
return milestones.map((m) => m.title).filter((t) => TRANCHE_SLUG_SHAPE.test(t));
|
|
737
|
+
}
|
|
716
738
|
function factsFromLegacyMilestone(milestone) {
|
|
717
739
|
return {
|
|
718
740
|
goal: milestone.description ?? "",
|
|
@@ -746,6 +768,105 @@ function findMilestoneForSlug(owner, repo, slug) {
|
|
|
746
768
|
return resolveLegacyFacts(legacy, issues);
|
|
747
769
|
return { goal: goalFromMilestones(milestones, slug), lifecycle: lifecycleFromIssues(issues) };
|
|
748
770
|
}
|
|
771
|
+
function trancheSlugsFromLabels(labels) {
|
|
772
|
+
const slugs = [];
|
|
773
|
+
for (const l of labels) {
|
|
774
|
+
const slug = trancheSlugOf(l.name);
|
|
775
|
+
if (slug !== null)
|
|
776
|
+
slugs.push(slug);
|
|
777
|
+
}
|
|
778
|
+
return slugs;
|
|
779
|
+
}
|
|
780
|
+
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
781
|
+
const read = (fetch2) => options.retryFailedReads ? retryOnce(fetch2) : fetch2();
|
|
782
|
+
const [milestones, labels] = await Promise.all([
|
|
783
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
784
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
785
|
+
]);
|
|
786
|
+
const active = [];
|
|
787
|
+
const archived = [];
|
|
788
|
+
const facts = new Map;
|
|
789
|
+
const legacySlugs = new Set(slugShapedTitles(milestones));
|
|
790
|
+
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
791
|
+
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
792
|
+
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
793
|
+
const uniqueLegacySlugs = [...legacySlugs];
|
|
794
|
+
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
795
|
+
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
796
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
797
|
+
]);
|
|
798
|
+
const issuesBySlug = new Map;
|
|
799
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
800
|
+
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
801
|
+
});
|
|
802
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
803
|
+
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
804
|
+
});
|
|
805
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
806
|
+
const m = legacyMilestoneBySlug.get(slug);
|
|
807
|
+
if (!m)
|
|
808
|
+
return;
|
|
809
|
+
const ref = { slug, goal: m.description ?? "" };
|
|
810
|
+
const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
|
|
811
|
+
if (f.lifecycle === "complete")
|
|
812
|
+
archived.push(ref);
|
|
813
|
+
else if (f.lifecycle === "active")
|
|
814
|
+
active.push(ref);
|
|
815
|
+
facts.set(slug, f);
|
|
816
|
+
});
|
|
817
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
818
|
+
const issues = newPathIssuesBySlug[i] ?? [];
|
|
819
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
820
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
821
|
+
const f = { goal, lifecycle };
|
|
822
|
+
facts.set(slug, f);
|
|
823
|
+
if (lifecycle === "active")
|
|
824
|
+
active.push({ slug, goal });
|
|
825
|
+
else if (lifecycle === "complete")
|
|
826
|
+
archived.push({ slug, goal });
|
|
827
|
+
});
|
|
828
|
+
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
829
|
+
}
|
|
830
|
+
async function retryOnce(fetch2) {
|
|
831
|
+
try {
|
|
832
|
+
return await fetch2();
|
|
833
|
+
} catch {
|
|
834
|
+
return fetch2();
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
|
|
838
|
+
const [milestones, labels, issues] = await Promise.all([
|
|
839
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
840
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`),
|
|
841
|
+
ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))
|
|
842
|
+
]);
|
|
843
|
+
const active = [];
|
|
844
|
+
const archived = [];
|
|
845
|
+
const facts = new Map;
|
|
846
|
+
const legacySlugs = new Set;
|
|
847
|
+
const legacyMilestone = slugShapedTitles(milestones).includes(slug) ? matchesLegacyMilestone(milestones, slug) : null;
|
|
848
|
+
if (legacyMilestone) {
|
|
849
|
+
legacySlugs.add(slug);
|
|
850
|
+
const ref = { slug, goal: legacyMilestone.description ?? "" };
|
|
851
|
+
const f = resolveLegacyFacts(legacyMilestone, issues);
|
|
852
|
+
if (f.lifecycle === "complete")
|
|
853
|
+
archived.push(ref);
|
|
854
|
+
else if (f.lifecycle === "active")
|
|
855
|
+
active.push(ref);
|
|
856
|
+
facts.set(slug, f);
|
|
857
|
+
} else if (trancheSlugsFromLabels(labels).includes(slug)) {
|
|
858
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
859
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
860
|
+
facts.set(slug, { goal, lifecycle });
|
|
861
|
+
if (lifecycle === "active")
|
|
862
|
+
active.push({ slug, goal });
|
|
863
|
+
else if (lifecycle === "complete")
|
|
864
|
+
archived.push({ slug, goal });
|
|
865
|
+
}
|
|
866
|
+
const openLegacyTitles = new Set(slugShapedTitles(milestones.filter((m) => m.state === "open")));
|
|
867
|
+
const otherOpenLegacySlugs = [...openLegacyTitles].filter((t) => t !== slug);
|
|
868
|
+
return { active, archived, facts, legacySlugs, otherOpenLegacySlugs };
|
|
869
|
+
}
|
|
749
870
|
|
|
750
871
|
// ../../packages/aeg-forge-state/src/derive-from-forge.ts
|
|
751
872
|
function trancheFromIssues(slug, issues, known) {
|
|
@@ -1406,6 +1527,125 @@ var graphql2 = withDefaults3(request, {
|
|
|
1406
1527
|
method: "POST",
|
|
1407
1528
|
url: "/graphql"
|
|
1408
1529
|
});
|
|
1530
|
+
|
|
1531
|
+
// ../../packages/aeg-forge-state/src/fetch-provenance.ts
|
|
1532
|
+
var PROVENANCE_PATTERN = /^###\s+AEG provenance\b/im;
|
|
1533
|
+
function provenanceMatchesIssue(text, issueNum) {
|
|
1534
|
+
if (!PROVENANCE_PATTERN.test(text))
|
|
1535
|
+
return false;
|
|
1536
|
+
const m = text.match(/^-\s*Issue:\s*#(\d+)/im);
|
|
1537
|
+
return m !== null && Number(m[1]) === issueNum;
|
|
1538
|
+
}
|
|
1539
|
+
function isPrCloser(closer) {
|
|
1540
|
+
return closer !== null && typeof closer.number === "number";
|
|
1541
|
+
}
|
|
1542
|
+
async function fetchProvenanceViaCrossReferences(issueNums, owner, repo, token) {
|
|
1543
|
+
const result = new Map;
|
|
1544
|
+
if (issueNums.length === 0)
|
|
1545
|
+
return result;
|
|
1546
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1547
|
+
const perIssue = issueNums.map((n) => `
|
|
1548
|
+
i_${n}: issue(number: ${n}) {
|
|
1549
|
+
timelineItems(first: 50, itemTypes: [CROSS_REFERENCED_EVENT]) {
|
|
1550
|
+
nodes {
|
|
1551
|
+
... on CrossReferencedEvent {
|
|
1552
|
+
source {
|
|
1553
|
+
... on PullRequest {
|
|
1554
|
+
number
|
|
1555
|
+
body
|
|
1556
|
+
comments(first: 50) { nodes { body } }
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}`).join("");
|
|
1563
|
+
const query = `query ProvenanceCrossRef($owner: String!, $repo: String!) {
|
|
1564
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1565
|
+
}
|
|
1566
|
+
}`;
|
|
1567
|
+
let response;
|
|
1568
|
+
try {
|
|
1569
|
+
response = await client(query, { owner, repo });
|
|
1570
|
+
} catch {
|
|
1571
|
+
return result;
|
|
1572
|
+
}
|
|
1573
|
+
if (!response.repository)
|
|
1574
|
+
return result;
|
|
1575
|
+
for (const n of issueNums) {
|
|
1576
|
+
const raw = response.repository[`i_${n}`];
|
|
1577
|
+
const nodes = raw?.timelineItems?.nodes ?? [];
|
|
1578
|
+
const found = nodes.some(({ source }) => {
|
|
1579
|
+
if (!source || typeof source.number !== "number")
|
|
1580
|
+
return false;
|
|
1581
|
+
const pr = source;
|
|
1582
|
+
if (provenanceMatchesIssue(pr.body ?? "", n))
|
|
1583
|
+
return true;
|
|
1584
|
+
return pr.comments.nodes.some((c) => provenanceMatchesIssue(c.body, n));
|
|
1585
|
+
});
|
|
1586
|
+
result.set(n, found);
|
|
1587
|
+
}
|
|
1588
|
+
return result;
|
|
1589
|
+
}
|
|
1590
|
+
async function fetchProvenance(issueNums, owner, repo, token) {
|
|
1591
|
+
const result = new Map;
|
|
1592
|
+
if (issueNums.length === 0)
|
|
1593
|
+
return result;
|
|
1594
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1595
|
+
const perIssue = issueNums.map((n) => `
|
|
1596
|
+
i_${n}: issue(number: ${n}) {
|
|
1597
|
+
timelineItems(last: 1, itemTypes: [CLOSED_EVENT]) {
|
|
1598
|
+
nodes {
|
|
1599
|
+
... on ClosedEvent {
|
|
1600
|
+
closer {
|
|
1601
|
+
... on PullRequest {
|
|
1602
|
+
number
|
|
1603
|
+
body
|
|
1604
|
+
comments(first: 50) {
|
|
1605
|
+
nodes { body }
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}`).join("");
|
|
1613
|
+
const query = `query Provenance($owner: String!, $repo: String!) {
|
|
1614
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1615
|
+
}
|
|
1616
|
+
}`;
|
|
1617
|
+
let response;
|
|
1618
|
+
try {
|
|
1619
|
+
response = await client(query, { owner, repo });
|
|
1620
|
+
} catch {
|
|
1621
|
+
return result;
|
|
1622
|
+
}
|
|
1623
|
+
if (!response.repository)
|
|
1624
|
+
return result;
|
|
1625
|
+
const needsFallback = [];
|
|
1626
|
+
for (const n of issueNums) {
|
|
1627
|
+
const raw = response.repository[`i_${n}`];
|
|
1628
|
+
if (!raw) {
|
|
1629
|
+
result.set(n, false);
|
|
1630
|
+
continue;
|
|
1631
|
+
}
|
|
1632
|
+
const closer = raw.timelineItems?.nodes?.[0]?.closer;
|
|
1633
|
+
const c = closer ?? null;
|
|
1634
|
+
if (!isPrCloser(c)) {
|
|
1635
|
+
needsFallback.push(n);
|
|
1636
|
+
continue;
|
|
1637
|
+
}
|
|
1638
|
+
const bodyHas = PROVENANCE_PATTERN.test(c.body ?? "");
|
|
1639
|
+
const commentHas = c.comments.nodes.some((x) => PROVENANCE_PATTERN.test(x.body));
|
|
1640
|
+
result.set(n, bodyHas || commentHas);
|
|
1641
|
+
}
|
|
1642
|
+
if (needsFallback.length > 0) {
|
|
1643
|
+
const fallback = await fetchProvenanceViaCrossReferences(needsFallback, owner, repo, token);
|
|
1644
|
+
for (const [n, found] of fallback)
|
|
1645
|
+
result.set(n, found);
|
|
1646
|
+
}
|
|
1647
|
+
return result;
|
|
1648
|
+
}
|
|
1409
1649
|
// ../../packages/aeg-forge-state/src/github-token.ts
|
|
1410
1650
|
import { execFile as execFile2 } from "node:child_process";
|
|
1411
1651
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -1635,6 +1875,52 @@ function describeError(err) {
|
|
|
1635
1875
|
return err;
|
|
1636
1876
|
return "unknown error";
|
|
1637
1877
|
}
|
|
1878
|
+
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1879
|
+
function defaultPriorTrancheArchivalDeps() {
|
|
1880
|
+
return {
|
|
1881
|
+
activeTranches: async (excludeSlug, repo) => {
|
|
1882
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo, { retryFailedReads: true });
|
|
1883
|
+
return index.active.filter((m) => m.slug !== excludeSlug).map((m) => {
|
|
1884
|
+
const issues = index.issuesBySlug?.get(m.slug);
|
|
1885
|
+
if (!issues)
|
|
1886
|
+
throw new Error(`the Milestone index holds no Issue list for tranche \`${m.slug}\``);
|
|
1887
|
+
return { slug: m.slug, issues };
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
function reason(err) {
|
|
1893
|
+
return err instanceof Error ? err.message.split(`
|
|
1894
|
+
`)[0] ?? "failed" : String(err);
|
|
1895
|
+
}
|
|
1896
|
+
async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
|
|
1897
|
+
if (projects.length === 0)
|
|
1898
|
+
return { facts: [], infraFailure: null };
|
|
1899
|
+
let candidates;
|
|
1900
|
+
try {
|
|
1901
|
+
candidates = await deps.activeTranches(excludeSlug, repo);
|
|
1902
|
+
} catch (err) {
|
|
1903
|
+
return {
|
|
1904
|
+
facts: [],
|
|
1905
|
+
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
const tasksBySlug = new Map(candidates.map((c) => [c.slug, tasksFromIssues(c.issues)]));
|
|
1909
|
+
const facts = [];
|
|
1910
|
+
for (const project of projects) {
|
|
1911
|
+
let found = null;
|
|
1912
|
+
for (const { slug, issues } of candidates) {
|
|
1913
|
+
if (!(tasksBySlug.get(slug) ?? []).some((t) => t.projects.includes(project)))
|
|
1914
|
+
continue;
|
|
1915
|
+
if (!issues.some((issue) => issue.state === "OPEN")) {
|
|
1916
|
+
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1917
|
+
break;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1921
|
+
}
|
|
1922
|
+
return { facts, infraFailure: null };
|
|
1923
|
+
}
|
|
1638
1924
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1639
1925
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
1640
1926
|
const result = new Map;
|
|
@@ -1709,6 +1995,10 @@ function buildQuery(issueNumbers) {
|
|
|
1709
1995
|
}
|
|
1710
1996
|
}`;
|
|
1711
1997
|
}
|
|
1998
|
+
// ../../packages/aeg-forge-state/src/list-issue-milestones.ts
|
|
1999
|
+
function issueMilestonesFromIssues(issues) {
|
|
2000
|
+
return issues.filter((i) => i.state === "OPEN").map((i) => ({ issue: i.number, milestoneTitle: i.milestone?.title ?? null }));
|
|
2001
|
+
}
|
|
1712
2002
|
// ../../packages/aeg-forge-state/src/resolve-repo.ts
|
|
1713
2003
|
import { execFile as execFile3 } from "node:child_process";
|
|
1714
2004
|
import { promisify as promisify3 } from "node:util";
|
|
@@ -1771,7 +2061,8 @@ var ANCHOR_FIELDS = [
|
|
|
1771
2061
|
"PREMISE",
|
|
1772
2062
|
"TEST-PLAN",
|
|
1773
2063
|
"EVIDENCE",
|
|
1774
|
-
"BEYOND-SURFACE"
|
|
2064
|
+
"BEYOND-SURFACE",
|
|
2065
|
+
"LIVE"
|
|
1775
2066
|
];
|
|
1776
2067
|
function anchoredRegionBounds(body, field) {
|
|
1777
2068
|
const masked = maskCode(body);
|
|
@@ -1972,7 +2263,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
|
1972
2263
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1973
2264
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1974
2265
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
1975
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
1976
2266
|
function isPrincipal(login, principalAllowlist) {
|
|
1977
2267
|
if (login === null)
|
|
1978
2268
|
return false;
|
|
@@ -1991,6 +2281,14 @@ var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(
|
|
|
1991
2281
|
var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1992
2282
|
var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1993
2283
|
var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2284
|
+
var MANIFEST_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Manifest version:\s*(\d+)\s*$/im;
|
|
2285
|
+
var PAUSE_BOUND_RULING_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Pause-bound ruling:\s*(?:(\S+)\|(\S+)\|([0-9a-f]{64})|\(none\))\s*$/im;
|
|
2286
|
+
function extractPauseBoundRuling(comment) {
|
|
2287
|
+
const m = comment.match(PAUSE_BOUND_RULING_PATTERN);
|
|
2288
|
+
if (!m)
|
|
2289
|
+
return;
|
|
2290
|
+
return m[1] ? { rulingId: m[1], pauseId: m[2], contentDigest: m[3] } : null;
|
|
2291
|
+
}
|
|
1994
2292
|
function firstFiveLines(comment) {
|
|
1995
2293
|
return comment.split(`
|
|
1996
2294
|
`).slice(0, 5).join(`
|
|
@@ -2084,6 +2382,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2084
2382
|
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
2085
2383
|
};
|
|
2086
2384
|
}
|
|
2385
|
+
const versionMatch = latest.match(MANIFEST_VERSION_PATTERN);
|
|
2386
|
+
const pauseBoundRuling = extractPauseBoundRuling(latest);
|
|
2087
2387
|
return {
|
|
2088
2388
|
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
2089
2389
|
headSha: extractHeadSha(latest),
|
|
@@ -2092,6 +2392,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2092
2392
|
briefHash: extractBriefHash(latest),
|
|
2093
2393
|
policyDigest: extractPolicyDigest(latest),
|
|
2094
2394
|
baseSha: extractBaseSha(latest),
|
|
2395
|
+
...versionMatch ? { manifestVersion: Number.parseInt(versionMatch[1], 10) } : {},
|
|
2396
|
+
...pauseBoundRuling === undefined ? {} : { pauseBoundRuling },
|
|
2095
2397
|
findingSeverities: extractFindingSeverities(latest),
|
|
2096
2398
|
danglingNote: null
|
|
2097
2399
|
};
|
|
@@ -2102,6 +2404,16 @@ function extractCodeReviewVerdict(comments) {
|
|
|
2102
2404
|
function extractSecurityReviewVerdict(comments) {
|
|
2103
2405
|
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
2104
2406
|
}
|
|
2407
|
+
|
|
2408
|
+
// ../../packages/aeg-core/src/review-status.ts
|
|
2409
|
+
var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-(\d+)\s*-->/i;
|
|
2410
|
+
function parseDeveloperRoundMarker(body) {
|
|
2411
|
+
const m = body.match(DEVELOPER_ROUND_MARKER);
|
|
2412
|
+
if (!m)
|
|
2413
|
+
return null;
|
|
2414
|
+
const n = Number(m[1]);
|
|
2415
|
+
return Number.isFinite(n) ? n : null;
|
|
2416
|
+
}
|
|
2105
2417
|
// ../../packages/aeg-core/src/report-tokens.ts
|
|
2106
2418
|
var DASH_LOOKALIKES = {
|
|
2107
2419
|
"-": "‑",
|
|
@@ -2433,11 +2745,13 @@ var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
|
2433
2745
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2434
2746
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2435
2747
|
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2748
|
+
var DEFAULT_READY_PUSH_TIMEOUT_MINUTES = 20;
|
|
2436
2749
|
var DEFAULT_REVIEW_POLICY = {
|
|
2437
2750
|
codeReviewThreshold: "BLOCKER",
|
|
2438
2751
|
securityThreshold: "HIGH",
|
|
2439
2752
|
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2440
|
-
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2753
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES,
|
|
2754
|
+
readyPushTimeoutMinutes: DEFAULT_READY_PUSH_TIMEOUT_MINUTES
|
|
2441
2755
|
};
|
|
2442
2756
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2443
2757
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2797,14 +3111,14 @@ function checkTestPlan(prBody) {
|
|
|
2797
3111
|
const region = located.found ? located.section : prBody;
|
|
2798
3112
|
if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
|
|
2799
3113
|
return { status: "pass", errors: [] };
|
|
2800
|
-
if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
|
|
3114
|
+
if (/\*\*\[(?:agent|principal|live)\]\*\*/.test(region))
|
|
2801
3115
|
return { status: "pass", errors: [] };
|
|
2802
3116
|
if (located.found && extractFencedBlocks(region).length > 0)
|
|
2803
3117
|
return { status: "pass", errors: [] };
|
|
2804
3118
|
return {
|
|
2805
3119
|
status: "fail",
|
|
2806
3120
|
errors: [
|
|
2807
|
-
"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
|
|
3121
|
+
"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."
|
|
2808
3122
|
]
|
|
2809
3123
|
};
|
|
2810
3124
|
}
|
|
@@ -3426,6 +3740,375 @@ function checkPrReportDensity(prBody) {
|
|
|
3426
3740
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3427
3741
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3428
3742
|
}
|
|
3743
|
+
// ../../packages/aeg-core/src/prose-rules.ts
|
|
3744
|
+
var RETIRED_GLOBAL_EXEMPTIONS = [
|
|
3745
|
+
"docs/decisions-legacy.md",
|
|
3746
|
+
"apps/herald-ai/docs/",
|
|
3747
|
+
"apps/vada-ai/docs/",
|
|
3748
|
+
"aeg-root/tranches/completed/",
|
|
3749
|
+
"packages/aeg-core/src/docs/published-prose",
|
|
3750
|
+
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
3751
|
+
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
3752
|
+
"/fixtures/",
|
|
3753
|
+
"/node_modules/",
|
|
3754
|
+
"/.next/",
|
|
3755
|
+
"/.turbo/"
|
|
3756
|
+
];
|
|
3757
|
+
var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
|
|
3758
|
+
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
3759
|
+
var RETIRED_PATTERN_EXEMPTIONS = {
|
|
3760
|
+
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
3761
|
+
[String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
|
|
3762
|
+
"docs-index.md",
|
|
3763
|
+
"apps/vada-ai/specs/legacy/README.md",
|
|
3764
|
+
"apps/vada-ai/specs/vada-product-spec.md",
|
|
3765
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3766
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3767
|
+
],
|
|
3768
|
+
"decisions-legacy": [
|
|
3769
|
+
"packages/aeg-core/src/file-classify.ts",
|
|
3770
|
+
"packages/aeg-core/src/file-classify.test.ts",
|
|
3771
|
+
"packages/aeg-core/src/pr-tier.test.ts",
|
|
3772
|
+
"docs-index.md",
|
|
3773
|
+
".claude/skills/database/SKILL.md",
|
|
3774
|
+
".claude/skills/vada-architecture/SKILL.md",
|
|
3775
|
+
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
3776
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3777
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3778
|
+
],
|
|
3779
|
+
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
3780
|
+
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
3781
|
+
};
|
|
3782
|
+
var retiredPatterns = [
|
|
3783
|
+
String.raw`\bD-[0-9]{3}\b`,
|
|
3784
|
+
"D-(###|NNN|nnn|xxx)",
|
|
3785
|
+
"decision (entry|logged)",
|
|
3786
|
+
"decision-log entry",
|
|
3787
|
+
"decision log entry",
|
|
3788
|
+
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
3789
|
+
"decision-log",
|
|
3790
|
+
"decision entr",
|
|
3791
|
+
"decisions? (are |is )?logged",
|
|
3792
|
+
"log entries",
|
|
3793
|
+
String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
|
|
3794
|
+
"decisions-legacy",
|
|
3795
|
+
"CONTRADICTION",
|
|
3796
|
+
"assumes Tier 3",
|
|
3797
|
+
"Lock: ?YES",
|
|
3798
|
+
"Lock: ?NO",
|
|
3799
|
+
"lock approvals?",
|
|
3800
|
+
"approves locks",
|
|
3801
|
+
"Conforms to lock",
|
|
3802
|
+
"Challenges lock",
|
|
3803
|
+
"checkDecisionNumbersFresh",
|
|
3804
|
+
String.raw`roles/team-leader\.md`,
|
|
3805
|
+
String.raw`\(,`,
|
|
3806
|
+
String.raw`,\)`,
|
|
3807
|
+
String.raw`\(\.\)`,
|
|
3808
|
+
...PLAN_ON_DISK_PATTERNS
|
|
3809
|
+
];
|
|
3810
|
+
var published = [
|
|
3811
|
+
["decision-id", "a decision id", /\bD-\d{3,}\b/],
|
|
3812
|
+
["section-ref", "a section reference", /§/],
|
|
3813
|
+
["forge-number", "a forge number", /#\d+/],
|
|
3814
|
+
["retired-name", "the retired public name", /\bAEG\b/],
|
|
3815
|
+
["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
|
|
3816
|
+
[
|
|
3817
|
+
"label-vocabulary",
|
|
3818
|
+
"forge label vocabulary",
|
|
3819
|
+
/(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
|
|
3820
|
+
],
|
|
3821
|
+
["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
|
|
3822
|
+
["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
|
|
3823
|
+
[
|
|
3824
|
+
"internal-path",
|
|
3825
|
+
"a repo-internal file",
|
|
3826
|
+
/(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
|
|
3827
|
+
]
|
|
3828
|
+
];
|
|
3829
|
+
var DEFAULT_PROSE_RULES = [
|
|
3830
|
+
{
|
|
3831
|
+
id: "forge-number",
|
|
3832
|
+
group: "reader-resolvable",
|
|
3833
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3834
|
+
patterns: { prose: /#[0-9]{2,4}/g },
|
|
3835
|
+
flags: ["global"],
|
|
3836
|
+
message: "a forge number",
|
|
3837
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3838
|
+
exemptions: []
|
|
3839
|
+
},
|
|
3840
|
+
{
|
|
3841
|
+
id: "tranche-slug",
|
|
3842
|
+
group: "reader-resolvable",
|
|
3843
|
+
scopes: ["ships", "reader-facing", "product", "spec"],
|
|
3844
|
+
patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
|
|
3845
|
+
flags: ["global"],
|
|
3846
|
+
message: "an internal tranche slug",
|
|
3847
|
+
severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
|
|
3848
|
+
exemptions: []
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
id: "task-number",
|
|
3852
|
+
group: "reader-resolvable",
|
|
3853
|
+
scopes: ["spec"],
|
|
3854
|
+
patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
|
|
3855
|
+
flags: ["global", "ignore-case"],
|
|
3856
|
+
message: "a task number",
|
|
3857
|
+
severity: { spec: "error" },
|
|
3858
|
+
exemptions: []
|
|
3859
|
+
},
|
|
3860
|
+
{
|
|
3861
|
+
id: "source-comment-tranche-slug",
|
|
3862
|
+
group: "reader-resolvable",
|
|
3863
|
+
scopes: ["source-comment"],
|
|
3864
|
+
patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
|
|
3865
|
+
flags: ["global"],
|
|
3866
|
+
message: "a tranche-slug citation",
|
|
3867
|
+
severity: { "source-comment": "warning" },
|
|
3868
|
+
exemptions: []
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
id: "source-comment-forge-number",
|
|
3872
|
+
group: "reader-resolvable",
|
|
3873
|
+
scopes: ["source-comment"],
|
|
3874
|
+
patterns: { comment: /#[0-9]{2,}/g },
|
|
3875
|
+
flags: ["global"],
|
|
3876
|
+
message: "a forge-number citation",
|
|
3877
|
+
severity: { "source-comment": "warning" },
|
|
3878
|
+
exemptions: []
|
|
3879
|
+
},
|
|
3880
|
+
{
|
|
3881
|
+
id: "legacy-batch-name",
|
|
3882
|
+
group: "reader-resolvable",
|
|
3883
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3884
|
+
patterns: {},
|
|
3885
|
+
flags: ["built-in"],
|
|
3886
|
+
message: "an internal tranche slug",
|
|
3887
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3888
|
+
exemptions: [],
|
|
3889
|
+
builtIn: true
|
|
3890
|
+
},
|
|
3891
|
+
{
|
|
3892
|
+
id: "coined-term",
|
|
3893
|
+
group: "reader-resolvable",
|
|
3894
|
+
scopes: ["ships", "reader-facing"],
|
|
3895
|
+
patterns: {},
|
|
3896
|
+
flags: ["built-in"],
|
|
3897
|
+
message: "uses coined term without defining it inline or linking the glossary",
|
|
3898
|
+
severity: { ships: "warning", "reader-facing": "warning" },
|
|
3899
|
+
exemptions: [],
|
|
3900
|
+
builtIn: true
|
|
3901
|
+
},
|
|
3902
|
+
...retiredPatterns.map((pattern, index) => ({
|
|
3903
|
+
id: `retired-vocabulary-${index + 1}`,
|
|
3904
|
+
group: "retired-vocabulary",
|
|
3905
|
+
scopes: ["repository"],
|
|
3906
|
+
patterns: { repository: pattern },
|
|
3907
|
+
flags: [],
|
|
3908
|
+
message: "retired vocabulary",
|
|
3909
|
+
severity: { repository: "error" },
|
|
3910
|
+
exemptions: RETIRED_GLOBAL_EXEMPTIONS,
|
|
3911
|
+
patternExemptions: RETIRED_PATTERN_EXEMPTIONS
|
|
3912
|
+
})),
|
|
3913
|
+
...published.map(([id, message, pattern]) => ({
|
|
3914
|
+
id,
|
|
3915
|
+
group: "published-prose",
|
|
3916
|
+
scopes: ["published"],
|
|
3917
|
+
patterns: { published: pattern },
|
|
3918
|
+
flags: [],
|
|
3919
|
+
message,
|
|
3920
|
+
severity: { published: "error" },
|
|
3921
|
+
exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
|
|
3922
|
+
}))
|
|
3923
|
+
];
|
|
3924
|
+
var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
|
|
3925
|
+
var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
|
|
3926
|
+
var RETIRED_SCOPES = ["repository"];
|
|
3927
|
+
var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
|
|
3928
|
+
function groupOfScope(scope) {
|
|
3929
|
+
if (RESOLVABLE_SCOPES.includes(scope))
|
|
3930
|
+
return "reader-resolvable";
|
|
3931
|
+
if (RETIRED_SCOPES.includes(scope))
|
|
3932
|
+
return "retired-vocabulary";
|
|
3933
|
+
return;
|
|
3934
|
+
}
|
|
3935
|
+
var CONFIGURED_PROSE_FLAGS = ["i", "u"];
|
|
3936
|
+
var CONFIGURED_PATTERN_MAX_LENGTH = 200;
|
|
3937
|
+
var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
|
|
3938
|
+
function allowedScopesFor(rule) {
|
|
3939
|
+
if (rule.builtIn)
|
|
3940
|
+
return rule.scopes;
|
|
3941
|
+
return rule.group === "retired-vocabulary" ? RETIRED_SCOPES : RESOLVABLE_SCOPES;
|
|
3942
|
+
}
|
|
3943
|
+
function normalizeRepoPath(entry) {
|
|
3944
|
+
let out = entry.replace(/\\/g, "/");
|
|
3945
|
+
while (out.startsWith("./"))
|
|
3946
|
+
out = out.slice(2);
|
|
3947
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3948
|
+
while (out.endsWith("/"))
|
|
3949
|
+
out = out.slice(0, -1);
|
|
3950
|
+
return out;
|
|
3951
|
+
}
|
|
3952
|
+
function isConfiguredExempt(path, exempt, repoRoot) {
|
|
3953
|
+
if (exempt.length === 0)
|
|
3954
|
+
return false;
|
|
3955
|
+
const root = repoRoot === undefined ? undefined : normalizeRepoPath(repoRoot);
|
|
3956
|
+
let rel = normalizeRepoPath(path);
|
|
3957
|
+
if (root && rel.startsWith(`${root}/`))
|
|
3958
|
+
rel = rel.slice(root.length + 1);
|
|
3959
|
+
return exempt.some((entry) => {
|
|
3960
|
+
const e = normalizeRepoPath(entry);
|
|
3961
|
+
return rel === e || rel.startsWith(`${e}/`);
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
function ruleReads(set, rule, path) {
|
|
3965
|
+
return !isConfiguredExempt(path, set.exempt, set.repoRoot) && !isConfiguredExempt(path, rule.exempt, set.repoRoot);
|
|
3966
|
+
}
|
|
3967
|
+
var RESOLVABLE_RUN_ORDER = [
|
|
3968
|
+
"forge-number",
|
|
3969
|
+
"tranche-slug",
|
|
3970
|
+
"legacy-batch-name",
|
|
3971
|
+
"task-number",
|
|
3972
|
+
"source-comment-tranche-slug",
|
|
3973
|
+
"source-comment-forge-number",
|
|
3974
|
+
"coined-term"
|
|
3975
|
+
];
|
|
3976
|
+
var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
|
|
3977
|
+
function scopeDefaultSeverity(scope, sourceCommentSeverity) {
|
|
3978
|
+
if (scope === "source-comment")
|
|
3979
|
+
return sourceCommentSeverity ?? "warning";
|
|
3980
|
+
if (scope === "repository")
|
|
3981
|
+
return "error";
|
|
3982
|
+
return "warning";
|
|
3983
|
+
}
|
|
3984
|
+
function applySeverity(scopes, base, setting) {
|
|
3985
|
+
const out = {};
|
|
3986
|
+
for (const scope of scopes) {
|
|
3987
|
+
const configured = typeof setting === "string" ? setting : setting?.[scope];
|
|
3988
|
+
const value = configured ?? base[scope];
|
|
3989
|
+
if (value !== undefined)
|
|
3990
|
+
out[scope] = value;
|
|
3991
|
+
}
|
|
3992
|
+
return out;
|
|
3993
|
+
}
|
|
3994
|
+
function defaultPatternFor(rule) {
|
|
3995
|
+
const cache = new Map;
|
|
3996
|
+
return (scope) => {
|
|
3997
|
+
if (cache.has(scope))
|
|
3998
|
+
return cache.get(scope) ?? null;
|
|
3999
|
+
const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
|
|
4000
|
+
const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
|
|
4001
|
+
cache.set(scope, compiled);
|
|
4002
|
+
return compiled;
|
|
4003
|
+
};
|
|
4004
|
+
}
|
|
4005
|
+
function customPatternFor(rule, global) {
|
|
4006
|
+
const cache = new Map;
|
|
4007
|
+
return (scope) => {
|
|
4008
|
+
if (cache.has(scope))
|
|
4009
|
+
return cache.get(scope) ?? null;
|
|
4010
|
+
const source = rule.patterns?.[scope] ?? rule.pattern;
|
|
4011
|
+
const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
|
|
4012
|
+
cache.set(scope, compiled);
|
|
4013
|
+
return compiled;
|
|
4014
|
+
};
|
|
4015
|
+
}
|
|
4016
|
+
function resolveProseRules(config = undefined, options = {}) {
|
|
4017
|
+
const rules = [];
|
|
4018
|
+
const defaults = config?.defaults ?? {};
|
|
4019
|
+
for (const rule of CONFIGURABLE_DEFAULT_RULES) {
|
|
4020
|
+
const override = defaults[rule.id];
|
|
4021
|
+
if (override === "off")
|
|
4022
|
+
continue;
|
|
4023
|
+
const group = rule.group;
|
|
4024
|
+
const scopes = override?.scopes ?? rule.scopes;
|
|
4025
|
+
const base = {};
|
|
4026
|
+
for (const scope of scopes) {
|
|
4027
|
+
base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4028
|
+
}
|
|
4029
|
+
rules.push({
|
|
4030
|
+
id: rule.id,
|
|
4031
|
+
group,
|
|
4032
|
+
custom: false,
|
|
4033
|
+
builtIn: rule.builtIn === true,
|
|
4034
|
+
scopes,
|
|
4035
|
+
message: rule.message,
|
|
4036
|
+
severity: applySeverity(scopes, base, override?.severity),
|
|
4037
|
+
exempt: override?.exempt ?? [],
|
|
4038
|
+
substringExempt: rule.exemptions,
|
|
4039
|
+
reportGroup: REPORT_GROUPS[rule.id],
|
|
4040
|
+
patternFor: defaultPatternFor(rule)
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4043
|
+
for (const rule of config?.custom ?? []) {
|
|
4044
|
+
const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
|
|
4045
|
+
const base = {};
|
|
4046
|
+
for (const scope of rule.scopes)
|
|
4047
|
+
base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4048
|
+
rules.push({
|
|
4049
|
+
id: rule.id,
|
|
4050
|
+
group,
|
|
4051
|
+
custom: true,
|
|
4052
|
+
builtIn: false,
|
|
4053
|
+
scopes: rule.scopes,
|
|
4054
|
+
message: rule.means,
|
|
4055
|
+
severity: applySeverity(rule.scopes, base, rule.severity),
|
|
4056
|
+
exempt: rule.exempt ?? [],
|
|
4057
|
+
substringExempt: [],
|
|
4058
|
+
patternFor: customPatternFor(rule, group === "reader-resolvable")
|
|
4059
|
+
});
|
|
4060
|
+
}
|
|
4061
|
+
if (options.decisionRecordsPath !== undefined)
|
|
4062
|
+
rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
|
|
4063
|
+
const order = (rule) => {
|
|
4064
|
+
const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
|
|
4065
|
+
return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
|
|
4066
|
+
};
|
|
4067
|
+
const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
|
|
4068
|
+
const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
|
|
4069
|
+
return {
|
|
4070
|
+
rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
|
|
4071
|
+
exempt: config?.exempt ?? [],
|
|
4072
|
+
repoRoot: options.repoRoot
|
|
4073
|
+
};
|
|
4074
|
+
}
|
|
4075
|
+
function rulesOfGroup(set, group) {
|
|
4076
|
+
return set.rules.filter((rule) => rule.group === group);
|
|
4077
|
+
}
|
|
4078
|
+
function rulesInScope(set, scope) {
|
|
4079
|
+
return set.rules.filter((rule) => rule.scopes.includes(scope));
|
|
4080
|
+
}
|
|
4081
|
+
var DEFAULT_PROSE_RULE_SET = resolveProseRules();
|
|
4082
|
+
var DECISION_RECORD_CITATION_ID = "decision-record-citation";
|
|
4083
|
+
var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
|
|
4084
|
+
var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
|
|
4085
|
+
function escapeRegExp(text) {
|
|
4086
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4087
|
+
}
|
|
4088
|
+
function decisionRecordCitationPattern(decisionRecordsPath) {
|
|
4089
|
+
const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
|
|
4090
|
+
return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
|
|
4091
|
+
}
|
|
4092
|
+
function decisionRecordCitationRule(decisionRecordsPath) {
|
|
4093
|
+
const folder = normalizeRepoPath(decisionRecordsPath);
|
|
4094
|
+
const pattern = decisionRecordCitationPattern(folder);
|
|
4095
|
+
const severity = {};
|
|
4096
|
+
for (const scope of DECISION_RECORD_CITATION_SCOPES)
|
|
4097
|
+
severity[scope] = "error";
|
|
4098
|
+
return {
|
|
4099
|
+
id: DECISION_RECORD_CITATION_ID,
|
|
4100
|
+
group: "reader-resolvable",
|
|
4101
|
+
custom: false,
|
|
4102
|
+
builtIn: false,
|
|
4103
|
+
scopes: DECISION_RECORD_CITATION_SCOPES,
|
|
4104
|
+
message: DECISION_RECORD_CITATION_MESSAGE,
|
|
4105
|
+
severity,
|
|
4106
|
+
exempt: [folder],
|
|
4107
|
+
substringExempt: [],
|
|
4108
|
+
patternFor: () => pattern
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
|
|
3429
4112
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3430
4113
|
var PRODUCT_SLUG_SCOPE = [
|
|
3431
4114
|
"apps/cli/src",
|
|
@@ -3437,8 +4120,8 @@ var PRODUCT_SLUG_SCOPE = [
|
|
|
3437
4120
|
function isUnderOrEqual(path, prefix) {
|
|
3438
4121
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3439
4122
|
}
|
|
3440
|
-
function isProductScopeFile(path) {
|
|
3441
|
-
return
|
|
4123
|
+
function isProductScopeFile(path, productPaths) {
|
|
4124
|
+
return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)));
|
|
3442
4125
|
}
|
|
3443
4126
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3444
4127
|
function shipsArchivePrefix(shipsPrefix) {
|
|
@@ -3446,13 +4129,7 @@ function shipsArchivePrefix(shipsPrefix) {
|
|
|
3446
4129
|
}
|
|
3447
4130
|
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3448
4131
|
function normalizeSpecPath(entry) {
|
|
3449
|
-
|
|
3450
|
-
while (out.startsWith("./"))
|
|
3451
|
-
out = out.slice(2);
|
|
3452
|
-
out = out.replace(/\/{2,}/g, "/");
|
|
3453
|
-
while (out.endsWith("/"))
|
|
3454
|
-
out = out.slice(0, -1);
|
|
3455
|
-
return out;
|
|
4132
|
+
return normalizeRepoPath(entry);
|
|
3456
4133
|
}
|
|
3457
4134
|
function isSpecFile2(path, specPaths) {
|
|
3458
4135
|
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
@@ -3464,7 +4141,7 @@ function isSpecFile2(path, specPaths) {
|
|
|
3464
4141
|
function isClaudeMdFile(path) {
|
|
3465
4142
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3466
4143
|
}
|
|
3467
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4144
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS, productPaths = PRODUCT_SLUG_SCOPE) {
|
|
3468
4145
|
if (path.startsWith(shipsPrefix)) {
|
|
3469
4146
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3470
4147
|
}
|
|
@@ -3475,7 +4152,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
3475
4152
|
return "internal";
|
|
3476
4153
|
if (isSpecFile2(path, specPaths))
|
|
3477
4154
|
return "spec";
|
|
3478
|
-
if (isProductScopeFile(path))
|
|
4155
|
+
if (isProductScopeFile(path, productPaths))
|
|
3479
4156
|
return "product";
|
|
3480
4157
|
return null;
|
|
3481
4158
|
}
|
|
@@ -3500,9 +4177,16 @@ function lineAt(content, index) {
|
|
|
3500
4177
|
}
|
|
3501
4178
|
return line;
|
|
3502
4179
|
}
|
|
3503
|
-
var
|
|
3504
|
-
var
|
|
3505
|
-
|
|
4180
|
+
var readerRules = rulesForGroup("reader-resolvable");
|
|
4181
|
+
var readerPattern = (id, scope = "prose") => {
|
|
4182
|
+
const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
|
|
4183
|
+
if (!(pattern instanceof RegExp))
|
|
4184
|
+
throw new Error(`default prose rule ${id} has no ${scope} pattern`);
|
|
4185
|
+
return pattern;
|
|
4186
|
+
};
|
|
4187
|
+
var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
|
|
4188
|
+
var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
|
|
4189
|
+
var TASK_NUMBER_PATTERN = readerPattern("task-number");
|
|
3506
4190
|
function legacySlugPattern(legacySlugs) {
|
|
3507
4191
|
if (legacySlugs.length === 0)
|
|
3508
4192
|
return null;
|
|
@@ -3512,48 +4196,61 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3512
4196
|
function specGrandfatherPaths(specGrandfather) {
|
|
3513
4197
|
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3514
4198
|
}
|
|
3515
|
-
|
|
4199
|
+
var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
|
|
4200
|
+
function referenceRulesFor(set, cls) {
|
|
4201
|
+
return rulesInScope(set, cls).filter((rule) => rule.group === "reader-resolvable" && rule.id !== "coined-term");
|
|
4202
|
+
}
|
|
4203
|
+
function citations(pattern, text, group) {
|
|
4204
|
+
const out = [];
|
|
4205
|
+
const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
|
|
4206
|
+
re.lastIndex = 0;
|
|
4207
|
+
let match = re.exec(text);
|
|
4208
|
+
while (match !== null) {
|
|
4209
|
+
if (match[0] === "") {
|
|
4210
|
+
re.lastIndex++;
|
|
4211
|
+
} else {
|
|
4212
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4213
|
+
out.push({ cited, index: match.index + match[0].indexOf(cited) });
|
|
4214
|
+
}
|
|
4215
|
+
match = re.exec(text);
|
|
4216
|
+
}
|
|
4217
|
+
re.lastIndex = 0;
|
|
4218
|
+
return out;
|
|
4219
|
+
}
|
|
4220
|
+
function customMessage(rule, cited) {
|
|
4221
|
+
return `${rule.id}: ${rule.message} ("${cited}")`;
|
|
4222
|
+
}
|
|
4223
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
4224
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4225
|
+
const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE;
|
|
3516
4226
|
const findings = [];
|
|
3517
4227
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3518
4228
|
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3519
4229
|
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3520
|
-
const patterns = [
|
|
3521
|
-
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3522
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3523
|
-
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3524
|
-
];
|
|
3525
|
-
const productPatterns = [
|
|
3526
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3527
|
-
];
|
|
3528
|
-
const specPatterns = [
|
|
3529
|
-
...patterns,
|
|
3530
|
-
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3531
|
-
];
|
|
3532
4230
|
for (const file of files) {
|
|
3533
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3534
|
-
if (!cls || cls
|
|
3535
|
-
continue;
|
|
3536
|
-
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
4231
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths, productPaths);
|
|
4232
|
+
if (!cls || !REFERENCE_CLASSES.has(cls))
|
|
3537
4233
|
continue;
|
|
3538
4234
|
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3539
4235
|
continue;
|
|
3540
|
-
const blocking = cls === "product" || cls === "spec";
|
|
3541
4236
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3542
|
-
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3543
4237
|
const fileFindings = [];
|
|
3544
|
-
for (const
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
4238
|
+
for (const rule of referenceRulesFor(set, cls)) {
|
|
4239
|
+
if (!ruleReads(set, rule, file.path))
|
|
4240
|
+
continue;
|
|
4241
|
+
const pattern = !rule.custom && rule.id === "legacy-batch-name" ? legacyPattern : rule.patternFor(cls);
|
|
4242
|
+
if (!pattern)
|
|
4243
|
+
continue;
|
|
4244
|
+
const blocking = rule.severity[cls] === "error";
|
|
4245
|
+
const what = cls === "product" ? `${rule.message} in product code` : rule.message;
|
|
4246
|
+
for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
|
|
3550
4247
|
fileFindings.push({
|
|
3551
4248
|
file: file.path,
|
|
3552
|
-
line: lineAt(scrubbed,
|
|
3553
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3554
|
-
blocking
|
|
4249
|
+
line: lineAt(scrubbed, index),
|
|
4250
|
+
message: rule.custom ? customMessage(rule, cited) : `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4251
|
+
blocking,
|
|
4252
|
+
rule: rule.id
|
|
3555
4253
|
});
|
|
3556
|
-
match = pattern.exec(scrubbed);
|
|
3557
4254
|
}
|
|
3558
4255
|
}
|
|
3559
4256
|
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
@@ -3594,11 +4291,17 @@ function definesOrLinksGlossary(content, term) {
|
|
|
3594
4291
|
return true;
|
|
3595
4292
|
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3596
4293
|
}
|
|
3597
|
-
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4294
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, options = {}) {
|
|
3598
4295
|
const findings = [];
|
|
4296
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4297
|
+
const rule = set.rules.find((r) => !r.custom && r.id === "coined-term");
|
|
4298
|
+
if (!rule)
|
|
4299
|
+
return findings;
|
|
3599
4300
|
for (const file of files) {
|
|
3600
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3601
|
-
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
4301
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, DEFAULT_SPEC_PATHS, options.productPaths);
|
|
4302
|
+
if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls))
|
|
4303
|
+
continue;
|
|
4304
|
+
if (!ruleReads(set, rule, file.path))
|
|
3602
4305
|
continue;
|
|
3603
4306
|
const scrubbed = stripNonProse(file.path, file.content);
|
|
3604
4307
|
for (const term of glossaryTerms) {
|
|
@@ -3611,14 +4314,15 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
|
|
|
3611
4314
|
file: file.path,
|
|
3612
4315
|
line,
|
|
3613
4316
|
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3614
|
-
blocking:
|
|
4317
|
+
blocking: rule.severity[cls] === "error",
|
|
4318
|
+
rule: rule.id
|
|
3615
4319
|
});
|
|
3616
4320
|
}
|
|
3617
4321
|
}
|
|
3618
4322
|
return findings;
|
|
3619
4323
|
}
|
|
3620
|
-
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN =
|
|
3621
|
-
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN =
|
|
4324
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
|
|
4325
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
|
|
3622
4326
|
function extractComments(path, content) {
|
|
3623
4327
|
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3624
4328
|
return content.replace(/[^\n]/g, "");
|
|
@@ -3715,39 +4419,40 @@ function extractComments(path, content) {
|
|
|
3715
4419
|
}
|
|
3716
4420
|
return out;
|
|
3717
4421
|
}
|
|
3718
|
-
function checkSourceComments(files, allowlist = []) {
|
|
4422
|
+
function checkSourceComments(files, allowlist = [], options = {}) {
|
|
3719
4423
|
const findings = [];
|
|
3720
4424
|
const allowed = new Set(allowlist);
|
|
3721
|
-
const
|
|
3722
|
-
|
|
3723
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3724
|
-
];
|
|
4425
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4426
|
+
const rules = rulesInScope(set, "source-comment").filter((rule) => rule.group === "reader-resolvable");
|
|
3725
4427
|
for (const file of files) {
|
|
3726
4428
|
if (!file.path.endsWith(".ts"))
|
|
3727
4429
|
continue;
|
|
3728
4430
|
if (allowed.has(file.path))
|
|
3729
4431
|
continue;
|
|
3730
4432
|
const comments = extractComments(file.path, file.content);
|
|
3731
|
-
for (const
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
4433
|
+
for (const rule of rules) {
|
|
4434
|
+
if (!ruleReads(set, rule, file.path))
|
|
4435
|
+
continue;
|
|
4436
|
+
const pattern = rule.patternFor("source-comment");
|
|
4437
|
+
if (!pattern)
|
|
4438
|
+
continue;
|
|
4439
|
+
for (const { cited, index } of citations(pattern, comments)) {
|
|
4440
|
+
findings.push({
|
|
3736
4441
|
file: file.path,
|
|
3737
|
-
line: lineAt(comments,
|
|
3738
|
-
message: `comment cites ${
|
|
3739
|
-
blocking:
|
|
4442
|
+
line: lineAt(comments, index),
|
|
4443
|
+
message: rule.custom ? customMessage(rule, cited) : `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4444
|
+
blocking: rule.severity["source-comment"] === "error",
|
|
4445
|
+
rule: rule.id
|
|
3740
4446
|
});
|
|
3741
|
-
match = pattern.exec(comments);
|
|
3742
4447
|
}
|
|
3743
4448
|
}
|
|
3744
4449
|
}
|
|
3745
4450
|
return findings;
|
|
3746
4451
|
}
|
|
3747
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4452
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
3748
4453
|
return [
|
|
3749
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3750
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4454
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths, options),
|
|
4455
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
|
|
3751
4456
|
];
|
|
3752
4457
|
}
|
|
3753
4458
|
function parseGlossaryTerms(glossaryContent) {
|
|
@@ -3950,6 +4655,17 @@ function checkDocClaims(files, fileReader) {
|
|
|
3950
4655
|
};
|
|
3951
4656
|
}
|
|
3952
4657
|
|
|
4658
|
+
// ../../packages/aeg-core/src/protected-paths.ts
|
|
4659
|
+
import { posix as posixPath } from "node:path";
|
|
4660
|
+
var PROTECTED_ADMIN_PATHS = ["vinaya.config.json", ".vinaya/doc-owners", ".github/", "aeg-root/"];
|
|
4661
|
+
function normalizeTouchedPath(path) {
|
|
4662
|
+
return posixPath.resolve("/", path.replace(/\\/g, "/")).replace(/^\/+/, "");
|
|
4663
|
+
}
|
|
4664
|
+
function isProtectedAdminPath(path) {
|
|
4665
|
+
const normalized = normalizeTouchedPath(path);
|
|
4666
|
+
return PROTECTED_ADMIN_PATHS.some((prefix) => normalized === prefix || normalized.startsWith(prefix));
|
|
4667
|
+
}
|
|
4668
|
+
|
|
3953
4669
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3954
4670
|
function hasRationaleField(body, labelPattern) {
|
|
3955
4671
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -4069,13 +4785,20 @@ function globCoversPath(glob, path) {
|
|
|
4069
4785
|
return !p.includes("/");
|
|
4070
4786
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
4071
4787
|
}
|
|
4788
|
+
function surfaceEntryResolves(entry, resolvesToFile, pinnedFiles) {
|
|
4789
|
+
if (resolvesToFile(entry))
|
|
4790
|
+
return true;
|
|
4791
|
+
const directory = entry.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
4792
|
+
return pinnedFiles.some((path) => path.startsWith(`${directory}/`));
|
|
4793
|
+
}
|
|
4072
4794
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
4073
4795
|
const surface = parseIssueSurface(body);
|
|
4074
4796
|
if (!surface.ok)
|
|
4075
4797
|
return { status: "pass", errors: [] };
|
|
4798
|
+
const pinnedFiles = boundaryPinnedFiles(body);
|
|
4076
4799
|
const errors = [];
|
|
4077
4800
|
for (const glob of surface.value.in) {
|
|
4078
|
-
if (!
|
|
4801
|
+
if (!surfaceEntryResolves(glob, resolvesToFile, pinnedFiles)) {
|
|
4079
4802
|
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.`);
|
|
4080
4803
|
}
|
|
4081
4804
|
}
|
|
@@ -4105,6 +4828,14 @@ function recordedBeyondSurfacePaths(body) {
|
|
|
4105
4828
|
return paths;
|
|
4106
4829
|
}
|
|
4107
4830
|
function checkSurfaceScope(changedFiles, surface, recorded) {
|
|
4831
|
+
for (const path of changedFiles) {
|
|
4832
|
+
if (!isProtectedAdminPath(path))
|
|
4833
|
+
continue;
|
|
4834
|
+
const normalized = normalizeTouchedPath(path);
|
|
4835
|
+
if (!surface.in.some((glob) => globCoversPath(glob, normalized))) {
|
|
4836
|
+
return { ok: false, violation: { path, reason: "protected" } };
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4108
4839
|
const listed = new Set(recorded);
|
|
4109
4840
|
const violation = beyondSurfacePaths(changedFiles, surface).find((entry) => !listed.has(entry.path));
|
|
4110
4841
|
return violation ? { ok: false, violation } : { ok: true };
|
|
@@ -4160,12 +4891,22 @@ function checkPartsCiteDefinedObjectives(body) {
|
|
|
4160
4891
|
}
|
|
4161
4892
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
4162
4893
|
}
|
|
4894
|
+
var ISSUE_LIVE_LINE_RE = /^-\s*\*{2}\[live\]\*{2}(.*)$/gim;
|
|
4895
|
+
function liveCommand(text) {
|
|
4896
|
+
const trimmed = text.trim();
|
|
4897
|
+
const span = /^(`+)(.+)\1$/.exec(trimmed);
|
|
4898
|
+
return span ? span[2].trim() : trimmed;
|
|
4899
|
+
}
|
|
4900
|
+
function liveItemsIn(region) {
|
|
4901
|
+
return [...region.matchAll(ISSUE_LIVE_LINE_RE)].map((m) => liveCommand(m[1] ?? "")).filter(Boolean);
|
|
4902
|
+
}
|
|
4903
|
+
function parseLiveTestPlanItems(body) {
|
|
4904
|
+
const located = locateTestPlanSection(body);
|
|
4905
|
+
return located.found ? liveItemsIn(located.section) : [];
|
|
4906
|
+
}
|
|
4163
4907
|
function isTaskIssueLabelSet(labels) {
|
|
4164
4908
|
return hasLabel("tranche", labels);
|
|
4165
4909
|
}
|
|
4166
|
-
function checkTrancheLabelPresence(_body, _labels) {
|
|
4167
|
-
return { status: "pass", errors: [] };
|
|
4168
|
-
}
|
|
4169
4910
|
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
4170
4911
|
if (!isTaskIssueLabelSet(labels))
|
|
4171
4912
|
return { status: "pass", errors: [] };
|
|
@@ -4181,6 +4922,7 @@ function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTi
|
|
|
4181
4922
|
};
|
|
4182
4923
|
}
|
|
4183
4924
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
4925
|
+
var PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" });
|
|
4184
4926
|
function isControlCodePoint(codePoint) {
|
|
4185
4927
|
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
4186
4928
|
}
|
|
@@ -4241,8 +4983,14 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
4241
4983
|
}
|
|
4242
4984
|
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
4243
4985
|
}
|
|
4986
|
+
function rationaleFieldText(text, labelPattern) {
|
|
4987
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})[^\\n]*\\n?([\\s\\S]*?)(?=\\n\\s*(?:\\*\\*[A-Z]|#{1,4}\\s)|(?![\\s\\S]))`, "im");
|
|
4988
|
+
const m = re.exec(text);
|
|
4989
|
+
return m ? m[0] : "";
|
|
4990
|
+
}
|
|
4244
4991
|
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;
|
|
4245
4992
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
4993
|
+
var RATIONALE_PATH_RE_GLOBAL = /`([\w.@-]+(?:\/[\w.@-]+)+)`/g;
|
|
4246
4994
|
function normalizeEdgeId(s) {
|
|
4247
4995
|
const qualified = splitSlugQualifiedEdge(s);
|
|
4248
4996
|
return (qualified ? qualified.bareId : s).replace(/^#/, "").trim();
|
|
@@ -4250,6 +4998,15 @@ function normalizeEdgeId(s) {
|
|
|
4250
4998
|
function edgesNameEachOther(a, b) {
|
|
4251
4999
|
return a.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(b.ref)) || b.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(a.ref));
|
|
4252
5000
|
}
|
|
5001
|
+
var BOUNDARY_OUT_RE = /\bOut\s*:\s*([\s\S]*)$/im;
|
|
5002
|
+
function boundaryOutText(body) {
|
|
5003
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5004
|
+
const m = BOUNDARY_OUT_RE.exec(boundary);
|
|
5005
|
+
return m ? m[1] : "";
|
|
5006
|
+
}
|
|
5007
|
+
function namedPathsIn(text) {
|
|
5008
|
+
return [...new Set([...text.matchAll(RATIONALE_PATH_RE_GLOBAL)].map((m) => m[1]))].filter((p) => !/^https?:\/\//i.test(p));
|
|
5009
|
+
}
|
|
4253
5010
|
var FILE_EXTENSIONS = new Set([
|
|
4254
5011
|
"ts",
|
|
4255
5012
|
"tsx",
|
|
@@ -4271,6 +5028,11 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4271
5028
|
"html",
|
|
4272
5029
|
"css"
|
|
4273
5030
|
]);
|
|
5031
|
+
function boundaryPinnedFiles(body) {
|
|
5032
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5033
|
+
const excluded = new Set(namedPathsIn(boundaryOutText(body)));
|
|
5034
|
+
return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
|
|
5035
|
+
}
|
|
4274
5036
|
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4275
5037
|
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4276
5038
|
|
|
@@ -4295,7 +5057,7 @@ function isGrandfathered(isoDate) {
|
|
|
4295
5057
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
4296
5058
|
}
|
|
4297
5059
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4298
|
-
function checkA1(entries, principalAllowlist
|
|
5060
|
+
function checkA1(entries, principalAllowlist) {
|
|
4299
5061
|
const failures = [];
|
|
4300
5062
|
for (const e of entries) {
|
|
4301
5063
|
if (!e.facts)
|
|
@@ -4325,6 +5087,37 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
|
4325
5087
|
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4326
5088
|
};
|
|
4327
5089
|
}
|
|
5090
|
+
function checkA2(entries, hasProvenanceByKey) {
|
|
5091
|
+
const failures = [];
|
|
5092
|
+
for (const e of entries) {
|
|
5093
|
+
if (!e.facts)
|
|
5094
|
+
continue;
|
|
5095
|
+
if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
|
|
5096
|
+
continue;
|
|
5097
|
+
const key = `${e.trancheSlug}/${e.task.id}`;
|
|
5098
|
+
const hasProvenance = hasProvenanceByKey.get(key);
|
|
5099
|
+
if (hasProvenance === undefined)
|
|
5100
|
+
continue;
|
|
5101
|
+
if (!hasProvenance) {
|
|
5102
|
+
failures.push({
|
|
5103
|
+
code: "archived-without-provenance",
|
|
5104
|
+
issue: e.task.issue,
|
|
5105
|
+
tranche: e.trancheSlug,
|
|
5106
|
+
task: e.task.id,
|
|
5107
|
+
reason: "Closing PR has no `### AEG provenance` comment (Archivist close-out missing)",
|
|
5108
|
+
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
5109
|
+
});
|
|
5110
|
+
}
|
|
5111
|
+
}
|
|
5112
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
5113
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
5114
|
+
return {
|
|
5115
|
+
check: "A2",
|
|
5116
|
+
status,
|
|
5117
|
+
failures,
|
|
5118
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
5119
|
+
};
|
|
5120
|
+
}
|
|
4328
5121
|
function checkA3(entries) {
|
|
4329
5122
|
const failures = [];
|
|
4330
5123
|
for (const e of entries) {
|
|
@@ -4540,6 +5333,33 @@ function checkL1(files, entriesBySlug) {
|
|
|
4540
5333
|
note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
|
|
4541
5334
|
};
|
|
4542
5335
|
}
|
|
5336
|
+
function checkL2(files, entriesBySlug) {
|
|
5337
|
+
const failures = [];
|
|
5338
|
+
for (const f of files) {
|
|
5339
|
+
if (!f.archived)
|
|
5340
|
+
continue;
|
|
5341
|
+
const entries = entriesBySlug.get(f.slug) ?? [];
|
|
5342
|
+
for (const e of entries) {
|
|
5343
|
+
if (!e.facts)
|
|
5344
|
+
continue;
|
|
5345
|
+
if (e.facts.issueState === "open") {
|
|
5346
|
+
failures.push({
|
|
5347
|
+
code: "premature-archive",
|
|
5348
|
+
issue: e.task.issue,
|
|
5349
|
+
tranche: f.slug,
|
|
5350
|
+
task: e.task.id,
|
|
5351
|
+
reason: `Archived tranche has open task-Issue #${e.task.issue ?? "?"} (premature archive)`
|
|
5352
|
+
});
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
return {
|
|
5357
|
+
check: "L2",
|
|
5358
|
+
status: "info",
|
|
5359
|
+
failures,
|
|
5360
|
+
note: failures.length > 0 ? `${failures.length} archived tranche(s) with an open task-Issue — investigate (advisory)` : undefined
|
|
5361
|
+
};
|
|
5362
|
+
}
|
|
4543
5363
|
function checkL3(files) {
|
|
4544
5364
|
const active = files.filter((f) => !f.archived);
|
|
4545
5365
|
return {
|
|
@@ -4549,6 +5369,51 @@ function checkL3(files) {
|
|
|
4549
5369
|
note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
|
|
4550
5370
|
};
|
|
4551
5371
|
}
|
|
5372
|
+
function checkL4(activeTrancheSlugs, issueMilestones) {
|
|
5373
|
+
const activeSet = new Set(activeTrancheSlugs);
|
|
5374
|
+
const failures = [];
|
|
5375
|
+
for (const f of issueMilestones) {
|
|
5376
|
+
if (!activeSet.has(f.tranche))
|
|
5377
|
+
continue;
|
|
5378
|
+
if (f.milestoneTitle === f.tranche)
|
|
5379
|
+
continue;
|
|
5380
|
+
failures.push({
|
|
5381
|
+
code: "milestone-drift",
|
|
5382
|
+
issue: f.issue,
|
|
5383
|
+
tranche: f.tranche,
|
|
5384
|
+
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`
|
|
5385
|
+
});
|
|
5386
|
+
}
|
|
5387
|
+
return {
|
|
5388
|
+
check: "L4",
|
|
5389
|
+
status: "info",
|
|
5390
|
+
failures,
|
|
5391
|
+
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
|
|
5392
|
+
};
|
|
5393
|
+
}
|
|
5394
|
+
function checkL5(activeTrancheSlugs, entriesBySlug) {
|
|
5395
|
+
const failures = [];
|
|
5396
|
+
for (const slug of activeTrancheSlugs) {
|
|
5397
|
+
const entries = entriesBySlug.get(slug) ?? [];
|
|
5398
|
+
const withFacts = entries.filter((e) => e.facts !== undefined);
|
|
5399
|
+
if (withFacts.length === 0)
|
|
5400
|
+
continue;
|
|
5401
|
+
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
5402
|
+
if (allClosed) {
|
|
5403
|
+
failures.push({
|
|
5404
|
+
code: "tranche-not-archived",
|
|
5405
|
+
tranche: slug,
|
|
5406
|
+
reason: "Every task Issue is closed but the tranche is not recorded as complete — archive it"
|
|
5407
|
+
});
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
return {
|
|
5411
|
+
check: "L5",
|
|
5412
|
+
status: failures.length > 0 ? "fail" : "pass",
|
|
5413
|
+
failures,
|
|
5414
|
+
note: failures.length > 0 ? `${failures.length} tranche(s) whose task Issues are all closed but were never archived` : undefined
|
|
5415
|
+
};
|
|
5416
|
+
}
|
|
4552
5417
|
function extractClosesReferences(prBody) {
|
|
4553
5418
|
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#(\d+)/gi;
|
|
4554
5419
|
const stripped = stripCode(prBody);
|
|
@@ -4644,6 +5509,58 @@ function extractIssue(body) {
|
|
|
4644
5509
|
}
|
|
4645
5510
|
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4646
5511
|
import { createHash as createHash4 } from "node:crypto";
|
|
5512
|
+
|
|
5513
|
+
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
5514
|
+
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
5515
|
+
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
5516
|
+
let best = 0;
|
|
5517
|
+
for (const c of comments) {
|
|
5518
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5519
|
+
continue;
|
|
5520
|
+
const firstLine = (c.body.split(`
|
|
5521
|
+
`)[0] ?? "").trim();
|
|
5522
|
+
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
5523
|
+
if (!m)
|
|
5524
|
+
continue;
|
|
5525
|
+
const k = Number.parseInt(m[1], 10);
|
|
5526
|
+
if (k > best)
|
|
5527
|
+
best = k;
|
|
5528
|
+
}
|
|
5529
|
+
return best;
|
|
5530
|
+
}
|
|
5531
|
+
function parseRulingIdentity(rulingId) {
|
|
5532
|
+
const m = /^(issue-)?(\d+)-(\d+)$/.exec(rulingId);
|
|
5533
|
+
if (!m)
|
|
5534
|
+
return null;
|
|
5535
|
+
const ref = Number.parseInt(m[2], 10);
|
|
5536
|
+
const ordinal = Number.parseInt(m[3], 10);
|
|
5537
|
+
if (ref <= 0 || ordinal <= 0)
|
|
5538
|
+
return null;
|
|
5539
|
+
return { target: m[1] ? "issue" : "pr", ref, ordinal };
|
|
5540
|
+
}
|
|
5541
|
+
function principalRulingTextById(comments, allowlist, rulingId) {
|
|
5542
|
+
const identity = parseRulingIdentity(rulingId);
|
|
5543
|
+
if (identity === null)
|
|
5544
|
+
return null;
|
|
5545
|
+
const matches = comments.filter((c) => {
|
|
5546
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5547
|
+
return false;
|
|
5548
|
+
const m = RULING_MARKER_ORDINAL.exec((c.body.split(`
|
|
5549
|
+
`)[0] ?? "").trim());
|
|
5550
|
+
return m !== null && Number.parseInt(m[1], 10) === identity.ordinal;
|
|
5551
|
+
});
|
|
5552
|
+
if (matches.length !== 1)
|
|
5553
|
+
return null;
|
|
5554
|
+
const body = matches[0].body;
|
|
5555
|
+
const idx = body.indexOf(`
|
|
5556
|
+
`);
|
|
5557
|
+
return idx === -1 ? "" : body.slice(idx + 1).trim();
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
5561
|
+
function pauseBoundRulingDigest(rulingText) {
|
|
5562
|
+
return createHash4("sha256").update(rulingText).digest("hex");
|
|
5563
|
+
}
|
|
4647
5564
|
function briefHash(brief) {
|
|
4648
5565
|
return createHash4("sha256").update(`${brief}
|
|
4649
5566
|
`).digest("hex");
|
|
@@ -4704,14 +5621,19 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4704
5621
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4705
5622
|
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4706
5623
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
5624
|
+
const legacyCurrent = current.manifestVersion === undefined;
|
|
5625
|
+
const manifestVersion = legacyCurrent ? echoed.manifestVersion === undefined || echoed.manifestVersion === null : echoed.manifestVersion === current.manifestVersion;
|
|
5626
|
+
const pauseBoundRuling = legacyCurrent ? true : Object.hasOwn(echoed, "pauseBoundRuling") && JSON.stringify(echoed.pauseBoundRuling) === JSON.stringify(current.pauseBoundRuling);
|
|
4707
5627
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4708
5628
|
return {
|
|
4709
|
-
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
5629
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && pauseBoundRuling && manifestVersion && policyDigestBound,
|
|
4710
5630
|
head,
|
|
4711
5631
|
base,
|
|
4712
5632
|
briefHash: briefHashBound,
|
|
4713
5633
|
objectivesVersion,
|
|
4714
5634
|
rulingOrdinal,
|
|
5635
|
+
pauseBoundRuling,
|
|
5636
|
+
manifestVersion,
|
|
4715
5637
|
policyDigest: policyDigestBound
|
|
4716
5638
|
};
|
|
4717
5639
|
}
|
|
@@ -4727,7 +5649,7 @@ function renderGateDeferred(deferred) {
|
|
|
4727
5649
|
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4728
5650
|
}
|
|
4729
5651
|
function checkReviewGate(input) {
|
|
4730
|
-
const principalAllowlist = input
|
|
5652
|
+
const { principalAllowlist } = input;
|
|
4731
5653
|
const waived = isWaiverLabelActorVerified({
|
|
4732
5654
|
label: WAIVER_LABEL_REVIEW,
|
|
4733
5655
|
labels: input.labels,
|
|
@@ -4766,27 +5688,33 @@ function checkReviewGate(input) {
|
|
|
4766
5688
|
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4767
5689
|
const securityClean = securityTextClean && securityPolicyClean;
|
|
4768
5690
|
const currentManifest = {
|
|
5691
|
+
...input.manifestVersion === undefined ? {} : { manifestVersion: input.manifestVersion },
|
|
4769
5692
|
headSha: input.headSha,
|
|
4770
5693
|
baseSha: input.baseSha ?? null,
|
|
4771
5694
|
briefHash: input.briefHash ?? null,
|
|
4772
5695
|
objectivesVersion: input.objectivesVersion,
|
|
4773
5696
|
rulingOrdinal: input.rulingOrdinal,
|
|
5697
|
+
pauseBoundRuling: input.pauseBoundRuling ?? null,
|
|
4774
5698
|
policyDigest: policyDigest(policy)
|
|
4775
5699
|
};
|
|
4776
5700
|
const codeReviewEchoed = {
|
|
5701
|
+
manifestVersion: codeReview.manifestVersion,
|
|
4777
5702
|
headSha: codeReview.headSha,
|
|
4778
5703
|
baseSha: codeReview.baseSha,
|
|
4779
5704
|
briefHash: codeReview.briefHash,
|
|
4780
5705
|
objectivesVersion: codeReview.objectivesVersion,
|
|
4781
5706
|
rulingOrdinal: codeReview.rulingOrdinal,
|
|
5707
|
+
pauseBoundRuling: codeReview.pauseBoundRuling,
|
|
4782
5708
|
policyDigest: codeReview.policyDigest
|
|
4783
5709
|
};
|
|
4784
5710
|
const securityEchoed = {
|
|
5711
|
+
manifestVersion: security.manifestVersion,
|
|
4785
5712
|
headSha: security.headSha,
|
|
4786
5713
|
baseSha: security.baseSha,
|
|
4787
5714
|
briefHash: security.briefHash,
|
|
4788
5715
|
objectivesVersion: security.objectivesVersion,
|
|
4789
5716
|
rulingOrdinal: security.rulingOrdinal,
|
|
5717
|
+
pauseBoundRuling: security.pauseBoundRuling,
|
|
4790
5718
|
policyDigest: security.policyDigest
|
|
4791
5719
|
};
|
|
4792
5720
|
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
@@ -4825,6 +5753,10 @@ function checkReviewGate(input) {
|
|
|
4825
5753
|
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"}`);
|
|
4826
5754
|
} else if (!codeReviewBinding.policyDigest) {
|
|
4827
5755
|
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}`);
|
|
5756
|
+
} else if (!codeReviewBinding.manifestVersion) {
|
|
5757
|
+
problems.push(`the newest code-review verdict echoes manifest version ${codeReview.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5758
|
+
} else if (!codeReviewBinding.pauseBoundRuling) {
|
|
5759
|
+
problems.push(`the newest code-review verdict echoes pauseBoundRuling ${renderBinding(codeReview.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4828
5760
|
}
|
|
4829
5761
|
if (!securityTextClean) {
|
|
4830
5762
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
@@ -4842,6 +5774,10 @@ function checkReviewGate(input) {
|
|
|
4842
5774
|
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"}`);
|
|
4843
5775
|
} else if (!securityBinding.policyDigest) {
|
|
4844
5776
|
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}`);
|
|
5777
|
+
} else if (!securityBinding.manifestVersion) {
|
|
5778
|
+
problems.push(`the newest security-review verdict echoes manifest version ${security.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5779
|
+
} else if (!securityBinding.pauseBoundRuling) {
|
|
5780
|
+
problems.push(`the newest security-review verdict echoes pauseBoundRuling ${renderBinding(security.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4845
5781
|
}
|
|
4846
5782
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4847
5783
|
return {
|
|
@@ -4850,29 +5786,16 @@ function checkReviewGate(input) {
|
|
|
4850
5786
|
waived: false
|
|
4851
5787
|
};
|
|
4852
5788
|
}
|
|
5789
|
+
function renderBinding(binding) {
|
|
5790
|
+
if (binding === undefined)
|
|
5791
|
+
return "(absent)";
|
|
5792
|
+
return binding === null ? "(none)" : `${binding.rulingId}|${binding.pauseId}|${binding.contentDigest}`;
|
|
5793
|
+
}
|
|
4853
5794
|
var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
|
|
4854
5795
|
var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
|
|
4855
5796
|
function isChangesetsReleasePr(branch, author, expectedAuthor) {
|
|
4856
5797
|
return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
|
|
4857
5798
|
}
|
|
4858
|
-
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
4859
|
-
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
4860
|
-
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
4861
|
-
let best = 0;
|
|
4862
|
-
for (const c of comments) {
|
|
4863
|
-
if (!isPrincipal(c.author, allowlist))
|
|
4864
|
-
continue;
|
|
4865
|
-
const firstLine = (c.body.split(`
|
|
4866
|
-
`)[0] ?? "").trim();
|
|
4867
|
-
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
4868
|
-
if (!m)
|
|
4869
|
-
continue;
|
|
4870
|
-
const k = Number.parseInt(m[1], 10);
|
|
4871
|
-
if (k > best)
|
|
4872
|
-
best = k;
|
|
4873
|
-
}
|
|
4874
|
-
return best;
|
|
4875
|
-
}
|
|
4876
5799
|
// ../../packages/aeg-core/src/markdown-table.ts
|
|
4877
5800
|
function splitRow(line) {
|
|
4878
5801
|
const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
@@ -5024,7 +5947,6 @@ var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
|
5024
5947
|
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
5025
5948
|
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
5026
5949
|
"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)',
|
|
5027
|
-
"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)`,
|
|
5028
5950
|
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
5029
5951
|
};
|
|
5030
5952
|
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
@@ -5248,72 +6170,10 @@ function compareToBaseline(current, baseline) {
|
|
|
5248
6170
|
};
|
|
5249
6171
|
}
|
|
5250
6172
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
5251
|
-
var
|
|
5252
|
-
var RETIRED_PATTERNS =
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
"decision (entry|logged)",
|
|
5256
|
-
"decision-log entry",
|
|
5257
|
-
"decision log entry",
|
|
5258
|
-
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
5259
|
-
"decision-log",
|
|
5260
|
-
"decision entr",
|
|
5261
|
-
"decisions? (are |is )?logged",
|
|
5262
|
-
"log entries",
|
|
5263
|
-
String.raw`decisions\.md`,
|
|
5264
|
-
"decisions-legacy",
|
|
5265
|
-
"CONTRADICTION",
|
|
5266
|
-
"assumes Tier 3",
|
|
5267
|
-
"Lock: ?YES",
|
|
5268
|
-
"Lock: ?NO",
|
|
5269
|
-
"lock approvals?",
|
|
5270
|
-
"approves locks",
|
|
5271
|
-
"Conforms to lock",
|
|
5272
|
-
"Challenges lock",
|
|
5273
|
-
"checkDecisionNumbersFresh",
|
|
5274
|
-
String.raw`roles/team-leader\.md`,
|
|
5275
|
-
String.raw`\(,`,
|
|
5276
|
-
String.raw`,\)`,
|
|
5277
|
-
String.raw`\(\.\)`,
|
|
5278
|
-
...PLAN_ON_DISK_PATTERNS
|
|
5279
|
-
];
|
|
5280
|
-
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
5281
|
-
var RETIRED_EXEMPT_SUBSTRINGS = [
|
|
5282
|
-
"docs/decisions-legacy.md",
|
|
5283
|
-
"apps/herald-ai/docs/",
|
|
5284
|
-
"apps/vada-ai/docs/",
|
|
5285
|
-
"aeg-root/tranches/completed/",
|
|
5286
|
-
"packages/aeg-core/src/docs/published-prose",
|
|
5287
|
-
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
5288
|
-
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
5289
|
-
"/fixtures/",
|
|
5290
|
-
"/node_modules/",
|
|
5291
|
-
"/.next/",
|
|
5292
|
-
"/.turbo/"
|
|
5293
|
-
];
|
|
5294
|
-
var PATTERN_EXEMPT = {
|
|
5295
|
-
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
5296
|
-
[String.raw`decisions\.md`]: [
|
|
5297
|
-
"docs-index.md",
|
|
5298
|
-
"apps/vada-ai/specs/legacy/README.md",
|
|
5299
|
-
"apps/vada-ai/specs/vada-product-spec.md",
|
|
5300
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5301
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5302
|
-
],
|
|
5303
|
-
"decisions-legacy": [
|
|
5304
|
-
"packages/aeg-core/src/file-classify.ts",
|
|
5305
|
-
"packages/aeg-core/src/file-classify.test.ts",
|
|
5306
|
-
"packages/aeg-core/src/pr-tier.test.ts",
|
|
5307
|
-
"docs-index.md",
|
|
5308
|
-
".claude/skills/database/SKILL.md",
|
|
5309
|
-
".claude/skills/vada-architecture/SKILL.md",
|
|
5310
|
-
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
5311
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5312
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5313
|
-
],
|
|
5314
|
-
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
5315
|
-
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
5316
|
-
};
|
|
6173
|
+
var retiredRules = rulesForGroup("retired-vocabulary");
|
|
6174
|
+
var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
|
|
6175
|
+
var PATTERN_EXEMPT = RETIRED_PATTERN_EXEMPTIONS;
|
|
6176
|
+
var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
|
|
5317
6177
|
function lineNumbers(content, pattern) {
|
|
5318
6178
|
const out = [];
|
|
5319
6179
|
const lines = content.split(`
|
|
@@ -5324,22 +6184,29 @@ function lineNumbers(content, pattern) {
|
|
|
5324
6184
|
}
|
|
5325
6185
|
return out;
|
|
5326
6186
|
}
|
|
5327
|
-
function scanRetiredVocabulary(files) {
|
|
6187
|
+
function scanRetiredVocabulary(files, rules = DEFAULT_PROSE_RULE_SET) {
|
|
5328
6188
|
const findings = [];
|
|
6189
|
+
const retired = rulesOfGroup(rules, "retired-vocabulary");
|
|
5329
6190
|
for (const file of files) {
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
6191
|
+
for (const rule of retired) {
|
|
6192
|
+
if (rule.substringExempt.some((e) => file.path.includes(e)))
|
|
6193
|
+
continue;
|
|
6194
|
+
if (!ruleReads(rules, rule, file.path))
|
|
6195
|
+
continue;
|
|
6196
|
+
const re = rule.patternFor("repository");
|
|
6197
|
+
if (!re)
|
|
6198
|
+
continue;
|
|
6199
|
+
const pattern = rule.custom ? re.source : DEFAULT_PATTERN_OF.get(rule.id) ?? re.source;
|
|
6200
|
+
if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e)))
|
|
5335
6201
|
continue;
|
|
5336
|
-
const re = new RegExp(pattern);
|
|
5337
6202
|
for (const line of lineNumbers(file.content, re)) {
|
|
5338
6203
|
findings.push({
|
|
5339
6204
|
file: file.path,
|
|
5340
6205
|
line,
|
|
5341
6206
|
pattern,
|
|
5342
|
-
message: `claims a retired AEG mechanism is still live (matches /${pattern}/)
|
|
6207
|
+
message: rule.custom ? `${rule.id}: ${rule.message} (matches /${pattern}/)` : `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
|
|
6208
|
+
rule: rule.id,
|
|
6209
|
+
blocking: rule.severity.repository === "error"
|
|
5343
6210
|
});
|
|
5344
6211
|
}
|
|
5345
6212
|
}
|
|
@@ -5363,7 +6230,7 @@ function isSelfDependency(dep, task, issue) {
|
|
|
5363
6230
|
function checkDispatchReadiness(input) {
|
|
5364
6231
|
const { trancheSlug, task } = input;
|
|
5365
6232
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
5366
|
-
const principalAllowlist = input
|
|
6233
|
+
const { principalAllowlist } = input;
|
|
5367
6234
|
const blockerDetails = [];
|
|
5368
6235
|
const push = (blockerClass, message) => {
|
|
5369
6236
|
blockerDetails.push({ class: blockerClass, message });
|
|
@@ -5455,6 +6322,16 @@ function pushesAnyBranchRef(pushRefs) {
|
|
|
5455
6322
|
return pushRefs.split(`
|
|
5456
6323
|
`).map((line) => line.trim()).filter((line) => line.length > 0).some((line) => line.split(/\s+/)[2]?.startsWith("refs/heads/") === true);
|
|
5457
6324
|
}
|
|
6325
|
+
function resolveDefaultBranch(facts) {
|
|
6326
|
+
const { originHead, hasOriginMain, hasOriginMaster } = facts;
|
|
6327
|
+
if (originHead !== null && originHead !== "")
|
|
6328
|
+
return originHead;
|
|
6329
|
+
if (hasOriginMain)
|
|
6330
|
+
return "main";
|
|
6331
|
+
if (hasOriginMaster)
|
|
6332
|
+
return "master";
|
|
6333
|
+
return null;
|
|
6334
|
+
}
|
|
5458
6335
|
function checkMainBranchRefusal(facts) {
|
|
5459
6336
|
const { currentSymbolicBranch, defaultBranch, pushRefs = null } = facts;
|
|
5460
6337
|
if (currentSymbolicBranch === null)
|
|
@@ -5715,54 +6592,61 @@ function checkFirstPushDispatchGate(input) {
|
|
|
5715
6592
|
reason: `verify-dispatch reports READY TO DISPATCH for \`${branch}\`.`
|
|
5716
6593
|
};
|
|
5717
6594
|
}
|
|
5718
|
-
// ../../packages/aeg-core/src/
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
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
|
-
|
|
6595
|
+
// ../../packages/aeg-core/src/live-record.ts
|
|
6596
|
+
var RECORD_LINE_RE = /^-\s*\[([ xX])\]\s*\*\*\[live\]\*\*\s+(`+) ?(.+?) ?\2(?!`)\s+—\s+(passed|failed|unverified)\s+at\s+`([^`]+)`/;
|
|
6597
|
+
function liveMarkers(body) {
|
|
6598
|
+
const masked = maskCode(body);
|
|
6599
|
+
return [...masked.matchAll(/<!--\s*AEG:LIVE:(?:START|END)\s*-->/g)].map((m) => ({
|
|
6600
|
+
start: m.index,
|
|
6601
|
+
end: m.index + m[0].length
|
|
6602
|
+
}));
|
|
6603
|
+
}
|
|
6604
|
+
var AMBIGUOUS_RECORD_LINE = {
|
|
6605
|
+
line: "- [ ] **[live]** the pull request body carries more than one `AEG:LIVE` marker pair, so the driver's record cannot be told apart",
|
|
6606
|
+
ticked: false,
|
|
6607
|
+
command: "",
|
|
6608
|
+
outcome: "failed",
|
|
6609
|
+
head: ""
|
|
6610
|
+
};
|
|
6611
|
+
function readLiveRecord(body) {
|
|
6612
|
+
const markers = liveMarkers(body).length;
|
|
6613
|
+
if (markers === 0)
|
|
6614
|
+
return [];
|
|
6615
|
+
if (markers !== 2)
|
|
6616
|
+
return [AMBIGUOUS_RECORD_LINE];
|
|
6617
|
+
const region = anchoredRegion(body, "LIVE");
|
|
6618
|
+
if (region === null)
|
|
6619
|
+
return [];
|
|
6620
|
+
const lines = [];
|
|
6621
|
+
for (const raw of region.split(`
|
|
6622
|
+
`)) {
|
|
6623
|
+
const line = raw.trim();
|
|
6624
|
+
const m = RECORD_LINE_RE.exec(line);
|
|
6625
|
+
if (!m)
|
|
6626
|
+
continue;
|
|
6627
|
+
lines.push({
|
|
6628
|
+
line,
|
|
6629
|
+
ticked: m[1].toLowerCase() === "x",
|
|
6630
|
+
command: m[3],
|
|
6631
|
+
outcome: m[4],
|
|
6632
|
+
head: m[5]
|
|
6633
|
+
});
|
|
5756
6634
|
}
|
|
5757
|
-
return
|
|
5758
|
-
action: "assign",
|
|
5759
|
-
issue,
|
|
5760
|
-
login,
|
|
5761
|
-
reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
|
|
5762
|
-
};
|
|
6635
|
+
return lines;
|
|
5763
6636
|
}
|
|
5764
6637
|
// ../../packages/aeg-core/src/test-plan-gate.ts
|
|
5765
|
-
function
|
|
6638
|
+
function gradedLiveLines(record, live) {
|
|
6639
|
+
if (live === undefined)
|
|
6640
|
+
return record.map((entry) => entry.line);
|
|
6641
|
+
const commands = new Set(live.liveCommands);
|
|
6642
|
+
const others = record.filter((entry) => !commands.has(entry.command)).map((entry) => entry.line);
|
|
6643
|
+
const graded = live.liveCommands.map((command) => {
|
|
6644
|
+
const atHead = record.filter((entry) => entry.command === command && entry.head === live.head);
|
|
6645
|
+
return (atHead.find((entry) => entry.ticked) ?? atHead[0])?.line ?? `- [ ] **[live]** \`${command}\` — no passed run recorded at \`${live.head || "an unknown head"}\``;
|
|
6646
|
+
});
|
|
6647
|
+
return [...others, ...graded];
|
|
6648
|
+
}
|
|
6649
|
+
function evaluateTestPlanGate(body, branch, live) {
|
|
5766
6650
|
if (!body) {
|
|
5767
6651
|
return {
|
|
5768
6652
|
verdict: "pass",
|
|
@@ -5773,7 +6657,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5773
6657
|
};
|
|
5774
6658
|
}
|
|
5775
6659
|
const located = locateTestPlanSection(body);
|
|
5776
|
-
|
|
6660
|
+
const liveLines = gradedLiveLines(readLiveRecord(body), live);
|
|
6661
|
+
const liveUnticked = liveLines.some((line) => /^[-*]\s+\[\s\]/.test(line));
|
|
6662
|
+
if (!located.found && !liveUnticked) {
|
|
5777
6663
|
if (parseTaskBranchIdentity(branch) !== null) {
|
|
5778
6664
|
return {
|
|
5779
6665
|
verdict: "fail",
|
|
@@ -5793,15 +6679,18 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5793
6679
|
]
|
|
5794
6680
|
};
|
|
5795
6681
|
}
|
|
5796
|
-
const section = located.section;
|
|
5797
|
-
if (/unit-tests-only/i.test(section)) {
|
|
6682
|
+
const section = located.found ? located.section : "";
|
|
6683
|
+
if (/unit-tests-only/i.test(section) && !liveUnticked) {
|
|
5798
6684
|
return {
|
|
5799
6685
|
verdict: "pass",
|
|
5800
6686
|
messages: ["Test Plan: unit-tests-only — pure-logic brief, CI unit-tests are the proof.", "PASS."]
|
|
5801
6687
|
};
|
|
5802
6688
|
}
|
|
5803
|
-
const checkboxLines =
|
|
5804
|
-
|
|
6689
|
+
const checkboxLines = [
|
|
6690
|
+
...section.split(`
|
|
6691
|
+
`).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line)),
|
|
6692
|
+
...liveLines
|
|
6693
|
+
];
|
|
5805
6694
|
if (checkboxLines.length === 0) {
|
|
5806
6695
|
return {
|
|
5807
6696
|
verdict: "pass",
|
|
@@ -5818,7 +6707,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5818
6707
|
messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
|
|
5819
6708
|
for (const line of unchecked)
|
|
5820
6709
|
messages.push(` ${line}`);
|
|
5821
|
-
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.",
|
|
6710
|
+
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 ? [
|
|
6711
|
+
"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."
|
|
6712
|
+
] : [], "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.");
|
|
5822
6713
|
return { verdict: "fail", messages };
|
|
5823
6714
|
}
|
|
5824
6715
|
messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
@@ -6007,9 +6898,11 @@ var LineageSchema = z3.object({
|
|
|
6007
6898
|
parent: z3.string().nullable()
|
|
6008
6899
|
}).strict();
|
|
6009
6900
|
var InputVersionsSchema = z3.object({
|
|
6901
|
+
manifest_version: z3.literal(2).nullable().optional(),
|
|
6010
6902
|
objectives_version: z3.string().nullable(),
|
|
6011
6903
|
brief_hash: z3.string().nullable(),
|
|
6012
6904
|
ruling_ordinal: z3.number().int().nullable(),
|
|
6905
|
+
pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
|
|
6013
6906
|
policy_digest: z3.string().nullable()
|
|
6014
6907
|
}).strict();
|
|
6015
6908
|
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
@@ -6047,7 +6940,17 @@ var HeaderMetaV3Schema = z3.object({
|
|
|
6047
6940
|
runtime: z3.string().nullable(),
|
|
6048
6941
|
source: z3.string().nullable()
|
|
6049
6942
|
}).strict();
|
|
6050
|
-
var
|
|
6943
|
+
var HeaderMetaV4Schema = HeaderMetaV3Schema.extend({
|
|
6944
|
+
schema: z3.literal(4),
|
|
6945
|
+
process: z3.object({ id: z3.string(), version: z3.string().nullable(), digest: z3.string().nullable() }).strict(),
|
|
6946
|
+
runner: z3.object({ id: z3.string(), version: z3.string().nullable() }).strict()
|
|
6947
|
+
}).strict();
|
|
6948
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [
|
|
6949
|
+
HeaderMetaV1Schema,
|
|
6950
|
+
HeaderMetaV2Schema,
|
|
6951
|
+
HeaderMetaV3Schema,
|
|
6952
|
+
HeaderMetaV4Schema
|
|
6953
|
+
]);
|
|
6051
6954
|
var SubjectSchema = z3.object({
|
|
6052
6955
|
issue: z3.number().int().nullable(),
|
|
6053
6956
|
pr: z3.number().int().optional(),
|
|
@@ -6267,6 +7170,75 @@ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
|
6267
7170
|
round: z3.number().int(),
|
|
6268
7171
|
phase: z3.string()
|
|
6269
7172
|
}).strict(),
|
|
7173
|
+
z3.object({
|
|
7174
|
+
...loopShared,
|
|
7175
|
+
event: z3.literal("conflict_reentry"),
|
|
7176
|
+
task: z3.number().int(),
|
|
7177
|
+
pr: z3.number().int().positive(),
|
|
7178
|
+
attempt: z3.number().int().positive(),
|
|
7179
|
+
bound: z3.number().int().positive()
|
|
7180
|
+
}).strict(),
|
|
7181
|
+
z3.object({
|
|
7182
|
+
...loopShared,
|
|
7183
|
+
event: z3.literal("storage_push"),
|
|
7184
|
+
round: z3.number().int(),
|
|
7185
|
+
branch: z3.string(),
|
|
7186
|
+
head: z3.string()
|
|
7187
|
+
}).strict(),
|
|
7188
|
+
z3.object({
|
|
7189
|
+
...loopShared,
|
|
7190
|
+
event: z3.literal("local_checks_run"),
|
|
7191
|
+
round: z3.number().int(),
|
|
7192
|
+
head: z3.string().nullable(),
|
|
7193
|
+
passed: z3.boolean(),
|
|
7194
|
+
wall_ms: z3.number().nonnegative()
|
|
7195
|
+
}).strict(),
|
|
7196
|
+
z3.object({
|
|
7197
|
+
...loopShared,
|
|
7198
|
+
event: z3.literal("ready_push"),
|
|
7199
|
+
round: z3.number().int(),
|
|
7200
|
+
head: z3.string(),
|
|
7201
|
+
outcome: z3.enum(["passed", "refused"]),
|
|
7202
|
+
selected: z3.number().int().nonnegative(),
|
|
7203
|
+
failed: z3.number().int().nonnegative(),
|
|
7204
|
+
rerun: z3.boolean(),
|
|
7205
|
+
wall_ms: z3.number().nonnegative()
|
|
7206
|
+
}).strict(),
|
|
7207
|
+
z3.object({
|
|
7208
|
+
...loopShared,
|
|
7209
|
+
event: z3.literal("failed_tests_rerun"),
|
|
7210
|
+
round: z3.number().int(),
|
|
7211
|
+
head: z3.string(),
|
|
7212
|
+
rerun_of: z3.string(),
|
|
7213
|
+
failed_files: z3.number().int().nonnegative(),
|
|
7214
|
+
affected_files: z3.number().int().nonnegative(),
|
|
7215
|
+
full_count: z3.number().int().nonnegative()
|
|
7216
|
+
}).strict(),
|
|
7217
|
+
z3.object({
|
|
7218
|
+
...loopShared,
|
|
7219
|
+
event: z3.literal("pr_opened"),
|
|
7220
|
+
round: z3.number().int(),
|
|
7221
|
+
pr: z3.number().int().positive(),
|
|
7222
|
+
head: z3.string()
|
|
7223
|
+
}).strict(),
|
|
7224
|
+
z3.object({
|
|
7225
|
+
...loopShared,
|
|
7226
|
+
event: z3.literal("ci_result_read"),
|
|
7227
|
+
round: z3.number().int(),
|
|
7228
|
+
pr: z3.number().int().positive(),
|
|
7229
|
+
head: z3.string(),
|
|
7230
|
+
conclusion: z3.enum(["green", "red", "pending", "skipped"]),
|
|
7231
|
+
failing_checks: z3.array(z3.string()),
|
|
7232
|
+
wait_ms: z3.number().nonnegative()
|
|
7233
|
+
}).strict(),
|
|
7234
|
+
z3.object({
|
|
7235
|
+
...loopShared,
|
|
7236
|
+
event: z3.literal("phase_time"),
|
|
7237
|
+
round: z3.number().int(),
|
|
7238
|
+
phase: z3.enum(["developer", "local_checks", "review", "push", "ci", "other"]),
|
|
7239
|
+
step: z3.string(),
|
|
7240
|
+
wall_ms: z3.number().nonnegative()
|
|
7241
|
+
}).strict(),
|
|
6270
7242
|
z3.object({
|
|
6271
7243
|
...loopShared,
|
|
6272
7244
|
event: z3.literal("driver_exited"),
|
|
@@ -6454,7 +7426,7 @@ var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
|
6454
7426
|
]);
|
|
6455
7427
|
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6456
7428
|
var customShared = {
|
|
6457
|
-
meta:
|
|
7429
|
+
meta: HeaderMetaSchema,
|
|
6458
7430
|
subject: SubjectSchema,
|
|
6459
7431
|
kind: z3.literal("custom"),
|
|
6460
7432
|
...envelopeTail
|
|
@@ -6539,7 +7511,7 @@ function buildHeader(input) {
|
|
|
6539
7511
|
const issue = subject.issue;
|
|
6540
7512
|
return {
|
|
6541
7513
|
meta: {
|
|
6542
|
-
schema:
|
|
7514
|
+
schema: 4,
|
|
6543
7515
|
ts: input.now.toISOString(),
|
|
6544
7516
|
run_id: input.runId,
|
|
6545
7517
|
seq: input.seq,
|
|
@@ -6557,23 +7529,34 @@ function buildHeader(input) {
|
|
|
6557
7529
|
parent: lineageFieldFromEnv(input.env.parent)
|
|
6558
7530
|
},
|
|
6559
7531
|
input_versions: {
|
|
7532
|
+
manifest_version: input.inputVersions?.manifestVersion ?? null,
|
|
6560
7533
|
objectives_version: input.inputVersions?.objectivesVersion ?? null,
|
|
6561
7534
|
brief_hash: input.inputVersions?.briefHash ?? null,
|
|
6562
7535
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
7536
|
+
pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
|
|
6563
7537
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6564
7538
|
},
|
|
6565
7539
|
provenance: provenanceFor(input),
|
|
6566
7540
|
work: {
|
|
6567
7541
|
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6568
7542
|
repo: input.repo,
|
|
6569
|
-
change: null,
|
|
6570
|
-
revision: null
|
|
7543
|
+
change: pr === undefined ? null : String(pr),
|
|
7544
|
+
revision: input.revision ?? null
|
|
6571
7545
|
},
|
|
6572
7546
|
flow: {
|
|
6573
7547
|
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6574
7548
|
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6575
7549
|
},
|
|
6576
7550
|
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
7551
|
+
process: {
|
|
7552
|
+
id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
|
|
7553
|
+
version: lineageFieldFromEnv(input.env.processVersion),
|
|
7554
|
+
digest: lineageFieldFromEnv(input.env.processDigest)
|
|
7555
|
+
},
|
|
7556
|
+
runner: {
|
|
7557
|
+
id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
|
|
7558
|
+
version: lineageFieldFromEnv(input.env.runnerVersion)
|
|
7559
|
+
},
|
|
6577
7560
|
source: lineageFieldFromEnv(input.env.source)
|
|
6578
7561
|
},
|
|
6579
7562
|
subject
|
|
@@ -6617,7 +7600,7 @@ function redact(value, home) {
|
|
|
6617
7600
|
return value;
|
|
6618
7601
|
}
|
|
6619
7602
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6620
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
7603
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3, 4];
|
|
6621
7604
|
function metaOf(obj) {
|
|
6622
7605
|
if (obj === null || typeof obj !== "object")
|
|
6623
7606
|
return null;
|
|
@@ -6755,6 +7738,12 @@ var ManifestRecordSchema = z4.object({
|
|
|
6755
7738
|
briefHash: z4.string().min(1).nullable(),
|
|
6756
7739
|
objectivesVersion: z4.string().min(1).nullable(),
|
|
6757
7740
|
rulingOrdinal: epochNumber,
|
|
7741
|
+
manifestVersion: z4.literal(2).optional(),
|
|
7742
|
+
pauseBoundRuling: z4.object({
|
|
7743
|
+
rulingId: z4.string().min(1),
|
|
7744
|
+
pauseId: z4.string().min(1),
|
|
7745
|
+
contentDigest: z4.string().min(1)
|
|
7746
|
+
}).strict().nullable().optional(),
|
|
6758
7747
|
policyDigest: z4.string().min(1),
|
|
6759
7748
|
recordedAt: isoTimestamp
|
|
6760
7749
|
}).strict();
|
|
@@ -6776,7 +7765,11 @@ var LoopStateRecordSchema = z4.object({
|
|
|
6776
7765
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6777
7766
|
repeatMemory: z4.object({
|
|
6778
7767
|
blockingFindings: z4.array(z4.string()),
|
|
6779
|
-
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
7768
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
|
|
7769
|
+
}).strict().optional(),
|
|
7770
|
+
developerHandoff: z4.object({
|
|
7771
|
+
findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
|
|
7772
|
+
failingChecks: z4.array(z4.string().min(1))
|
|
6780
7773
|
}).strict().optional(),
|
|
6781
7774
|
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6782
7775
|
taskStartedAt: isoTimestamp.optional(),
|
|
@@ -6831,45 +7824,346 @@ var ResolutionRecordSchema = z4.object({
|
|
|
6831
7824
|
authenticatedFrom: z4.string().min(1),
|
|
6832
7825
|
consumedAt: isoTimestamp
|
|
6833
7826
|
}).strict();
|
|
7827
|
+
var ExecutionRoundMirrorRecordSchema = z4.object({
|
|
7828
|
+
version: z4.literal(1),
|
|
7829
|
+
kind: z4.literal("execution_round"),
|
|
7830
|
+
task: taskId,
|
|
7831
|
+
repository: z4.string().min(1),
|
|
7832
|
+
threadId: z4.string().min(1),
|
|
7833
|
+
checkpointId: z4.string().min(1),
|
|
7834
|
+
round: z4.number().int().positive(),
|
|
7835
|
+
recordedAt: isoTimestamp
|
|
7836
|
+
}).strict();
|
|
6834
7837
|
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6835
7838
|
var CONTROL_AREA_DIRNAME = "control";
|
|
6836
7839
|
// src/checks/bin/check-workspace-escape.ts
|
|
6837
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
6838
|
-
import { join as
|
|
7840
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync9, statSync as statSync3 } from "node:fs";
|
|
7841
|
+
import { join as join11 } from "node:path";
|
|
6839
7842
|
|
|
6840
7843
|
// src/lib/diff-evidence.ts
|
|
6841
7844
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
6842
|
-
import { join as
|
|
7845
|
+
import { join as join10, relative as relative2, resolve as resolve2 } from "node:path";
|
|
6843
7846
|
|
|
6844
7847
|
// src/lib/config.ts
|
|
6845
7848
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6846
7849
|
import { promisify as promisify4 } from "node:util";
|
|
6847
|
-
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7850
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
6848
7851
|
import { homedir } from "node:os";
|
|
6849
|
-
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6850
|
-
import { z as
|
|
7852
|
+
import { basename as basename3, dirname, isAbsolute, join, resolve } from "node:path";
|
|
7853
|
+
import { z as z6 } from "zod";
|
|
7854
|
+
|
|
7855
|
+
// src/checks/contract.ts
|
|
7856
|
+
var CHECK_SCHEMA_VERSION = 1;
|
|
7857
|
+
function emitCheckError(error) {
|
|
7858
|
+
process.stderr.write(`${JSON.stringify(error)}
|
|
7859
|
+
`);
|
|
7860
|
+
}
|
|
6851
7861
|
|
|
6852
7862
|
// src/lib/agent-vendors.ts
|
|
6853
7863
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
6854
7864
|
|
|
7865
|
+
// src/lib/prose-rules-config.ts
|
|
7866
|
+
import safeRegex from "safe-regex2";
|
|
7867
|
+
import { z as z5 } from "zod";
|
|
7868
|
+
var SEVERITIES = ["error", "warning"];
|
|
7869
|
+
var OVERRIDE_KEYS = ["scopes", "severity", "exempt"];
|
|
7870
|
+
var FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
|
|
7871
|
+
var CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
|
|
7872
|
+
var DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
|
|
7873
|
+
function isPlainObject3(value) {
|
|
7874
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7875
|
+
}
|
|
7876
|
+
function outsideRepositoryReason(entry) {
|
|
7877
|
+
if (entry.startsWith("/") || /^[A-Za-z]:/.test(entry))
|
|
7878
|
+
return "must be a repository-relative path, not an absolute one";
|
|
7879
|
+
if (entry.split(/[\\/]/).includes(".."))
|
|
7880
|
+
return "must stay inside the repository — no `..` segment";
|
|
7881
|
+
return null;
|
|
7882
|
+
}
|
|
7883
|
+
var RepoRelativePathSchema = z5.string().min(1).superRefine((entry, ctx) => {
|
|
7884
|
+
const reason = outsideRepositoryReason(entry);
|
|
7885
|
+
if (reason)
|
|
7886
|
+
ctx.addIssue({ code: z5.ZodIssueCode.custom, message: reason });
|
|
7887
|
+
});
|
|
7888
|
+
function pathListIssues(value, path, issues) {
|
|
7889
|
+
if (!Array.isArray(value)) {
|
|
7890
|
+
issues.push({ path, message: "must be a list of repository-relative paths" });
|
|
7891
|
+
return;
|
|
7892
|
+
}
|
|
7893
|
+
value.forEach((entry, index) => {
|
|
7894
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
7895
|
+
issues.push({ path: [...path, index], message: "must be a non-empty repository-relative path" });
|
|
7896
|
+
return;
|
|
7897
|
+
}
|
|
7898
|
+
const reason = outsideRepositoryReason(entry);
|
|
7899
|
+
if (reason)
|
|
7900
|
+
issues.push({ path: [...path, index], message: reason });
|
|
7901
|
+
});
|
|
7902
|
+
}
|
|
7903
|
+
function scopeListIssues(value, path, allowed, issues) {
|
|
7904
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
7905
|
+
issues.push({ path, message: "must name at least one scope" });
|
|
7906
|
+
return null;
|
|
7907
|
+
}
|
|
7908
|
+
const scopes = [];
|
|
7909
|
+
value.forEach((scope, index) => {
|
|
7910
|
+
if (typeof scope !== "string" || !CONFIGURABLE_PROSE_SCOPES.includes(scope)) {
|
|
7911
|
+
issues.push({
|
|
7912
|
+
path: [...path, index],
|
|
7913
|
+
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(", ")}`
|
|
7914
|
+
});
|
|
7915
|
+
return;
|
|
7916
|
+
}
|
|
7917
|
+
if (!allowed.includes(scope)) {
|
|
7918
|
+
issues.push({
|
|
7919
|
+
path: [...path, index],
|
|
7920
|
+
message: `scope "${scope}" is not one this rule can run in — it can run in: ${allowed.join(", ")}`
|
|
7921
|
+
});
|
|
7922
|
+
return;
|
|
7923
|
+
}
|
|
7924
|
+
scopes.push(scope);
|
|
7925
|
+
});
|
|
7926
|
+
return scopes;
|
|
7927
|
+
}
|
|
7928
|
+
function severityIssues(value, path, scopes, issues) {
|
|
7929
|
+
if (typeof value === "string") {
|
|
7930
|
+
if (!SEVERITIES.includes(value)) {
|
|
7931
|
+
issues.push({ path, message: `unknown severity ${JSON.stringify(value)} — use "error" or "warning"` });
|
|
7932
|
+
}
|
|
7933
|
+
return;
|
|
7934
|
+
}
|
|
7935
|
+
if (!isPlainObject3(value)) {
|
|
7936
|
+
issues.push({ path, message: 'must be "error", "warning", or a map from scope to one of them' });
|
|
7937
|
+
return;
|
|
7938
|
+
}
|
|
7939
|
+
for (const [scope, severity] of Object.entries(value)) {
|
|
7940
|
+
if (!scopes.includes(scope)) {
|
|
7941
|
+
issues.push({ path: [...path, scope], message: `names scope "${scope}", which this rule's scopes do not cover` });
|
|
7942
|
+
}
|
|
7943
|
+
if (typeof severity !== "string" || !SEVERITIES.includes(severity)) {
|
|
7944
|
+
issues.push({
|
|
7945
|
+
path: [...path, scope],
|
|
7946
|
+
message: `unknown severity ${JSON.stringify(severity)} — use "error" or "warning"`
|
|
7947
|
+
});
|
|
7948
|
+
}
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7951
|
+
function patternIssues(source, flags, path, issues) {
|
|
7952
|
+
if (typeof source !== "string" || source.length === 0) {
|
|
7953
|
+
issues.push({ path, message: "must be a non-empty regular expression" });
|
|
7954
|
+
return;
|
|
7955
|
+
}
|
|
7956
|
+
if (source.length > CONFIGURED_PATTERN_MAX_LENGTH) {
|
|
7957
|
+
issues.push({
|
|
7958
|
+
path,
|
|
7959
|
+
message: `is ${source.length} characters, over the ${CONFIGURED_PATTERN_MAX_LENGTH}-character limit for a configured pattern`
|
|
7960
|
+
});
|
|
7961
|
+
return;
|
|
7962
|
+
}
|
|
7963
|
+
try {
|
|
7964
|
+
new RegExp(source, flags);
|
|
7965
|
+
} catch (err) {
|
|
7966
|
+
issues.push({ path, message: `does not compile: ${err.message}` });
|
|
7967
|
+
return;
|
|
7968
|
+
}
|
|
7969
|
+
if (!safeRegex(source, { limit: Number.MAX_SAFE_INTEGER })) {
|
|
7970
|
+
issues.push({
|
|
7971
|
+
path,
|
|
7972
|
+
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."
|
|
7973
|
+
});
|
|
7974
|
+
}
|
|
7975
|
+
}
|
|
7976
|
+
function flagIssues(value, path, issues) {
|
|
7977
|
+
if (value === undefined)
|
|
7978
|
+
return "";
|
|
7979
|
+
if (typeof value !== "string") {
|
|
7980
|
+
issues.push({ path, message: 'must be a string of flags, e.g. "i"' });
|
|
7981
|
+
return "";
|
|
7982
|
+
}
|
|
7983
|
+
const seen = new Set;
|
|
7984
|
+
for (const flag of value) {
|
|
7985
|
+
if (!CONFIGURED_PROSE_FLAGS.includes(flag)) {
|
|
7986
|
+
issues.push({
|
|
7987
|
+
path,
|
|
7988
|
+
message: `unknown flag ${JSON.stringify(flag)} — only ${CONFIGURED_PROSE_FLAGS.map((f) => `"${f}"`).join(" and ")} are allowed`
|
|
7989
|
+
});
|
|
7990
|
+
return "";
|
|
7991
|
+
}
|
|
7992
|
+
if (seen.has(flag)) {
|
|
7993
|
+
issues.push({ path, message: `repeats the flag "${flag}"` });
|
|
7994
|
+
return "";
|
|
7995
|
+
}
|
|
7996
|
+
seen.add(flag);
|
|
7997
|
+
}
|
|
7998
|
+
return value;
|
|
7999
|
+
}
|
|
8000
|
+
function defaultsIssues(value, issues) {
|
|
8001
|
+
const base = ["defaults"];
|
|
8002
|
+
if (!isPlainObject3(value)) {
|
|
8003
|
+
issues.push({ path: base, message: 'must map a default rule id to "off" or an override' });
|
|
8004
|
+
return;
|
|
8005
|
+
}
|
|
8006
|
+
for (const [id, override] of Object.entries(value)) {
|
|
8007
|
+
const path = [...base, id];
|
|
8008
|
+
const rule = CONFIGURABLE_DEFAULT_RULES.find((candidate) => candidate.id === id);
|
|
8009
|
+
if (!rule) {
|
|
8010
|
+
issues.push({
|
|
8011
|
+
path,
|
|
8012
|
+
message: `unknown default rule id "${id}" — \`vinaya check --plan\` lists the rules each prose check runs`
|
|
8013
|
+
});
|
|
8014
|
+
continue;
|
|
8015
|
+
}
|
|
8016
|
+
if (override === "off")
|
|
8017
|
+
continue;
|
|
8018
|
+
if (!isPlainObject3(override)) {
|
|
8019
|
+
issues.push({ path, message: 'must be "off" or an object with any of scopes, severity, exempt' });
|
|
8020
|
+
continue;
|
|
8021
|
+
}
|
|
8022
|
+
for (const key of Object.keys(override)) {
|
|
8023
|
+
if (OVERRIDE_KEYS.includes(key))
|
|
8024
|
+
continue;
|
|
8025
|
+
issues.push({
|
|
8026
|
+
path: [...path, key],
|
|
8027
|
+
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`
|
|
8028
|
+
});
|
|
8029
|
+
}
|
|
8030
|
+
const scopes = override.scopes === undefined ? [...rule.scopes] : scopeListIssues(override.scopes, [...path, "scopes"], allowedScopesFor(rule), issues);
|
|
8031
|
+
if (override.severity !== undefined && scopes)
|
|
8032
|
+
severityIssues(override.severity, [...path, "severity"], scopes, issues);
|
|
8033
|
+
if (override.exempt !== undefined)
|
|
8034
|
+
pathListIssues(override.exempt, [...path, "exempt"], issues);
|
|
8035
|
+
}
|
|
8036
|
+
}
|
|
8037
|
+
function customIssues(value, issues) {
|
|
8038
|
+
if (!Array.isArray(value)) {
|
|
8039
|
+
issues.push({ path: ["custom"], message: "must be a list of rules" });
|
|
8040
|
+
return;
|
|
8041
|
+
}
|
|
8042
|
+
const ids = new Set;
|
|
8043
|
+
value.forEach((rule, index) => {
|
|
8044
|
+
const path = ["custom", index];
|
|
8045
|
+
if (!isPlainObject3(rule)) {
|
|
8046
|
+
issues.push({ path, message: "must be a rule object" });
|
|
8047
|
+
return;
|
|
8048
|
+
}
|
|
8049
|
+
for (const key of Object.keys(rule)) {
|
|
8050
|
+
if (!CUSTOM_KEYS.includes(key)) {
|
|
8051
|
+
issues.push({ path: [...path, key], message: `unknown key "${key}" — a rule takes ${CUSTOM_KEYS.join(", ")}` });
|
|
8052
|
+
}
|
|
8053
|
+
}
|
|
8054
|
+
if (typeof rule.id !== "string" || rule.id.length === 0) {
|
|
8055
|
+
issues.push({ path: [...path, "id"], message: "a custom rule needs an id" });
|
|
8056
|
+
} else if (DEFAULT_IDS.has(rule.id)) {
|
|
8057
|
+
issues.push({
|
|
8058
|
+
path: [...path, "id"],
|
|
8059
|
+
message: `"${rule.id}" is a default rule id — a custom rule needs its own id; retune the default under proseGates.rules.defaults instead`
|
|
8060
|
+
});
|
|
8061
|
+
} else if (ids.has(rule.id)) {
|
|
8062
|
+
issues.push({ path: [...path, "id"], message: `"${rule.id}" is used by an earlier custom rule` });
|
|
8063
|
+
} else {
|
|
8064
|
+
ids.add(rule.id);
|
|
8065
|
+
}
|
|
8066
|
+
if (typeof rule.means !== "string" || rule.means.trim().length === 0) {
|
|
8067
|
+
issues.push({ path: [...path, "means"], message: "a custom rule needs a message (`means`)" });
|
|
8068
|
+
}
|
|
8069
|
+
let scopes = null;
|
|
8070
|
+
if (rule.scopes === undefined) {
|
|
8071
|
+
issues.push({ path: [...path, "scopes"], message: "a custom rule needs at least one scope (`scopes`)" });
|
|
8072
|
+
} else {
|
|
8073
|
+
scopes = scopeListIssues(rule.scopes, [...path, "scopes"], CONFIGURABLE_PROSE_SCOPES, issues);
|
|
8074
|
+
}
|
|
8075
|
+
if (scopes && new Set(scopes.map(groupOfScope)).size > 1) {
|
|
8076
|
+
issues.push({
|
|
8077
|
+
path: [...path, "scopes"],
|
|
8078
|
+
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'
|
|
8079
|
+
});
|
|
8080
|
+
}
|
|
8081
|
+
const flags = flagIssues(rule.flags, [...path, "flags"], issues);
|
|
8082
|
+
if (rule.pattern === undefined && rule.patterns === undefined) {
|
|
8083
|
+
issues.push({
|
|
8084
|
+
path: [...path, "pattern"],
|
|
8085
|
+
message: "a custom rule needs a `pattern` or a per-scope `patterns` map"
|
|
8086
|
+
});
|
|
8087
|
+
}
|
|
8088
|
+
if (rule.pattern !== undefined)
|
|
8089
|
+
patternIssues(rule.pattern, flags, [...path, "pattern"], issues);
|
|
8090
|
+
if (rule.patterns !== undefined) {
|
|
8091
|
+
if (!isPlainObject3(rule.patterns)) {
|
|
8092
|
+
issues.push({ path: [...path, "patterns"], message: "must map a scope to a regular expression" });
|
|
8093
|
+
} else {
|
|
8094
|
+
for (const [scope, source] of Object.entries(rule.patterns)) {
|
|
8095
|
+
if (scopes && !scopes.includes(scope)) {
|
|
8096
|
+
issues.push({
|
|
8097
|
+
path: [...path, "patterns", scope],
|
|
8098
|
+
message: `names scope "${scope}", which this rule's scopes do not cover`
|
|
8099
|
+
});
|
|
8100
|
+
continue;
|
|
8101
|
+
}
|
|
8102
|
+
patternIssues(source, flags, [...path, "patterns", scope], issues);
|
|
8103
|
+
}
|
|
8104
|
+
if (rule.pattern === undefined && scopes) {
|
|
8105
|
+
for (const scope of scopes) {
|
|
8106
|
+
if (!(scope in rule.patterns)) {
|
|
8107
|
+
issues.push({
|
|
8108
|
+
path: [...path, "patterns"],
|
|
8109
|
+
message: `has no pattern for scope "${scope}" — add one, or a \`pattern\` every other scope uses`
|
|
8110
|
+
});
|
|
8111
|
+
}
|
|
8112
|
+
}
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
8115
|
+
}
|
|
8116
|
+
if (rule.severity !== undefined && scopes)
|
|
8117
|
+
severityIssues(rule.severity, [...path, "severity"], scopes, issues);
|
|
8118
|
+
if (rule.exempt !== undefined)
|
|
8119
|
+
pathListIssues(rule.exempt, [...path, "exempt"], issues);
|
|
8120
|
+
});
|
|
8121
|
+
}
|
|
8122
|
+
function proseRulesIssues(value) {
|
|
8123
|
+
const issues = [];
|
|
8124
|
+
if (!isPlainObject3(value))
|
|
8125
|
+
return [{ path: [], message: "must be an object with any of exempt, defaults, custom" }];
|
|
8126
|
+
for (const key of Object.keys(value)) {
|
|
8127
|
+
if (!["exempt", "defaults", "custom"].includes(key)) {
|
|
8128
|
+
issues.push({ path: [key], message: `unknown key "${key}" — proseGates.rules takes exempt, defaults and custom` });
|
|
8129
|
+
}
|
|
8130
|
+
}
|
|
8131
|
+
if (value.exempt !== undefined)
|
|
8132
|
+
pathListIssues(value.exempt, ["exempt"], issues);
|
|
8133
|
+
if (value.defaults !== undefined)
|
|
8134
|
+
defaultsIssues(value.defaults, issues);
|
|
8135
|
+
if (value.custom !== undefined)
|
|
8136
|
+
customIssues(value.custom, issues);
|
|
8137
|
+
return issues;
|
|
8138
|
+
}
|
|
8139
|
+
var ProseRulesSchema = z5.unknown().superRefine((value, ctx) => {
|
|
8140
|
+
for (const issue of proseRulesIssues(value)) {
|
|
8141
|
+
ctx.addIssue({ code: z5.ZodIssueCode.custom, path: issue.path, message: issue.message });
|
|
8142
|
+
}
|
|
8143
|
+
}).transform((value) => value);
|
|
8144
|
+
var PublishedProseSchema = z5.object({
|
|
8145
|
+
allow: z5.array(z5.string().min(1)).optional()
|
|
8146
|
+
}).strict();
|
|
8147
|
+
|
|
6855
8148
|
// src/lib/config.ts
|
|
6856
|
-
var EnvEntrySchema =
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
8149
|
+
var EnvEntrySchema = z6.union([
|
|
8150
|
+
z6.literal(true),
|
|
8151
|
+
z6.object({ optional: z6.literal(true) }),
|
|
8152
|
+
z6.object({ anyOf: z6.array(z6.string()).min(2) }),
|
|
8153
|
+
z6.string()
|
|
6861
8154
|
]);
|
|
6862
|
-
var CheckEntrySchema =
|
|
6863
|
-
run:
|
|
6864
|
-
scope:
|
|
6865
|
-
include:
|
|
6866
|
-
args:
|
|
6867
|
-
timeoutMs:
|
|
6868
|
-
env:
|
|
6869
|
-
requiresOpenPr:
|
|
6870
|
-
ownWorkflow:
|
|
6871
|
-
principalOwed:
|
|
6872
|
-
validates:
|
|
8155
|
+
var CheckEntrySchema = z6.object({
|
|
8156
|
+
run: z6.string(),
|
|
8157
|
+
scope: z6.enum(["diff", "full"]),
|
|
8158
|
+
include: z6.array(z6.string()).optional(),
|
|
8159
|
+
args: z6.array(z6.string()).optional(),
|
|
8160
|
+
timeoutMs: z6.number().optional(),
|
|
8161
|
+
env: z6.record(z6.string(), EnvEntrySchema).optional(),
|
|
8162
|
+
requiresOpenPr: z6.boolean().optional(),
|
|
8163
|
+
ownWorkflow: z6.boolean().optional(),
|
|
8164
|
+
principalOwed: z6.literal(true).optional(),
|
|
8165
|
+
validates: z6.enum(["body", "issue"]).optional(),
|
|
8166
|
+
advisory: z6.literal(true).optional()
|
|
6873
8167
|
}).superRefine((entry, ctx) => {
|
|
6874
8168
|
if (!entry.env)
|
|
6875
8169
|
return;
|
|
@@ -6879,22 +8173,22 @@ var CheckEntrySchema = z5.object({
|
|
|
6879
8173
|
const members = value.anyOf;
|
|
6880
8174
|
if (new Set(members).size !== members.length) {
|
|
6881
8175
|
ctx.addIssue({
|
|
6882
|
-
code:
|
|
8176
|
+
code: z6.ZodIssueCode.custom,
|
|
6883
8177
|
message: `env.${key}.anyOf has duplicate members`,
|
|
6884
8178
|
path: ["env", key, "anyOf"]
|
|
6885
8179
|
});
|
|
6886
8180
|
}
|
|
6887
8181
|
if (!members.includes(key)) {
|
|
6888
8182
|
ctx.addIssue({
|
|
6889
|
-
code:
|
|
8183
|
+
code: z6.ZodIssueCode.custom,
|
|
6890
8184
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
6891
8185
|
path: ["env", key, "anyOf"]
|
|
6892
8186
|
});
|
|
6893
8187
|
}
|
|
6894
8188
|
}
|
|
6895
8189
|
});
|
|
6896
|
-
var RoleEntrySchema =
|
|
6897
|
-
contract:
|
|
8190
|
+
var RoleEntrySchema = z6.object({
|
|
8191
|
+
contract: z6.string().refine((p) => p.includes("/"), {
|
|
6898
8192
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
6899
8193
|
})
|
|
6900
8194
|
});
|
|
@@ -6918,17 +8212,17 @@ var BRIEF_BUILTINS = [
|
|
|
6918
8212
|
"briefSections",
|
|
6919
8213
|
"milestoneShape"
|
|
6920
8214
|
];
|
|
6921
|
-
var BriefSectionSchema =
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
8215
|
+
var BriefSectionSchema = z6.union([
|
|
8216
|
+
z6.object({ builtin: z6.enum(BRIEF_BUILTINS) }),
|
|
8217
|
+
z6.object({ heading: z6.string().min(1), name: z6.string().optional() }),
|
|
8218
|
+
z6.object({ field: z6.string().min(1), name: z6.string().optional() }),
|
|
8219
|
+
z6.object({ phrase: z6.string().min(1), name: z6.string().optional() })
|
|
6926
8220
|
]);
|
|
6927
|
-
var BriefSchemaSchema =
|
|
6928
|
-
pr:
|
|
6929
|
-
issue:
|
|
6930
|
-
milestone:
|
|
6931
|
-
ack:
|
|
8221
|
+
var BriefSchemaSchema = z6.object({
|
|
8222
|
+
pr: z6.object({ sections: z6.array(BriefSectionSchema) }).optional(),
|
|
8223
|
+
issue: z6.object({ sections: z6.array(BriefSectionSchema) }).optional(),
|
|
8224
|
+
milestone: z6.object({ sections: z6.array(BriefSectionSchema) }).optional(),
|
|
8225
|
+
ack: z6.array(z6.enum(BRIEF_BUILTINS)).optional()
|
|
6932
8226
|
});
|
|
6933
8227
|
function isSafeRepoRelPath(p) {
|
|
6934
8228
|
if (p.length === 0)
|
|
@@ -6937,7 +8231,7 @@ function isSafeRepoRelPath(p) {
|
|
|
6937
8231
|
return false;
|
|
6938
8232
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
6939
8233
|
}
|
|
6940
|
-
var SafeRepoRelPath =
|
|
8234
|
+
var SafeRepoRelPath = z6.string().refine(isSafeRepoRelPath, {
|
|
6941
8235
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
6942
8236
|
});
|
|
6943
8237
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -6947,22 +8241,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
6947
8241
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
6948
8242
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
6949
8243
|
});
|
|
6950
|
-
var ManagedBlockRecordSchema =
|
|
8244
|
+
var ManagedBlockRecordSchema = z6.object({
|
|
6951
8245
|
path: ManagedHookBlockPath,
|
|
6952
|
-
marker:
|
|
6953
|
-
comment:
|
|
8246
|
+
marker: z6.string(),
|
|
8247
|
+
comment: z6.enum(["hash", "html"])
|
|
6954
8248
|
});
|
|
6955
|
-
var ManagedManifestSchema =
|
|
6956
|
-
version:
|
|
6957
|
-
files:
|
|
6958
|
-
blocks:
|
|
6959
|
-
labels:
|
|
6960
|
-
agents:
|
|
8249
|
+
var ManagedManifestSchema = z6.object({
|
|
8250
|
+
version: z6.number().int().positive(),
|
|
8251
|
+
files: z6.array(SafeRepoRelPath),
|
|
8252
|
+
blocks: z6.array(ManagedBlockRecordSchema),
|
|
8253
|
+
labels: z6.array(z6.string()),
|
|
8254
|
+
agents: z6.array(z6.enum(AGENT_VENDORS)).optional()
|
|
6961
8255
|
});
|
|
6962
|
-
var ProjectEntrySchema =
|
|
6963
|
-
name:
|
|
6964
|
-
description:
|
|
6965
|
-
path:
|
|
8256
|
+
var ProjectEntrySchema = z6.object({
|
|
8257
|
+
name: z6.string().min(1),
|
|
8258
|
+
description: z6.string().min(1).optional(),
|
|
8259
|
+
path: z6.string().min(1).optional()
|
|
6966
8260
|
});
|
|
6967
8261
|
function parseTokensCollectDeclaration(value) {
|
|
6968
8262
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -6973,90 +8267,101 @@ function parseTokensCollectDeclaration(value) {
|
|
|
6973
8267
|
return null;
|
|
6974
8268
|
return { interpreter, script };
|
|
6975
8269
|
}
|
|
6976
|
-
var
|
|
6977
|
-
rings:
|
|
6978
|
-
ring1_forgeWriteInterception:
|
|
6979
|
-
ring2_asyncAudits:
|
|
8270
|
+
var VinayaConfigObjectSchema = z6.object({
|
|
8271
|
+
rings: z6.object({
|
|
8272
|
+
ring1_forgeWriteInterception: z6.boolean(),
|
|
8273
|
+
ring2_asyncAudits: z6.boolean()
|
|
6980
8274
|
}).optional(),
|
|
6981
|
-
checks:
|
|
6982
|
-
roles:
|
|
8275
|
+
checks: z6.record(z6.string(), CheckEntrySchema).optional(),
|
|
8276
|
+
roles: z6.record(z6.string(), RoleEntrySchema).optional(),
|
|
6983
8277
|
briefSchema: BriefSchemaSchema.optional(),
|
|
6984
8278
|
managed: ManagedManifestSchema.optional(),
|
|
6985
|
-
principals:
|
|
6986
|
-
releaseActor:
|
|
6987
|
-
ci:
|
|
6988
|
-
tokens:
|
|
6989
|
-
collect:
|
|
8279
|
+
principals: z6.array(z6.string()).min(1).optional(),
|
|
8280
|
+
releaseActor: z6.string().min(1).optional(),
|
|
8281
|
+
ci: z6.object({ setup: z6.string().min(1) }).optional(),
|
|
8282
|
+
tokens: z6.object({
|
|
8283
|
+
collect: z6.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
6990
8284
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
6991
8285
|
})
|
|
6992
8286
|
}).optional(),
|
|
6993
|
-
blastRadius:
|
|
6994
|
-
proseGates:
|
|
6995
|
-
doctrineRoot:
|
|
6996
|
-
readerFacingPrefix:
|
|
6997
|
-
readerFacingSuffix:
|
|
6998
|
-
legacySlugDir:
|
|
6999
|
-
sourceComments:
|
|
7000
|
-
globs:
|
|
7001
|
-
allowlist:
|
|
7002
|
-
severity:
|
|
8287
|
+
blastRadius: z6.object({ extraDomains: z6.array(z6.string()).optional() }).optional(),
|
|
8288
|
+
proseGates: z6.object({
|
|
8289
|
+
doctrineRoot: z6.string().min(1).optional(),
|
|
8290
|
+
readerFacingPrefix: z6.string().min(1).optional(),
|
|
8291
|
+
readerFacingSuffix: z6.string().min(1).optional(),
|
|
8292
|
+
legacySlugDir: z6.string().min(1).optional(),
|
|
8293
|
+
sourceComments: z6.object({
|
|
8294
|
+
globs: z6.array(z6.string().min(1)).optional(),
|
|
8295
|
+
allowlist: z6.array(z6.string().min(1)).optional(),
|
|
8296
|
+
severity: z6.enum(["warning", "error"]).optional()
|
|
7003
8297
|
}).optional(),
|
|
7004
|
-
specGrandfather:
|
|
7005
|
-
specPaths:
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
})).optional()
|
|
8298
|
+
specGrandfather: z6.union([z6.array(z6.string().min(1)), z6.record(z6.string().min(1), z6.number().int().min(0))]).optional(),
|
|
8299
|
+
specPaths: z6.array(RepoRelativePathSchema).optional(),
|
|
8300
|
+
productPaths: z6.array(RepoRelativePathSchema).optional(),
|
|
8301
|
+
published: PublishedProseSchema.optional(),
|
|
8302
|
+
rules: ProseRulesSchema.optional()
|
|
7010
8303
|
}).optional(),
|
|
7011
|
-
projects:
|
|
7012
|
-
dispatch:
|
|
7013
|
-
timeoutMs:
|
|
7014
|
-
|
|
7015
|
-
|
|
8304
|
+
projects: z6.array(ProjectEntrySchema).optional(),
|
|
8305
|
+
dispatch: z6.object({
|
|
8306
|
+
timeoutMs: z6.number().int().positive().optional(),
|
|
8307
|
+
reviewerTimeoutMs: z6.number().int().positive().optional(),
|
|
8308
|
+
killGraceMs: z6.number().int().positive().optional(),
|
|
8309
|
+
agent: z6.enum(["claude", "codex"]).optional()
|
|
7016
8310
|
}).optional(),
|
|
7017
|
-
reviewPolicy:
|
|
7018
|
-
codeReviewThreshold:
|
|
7019
|
-
securityThreshold:
|
|
7020
|
-
maxRounds:
|
|
7021
|
-
maxTaskMinutes:
|
|
8311
|
+
reviewPolicy: z6.object({
|
|
8312
|
+
codeReviewThreshold: z6.string().min(1).optional(),
|
|
8313
|
+
securityThreshold: z6.string().min(1).optional(),
|
|
8314
|
+
maxRounds: z6.number().optional(),
|
|
8315
|
+
maxTaskMinutes: z6.number().optional(),
|
|
8316
|
+
readyPushTimeoutMinutes: z6.number().optional()
|
|
7022
8317
|
}).optional(),
|
|
7023
|
-
securityScan:
|
|
7024
|
-
command:
|
|
8318
|
+
securityScan: z6.object({
|
|
8319
|
+
command: z6.array(z6.string().min(1)).min(1)
|
|
7025
8320
|
}).optional(),
|
|
7026
|
-
gateCutovers:
|
|
7027
|
-
objectivesSinceIssue:
|
|
7028
|
-
briefSectionsSinceIssue:
|
|
7029
|
-
documentationSinceIssue:
|
|
7030
|
-
briefRulesSincePr:
|
|
7031
|
-
agentBoxesRefusedSincePr:
|
|
8321
|
+
gateCutovers: z6.object({
|
|
8322
|
+
objectivesSinceIssue: z6.number().int().nonnegative().optional(),
|
|
8323
|
+
briefSectionsSinceIssue: z6.number().int().nonnegative().optional(),
|
|
8324
|
+
documentationSinceIssue: z6.number().int().nonnegative().optional(),
|
|
8325
|
+
briefRulesSincePr: z6.number().int().nonnegative().optional(),
|
|
8326
|
+
agentBoxesRefusedSincePr: z6.number().int().nonnegative().optional()
|
|
7032
8327
|
}).optional(),
|
|
7033
|
-
planning:
|
|
7034
|
-
collisionThreshold:
|
|
8328
|
+
planning: z6.object({
|
|
8329
|
+
collisionThreshold: z6.number().int().nonnegative().optional()
|
|
7035
8330
|
}).optional(),
|
|
7036
|
-
prePush:
|
|
7037
|
-
alwaysRun:
|
|
8331
|
+
prePush: z6.object({
|
|
8332
|
+
alwaysRun: z6.array(z6.string()).optional(),
|
|
8333
|
+
readyTests: z6.object({
|
|
8334
|
+
mode: z6.literal("ci"),
|
|
8335
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8336
|
+
check: z6.literal("Vinaya CI")
|
|
8337
|
+
}).strict().optional(),
|
|
8338
|
+
requiredCi: z6.object({
|
|
8339
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8340
|
+
check: z6.literal("Vinaya CI")
|
|
8341
|
+
}).strict().optional()
|
|
7038
8342
|
}).optional(),
|
|
7039
|
-
report:
|
|
7040
|
-
commandTimeoutMs:
|
|
8343
|
+
report: z6.object({
|
|
8344
|
+
commandTimeoutMs: z6.number().int().positive().optional()
|
|
7041
8345
|
}).superRefine((report, ctx) => {
|
|
7042
8346
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
7043
8347
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
7044
8348
|
ctx.addIssue({
|
|
7045
|
-
code:
|
|
8349
|
+
code: z6.ZodIssueCode.custom,
|
|
7046
8350
|
path: ["commandTimeoutMs"],
|
|
7047
8351
|
message: "must be at most 3600000 (1 hour)"
|
|
7048
8352
|
});
|
|
7049
8353
|
}
|
|
7050
8354
|
}).optional(),
|
|
7051
|
-
logPublish:
|
|
8355
|
+
logPublish: z6.unknown().refine((v) => v === undefined, {
|
|
7052
8356
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
7053
8357
|
}),
|
|
7054
|
-
runtimeDir:
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
8358
|
+
runtimeDir: z6.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
8359
|
+
runner: z6.enum(["standalone", "atta-engine"]).optional(),
|
|
8360
|
+
logs: z6.object({
|
|
8361
|
+
folder: z6.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
8362
|
+
url: z6.string().url().optional(),
|
|
8363
|
+
headers: z6.record(z6.string()).optional(),
|
|
8364
|
+
readHeaders: z6.record(z6.string()).optional(),
|
|
7060
8365
|
events: CustomEventDeclarationsSchema.optional()
|
|
7061
8366
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
7062
8367
|
message: "logs: set at most one of folder/url"
|
|
@@ -7064,8 +8369,33 @@ var VinayaConfigSchema = z5.object({
|
|
|
7064
8369
|
message: "logs: headers requires url"
|
|
7065
8370
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
7066
8371
|
message: "logs: readHeaders requires url"
|
|
7067
|
-
}).optional()
|
|
8372
|
+
}).or(z6.literal(false)).optional(),
|
|
8373
|
+
decisionRecords: z6.object({
|
|
8374
|
+
path: RepoRelativePathSchema
|
|
8375
|
+
}).strict().optional()
|
|
8376
|
+
});
|
|
8377
|
+
function decisionRecordsPathIssue(path, doctrineRoot) {
|
|
8378
|
+
const reason = outsideRepositoryReason(path);
|
|
8379
|
+
if (reason)
|
|
8380
|
+
return reason;
|
|
8381
|
+
const folder = normalizeSpecPath(path);
|
|
8382
|
+
if (folder === "" || folder === ".")
|
|
8383
|
+
return "must name a folder, not the repository root";
|
|
8384
|
+
const root = normalizeSpecPath(doctrineRoot ?? "aeg-root");
|
|
8385
|
+
if (folder === root || folder.startsWith(`${root}/`)) {
|
|
8386
|
+
return `must be outside the doctrine tree "${root}" — decision records belong to this repository, not to the doctrine it ships`;
|
|
8387
|
+
}
|
|
8388
|
+
return null;
|
|
8389
|
+
}
|
|
8390
|
+
var VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
|
|
8391
|
+
const path = config.decisionRecords?.path;
|
|
8392
|
+
if (path === undefined || outsideRepositoryReason(path))
|
|
8393
|
+
return;
|
|
8394
|
+
const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
|
|
8395
|
+
if (issue)
|
|
8396
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
|
|
7068
8397
|
});
|
|
8398
|
+
var VinayaConfigShape = VinayaConfigObjectSchema.shape;
|
|
7069
8399
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
7070
8400
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
7071
8401
|
var LOCAL_CONFIG_FILENAME = "vinaya.config.json";
|
|
@@ -7146,9 +8476,6 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
7146
8476
|
}
|
|
7147
8477
|
return result;
|
|
7148
8478
|
}
|
|
7149
|
-
function resolvePrincipalAllowlist(config) {
|
|
7150
|
-
return config?.principals ?? PRINCIPAL_ALLOWLIST;
|
|
7151
|
-
}
|
|
7152
8479
|
function resolveReleaseActor(config) {
|
|
7153
8480
|
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
7154
8481
|
}
|
|
@@ -7172,13 +8499,19 @@ function resolveReviewPolicy(config) {
|
|
|
7172
8499
|
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
7173
8500
|
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
7174
8501
|
}
|
|
8502
|
+
const readyPushTimeoutMinutes = raw.readyPushTimeoutMinutes ?? DEFAULT_READY_PUSH_TIMEOUT_MINUTES;
|
|
8503
|
+
if (!Number.isInteger(readyPushTimeoutMinutes) || readyPushTimeoutMinutes < 1) {
|
|
8504
|
+
throw new Error(`vinaya.config.json: reviewPolicy.readyPushTimeoutMinutes "${readyPushTimeoutMinutes}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
8505
|
+
}
|
|
7175
8506
|
return {
|
|
7176
8507
|
codeReviewThreshold,
|
|
7177
8508
|
securityThreshold,
|
|
7178
8509
|
maxRounds,
|
|
7179
|
-
maxTaskMinutes
|
|
8510
|
+
maxTaskMinutes,
|
|
8511
|
+
readyPushTimeoutMinutes
|
|
7180
8512
|
};
|
|
7181
8513
|
}
|
|
8514
|
+
var emittedLocalOverrideWarnings = new Set;
|
|
7182
8515
|
function resolveGateCutovers(config) {
|
|
7183
8516
|
const raw = config?.gateCutovers;
|
|
7184
8517
|
if (!raw)
|
|
@@ -7284,13 +8617,14 @@ function readTrustAnchorConfigAtRef(ref) {
|
|
|
7284
8617
|
});
|
|
7285
8618
|
return Buffer.from(raw, "utf-8").toString("base64");
|
|
7286
8619
|
}
|
|
8620
|
+
var NO_TRUST_ANCHOR_REPO_MESSAGE = "could not resolve repo identity for the trust-anchor read";
|
|
7287
8621
|
function ghFetchTrustAnchorConfig() {
|
|
7288
8622
|
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
7289
8623
|
if (probeRef)
|
|
7290
8624
|
return readTrustAnchorConfigAtRef(probeRef);
|
|
7291
8625
|
const repo = trustAnchorRepo();
|
|
7292
8626
|
if (!repo)
|
|
7293
|
-
throw new Error(
|
|
8627
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
7294
8628
|
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
7295
8629
|
encoding: "utf-8",
|
|
7296
8630
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -7307,7 +8641,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
7307
8641
|
}
|
|
7308
8642
|
const repo = await trustAnchorRepoAsync();
|
|
7309
8643
|
if (!repo)
|
|
7310
|
-
throw new Error(
|
|
8644
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
7311
8645
|
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
7312
8646
|
return stdout;
|
|
7313
8647
|
}
|
|
@@ -7333,6 +8667,47 @@ function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
|
7333
8667
|
}
|
|
7334
8668
|
return parseTrustAnchorContent(base64);
|
|
7335
8669
|
}
|
|
8670
|
+
class PrincipalsUnresolvedError extends Error {
|
|
8671
|
+
kind;
|
|
8672
|
+
constructor(kind, message) {
|
|
8673
|
+
super(message);
|
|
8674
|
+
this.name = "PrincipalsUnresolvedError";
|
|
8675
|
+
this.kind = kind;
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
var PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch';
|
|
8679
|
+
function fetchFailureReason(err) {
|
|
8680
|
+
const stderr = err?.stderr;
|
|
8681
|
+
const text = (typeof stderr === "string" ? stderr : stderr?.toString() ?? "").trim();
|
|
8682
|
+
return text.split(`
|
|
8683
|
+
`)[0]?.trim() || firstLine(err);
|
|
8684
|
+
}
|
|
8685
|
+
function principalsNotConfigured(why) {
|
|
8686
|
+
return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
|
|
8687
|
+
}
|
|
8688
|
+
function resolveTrustedPrincipals(fetcher = ghFetchTrustAnchorConfig) {
|
|
8689
|
+
let content;
|
|
8690
|
+
try {
|
|
8691
|
+
content = fetcher();
|
|
8692
|
+
} catch (err) {
|
|
8693
|
+
if (err?.message === NO_TRUST_ANCHOR_REPO_MESSAGE) {
|
|
8694
|
+
throw principalsNotConfigured("no repository resolves for the read");
|
|
8695
|
+
}
|
|
8696
|
+
if (isMissingFileError(err))
|
|
8697
|
+
throw principalsNotConfigured("the default branch has no vinaya.config.json");
|
|
8698
|
+
throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`);
|
|
8699
|
+
}
|
|
8700
|
+
const unusable = { why: "" };
|
|
8701
|
+
const config = parseTrustAnchorContent(content, (why) => {
|
|
8702
|
+
unusable.why = why;
|
|
8703
|
+
});
|
|
8704
|
+
if (config === null) {
|
|
8705
|
+
throw principalsNotConfigured(`vinaya.config.json on the default branch ${unusable.why ? `is unusable: ${unusable.why}` : "is empty"}`);
|
|
8706
|
+
}
|
|
8707
|
+
if (!config.principals)
|
|
8708
|
+
throw principalsNotConfigured('vinaya.config.json on the default branch sets no "principals"');
|
|
8709
|
+
return config.principals;
|
|
8710
|
+
}
|
|
7336
8711
|
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
7337
8712
|
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
7338
8713
|
let base64;
|
|
@@ -7352,37 +8727,203 @@ function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
|
7352
8727
|
warn(firstLine(err));
|
|
7353
8728
|
return null;
|
|
7354
8729
|
}
|
|
7355
|
-
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
7356
|
-
const base64 = content.trim();
|
|
7357
|
-
if (!base64)
|
|
8730
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
8731
|
+
const base64 = content.trim();
|
|
8732
|
+
if (!base64)
|
|
8733
|
+
return null;
|
|
8734
|
+
try {
|
|
8735
|
+
const raw = Buffer.from(base64, "base64").toString("utf-8");
|
|
8736
|
+
const parsed = VinayaConfigSchema.safeParse(JSON.parse(raw));
|
|
8737
|
+
if (parsed.success)
|
|
8738
|
+
return parsed.data;
|
|
8739
|
+
warn("it did not satisfy the config schema");
|
|
8740
|
+
return null;
|
|
8741
|
+
} catch {
|
|
8742
|
+
warn("it was not readable as JSON");
|
|
8743
|
+
return null;
|
|
8744
|
+
}
|
|
8745
|
+
}
|
|
8746
|
+
function loadConfig() {
|
|
8747
|
+
const path = configPath();
|
|
8748
|
+
if (!path)
|
|
8749
|
+
return null;
|
|
8750
|
+
let text;
|
|
8751
|
+
try {
|
|
8752
|
+
text = readFileSync2(path, "utf-8");
|
|
8753
|
+
} catch (err) {
|
|
8754
|
+
reportInvalidConfigOnce(path, `unreadable: ${err.message}`);
|
|
8755
|
+
return null;
|
|
8756
|
+
}
|
|
8757
|
+
let raw;
|
|
8758
|
+
try {
|
|
8759
|
+
raw = JSON.parse(text);
|
|
8760
|
+
} catch (err) {
|
|
8761
|
+
reportInvalidConfigOnce(path, `invalid JSON: ${err.message}`);
|
|
8762
|
+
return null;
|
|
8763
|
+
}
|
|
8764
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
8765
|
+
if (!parsed.success) {
|
|
8766
|
+
reportInvalidConfigOnce(path, schemaIssueDetail(parsed.error));
|
|
8767
|
+
return null;
|
|
8768
|
+
}
|
|
8769
|
+
return stripGlobalOnlyKeys(parsed.data, path);
|
|
8770
|
+
}
|
|
8771
|
+
function schemaIssueDetail(error) {
|
|
8772
|
+
return error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ");
|
|
8773
|
+
}
|
|
8774
|
+
var emittedInvalidConfigReports = new Set;
|
|
8775
|
+
function reportInvalidConfigOnce(path, detail) {
|
|
8776
|
+
const key = `${path}
|
|
8777
|
+
${detail}`;
|
|
8778
|
+
if (emittedInvalidConfigReports.has(key))
|
|
8779
|
+
return;
|
|
8780
|
+
emittedInvalidConfigReports.add(key);
|
|
8781
|
+
const message = `${path} is not a valid Vinaya configuration (${detail}) — falling back to built-in defaults.`;
|
|
8782
|
+
const checkName = process.env.VINAYA_CHECK_NAME;
|
|
8783
|
+
if (checkName) {
|
|
8784
|
+
emitCheckError({
|
|
8785
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
8786
|
+
check: checkName,
|
|
8787
|
+
severity: "warning",
|
|
8788
|
+
message,
|
|
8789
|
+
agent_recovery_prompt: `Fix the failing keys in ${path} (${detail}) so the file parses and satisfies the configuration schema, then re-run.`,
|
|
8790
|
+
file: path
|
|
8791
|
+
});
|
|
8792
|
+
return;
|
|
8793
|
+
}
|
|
8794
|
+
console.error(`⚠ ${message}`);
|
|
8795
|
+
}
|
|
8796
|
+
function loadConfigChecked() {
|
|
8797
|
+
const path = configPath();
|
|
8798
|
+
if (!path)
|
|
8799
|
+
return { ok: true, config: null };
|
|
8800
|
+
let raw;
|
|
8801
|
+
try {
|
|
8802
|
+
raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
8803
|
+
} catch (err) {
|
|
8804
|
+
return { ok: false, path, error: `invalid JSON: ${err.message}` };
|
|
8805
|
+
}
|
|
8806
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
8807
|
+
if (!parsed.success) {
|
|
8808
|
+
return { ok: false, path, error: schemaIssueDetail(parsed.error) };
|
|
8809
|
+
}
|
|
8810
|
+
return { ok: true, config: stripGlobalOnlyKeys(parsed.data, path) };
|
|
8811
|
+
}
|
|
8812
|
+
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
8813
|
+
|
|
8814
|
+
// src/lib/forge-read.ts
|
|
8815
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
8816
|
+
|
|
8817
|
+
// src/lib/forge-snapshot.ts
|
|
8818
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
8819
|
+
import { join as join2 } from "node:path";
|
|
8820
|
+
var FORGE_SNAPSHOT_DIR_ENV = "VINAYA_FORGE_SNAPSHOT_DIR";
|
|
8821
|
+
var PULL_FILE = "pull.json";
|
|
8822
|
+
var PULL_COMMENTS_FILE = "pull-comments.json";
|
|
8823
|
+
var ISSUE_FILE = "issue.json";
|
|
8824
|
+
var ISSUE_COMMENTS_FILE = "issue-comments.json";
|
|
8825
|
+
function forgeSnapshotDir(env = process.env) {
|
|
8826
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
8827
|
+
return null;
|
|
8828
|
+
const dir = env[FORGE_SNAPSHOT_DIR_ENV];
|
|
8829
|
+
return dir ? dir : null;
|
|
8830
|
+
}
|
|
8831
|
+
|
|
8832
|
+
class ForgeSnapshotIncompleteError extends Error {
|
|
8833
|
+
constructor(dir, file) {
|
|
8834
|
+
super(`the forge snapshot ${dir} has no ${file} — the pull request read that writes it did not complete, so this check refuses to read the forge in its place.`);
|
|
8835
|
+
this.name = "ForgeSnapshotIncompleteError";
|
|
8836
|
+
}
|
|
8837
|
+
}
|
|
8838
|
+
|
|
8839
|
+
class ForgeSnapshotIssueNotFoundError extends Error {
|
|
8840
|
+
constructor(issue) {
|
|
8841
|
+
super(`Issue #${issue} did not resolve (HTTP 404) when this run's forge snapshot was read.`);
|
|
8842
|
+
this.name = "ForgeSnapshotIssueNotFoundError";
|
|
8843
|
+
}
|
|
8844
|
+
}
|
|
8845
|
+
function readSnapshotFile(dir, file) {
|
|
8846
|
+
let text;
|
|
8847
|
+
try {
|
|
8848
|
+
text = readFileSync3(join2(dir, file), "utf8");
|
|
8849
|
+
} catch {
|
|
8850
|
+
throw new ForgeSnapshotIncompleteError(dir, file);
|
|
8851
|
+
}
|
|
8852
|
+
return JSON.parse(text);
|
|
8853
|
+
}
|
|
8854
|
+
function readComments(dir, file, number) {
|
|
8855
|
+
const parsed = readSnapshotFile(dir, file);
|
|
8856
|
+
if (parsed.number !== number)
|
|
8857
|
+
throw new ForgeSnapshotIncompleteError(dir, `${file} for #${number}`);
|
|
8858
|
+
return parsed.comments;
|
|
8859
|
+
}
|
|
8860
|
+
function snapshotPullRequest(number, env = process.env) {
|
|
8861
|
+
const dir = forgeSnapshotDir(env);
|
|
8862
|
+
if (dir === null)
|
|
7358
8863
|
return null;
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
8864
|
+
const pull = readSnapshotFile(dir, PULL_FILE);
|
|
8865
|
+
return pull.number === number ? pull : null;
|
|
8866
|
+
}
|
|
8867
|
+
function snapshotIssue(number, env = process.env) {
|
|
8868
|
+
const dir = forgeSnapshotDir(env);
|
|
8869
|
+
if (dir === null)
|
|
7365
8870
|
return null;
|
|
7366
|
-
|
|
7367
|
-
|
|
8871
|
+
const issue = readSnapshotFile(dir, ISSUE_FILE);
|
|
8872
|
+
if (issue.number !== number)
|
|
7368
8873
|
return null;
|
|
7369
|
-
|
|
8874
|
+
if ("notFound" in issue)
|
|
8875
|
+
throw new ForgeSnapshotIssueNotFoundError(number);
|
|
8876
|
+
return issue;
|
|
7370
8877
|
}
|
|
7371
|
-
function
|
|
7372
|
-
const
|
|
7373
|
-
if (
|
|
8878
|
+
function snapshotComments(number, env = process.env) {
|
|
8879
|
+
const dir = forgeSnapshotDir(env);
|
|
8880
|
+
if (dir === null)
|
|
7374
8881
|
return null;
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
8882
|
+
if (snapshotPullRequest(number, env) !== null)
|
|
8883
|
+
return readComments(dir, PULL_COMMENTS_FILE, number);
|
|
8884
|
+
if (snapshotIssue(number, env) !== null)
|
|
8885
|
+
return readComments(dir, ISSUE_COMMENTS_FILE, number);
|
|
8886
|
+
return null;
|
|
8887
|
+
}
|
|
8888
|
+
function snapshotBody(number, env = process.env) {
|
|
8889
|
+
const pull = snapshotPullRequest(number, env);
|
|
8890
|
+
if (pull !== null)
|
|
8891
|
+
return pull.body;
|
|
8892
|
+
return snapshotIssue(number, env)?.body ?? null;
|
|
8893
|
+
}
|
|
8894
|
+
function incompleteForgeSnapshot(env = process.env) {
|
|
8895
|
+
const dir = forgeSnapshotDir(env);
|
|
8896
|
+
if (dir === null)
|
|
7379
8897
|
return null;
|
|
8898
|
+
for (const file of [PULL_FILE, PULL_COMMENTS_FILE, ISSUE_FILE]) {
|
|
8899
|
+
if (!existsSync2(join2(dir, file)))
|
|
8900
|
+
return new ForgeSnapshotIncompleteError(dir, file).message;
|
|
8901
|
+
}
|
|
8902
|
+
try {
|
|
8903
|
+
const issue = readSnapshotFile(dir, ISSUE_FILE);
|
|
8904
|
+
if (typeof issue.number === "number" && !("notFound" in issue) && !existsSync2(join2(dir, ISSUE_COMMENTS_FILE))) {
|
|
8905
|
+
return new ForgeSnapshotIncompleteError(dir, ISSUE_COMMENTS_FILE).message;
|
|
8906
|
+
}
|
|
8907
|
+
} catch (err) {
|
|
8908
|
+
return `the forge snapshot ${dir} has an unreadable ${ISSUE_FILE}: ${err.message}`;
|
|
7380
8909
|
}
|
|
8910
|
+
return null;
|
|
8911
|
+
}
|
|
8912
|
+
function exitOnIncompleteForgeSnapshot(checkName, env = process.env) {
|
|
8913
|
+
const reason = incompleteForgeSnapshot(env);
|
|
8914
|
+
if (reason === null)
|
|
8915
|
+
return;
|
|
8916
|
+
emitCheckError({
|
|
8917
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
8918
|
+
check: checkName,
|
|
8919
|
+
severity: "error",
|
|
8920
|
+
message: `${checkName}: ${reason}`,
|
|
8921
|
+
agent_recovery_prompt: `Re-run the whole workflow run so its pull request read step writes the snapshot again (its own log names the failed read), then let \`vinaya check ${checkName}\` re-run.`
|
|
8922
|
+
});
|
|
8923
|
+
process.exit(1);
|
|
7381
8924
|
}
|
|
7382
|
-
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
7383
8925
|
|
|
7384
8926
|
// src/lib/forge-read.ts
|
|
7385
|
-
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
7386
8927
|
var FORGE_READ_CEILING_BYTES = 64 * 1024 * 1024;
|
|
7387
8928
|
var PAGE_SIZE = 100;
|
|
7388
8929
|
var ghRunner = (args, maxBuffer) => execFileSync3("gh", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], maxBuffer });
|
|
@@ -7405,7 +8946,7 @@ function isForgeReadOversize(err) {
|
|
|
7405
8946
|
function isBufferOverflow(err) {
|
|
7406
8947
|
return err?.code === "ENOBUFS";
|
|
7407
8948
|
}
|
|
7408
|
-
function
|
|
8949
|
+
function runBounded(runner, args, subject, usedBytes) {
|
|
7409
8950
|
const remaining = FORGE_READ_CEILING_BYTES - usedBytes;
|
|
7410
8951
|
let out;
|
|
7411
8952
|
try {
|
|
@@ -7420,31 +8961,40 @@ function run2(runner, args, subject, usedBytes) {
|
|
|
7420
8961
|
throw new ForgeReadOversizeError(subject, usedBytes + size);
|
|
7421
8962
|
return out;
|
|
7422
8963
|
}
|
|
7423
|
-
function
|
|
7424
|
-
const
|
|
7425
|
-
const comments = [];
|
|
8964
|
+
function readRestCommentRows(number, subjectLabel = `Issue ${number}`, runner = ghRunner) {
|
|
8965
|
+
const rows = [];
|
|
7426
8966
|
let used = 0;
|
|
7427
8967
|
for (let page = 1;; page++) {
|
|
7428
|
-
const out =
|
|
8968
|
+
const out = runBounded(runner, ["api", `repos/{owner}/{repo}/issues/${number}/comments?per_page=${PAGE_SIZE}&page=${page}`], subjectLabel, used);
|
|
7429
8969
|
used += Buffer.byteLength(out, "utf8");
|
|
7430
|
-
const
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
url: r.html_url ?? "",
|
|
7435
|
-
author: r.user?.login ? { login: r.user.login } : null
|
|
7436
|
-
});
|
|
7437
|
-
}
|
|
7438
|
-
if (rows.length < PAGE_SIZE)
|
|
7439
|
-
return comments;
|
|
8970
|
+
const pageRows = JSON.parse(out);
|
|
8971
|
+
rows.push(...pageRows);
|
|
8972
|
+
if (pageRows.length < PAGE_SIZE)
|
|
8973
|
+
return rows;
|
|
7440
8974
|
}
|
|
7441
8975
|
}
|
|
8976
|
+
function readIssueComments(issue, subjectLabel = `Issue ${issue}`, runner = ghRunner) {
|
|
8977
|
+
const number = resolveNumber(issue, subjectLabel, runner);
|
|
8978
|
+
const fromSnapshot = snapshotComments(number);
|
|
8979
|
+
if (fromSnapshot !== null)
|
|
8980
|
+
return fromSnapshot;
|
|
8981
|
+
return readRestCommentRows(number, subjectLabel, runner).map((r) => ({
|
|
8982
|
+
body: r.body ?? "",
|
|
8983
|
+
url: r.html_url ?? "",
|
|
8984
|
+
author: r.user?.login ? { login: r.user.login } : null
|
|
8985
|
+
}));
|
|
8986
|
+
}
|
|
7442
8987
|
function readIssueBody(issue, subjectLabel = `Issue ${issue}`, runner = ghRunner) {
|
|
7443
|
-
|
|
8988
|
+
if (forgeSnapshotDir() !== null) {
|
|
8989
|
+
const fromSnapshot = snapshotBody(resolveNumber(issue, subjectLabel, runner));
|
|
8990
|
+
if (fromSnapshot !== null)
|
|
8991
|
+
return fromSnapshot;
|
|
8992
|
+
}
|
|
8993
|
+
const out = runBounded(runner, ["issue", "view", String(issue), "--json", "body"], subjectLabel, 0);
|
|
7444
8994
|
return JSON.parse(out).body ?? "";
|
|
7445
8995
|
}
|
|
7446
8996
|
function readIssueFields(issue, fields, subjectLabel = `Issue ${issue}`, runner = ghRunner) {
|
|
7447
|
-
return JSON.parse(
|
|
8997
|
+
return JSON.parse(runBounded(runner, ["issue", "view", String(issue), "--json", fields], subjectLabel, 0));
|
|
7448
8998
|
}
|
|
7449
8999
|
function resolveNumber(issue, subjectLabel, runner) {
|
|
7450
9000
|
if (typeof issue === "number")
|
|
@@ -7456,8 +9006,8 @@ function resolveNumber(issue, subjectLabel, runner) {
|
|
|
7456
9006
|
|
|
7457
9007
|
// src/lib/brief-assembly.ts
|
|
7458
9008
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
7459
|
-
import { existsSync as
|
|
7460
|
-
import { join as
|
|
9009
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2 } from "node:fs";
|
|
9010
|
+
import { join as join5 } from "node:path";
|
|
7461
9011
|
|
|
7462
9012
|
// ../../packages/sources/src/commands.ts
|
|
7463
9013
|
var COMMANDS = [
|
|
@@ -7573,6 +9123,16 @@ var COMMANDS = [
|
|
|
7573
9123
|
],
|
|
7574
9124
|
status: "shipped"
|
|
7575
9125
|
},
|
|
9126
|
+
{
|
|
9127
|
+
name: "new adr",
|
|
9128
|
+
needs: [],
|
|
9129
|
+
description: "Write the next numbered decision record into the folder decisionRecords.path names",
|
|
9130
|
+
details: [
|
|
9131
|
+
"`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.",
|
|
9132
|
+
"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."
|
|
9133
|
+
],
|
|
9134
|
+
status: "shipped"
|
|
9135
|
+
},
|
|
7576
9136
|
{
|
|
7577
9137
|
name: "brief render",
|
|
7578
9138
|
needs: ["forge", "default-branch"],
|
|
@@ -7591,9 +9151,7 @@ var COMMANDS = [
|
|
|
7591
9151
|
name: "task dispatch",
|
|
7592
9152
|
needs: ["forge", "operator-seat"],
|
|
7593
9153
|
description: "Deprecated — render, pin, and post the brief on the Issue as the frozen original; start the developer",
|
|
7594
|
-
flags: [
|
|
7595
|
-
{ flag: "--agent <claude|codex|gemini>", description: "Start the developer through dispatchRole once posted" }
|
|
7596
|
-
],
|
|
9154
|
+
flags: [{ flag: "--agent <claude|codex>", description: "Start the developer through dispatchRole once posted" }],
|
|
7597
9155
|
details: [
|
|
7598
9156
|
"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.",
|
|
7599
9157
|
"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.",
|
|
@@ -7618,7 +9176,11 @@ var COMMANDS = [
|
|
|
7618
9176
|
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
7619
9177
|
flags: [
|
|
7620
9178
|
{
|
|
7621
|
-
flag: "--
|
|
9179
|
+
flag: "--runner <standalone|atta-engine>",
|
|
9180
|
+
description: "Override runner config for this invocation; absent uses config, whose default is standalone"
|
|
9181
|
+
},
|
|
9182
|
+
{
|
|
9183
|
+
flag: "--agent <claude|codex>",
|
|
7622
9184
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
7623
9185
|
},
|
|
7624
9186
|
{
|
|
@@ -7628,17 +9190,39 @@ var COMMANDS = [
|
|
|
7628
9190
|
{
|
|
7629
9191
|
flag: "--widen-surface <glob,...> --reason <text>",
|
|
7630
9192
|
description: "Continue a pre-pull-request escalation whose Developer asked for `widen_surface`: supersede the frozen brief with the globs added to `## Surface`, record that as the escalation's resolution, grade the widened Issue through the write gate, then start the run"
|
|
9193
|
+
},
|
|
9194
|
+
{
|
|
9195
|
+
flag: "--rollback",
|
|
9196
|
+
description: "Run the terminate-and-restart procedure for this task: cancel its in-flight Engine run, reconcile every prepared and uncertain effect by its identity, then start a fresh standalone run from the same frozen brief. Refuses a task whose recorded runner is not `atta-engine`"
|
|
7631
9197
|
}
|
|
7632
9198
|
],
|
|
7633
9199
|
details: [
|
|
9200
|
+
"The atta-engine runner starts the workspace Engine script with Bun, streams its output and returns its exit code. A published install without the script prints one notice and falls back to standalone. Engine Log events use the local folder only; logs: false disables all Log destinations for both runners.",
|
|
9201
|
+
"A run's runner is recorded when it starts and never changes: switching `runner` in config changes only the runner of new runs, and a run recorded on `atta-engine` keeps routing to the Engine for `task status`, `task_resume` and `task_cancel`. A start on a pause another runner holds is refused with a typed reason naming the recorded runner and the requested one, and so is a start on another runner's Engine run that is still in flight with no pause held — halted or stopped short of completed or cancelled.",
|
|
9202
|
+
"`--rollback` ends the Engine run first: a held pause through the shared cancel `task_cancel` uses, which needs a Principal ruling newer than the pause as any cancel does; a run halted with no pause held has its started effects fenced; a run that already completed or was cancelled is refused, as is a driver still running with no pause held, which is never signalled; and the standalone run never starts while the Engine driver lives, a cancelled run's driver given a bounded wait to release its lock. Every started and uncertain effect is then reconciled by its identity: one the forge carries is recorded verified, one it does not carry is left for the restarted run to complete, and one the forge read cannot settle refuses the restart. Each rehearsal appends a record — task, recorded runner, action, reconciled effect identities, the restarted run's runner and terminal state — to `backend-rollback-rehearsals.jsonl` in the task's runtime directory, whether it completed, was refused or failed at a later step, and nothing removes it.",
|
|
7634
9203
|
"`--widen-surface` is the Planner's one command for a widen-surface escalation, and refuses before any write when the held pause is not one (no pause, a pause with a pull request — whose continuation is the ruling on that pull request — or a round whose Developer asked for no `widen_surface`), when a driver is still alive for the task, when the escalation's resolution is already consumed (a replay — the Surface is never widened twice), or when the widened body fails the write gate, whose findings name the field to edit first. The escalation packet's permitted next actions name this command with the globs the Developer asked for, and `task_resume` refuses such an escalation naming it.",
|
|
7635
|
-
"
|
|
9204
|
+
"Prepares the frozen brief and resolves the task, branch and model once. The standalone runner then starts the watching driver (`runDriverLoop`, `dev-review-loop.ts`). Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
7636
9205
|
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
7637
9206
|
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
7638
9207
|
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
7639
9208
|
],
|
|
7640
9209
|
status: "shipped"
|
|
7641
9210
|
},
|
|
9211
|
+
{
|
|
9212
|
+
name: "task switch",
|
|
9213
|
+
needs: ["forge"],
|
|
9214
|
+
description: "Change a task's agent or model by setting its Engine checkpoint aside, so the next `task run` is accepted",
|
|
9215
|
+
flags: [
|
|
9216
|
+
{ flag: "--issue <n>", description: "Address the task by its Issue number instead of `<tranche> <n>`" },
|
|
9217
|
+
{ flag: "--agent <claude|codex>", description: "Vendor the next `task run` of the task continues on" },
|
|
9218
|
+
{ flag: "--model <model>", description: "Model the next `task run` is meant to use; absent, the vendor default" }
|
|
9219
|
+
],
|
|
9220
|
+
details: [
|
|
9221
|
+
"Refuses, changing nothing, while a driver for the task is alive, naming its pid. Otherwise moves the task's Engine checkpoint (`checkpoints.sqlite` with its `-wal` and `-shm` files) into a timestamped `switched-*` folder of the task's run directory and never deletes it; the branch, its commits and its pull request are untouched, so the next `task run` with the new agent continues the same branch on a fresh checkpoint.",
|
|
9222
|
+
"Writes one driver-log line naming the from and to agent, the from and to model and the folder the checkpoint went to. On the standalone runner it changes nothing on disk and says that runner already continues a task on a new `--agent` by itself. `task run` and `run-engine --resume` still refuse an agent other than the checkpoint's, and their refusal names this command."
|
|
9223
|
+
],
|
|
9224
|
+
status: "shipped"
|
|
9225
|
+
},
|
|
7642
9226
|
{
|
|
7643
9227
|
name: "task status",
|
|
7644
9228
|
needs: ["forge"],
|
|
@@ -7793,6 +9377,22 @@ var COMMANDS = [
|
|
|
7793
9377
|
],
|
|
7794
9378
|
status: "shipped"
|
|
7795
9379
|
},
|
|
9380
|
+
{
|
|
9381
|
+
name: "pr snapshot",
|
|
9382
|
+
needs: ["forge"],
|
|
9383
|
+
description: "CI plumbing: write a run's forge snapshot of the pull request and its task Issue, read over REST",
|
|
9384
|
+
flags: [
|
|
9385
|
+
{
|
|
9386
|
+
flag: "--dir",
|
|
9387
|
+
description: "The snapshot directory; its `raw/` holds the REST pull request and comment pages the read step wrote"
|
|
9388
|
+
}
|
|
9389
|
+
],
|
|
9390
|
+
details: [
|
|
9391
|
+
"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.",
|
|
9392
|
+
"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."
|
|
9393
|
+
],
|
|
9394
|
+
status: "shipped"
|
|
9395
|
+
},
|
|
7796
9396
|
{
|
|
7797
9397
|
name: "issue create",
|
|
7798
9398
|
needs: ["forge"],
|
|
@@ -7913,14 +9513,14 @@ var COMMANDS = [
|
|
|
7913
9513
|
{
|
|
7914
9514
|
name: "milestone close",
|
|
7915
9515
|
needs: ["forge"],
|
|
7916
|
-
description: "Close a tranche's Milestone after verifying every labeled Issue is
|
|
9516
|
+
description: "Close a tranche's Milestone after verifying every labeled Issue is attached and every tranche it declares is complete",
|
|
7917
9517
|
flags: [
|
|
7918
9518
|
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
7919
9519
|
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
7920
9520
|
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7921
9521
|
],
|
|
7922
9522
|
details: [
|
|
7923
|
-
"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."
|
|
9523
|
+
"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."
|
|
7924
9524
|
],
|
|
7925
9525
|
status: "shipped"
|
|
7926
9526
|
},
|
|
@@ -8209,7 +9809,7 @@ var COMMANDS = [
|
|
|
8209
9809
|
}
|
|
8210
9810
|
],
|
|
8211
9811
|
details: [
|
|
8212
|
-
"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`
|
|
9812
|
+
"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.",
|
|
8213
9813
|
"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.",
|
|
8214
9814
|
'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.'
|
|
8215
9815
|
],
|
|
@@ -8218,11 +9818,11 @@ var COMMANDS = [
|
|
|
8218
9818
|
{
|
|
8219
9819
|
name: "dispatch",
|
|
8220
9820
|
needs: ["operator-seat"],
|
|
8221
|
-
description: "Start a role's headless agent session (claude/codex
|
|
9821
|
+
description: "Start a role's headless agent session (claude/codex) with attribution set on its environment, recording the outcome through the Vinaya Log",
|
|
8222
9822
|
flags: [
|
|
8223
9823
|
{
|
|
8224
9824
|
flag: "--agent",
|
|
8225
|
-
description: "Vendor to start: `claude
|
|
9825
|
+
description: "Vendor to start: `claude` or `codex` (falls back to `dispatch.agent` in config)"
|
|
8226
9826
|
},
|
|
8227
9827
|
{ flag: "--prompt-file", description: "Path to the prompt text sent to the agent (never on argv)" },
|
|
8228
9828
|
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
@@ -8239,9 +9839,9 @@ var COMMANDS = [
|
|
|
8239
9839
|
],
|
|
8240
9840
|
details: [
|
|
8241
9841
|
"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.",
|
|
8242
|
-
"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 `
|
|
9842
|
+
"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`.",
|
|
8243
9843
|
"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.",
|
|
8244
|
-
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude
|
|
9844
|
+
"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."
|
|
8245
9845
|
],
|
|
8246
9846
|
status: "shipped"
|
|
8247
9847
|
},
|
|
@@ -8252,7 +9852,7 @@ var COMMANDS = [
|
|
|
8252
9852
|
flags: [
|
|
8253
9853
|
{ flag: "--task <n>", description: "This task's Issue number — its frozen `aeg:brief:v1` comment is the brief" },
|
|
8254
9854
|
{
|
|
8255
|
-
flag: "--agent <claude|codex
|
|
9855
|
+
flag: "--agent <claude|codex>",
|
|
8256
9856
|
description: "Vendor for every dispatch this loop makes (falls back to `dispatch.agent` in config)"
|
|
8257
9857
|
},
|
|
8258
9858
|
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
@@ -8331,22 +9931,78 @@ function createForgeSource(config) {
|
|
|
8331
9931
|
};
|
|
8332
9932
|
}
|
|
8333
9933
|
// ../../packages/sources/src/select-source.ts
|
|
8334
|
-
import { z as
|
|
8335
|
-
var StateSourceConfigSchema =
|
|
8336
|
-
|
|
8337
|
-
|
|
9934
|
+
import { z as z7 } from "zod";
|
|
9935
|
+
var StateSourceConfigSchema = z7.discriminatedUnion("kind", [
|
|
9936
|
+
z7.object({ kind: z7.literal("forge"), owner: z7.string(), repo: z7.string() }),
|
|
9937
|
+
z7.object({ kind: z7.literal("file"), root: z7.string().optional() })
|
|
8338
9938
|
]);
|
|
8339
9939
|
// src/checks/edge-resolve.ts
|
|
9940
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
9941
|
+
import { promisify as promisify5 } from "node:util";
|
|
9942
|
+
|
|
9943
|
+
// src/lib/github-rate-limit.ts
|
|
8340
9944
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
9945
|
+
var GITHUB_RATE_LIMIT_WORDING = /api rate limit (?:already )?exceeded|secondary rate limit|rate limit exceeded/i;
|
|
9946
|
+
var SECONDARY_RATE_LIMIT_WORDING = /secondary rate limit/i;
|
|
9947
|
+
function isGithubRateLimitError(text) {
|
|
9948
|
+
return GITHUB_RATE_LIMIT_WORDING.test(text);
|
|
9949
|
+
}
|
|
9950
|
+
function rateLimitBudget(errorText) {
|
|
9951
|
+
return errorText.trimStart().startsWith("GraphQL:") ? "GraphQL" : "REST";
|
|
9952
|
+
}
|
|
9953
|
+
var defaultReader = () => execFileSync4("gh", ["api", "rate_limit"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
9954
|
+
function readRateLimitReset(budget, read = defaultReader) {
|
|
9955
|
+
let parsed;
|
|
9956
|
+
try {
|
|
9957
|
+
parsed = JSON.parse(read());
|
|
9958
|
+
} catch {
|
|
9959
|
+
return null;
|
|
9960
|
+
}
|
|
9961
|
+
const resources = parsed.resources;
|
|
9962
|
+
const entry = resources?.[budget === "GraphQL" ? "graphql" : "core"];
|
|
9963
|
+
if (!entry || typeof entry.reset !== "number" || !Number.isFinite(entry.reset) || entry.reset <= 0)
|
|
9964
|
+
return null;
|
|
9965
|
+
if (typeof entry.remaining === "number" && entry.remaining > 0)
|
|
9966
|
+
return null;
|
|
9967
|
+
return entry.reset;
|
|
9968
|
+
}
|
|
9969
|
+
function formatResetUtc(epochSeconds) {
|
|
9970
|
+
const d = new Date(epochSeconds * 1000);
|
|
9971
|
+
const hh = String(d.getUTCHours()).padStart(2, "0");
|
|
9972
|
+
const mm = String(d.getUTCMinutes()).padStart(2, "0");
|
|
9973
|
+
return `${hh}:${mm} UTC`;
|
|
9974
|
+
}
|
|
9975
|
+
function rateLimitMessage(errorText, read = defaultReader) {
|
|
9976
|
+
const budget = rateLimitBudget(errorText);
|
|
9977
|
+
const reset = SECONDARY_RATE_LIMIT_WORDING.test(errorText) ? null : readRateLimitReset(budget, read);
|
|
9978
|
+
const when = reset === null ? "resets in a few minutes" : `resets at ${formatResetUtc(reset)}`;
|
|
9979
|
+
return `GitHub rate limit (${budget}), ${when}`;
|
|
9980
|
+
}
|
|
9981
|
+
function execErrorText(err) {
|
|
9982
|
+
const e = err;
|
|
9983
|
+
const stderr = e?.stderr === undefined || e.stderr === null ? "" : String(e.stderr);
|
|
9984
|
+
const message = typeof e?.message === "string" ? e.message : "";
|
|
9985
|
+
return stderr.trim() !== "" ? `${stderr}
|
|
9986
|
+
${message}` : message;
|
|
9987
|
+
}
|
|
9988
|
+
|
|
9989
|
+
// src/checks/edge-resolve.ts
|
|
8341
9990
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
8342
9991
|
var issueCache = new Map;
|
|
9992
|
+
var execFileAsync5 = promisify5(execFile5);
|
|
9993
|
+
var ISSUE_NOT_FOUND = /could not resolve to an issue/i;
|
|
8343
9994
|
function fetchIssueState(num, repo) {
|
|
8344
9995
|
const key = `${repo.owner}/${repo.repo}#${num}`;
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
9996
|
+
const cached = issueCache.get(key);
|
|
9997
|
+
if (cached)
|
|
9998
|
+
return cached;
|
|
9999
|
+
const out = readIssueOnce(num, repo).then((first) => first.readFailed ? readIssueOnce(num, repo) : first);
|
|
10000
|
+
issueCache.set(key, out);
|
|
10001
|
+
return out;
|
|
10002
|
+
}
|
|
10003
|
+
async function readIssueOnce(num, repo) {
|
|
8348
10004
|
try {
|
|
8349
|
-
const
|
|
10005
|
+
const { stdout } = await execFileAsync5("gh", [
|
|
8350
10006
|
"issue",
|
|
8351
10007
|
"view",
|
|
8352
10008
|
String(num),
|
|
@@ -8354,13 +10010,11 @@ function fetchIssueState(num, repo) {
|
|
|
8354
10010
|
`${repo.owner}/${repo.repo}`,
|
|
8355
10011
|
"--json",
|
|
8356
10012
|
"state,stateReason,closedByPullRequestsReferences"
|
|
8357
|
-
], { encoding: "utf8"
|
|
8358
|
-
|
|
8359
|
-
} catch {
|
|
8360
|
-
|
|
10013
|
+
], { encoding: "utf8" });
|
|
10014
|
+
return { json: JSON.parse(stdout), readFailed: false };
|
|
10015
|
+
} catch (err) {
|
|
10016
|
+
return { json: null, readFailed: !ISSUE_NOT_FOUND.test(execErrorText(err)) };
|
|
8361
10017
|
}
|
|
8362
|
-
issueCache.set(key, out);
|
|
8363
|
-
return out;
|
|
8364
10018
|
}
|
|
8365
10019
|
var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
8366
10020
|
let tranche;
|
|
@@ -8377,7 +10031,7 @@ var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
|
8377
10031
|
};
|
|
8378
10032
|
};
|
|
8379
10033
|
var siblingTrancheCache = new Map;
|
|
8380
|
-
function edgeFromIssueJson(num, json) {
|
|
10034
|
+
function edgeFromIssueJson(num, json, readFailed = false) {
|
|
8381
10035
|
if (json === null) {
|
|
8382
10036
|
return {
|
|
8383
10037
|
issue: num,
|
|
@@ -8386,7 +10040,8 @@ function edgeFromIssueJson(num, json) {
|
|
|
8386
10040
|
issueState: null,
|
|
8387
10041
|
stateReason: null,
|
|
8388
10042
|
closedByActor: null,
|
|
8389
|
-
resolved: true
|
|
10043
|
+
resolved: true,
|
|
10044
|
+
...readFailed ? { readFailed: true } : {}
|
|
8390
10045
|
};
|
|
8391
10046
|
}
|
|
8392
10047
|
const state = json.state === "CLOSED" ? "closed" : json.state === "OPEN" ? "open" : null;
|
|
@@ -8419,7 +10074,8 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
8419
10074
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
8420
10075
|
if (direct) {
|
|
8421
10076
|
const num = Number(direct[1]);
|
|
8422
|
-
|
|
10077
|
+
const read = await fetchIssueState(num, repo);
|
|
10078
|
+
return edgeFromIssueJson(num, read.json, read.readFailed);
|
|
8423
10079
|
}
|
|
8424
10080
|
const qualified = splitSlugQualifiedEdge(id);
|
|
8425
10081
|
if (qualified) {
|
|
@@ -8453,15 +10109,27 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
8453
10109
|
resolved: false
|
|
8454
10110
|
};
|
|
8455
10111
|
}
|
|
10112
|
+
function dependsOnFactFromEdge(id, r) {
|
|
10113
|
+
return {
|
|
10114
|
+
id,
|
|
10115
|
+
issue: r.issue,
|
|
10116
|
+
merged: r.merged,
|
|
10117
|
+
resolved: r.resolved,
|
|
10118
|
+
issueState: r.issueState,
|
|
10119
|
+
stateReason: r.stateReason,
|
|
10120
|
+
closedByActor: r.closedByActor,
|
|
10121
|
+
...r.readFailed ? { readFailed: true } : {}
|
|
10122
|
+
};
|
|
10123
|
+
}
|
|
8456
10124
|
|
|
8457
10125
|
// src/lib/package-root.ts
|
|
8458
|
-
import { existsSync as
|
|
8459
|
-
import { dirname as dirname2, join as
|
|
10126
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
10127
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
8460
10128
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8461
10129
|
function packageRoot(moduleUrl) {
|
|
8462
10130
|
let dir = dirname2(fileURLToPath2(moduleUrl));
|
|
8463
|
-
while (!
|
|
8464
|
-
if (
|
|
10131
|
+
while (!existsSync3(join3(dir, "package.json"))) {
|
|
10132
|
+
if (existsSync3(join3(dir, ".git")))
|
|
8465
10133
|
break;
|
|
8466
10134
|
const parent = dirname2(dir);
|
|
8467
10135
|
if (parent === dir)
|
|
@@ -8473,14 +10141,21 @@ function packageRoot(moduleUrl) {
|
|
|
8473
10141
|
|
|
8474
10142
|
// src/commands/doctrine.ts
|
|
8475
10143
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
8476
|
-
import { existsSync as
|
|
8477
|
-
import { dirname as dirname3, join as
|
|
10144
|
+
import { existsSync as existsSync4, readdirSync, readFileSync as readFileSync4 } from "node:fs";
|
|
10145
|
+
import { dirname as dirname3, join as join4, sep } from "node:path";
|
|
8478
10146
|
import matter4 from "gray-matter";
|
|
8479
10147
|
|
|
8480
10148
|
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
8481
10149
|
import matter2 from "gray-matter";
|
|
8482
10150
|
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
8483
10151
|
var NO_MODEL_BACKED_PATHS = new Set;
|
|
10152
|
+
// ../../packages/aeg-core/src/docs/published-prose.ts
|
|
10153
|
+
var ALLOWED_MECHANICS = rulesForGroup("published-prose")[0]?.exemptions ?? [];
|
|
10154
|
+
var PROSE_RULES = rulesForGroup("published-prose").map((rule) => ({
|
|
10155
|
+
id: rule.id,
|
|
10156
|
+
what: rule.message,
|
|
10157
|
+
pattern: rule.patterns.published
|
|
10158
|
+
}));
|
|
8484
10159
|
// src/roles/contract.ts
|
|
8485
10160
|
import matter3 from "gray-matter";
|
|
8486
10161
|
|
|
@@ -8502,22 +10177,22 @@ function gitToplevel(cwd) {
|
|
|
8502
10177
|
function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
8503
10178
|
const toplevel = gitToplevel(cwd);
|
|
8504
10179
|
if (toplevel !== null) {
|
|
8505
|
-
const treeRoot =
|
|
8506
|
-
if (
|
|
10180
|
+
const treeRoot = join4(toplevel, "aeg-root");
|
|
10181
|
+
if (existsSync4(join4(treeRoot, "roles")))
|
|
8507
10182
|
return { root: treeRoot, source: "tree" };
|
|
8508
10183
|
}
|
|
8509
10184
|
const fromSource = !pkg.split(sep).includes("node_modules");
|
|
8510
|
-
const bundleRoot = fromSource ?
|
|
10185
|
+
const bundleRoot = fromSource ? join4(dirname3(dirname3(pkg)), "aeg-root") : join4(pkg, "aeg-root");
|
|
8511
10186
|
return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
|
|
8512
10187
|
}
|
|
8513
10188
|
function hasDoctrineEntry(root) {
|
|
8514
|
-
return
|
|
10189
|
+
return existsSync4(join4(root, ...ENTRY_SEGMENTS));
|
|
8515
10190
|
}
|
|
8516
10191
|
|
|
8517
10192
|
// src/lib/brief-assembly.ts
|
|
8518
10193
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
8519
|
-
var PACKAGED_TEMPLATE_PATH =
|
|
8520
|
-
var TEMPLATE_PATH =
|
|
10194
|
+
var PACKAGED_TEMPLATE_PATH = join5(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
10195
|
+
var TEMPLATE_PATH = existsSync5(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join5(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
8521
10196
|
function git(args) {
|
|
8522
10197
|
try {
|
|
8523
10198
|
return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
@@ -8533,24 +10208,25 @@ function expandGlob(glob) {
|
|
|
8533
10208
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
8534
10209
|
|
|
8535
10210
|
// src/checks/registry.ts
|
|
8536
|
-
import { join as
|
|
10211
|
+
import { join as join6, relative, sep as sep2 } from "node:path";
|
|
8537
10212
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8538
10213
|
function resolveCheckBin(packageDir, moduleUrl) {
|
|
8539
10214
|
const fromPackage = relative(packageDir, fileURLToPath3(moduleUrl));
|
|
8540
10215
|
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
|
|
8541
|
-
return bundled ? { dir:
|
|
10216
|
+
return bundled ? { dir: join6(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join6(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
8542
10217
|
}
|
|
8543
10218
|
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
8544
10219
|
var BIN_DIR = CHECK_BIN.dir;
|
|
8545
10220
|
var BIN_EXT = CHECK_BIN.ext;
|
|
8546
10221
|
function bin(name) {
|
|
8547
|
-
return
|
|
10222
|
+
return join6(BIN_DIR, `${name}${BIN_EXT}`);
|
|
8548
10223
|
}
|
|
8549
10224
|
var REGISTRY = [
|
|
8550
10225
|
[
|
|
8551
10226
|
{
|
|
8552
10227
|
name: "brief-shape",
|
|
8553
10228
|
validates: "body",
|
|
10229
|
+
requiresOpenPr: true,
|
|
8554
10230
|
run: bin("check-brief-shape"),
|
|
8555
10231
|
scope: "diff",
|
|
8556
10232
|
timeoutMs: 15000,
|
|
@@ -8559,7 +10235,9 @@ var REGISTRY = [
|
|
|
8559
10235
|
BRANCH: { optional: true },
|
|
8560
10236
|
PR_NUMBER: { optional: true },
|
|
8561
10237
|
GITHUB_TOKEN: { optional: true },
|
|
8562
|
-
GH_TOKEN: { optional: true }
|
|
10238
|
+
GH_TOKEN: { optional: true },
|
|
10239
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10240
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8563
10241
|
}
|
|
8564
10242
|
},
|
|
8565
10243
|
0
|
|
@@ -8568,6 +10246,7 @@ var REGISTRY = [
|
|
|
8568
10246
|
{
|
|
8569
10247
|
name: "pr-report-density",
|
|
8570
10248
|
validates: "body",
|
|
10249
|
+
requiresOpenPr: true,
|
|
8571
10250
|
run: bin("check-pr-report-density"),
|
|
8572
10251
|
scope: "diff",
|
|
8573
10252
|
timeoutMs: 15000,
|
|
@@ -8593,7 +10272,9 @@ var REGISTRY = [
|
|
|
8593
10272
|
PR_NUMBER: { optional: true },
|
|
8594
10273
|
GITHUB_REPOSITORY: { optional: true },
|
|
8595
10274
|
GITHUB_TOKEN: { optional: true },
|
|
8596
|
-
GH_TOKEN: { optional: true }
|
|
10275
|
+
GH_TOKEN: { optional: true },
|
|
10276
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10277
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8597
10278
|
}
|
|
8598
10279
|
},
|
|
8599
10280
|
0
|
|
@@ -8617,6 +10298,7 @@ var REGISTRY = [
|
|
|
8617
10298
|
{
|
|
8618
10299
|
name: "pr-premise-reassert",
|
|
8619
10300
|
validates: "body",
|
|
10301
|
+
requiresOpenPr: true,
|
|
8620
10302
|
run: bin("check-pr-premise-reassert"),
|
|
8621
10303
|
scope: "diff",
|
|
8622
10304
|
timeoutMs: 15000,
|
|
@@ -8637,7 +10319,9 @@ var REGISTRY = [
|
|
|
8637
10319
|
BRANCH: { optional: true },
|
|
8638
10320
|
GITHUB_TOKEN: { optional: true },
|
|
8639
10321
|
GH_TOKEN: { optional: true },
|
|
8640
|
-
PREMISE_FILE: { optional: true }
|
|
10322
|
+
PREMISE_FILE: { optional: true },
|
|
10323
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10324
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8641
10325
|
}
|
|
8642
10326
|
},
|
|
8643
10327
|
0
|
|
@@ -8689,7 +10373,9 @@ var REGISTRY = [
|
|
|
8689
10373
|
PR_BODY: { optional: true },
|
|
8690
10374
|
PR_BODY_FILE: { optional: true },
|
|
8691
10375
|
GITHUB_TOKEN: { optional: true },
|
|
8692
|
-
GH_TOKEN: { optional: true }
|
|
10376
|
+
GH_TOKEN: { optional: true },
|
|
10377
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10378
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8693
10379
|
}
|
|
8694
10380
|
},
|
|
8695
10381
|
1
|
|
@@ -8705,7 +10391,13 @@ var REGISTRY = [
|
|
|
8705
10391
|
principalOwed: true,
|
|
8706
10392
|
env: {
|
|
8707
10393
|
PR_BODY: { optional: true },
|
|
8708
|
-
BRANCH: { optional: true }
|
|
10394
|
+
BRANCH: { optional: true },
|
|
10395
|
+
PULL_REQUEST_HEAD_SHA: { optional: true },
|
|
10396
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
10397
|
+
GITHUB_TOKEN: { optional: true },
|
|
10398
|
+
GH_TOKEN: { optional: true },
|
|
10399
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10400
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8709
10401
|
}
|
|
8710
10402
|
},
|
|
8711
10403
|
1
|
|
@@ -8721,7 +10413,13 @@ var REGISTRY = [
|
|
|
8721
10413
|
ownWorkflow: true,
|
|
8722
10414
|
env: {
|
|
8723
10415
|
PR_BODY: { optional: true },
|
|
8724
|
-
BRANCH: { optional: true }
|
|
10416
|
+
BRANCH: { optional: true },
|
|
10417
|
+
PULL_REQUEST_HEAD_SHA: { optional: true },
|
|
10418
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
10419
|
+
GITHUB_TOKEN: { optional: true },
|
|
10420
|
+
GH_TOKEN: { optional: true },
|
|
10421
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10422
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8725
10423
|
}
|
|
8726
10424
|
},
|
|
8727
10425
|
1
|
|
@@ -8740,7 +10438,9 @@ var REGISTRY = [
|
|
|
8740
10438
|
PR_NUMBER: { optional: true },
|
|
8741
10439
|
GITHUB_REPOSITORY: { optional: true },
|
|
8742
10440
|
GITHUB_TOKEN: { optional: true },
|
|
8743
|
-
GH_TOKEN: { optional: true }
|
|
10441
|
+
GH_TOKEN: { optional: true },
|
|
10442
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10443
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8744
10444
|
}
|
|
8745
10445
|
},
|
|
8746
10446
|
1
|
|
@@ -8780,7 +10480,9 @@ var REGISTRY = [
|
|
|
8780
10480
|
PR_NUMBER: { optional: true },
|
|
8781
10481
|
GITHUB_REPOSITORY: { optional: true },
|
|
8782
10482
|
GITHUB_TOKEN: { optional: true },
|
|
8783
|
-
GH_TOKEN: { optional: true }
|
|
10483
|
+
GH_TOKEN: { optional: true },
|
|
10484
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10485
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8784
10486
|
}
|
|
8785
10487
|
},
|
|
8786
10488
|
1
|
|
@@ -8833,12 +10535,15 @@ var REGISTRY = [
|
|
|
8833
10535
|
{
|
|
8834
10536
|
name: "doc-coverage-push",
|
|
8835
10537
|
validates: "body",
|
|
10538
|
+
advisory: true,
|
|
8836
10539
|
run: bin("check-doc-coverage-push"),
|
|
8837
10540
|
scope: "diff",
|
|
8838
10541
|
timeoutMs: 15000,
|
|
8839
10542
|
env: {
|
|
8840
10543
|
OVERRIDE_DOCS: { optional: true },
|
|
8841
10544
|
BASE_SHA: { optional: true },
|
|
10545
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10546
|
+
VINAYA_COMMIT_HOOK: { optional: true },
|
|
8842
10547
|
PR_BODY: { optional: true },
|
|
8843
10548
|
PR_BODY_FILE: { optional: true },
|
|
8844
10549
|
PR_LABELS: { optional: true },
|
|
@@ -8850,21 +10555,6 @@ var REGISTRY = [
|
|
|
8850
10555
|
},
|
|
8851
10556
|
0
|
|
8852
10557
|
],
|
|
8853
|
-
[
|
|
8854
|
-
{
|
|
8855
|
-
name: "issue-assignment",
|
|
8856
|
-
run: bin("check-issue-assignment"),
|
|
8857
|
-
scope: "full",
|
|
8858
|
-
timeoutMs: 30000,
|
|
8859
|
-
env: {
|
|
8860
|
-
AEG_REPO: { optional: true },
|
|
8861
|
-
BRANCH: { optional: true },
|
|
8862
|
-
GITHUB_TOKEN: { optional: true },
|
|
8863
|
-
GH_TOKEN: { optional: true }
|
|
8864
|
-
}
|
|
8865
|
-
},
|
|
8866
|
-
0
|
|
8867
|
-
],
|
|
8868
10558
|
[
|
|
8869
10559
|
{
|
|
8870
10560
|
name: "evidence-fresh",
|
|
@@ -8878,7 +10568,9 @@ var REGISTRY = [
|
|
|
8878
10568
|
PR_BODY: { optional: true },
|
|
8879
10569
|
BASE_SHA: { optional: true },
|
|
8880
10570
|
GITHUB_TOKEN: { optional: true },
|
|
8881
|
-
GH_TOKEN: { optional: true }
|
|
10571
|
+
GH_TOKEN: { optional: true },
|
|
10572
|
+
VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
|
|
10573
|
+
GITHUB_ACTIONS: { optional: true }
|
|
8882
10574
|
}
|
|
8883
10575
|
},
|
|
8884
10576
|
1
|
|
@@ -8889,7 +10581,11 @@ var REGISTRY = [
|
|
|
8889
10581
|
run: bin("check-reader-resolvable-prose"),
|
|
8890
10582
|
scope: "full",
|
|
8891
10583
|
timeoutMs: 30000,
|
|
8892
|
-
env: {
|
|
10584
|
+
env: {
|
|
10585
|
+
BASE_SHA: { optional: true },
|
|
10586
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10587
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10588
|
+
},
|
|
8893
10589
|
include: [
|
|
8894
10590
|
"aeg-root/**/*.md",
|
|
8895
10591
|
"apps/cli/src/**",
|
|
@@ -8907,7 +10603,11 @@ var REGISTRY = [
|
|
|
8907
10603
|
run: bin("check-retired-vocabulary"),
|
|
8908
10604
|
scope: "full",
|
|
8909
10605
|
timeoutMs: 30000,
|
|
8910
|
-
env: {
|
|
10606
|
+
env: {
|
|
10607
|
+
BASE_SHA: { optional: true },
|
|
10608
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10609
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10610
|
+
},
|
|
8911
10611
|
include: ["aeg-root/**/*.md"]
|
|
8912
10612
|
},
|
|
8913
10613
|
0
|
|
@@ -8915,10 +10615,15 @@ var REGISTRY = [
|
|
|
8915
10615
|
[
|
|
8916
10616
|
{
|
|
8917
10617
|
name: "doctrine-portability",
|
|
10618
|
+
advisory: true,
|
|
8918
10619
|
run: bin("check-doctrine-portability"),
|
|
8919
10620
|
scope: "full",
|
|
8920
10621
|
timeoutMs: 30000,
|
|
8921
|
-
env: {
|
|
10622
|
+
env: {
|
|
10623
|
+
BASE_SHA: { optional: true },
|
|
10624
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10625
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10626
|
+
},
|
|
8922
10627
|
include: ["aeg-root/**/*.md"]
|
|
8923
10628
|
},
|
|
8924
10629
|
0
|
|
@@ -8951,7 +10656,11 @@ var REGISTRY = [
|
|
|
8951
10656
|
run: bin("check-exec-bits"),
|
|
8952
10657
|
scope: "diff",
|
|
8953
10658
|
timeoutMs: 30000,
|
|
8954
|
-
env: {
|
|
10659
|
+
env: {
|
|
10660
|
+
BASE_SHA: { optional: true },
|
|
10661
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10662
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10663
|
+
}
|
|
8955
10664
|
},
|
|
8956
10665
|
0
|
|
8957
10666
|
],
|
|
@@ -8961,17 +10670,26 @@ var REGISTRY = [
|
|
|
8961
10670
|
run: bin("check-ci-shard-coverage"),
|
|
8962
10671
|
scope: "diff",
|
|
8963
10672
|
timeoutMs: 15000,
|
|
8964
|
-
env: {
|
|
10673
|
+
env: {
|
|
10674
|
+
BASE_SHA: { optional: true },
|
|
10675
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10676
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10677
|
+
}
|
|
8965
10678
|
},
|
|
8966
10679
|
0
|
|
8967
10680
|
],
|
|
8968
10681
|
[
|
|
8969
10682
|
{
|
|
8970
10683
|
name: "workspace-escape",
|
|
10684
|
+
advisory: true,
|
|
8971
10685
|
run: bin("check-workspace-escape"),
|
|
8972
10686
|
scope: "full",
|
|
8973
10687
|
timeoutMs: 30000,
|
|
8974
|
-
env: {
|
|
10688
|
+
env: {
|
|
10689
|
+
BASE_SHA: { optional: true },
|
|
10690
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10691
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10692
|
+
},
|
|
8975
10693
|
include: ["aeg-root/**/*.md"]
|
|
8976
10694
|
},
|
|
8977
10695
|
0
|
|
@@ -8982,17 +10700,23 @@ var REGISTRY = [
|
|
|
8982
10700
|
run: bin("check-changeset-coverage"),
|
|
8983
10701
|
scope: "diff",
|
|
8984
10702
|
timeoutMs: 15000,
|
|
8985
|
-
env: {
|
|
10703
|
+
env: {
|
|
10704
|
+
BASE_SHA: { optional: true },
|
|
10705
|
+
GIT_INDEX_FILE: { optional: true },
|
|
10706
|
+
VINAYA_COMMIT_HOOK: { optional: true }
|
|
10707
|
+
}
|
|
8986
10708
|
},
|
|
8987
10709
|
0
|
|
8988
10710
|
],
|
|
8989
10711
|
[
|
|
8990
10712
|
{
|
|
8991
10713
|
name: "quoted-command",
|
|
10714
|
+
advisory: true,
|
|
8992
10715
|
run: bin("check-quoted-command"),
|
|
8993
|
-
scope: "
|
|
10716
|
+
scope: "full",
|
|
8994
10717
|
timeoutMs: 15000,
|
|
8995
|
-
env: {}
|
|
10718
|
+
env: {},
|
|
10719
|
+
include: ["aeg-root/**/*.md"]
|
|
8996
10720
|
},
|
|
8997
10721
|
0
|
|
8998
10722
|
],
|
|
@@ -9000,7 +10724,7 @@ var REGISTRY = [
|
|
|
9000
10724
|
{
|
|
9001
10725
|
name: "main-branch-refusal",
|
|
9002
10726
|
run: bin("check-main-branch-refusal"),
|
|
9003
|
-
scope: "
|
|
10727
|
+
scope: "diff",
|
|
9004
10728
|
timeoutMs: 15000,
|
|
9005
10729
|
env: { VINAYA_PUSH_REFS: { optional: true } }
|
|
9006
10730
|
},
|
|
@@ -9067,18 +10791,6 @@ var REGISTRY = [
|
|
|
9067
10791
|
},
|
|
9068
10792
|
1
|
|
9069
10793
|
],
|
|
9070
|
-
[
|
|
9071
|
-
{
|
|
9072
|
-
name: "issue-tranche-label",
|
|
9073
|
-
run: bin("check-issue-tranche-label"),
|
|
9074
|
-
validates: "issue",
|
|
9075
|
-
scope: "full",
|
|
9076
|
-
ownWorkflow: true,
|
|
9077
|
-
timeoutMs: 15000,
|
|
9078
|
-
env: { ISSUE_BODY: { optional: true }, ISSUE_LABELS: { optional: true } }
|
|
9079
|
-
},
|
|
9080
|
-
1
|
|
9081
|
-
],
|
|
9082
10794
|
[
|
|
9083
10795
|
{
|
|
9084
10796
|
name: "issue-milestone-attach",
|
|
@@ -9102,30 +10814,30 @@ function coreCheckRegistry() {
|
|
|
9102
10814
|
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
9103
10815
|
|
|
9104
10816
|
// src/lib/log-sink.ts
|
|
9105
|
-
import { execFile as
|
|
10817
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
9106
10818
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
9107
10819
|
import {
|
|
9108
10820
|
appendFileSync,
|
|
9109
10821
|
closeSync as closeSync4,
|
|
9110
10822
|
constants as fsConstants4,
|
|
9111
|
-
existsSync as
|
|
10823
|
+
existsSync as existsSync8,
|
|
9112
10824
|
fstatSync as fstatSync3,
|
|
9113
10825
|
mkdirSync as mkdirSync4,
|
|
9114
|
-
lstatSync as
|
|
10826
|
+
lstatSync as lstatSync3,
|
|
9115
10827
|
openSync as openSync4,
|
|
9116
|
-
readFileSync as
|
|
10828
|
+
readFileSync as readFileSync8,
|
|
9117
10829
|
renameSync as renameSync2,
|
|
9118
|
-
writeFileSync as
|
|
10830
|
+
writeFileSync as writeFileSync4,
|
|
9119
10831
|
writeSync as writeSync3
|
|
9120
10832
|
} from "node:fs";
|
|
9121
10833
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
9122
|
-
import { dirname as dirname7, join as
|
|
9123
|
-
import { promisify as
|
|
10834
|
+
import { dirname as dirname7, join as join9 } from "node:path";
|
|
10835
|
+
import { promisify as promisify6 } from "node:util";
|
|
9124
10836
|
|
|
9125
10837
|
// src/lib/run-paths.ts
|
|
9126
10838
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
9127
|
-
import { chmodSync, existsSync as
|
|
9128
|
-
import { dirname as dirname4, join as
|
|
10839
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
10840
|
+
import { dirname as dirname4, join as join7, resolve as resolvePath } from "node:path";
|
|
9129
10841
|
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
9130
10842
|
var RUN_AREA_DIRNAMES = {
|
|
9131
10843
|
control: CONTROL_AREA_DIRNAME,
|
|
@@ -9144,7 +10856,7 @@ function repoSegment(repo) {
|
|
|
9144
10856
|
return `${repo.owner}-${repo.repo}`;
|
|
9145
10857
|
}
|
|
9146
10858
|
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
9147
|
-
return
|
|
10859
|
+
return join7(home, "runtime", repoSegment(repo));
|
|
9148
10860
|
}
|
|
9149
10861
|
function resolveRuntimeDir(input) {
|
|
9150
10862
|
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
@@ -9165,27 +10877,27 @@ function isInsideRepo(candidate, repoRoot) {
|
|
|
9165
10877
|
return target === root || target.startsWith(`${root}/`);
|
|
9166
10878
|
}
|
|
9167
10879
|
function runPath(runtimeDir, scope, location) {
|
|
9168
|
-
const dir =
|
|
10880
|
+
const dir = join7(runtimeDir, TASKS_EXECUTION_DIRNAME, scopeSegment(scope));
|
|
9169
10881
|
switch (location.area) {
|
|
9170
10882
|
case "task":
|
|
9171
|
-
return location.file ?
|
|
10883
|
+
return location.file ? join7(dir, location.file) : dir;
|
|
9172
10884
|
case "control": {
|
|
9173
|
-
const controlDir =
|
|
9174
|
-
return location.file ?
|
|
10885
|
+
const controlDir = join7(dir, RUN_AREA_DIRNAMES.control);
|
|
10886
|
+
return location.file ? join7(controlDir, location.file) : controlDir;
|
|
9175
10887
|
}
|
|
9176
10888
|
case "rounds":
|
|
9177
|
-
return
|
|
10889
|
+
return join7(dir, RUN_AREA_DIRNAMES.rounds);
|
|
9178
10890
|
case "round": {
|
|
9179
|
-
const roundDir =
|
|
9180
|
-
return location.file ?
|
|
10891
|
+
const roundDir = join7(dir, RUN_AREA_DIRNAMES.rounds, String(location.round));
|
|
10892
|
+
return location.file ? join7(roundDir, location.file) : roundDir;
|
|
9181
10893
|
}
|
|
9182
10894
|
case "developer": {
|
|
9183
|
-
const developerDir =
|
|
9184
|
-
return location.file ?
|
|
10895
|
+
const developerDir = join7(dir, RUN_AREA_DIRNAMES.rounds, String(location.round), "developer");
|
|
10896
|
+
return location.file ? join7(developerDir, location.file) : developerDir;
|
|
9185
10897
|
}
|
|
9186
10898
|
default: {
|
|
9187
|
-
const areaDir =
|
|
9188
|
-
return location.file ?
|
|
10899
|
+
const areaDir = join7(dir, RUN_AREA_DIRNAMES[location.area]);
|
|
10900
|
+
return location.file ? join7(areaDir, location.file) : areaDir;
|
|
9189
10901
|
}
|
|
9190
10902
|
}
|
|
9191
10903
|
}
|
|
@@ -9254,7 +10966,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
9254
10966
|
return null;
|
|
9255
10967
|
}
|
|
9256
10968
|
for (;; ) {
|
|
9257
|
-
if (
|
|
10969
|
+
if (existsSync6(join7(dir, ".git")))
|
|
9258
10970
|
return dir;
|
|
9259
10971
|
const parent = dirname4(dir);
|
|
9260
10972
|
if (parent === dir)
|
|
@@ -9298,11 +11010,11 @@ function runtimeDirForThisRepo() {
|
|
|
9298
11010
|
import {
|
|
9299
11011
|
closeSync as closeSync2,
|
|
9300
11012
|
constants as fsConstants2,
|
|
9301
|
-
existsSync as
|
|
11013
|
+
existsSync as existsSync7,
|
|
9302
11014
|
fstatSync as fstatSync2,
|
|
9303
11015
|
mkdirSync as mkdirSync2,
|
|
9304
11016
|
openSync as openSync2,
|
|
9305
|
-
readFileSync as
|
|
11017
|
+
readFileSync as readFileSync6,
|
|
9306
11018
|
readSync,
|
|
9307
11019
|
statSync,
|
|
9308
11020
|
writeSync
|
|
@@ -9335,21 +11047,21 @@ function appendLoopLogLine(path, line) {
|
|
|
9335
11047
|
import {
|
|
9336
11048
|
closeSync as closeSync3,
|
|
9337
11049
|
constants as fsConstants3,
|
|
9338
|
-
lstatSync,
|
|
11050
|
+
lstatSync as lstatSync2,
|
|
9339
11051
|
mkdirSync as mkdirSync3,
|
|
9340
11052
|
openSync as openSync3,
|
|
9341
11053
|
linkSync,
|
|
9342
|
-
readFileSync as
|
|
11054
|
+
readFileSync as readFileSync7,
|
|
9343
11055
|
renameSync,
|
|
9344
11056
|
statSync as statSync2,
|
|
9345
11057
|
unlinkSync,
|
|
9346
11058
|
utimesSync,
|
|
9347
|
-
writeFileSync as
|
|
11059
|
+
writeFileSync as writeFileSync3,
|
|
9348
11060
|
writeSync as writeSync2
|
|
9349
11061
|
} from "node:fs";
|
|
9350
11062
|
import { randomUUID } from "node:crypto";
|
|
9351
11063
|
import { homedir as homedir2 } from "node:os";
|
|
9352
|
-
import { dirname as dirname6, join as
|
|
11064
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
9353
11065
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
9354
11066
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
9355
11067
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -9430,7 +11142,7 @@ function acquireDrainLock(lockPath) {
|
|
|
9430
11142
|
function renewDrainLock(lockPath, token) {
|
|
9431
11143
|
let holder;
|
|
9432
11144
|
try {
|
|
9433
|
-
holder =
|
|
11145
|
+
holder = readFileSync7(lockPath, "utf8").trim();
|
|
9434
11146
|
} catch (err) {
|
|
9435
11147
|
if (!isEnoent(err))
|
|
9436
11148
|
throw err;
|
|
@@ -9450,7 +11162,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
9450
11162
|
}
|
|
9451
11163
|
function releaseDrainLock(lockPath, token) {
|
|
9452
11164
|
try {
|
|
9453
|
-
const holder =
|
|
11165
|
+
const holder = readFileSync7(lockPath, "utf8").trim();
|
|
9454
11166
|
if (holder !== token)
|
|
9455
11167
|
return;
|
|
9456
11168
|
unlinkSync(lockPath);
|
|
@@ -9500,13 +11212,13 @@ function queueLines(buf) {
|
|
|
9500
11212
|
return lines;
|
|
9501
11213
|
}
|
|
9502
11214
|
function removeQueueHead(path, cut) {
|
|
9503
|
-
const remaining =
|
|
9504
|
-
|
|
11215
|
+
const remaining = readFileSync7(path);
|
|
11216
|
+
writeFileSync3(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
9505
11217
|
}
|
|
9506
11218
|
function queueBucketSize(path) {
|
|
9507
11219
|
let lstat;
|
|
9508
11220
|
try {
|
|
9509
|
-
lstat =
|
|
11221
|
+
lstat = lstatSync2(path);
|
|
9510
11222
|
} catch (err) {
|
|
9511
11223
|
if (!isEnoent(err))
|
|
9512
11224
|
throw err;
|
|
@@ -9521,7 +11233,7 @@ function queueBucketSize(path) {
|
|
|
9521
11233
|
function readQueueFile(path) {
|
|
9522
11234
|
if (queueBucketSize(path) === null)
|
|
9523
11235
|
return null;
|
|
9524
|
-
return
|
|
11236
|
+
return readFileSync7(path);
|
|
9525
11237
|
}
|
|
9526
11238
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
9527
11239
|
const record = JSON.stringify({
|
|
@@ -9636,7 +11348,7 @@ async function drainRenamedAside(args, livePath, source) {
|
|
|
9636
11348
|
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
9637
11349
|
const resolved = await resolveRepo();
|
|
9638
11350
|
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
9639
|
-
const outboxRoot = () =>
|
|
11351
|
+
const outboxRoot = () => join8(GLOBAL_VINAYA_HOME, "outbox");
|
|
9640
11352
|
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
9641
11353
|
const lockPath = `${path}.flush-lock`;
|
|
9642
11354
|
const lockToken = acquireDrainLock(lockPath);
|
|
@@ -9673,6 +11385,7 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
9673
11385
|
|
|
9674
11386
|
// src/lib/log-sink.ts
|
|
9675
11387
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
11388
|
+
var LOG_FOLDER_ONLY_ENV = "VINAYA_LOG_FOLDER_ONLY";
|
|
9676
11389
|
function describeFolderFallback(reason) {
|
|
9677
11390
|
if (reason.kind === "anchor-unreadable") {
|
|
9678
11391
|
return `not delivering to the configured log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json could not be read to confirm it (the trust-anchor read via `gh` was offline, " + "unauthenticated, or slower than its deadline); events are written to the local folder and can be " + "delivered later with `vinaya log send`";
|
|
@@ -9712,6 +11425,9 @@ function logsCredentialMissing(headers, env) {
|
|
|
9712
11425
|
return false;
|
|
9713
11426
|
}
|
|
9714
11427
|
function resolveLogDestinationFrom(input) {
|
|
11428
|
+
if (input.localConfig?.logs === false || input.unattended && input.trustAnchorConfig?.logs === false) {
|
|
11429
|
+
return { kind: "none", reason: "logs: false disables Log recording" };
|
|
11430
|
+
}
|
|
9715
11431
|
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
9716
11432
|
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
9717
11433
|
return { kind: "folder", folder: spoolDir };
|
|
@@ -9731,6 +11447,10 @@ function resolveLogDestinationFrom(input) {
|
|
|
9731
11447
|
} else {
|
|
9732
11448
|
effective = local;
|
|
9733
11449
|
}
|
|
11450
|
+
if (input.folderOnly || input.env[LOG_FOLDER_ONLY_ENV] === "1") {
|
|
11451
|
+
const folder = effective && "folder" in effective && !isInsideRepo(effective.folder, input.repoRoot) ? effective.folder : input.defaultFolder;
|
|
11452
|
+
return { kind: "folder", folder };
|
|
11453
|
+
}
|
|
9734
11454
|
if (hostFromEnv(input.env) === "ci") {
|
|
9735
11455
|
if (effective && "url" in effective) {
|
|
9736
11456
|
if (logsCredentialMissing(effective.headers, input.env)) {
|
|
@@ -9755,41 +11475,73 @@ function resolveLogDestinationFrom(input) {
|
|
|
9755
11475
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
9756
11476
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
9757
11477
|
}
|
|
9758
|
-
var
|
|
11478
|
+
var LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS = 30000;
|
|
11479
|
+
var LOG_DESTINATION_ANCHOR_MAX_RETRIES = 5;
|
|
11480
|
+
function createTrustAnchorCache(read, now = Date.now, bounds = {
|
|
11481
|
+
retryIntervalMs: LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS,
|
|
11482
|
+
maxRetries: LOG_DESTINATION_ANCHOR_MAX_RETRIES
|
|
11483
|
+
}) {
|
|
11484
|
+
const slots = new Map;
|
|
11485
|
+
const start = (repoRoot, retries) => {
|
|
11486
|
+
const slot = {
|
|
11487
|
+
reading: Promise.resolve().then(read).catch(() => null),
|
|
11488
|
+
retries,
|
|
11489
|
+
missedAt: null
|
|
11490
|
+
};
|
|
11491
|
+
slots.set(repoRoot, slot);
|
|
11492
|
+
slot.reading.then((config) => {
|
|
11493
|
+
if (config === null)
|
|
11494
|
+
slot.missedAt = now();
|
|
11495
|
+
});
|
|
11496
|
+
return slot.reading;
|
|
11497
|
+
};
|
|
11498
|
+
return {
|
|
11499
|
+
get: (repoRoot) => {
|
|
11500
|
+
const slot = slots.get(repoRoot);
|
|
11501
|
+
if (slot === undefined)
|
|
11502
|
+
return start(repoRoot, 0);
|
|
11503
|
+
if (slot.missedAt === null)
|
|
11504
|
+
return slot.reading;
|
|
11505
|
+
if (slot.retries >= bounds.maxRetries || now() - slot.missedAt < bounds.retryIntervalMs)
|
|
11506
|
+
return slot.reading;
|
|
11507
|
+
return start(repoRoot, slot.retries + 1);
|
|
11508
|
+
},
|
|
11509
|
+
clear: () => slots.clear()
|
|
11510
|
+
};
|
|
11511
|
+
}
|
|
11512
|
+
var processTrustAnchorByRepo = createTrustAnchorCache(safeLoadTrustAnchorConfig);
|
|
9759
11513
|
function processTrustAnchor(repoRoot) {
|
|
9760
|
-
|
|
9761
|
-
if (cached !== undefined)
|
|
9762
|
-
return cached;
|
|
9763
|
-
const reading = safeLoadTrustAnchorConfig();
|
|
9764
|
-
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
9765
|
-
return reading;
|
|
11514
|
+
return processTrustAnchorByRepo.get(repoRoot);
|
|
9766
11515
|
}
|
|
9767
|
-
async function defaultResolveLogDestination(repo, env) {
|
|
11516
|
+
async function defaultResolveLogDestination(repo, env, folderOnly = false) {
|
|
9768
11517
|
const localConfig = loadConfig();
|
|
9769
11518
|
const unattended = isUnattendedProcess(process.env);
|
|
9770
11519
|
const repoRoot = repoRootSync();
|
|
9771
11520
|
return resolveLogDestinationFrom({
|
|
9772
11521
|
localConfig,
|
|
11522
|
+
folderOnly,
|
|
9773
11523
|
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
9774
11524
|
unattended,
|
|
9775
11525
|
env,
|
|
9776
|
-
defaultFolder:
|
|
11526
|
+
defaultFolder: join9(await runtimeDirForRepoAsync(repo), "logs"),
|
|
9777
11527
|
repoRoot
|
|
9778
11528
|
});
|
|
9779
11529
|
}
|
|
9780
11530
|
function unresolvedLogDestination(env) {
|
|
11531
|
+
const loaded = loadConfig();
|
|
11532
|
+
if (loaded?.logs === false)
|
|
11533
|
+
return { kind: "none", reason: "logs: false disables Log recording" };
|
|
9781
11534
|
if (hostFromEnv(env) === "ci") {
|
|
9782
11535
|
return {
|
|
9783
11536
|
kind: "none",
|
|
9784
11537
|
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
9785
11538
|
};
|
|
9786
11539
|
}
|
|
9787
|
-
const
|
|
9788
|
-
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
11540
|
+
const localConfig = loaded?.logs && loaded.logs.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
9789
11541
|
const unattended = isUnattendedProcess(process.env);
|
|
9790
11542
|
const repoRoot = repoRootSync();
|
|
9791
11543
|
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
9792
|
-
const defaultFolder =
|
|
11544
|
+
const defaultFolder = join9(runtimeDir, "logs");
|
|
9793
11545
|
const resolved = resolveLogDestinationFrom({
|
|
9794
11546
|
localConfig,
|
|
9795
11547
|
trustAnchorConfig: null,
|
|
@@ -9802,7 +11554,7 @@ function unresolvedLogDestination(env) {
|
|
|
9802
11554
|
}
|
|
9803
11555
|
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9804
11556
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9805
|
-
return
|
|
11557
|
+
return join9(stateRoot, "fallback", `${dirName}.json`);
|
|
9806
11558
|
}
|
|
9807
11559
|
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9808
11560
|
const message = describeFolderFallback(reason);
|
|
@@ -9818,25 +11570,25 @@ function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot =
|
|
|
9818
11570
|
};
|
|
9819
11571
|
const path = folderFallbackStatePath(repo, stateRoot);
|
|
9820
11572
|
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9821
|
-
|
|
11573
|
+
writeFileSync4(path, `${JSON.stringify(record)}
|
|
9822
11574
|
`, { mode: 384 });
|
|
9823
11575
|
} catch {}
|
|
9824
11576
|
}
|
|
9825
11577
|
function isEnoent2(err) {
|
|
9826
11578
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
9827
11579
|
}
|
|
9828
|
-
var
|
|
11580
|
+
var execFileAsync6 = promisify6(execFile6);
|
|
9829
11581
|
async function resolveDoctrine(cwd, vinayaVersion) {
|
|
9830
11582
|
let toplevel;
|
|
9831
11583
|
try {
|
|
9832
|
-
toplevel = (await
|
|
11584
|
+
toplevel = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { encoding: "utf8" })).stdout.trim();
|
|
9833
11585
|
} catch (err) {
|
|
9834
11586
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
9835
11587
|
}
|
|
9836
|
-
if (!
|
|
11588
|
+
if (!existsSync8(join9(toplevel, "aeg-root", "roles")))
|
|
9837
11589
|
return vinayaVersion;
|
|
9838
11590
|
try {
|
|
9839
|
-
const sha = (await
|
|
11591
|
+
const sha = (await execFileAsync6("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
9840
11592
|
return `aeg-root@${sha}`;
|
|
9841
11593
|
} catch {
|
|
9842
11594
|
return vinayaVersion;
|
|
@@ -9859,7 +11611,7 @@ var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
|
9859
11611
|
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
9860
11612
|
let stdout;
|
|
9861
11613
|
try {
|
|
9862
|
-
({ stdout } = await
|
|
11614
|
+
({ stdout } = await execFileAsync6("gh", [
|
|
9863
11615
|
"issue",
|
|
9864
11616
|
"list",
|
|
9865
11617
|
"--state",
|
|
@@ -9897,7 +11649,7 @@ async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
|
9897
11649
|
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
9898
11650
|
let stdout;
|
|
9899
11651
|
try {
|
|
9900
|
-
({ stdout } = await
|
|
11652
|
+
({ stdout } = await execFileAsync6("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
9901
11653
|
cwd,
|
|
9902
11654
|
encoding: "utf8",
|
|
9903
11655
|
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
@@ -9916,7 +11668,7 @@ async function confirmBacklogIssue(issue, cwd, repo) {
|
|
|
9916
11668
|
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
9917
11669
|
let branch;
|
|
9918
11670
|
try {
|
|
9919
|
-
branch = (await
|
|
11671
|
+
branch = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
9920
11672
|
encoding: "utf8",
|
|
9921
11673
|
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
9922
11674
|
killSignal: "SIGKILL"
|
|
@@ -9934,7 +11686,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
9934
11686
|
}
|
|
9935
11687
|
function readVinayaVersion() {
|
|
9936
11688
|
try {
|
|
9937
|
-
const pkg = JSON.parse(
|
|
11689
|
+
const pkg = JSON.parse(readFileSync8(join9(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
9938
11690
|
return pkg.version ?? "unknown";
|
|
9939
11691
|
} catch {
|
|
9940
11692
|
return "unknown";
|
|
@@ -9952,7 +11704,7 @@ function safeRepoSlug(repo) {
|
|
|
9952
11704
|
function outboxPathFor(deps, repo, issue) {
|
|
9953
11705
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9954
11706
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
9955
|
-
return
|
|
11707
|
+
return join9(deps.outboxRoot(), dirName, fileName);
|
|
9956
11708
|
}
|
|
9957
11709
|
function hostFromEnv(env) {
|
|
9958
11710
|
if (env.GITHUB_ACTIONS)
|
|
@@ -9999,7 +11751,7 @@ function headShaRead(key, read, shared) {
|
|
|
9999
11751
|
}
|
|
10000
11752
|
async function resolveHeadSha(cwd) {
|
|
10001
11753
|
try {
|
|
10002
|
-
const out = (await
|
|
11754
|
+
const out = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
10003
11755
|
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
10004
11756
|
} catch {
|
|
10005
11757
|
return null;
|
|
@@ -10007,7 +11759,8 @@ async function resolveHeadSha(cwd) {
|
|
|
10007
11759
|
}
|
|
10008
11760
|
function defaultDeps() {
|
|
10009
11761
|
return {
|
|
10010
|
-
|
|
11762
|
+
readConfig: loadConfig,
|
|
11763
|
+
outboxRoot: () => join9(GLOBAL_VINAYA_HOME, "outbox"),
|
|
10011
11764
|
home: () => homedir3(),
|
|
10012
11765
|
hostname: () => osHostname(),
|
|
10013
11766
|
cwd: () => process.cwd(),
|
|
@@ -10052,7 +11805,7 @@ function appendHardenedLine(path, line) {
|
|
|
10052
11805
|
function reportRotationOverflow(backupPath, warn) {
|
|
10053
11806
|
let raw;
|
|
10054
11807
|
try {
|
|
10055
|
-
raw =
|
|
11808
|
+
raw = readFileSync8(backupPath, "utf8");
|
|
10056
11809
|
} catch {
|
|
10057
11810
|
return;
|
|
10058
11811
|
}
|
|
@@ -10190,23 +11943,59 @@ function createLogSink(overrides = {}) {
|
|
|
10190
11943
|
};
|
|
10191
11944
|
let contextCache;
|
|
10192
11945
|
let settledContext;
|
|
11946
|
+
let contextEnv = {};
|
|
11947
|
+
const resolveDestination = async (repo, env) => deps.readConfig()?.logs === false ? { kind: "none", reason: "logs: false disables Log recording" } : await deps.resolveLogDestination(repo, env, deps.folderOnly);
|
|
10193
11948
|
const context = () => {
|
|
10194
11949
|
if (contextCache === undefined) {
|
|
10195
11950
|
const env = deps.env();
|
|
11951
|
+
contextEnv = env;
|
|
10196
11952
|
contextCache = Promise.all([
|
|
10197
11953
|
withDeadline(resolveRepoOnce(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null),
|
|
10198
11954
|
doctrine()
|
|
10199
11955
|
]).then(async ([resolved, doctrineValue]) => {
|
|
10200
11956
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
10201
|
-
settledContext = { repo, doctrine: doctrineValue, destination: await
|
|
11957
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await resolveDestination(repo, env) };
|
|
11958
|
+
destinationRetryDueAt = deps.now().getTime() + LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS;
|
|
10202
11959
|
return settledContext;
|
|
10203
11960
|
});
|
|
10204
11961
|
}
|
|
10205
11962
|
return contextCache;
|
|
10206
11963
|
};
|
|
11964
|
+
let destinationRetries = 0;
|
|
11965
|
+
let destinationRetryDueAt = 0;
|
|
11966
|
+
let destinationRetryInFlight = false;
|
|
11967
|
+
const retryDestinationIfDue = (ctx) => {
|
|
11968
|
+
if (ctx.destination.kind !== "folder" || ctx.destination.fallbackReason?.kind !== "anchor-unreadable")
|
|
11969
|
+
return;
|
|
11970
|
+
if (destinationRetryInFlight || destinationRetries >= LOG_DESTINATION_ANCHOR_MAX_RETRIES)
|
|
11971
|
+
return;
|
|
11972
|
+
if (deps.now().getTime() < destinationRetryDueAt)
|
|
11973
|
+
return;
|
|
11974
|
+
destinationRetryInFlight = true;
|
|
11975
|
+
destinationRetries++;
|
|
11976
|
+
const generation = contextCache;
|
|
11977
|
+
Promise.resolve().then(() => resolveDestination(ctx.repo, contextEnv)).then((destination) => {
|
|
11978
|
+
if (contextCache !== generation)
|
|
11979
|
+
return;
|
|
11980
|
+
if (destination.kind === "server") {
|
|
11981
|
+
settledContext = { ...ctx, destination };
|
|
11982
|
+
contextCache = Promise.resolve(settledContext);
|
|
11983
|
+
return;
|
|
11984
|
+
}
|
|
11985
|
+
if (destination.kind !== "folder" || destination.fallbackReason?.kind !== "anchor-unreadable") {
|
|
11986
|
+
destinationRetries = LOG_DESTINATION_ANCHOR_MAX_RETRIES;
|
|
11987
|
+
}
|
|
11988
|
+
}, () => {
|
|
11989
|
+
return;
|
|
11990
|
+
}).finally(() => {
|
|
11991
|
+
destinationRetryInFlight = false;
|
|
11992
|
+
destinationRetryDueAt = deps.now().getTime() + LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS;
|
|
11993
|
+
});
|
|
11994
|
+
};
|
|
10207
11995
|
const resetContext = () => {
|
|
10208
11996
|
contextCache = undefined;
|
|
10209
11997
|
settledContext = undefined;
|
|
11998
|
+
destinationRetries = 0;
|
|
10210
11999
|
};
|
|
10211
12000
|
let drainChain = Promise.resolve();
|
|
10212
12001
|
const pendingWrites = new Set;
|
|
@@ -10219,24 +12008,30 @@ function createLogSink(overrides = {}) {
|
|
|
10219
12008
|
`);
|
|
10220
12009
|
});
|
|
10221
12010
|
};
|
|
10222
|
-
const snapshot = () => {
|
|
12011
|
+
const snapshot = (attribution) => {
|
|
10223
12012
|
const env = deps.env();
|
|
10224
12013
|
return {
|
|
12014
|
+
attributed: attribution !== undefined,
|
|
10225
12015
|
host: hostFromEnv(env),
|
|
10226
12016
|
now: deps.now(),
|
|
10227
12017
|
seq: seq++,
|
|
10228
12018
|
envFields: {
|
|
10229
|
-
role: env.VINAYA_ROLE,
|
|
12019
|
+
role: attribution?.role ?? env.VINAYA_ROLE,
|
|
10230
12020
|
task: env.VINAYA_TASK,
|
|
10231
|
-
round: env.VINAYA_ROUND,
|
|
12021
|
+
round: attribution ? String(attribution.round) : env.VINAYA_ROUND,
|
|
10232
12022
|
pr: env.VINAYA_PR,
|
|
10233
12023
|
run: env.VINAYA_RUN || runId,
|
|
10234
|
-
attempt: env.VINAYA_ATTEMPT,
|
|
12024
|
+
attempt: attribution ? String(attribution.attempt) : env.VINAYA_ATTEMPT,
|
|
10235
12025
|
parent: env.VINAYA_PARENT_EVENT,
|
|
10236
12026
|
workRef: env.VINAYA_WORK_REF,
|
|
10237
12027
|
flow: env.VINAYA_FLOW,
|
|
10238
12028
|
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
10239
12029
|
runtime: env.VINAYA_RUNTIME,
|
|
12030
|
+
processId: env.VINAYA_PROCESS_ID,
|
|
12031
|
+
processVersion: env.VINAYA_PROCESS_VERSION,
|
|
12032
|
+
processDigest: env.VINAYA_PROCESS_DIGEST,
|
|
12033
|
+
runnerId: env.VINAYA_RUNNER_ID,
|
|
12034
|
+
runnerVersion: env.VINAYA_RUNNER_VERSION,
|
|
10240
12035
|
source: env.VINAYA_SOURCE
|
|
10241
12036
|
}
|
|
10242
12037
|
};
|
|
@@ -10265,12 +12060,14 @@ function createLogSink(overrides = {}) {
|
|
|
10265
12060
|
branchIssue,
|
|
10266
12061
|
eventId: randomUUID2(),
|
|
10267
12062
|
processId,
|
|
12063
|
+
revision: headSha,
|
|
12064
|
+
provenance: call.attributed ? "parent_attributed" : deps.provenance,
|
|
10268
12065
|
inputVersions: deps.inputVersions()
|
|
10269
12066
|
});
|
|
10270
12067
|
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
10271
12068
|
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
10272
12069
|
folderFallbackRecorded = true;
|
|
10273
|
-
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder),
|
|
12070
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join9(deps.home(), ".vinaya"));
|
|
10274
12071
|
}
|
|
10275
12072
|
const full = { ...e, ...header };
|
|
10276
12073
|
const parsed = LogEventSchema.safeParse(full);
|
|
@@ -10289,11 +12086,14 @@ function createLogSink(overrides = {}) {
|
|
|
10289
12086
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
10290
12087
|
}
|
|
10291
12088
|
};
|
|
10292
|
-
function log(e) {
|
|
12089
|
+
function log(e, attribution) {
|
|
10293
12090
|
try {
|
|
10294
|
-
const call = snapshot();
|
|
12091
|
+
const call = snapshot(attribution);
|
|
10295
12092
|
const write = async () => {
|
|
10296
12093
|
const ctx = await context();
|
|
12094
|
+
try {
|
|
12095
|
+
retryDestinationIfDue(ctx);
|
|
12096
|
+
} catch {}
|
|
10297
12097
|
if (ctx.destination.kind === "none") {
|
|
10298
12098
|
writeEvent(e, call, ctx, null, null, true);
|
|
10299
12099
|
return;
|
|
@@ -10317,9 +12117,13 @@ function createLogSink(overrides = {}) {
|
|
|
10317
12117
|
function logSync(e, opts = {}) {
|
|
10318
12118
|
try {
|
|
10319
12119
|
const call = snapshot();
|
|
10320
|
-
let ctx =
|
|
12120
|
+
let ctx = deps.readConfig()?.logs === false ? {
|
|
12121
|
+
repo: null,
|
|
12122
|
+
doctrine: "unknown",
|
|
12123
|
+
destination: { kind: "none", reason: "logs: false disables Log recording" }
|
|
12124
|
+
} : settledContext;
|
|
10321
12125
|
if (ctx === undefined) {
|
|
10322
|
-
const destination = deps.unresolvedLogDestination(deps.env());
|
|
12126
|
+
const destination = deps.readConfig()?.logs === false ? { kind: "none", reason: "logs: false disables Log recording" } : deps.unresolvedLogDestination(deps.env());
|
|
10323
12127
|
if (destination.kind === "folder" && !opts.quiet) {
|
|
10324
12128
|
warnOnce(`vinaya: the process ended before its log destination was resolved — the event is written to ${destination.folder}; \`vinaya log send\` delivers it to a configured server later
|
|
10325
12129
|
`);
|
|
@@ -10355,13 +12159,6 @@ function createLogSink(overrides = {}) {
|
|
|
10355
12159
|
}
|
|
10356
12160
|
var defaultSink = createLogSink();
|
|
10357
12161
|
|
|
10358
|
-
// src/checks/contract.ts
|
|
10359
|
-
var CHECK_SCHEMA_VERSION = 1;
|
|
10360
|
-
function emitCheckError(error) {
|
|
10361
|
-
process.stderr.write(`${JSON.stringify(error)}
|
|
10362
|
-
`);
|
|
10363
|
-
}
|
|
10364
|
-
|
|
10365
12162
|
// src/checks/runner.ts
|
|
10366
12163
|
var activeChecks = new Map;
|
|
10367
12164
|
|
|
@@ -10402,17 +12199,37 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
10402
12199
|
|
|
10403
12200
|
// src/lib/diff-evidence.ts
|
|
10404
12201
|
function fileDiffAgainst(ref, path) {
|
|
10405
|
-
let
|
|
12202
|
+
let committed;
|
|
10406
12203
|
try {
|
|
10407
|
-
|
|
12204
|
+
committed = execFileSync8("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
10408
12205
|
encoding: "utf8",
|
|
10409
12206
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10410
12207
|
}).trim();
|
|
10411
12208
|
} catch {
|
|
10412
12209
|
return null;
|
|
10413
12210
|
}
|
|
12211
|
+
const staged = stagedDiff(["--", path]);
|
|
12212
|
+
if (staged === null)
|
|
12213
|
+
return null;
|
|
12214
|
+
const out = [committed, staged].filter(Boolean).join(`
|
|
12215
|
+
`);
|
|
10414
12216
|
return out === "" ? null : out;
|
|
10415
12217
|
}
|
|
12218
|
+
function readsStagedDiff() {
|
|
12219
|
+
return process.env.VINAYA_COMMIT_HOOK === "1" && Boolean(process.env.GIT_INDEX_FILE);
|
|
12220
|
+
}
|
|
12221
|
+
function stagedDiff(args) {
|
|
12222
|
+
if (!readsStagedDiff())
|
|
12223
|
+
return "";
|
|
12224
|
+
try {
|
|
12225
|
+
return execFileSync8("git", ["diff", "--cached", ...args], {
|
|
12226
|
+
encoding: "utf8",
|
|
12227
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
12228
|
+
}).trim();
|
|
12229
|
+
} catch {
|
|
12230
|
+
return null;
|
|
12231
|
+
}
|
|
12232
|
+
}
|
|
10416
12233
|
function revParse(ref) {
|
|
10417
12234
|
try {
|
|
10418
12235
|
return execFileSync8("git", ["rev-parse", "--verify", ref], {
|
|
@@ -10446,6 +12263,13 @@ function changedFiles(base) {
|
|
|
10446
12263
|
return out === "" ? [] : out.split(`
|
|
10447
12264
|
`).map((s) => s.trim()).filter(Boolean);
|
|
10448
12265
|
}
|
|
12266
|
+
function stagedChangedFiles() {
|
|
12267
|
+
const out = stagedDiff(["--name-only"]);
|
|
12268
|
+
if (out === null)
|
|
12269
|
+
return null;
|
|
12270
|
+
return out === "" ? [] : out.split(`
|
|
12271
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
12272
|
+
}
|
|
10449
12273
|
function resolveChangedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
10450
12274
|
return resolveDiff(base)?.files ?? null;
|
|
10451
12275
|
}
|
|
@@ -10461,7 +12285,30 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
10461
12285
|
const relPaths = changedFiles(ref);
|
|
10462
12286
|
if (relPaths === null)
|
|
10463
12287
|
continue;
|
|
10464
|
-
|
|
12288
|
+
const stagedPaths = stagedChangedFiles();
|
|
12289
|
+
if (stagedPaths === null)
|
|
12290
|
+
return null;
|
|
12291
|
+
const paths = [...new Set([...relPaths, ...stagedPaths])];
|
|
12292
|
+
return { base: ref, root, files: paths.map((p) => join10(root, p)) };
|
|
12293
|
+
}
|
|
12294
|
+
return null;
|
|
12295
|
+
}
|
|
12296
|
+
function resolveAddedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
12297
|
+
if (repoRoot() === null)
|
|
12298
|
+
return null;
|
|
12299
|
+
const head = revParse("HEAD");
|
|
12300
|
+
for (const ref of new Set([base, "origin/main", "main"])) {
|
|
12301
|
+
const resolved = revParse(ref);
|
|
12302
|
+
if (resolved === null || resolved === head)
|
|
12303
|
+
continue;
|
|
12304
|
+
try {
|
|
12305
|
+
const out = execFileSync8("git", ["diff", "--name-only", "--diff-filter=A", `${ref}...HEAD`], {
|
|
12306
|
+
encoding: "utf8",
|
|
12307
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
12308
|
+
}).trim();
|
|
12309
|
+
return out === "" ? [] : out.split(`
|
|
12310
|
+
`).map((p) => p.trim()).filter(Boolean);
|
|
12311
|
+
} catch {}
|
|
10465
12312
|
}
|
|
10466
12313
|
return null;
|
|
10467
12314
|
}
|
|
@@ -10510,7 +12357,7 @@ function collectAllPaths(dir, out = []) {
|
|
|
10510
12357
|
for (const name of entries) {
|
|
10511
12358
|
if (EXCLUDED_DIRS.has(name))
|
|
10512
12359
|
continue;
|
|
10513
|
-
const full =
|
|
12360
|
+
const full = join11(dir, name);
|
|
10514
12361
|
let isDir;
|
|
10515
12362
|
try {
|
|
10516
12363
|
isDir = statSync3(full).isDirectory();
|
|
@@ -10526,7 +12373,7 @@ function collectAllPaths(dir, out = []) {
|
|
|
10526
12373
|
function main() {
|
|
10527
12374
|
const allPaths = WORKSPACE_DIRS.flatMap((d) => collectAllPaths(d)).map((p) => p.split("\\").join("/"));
|
|
10528
12375
|
const knownPaths = new Set(allPaths);
|
|
10529
|
-
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content:
|
|
12376
|
+
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content: readFileSync9(p, "utf8") }));
|
|
10530
12377
|
const findings = findWorkspaceEscapes(sourceFiles, knownPaths, WORKSPACE_DIRS);
|
|
10531
12378
|
const reportable = findingsInThisDiff(findings);
|
|
10532
12379
|
console.log(`${CHECK_NAME}: ${sourceFiles.length} source file(s) scanned under ${WORKSPACE_DIRS.join("/")}; ${findings.length} finding(s), ${reportable.length} in this diff`);
|