@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
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-dispatch-readiness.ts
|
|
4
4
|
import { execFile as execFile4, execFileSync as execFileSync4 } from "node:child_process";
|
|
5
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
6
|
+
import { sep as sep2 } from "node:path";
|
|
5
7
|
import { promisify as promisify4 } from "node:util";
|
|
6
8
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
7
9
|
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" },
|
|
10
|
+
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
11
|
+
"check-first-push-dispatch": { shippedAs: "first-push-dispatch", ring: 0 },
|
|
12
|
+
"check-no-disk-state": { shippedAs: "no-disk-state", ring: 0 },
|
|
13
|
+
"verify-brief": { shippedAs: "brief-shape", ring: 0 },
|
|
14
|
+
"verify-coherence": { shippedAs: "coherence", ring: 0 },
|
|
15
|
+
"verify-dispatch": { shippedAs: "dispatch-readiness", ring: 0 },
|
|
16
|
+
"verify-docs": { shippedAs: ["doc-coverage", "doc-coverage-push"], ring: 0 },
|
|
17
|
+
"verify-registry": { shippedAs: "registry-gates", ring: 0 },
|
|
18
|
+
"verify-review-gate": { shippedAs: "review-gate", ring: 1 },
|
|
19
|
+
"verify-single-plan-pr": { shippedAs: "single-plan-pr", ring: 0 },
|
|
20
|
+
"verify-test-plan": { shippedAs: "test-plan", ring: 1 },
|
|
19
21
|
"check-direct-main-push": {
|
|
20
22
|
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
23
|
},
|
|
@@ -190,6 +192,12 @@ var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
|
190
192
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
191
193
|
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
|
|
192
194
|
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
|
|
195
|
+
function splitSlugQualifiedEdge(edge) {
|
|
196
|
+
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
197
|
+
if (!m)
|
|
198
|
+
return null;
|
|
199
|
+
return { slug: m[1], bareId: m[2] };
|
|
200
|
+
}
|
|
193
201
|
function isEmptyMarker(s) {
|
|
194
202
|
const t = s.trim();
|
|
195
203
|
return t === "" || t === "—" || t === "-" || t === "–";
|
|
@@ -327,6 +335,13 @@ var LABELS = [
|
|
|
327
335
|
form: "literal",
|
|
328
336
|
carries: "Execution is halted pending an external unblock; wins over every other derived status."
|
|
329
337
|
},
|
|
338
|
+
{
|
|
339
|
+
key: "backlog",
|
|
340
|
+
id: "vinaya/backlog",
|
|
341
|
+
category: "state",
|
|
342
|
+
form: "literal",
|
|
343
|
+
carries: "The Issue is deliberately unplanned — belongs to no tranche and is excluded from dispatch, until a Planner promotes it."
|
|
344
|
+
},
|
|
330
345
|
{
|
|
331
346
|
key: "tier-0",
|
|
332
347
|
id: "vinaya/tier:0",
|
|
@@ -1779,6 +1794,151 @@ var DERIVED_STATUSES = [
|
|
|
1779
1794
|
"incoherent"
|
|
1780
1795
|
];
|
|
1781
1796
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1797
|
+
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1798
|
+
var DASH_LOOKALIKES = {
|
|
1799
|
+
"-": "‑",
|
|
1800
|
+
"–": "‒",
|
|
1801
|
+
"—": "―"
|
|
1802
|
+
};
|
|
1803
|
+
var DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES));
|
|
1804
|
+
// ../../packages/aeg-core/src/claude-code-transcript.ts
|
|
1805
|
+
function summarizeTranscript(jsonl) {
|
|
1806
|
+
const seen = new Set;
|
|
1807
|
+
const components = {
|
|
1808
|
+
inputTokens: 0,
|
|
1809
|
+
outputTokens: 0,
|
|
1810
|
+
cacheCreationInputTokens: 0,
|
|
1811
|
+
cacheReadInputTokens: 0
|
|
1812
|
+
};
|
|
1813
|
+
let model = null;
|
|
1814
|
+
let messageCount = 0;
|
|
1815
|
+
for (const rawLine of jsonl.split(/\r?\n/)) {
|
|
1816
|
+
const line = rawLine.trim();
|
|
1817
|
+
if (!line)
|
|
1818
|
+
continue;
|
|
1819
|
+
let entry2;
|
|
1820
|
+
try {
|
|
1821
|
+
entry2 = JSON.parse(line);
|
|
1822
|
+
} catch {
|
|
1823
|
+
continue;
|
|
1824
|
+
}
|
|
1825
|
+
if (!entry2 || typeof entry2 !== "object")
|
|
1826
|
+
continue;
|
|
1827
|
+
const obj = entry2;
|
|
1828
|
+
if (obj.type !== "assistant")
|
|
1829
|
+
continue;
|
|
1830
|
+
const message = obj.message;
|
|
1831
|
+
const id = message?.id;
|
|
1832
|
+
const usage = message?.usage;
|
|
1833
|
+
if (typeof id !== "string" || !id || !usage || seen.has(id))
|
|
1834
|
+
continue;
|
|
1835
|
+
seen.add(id);
|
|
1836
|
+
messageCount++;
|
|
1837
|
+
components.inputTokens += numberOr(usage.input_tokens, 0);
|
|
1838
|
+
components.outputTokens += numberOr(usage.output_tokens, 0);
|
|
1839
|
+
components.cacheCreationInputTokens += numberOr(usage.cache_creation_input_tokens, 0);
|
|
1840
|
+
components.cacheReadInputTokens += numberOr(usage.cache_read_input_tokens, 0);
|
|
1841
|
+
const messageModel = message?.model;
|
|
1842
|
+
if (typeof messageModel === "string" && messageModel)
|
|
1843
|
+
model = messageModel;
|
|
1844
|
+
}
|
|
1845
|
+
return { components, model, messageCount };
|
|
1846
|
+
}
|
|
1847
|
+
function numberOr(value, fallback) {
|
|
1848
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1849
|
+
}
|
|
1850
|
+
function sanitizeKey(value) {
|
|
1851
|
+
return value.replace(/[^A-Za-z0-9]+/g, "-");
|
|
1852
|
+
}
|
|
1853
|
+
function transcriptPointerPath(projectDir, tmpDir) {
|
|
1854
|
+
return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`;
|
|
1855
|
+
}
|
|
1856
|
+
function resolvePointer(explicitTranscriptPath, deps) {
|
|
1857
|
+
if (explicitTranscriptPath)
|
|
1858
|
+
return { path: explicitTranscriptPath, corroborated: true };
|
|
1859
|
+
const projectDir = deps.env.CLAUDE_PROJECT_DIR ?? deps.cwd;
|
|
1860
|
+
const tmpDir = deps.env.TMPDIR ?? "/tmp";
|
|
1861
|
+
const pointerPath = transcriptPointerPath(projectDir, tmpDir);
|
|
1862
|
+
const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID;
|
|
1863
|
+
if (!deps.exists(pointerPath)) {
|
|
1864
|
+
return {
|
|
1865
|
+
pointerExisted: false,
|
|
1866
|
+
corroborated: false,
|
|
1867
|
+
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."
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
let contents;
|
|
1871
|
+
try {
|
|
1872
|
+
contents = deps.readFile(pointerPath).replace(/\r?\n+$/, "");
|
|
1873
|
+
} catch (err) {
|
|
1874
|
+
return {
|
|
1875
|
+
pointerExisted: true,
|
|
1876
|
+
oursByLocation: true,
|
|
1877
|
+
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."
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
const [pointerSessionId, transcriptPath] = contents.split("\t");
|
|
1881
|
+
if (!transcriptPath) {
|
|
1882
|
+
return {
|
|
1883
|
+
pointerExisted: true,
|
|
1884
|
+
oursByLocation: true,
|
|
1885
|
+
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."
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
if (currentSessionId && pointerSessionId && currentSessionId !== pointerSessionId) {
|
|
1889
|
+
return {
|
|
1890
|
+
pointerExisted: true,
|
|
1891
|
+
corroborated: false,
|
|
1892
|
+
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."
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
return { path: transcriptPath, corroborated: Boolean(currentSessionId && pointerSessionId) };
|
|
1896
|
+
}
|
|
1897
|
+
function resolveMeteringCapability(deps, explicitTranscriptPath) {
|
|
1898
|
+
const resolved = resolvePointer(explicitTranscriptPath, deps);
|
|
1899
|
+
if ("error" in resolved) {
|
|
1900
|
+
const ours = resolved.pointerExisted && (resolved.corroborated || resolved.oursByLocation);
|
|
1901
|
+
if (ours)
|
|
1902
|
+
return { capable: false, reason: "pointer-unusable", detail: resolved.error };
|
|
1903
|
+
return {
|
|
1904
|
+
capable: false,
|
|
1905
|
+
reason: "no-transcript-resolved",
|
|
1906
|
+
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
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
const downstream = (r, detail) => resolved.corroborated ? { reason: r, detail } : {
|
|
1910
|
+
reason: "no-transcript-resolved",
|
|
1911
|
+
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})`
|
|
1912
|
+
};
|
|
1913
|
+
if (!deps.exists(resolved.path)) {
|
|
1914
|
+
return {
|
|
1915
|
+
capable: false,
|
|
1916
|
+
...downstream("transcript-unreadable", `Resolved transcript path ${resolved.path} is not readable as a regular file owned by this user.`)
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
let jsonl;
|
|
1920
|
+
try {
|
|
1921
|
+
jsonl = deps.readFile(resolved.path);
|
|
1922
|
+
} catch (err) {
|
|
1923
|
+
return {
|
|
1924
|
+
capable: false,
|
|
1925
|
+
...downstream("transcript-unreadable", `Transcript at ${resolved.path} could not be read: ${err.message}`)
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
const summary = summarizeTranscript(jsonl);
|
|
1929
|
+
if (summary.messageCount === 0) {
|
|
1930
|
+
return {
|
|
1931
|
+
capable: false,
|
|
1932
|
+
...downstream("transcript-empty", `Transcript at ${resolved.path} yielded zero assistant messages with usage data — ` + "it's empty, unparseable, or not yet flushed to disk.")
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
return { capable: true, transcriptPath: resolved.path, summary };
|
|
1936
|
+
}
|
|
1937
|
+
function isTokenCollectionWiringBroken(capability) {
|
|
1938
|
+
if (capability.capable)
|
|
1939
|
+
return false;
|
|
1940
|
+
return capability.reason !== "no-transcript-resolved";
|
|
1941
|
+
}
|
|
1782
1942
|
// ../../packages/aeg-core/src/file-classify.ts
|
|
1783
1943
|
function isCodeFile(p) {
|
|
1784
1944
|
if (p.endsWith(".md"))
|
|
@@ -1985,7 +2145,59 @@ function overrideActive(opts) {
|
|
|
1985
2145
|
return false;
|
|
1986
2146
|
}
|
|
1987
2147
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
2148
|
+
import { createHash } from "node:crypto";
|
|
1988
2149
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
2150
|
+
function isPremiseHeader(line) {
|
|
2151
|
+
const stripped = line.replace(/[*#]/g, "").trim();
|
|
2152
|
+
return /^premise\s*:?$/i.test(stripped);
|
|
2153
|
+
}
|
|
2154
|
+
var PREMISE_LINE = /^[-*]\s*(\S+)\s+(contains|absent|sha256)\s*:\s*(.+)$/i;
|
|
2155
|
+
function parsePremiseBlock(prBody) {
|
|
2156
|
+
const searchIn = anchoredRegion(prBody, "PREMISE") ?? prBody;
|
|
2157
|
+
const lines = searchIn.split(/\r?\n/);
|
|
2158
|
+
const assertions = [];
|
|
2159
|
+
let inBlock = false;
|
|
2160
|
+
for (const raw of lines) {
|
|
2161
|
+
const line = raw.trim();
|
|
2162
|
+
if (!inBlock) {
|
|
2163
|
+
if (isPremiseHeader(line))
|
|
2164
|
+
inBlock = true;
|
|
2165
|
+
continue;
|
|
2166
|
+
}
|
|
2167
|
+
if (line === "")
|
|
2168
|
+
break;
|
|
2169
|
+
const m = line.match(PREMISE_LINE);
|
|
2170
|
+
if (!m)
|
|
2171
|
+
break;
|
|
2172
|
+
const [, path, kindRaw, value] = m;
|
|
2173
|
+
const kind = kindRaw.toLowerCase();
|
|
2174
|
+
if (!ASSERTION_KINDS.has(kind))
|
|
2175
|
+
continue;
|
|
2176
|
+
assertions.push({ kind, path, value: value.trim() });
|
|
2177
|
+
}
|
|
2178
|
+
return assertions;
|
|
2179
|
+
}
|
|
2180
|
+
function checkPremises(assertions, fileReader) {
|
|
2181
|
+
const failures = [];
|
|
2182
|
+
for (const a of assertions) {
|
|
2183
|
+
const content = fileReader(a.path);
|
|
2184
|
+
if (content === null) {
|
|
2185
|
+
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.`);
|
|
2186
|
+
continue;
|
|
2187
|
+
}
|
|
2188
|
+
if (a.kind === "contains" && !content.includes(a.value)) {
|
|
2189
|
+
failures.push(`premise-check: ${a.path} no longer contains "${a.value}" — the premise this brief pinned has moved; re-dig before proceeding.`);
|
|
2190
|
+
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2191
|
+
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2192
|
+
} else if (a.kind === "sha256") {
|
|
2193
|
+
const actual = createHash("sha256").update(content).digest("hex");
|
|
2194
|
+
if (actual !== a.value.toLowerCase()) {
|
|
2195
|
+
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.`);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
return { pass: failures.length === 0, failures };
|
|
2200
|
+
}
|
|
1989
2201
|
|
|
1990
2202
|
// ../../packages/aeg-core/src/test-plan-section.ts
|
|
1991
2203
|
var HEADING_FORM_RE = /^#{1,4}[ \t]*(?:\d+[a-z]?\.[ \t]*)?\*{0,2}Test Plan\*{0,2}[ \t]*$/im;
|
|
@@ -2789,6 +3001,7 @@ function checkG1(rows, existsFn) {
|
|
|
2789
3001
|
}
|
|
2790
3002
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
2791
3003
|
}
|
|
3004
|
+
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
2792
3005
|
function checkG2(rows, candidateFiles) {
|
|
2793
3006
|
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
2794
3007
|
const findings = [];
|
|
@@ -2800,6 +3013,16 @@ function checkG2(rows, candidateFiles) {
|
|
|
2800
3013
|
});
|
|
2801
3014
|
}
|
|
2802
3015
|
}
|
|
3016
|
+
for (const row of rows) {
|
|
3017
|
+
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
3018
|
+
if (carriesPlaceholder) {
|
|
3019
|
+
findings.push({
|
|
3020
|
+
row: row.action,
|
|
3021
|
+
path: row.implementation,
|
|
3022
|
+
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
2803
3026
|
return { check: "G2", status: findings.length > 0 ? "info" : "pass", findings };
|
|
2804
3027
|
}
|
|
2805
3028
|
function checkG3(ring0Rows, crossingFiles) {
|
|
@@ -3147,6 +3370,100 @@ function parseGlossaryTerms(glossaryContent) {
|
|
|
3147
3370
|
}
|
|
3148
3371
|
return terms;
|
|
3149
3372
|
}
|
|
3373
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3374
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3375
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3376
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3377
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3378
|
+
function isValidCitedFilePath(path) {
|
|
3379
|
+
if (path.length === 0)
|
|
3380
|
+
return false;
|
|
3381
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3382
|
+
return false;
|
|
3383
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3384
|
+
return false;
|
|
3385
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3386
|
+
}
|
|
3387
|
+
function quotedCommandLineAt(content, index) {
|
|
3388
|
+
let line = 1;
|
|
3389
|
+
for (let i = 0;i < index; i++) {
|
|
3390
|
+
if (content.charCodeAt(i) === 10)
|
|
3391
|
+
line++;
|
|
3392
|
+
}
|
|
3393
|
+
return line;
|
|
3394
|
+
}
|
|
3395
|
+
function extractQuotedText(raw) {
|
|
3396
|
+
const trimmed = raw.trim();
|
|
3397
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3398
|
+
if (fenced)
|
|
3399
|
+
return (fenced[1] ?? "").trim();
|
|
3400
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3401
|
+
if (inline)
|
|
3402
|
+
return (inline[1] ?? "").trim();
|
|
3403
|
+
return trimmed;
|
|
3404
|
+
}
|
|
3405
|
+
function findQuotesInFile(path, content) {
|
|
3406
|
+
const masked = maskCode(content);
|
|
3407
|
+
const quotes = [];
|
|
3408
|
+
START_PATTERN.lastIndex = 0;
|
|
3409
|
+
let start = START_PATTERN.exec(masked);
|
|
3410
|
+
while (start !== null) {
|
|
3411
|
+
const citedFile = start[1];
|
|
3412
|
+
const innerStart = start.index + start[0].length;
|
|
3413
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3414
|
+
if (end === null) {
|
|
3415
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3416
|
+
start = START_PATTERN.exec(masked);
|
|
3417
|
+
continue;
|
|
3418
|
+
}
|
|
3419
|
+
const innerEnd = innerStart + end.index;
|
|
3420
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3421
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3422
|
+
if (quotedText.length > 0) {
|
|
3423
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3427
|
+
start = START_PATTERN.exec(masked);
|
|
3428
|
+
}
|
|
3429
|
+
return quotes;
|
|
3430
|
+
}
|
|
3431
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3432
|
+
const quotes = [];
|
|
3433
|
+
for (const file of files) {
|
|
3434
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3435
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3436
|
+
continue;
|
|
3437
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3438
|
+
}
|
|
3439
|
+
return quotes;
|
|
3440
|
+
}
|
|
3441
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3442
|
+
const findings = [];
|
|
3443
|
+
for (const quote of citedQuotes) {
|
|
3444
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3445
|
+
if (content === undefined) {
|
|
3446
|
+
findings.push({
|
|
3447
|
+
file: quote.file,
|
|
3448
|
+
line: quote.line,
|
|
3449
|
+
citedFile: quote.citedFile,
|
|
3450
|
+
quotedText: quote.quotedText,
|
|
3451
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3452
|
+
});
|
|
3453
|
+
continue;
|
|
3454
|
+
}
|
|
3455
|
+
if (!content.includes(quote.quotedText)) {
|
|
3456
|
+
findings.push({
|
|
3457
|
+
file: quote.file,
|
|
3458
|
+
line: quote.line,
|
|
3459
|
+
citedFile: quote.citedFile,
|
|
3460
|
+
quotedText: quote.quotedText,
|
|
3461
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3462
|
+
});
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
return findings;
|
|
3466
|
+
}
|
|
3150
3467
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
3151
3468
|
var RETIRED_PATTERNS = [
|
|
3152
3469
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -3260,6 +3577,10 @@ function checkDispatchReadiness(input) {
|
|
|
3260
3577
|
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
3578
|
}
|
|
3262
3579
|
for (const dep of input.dependsOn) {
|
|
3580
|
+
if (dep.resolved === false) {
|
|
3581
|
+
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.`);
|
|
3582
|
+
continue;
|
|
3583
|
+
}
|
|
3263
3584
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
3264
3585
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
3265
3586
|
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 +3640,29 @@ function isNewDiskStateFile(path, status) {
|
|
|
3319
3640
|
return false;
|
|
3320
3641
|
return ANY_DEPTH_TRANCHES_MD.test(path) || TOKENS_FILE.test(path);
|
|
3321
3642
|
}
|
|
3643
|
+
// ../../packages/aeg-core/src/main-branch-refusal.ts
|
|
3644
|
+
function checkMainBranchRefusal(facts) {
|
|
3645
|
+
const { currentSymbolicBranch, defaultBranch } = facts;
|
|
3646
|
+
if (currentSymbolicBranch === null)
|
|
3647
|
+
return null;
|
|
3648
|
+
if (defaultBranch === null) {
|
|
3649
|
+
return {
|
|
3650
|
+
reason: "default-branch-undetermined",
|
|
3651
|
+
severity: "warning",
|
|
3652
|
+
currentBranch: currentSymbolicBranch,
|
|
3653
|
+
defaultBranch: null
|
|
3654
|
+
};
|
|
3655
|
+
}
|
|
3656
|
+
if (currentSymbolicBranch === defaultBranch) {
|
|
3657
|
+
return {
|
|
3658
|
+
reason: "on-default-branch",
|
|
3659
|
+
severity: "error",
|
|
3660
|
+
currentBranch: currentSymbolicBranch,
|
|
3661
|
+
defaultBranch
|
|
3662
|
+
};
|
|
3663
|
+
}
|
|
3664
|
+
return null;
|
|
3665
|
+
}
|
|
3322
3666
|
// ../../packages/aeg-core/src/branch-topology-gate.ts
|
|
3323
3667
|
function taskBranchTopologyFields(branch) {
|
|
3324
3668
|
if (!/^task\/.*\/.*$/.test(branch))
|
|
@@ -3572,6 +3916,445 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
3572
3916
|
}
|
|
3573
3917
|
return findings;
|
|
3574
3918
|
}
|
|
3919
|
+
// ../../packages/sources/src/commands.ts
|
|
3920
|
+
var COMMANDS = [
|
|
3921
|
+
{
|
|
3922
|
+
name: "help",
|
|
3923
|
+
description: "Show this help text",
|
|
3924
|
+
status: "shipped"
|
|
3925
|
+
},
|
|
3926
|
+
{
|
|
3927
|
+
name: "version",
|
|
3928
|
+
description: "Print the CLI version",
|
|
3929
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
3930
|
+
status: "shipped"
|
|
3931
|
+
},
|
|
3932
|
+
{
|
|
3933
|
+
name: "init",
|
|
3934
|
+
description: "Install Vinaya's git hooks, CI workflow, and starter config (diff-and-confirm, non-destructive)",
|
|
3935
|
+
flags: [
|
|
3936
|
+
{ flag: "--dry-run", description: "Print the full diff without installing anything" },
|
|
3937
|
+
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
3938
|
+
],
|
|
3939
|
+
details: [
|
|
3940
|
+
"It detects your repo, prints the complete diff of every intended change, and waits for your confirmation before installing anything. `--dry-run` prints that same diff and installs nothing. Nothing ever runs automatically on package install.",
|
|
3941
|
+
"It installs one CI workflow that runs `vinaya check --all --diff-only`, alongside your existing workflows — refusing to overwrite rather than touching foreign content already at that path. Git hook stubs invoke the `vinaya` binary directly; if a hook already exists, it appends a delimited managed block, shown verbatim in the diff first, rather than overwriting it.",
|
|
3942
|
+
"`vinaya.config.json` is seeded with a starter ruleset extracted from Vinaya's own battle-tested gates, not invented defaults. Issue and PR templates carrying the brief schema are added alongside your own; tier and `needs:*-input` labels are created only if they don't already exist — your existing labels are never modified.",
|
|
3943
|
+
"Two empty folders — `vinaya/checks/` and `vinaya/roles/` — are scaffolded alongside the config, each held open by a placeholder file (git does not track empty directories). `vinaya new noop-check` and `vinaya new role` write their real output into these folders later; both placeholders are recorded in the ownership manifest, so `eject` removes them exactly like everything else `init` created.",
|
|
3944
|
+
"The generated workflows reach the `vinaya` binary through `npx @attalabs/vinaya`, with no build step — unless your repo vendors the CLI itself (a workspace member declaring the name `@attalabs/vinaya`), in which case `npx` would resolve to that unbuilt local member instead of the registry. `init` detects that at generation time and writes workflows that build and run your own copy by path instead, so your CI exercises the code in the pull request. `upgrade` and `doctor` make the same determination, so regenerating is stable.",
|
|
3945
|
+
"The recommended branch-protection command is printed for you to run yourself — it is never applied, and your PATH is never touched. `eject` removes exactly the managed block it owns, or a whole file only if `init` created it."
|
|
3946
|
+
],
|
|
3947
|
+
status: "shipped"
|
|
3948
|
+
},
|
|
3949
|
+
{
|
|
3950
|
+
name: "init product",
|
|
3951
|
+
description: "Register a project in .vinaya/projects.md in an already-initialized repo",
|
|
3952
|
+
flags: [
|
|
3953
|
+
{
|
|
3954
|
+
flag: "--path <path>",
|
|
3955
|
+
description: "The project's home folder — declared, not derived. Defaults to the repo root."
|
|
3956
|
+
}
|
|
3957
|
+
],
|
|
3958
|
+
details: [
|
|
3959
|
+
"Writes (or appends to) `.vinaya/projects.md` — the registry Vinaya Studio's tranche board resolves a project's board link against. Idempotent: re-running with the same name updates nothing.",
|
|
3960
|
+
"Reaches no forge and needs no GitHub remote or credentials: the registry row is a pure local file write, and it is deliberately NOT recorded in the ownership manifest, so `eject` does not reverse adopter-declared data.",
|
|
3961
|
+
"Creates no label. Project is a field, not a label: a task Issue declares its project in the body's `**Project:**` field, and a `project:*` label is ignored wherever one still exists."
|
|
3962
|
+
],
|
|
3963
|
+
status: "shipped"
|
|
3964
|
+
},
|
|
3965
|
+
{
|
|
3966
|
+
name: "check",
|
|
3967
|
+
description: "Run one check, or every registered check",
|
|
3968
|
+
flags: [
|
|
3969
|
+
{ flag: "--all", description: "Run every registered check instead of one named check" },
|
|
3970
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" },
|
|
3971
|
+
{ flag: "--diff-only", description: "Scope diff-declared checks to changed files" },
|
|
3972
|
+
{
|
|
3973
|
+
flag: "--local",
|
|
3974
|
+
description: "Skip every requiresOpenPr check (closes-n, test-plan) — set by the generated hooks, never by CI"
|
|
3975
|
+
},
|
|
3976
|
+
{ flag: "--parallel[=n]", description: "Concurrency cap (default: cpu-derived)" },
|
|
3977
|
+
{
|
|
3978
|
+
flag: "--plan",
|
|
3979
|
+
description: "Print the resolved check registry and the resolved `roles` registry (default/overridden/additive) without running anything"
|
|
3980
|
+
}
|
|
3981
|
+
],
|
|
3982
|
+
details: [
|
|
3983
|
+
"Each spawned check's child process sees only a fixed baseline (`PATH`, `LANG`, `HOME`, `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY`, `TMPDIR`) plus whatever its `CheckSpec['env']` declaration explicitly forwards — never the full parent environment. A required (`true`) or unsatisfied `anyOf` declaration missing from the caller's environment synthesizes a `CheckError` before the check ever spawns. Declare `env` (a core check's own registration, or `vinaya.config.json`'s `checks.<name>.env` for a custom one) for any check that reads `process.env`/`Bun.env`/`Deno.env` directly — `vinaya doctor` carries the permanent diagnostic for one that doesn't.",
|
|
3984
|
+
"The resolved registry IS what runs. A `checks` key that exactly matches a core check id REPLACES that core check (the core one does not run); any other key must be namespaced `<yourname>/<id>`. Anything the resolver cannot classify — a malformed entry, a bare un-namespaced key matching no core id, a duplicate id — makes `vinaya check` refuse the ENTIRE run: exit 1, nothing executes, never a partial ruleset and never a core-only fallback. `vinaya doctor` carries the permanent diagnostic for each rejected entry, so a refused config is still diagnosable.",
|
|
3985
|
+
"`--plan` composes with `--json`. It requires zero env vars and never prints an env value — only how each one resolves (passthrough, optional, literal, or anyOf). A `FAIL_CLOSED` entry always renders inline rather than being dropped, and exits non-zero. `--plan` and execution read the same resolution, so what the plan prints is what runs.",
|
|
3986
|
+
"`--local` exists because a `requiresOpenPr` check (the core `closes-n`/`test-plan`, or a custom check declaring the same field) can only evaluate for real once a pull request exists — the generated `pre-commit`/`pre-push` hooks pass it so the first commit on a fresh task branch is never asked to satisfy a PR-body field before a PR can possibly exist. CI's `vinaya-checks.yml` omits it, so these checks always run for real once a PR is open.",
|
|
3987
|
+
"`--plan`'s `roles` half resolves `vinaya.config.json`'s `roles` block against bundled doctrine — same override/additive shape as `checks`, with its own RENDERS AS column (the registry key and the role's own `role_id` differ for an additive entry) and a GATING column (`core` vs. `inert` — an additive role carries no core `ACTIONS` wiring). `roles.available` is `false` only when no bundled doctrine can be found next to this CLI install."
|
|
3988
|
+
],
|
|
3989
|
+
status: "shipped"
|
|
3990
|
+
},
|
|
3991
|
+
{
|
|
3992
|
+
name: "commit-msg",
|
|
3993
|
+
description: "The generated `commit-msg` hook's invocation target — validates a commit message's first line",
|
|
3994
|
+
details: [
|
|
3995
|
+
"Not meant to be run by hand day-to-day: the managed `commit-msg` hook calls `vinaya commit-msg <message-file> [source]` with the two arguments git itself passes a commit-msg hook (githooks(5)) — the message file path and, when known, the commit's source keyword.",
|
|
3996
|
+
"Validates the message file's first line against the same `Type(scope): Description` vocabulary `check`'s `forge-title`-shaped gates enforce on PR/Issue titles (`@attalabs/aeg-core`'s `COMMIT_TYPES` — the commitlint type set plus `Plan`). Exits 0 with no output on a conforming message; a `source` of `merge` is skipped outright, since a merge commit's message is written by git, not the person committing."
|
|
3997
|
+
],
|
|
3998
|
+
status: "shipped"
|
|
3999
|
+
},
|
|
4000
|
+
{
|
|
4001
|
+
name: "new check",
|
|
4002
|
+
description: "Scaffold a custom check into ./scripts/vinaya-checks/",
|
|
4003
|
+
details: [
|
|
4004
|
+
"Takes the REGISTRATION KEY, not a bare name: `vinaya new check <yourname>/<id>` writes `./scripts/vinaya-checks/<id>.ts` and prints the namespaced `checks` entry to paste. It refuses a bare, un-namespaced name — `vinaya check` refuses its entire run over a key it cannot resolve, so scaffolding one would brick every check invocation in the repo — and refuses a core check id, since registering one REPLACES that core gate and a scaffolded stub is never what an adopter means by that."
|
|
4005
|
+
],
|
|
4006
|
+
status: "shipped"
|
|
4007
|
+
},
|
|
4008
|
+
{
|
|
4009
|
+
name: "new noop-check",
|
|
4010
|
+
description: "Scaffold an explicit no-op into vinaya/checks/ that silences a core check",
|
|
4011
|
+
details: [
|
|
4012
|
+
"Takes a CORE check id — the opposite of what `new check` accepts, which refuses one. `vinaya new noop-check <core-check-id>` writes `vinaya/checks/<id>.ts`, an explicit, contract-satisfying no-op (always exits `0`, emits no findings, carries a comment marking the silencing as intentional) and prints the `checks` entry that REPLACES the named core check with it. This is the only sanctioned way to silence a core check."
|
|
4013
|
+
],
|
|
4014
|
+
status: "shipped"
|
|
4015
|
+
},
|
|
4016
|
+
{
|
|
4017
|
+
name: "new role",
|
|
4018
|
+
description: "Scaffold an additive role contract into vinaya/roles/",
|
|
4019
|
+
details: [
|
|
4020
|
+
'Takes the REGISTRATION KEY: `vinaya new role <yourname>/<id>` writes `vinaya/roles/<id>.md` — a structurally-valid role contract stub (the six frontmatter keys plus `title`/`order`, and a non-empty "## The short version" section) whose own `role_id` is set to `<id>` — and prints the `roles` entry to paste. It refuses a bare, un-namespaced key: that shape resolves as an OVERRIDE of a core role, a complete replacement of that role\'s contract and a real governance decision this scaffolder does not make for you.'
|
|
4021
|
+
],
|
|
4022
|
+
status: "shipped"
|
|
4023
|
+
},
|
|
4024
|
+
{
|
|
4025
|
+
name: "pr create",
|
|
4026
|
+
description: "Open a pull request after full brief-schema validation",
|
|
4027
|
+
flags: [
|
|
4028
|
+
{ flag: "--title", description: "PR title (validated against the forge-title grammar)" },
|
|
4029
|
+
{ flag: "--body-file", description: "Path to the PR body (stream-safe; the same bytes are validated and sent)" },
|
|
4030
|
+
{ flag: "--label", description: "Label(s) to apply (repeatable, comma-separated)" },
|
|
4031
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the PR" },
|
|
4032
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4033
|
+
],
|
|
4034
|
+
details: [
|
|
4035
|
+
"Runs the config-defined brief-schema gate (`briefSchema.pr` in `vinaya.config.json`) LOCALLY before any `gh` write — prevention, not detection. On any failure it refuses with the versioned CheckError contract (one JSON line per finding on stderr, exit 1) whose `agent_recovery_prompt` names the exact corrective command.",
|
|
4036
|
+
"Which sections bind depends on the branch, matching the `brief-shape` check that runs the same grammar in CI. On a `task/<tranche>/<n>` branch every configured section binds, `closesN` included. On any other branch a body that is not brief-shaped is exempt entirely — an ordinary one-line dependency bump is not made to grow a brief — while a brief-shaped body is still graded on every other section, since a standalone fix brief is a brief; only `closesN` is dropped, because such a branch has no task Issue to close. The title grammar sits outside all of this and binds on every branch.",
|
|
4037
|
+
"A branch counts as resolvable only when HEAD is a symbolic ref that also resolves to a commit. Neither git query answers that alone: `rev-parse --abbrev-ref HEAD` reports the literal string `HEAD` on a detached HEAD, and `symbolic-ref` reports the not-yet-created branch name when HEAD is unborn. Reading either as an ordinary branch would take the relaxed path, so both states — plus running outside a repo — resolve to nothing and the gate is fail-closed: every configured section is enforced."
|
|
4038
|
+
],
|
|
4039
|
+
status: "shipped"
|
|
4040
|
+
},
|
|
4041
|
+
{
|
|
4042
|
+
name: "pr edit",
|
|
4043
|
+
description: "Edit an existing pull request (<n>) after full brief-schema validation",
|
|
4044
|
+
flags: [
|
|
4045
|
+
{ flag: "--title", description: "New PR title (validated against the forge-title grammar)" },
|
|
4046
|
+
{ flag: "--body-file", description: "Path to the new PR body (stream-safe; same bytes validated and sent)" },
|
|
4047
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the PR" },
|
|
4048
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4049
|
+
],
|
|
4050
|
+
details: [
|
|
4051
|
+
"The target PR's real head branch and changed files are fetched from the forge to build the validation context — a failed fetch is a hard refusal, never a fall-back to the local checkout.",
|
|
4052
|
+
"That fetched head branch is what selects the section set, by the same branch grammar `pr create` uses — a property of the target PR, never of whatever the local checkout happens to have checked out."
|
|
4053
|
+
],
|
|
4054
|
+
status: "shipped"
|
|
4055
|
+
},
|
|
4056
|
+
{
|
|
4057
|
+
name: "pr report",
|
|
4058
|
+
description: "Emit the AEG:EVIDENCE block — a PR body's factual claims, from commands, never typed",
|
|
4059
|
+
flags: [
|
|
4060
|
+
{
|
|
4061
|
+
flag: "--write",
|
|
4062
|
+
description: "Path to the PR body file; replaces the content between the AEG:EVIDENCE anchors in place"
|
|
4063
|
+
}
|
|
4064
|
+
],
|
|
4065
|
+
details: [
|
|
4066
|
+
"Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
|
|
4067
|
+
"With no `--write`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` from carrying a failing suite onto the forge."
|
|
4068
|
+
],
|
|
4069
|
+
status: "shipped"
|
|
4070
|
+
},
|
|
4071
|
+
{
|
|
4072
|
+
name: "pr verify-evidence",
|
|
4073
|
+
description: "Prove a pull request's AEG:EVIDENCE region was machine-generated — regenerate it and compare",
|
|
4074
|
+
flags: [],
|
|
4075
|
+
details: [
|
|
4076
|
+
"Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
|
|
4077
|
+
"Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
|
|
4078
|
+
"Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
|
|
4079
|
+
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read, since AEG:TOKENS appends by design. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
|
|
4080
|
+
],
|
|
4081
|
+
status: "shipped"
|
|
4082
|
+
},
|
|
4083
|
+
{
|
|
4084
|
+
name: "issue create",
|
|
4085
|
+
description: "Open an issue after full brief-schema validation",
|
|
4086
|
+
flags: [
|
|
4087
|
+
{ flag: "--title", description: "Issue title (validated on task Issues)" },
|
|
4088
|
+
{ flag: "--body-file", description: "Path to the Issue body (stream-safe; same bytes validated and sent)" },
|
|
4089
|
+
{ flag: "--label", description: "Label(s) to apply; a `vinaya/tranche:*` label marks a task Issue" },
|
|
4090
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the Issue" },
|
|
4091
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4092
|
+
],
|
|
4093
|
+
details: [
|
|
4094
|
+
"A task Issue (any `vinaya/tranche:*` label) must carry the full Planner rationale (`briefSchema.issue`); non-task Issues pass through unvalidated."
|
|
4095
|
+
],
|
|
4096
|
+
status: "shipped"
|
|
4097
|
+
},
|
|
4098
|
+
{
|
|
4099
|
+
name: "issue edit",
|
|
4100
|
+
description: "Edit an existing issue (<n>) after full brief-schema validation",
|
|
4101
|
+
flags: [
|
|
4102
|
+
{ flag: "--title", description: "New Issue title (validated on task Issues)" },
|
|
4103
|
+
{ flag: "--body-file", description: "Path to the new Issue body (stream-safe; same bytes validated and sent)" },
|
|
4104
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the Issue" },
|
|
4105
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4106
|
+
],
|
|
4107
|
+
details: [
|
|
4108
|
+
"The target Issue's actual labels are fetched from the forge and unioned with argv to decide task-Issue applicability — a failed fetch is a hard refusal."
|
|
4109
|
+
],
|
|
4110
|
+
status: "shipped"
|
|
4111
|
+
},
|
|
4112
|
+
{
|
|
4113
|
+
name: "milestone create",
|
|
4114
|
+
description: "Create a GitHub Milestone from a validated body",
|
|
4115
|
+
flags: [
|
|
4116
|
+
{ flag: "--title", description: "Milestone title — free text, never parsed for a version" },
|
|
4117
|
+
{
|
|
4118
|
+
flag: "--body-file",
|
|
4119
|
+
description: "Path to the Milestone description (stream-safe; same bytes validated and sent)"
|
|
4120
|
+
},
|
|
4121
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without creating the Milestone" },
|
|
4122
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4123
|
+
],
|
|
4124
|
+
details: [
|
|
4125
|
+
"Refuses before any `gh` call when the goal is absent, an optional `Release:` field is present but not a version, or an optional `### Tranche intents` section (`- <slug>: <intent text>`) doesn't parse. `Release:` is the sole authority for the milestone's version — the title is never parsed for one."
|
|
4126
|
+
],
|
|
4127
|
+
status: "shipped"
|
|
4128
|
+
},
|
|
4129
|
+
{
|
|
4130
|
+
name: "milestone adopt",
|
|
4131
|
+
description: "Move one or more existing tranches into a target Milestone",
|
|
4132
|
+
flags: [
|
|
4133
|
+
{ flag: "--target", description: "The Milestone every named slug is adopted into" },
|
|
4134
|
+
{ flag: "--slug", description: "A tranche slug to adopt — repeatable for a multi-slug move" },
|
|
4135
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without writing anything" },
|
|
4136
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4137
|
+
],
|
|
4138
|
+
details: [
|
|
4139
|
+
"Reattaches every Issue carrying each named `vinaya/tranche:<slug>` label to `--target`, then closes (never deletes) each slug's old tranche-Milestone. Every fact for every named slug is gathered and checked in ONE call before any write, so a single unsafe slug — an unknown slug, a slug whose label carries no Issues, a target that does not exist or is closed, or a slug already adopted into a different Milestone — refuses the whole invocation, not just its own slug."
|
|
4140
|
+
],
|
|
4141
|
+
status: "shipped"
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
name: "milestone edit",
|
|
4145
|
+
description: "Edit an existing Milestone (<n>) after full brief-schema validation",
|
|
4146
|
+
flags: [
|
|
4147
|
+
{
|
|
4148
|
+
flag: "--body-file",
|
|
4149
|
+
description: "Path to the new Milestone description (stream-safe; same bytes validated and sent)"
|
|
4150
|
+
},
|
|
4151
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the Milestone" },
|
|
4152
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4153
|
+
],
|
|
4154
|
+
details: [
|
|
4155
|
+
"Same `checkMilestoneShape` refusal `create` runs, before any `gh` call — the gated replacement for a raw `gh api PATCH` against a Milestone. Only the description changes; the title is untouched."
|
|
4156
|
+
],
|
|
4157
|
+
status: "shipped"
|
|
4158
|
+
},
|
|
4159
|
+
{
|
|
4160
|
+
name: "milestone close",
|
|
4161
|
+
description: "Close a tranche's Milestone after verifying every labeled Issue is actually attached",
|
|
4162
|
+
flags: [
|
|
4163
|
+
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
4164
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
4165
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4166
|
+
],
|
|
4167
|
+
details: [
|
|
4168
|
+
"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."
|
|
4169
|
+
],
|
|
4170
|
+
status: "shipped"
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
name: "review post",
|
|
4174
|
+
description: "Render, post, and self-verify a code-reviewer or security-review verdict comment on a PR",
|
|
4175
|
+
flags: [
|
|
4176
|
+
{ flag: "--role", description: "`code-reviewer` or `security` — selects which role template is rendered" },
|
|
4177
|
+
{
|
|
4178
|
+
flag: "--pr",
|
|
4179
|
+
description: "Target PR number — its real head is resolved via `gh pr view`, never caller-supplied"
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
flag: "--verdict",
|
|
4183
|
+
description: "code-reviewer: `APPROVE` | `REQUEST_CHANGES`. security: `PASS` | `FAIL`"
|
|
4184
|
+
},
|
|
4185
|
+
{
|
|
4186
|
+
flag: "--findings-file",
|
|
4187
|
+
description: "One finding per line: `SEVERITY|file:line|description` (`|`-delimited). Omit for zero findings."
|
|
4188
|
+
},
|
|
4189
|
+
{ flag: "--brief-conformance", description: "code-reviewer only: the BRIEF CONFORMANCE line" },
|
|
4190
|
+
{ flag: "--spec-conformance", description: "code-reviewer only: the SPEC CONFORMANCE line" },
|
|
4191
|
+
{ flag: "--scope", description: "code-reviewer only: the SCOPE line" },
|
|
4192
|
+
{ flag: "--tests", description: "code-reviewer only: the TESTS line" },
|
|
4193
|
+
{ flag: "--docs", description: "code-reviewer only: the DOCS line" },
|
|
4194
|
+
{ flag: "--config-scan", description: "security only: the CONFIG SCAN line" },
|
|
4195
|
+
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
4196
|
+
{
|
|
4197
|
+
flag: "--secrets-evidence-file",
|
|
4198
|
+
description: 'security only: required whenever `--secrets` claims "none found" — the pasted scanner output backing that claim'
|
|
4199
|
+
},
|
|
4200
|
+
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
4201
|
+
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
4202
|
+
{ flag: "--tokens-in", description: "a non-negative integer, or `-` if unknown" },
|
|
4203
|
+
{ flag: "--tokens-out", description: "a non-negative integer, or `-` if unknown" },
|
|
4204
|
+
{ flag: "--cost", description: "free text, or `-` if unknown" },
|
|
4205
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4206
|
+
],
|
|
4207
|
+
details: [
|
|
4208
|
+
"Every structural line (`VERDICT:`, `Judged head:`) is rendered from this command's own validated enum/sha inputs — never from a caller-supplied string — so a Reviewer's free-typed prose can no longer produce a shape the merge gate's line-anchored regex fails to see.",
|
|
4209
|
+
"Refuses a contradictory verdict before posting anything: a BLOCKER finding with `--verdict APPROVE`, or a CRITICAL/HIGH finding with `--verdict PASS`, is rejected outright, mirroring each role doc's own consistency rule.",
|
|
4210
|
+
"After posting, re-fetches the PR's comments and runs them through the exact `extractCodeReviewVerdict`/`extractSecurityReviewVerdict` functions `checkReviewGate` calls — the same functions, not a second implementation — and exits non-zero naming precisely what failed to re-parse if the post does not come back clean and bound to the resolved head. There is no `--skip-verify` escape."
|
|
4211
|
+
],
|
|
4212
|
+
status: "shipped"
|
|
4213
|
+
},
|
|
4214
|
+
{
|
|
4215
|
+
name: "doctor",
|
|
4216
|
+
description: "Diagnose hook, workflow, and config health — report only, never mutates",
|
|
4217
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
4218
|
+
details: [
|
|
4219
|
+
'Carries the same env-declaration diagnostic `vinaya check` warns with — permanently, at `info` severity, not just ahead of the spawn-default flip — plus a `warn`-severity lint over suspicious `env` literal forms (a stray `"true"`/`"false"` string, or a high-entropy literal that reads like a leaked secret committed to config).',
|
|
4220
|
+
"Also carries the two permanent `checks`-classification diagnostics: a config key that REPLACES a core check (`warn`), and a bare un-namespaced key that is REJECTED (`error`, naming the rename requirement). These are the reason a config `vinaya check` now refuses outright is still diagnosable — the refusal runs nothing, so `doctor` is the surface that explains why."
|
|
4221
|
+
],
|
|
4222
|
+
status: "shipped"
|
|
4223
|
+
},
|
|
4224
|
+
{
|
|
4225
|
+
name: "tokens",
|
|
4226
|
+
description: "Print a role's `Tokens: …` report line — the portable front door over the collection adapter",
|
|
4227
|
+
flags: [
|
|
4228
|
+
{ flag: "--phase", description: 'e.g. `"<task-id>: develop"` — required' },
|
|
4229
|
+
{ flag: "--role", description: "e.g. `Developer` — required" },
|
|
4230
|
+
{ flag: "--model", description: "Overrides the model id the adapter derived, if given" },
|
|
4231
|
+
{
|
|
4232
|
+
flag: "--transcript",
|
|
4233
|
+
description: "Read this transcript directly. Supported primary route — use it whenever you know which transcript " + "is yours, and always in a repo with no track-transcript.sh hook. Omitted resolves via the Stop-hook " + "pointer file, if this repo installs that hook."
|
|
4234
|
+
},
|
|
4235
|
+
{
|
|
4236
|
+
flag: "--in / --out",
|
|
4237
|
+
description: "Manual entry: the exact token figures, for a host whose usage arrives by some other means than a " + "Claude Code transcript. Both required together; skips transcript resolution entirely."
|
|
4238
|
+
}
|
|
4239
|
+
],
|
|
4240
|
+
details: [
|
|
4241
|
+
"Resolves the Claude Code collection adapter (`resolveMeteringCapability`, `summarizeTranscript`, `formatTokensLine`) from the INSTALLED `@attalabs/aeg-core` package, never by a repo-relative path — the fix for `packages/aeg-core/bin/report-tokens.ts` not existing in an adopter repo with no local `packages/`.",
|
|
4242
|
+
"Refuses — never emits a `0/0/—` line — when no transcript resolves, a resolved transcript can't be read, or it summarizes to zero usage records (empty, unparseable, or not yet flushed to disk). Capability is probed by actually attempting resolution, never declared from the host being Claude Code."
|
|
4243
|
+
],
|
|
4244
|
+
status: "shipped"
|
|
4245
|
+
},
|
|
4246
|
+
{
|
|
4247
|
+
name: "doctrine",
|
|
4248
|
+
description: "Print the absolute path of the bundled doctrine's front door (aeg-root/skills/aeg/SKILL.md) on this machine",
|
|
4249
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1) — `{ root, entry }`" }],
|
|
4250
|
+
details: [
|
|
4251
|
+
"The committed root `VINAYA.md` pointer names the `@attalabs/vinaya` package, never a filesystem path — where the package sits is a property of each machine, not of the repo, and the pointer is committed for every clone. This command is the read-time resolution step the pointer hands the reader: it resolves the installed package's own bundled `aeg-root/` wherever the CLI physically sits and prints the front door's absolute path, so `cat \"$(vinaya doctrine)\"` opens the doctrine on any machine at any version.",
|
|
4252
|
+
"In a repo that vendors the CLI, the bundled copy is a gitignored pack-time artifact, so the command falls back to the monorepo root's own `aeg-root/` — the same directory `bundle-doctrine` copies from. Exits 1 with a corrective message when neither location holds a doctrine."
|
|
4253
|
+
],
|
|
4254
|
+
status: "shipped"
|
|
4255
|
+
},
|
|
4256
|
+
{
|
|
4257
|
+
name: "upgrade",
|
|
4258
|
+
description: "Regenerate hooks, workflow, and config to the current contract version (diff-and-confirm)",
|
|
4259
|
+
flags: [
|
|
4260
|
+
{ flag: "--dry-run", description: "Print the full diff without regenerating anything" },
|
|
4261
|
+
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
4262
|
+
],
|
|
4263
|
+
status: "shipped"
|
|
4264
|
+
},
|
|
4265
|
+
{
|
|
4266
|
+
name: "archive",
|
|
4267
|
+
description: "Run the post-merge Archivist directly: provenance + Issue close-out for a merged task PR",
|
|
4268
|
+
flags: [{ flag: "--merge-sha", description: "The merge commit to resolve (defaults to the current HEAD)" }],
|
|
4269
|
+
details: [
|
|
4270
|
+
"Resolves the merge commit's associated PR via `gh`, and — if it's a task PR without a provenance comment yet — posts the provenance block and closes the linked Issue. Idempotent: re-running against an already-archived PR is a no-op.",
|
|
4271
|
+
"The same logic the generated `vinaya-archivist.yml` workflow's `post-merge` job runs on every push to `main` — callable directly for a one-off run or local verification.",
|
|
4272
|
+
"All progress output writes through `process.stdout.write`/`process.stderr.write` (never bare `console.*`), so piping this command into a log file or a CI step captures every line in order."
|
|
4273
|
+
],
|
|
4274
|
+
status: "shipped"
|
|
4275
|
+
},
|
|
4276
|
+
{
|
|
4277
|
+
name: "archive tranche",
|
|
4278
|
+
description: "Close a tranche — the tranche-level bookend to `init product`, closing the Milestone via the CLI",
|
|
4279
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
4280
|
+
details: [
|
|
4281
|
+
"Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
|
|
4282
|
+
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes the GitHub Milestone."
|
|
4283
|
+
],
|
|
4284
|
+
status: "shipped"
|
|
4285
|
+
},
|
|
4286
|
+
{
|
|
4287
|
+
name: "audit",
|
|
4288
|
+
description: "Run the ring-2 dead-branch-push and direct-main-push detection checks directly",
|
|
4289
|
+
flags: [
|
|
4290
|
+
{ flag: "--only", description: "Scope to one check: 'dead-branches' or 'direct-push'" },
|
|
4291
|
+
{ flag: "--sha", description: "The commit to check for direct-main-push (defaults to the current HEAD)" },
|
|
4292
|
+
{ flag: "--json", description: "Enveloped JSON output" }
|
|
4293
|
+
],
|
|
4294
|
+
details: [
|
|
4295
|
+
"Dead-branch-push is never-red — a notification channel that flags (label + PR comment) any `task/*` branch whose tip commit lands after its own PR already resolved. Direct-main-push is a real pass/fail — it polls the merge-association API for up to ~100s before deciding, then opens an incident Issue and exits 1 if a commit on `main` genuinely has no associated merged PR.",
|
|
4296
|
+
"The same logic the generated `vinaya-archivist.yml` workflow's `daily-drift` and `direct-main-push-detection` jobs run on schedule / on every push to `main` — callable directly for a one-off run or local verification.",
|
|
4297
|
+
"All progress output writes through `process.stdout.write`/`process.stderr.write` (never bare `console.*`), so piping this command into a log file or a CI step captures every line in order."
|
|
4298
|
+
],
|
|
4299
|
+
status: "shipped"
|
|
4300
|
+
},
|
|
4301
|
+
{
|
|
4302
|
+
name: "eject",
|
|
4303
|
+
description: "Remove every Vinaya-installed artifact, restoring the repo to stock",
|
|
4304
|
+
flags: [
|
|
4305
|
+
{ flag: "--dry-run", description: "Print the full removal diff without removing anything" },
|
|
4306
|
+
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
4307
|
+
],
|
|
4308
|
+
status: "shipped"
|
|
4309
|
+
},
|
|
4310
|
+
{
|
|
4311
|
+
name: "demo break",
|
|
4312
|
+
description: "Run a guided refusal-then-fix demo on an isolated, discardable branch",
|
|
4313
|
+
flags: [{ flag: "--keep", description: "Skip cleanup and leave the demo branch checked out to inspect" }],
|
|
4314
|
+
details: [
|
|
4315
|
+
"Creates a collision-safe `vinaya/demo-break-<id>` branch off the current one, stages a deliberately incomplete draft brief, and attempts a real `git commit` — the repo's actually-installed pre-commit hook refuses it with its real output, not a scripted string. Applies the minimal fix, commits again, then switches back and deletes the demo branch.",
|
|
4316
|
+
"Safe to run twice: refuses on a dirty working tree, refuses from a detached HEAD, and recovers automatically from a prior crashed run before starting a fresh one — never leaves the original branch touched or a stray demo branch behind."
|
|
4317
|
+
],
|
|
4318
|
+
status: "shipped"
|
|
4319
|
+
},
|
|
4320
|
+
{
|
|
4321
|
+
name: "waiver",
|
|
4322
|
+
description: "Apply the actor-verified 'vinaya/waiver:docs' or 'vinaya/waiver:review' label after prompting for a reason",
|
|
4323
|
+
flags: [
|
|
4324
|
+
{ flag: "--reason", description: "The waiver rationale, posted as a PR comment (prompted for if omitted)" },
|
|
4325
|
+
{ flag: "--print-only", description: "Print the exact `gh` commands instead of running them" }
|
|
4326
|
+
],
|
|
4327
|
+
details: [
|
|
4328
|
+
"Applies the label via `gh pr edit --add-label`, under the invoking human's own authenticated `gh` identity — this command never fabricates an actor. A waiver is never an agent-emittable string: not a PR body field, not a commit trailer, not a comment — the label plus its own labeling-timeline actor is the only mechanism ring 1 honors.",
|
|
4329
|
+
"`--print-only` prints the exact `gh pr edit`/`gh pr comment` commands and runs nothing — for a human who wants to run them itself, or a CI/non-interactive context where an agent session should never be the one applying its own waiver."
|
|
4330
|
+
],
|
|
4331
|
+
status: "shipped"
|
|
4332
|
+
},
|
|
4333
|
+
{
|
|
4334
|
+
name: "studio",
|
|
4335
|
+
description: "Launch Vinaya Studio — runs the Studio dev app when its source (apps/vinaya-studio/web) is in a checkout above the current directory; a published install launches its bundled standalone server instead",
|
|
4336
|
+
flags: [
|
|
4337
|
+
{
|
|
4338
|
+
flag: "--port <n>",
|
|
4339
|
+
description: "Bind this exact port. Without the flag the default is unchanged — 3008, falling back to 3108 when it is taken. With it there is no fallback: a taken port is refused, so you always know which server answered. Accepts `--port 3208` and `--port=3208`. Applies to a published install; in a workspace checkout Studio's own dev script owns the port and the flag is refused."
|
|
4340
|
+
}
|
|
4341
|
+
],
|
|
4342
|
+
details: [
|
|
4343
|
+
"Resolution happens in this order: a workspace checkout carrying `apps/vinaya-studio/web` (Studio's source, which lives in the attalabs monorepo — not this repository) runs the dev app directly; a published install's `studio-standalone/` bundle (fetched from attalabs' release artifact at publish time, see `scripts/bundle-studio.ts`) runs that bundled server; anything else — a publish that shipped without the bundle — gets an explicit refusal and exit 1 rather than a silent no-op.",
|
|
4344
|
+
"Every published `@attalabs/vinaya` build ships the `studio-standalone/` bundle: `prepack` fetches attalabs’ latest CI-built standalone Studio artifact and assembles it into the tarball before publish."
|
|
4345
|
+
],
|
|
4346
|
+
status: "shipped"
|
|
4347
|
+
},
|
|
4348
|
+
{
|
|
4349
|
+
name: "quickstart",
|
|
4350
|
+
description: "Guided wizard: init, doc-owners, project, commit, demo break, doctor, push — one command",
|
|
4351
|
+
details: [
|
|
4352
|
+
"Calls `init`'s own diff-and-confirm flow unchanged (pausing on Enter before the diff prints, so its own step header isn't scrolled off by a long diff), then Y/n-prompts through the workarounds a guest used to run by hand: binding `.vinaya/doc-owners` pairs (bad input offers a retry instead of silently skipping, and a pointer that doesn't exist on disk is refused outright — both loop across as many pairs as the guest wants, not just one), registering tracked projects (`init product`, same retry/loop shape), committing the install, running `demo break` as proof the gates actually work (default yes — the one step this wizard makes hardest to skip), running `doctor`, and pushing. Each declined prompt skips only that step; the install commit itself is never prompt-gated — it just no-ops when there is genuinely nothing to commit.",
|
|
4353
|
+
"Never reimplements or edits `init`/`init product`/`demo break`/`doctor` — it only calls their existing, unmodified entry points in sequence."
|
|
4354
|
+
],
|
|
4355
|
+
status: "shipped"
|
|
4356
|
+
}
|
|
4357
|
+
];
|
|
3575
4358
|
// ../../packages/sources/src/forge-adapter.ts
|
|
3576
4359
|
function createForgeSource(config) {
|
|
3577
4360
|
return {
|
|
@@ -3595,9 +4378,9 @@ function emitCheckError(error) {
|
|
|
3595
4378
|
|
|
3596
4379
|
// src/lib/config.ts
|
|
3597
4380
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3598
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4381
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
3599
4382
|
import { homedir } from "node:os";
|
|
3600
|
-
import { dirname, join } from "node:path";
|
|
4383
|
+
import { dirname, join, resolve } from "node:path";
|
|
3601
4384
|
import { z as z2 } from "zod";
|
|
3602
4385
|
|
|
3603
4386
|
// src/lib/agent-vendors.ts
|
|
@@ -3686,8 +4469,15 @@ function isSafeRepoRelPath(p) {
|
|
|
3686
4469
|
var SafeRepoRelPath = z2.string().refine(isSafeRepoRelPath, {
|
|
3687
4470
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
3688
4471
|
});
|
|
4472
|
+
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
4473
|
+
function isCanonicalHookBlockPath(p) {
|
|
4474
|
+
return CANONICAL_HOOK_BLOCK_PREFIXES.some((prefix) => p.startsWith(prefix) && p.length > prefix.length);
|
|
4475
|
+
}
|
|
4476
|
+
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
4477
|
+
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
4478
|
+
});
|
|
3689
4479
|
var ManagedBlockRecordSchema = z2.object({
|
|
3690
|
-
path:
|
|
4480
|
+
path: ManagedHookBlockPath,
|
|
3691
4481
|
marker: z2.string(),
|
|
3692
4482
|
comment: z2.enum(["hash", "html"])
|
|
3693
4483
|
});
|
|
@@ -3698,6 +4488,20 @@ var ManagedManifestSchema = z2.object({
|
|
|
3698
4488
|
labels: z2.array(z2.string()),
|
|
3699
4489
|
agents: z2.array(z2.enum(AGENT_VENDORS)).optional()
|
|
3700
4490
|
});
|
|
4491
|
+
var ProjectEntrySchema = z2.object({
|
|
4492
|
+
name: z2.string().min(1),
|
|
4493
|
+
description: z2.string().min(1).optional(),
|
|
4494
|
+
path: z2.string().min(1).optional()
|
|
4495
|
+
});
|
|
4496
|
+
function parseTokensCollectDeclaration(value) {
|
|
4497
|
+
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
4498
|
+
if (!m)
|
|
4499
|
+
return null;
|
|
4500
|
+
const [, interpreter, script] = m;
|
|
4501
|
+
if (!isSafeRepoRelPath(script))
|
|
4502
|
+
return null;
|
|
4503
|
+
return { interpreter, script };
|
|
4504
|
+
}
|
|
3701
4505
|
var VinayaConfigSchema = z2.object({
|
|
3702
4506
|
rings: z2.object({
|
|
3703
4507
|
ring1_forgeWriteInterception: z2.boolean(),
|
|
@@ -3710,13 +4514,19 @@ var VinayaConfigSchema = z2.object({
|
|
|
3710
4514
|
principals: z2.array(z2.string()).min(1).optional(),
|
|
3711
4515
|
releaseActor: z2.string().min(1).optional(),
|
|
3712
4516
|
ci: z2.object({ setup: z2.string().min(1) }).optional(),
|
|
4517
|
+
tokens: z2.object({
|
|
4518
|
+
collect: z2.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
4519
|
+
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
4520
|
+
})
|
|
4521
|
+
}).optional(),
|
|
3713
4522
|
blastRadius: z2.object({ extraDomains: z2.array(z2.string()).optional() }).optional(),
|
|
3714
4523
|
proseGates: z2.object({
|
|
3715
4524
|
doctrineRoot: z2.string().min(1).optional(),
|
|
3716
4525
|
readerFacingPrefix: z2.string().min(1).optional(),
|
|
3717
4526
|
readerFacingSuffix: z2.string().min(1).optional(),
|
|
3718
4527
|
legacySlugDir: z2.string().min(1).optional()
|
|
3719
|
-
}).optional()
|
|
4528
|
+
}).optional(),
|
|
4529
|
+
projects: z2.array(ProjectEntrySchema).optional()
|
|
3720
4530
|
});
|
|
3721
4531
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
3722
4532
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -3755,6 +4565,9 @@ function globalRolesIgnoredWarning(path) {
|
|
|
3755
4565
|
function globalReleaseActorIgnoredWarning(path) {
|
|
3756
4566
|
return `${path}: "releaseActor" in the global config is ignored — releaseActor may only be declared from a repo-local vinaya.config.json.`;
|
|
3757
4567
|
}
|
|
4568
|
+
function globalTokensCollectIgnoredWarning(path) {
|
|
4569
|
+
return `${path}: "tokens" in the global config is ignored — tokens.collect may only be declared from a repo-local vinaya.config.json.`;
|
|
4570
|
+
}
|
|
3758
4571
|
function stripGlobalOnlyKeys(config, path) {
|
|
3759
4572
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
3760
4573
|
return config;
|
|
@@ -3775,6 +4588,10 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
3775
4588
|
console.error(`⚠ ${globalReleaseActorIgnoredWarning(path)}`);
|
|
3776
4589
|
result = { ...result, releaseActor: undefined };
|
|
3777
4590
|
}
|
|
4591
|
+
if (result.tokens) {
|
|
4592
|
+
console.error(`⚠ ${globalTokensCollectIgnoredWarning(path)}`);
|
|
4593
|
+
result = { ...result, tokens: undefined };
|
|
4594
|
+
}
|
|
3778
4595
|
return result;
|
|
3779
4596
|
}
|
|
3780
4597
|
function resolvePrincipalAllowlist(config) {
|
|
@@ -3860,6 +4677,17 @@ function loadConfig() {
|
|
|
3860
4677
|
return null;
|
|
3861
4678
|
}
|
|
3862
4679
|
}
|
|
4680
|
+
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
4681
|
+
|
|
4682
|
+
// src/lib/ops.ts
|
|
4683
|
+
import { dirname as dirname2, isAbsolute, join as join2, resolve as resolve2, sep } from "node:path";
|
|
4684
|
+
function containedAbs(repoRoot, relPath) {
|
|
4685
|
+
const root = resolve2(repoRoot);
|
|
4686
|
+
const target = resolve2(root, relPath);
|
|
4687
|
+
if (target === root)
|
|
4688
|
+
return null;
|
|
4689
|
+
return target === root || target.startsWith(root + sep) ? target : null;
|
|
4690
|
+
}
|
|
3863
4691
|
|
|
3864
4692
|
// src/checks/edge-resolve.ts
|
|
3865
4693
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -3887,9 +4715,32 @@ function fetchIssueState(num, repo) {
|
|
|
3887
4715
|
issueCache.set(key, out);
|
|
3888
4716
|
return out;
|
|
3889
4717
|
}
|
|
4718
|
+
var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
4719
|
+
let tranche;
|
|
4720
|
+
try {
|
|
4721
|
+
tranche = await deriveTrancheFromForge(repo.owner, repo.repo, slug);
|
|
4722
|
+
} catch {
|
|
4723
|
+
return null;
|
|
4724
|
+
}
|
|
4725
|
+
const taskRefs = tranche.tasks.map((t) => ({ id: t.id, issue: t.issue }));
|
|
4726
|
+
const snapshot = await fetchForgeFacts({ owner: repo.owner, repo: repo.repo, tranche: slug, tasks: taskRefs });
|
|
4727
|
+
return {
|
|
4728
|
+
tasks: new Map(tranche.tasks.map((t) => [t.id, { id: t.id, issue: t.issue }])),
|
|
4729
|
+
facts: snapshot.facts
|
|
4730
|
+
};
|
|
4731
|
+
};
|
|
4732
|
+
var siblingTrancheCache = new Map;
|
|
3890
4733
|
function edgeFromIssueJson(num, json) {
|
|
3891
4734
|
if (json === null) {
|
|
3892
|
-
return {
|
|
4735
|
+
return {
|
|
4736
|
+
issue: num,
|
|
4737
|
+
merged: false,
|
|
4738
|
+
open: false,
|
|
4739
|
+
issueState: null,
|
|
4740
|
+
stateReason: null,
|
|
4741
|
+
closedByActor: null,
|
|
4742
|
+
resolved: true
|
|
4743
|
+
};
|
|
3893
4744
|
}
|
|
3894
4745
|
const state = json.state === "CLOSED" ? "closed" : json.state === "OPEN" ? "open" : null;
|
|
3895
4746
|
const reason = json.stateReason === "COMPLETED" ? "completed" : json.stateReason === "NOT_PLANNED" ? "not_planned" : null;
|
|
@@ -3900,10 +4751,11 @@ function edgeFromIssueJson(num, json) {
|
|
|
3900
4751
|
open: false,
|
|
3901
4752
|
issueState: state,
|
|
3902
4753
|
stateReason: reason,
|
|
3903
|
-
closedByActor: null
|
|
4754
|
+
closedByActor: null,
|
|
4755
|
+
resolved: true
|
|
3904
4756
|
};
|
|
3905
4757
|
}
|
|
3906
|
-
function resolveEdge(id, taskById, factsByTaskId, repo) {
|
|
4758
|
+
async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = defaultResolveSiblingTranche) {
|
|
3907
4759
|
const target = taskById.get(id);
|
|
3908
4760
|
if (target) {
|
|
3909
4761
|
const facts = target.issue !== null ? factsByTaskId.get(target.id) : undefined;
|
|
@@ -3913,7 +4765,8 @@ function resolveEdge(id, taskById, factsByTaskId, repo) {
|
|
|
3913
4765
|
open: facts?.prState === "open",
|
|
3914
4766
|
issueState: facts?.issueState ?? null,
|
|
3915
4767
|
stateReason: facts?.stateReason ?? null,
|
|
3916
|
-
closedByActor: facts?.closedByActor ?? null
|
|
4768
|
+
closedByActor: facts?.closedByActor ?? null,
|
|
4769
|
+
resolved: true
|
|
3917
4770
|
};
|
|
3918
4771
|
}
|
|
3919
4772
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
@@ -3921,7 +4774,84 @@ function resolveEdge(id, taskById, factsByTaskId, repo) {
|
|
|
3921
4774
|
const num = Number(direct[1]);
|
|
3922
4775
|
return edgeFromIssueJson(num, fetchIssueState(num, repo));
|
|
3923
4776
|
}
|
|
3924
|
-
|
|
4777
|
+
const qualified = splitSlugQualifiedEdge(id);
|
|
4778
|
+
if (qualified) {
|
|
4779
|
+
const cacheKey = `${repo.owner}/${repo.repo}:${qualified.slug}`;
|
|
4780
|
+
let sibling = siblingTrancheCache.get(cacheKey);
|
|
4781
|
+
if (sibling === undefined) {
|
|
4782
|
+
sibling = await resolveSibling(qualified.slug, repo);
|
|
4783
|
+
siblingTrancheCache.set(cacheKey, sibling);
|
|
4784
|
+
}
|
|
4785
|
+
const siblingTask = sibling?.tasks.get(qualified.bareId);
|
|
4786
|
+
if (sibling && siblingTask) {
|
|
4787
|
+
const facts = siblingTask.issue !== null ? sibling.facts.get(siblingTask.id) : undefined;
|
|
4788
|
+
return {
|
|
4789
|
+
issue: siblingTask.issue,
|
|
4790
|
+
merged: facts?.prState === "merged",
|
|
4791
|
+
open: facts?.prState === "open",
|
|
4792
|
+
issueState: facts?.issueState ?? null,
|
|
4793
|
+
stateReason: facts?.stateReason ?? null,
|
|
4794
|
+
closedByActor: facts?.closedByActor ?? null,
|
|
4795
|
+
resolved: true
|
|
4796
|
+
};
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
return {
|
|
4800
|
+
issue: null,
|
|
4801
|
+
merged: false,
|
|
4802
|
+
open: false,
|
|
4803
|
+
issueState: null,
|
|
4804
|
+
stateReason: null,
|
|
4805
|
+
closedByActor: null,
|
|
4806
|
+
resolved: false
|
|
4807
|
+
};
|
|
4808
|
+
}
|
|
4809
|
+
|
|
4810
|
+
// src/checks/premise-reassert-logic.ts
|
|
4811
|
+
function reassertPremiseFile(checkName, premiseFilePath, body, fileReader) {
|
|
4812
|
+
if (body === null) {
|
|
4813
|
+
return {
|
|
4814
|
+
pass: false,
|
|
4815
|
+
errors: [
|
|
4816
|
+
{
|
|
4817
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
4818
|
+
check: checkName,
|
|
4819
|
+
severity: "error",
|
|
4820
|
+
message: `dispatch-gate premise: PREMISE_FILE "${premiseFilePath}" does not exist or is unreadable.`,
|
|
4821
|
+
agent_recovery_prompt: "Confirm the path passed via PREMISE_FILE is correct and readable, then re-run `vinaya check dispatch-readiness`."
|
|
4822
|
+
}
|
|
4823
|
+
]
|
|
4824
|
+
};
|
|
4825
|
+
}
|
|
4826
|
+
const assertions = parsePremiseBlock(body);
|
|
4827
|
+
if (assertions.length === 0) {
|
|
4828
|
+
return {
|
|
4829
|
+
pass: false,
|
|
4830
|
+
errors: [
|
|
4831
|
+
{
|
|
4832
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
4833
|
+
check: checkName,
|
|
4834
|
+
severity: "error",
|
|
4835
|
+
message: `dispatch-gate premise: PREMISE_FILE "${premiseFilePath}" carries no \`Premise:\` assertions — a premise file with no pins is a mistake, not a pass.`,
|
|
4836
|
+
agent_recovery_prompt: "Add a `Premise:` block with at least one `contains`/`absent`/`sha256` pin to the brief file, then re-run `vinaya check dispatch-readiness`."
|
|
4837
|
+
}
|
|
4838
|
+
]
|
|
4839
|
+
};
|
|
4840
|
+
}
|
|
4841
|
+
const result = checkPremises(assertions, fileReader);
|
|
4842
|
+
if (!result.pass) {
|
|
4843
|
+
return {
|
|
4844
|
+
pass: false,
|
|
4845
|
+
errors: result.failures.map((failure) => ({
|
|
4846
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
4847
|
+
check: checkName,
|
|
4848
|
+
severity: "error",
|
|
4849
|
+
message: `dispatch-gate premise: ${failure}`,
|
|
4850
|
+
agent_recovery_prompt: "The surface moved since this brief was authored — re-dig the affected pin, correct the brief, and re-run `vinaya check dispatch-readiness` before continuing."
|
|
4851
|
+
}))
|
|
4852
|
+
};
|
|
4853
|
+
}
|
|
4854
|
+
return { pass: true, errors: [] };
|
|
3925
4855
|
}
|
|
3926
4856
|
|
|
3927
4857
|
// src/checks/bin/check-dispatch-readiness.ts
|
|
@@ -3976,6 +4906,37 @@ function fail(message, prompt) {
|
|
|
3976
4906
|
});
|
|
3977
4907
|
process.exit(1);
|
|
3978
4908
|
}
|
|
4909
|
+
function checkPremiseReassertion() {
|
|
4910
|
+
const premiseFile = process.env.PREMISE_FILE;
|
|
4911
|
+
if (!premiseFile)
|
|
4912
|
+
return true;
|
|
4913
|
+
const body = existsSync2(premiseFile) ? readFileSync2(premiseFile, "utf8") : null;
|
|
4914
|
+
const result = reassertPremiseFile(CHECK_NAME, premiseFile, body, (p) => {
|
|
4915
|
+
const real = containedRealPath(process.cwd(), p);
|
|
4916
|
+
if (real === null)
|
|
4917
|
+
return null;
|
|
4918
|
+
try {
|
|
4919
|
+
return readFileSync2(real, "utf8");
|
|
4920
|
+
} catch {
|
|
4921
|
+
return null;
|
|
4922
|
+
}
|
|
4923
|
+
});
|
|
4924
|
+
for (const error of result.errors)
|
|
4925
|
+
emitCheckError(error);
|
|
4926
|
+
return result.pass;
|
|
4927
|
+
}
|
|
4928
|
+
function containedRealPath(root, p) {
|
|
4929
|
+
const abs = containedAbs(root, p);
|
|
4930
|
+
if (abs === null)
|
|
4931
|
+
return null;
|
|
4932
|
+
try {
|
|
4933
|
+
const real = realpathSync2(abs);
|
|
4934
|
+
const realRoot = realpathSync2(root);
|
|
4935
|
+
return real === realRoot || real.startsWith(realRoot + sep2) ? real : null;
|
|
4936
|
+
} catch {
|
|
4937
|
+
return null;
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
3979
4940
|
async function main() {
|
|
3980
4941
|
const branch = currentBranch();
|
|
3981
4942
|
const m = branch.match(/^task\/([^/]+)\/(.+)$/);
|
|
@@ -4015,21 +4976,22 @@ async function main() {
|
|
|
4015
4976
|
const issueRationalePass = openIssueMatch ? checkIssueRationale(openIssueMatch.body).status !== "fail" : true;
|
|
4016
4977
|
const taskById = new Map(tranche.tasks.map((t) => [t.id, t]));
|
|
4017
4978
|
const factsByTaskId = snapshot.facts;
|
|
4018
|
-
const dependsOn = task.dependsOn.map((dep) => {
|
|
4019
|
-
const r = resolveEdge(dep, taskById, factsByTaskId, repo);
|
|
4979
|
+
const dependsOn = await Promise.all(task.dependsOn.map(async (dep) => {
|
|
4980
|
+
const r = await resolveEdge(dep, taskById, factsByTaskId, repo);
|
|
4020
4981
|
return {
|
|
4021
4982
|
id: dep,
|
|
4022
4983
|
issue: r.issue,
|
|
4023
4984
|
merged: r.merged,
|
|
4985
|
+
resolved: r.resolved,
|
|
4024
4986
|
issueState: r.issueState,
|
|
4025
4987
|
stateReason: r.stateReason,
|
|
4026
4988
|
closedByActor: r.closedByActor
|
|
4027
4989
|
};
|
|
4028
|
-
});
|
|
4029
|
-
const conflictsWith = task.conflictsWith.map((c) => {
|
|
4030
|
-
const r = resolveEdge(c, taskById, factsByTaskId, repo);
|
|
4990
|
+
}));
|
|
4991
|
+
const conflictsWith = await Promise.all(task.conflictsWith.map(async (c) => {
|
|
4992
|
+
const r = await resolveEdge(c, taskById, factsByTaskId, repo);
|
|
4031
4993
|
return { id: c, issue: r.issue, openOrInFlight: r.open };
|
|
4032
|
-
});
|
|
4994
|
+
}));
|
|
4033
4995
|
const priorTrancheArchival = [];
|
|
4034
4996
|
const input = {
|
|
4035
4997
|
trancheSlug,
|
|
@@ -4043,6 +5005,7 @@ async function main() {
|
|
|
4043
5005
|
principalAllowlist: resolvePrincipalAllowlist(loadTrustAnchorConfig())
|
|
4044
5006
|
};
|
|
4045
5007
|
const result = checkDispatchReadiness(input);
|
|
5008
|
+
let ready = true;
|
|
4046
5009
|
if (!result.ready) {
|
|
4047
5010
|
for (const blocker of result.blockers) {
|
|
4048
5011
|
emitCheckError({
|
|
@@ -4053,9 +5016,11 @@ async function main() {
|
|
|
4053
5016
|
agent_recovery_prompt: recoveryPromptFor(blocker)
|
|
4054
5017
|
});
|
|
4055
5018
|
}
|
|
4056
|
-
|
|
5019
|
+
ready = false;
|
|
4057
5020
|
}
|
|
4058
|
-
|
|
5021
|
+
if (!checkPremiseReassertion())
|
|
5022
|
+
ready = false;
|
|
5023
|
+
process.exit(ready ? 0 : 1);
|
|
4059
5024
|
}
|
|
4060
5025
|
function recoveryPromptFor(blocker) {
|
|
4061
5026
|
if (blocker.startsWith("dispatch-gate issue-existence:")) {
|
|
@@ -4064,6 +5029,9 @@ function recoveryPromptFor(blocker) {
|
|
|
4064
5029
|
if (blocker.startsWith("dispatch-gate rationale:")) {
|
|
4065
5030
|
return "The task's Issue fails the rationale gate. Ask the Planner to complete the eight-field rationale on the Issue body, then re-run `vinaya check dispatch-readiness`.";
|
|
4066
5031
|
}
|
|
5032
|
+
if (blocker.startsWith("dispatch-gate depends-on:") && blocker.includes("UNRESOLVABLE")) {
|
|
5033
|
+
return "A declared dependency edge could not be resolved to any tranche/task/Issue — check the tranche slug and task id in the edge text, then re-run `vinaya check dispatch-readiness`.";
|
|
5034
|
+
}
|
|
4067
5035
|
if (blocker.startsWith("dispatch-gate depends-on:")) {
|
|
4068
5036
|
return "A declared dependency is not merged yet. Do not start this task — wait for the named dependency PR to merge, then re-run `vinaya check dispatch-readiness`.";
|
|
4069
5037
|
}
|