@attalabs/vinaya 0.19.3 → 0.21.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 +81 -0
- package/aeg-root/contracts/archivist-tranche-archivist.md +2 -2
- package/aeg-root/contracts/tranche-archivist-planner.md +8 -8
- package/aeg-root/enforcement.md +18 -9
- package/aeg-root/milestone-model.md +3 -1
- package/aeg-root/process.md +5 -5
- package/aeg-root/roles/architect.md +2 -2
- package/aeg-root/roles/archivist.md +10 -11
- package/aeg-root/roles/brief-author.md +1 -1
- package/aeg-root/roles/developer.md +4 -3
- package/aeg-root/roles/planner.md +2 -2
- package/aeg-root/roles/principal.md +2 -1
- package/aeg-root/roles/tranche-archivist.md +5 -18
- package/aeg-root/skills/aeg/SKILL.md +30 -1
- package/aeg-root/skills/aeg-roles/SKILL.md +1 -1
- package/aeg-root/skills/brief-authoring/SKILL.md +2 -2
- package/aeg-root/state-machine.md +8 -6
- package/aeg-root/task-model.md +1 -1
- package/aeg-root/templates/issue-rationale-template.md +4 -4
- package/aeg-root/templates/pr-report-template.md +4 -0
- package/aeg-root/tranche-model.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +473 -32
- package/dist/checks/bin/check-branch-topology.js +792 -11
- package/dist/checks/bin/check-brief-shape.js +353 -11
- package/dist/checks/bin/check-changeset-coverage.js +4156 -0
- package/dist/checks/bin/check-closes-n.js +792 -11
- package/dist/checks/bin/check-coherence.js +831 -15
- package/dist/checks/bin/check-dead-branch-push.js +353 -11
- package/dist/checks/bin/check-dispatch-readiness.js +996 -28
- package/dist/checks/bin/check-doc-coverage-push.js +449 -22
- package/dist/checks/bin/check-doc-coverage.js +449 -22
- package/dist/checks/bin/check-doctrine-portability.js +392 -15
- package/dist/checks/bin/check-evidence-fresh.js +462 -20
- package/dist/checks/bin/check-first-push-dispatch.js +898 -26
- package/dist/checks/bin/check-issue-assignment.js +792 -11
- package/dist/checks/bin/check-main-branch-refusal.js +3973 -0
- package/dist/checks/bin/check-no-disk-state.js +353 -11
- package/dist/checks/bin/check-quoted-command.js +4405 -0
- package/dist/checks/bin/check-reader-resolvable-prose.js +466 -20
- package/dist/checks/bin/check-registry-gates.js +467 -16
- package/dist/checks/bin/check-retired-vocabulary.js +465 -19
- package/dist/checks/bin/check-review-gate.js +392 -15
- package/dist/checks/bin/check-single-plan-pr.js +353 -11
- package/dist/checks/bin/check-test-plan.js +353 -11
- package/dist/checks/bin/check-token-collection-wired.js +3975 -0
- package/dist/checks/bin/check-workspace-escape.js +353 -11
- package/dist/index.js +1921 -420
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +1089 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +5 -0
- 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 +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +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 +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
- 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 +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__0pvgf28._.js → [externals]__1agj1ww._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0053k9k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0112h-k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__040smoa._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0cxtq46._.js +25 -18
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0o771t1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__03jepya._.js → [root-of-the-server]__0ozbaq0._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0puovz5._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0ykun-j._.js → [root-of-the-server]__0z6dav-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__18kqy4q._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1hs0dcu._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1widio3._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1yoa8tx._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_03x_w6q._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gvm3og._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0lwxg63._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0wxycau._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0x999pb._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-6rzip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1fqw88f._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_0zys35s._.js → _1mqrlbl._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_1c9b9j-._.js → _1mrtj0f._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1n0cnq-._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{apps_vinaya-studio_web_src_app_studio_18kqbvs._.js → apps_vinaya-studio_web_src_app_studio_06it6s-._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_1vo08dj._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0r4i_ks9z02bw.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3noqvds-2bvrd.js → 1hfhxjy577l5d.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1k916ih3p4nsg.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{29-foak16tjfu.js → 1t2kft7bxzuxn.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2iysedx-n06xc.js → 1ybrihl5_aocy.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{30ojnsx3p4lp4.js → 1yqs2zgvwa4p1.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0msr2a1i-x-br.js → 25kbt5k-xb2a5.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3gehliafvmjo9.js → 2_k6j1o9q5nn4.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2hmannd4bjhzy.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3mqu_uhluy19i.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/aeg-root/coordination.md +0 -292
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1rku4gz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/25j-y57ng11hl.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/30lyvn0yzwdiz.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/35u8inxa732is.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/42wxpzjhw7oy4.css +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{5Lv83SnT--7YJDjSbxona → crNCHQ9uAgKOYC6DKkZma}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{5Lv83SnT--7YJDjSbxona → crNCHQ9uAgKOYC6DKkZma}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{5Lv83SnT--7YJDjSbxona → crNCHQ9uAgKOYC6DKkZma}/_ssgManifest.js +0 -0
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @bun
|
|
3
2
|
|
|
4
3
|
// src/checks/bin/check-body-bare-digits.ts
|
|
5
|
-
import { execFileSync as execFileSync3 } from "child_process";
|
|
4
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
6
5
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
7
6
|
var GATE_AUDIENCE = {
|
|
8
|
-
"check-branch-topology": { shippedAs: "branch-topology" },
|
|
9
|
-
"check-first-push-dispatch": { shippedAs: "first-push-dispatch" },
|
|
10
|
-
"check-no-disk-state": { shippedAs: "no-disk-state" },
|
|
11
|
-
"verify-brief": { shippedAs: "brief-shape" },
|
|
12
|
-
"verify-coherence": { shippedAs: "coherence" },
|
|
13
|
-
"verify-dispatch": { shippedAs: "dispatch-readiness" },
|
|
14
|
-
"verify-docs": { shippedAs: ["doc-coverage", "doc-coverage-push"] },
|
|
15
|
-
"verify-registry": { shippedAs: "registry-gates" },
|
|
16
|
-
"verify-review-gate": { shippedAs: "review-gate" },
|
|
17
|
-
"verify-single-plan-pr": { shippedAs: "single-plan-pr" },
|
|
18
|
-
"verify-test-plan": { shippedAs: "test-plan" },
|
|
7
|
+
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
8
|
+
"check-first-push-dispatch": { shippedAs: "first-push-dispatch", ring: 0 },
|
|
9
|
+
"check-no-disk-state": { shippedAs: "no-disk-state", ring: 0 },
|
|
10
|
+
"verify-brief": { shippedAs: "brief-shape", ring: 0 },
|
|
11
|
+
"verify-coherence": { shippedAs: "coherence", ring: 0 },
|
|
12
|
+
"verify-dispatch": { shippedAs: "dispatch-readiness", ring: 0 },
|
|
13
|
+
"verify-docs": { shippedAs: ["doc-coverage", "doc-coverage-push"], ring: 0 },
|
|
14
|
+
"verify-registry": { shippedAs: "registry-gates", ring: 0 },
|
|
15
|
+
"verify-review-gate": { shippedAs: "review-gate", ring: 1 },
|
|
16
|
+
"verify-single-plan-pr": { shippedAs: "single-plan-pr", ring: 0 },
|
|
17
|
+
"verify-test-plan": { shippedAs: "test-plan", ring: 1 },
|
|
19
18
|
"check-direct-main-push": {
|
|
20
19
|
internal: "Reaches adopters through `vinaya audit --only=direct-push`, not the check registry: it is a ring-2 sweep over merge history keyed on `GITHUB_SHA`, run by the generated archivist job on push to the default branch. It has no diff to key on, so there is nothing for `vinaya check` to run it against."
|
|
21
20
|
},
|
|
@@ -190,6 +189,12 @@ var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
|
190
189
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
191
190
|
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
|
|
192
191
|
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
|
|
192
|
+
function splitSlugQualifiedEdge(edge) {
|
|
193
|
+
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
194
|
+
if (!m)
|
|
195
|
+
return null;
|
|
196
|
+
return { slug: m[1], bareId: m[2] };
|
|
197
|
+
}
|
|
193
198
|
function isEmptyMarker(s) {
|
|
194
199
|
const t = s.trim();
|
|
195
200
|
return t === "" || t === "—" || t === "-" || t === "–";
|
|
@@ -327,6 +332,13 @@ var LABELS = [
|
|
|
327
332
|
form: "literal",
|
|
328
333
|
carries: "Execution is halted pending an external unblock; wins over every other derived status."
|
|
329
334
|
},
|
|
335
|
+
{
|
|
336
|
+
key: "backlog",
|
|
337
|
+
id: "vinaya/backlog",
|
|
338
|
+
category: "state",
|
|
339
|
+
form: "literal",
|
|
340
|
+
carries: "The Issue is deliberately unplanned — belongs to no tranche and is excluded from dispatch, until a Planner promotes it."
|
|
341
|
+
},
|
|
330
342
|
{
|
|
331
343
|
key: "tier-0",
|
|
332
344
|
id: "vinaya/tier:0",
|
|
@@ -1779,6 +1791,151 @@ var DERIVED_STATUSES = [
|
|
|
1779
1791
|
"incoherent"
|
|
1780
1792
|
];
|
|
1781
1793
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1794
|
+
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1795
|
+
var DASH_LOOKALIKES = {
|
|
1796
|
+
"-": "‑",
|
|
1797
|
+
"–": "‒",
|
|
1798
|
+
"—": "―"
|
|
1799
|
+
};
|
|
1800
|
+
var DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES));
|
|
1801
|
+
// ../../packages/aeg-core/src/claude-code-transcript.ts
|
|
1802
|
+
function summarizeTranscript(jsonl) {
|
|
1803
|
+
const seen = new Set;
|
|
1804
|
+
const components = {
|
|
1805
|
+
inputTokens: 0,
|
|
1806
|
+
outputTokens: 0,
|
|
1807
|
+
cacheCreationInputTokens: 0,
|
|
1808
|
+
cacheReadInputTokens: 0
|
|
1809
|
+
};
|
|
1810
|
+
let model = null;
|
|
1811
|
+
let messageCount = 0;
|
|
1812
|
+
for (const rawLine of jsonl.split(/\r?\n/)) {
|
|
1813
|
+
const line = rawLine.trim();
|
|
1814
|
+
if (!line)
|
|
1815
|
+
continue;
|
|
1816
|
+
let entry2;
|
|
1817
|
+
try {
|
|
1818
|
+
entry2 = JSON.parse(line);
|
|
1819
|
+
} catch {
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1822
|
+
if (!entry2 || typeof entry2 !== "object")
|
|
1823
|
+
continue;
|
|
1824
|
+
const obj = entry2;
|
|
1825
|
+
if (obj.type !== "assistant")
|
|
1826
|
+
continue;
|
|
1827
|
+
const message = obj.message;
|
|
1828
|
+
const id = message?.id;
|
|
1829
|
+
const usage = message?.usage;
|
|
1830
|
+
if (typeof id !== "string" || !id || !usage || seen.has(id))
|
|
1831
|
+
continue;
|
|
1832
|
+
seen.add(id);
|
|
1833
|
+
messageCount++;
|
|
1834
|
+
components.inputTokens += numberOr(usage.input_tokens, 0);
|
|
1835
|
+
components.outputTokens += numberOr(usage.output_tokens, 0);
|
|
1836
|
+
components.cacheCreationInputTokens += numberOr(usage.cache_creation_input_tokens, 0);
|
|
1837
|
+
components.cacheReadInputTokens += numberOr(usage.cache_read_input_tokens, 0);
|
|
1838
|
+
const messageModel = message?.model;
|
|
1839
|
+
if (typeof messageModel === "string" && messageModel)
|
|
1840
|
+
model = messageModel;
|
|
1841
|
+
}
|
|
1842
|
+
return { components, model, messageCount };
|
|
1843
|
+
}
|
|
1844
|
+
function numberOr(value, fallback) {
|
|
1845
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1846
|
+
}
|
|
1847
|
+
function sanitizeKey(value) {
|
|
1848
|
+
return value.replace(/[^A-Za-z0-9]+/g, "-");
|
|
1849
|
+
}
|
|
1850
|
+
function transcriptPointerPath(projectDir, tmpDir) {
|
|
1851
|
+
return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`;
|
|
1852
|
+
}
|
|
1853
|
+
function resolvePointer(explicitTranscriptPath, deps) {
|
|
1854
|
+
if (explicitTranscriptPath)
|
|
1855
|
+
return { path: explicitTranscriptPath, corroborated: true };
|
|
1856
|
+
const projectDir = deps.env.CLAUDE_PROJECT_DIR ?? deps.cwd;
|
|
1857
|
+
const tmpDir = deps.env.TMPDIR ?? "/tmp";
|
|
1858
|
+
const pointerPath = transcriptPointerPath(projectDir, tmpDir);
|
|
1859
|
+
const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID;
|
|
1860
|
+
if (!deps.exists(pointerPath)) {
|
|
1861
|
+
return {
|
|
1862
|
+
pointerExisted: false,
|
|
1863
|
+
corroborated: false,
|
|
1864
|
+
error: `No transcript pointer at ${pointerPath} and no --transcript given. ` + "Either this repo installs no track-transcript.sh Stop hook (lacking one is not a defect — " + "name the transcript directly instead), or no session has completed a turn yet."
|
|
1865
|
+
};
|
|
1866
|
+
}
|
|
1867
|
+
let contents;
|
|
1868
|
+
try {
|
|
1869
|
+
contents = deps.readFile(pointerPath).replace(/\r?\n+$/, "");
|
|
1870
|
+
} catch (err) {
|
|
1871
|
+
return {
|
|
1872
|
+
pointerExisted: true,
|
|
1873
|
+
oursByLocation: true,
|
|
1874
|
+
error: `Transcript pointer at ${pointerPath} could not be read: ${err.message}. ` + "Remove that file to clear this — the Stop hook rewrites it on the next turn."
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
const [pointerSessionId, transcriptPath] = contents.split("\t");
|
|
1878
|
+
if (!transcriptPath) {
|
|
1879
|
+
return {
|
|
1880
|
+
pointerExisted: true,
|
|
1881
|
+
oursByLocation: true,
|
|
1882
|
+
error: `Transcript pointer file ${pointerPath} is malformed: "${contents.slice(0, 120)}${contents.length > 120 ? "…" : ""}". ` + "Remove that file to clear this — the Stop hook rewrites it on the next turn."
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
if (currentSessionId && pointerSessionId && currentSessionId !== pointerSessionId) {
|
|
1886
|
+
return {
|
|
1887
|
+
pointerExisted: true,
|
|
1888
|
+
corroborated: false,
|
|
1889
|
+
error: `Transcript pointer at ${pointerPath} is stale: written for session ${pointerSessionId}, ` + `but this session is ${currentSessionId}. Name your own transcript with --transcript instead of ` + "reporting another session's figures as yours."
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
return { path: transcriptPath, corroborated: Boolean(currentSessionId && pointerSessionId) };
|
|
1893
|
+
}
|
|
1894
|
+
function resolveMeteringCapability(deps, explicitTranscriptPath) {
|
|
1895
|
+
const resolved = resolvePointer(explicitTranscriptPath, deps);
|
|
1896
|
+
if ("error" in resolved) {
|
|
1897
|
+
const ours = resolved.pointerExisted && (resolved.corroborated || resolved.oursByLocation);
|
|
1898
|
+
if (ours)
|
|
1899
|
+
return { capable: false, reason: "pointer-unusable", detail: resolved.error };
|
|
1900
|
+
return {
|
|
1901
|
+
capable: false,
|
|
1902
|
+
reason: "no-transcript-resolved",
|
|
1903
|
+
detail: resolved.pointerExisted ? `A transcript pointer exists but belongs to another session, so this session has no wiring of its own to use. (Underlying condition, for diagnosis only: ${resolved.error})` : resolved.error
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
const downstream = (r, detail) => resolved.corroborated ? { reason: r, detail } : {
|
|
1907
|
+
reason: "no-transcript-resolved",
|
|
1908
|
+
detail: `A transcript pointer was found but could not be shown to belong to this session, so it is not treated as this session's wiring. (Underlying condition, for diagnosis only: ${detail})`
|
|
1909
|
+
};
|
|
1910
|
+
if (!deps.exists(resolved.path)) {
|
|
1911
|
+
return {
|
|
1912
|
+
capable: false,
|
|
1913
|
+
...downstream("transcript-unreadable", `Resolved transcript path ${resolved.path} is not readable as a regular file owned by this user.`)
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
let jsonl;
|
|
1917
|
+
try {
|
|
1918
|
+
jsonl = deps.readFile(resolved.path);
|
|
1919
|
+
} catch (err) {
|
|
1920
|
+
return {
|
|
1921
|
+
capable: false,
|
|
1922
|
+
...downstream("transcript-unreadable", `Transcript at ${resolved.path} could not be read: ${err.message}`)
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
const summary = summarizeTranscript(jsonl);
|
|
1926
|
+
if (summary.messageCount === 0) {
|
|
1927
|
+
return {
|
|
1928
|
+
capable: false,
|
|
1929
|
+
...downstream("transcript-empty", `Transcript at ${resolved.path} yielded zero assistant messages with usage data — ` + "it's empty, unparseable, or not yet flushed to disk.")
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
return { capable: true, transcriptPath: resolved.path, summary };
|
|
1933
|
+
}
|
|
1934
|
+
function isTokenCollectionWiringBroken(capability) {
|
|
1935
|
+
if (capability.capable)
|
|
1936
|
+
return false;
|
|
1937
|
+
return capability.reason !== "no-transcript-resolved";
|
|
1938
|
+
}
|
|
1782
1939
|
// ../../packages/aeg-core/src/file-classify.ts
|
|
1783
1940
|
function isCodeFile(p) {
|
|
1784
1941
|
if (p.endsWith(".md"))
|
|
@@ -1985,7 +2142,59 @@ function overrideActive(opts) {
|
|
|
1985
2142
|
return false;
|
|
1986
2143
|
}
|
|
1987
2144
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
2145
|
+
import { createHash } from "node:crypto";
|
|
1988
2146
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
2147
|
+
function isPremiseHeader(line) {
|
|
2148
|
+
const stripped = line.replace(/[*#]/g, "").trim();
|
|
2149
|
+
return /^premise\s*:?$/i.test(stripped);
|
|
2150
|
+
}
|
|
2151
|
+
var PREMISE_LINE = /^[-*]\s*(\S+)\s+(contains|absent|sha256)\s*:\s*(.+)$/i;
|
|
2152
|
+
function parsePremiseBlock(prBody) {
|
|
2153
|
+
const searchIn = anchoredRegion(prBody, "PREMISE") ?? prBody;
|
|
2154
|
+
const lines = searchIn.split(/\r?\n/);
|
|
2155
|
+
const assertions = [];
|
|
2156
|
+
let inBlock = false;
|
|
2157
|
+
for (const raw of lines) {
|
|
2158
|
+
const line = raw.trim();
|
|
2159
|
+
if (!inBlock) {
|
|
2160
|
+
if (isPremiseHeader(line))
|
|
2161
|
+
inBlock = true;
|
|
2162
|
+
continue;
|
|
2163
|
+
}
|
|
2164
|
+
if (line === "")
|
|
2165
|
+
break;
|
|
2166
|
+
const m = line.match(PREMISE_LINE);
|
|
2167
|
+
if (!m)
|
|
2168
|
+
break;
|
|
2169
|
+
const [, path, kindRaw, value] = m;
|
|
2170
|
+
const kind = kindRaw.toLowerCase();
|
|
2171
|
+
if (!ASSERTION_KINDS.has(kind))
|
|
2172
|
+
continue;
|
|
2173
|
+
assertions.push({ kind, path, value: value.trim() });
|
|
2174
|
+
}
|
|
2175
|
+
return assertions;
|
|
2176
|
+
}
|
|
2177
|
+
function checkPremises(assertions, fileReader) {
|
|
2178
|
+
const failures = [];
|
|
2179
|
+
for (const a of assertions) {
|
|
2180
|
+
const content = fileReader(a.path);
|
|
2181
|
+
if (content === null) {
|
|
2182
|
+
failures.push(`premise-check: ${a.path} does not exist on disk (premise asserted \`${a.kind}: ${a.value}\`) — the surface moved since this brief was authored; re-dig before proceeding.`);
|
|
2183
|
+
continue;
|
|
2184
|
+
}
|
|
2185
|
+
if (a.kind === "contains" && !content.includes(a.value)) {
|
|
2186
|
+
failures.push(`premise-check: ${a.path} no longer contains "${a.value}" — the premise this brief pinned has moved; re-dig before proceeding.`);
|
|
2187
|
+
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2188
|
+
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2189
|
+
} else if (a.kind === "sha256") {
|
|
2190
|
+
const actual = createHash("sha256").update(content).digest("hex");
|
|
2191
|
+
if (actual !== a.value.toLowerCase()) {
|
|
2192
|
+
failures.push(`premise-check: ${a.path} sha256 mismatch (brief pinned ${a.value}, file is now ${actual}) — the file changed since this brief was authored; re-dig before proceeding.`);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
return { pass: failures.length === 0, failures };
|
|
2197
|
+
}
|
|
1989
2198
|
|
|
1990
2199
|
// ../../packages/aeg-core/src/test-plan-section.ts
|
|
1991
2200
|
var HEADING_FORM_RE = /^#{1,4}[ \t]*(?:\d+[a-z]?\.[ \t]*)?\*{0,2}Test Plan\*{0,2}[ \t]*$/im;
|
|
@@ -2789,6 +2998,7 @@ function checkG1(rows, existsFn) {
|
|
|
2789
2998
|
}
|
|
2790
2999
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
2791
3000
|
}
|
|
3001
|
+
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
2792
3002
|
function checkG2(rows, candidateFiles) {
|
|
2793
3003
|
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
2794
3004
|
const findings = [];
|
|
@@ -2800,6 +3010,16 @@ function checkG2(rows, candidateFiles) {
|
|
|
2800
3010
|
});
|
|
2801
3011
|
}
|
|
2802
3012
|
}
|
|
3013
|
+
for (const row of rows) {
|
|
3014
|
+
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
3015
|
+
if (carriesPlaceholder) {
|
|
3016
|
+
findings.push({
|
|
3017
|
+
row: row.action,
|
|
3018
|
+
path: row.implementation,
|
|
3019
|
+
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
2803
3023
|
return { check: "G2", status: findings.length > 0 ? "info" : "pass", findings };
|
|
2804
3024
|
}
|
|
2805
3025
|
function checkG3(ring0Rows, crossingFiles) {
|
|
@@ -3147,6 +3367,100 @@ function parseGlossaryTerms(glossaryContent) {
|
|
|
3147
3367
|
}
|
|
3148
3368
|
return terms;
|
|
3149
3369
|
}
|
|
3370
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3371
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3372
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3373
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3374
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3375
|
+
function isValidCitedFilePath(path) {
|
|
3376
|
+
if (path.length === 0)
|
|
3377
|
+
return false;
|
|
3378
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3379
|
+
return false;
|
|
3380
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3381
|
+
return false;
|
|
3382
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3383
|
+
}
|
|
3384
|
+
function quotedCommandLineAt(content, index) {
|
|
3385
|
+
let line = 1;
|
|
3386
|
+
for (let i = 0;i < index; i++) {
|
|
3387
|
+
if (content.charCodeAt(i) === 10)
|
|
3388
|
+
line++;
|
|
3389
|
+
}
|
|
3390
|
+
return line;
|
|
3391
|
+
}
|
|
3392
|
+
function extractQuotedText(raw) {
|
|
3393
|
+
const trimmed = raw.trim();
|
|
3394
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3395
|
+
if (fenced)
|
|
3396
|
+
return (fenced[1] ?? "").trim();
|
|
3397
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3398
|
+
if (inline)
|
|
3399
|
+
return (inline[1] ?? "").trim();
|
|
3400
|
+
return trimmed;
|
|
3401
|
+
}
|
|
3402
|
+
function findQuotesInFile(path, content) {
|
|
3403
|
+
const masked = maskCode(content);
|
|
3404
|
+
const quotes = [];
|
|
3405
|
+
START_PATTERN.lastIndex = 0;
|
|
3406
|
+
let start = START_PATTERN.exec(masked);
|
|
3407
|
+
while (start !== null) {
|
|
3408
|
+
const citedFile = start[1];
|
|
3409
|
+
const innerStart = start.index + start[0].length;
|
|
3410
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3411
|
+
if (end === null) {
|
|
3412
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3413
|
+
start = START_PATTERN.exec(masked);
|
|
3414
|
+
continue;
|
|
3415
|
+
}
|
|
3416
|
+
const innerEnd = innerStart + end.index;
|
|
3417
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3418
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3419
|
+
if (quotedText.length > 0) {
|
|
3420
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3424
|
+
start = START_PATTERN.exec(masked);
|
|
3425
|
+
}
|
|
3426
|
+
return quotes;
|
|
3427
|
+
}
|
|
3428
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3429
|
+
const quotes = [];
|
|
3430
|
+
for (const file of files) {
|
|
3431
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3432
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3433
|
+
continue;
|
|
3434
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3435
|
+
}
|
|
3436
|
+
return quotes;
|
|
3437
|
+
}
|
|
3438
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3439
|
+
const findings = [];
|
|
3440
|
+
for (const quote of citedQuotes) {
|
|
3441
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3442
|
+
if (content === undefined) {
|
|
3443
|
+
findings.push({
|
|
3444
|
+
file: quote.file,
|
|
3445
|
+
line: quote.line,
|
|
3446
|
+
citedFile: quote.citedFile,
|
|
3447
|
+
quotedText: quote.quotedText,
|
|
3448
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3449
|
+
});
|
|
3450
|
+
continue;
|
|
3451
|
+
}
|
|
3452
|
+
if (!content.includes(quote.quotedText)) {
|
|
3453
|
+
findings.push({
|
|
3454
|
+
file: quote.file,
|
|
3455
|
+
line: quote.line,
|
|
3456
|
+
citedFile: quote.citedFile,
|
|
3457
|
+
quotedText: quote.quotedText,
|
|
3458
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3459
|
+
});
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
return findings;
|
|
3463
|
+
}
|
|
3150
3464
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
3151
3465
|
var RETIRED_PATTERNS = [
|
|
3152
3466
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -3260,6 +3574,10 @@ function checkDispatchReadiness(input) {
|
|
|
3260
3574
|
blockers.push(`dispatch-gate rationale: Issue #${input.issue.number} for ${taskLabel} fails the rationale gate (checkIssueRationale) — the Planner must complete the eight-field rationale before this task is dispatchable.`);
|
|
3261
3575
|
}
|
|
3262
3576
|
for (const dep of input.dependsOn) {
|
|
3577
|
+
if (dep.resolved === false) {
|
|
3578
|
+
blockers.push(`dispatch-gate depends-on: ${taskLabel} depends on "${dep.id}", which is UNRESOLVABLE — the resolver could not find a matching tranche/task/Issue for this edge (not a claim about merge status). Not dispatchable until the edge is corrected.`);
|
|
3579
|
+
continue;
|
|
3580
|
+
}
|
|
3263
3581
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
3264
3582
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
3265
3583
|
blockers.push(`dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|
|
@@ -3319,6 +3637,29 @@ function isNewDiskStateFile(path, status) {
|
|
|
3319
3637
|
return false;
|
|
3320
3638
|
return ANY_DEPTH_TRANCHES_MD.test(path) || TOKENS_FILE.test(path);
|
|
3321
3639
|
}
|
|
3640
|
+
// ../../packages/aeg-core/src/main-branch-refusal.ts
|
|
3641
|
+
function checkMainBranchRefusal(facts) {
|
|
3642
|
+
const { currentSymbolicBranch, defaultBranch } = facts;
|
|
3643
|
+
if (currentSymbolicBranch === null)
|
|
3644
|
+
return null;
|
|
3645
|
+
if (defaultBranch === null) {
|
|
3646
|
+
return {
|
|
3647
|
+
reason: "default-branch-undetermined",
|
|
3648
|
+
severity: "warning",
|
|
3649
|
+
currentBranch: currentSymbolicBranch,
|
|
3650
|
+
defaultBranch: null
|
|
3651
|
+
};
|
|
3652
|
+
}
|
|
3653
|
+
if (currentSymbolicBranch === defaultBranch) {
|
|
3654
|
+
return {
|
|
3655
|
+
reason: "on-default-branch",
|
|
3656
|
+
severity: "error",
|
|
3657
|
+
currentBranch: currentSymbolicBranch,
|
|
3658
|
+
defaultBranch
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
return null;
|
|
3662
|
+
}
|
|
3322
3663
|
// ../../packages/aeg-core/src/branch-topology-gate.ts
|
|
3323
3664
|
function taskBranchTopologyFields(branch) {
|
|
3324
3665
|
if (!/^task\/.*\/.*$/.test(branch))
|
|
@@ -3574,9 +3915,9 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
3574
3915
|
}
|
|
3575
3916
|
// src/lib/config.ts
|
|
3576
3917
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3577
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3918
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
3578
3919
|
import { homedir } from "node:os";
|
|
3579
|
-
import { dirname, join } from "node:path";
|
|
3920
|
+
import { dirname, join, resolve } from "node:path";
|
|
3580
3921
|
import { z } from "zod";
|
|
3581
3922
|
|
|
3582
3923
|
// src/lib/agent-vendors.ts
|
|
@@ -3665,8 +4006,15 @@ function isSafeRepoRelPath(p) {
|
|
|
3665
4006
|
var SafeRepoRelPath = z.string().refine(isSafeRepoRelPath, {
|
|
3666
4007
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
3667
4008
|
});
|
|
4009
|
+
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
4010
|
+
function isCanonicalHookBlockPath(p) {
|
|
4011
|
+
return CANONICAL_HOOK_BLOCK_PREFIXES.some((prefix) => p.startsWith(prefix) && p.length > prefix.length);
|
|
4012
|
+
}
|
|
4013
|
+
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
4014
|
+
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
4015
|
+
});
|
|
3668
4016
|
var ManagedBlockRecordSchema = z.object({
|
|
3669
|
-
path:
|
|
4017
|
+
path: ManagedHookBlockPath,
|
|
3670
4018
|
marker: z.string(),
|
|
3671
4019
|
comment: z.enum(["hash", "html"])
|
|
3672
4020
|
});
|
|
@@ -3677,6 +4025,20 @@ var ManagedManifestSchema = z.object({
|
|
|
3677
4025
|
labels: z.array(z.string()),
|
|
3678
4026
|
agents: z.array(z.enum(AGENT_VENDORS)).optional()
|
|
3679
4027
|
});
|
|
4028
|
+
var ProjectEntrySchema = z.object({
|
|
4029
|
+
name: z.string().min(1),
|
|
4030
|
+
description: z.string().min(1).optional(),
|
|
4031
|
+
path: z.string().min(1).optional()
|
|
4032
|
+
});
|
|
4033
|
+
function parseTokensCollectDeclaration(value) {
|
|
4034
|
+
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
4035
|
+
if (!m)
|
|
4036
|
+
return null;
|
|
4037
|
+
const [, interpreter, script] = m;
|
|
4038
|
+
if (!isSafeRepoRelPath(script))
|
|
4039
|
+
return null;
|
|
4040
|
+
return { interpreter, script };
|
|
4041
|
+
}
|
|
3680
4042
|
var VinayaConfigSchema = z.object({
|
|
3681
4043
|
rings: z.object({
|
|
3682
4044
|
ring1_forgeWriteInterception: z.boolean(),
|
|
@@ -3689,13 +4051,19 @@ var VinayaConfigSchema = z.object({
|
|
|
3689
4051
|
principals: z.array(z.string()).min(1).optional(),
|
|
3690
4052
|
releaseActor: z.string().min(1).optional(),
|
|
3691
4053
|
ci: z.object({ setup: z.string().min(1) }).optional(),
|
|
4054
|
+
tokens: z.object({
|
|
4055
|
+
collect: z.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
4056
|
+
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
4057
|
+
})
|
|
4058
|
+
}).optional(),
|
|
3692
4059
|
blastRadius: z.object({ extraDomains: z.array(z.string()).optional() }).optional(),
|
|
3693
4060
|
proseGates: z.object({
|
|
3694
4061
|
doctrineRoot: z.string().min(1).optional(),
|
|
3695
4062
|
readerFacingPrefix: z.string().min(1).optional(),
|
|
3696
4063
|
readerFacingSuffix: z.string().min(1).optional(),
|
|
3697
4064
|
legacySlugDir: z.string().min(1).optional()
|
|
3698
|
-
}).optional()
|
|
4065
|
+
}).optional(),
|
|
4066
|
+
projects: z.array(ProjectEntrySchema).optional()
|
|
3699
4067
|
});
|
|
3700
4068
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
3701
4069
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -3734,6 +4102,9 @@ function globalRolesIgnoredWarning(path) {
|
|
|
3734
4102
|
function globalReleaseActorIgnoredWarning(path) {
|
|
3735
4103
|
return `${path}: "releaseActor" in the global config is ignored — releaseActor may only be declared from a repo-local vinaya.config.json.`;
|
|
3736
4104
|
}
|
|
4105
|
+
function globalTokensCollectIgnoredWarning(path) {
|
|
4106
|
+
return `${path}: "tokens" in the global config is ignored — tokens.collect may only be declared from a repo-local vinaya.config.json.`;
|
|
4107
|
+
}
|
|
3737
4108
|
function stripGlobalOnlyKeys(config, path) {
|
|
3738
4109
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
3739
4110
|
return config;
|
|
@@ -3754,6 +4125,10 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
3754
4125
|
console.error(`⚠ ${globalReleaseActorIgnoredWarning(path)}`);
|
|
3755
4126
|
result = { ...result, releaseActor: undefined };
|
|
3756
4127
|
}
|
|
4128
|
+
if (result.tokens) {
|
|
4129
|
+
console.error(`⚠ ${globalTokensCollectIgnoredWarning(path)}`);
|
|
4130
|
+
result = { ...result, tokens: undefined };
|
|
4131
|
+
}
|
|
3757
4132
|
return result;
|
|
3758
4133
|
}
|
|
3759
4134
|
function resolvePrincipalAllowlist(config) {
|
|
@@ -3839,6 +4214,7 @@ function loadConfig() {
|
|
|
3839
4214
|
return null;
|
|
3840
4215
|
}
|
|
3841
4216
|
}
|
|
4217
|
+
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
3842
4218
|
|
|
3843
4219
|
// src/checks/contract.ts
|
|
3844
4220
|
var CHECK_SCHEMA_VERSION = 1;
|
|
@@ -3847,6 +4223,81 @@ function emitCheckError(error) {
|
|
|
3847
4223
|
`);
|
|
3848
4224
|
}
|
|
3849
4225
|
|
|
4226
|
+
// src/lib/numstat.ts
|
|
4227
|
+
function summariseNumstat(numstat) {
|
|
4228
|
+
const rows = numstat.split(`
|
|
4229
|
+
`).filter((l) => l.trim() !== "");
|
|
4230
|
+
let added = 0;
|
|
4231
|
+
let deleted = 0;
|
|
4232
|
+
let binary = 0;
|
|
4233
|
+
for (const row of rows) {
|
|
4234
|
+
const [a, d] = row.split("\t");
|
|
4235
|
+
if (a === "-" || d === "-") {
|
|
4236
|
+
binary++;
|
|
4237
|
+
continue;
|
|
4238
|
+
}
|
|
4239
|
+
added += Number(a) || 0;
|
|
4240
|
+
deleted += Number(d) || 0;
|
|
4241
|
+
}
|
|
4242
|
+
const files = `${rows.length} file${rows.length === 1 ? "" : "s"} changed`;
|
|
4243
|
+
const bin = binary > 0 ? `, ${binary} binary` : "";
|
|
4244
|
+
return `${files}, ${added} insertion${added === 1 ? "" : "s"}(+), ${deleted} deletion${deleted === 1 ? "" : "s"}(-)${bin}`;
|
|
4245
|
+
}
|
|
4246
|
+
var EVIDENCE_SUMMARY_PREFIX = "Summary: ";
|
|
4247
|
+
|
|
4248
|
+
// src/checks/scan-context.ts
|
|
4249
|
+
var ZERO_WIDTH = /[\u200B-\u200D\u2060\uFEFF]/g;
|
|
4250
|
+
var HTML_ENTITIES = {
|
|
4251
|
+
""": '"',
|
|
4252
|
+
"'": "'",
|
|
4253
|
+
"<": "<",
|
|
4254
|
+
">": ">",
|
|
4255
|
+
"&": "&"
|
|
4256
|
+
};
|
|
4257
|
+
function decodeNamedEntities(body) {
|
|
4258
|
+
return body.replace(/&(?:quot|apos|lt|gt|amp);/g, (m) => HTML_ENTITIES[m] ?? m);
|
|
4259
|
+
}
|
|
4260
|
+
function normalizeBody(rawBody) {
|
|
4261
|
+
return decodeNamedEntities(rawBody.replace(ZERO_WIDTH, ""));
|
|
4262
|
+
}
|
|
4263
|
+
function buildAnchorLookupMask(body) {
|
|
4264
|
+
return maskDetailsBlocks(maskCode(body));
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4267
|
+
class ScanContext {
|
|
4268
|
+
raw;
|
|
4269
|
+
normalised;
|
|
4270
|
+
masked;
|
|
4271
|
+
constructor(raw, normalised, masked) {
|
|
4272
|
+
this.raw = raw;
|
|
4273
|
+
this.normalised = normalised;
|
|
4274
|
+
this.masked = masked;
|
|
4275
|
+
}
|
|
4276
|
+
static from(rawBody) {
|
|
4277
|
+
const normalised = normalizeBody(rawBody);
|
|
4278
|
+
return new ScanContext(rawBody, normalised, buildAnchorLookupMask(normalised));
|
|
4279
|
+
}
|
|
4280
|
+
rawResolutionAgrees(field) {
|
|
4281
|
+
const rawHasPair = anchoredRegionBounds(this.raw, field) !== null;
|
|
4282
|
+
return rawHasPair === (anchoredRegionBounds(this.masked, field) !== null);
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
function resolveAnchoredRegion(ctx, field) {
|
|
4286
|
+
const bounds = anchoredRegionBounds(ctx.masked, field);
|
|
4287
|
+
if (bounds === null) {
|
|
4288
|
+
return anchoredRegionBounds(ctx.normalised, field) !== null ? "hidden" : null;
|
|
4289
|
+
}
|
|
4290
|
+
return {
|
|
4291
|
+
region: ctx.normalised.slice(bounds.innerStart, bounds.innerEnd),
|
|
4292
|
+
maskedRegion: ctx.masked.slice(bounds.innerStart, bounds.innerEnd)
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
function summaryLineIndex(maskedRegion) {
|
|
4296
|
+
const index = maskedRegion.split(`
|
|
4297
|
+
`).findIndex((line) => line.startsWith(EVIDENCE_SUMMARY_PREFIX));
|
|
4298
|
+
return index === -1 ? null : index;
|
|
4299
|
+
}
|
|
4300
|
+
|
|
3850
4301
|
// src/checks/body-bare-digits-logic.ts
|
|
3851
4302
|
function blankRange(text, start, end) {
|
|
3852
4303
|
const region = text.slice(start, end);
|
|
@@ -4022,8 +4473,8 @@ var BOUNDED_ANCHOR_BLANK = {
|
|
|
4022
4473
|
PROJECT: blankProjectField,
|
|
4023
4474
|
EVIDENCE: blankEvidenceField
|
|
4024
4475
|
};
|
|
4025
|
-
function buildScanMask(
|
|
4026
|
-
let masked =
|
|
4476
|
+
function buildScanMask(ctx) {
|
|
4477
|
+
let masked = ctx.masked;
|
|
4027
4478
|
masked = blankAnchoredRegions(masked);
|
|
4028
4479
|
masked = blankPremiseValues(masked);
|
|
4029
4480
|
masked = blankTokenReportSection(masked);
|
|
@@ -4032,17 +4483,6 @@ function buildScanMask(body) {
|
|
|
4032
4483
|
}
|
|
4033
4484
|
var TOKEN_WITH_DIGIT = /\S*\p{Nd}\S*/gu;
|
|
4034
4485
|
var LIST_MARKER_TOKEN = /^\p{Nd}{1,9}[.)]$/u;
|
|
4035
|
-
var ZERO_WIDTH = /[\u200B-\u200D\u2060\uFEFF]/g;
|
|
4036
|
-
var HTML_ENTITIES = {
|
|
4037
|
-
""": '"',
|
|
4038
|
-
"'": "'",
|
|
4039
|
-
"<": "<",
|
|
4040
|
-
">": ">",
|
|
4041
|
-
"&": "&"
|
|
4042
|
-
};
|
|
4043
|
-
function decodeNamedEntities(body) {
|
|
4044
|
-
return body.replace(/&(?:quot|apos|lt|gt|amp);/g, (m) => HTML_ENTITIES[m] ?? m);
|
|
4045
|
-
}
|
|
4046
4486
|
function isLineLeadingListMarker(line, matchStart, rawToken) {
|
|
4047
4487
|
if (!LIST_MARKER_TOKEN.test(rawToken))
|
|
4048
4488
|
return false;
|
|
@@ -4050,8 +4490,9 @@ function isLineLeadingListMarker(line, matchStart, rawToken) {
|
|
|
4050
4490
|
return /^ {0,3}$/.test(before);
|
|
4051
4491
|
}
|
|
4052
4492
|
function checkBareDigits(rawBody) {
|
|
4053
|
-
const
|
|
4054
|
-
const
|
|
4493
|
+
const ctx = ScanContext.from(rawBody);
|
|
4494
|
+
const body = ctx.normalised;
|
|
4495
|
+
const masked = buildScanMask(ctx);
|
|
4055
4496
|
const maskedLines = masked.split(`
|
|
4056
4497
|
`);
|
|
4057
4498
|
const origLines = body.split(`
|