@attalabs/vinaya 0.20.1 → 0.22.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 +76 -1
- package/aeg-root/enforcement.md +15 -7
- package/aeg-root/milestone-model.md +3 -1
- package/aeg-root/roles/architect.md +2 -2
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer.md +3 -2
- package/aeg-root/roles/planner.md +2 -2
- package/aeg-root/roles/principal.md +1 -0
- package/aeg-root/roles/tranche-archivist.md +2 -2
- package/aeg-root/templates/issue-rationale-template.md +4 -4
- package/aeg-root/templates/pr-report-template.md +2 -0
- package/aeg-root/tranche-model.md +4 -4
- package/dist/checks/bin/check-body-bare-digits.js +392 -10
- package/dist/checks/bin/check-branch-topology.js +382 -2
- package/dist/checks/bin/check-brief-shape.js +357 -2
- package/dist/checks/bin/check-changeset-coverage.js +4262 -0
- package/dist/checks/bin/check-closes-n.js +382 -2
- package/dist/checks/bin/check-coherence.js +416 -8
- package/dist/checks/bin/check-dead-branch-push.js +357 -2
- package/dist/checks/bin/check-dispatch-readiness.js +492 -25
- package/dist/checks/bin/check-doc-coverage-push.js +392 -9
- package/dist/checks/bin/check-doc-coverage.js +392 -9
- package/dist/checks/bin/check-doctrine-portability.js +391 -8
- package/dist/checks/bin/check-evidence-fresh.js +357 -2
- package/dist/checks/bin/check-first-push-dispatch.js +481 -17
- package/dist/checks/bin/check-issue-assignment.js +382 -2
- package/dist/checks/bin/check-main-branch-refusal.js +357 -2
- package/dist/checks/bin/check-no-disk-state.js +357 -2
- package/dist/checks/bin/check-quoted-command.js +4514 -0
- package/dist/checks/bin/check-reader-resolvable-prose.js +430 -21
- package/dist/checks/bin/check-registry-gates.js +410 -7
- package/dist/checks/bin/check-retired-vocabulary.js +422 -13
- package/dist/checks/bin/check-review-gate.js +389 -6
- package/dist/checks/bin/check-single-plan-pr.js +357 -2
- package/dist/checks/bin/check-test-plan.js +357 -2
- package/dist/checks/bin/check-token-collection-wired.js +4081 -0
- package/dist/checks/bin/check-token-report.js +4096 -0
- package/dist/checks/bin/check-workspace-escape.js +359 -4
- package/dist/index.js +1607 -641
- package/package.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +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.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/[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]__02c71kv._.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]__16cuydh._.js → [root-of-the-server]__069-_41._.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]__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/_0o54suy._.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/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_1_cfi48._.js +1 -1
- 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/00pi8vhg8w6gi.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/03q0q9n6-xah8.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/13g16cu00g570.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1lk7h-0buf4ab.js → 1hufpuody6vjv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1sfxfunirkcr6.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{29-foak16tjfu.js → 206ajg8f1a-_h.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0ea8-8nopz29h.js → 267o-tsrnuwnv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0msr2a1i-x-br.js → 279qq4twinc97.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{112g08xpx3kro.js → 2ka8dg687auhj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0up5x3jg-cwov.js → 2rn89uwtf2lwc.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2twnwe77d4n-m.js → 37hnluhzj9bei.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3qc67qhcvbg0o.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{30ojnsx3p4lp4.js → 3zugx9esh2x51.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1rku4gz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0_jnwbarv-cqk.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0la0hhmjprdxm.css +0 -1
- 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/3r5efmleneaco.js +0 -1
- /package/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{b2VfZK2AItZwlghK_pUN0 → Fmyc42qzLwFcWWHLLNy-G}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{b2VfZK2AItZwlghK_pUN0 → Fmyc42qzLwFcWWHLLNy-G}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{b2VfZK2AItZwlghK_pUN0 → Fmyc42qzLwFcWWHLLNy-G}/_ssgManifest.js +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
5
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
|
|
6
6
|
import { sep as sep2 } from "node:path";
|
|
7
7
|
import { promisify as promisify4 } from "node:util";
|
|
8
8
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
@@ -192,6 +192,12 @@ var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
|
192
192
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
193
193
|
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
|
|
194
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
|
+
}
|
|
195
201
|
function isEmptyMarker(s) {
|
|
196
202
|
const t = s.trim();
|
|
197
203
|
return t === "" || t === "—" || t === "-" || t === "–";
|
|
@@ -1788,6 +1794,257 @@ var DERIVED_STATUSES = [
|
|
|
1788
1794
|
"incoherent"
|
|
1789
1795
|
];
|
|
1790
1796
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1797
|
+
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1798
|
+
function rowFromCells(cells) {
|
|
1799
|
+
if (cells.length < 7)
|
|
1800
|
+
return null;
|
|
1801
|
+
const phase = (cells[0] ?? "").trim();
|
|
1802
|
+
if (!phase)
|
|
1803
|
+
return null;
|
|
1804
|
+
return {
|
|
1805
|
+
phase,
|
|
1806
|
+
role: (cells[1] ?? "").trim(),
|
|
1807
|
+
agentModel: (cells[2] ?? "").trim(),
|
|
1808
|
+
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1809
|
+
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1810
|
+
cost: parseCostCell(cells[5] ?? ""),
|
|
1811
|
+
date: (cells[6] ?? "").trim()
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
function parseIntCell(cell) {
|
|
1815
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1816
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1817
|
+
return null;
|
|
1818
|
+
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1819
|
+
if (!/^-?\d+$/.test(normalized))
|
|
1820
|
+
return null;
|
|
1821
|
+
return Number(normalized);
|
|
1822
|
+
}
|
|
1823
|
+
function parseCostCell(cell) {
|
|
1824
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1825
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1826
|
+
return null;
|
|
1827
|
+
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1828
|
+
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1829
|
+
return null;
|
|
1830
|
+
return Number(normalized);
|
|
1831
|
+
}
|
|
1832
|
+
function isEmDashOrDash(s) {
|
|
1833
|
+
const t = s.trim();
|
|
1834
|
+
return t === "—" || t === "-" || t === "–";
|
|
1835
|
+
}
|
|
1836
|
+
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1837
|
+
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1838
|
+
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1839
|
+
function parseTokenReportEntries(body) {
|
|
1840
|
+
const lines = body.split(/\r?\n/);
|
|
1841
|
+
const headingIdxs = [];
|
|
1842
|
+
lines.forEach((line, i) => {
|
|
1843
|
+
if (TOKEN_REPORT_HEADING.test(line))
|
|
1844
|
+
headingIdxs.push(i);
|
|
1845
|
+
});
|
|
1846
|
+
const out = [];
|
|
1847
|
+
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1848
|
+
const start = headingIdxs[h] + 1;
|
|
1849
|
+
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1850
|
+
const section = lines.slice(start, end).join(`
|
|
1851
|
+
`);
|
|
1852
|
+
const tableRows = parseTableSection(section);
|
|
1853
|
+
if (tableRows.length > 0) {
|
|
1854
|
+
out.push(...tableRows);
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1857
|
+
const inlineRow = parseInlineFieldList(section);
|
|
1858
|
+
if (inlineRow)
|
|
1859
|
+
out.push(inlineRow);
|
|
1860
|
+
}
|
|
1861
|
+
return out;
|
|
1862
|
+
}
|
|
1863
|
+
function parseTableSection(section) {
|
|
1864
|
+
const lines = section.split(/\r?\n/);
|
|
1865
|
+
let i = 0;
|
|
1866
|
+
for (;i < lines.length; i++) {
|
|
1867
|
+
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1868
|
+
break;
|
|
1869
|
+
}
|
|
1870
|
+
if (i + 1 >= lines.length)
|
|
1871
|
+
return [];
|
|
1872
|
+
i += 2;
|
|
1873
|
+
const out = [];
|
|
1874
|
+
for (;i < lines.length; i++) {
|
|
1875
|
+
const trimmed = (lines[i] ?? "").trim();
|
|
1876
|
+
if (!trimmed.startsWith("|"))
|
|
1877
|
+
break;
|
|
1878
|
+
const row = rowFromCells(splitTableRow(trimmed));
|
|
1879
|
+
if (row)
|
|
1880
|
+
out.push(row);
|
|
1881
|
+
}
|
|
1882
|
+
return out;
|
|
1883
|
+
}
|
|
1884
|
+
function parseInlineFieldList(section) {
|
|
1885
|
+
const m = section.match(INLINE_FIELD_LIST);
|
|
1886
|
+
if (!m)
|
|
1887
|
+
return null;
|
|
1888
|
+
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1889
|
+
}
|
|
1890
|
+
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1891
|
+
var DASH_LOOKALIKES = {
|
|
1892
|
+
"-": "‑",
|
|
1893
|
+
"–": "‒",
|
|
1894
|
+
"—": "―"
|
|
1895
|
+
};
|
|
1896
|
+
var DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES));
|
|
1897
|
+
// ../../packages/aeg-core/src/claude-code-transcript.ts
|
|
1898
|
+
import { createHash } from "node:crypto";
|
|
1899
|
+
function summarizeTranscript(jsonl) {
|
|
1900
|
+
const seen = new Set;
|
|
1901
|
+
const components = {
|
|
1902
|
+
inputTokens: 0,
|
|
1903
|
+
outputTokens: 0,
|
|
1904
|
+
cacheCreationInputTokens: 0,
|
|
1905
|
+
cacheReadInputTokens: 0
|
|
1906
|
+
};
|
|
1907
|
+
let model = null;
|
|
1908
|
+
let messageCount = 0;
|
|
1909
|
+
for (const rawLine of jsonl.split(/\r?\n/)) {
|
|
1910
|
+
const line = rawLine.trim();
|
|
1911
|
+
if (!line)
|
|
1912
|
+
continue;
|
|
1913
|
+
let entry2;
|
|
1914
|
+
try {
|
|
1915
|
+
entry2 = JSON.parse(line);
|
|
1916
|
+
} catch {
|
|
1917
|
+
continue;
|
|
1918
|
+
}
|
|
1919
|
+
if (!entry2 || typeof entry2 !== "object")
|
|
1920
|
+
continue;
|
|
1921
|
+
const obj = entry2;
|
|
1922
|
+
if (obj.type !== "assistant")
|
|
1923
|
+
continue;
|
|
1924
|
+
const message = obj.message;
|
|
1925
|
+
const id = message?.id;
|
|
1926
|
+
const usage = message?.usage;
|
|
1927
|
+
if (typeof id !== "string" || !id || !usage || seen.has(id))
|
|
1928
|
+
continue;
|
|
1929
|
+
seen.add(id);
|
|
1930
|
+
messageCount++;
|
|
1931
|
+
components.inputTokens += numberOr(usage.input_tokens, 0);
|
|
1932
|
+
components.outputTokens += numberOr(usage.output_tokens, 0);
|
|
1933
|
+
components.cacheCreationInputTokens += numberOr(usage.cache_creation_input_tokens, 0);
|
|
1934
|
+
components.cacheReadInputTokens += numberOr(usage.cache_read_input_tokens, 0);
|
|
1935
|
+
const messageModel = message?.model;
|
|
1936
|
+
if (typeof messageModel === "string" && messageModel)
|
|
1937
|
+
model = messageModel;
|
|
1938
|
+
}
|
|
1939
|
+
return { components, model, messageCount };
|
|
1940
|
+
}
|
|
1941
|
+
function numberOr(value, fallback) {
|
|
1942
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1943
|
+
}
|
|
1944
|
+
function sanitizeKey(value) {
|
|
1945
|
+
return value.replace(/[^A-Za-z0-9]+/g, "-");
|
|
1946
|
+
}
|
|
1947
|
+
function collisionResistantKey(value) {
|
|
1948
|
+
const digest = createHash("sha256").update(value).digest("hex");
|
|
1949
|
+
return `${sanitizeKey(value)}-${digest}`;
|
|
1950
|
+
}
|
|
1951
|
+
function transcriptPointerPath(projectDir, tmpDir) {
|
|
1952
|
+
return `${tmpDir}/claude-transcript-${collisionResistantKey(projectDir)}.txt`;
|
|
1953
|
+
}
|
|
1954
|
+
function legacyTranscriptPointerPath(projectDir, tmpDir) {
|
|
1955
|
+
return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`;
|
|
1956
|
+
}
|
|
1957
|
+
function resolvePointer(explicitTranscriptPath, deps) {
|
|
1958
|
+
if (explicitTranscriptPath)
|
|
1959
|
+
return { path: explicitTranscriptPath, corroborated: true };
|
|
1960
|
+
const projectDir = deps.env.CLAUDE_PROJECT_DIR ?? deps.cwd;
|
|
1961
|
+
const tmpDir = deps.env.TMPDIR ?? "/tmp";
|
|
1962
|
+
const primaryPointerPath = transcriptPointerPath(projectDir, tmpDir);
|
|
1963
|
+
const legacyPointerPath = legacyTranscriptPointerPath(projectDir, tmpDir);
|
|
1964
|
+
const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID;
|
|
1965
|
+
const pointerPath = deps.exists(primaryPointerPath) ? primaryPointerPath : deps.exists(legacyPointerPath) ? legacyPointerPath : undefined;
|
|
1966
|
+
if (!pointerPath) {
|
|
1967
|
+
return {
|
|
1968
|
+
pointerExisted: false,
|
|
1969
|
+
corroborated: false,
|
|
1970
|
+
error: `No transcript pointer at ${primaryPointerPath} (nor its pre-migration name ${legacyPointerPath}) ` + "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."
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
let contents;
|
|
1974
|
+
try {
|
|
1975
|
+
contents = deps.readFile(pointerPath).replace(/\r?\n+$/, "");
|
|
1976
|
+
} catch (err) {
|
|
1977
|
+
return {
|
|
1978
|
+
pointerExisted: true,
|
|
1979
|
+
oursByLocation: true,
|
|
1980
|
+
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."
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
const [pointerSessionId, transcriptPath] = contents.split("\t");
|
|
1984
|
+
if (!transcriptPath) {
|
|
1985
|
+
return {
|
|
1986
|
+
pointerExisted: true,
|
|
1987
|
+
oursByLocation: true,
|
|
1988
|
+
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."
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
if (currentSessionId && pointerSessionId && currentSessionId !== pointerSessionId) {
|
|
1992
|
+
return {
|
|
1993
|
+
pointerExisted: true,
|
|
1994
|
+
corroborated: false,
|
|
1995
|
+
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."
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
return { path: transcriptPath, corroborated: Boolean(currentSessionId && pointerSessionId) };
|
|
1999
|
+
}
|
|
2000
|
+
function resolveMeteringCapability(deps, explicitTranscriptPath) {
|
|
2001
|
+
const resolved = resolvePointer(explicitTranscriptPath, deps);
|
|
2002
|
+
if ("error" in resolved) {
|
|
2003
|
+
const ours = resolved.pointerExisted && (resolved.corroborated || resolved.oursByLocation);
|
|
2004
|
+
if (ours)
|
|
2005
|
+
return { capable: false, reason: "pointer-unusable", detail: resolved.error };
|
|
2006
|
+
return {
|
|
2007
|
+
capable: false,
|
|
2008
|
+
reason: "no-transcript-resolved",
|
|
2009
|
+
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
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
const downstream = (r, detail) => resolved.corroborated ? { reason: r, detail } : {
|
|
2013
|
+
reason: "no-transcript-resolved",
|
|
2014
|
+
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})`
|
|
2015
|
+
};
|
|
2016
|
+
if (!deps.exists(resolved.path)) {
|
|
2017
|
+
return {
|
|
2018
|
+
capable: false,
|
|
2019
|
+
...downstream("transcript-unreadable", `Resolved transcript path ${resolved.path} is not readable as a regular file owned by this user.`)
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
let jsonl;
|
|
2023
|
+
try {
|
|
2024
|
+
jsonl = deps.readFile(resolved.path);
|
|
2025
|
+
} catch (err) {
|
|
2026
|
+
return {
|
|
2027
|
+
capable: false,
|
|
2028
|
+
...downstream("transcript-unreadable", `Transcript at ${resolved.path} could not be read: ${err.message}`)
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
const summary = summarizeTranscript(jsonl);
|
|
2032
|
+
if (summary.messageCount === 0) {
|
|
2033
|
+
return {
|
|
2034
|
+
capable: false,
|
|
2035
|
+
...downstream("transcript-empty", `Transcript at ${resolved.path} yielded zero assistant messages with usage data — ` + "it's empty, unparseable, or not yet flushed to disk.")
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
return { capable: true, transcriptPath: resolved.path, summary };
|
|
2039
|
+
}
|
|
2040
|
+
function isTokenCollectionWiringBroken(capability) {
|
|
2041
|
+
if (capability.capable)
|
|
2042
|
+
return false;
|
|
2043
|
+
return capability.reason !== "no-transcript-resolved";
|
|
2044
|
+
}
|
|
2045
|
+
// ../../packages/aeg-core/src/metering-io-guard.ts
|
|
2046
|
+
import { closeSync, constants as fsConstants, fstatSync, openSync, readFileSync } from "node:fs";
|
|
2047
|
+
var GUARD_OPEN_FLAGS = fsConstants.O_RDONLY | fsConstants.O_NONBLOCK | fsConstants.O_NOFOLLOW;
|
|
1791
2048
|
// ../../packages/aeg-core/src/file-classify.ts
|
|
1792
2049
|
function isCodeFile(p) {
|
|
1793
2050
|
if (p.endsWith(".md"))
|
|
@@ -1994,7 +2251,7 @@ function overrideActive(opts) {
|
|
|
1994
2251
|
return false;
|
|
1995
2252
|
}
|
|
1996
2253
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
1997
|
-
import { createHash } from "node:crypto";
|
|
2254
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
1998
2255
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
1999
2256
|
function isPremiseHeader(line) {
|
|
2000
2257
|
const stripped = line.replace(/[*#]/g, "").trim();
|
|
@@ -2039,7 +2296,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
2039
2296
|
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2040
2297
|
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2041
2298
|
} else if (a.kind === "sha256") {
|
|
2042
|
-
const actual =
|
|
2299
|
+
const actual = createHash2("sha256").update(content).digest("hex");
|
|
2043
2300
|
if (actual !== a.value.toLowerCase()) {
|
|
2044
2301
|
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.`);
|
|
2045
2302
|
}
|
|
@@ -3219,6 +3476,100 @@ function parseGlossaryTerms(glossaryContent) {
|
|
|
3219
3476
|
}
|
|
3220
3477
|
return terms;
|
|
3221
3478
|
}
|
|
3479
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3480
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3481
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3482
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3483
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3484
|
+
function isValidCitedFilePath(path) {
|
|
3485
|
+
if (path.length === 0)
|
|
3486
|
+
return false;
|
|
3487
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3488
|
+
return false;
|
|
3489
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3490
|
+
return false;
|
|
3491
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3492
|
+
}
|
|
3493
|
+
function quotedCommandLineAt(content, index) {
|
|
3494
|
+
let line = 1;
|
|
3495
|
+
for (let i = 0;i < index; i++) {
|
|
3496
|
+
if (content.charCodeAt(i) === 10)
|
|
3497
|
+
line++;
|
|
3498
|
+
}
|
|
3499
|
+
return line;
|
|
3500
|
+
}
|
|
3501
|
+
function extractQuotedText(raw) {
|
|
3502
|
+
const trimmed = raw.trim();
|
|
3503
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3504
|
+
if (fenced)
|
|
3505
|
+
return (fenced[1] ?? "").trim();
|
|
3506
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3507
|
+
if (inline)
|
|
3508
|
+
return (inline[1] ?? "").trim();
|
|
3509
|
+
return trimmed;
|
|
3510
|
+
}
|
|
3511
|
+
function findQuotesInFile(path, content) {
|
|
3512
|
+
const masked = maskCode(content);
|
|
3513
|
+
const quotes = [];
|
|
3514
|
+
START_PATTERN.lastIndex = 0;
|
|
3515
|
+
let start = START_PATTERN.exec(masked);
|
|
3516
|
+
while (start !== null) {
|
|
3517
|
+
const citedFile = start[1];
|
|
3518
|
+
const innerStart = start.index + start[0].length;
|
|
3519
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3520
|
+
if (end === null) {
|
|
3521
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3522
|
+
start = START_PATTERN.exec(masked);
|
|
3523
|
+
continue;
|
|
3524
|
+
}
|
|
3525
|
+
const innerEnd = innerStart + end.index;
|
|
3526
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3527
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3528
|
+
if (quotedText.length > 0) {
|
|
3529
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3533
|
+
start = START_PATTERN.exec(masked);
|
|
3534
|
+
}
|
|
3535
|
+
return quotes;
|
|
3536
|
+
}
|
|
3537
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3538
|
+
const quotes = [];
|
|
3539
|
+
for (const file of files) {
|
|
3540
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3541
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3542
|
+
continue;
|
|
3543
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3544
|
+
}
|
|
3545
|
+
return quotes;
|
|
3546
|
+
}
|
|
3547
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3548
|
+
const findings = [];
|
|
3549
|
+
for (const quote of citedQuotes) {
|
|
3550
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3551
|
+
if (content === undefined) {
|
|
3552
|
+
findings.push({
|
|
3553
|
+
file: quote.file,
|
|
3554
|
+
line: quote.line,
|
|
3555
|
+
citedFile: quote.citedFile,
|
|
3556
|
+
quotedText: quote.quotedText,
|
|
3557
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3558
|
+
});
|
|
3559
|
+
continue;
|
|
3560
|
+
}
|
|
3561
|
+
if (!content.includes(quote.quotedText)) {
|
|
3562
|
+
findings.push({
|
|
3563
|
+
file: quote.file,
|
|
3564
|
+
line: quote.line,
|
|
3565
|
+
citedFile: quote.citedFile,
|
|
3566
|
+
quotedText: quote.quotedText,
|
|
3567
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
return findings;
|
|
3572
|
+
}
|
|
3222
3573
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
3223
3574
|
var RETIRED_PATTERNS = [
|
|
3224
3575
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -3332,6 +3683,10 @@ function checkDispatchReadiness(input) {
|
|
|
3332
3683
|
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.`);
|
|
3333
3684
|
}
|
|
3334
3685
|
for (const dep of input.dependsOn) {
|
|
3686
|
+
if (dep.resolved === false) {
|
|
3687
|
+
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.`);
|
|
3688
|
+
continue;
|
|
3689
|
+
}
|
|
3335
3690
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
3336
3691
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
3337
3692
|
blockers.push(`dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|
|
@@ -3819,6 +4174,18 @@ var COMMANDS = [
|
|
|
3819
4174
|
],
|
|
3820
4175
|
status: "shipped"
|
|
3821
4176
|
},
|
|
4177
|
+
{
|
|
4178
|
+
name: "pr verify-evidence",
|
|
4179
|
+
description: "Prove a pull request's AEG:EVIDENCE region was machine-generated — regenerate it and compare",
|
|
4180
|
+
flags: [],
|
|
4181
|
+
details: [
|
|
4182
|
+
"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.",
|
|
4183
|
+
"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.",
|
|
4184
|
+
"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.",
|
|
4185
|
+
"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."
|
|
4186
|
+
],
|
|
4187
|
+
status: "shipped"
|
|
4188
|
+
},
|
|
3822
4189
|
{
|
|
3823
4190
|
name: "issue create",
|
|
3824
4191
|
description: "Open an issue after full brief-schema validation",
|
|
@@ -3895,6 +4262,19 @@ var COMMANDS = [
|
|
|
3895
4262
|
],
|
|
3896
4263
|
status: "shipped"
|
|
3897
4264
|
},
|
|
4265
|
+
{
|
|
4266
|
+
name: "milestone close",
|
|
4267
|
+
description: "Close a tranche's Milestone after verifying every labeled Issue is actually attached",
|
|
4268
|
+
flags: [
|
|
4269
|
+
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
4270
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
4271
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4272
|
+
],
|
|
4273
|
+
details: [
|
|
4274
|
+
"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."
|
|
4275
|
+
],
|
|
4276
|
+
status: "shipped"
|
|
4277
|
+
},
|
|
3898
4278
|
{
|
|
3899
4279
|
name: "review post",
|
|
3900
4280
|
description: "Render, post, and self-verify a code-reviewer or security-review verdict comment on a PR",
|
|
@@ -4104,9 +4484,9 @@ function emitCheckError(error) {
|
|
|
4104
4484
|
|
|
4105
4485
|
// src/lib/config.ts
|
|
4106
4486
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
4107
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4487
|
+
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
4108
4488
|
import { homedir } from "node:os";
|
|
4109
|
-
import { dirname, join } from "node:path";
|
|
4489
|
+
import { dirname, join, resolve } from "node:path";
|
|
4110
4490
|
import { z as z2 } from "zod";
|
|
4111
4491
|
|
|
4112
4492
|
// src/lib/agent-vendors.ts
|
|
@@ -4214,6 +4594,20 @@ var ManagedManifestSchema = z2.object({
|
|
|
4214
4594
|
labels: z2.array(z2.string()),
|
|
4215
4595
|
agents: z2.array(z2.enum(AGENT_VENDORS)).optional()
|
|
4216
4596
|
});
|
|
4597
|
+
var ProjectEntrySchema = z2.object({
|
|
4598
|
+
name: z2.string().min(1),
|
|
4599
|
+
description: z2.string().min(1).optional(),
|
|
4600
|
+
path: z2.string().min(1).optional()
|
|
4601
|
+
});
|
|
4602
|
+
function parseTokensCollectDeclaration(value) {
|
|
4603
|
+
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
4604
|
+
if (!m)
|
|
4605
|
+
return null;
|
|
4606
|
+
const [, interpreter, script] = m;
|
|
4607
|
+
if (!isSafeRepoRelPath(script))
|
|
4608
|
+
return null;
|
|
4609
|
+
return { interpreter, script };
|
|
4610
|
+
}
|
|
4217
4611
|
var VinayaConfigSchema = z2.object({
|
|
4218
4612
|
rings: z2.object({
|
|
4219
4613
|
ring1_forgeWriteInterception: z2.boolean(),
|
|
@@ -4226,13 +4620,19 @@ var VinayaConfigSchema = z2.object({
|
|
|
4226
4620
|
principals: z2.array(z2.string()).min(1).optional(),
|
|
4227
4621
|
releaseActor: z2.string().min(1).optional(),
|
|
4228
4622
|
ci: z2.object({ setup: z2.string().min(1) }).optional(),
|
|
4623
|
+
tokens: z2.object({
|
|
4624
|
+
collect: z2.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
4625
|
+
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
4626
|
+
})
|
|
4627
|
+
}).optional(),
|
|
4229
4628
|
blastRadius: z2.object({ extraDomains: z2.array(z2.string()).optional() }).optional(),
|
|
4230
4629
|
proseGates: z2.object({
|
|
4231
4630
|
doctrineRoot: z2.string().min(1).optional(),
|
|
4232
4631
|
readerFacingPrefix: z2.string().min(1).optional(),
|
|
4233
4632
|
readerFacingSuffix: z2.string().min(1).optional(),
|
|
4234
4633
|
legacySlugDir: z2.string().min(1).optional()
|
|
4235
|
-
}).optional()
|
|
4634
|
+
}).optional(),
|
|
4635
|
+
projects: z2.array(ProjectEntrySchema).optional()
|
|
4236
4636
|
});
|
|
4237
4637
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
4238
4638
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -4271,6 +4671,9 @@ function globalRolesIgnoredWarning(path) {
|
|
|
4271
4671
|
function globalReleaseActorIgnoredWarning(path) {
|
|
4272
4672
|
return `${path}: "releaseActor" in the global config is ignored — releaseActor may only be declared from a repo-local vinaya.config.json.`;
|
|
4273
4673
|
}
|
|
4674
|
+
function globalTokensCollectIgnoredWarning(path) {
|
|
4675
|
+
return `${path}: "tokens" in the global config is ignored — tokens.collect may only be declared from a repo-local vinaya.config.json.`;
|
|
4676
|
+
}
|
|
4274
4677
|
function stripGlobalOnlyKeys(config, path) {
|
|
4275
4678
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
4276
4679
|
return config;
|
|
@@ -4291,6 +4694,10 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
4291
4694
|
console.error(`⚠ ${globalReleaseActorIgnoredWarning(path)}`);
|
|
4292
4695
|
result = { ...result, releaseActor: undefined };
|
|
4293
4696
|
}
|
|
4697
|
+
if (result.tokens) {
|
|
4698
|
+
console.error(`⚠ ${globalTokensCollectIgnoredWarning(path)}`);
|
|
4699
|
+
result = { ...result, tokens: undefined };
|
|
4700
|
+
}
|
|
4294
4701
|
return result;
|
|
4295
4702
|
}
|
|
4296
4703
|
function resolvePrincipalAllowlist(config) {
|
|
@@ -4370,18 +4777,19 @@ function loadConfig() {
|
|
|
4370
4777
|
if (!path)
|
|
4371
4778
|
return null;
|
|
4372
4779
|
try {
|
|
4373
|
-
const raw = JSON.parse(
|
|
4780
|
+
const raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
4374
4781
|
return stripGlobalOnlyKeys(VinayaConfigSchema.parse(raw), path);
|
|
4375
4782
|
} catch {
|
|
4376
4783
|
return null;
|
|
4377
4784
|
}
|
|
4378
4785
|
}
|
|
4786
|
+
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
4379
4787
|
|
|
4380
4788
|
// src/lib/ops.ts
|
|
4381
|
-
import { dirname as dirname2, isAbsolute, join as join2, resolve, sep } from "node:path";
|
|
4789
|
+
import { dirname as dirname2, isAbsolute, join as join2, resolve as resolve2, sep } from "node:path";
|
|
4382
4790
|
function containedAbs(repoRoot, relPath) {
|
|
4383
|
-
const root =
|
|
4384
|
-
const target =
|
|
4791
|
+
const root = resolve2(repoRoot);
|
|
4792
|
+
const target = resolve2(root, relPath);
|
|
4385
4793
|
if (target === root)
|
|
4386
4794
|
return null;
|
|
4387
4795
|
return target === root || target.startsWith(root + sep) ? target : null;
|
|
@@ -4413,9 +4821,32 @@ function fetchIssueState(num, repo) {
|
|
|
4413
4821
|
issueCache.set(key, out);
|
|
4414
4822
|
return out;
|
|
4415
4823
|
}
|
|
4824
|
+
var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
4825
|
+
let tranche;
|
|
4826
|
+
try {
|
|
4827
|
+
tranche = await deriveTrancheFromForge(repo.owner, repo.repo, slug);
|
|
4828
|
+
} catch {
|
|
4829
|
+
return null;
|
|
4830
|
+
}
|
|
4831
|
+
const taskRefs = tranche.tasks.map((t) => ({ id: t.id, issue: t.issue }));
|
|
4832
|
+
const snapshot = await fetchForgeFacts({ owner: repo.owner, repo: repo.repo, tranche: slug, tasks: taskRefs });
|
|
4833
|
+
return {
|
|
4834
|
+
tasks: new Map(tranche.tasks.map((t) => [t.id, { id: t.id, issue: t.issue }])),
|
|
4835
|
+
facts: snapshot.facts
|
|
4836
|
+
};
|
|
4837
|
+
};
|
|
4838
|
+
var siblingTrancheCache = new Map;
|
|
4416
4839
|
function edgeFromIssueJson(num, json) {
|
|
4417
4840
|
if (json === null) {
|
|
4418
|
-
return {
|
|
4841
|
+
return {
|
|
4842
|
+
issue: num,
|
|
4843
|
+
merged: false,
|
|
4844
|
+
open: false,
|
|
4845
|
+
issueState: null,
|
|
4846
|
+
stateReason: null,
|
|
4847
|
+
closedByActor: null,
|
|
4848
|
+
resolved: true
|
|
4849
|
+
};
|
|
4419
4850
|
}
|
|
4420
4851
|
const state = json.state === "CLOSED" ? "closed" : json.state === "OPEN" ? "open" : null;
|
|
4421
4852
|
const reason = json.stateReason === "COMPLETED" ? "completed" : json.stateReason === "NOT_PLANNED" ? "not_planned" : null;
|
|
@@ -4426,10 +4857,11 @@ function edgeFromIssueJson(num, json) {
|
|
|
4426
4857
|
open: false,
|
|
4427
4858
|
issueState: state,
|
|
4428
4859
|
stateReason: reason,
|
|
4429
|
-
closedByActor: null
|
|
4860
|
+
closedByActor: null,
|
|
4861
|
+
resolved: true
|
|
4430
4862
|
};
|
|
4431
4863
|
}
|
|
4432
|
-
function resolveEdge(id, taskById, factsByTaskId, repo) {
|
|
4864
|
+
async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = defaultResolveSiblingTranche) {
|
|
4433
4865
|
const target = taskById.get(id);
|
|
4434
4866
|
if (target) {
|
|
4435
4867
|
const facts = target.issue !== null ? factsByTaskId.get(target.id) : undefined;
|
|
@@ -4439,7 +4871,8 @@ function resolveEdge(id, taskById, factsByTaskId, repo) {
|
|
|
4439
4871
|
open: facts?.prState === "open",
|
|
4440
4872
|
issueState: facts?.issueState ?? null,
|
|
4441
4873
|
stateReason: facts?.stateReason ?? null,
|
|
4442
|
-
closedByActor: facts?.closedByActor ?? null
|
|
4874
|
+
closedByActor: facts?.closedByActor ?? null,
|
|
4875
|
+
resolved: true
|
|
4443
4876
|
};
|
|
4444
4877
|
}
|
|
4445
4878
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
@@ -4447,7 +4880,37 @@ function resolveEdge(id, taskById, factsByTaskId, repo) {
|
|
|
4447
4880
|
const num = Number(direct[1]);
|
|
4448
4881
|
return edgeFromIssueJson(num, fetchIssueState(num, repo));
|
|
4449
4882
|
}
|
|
4450
|
-
|
|
4883
|
+
const qualified = splitSlugQualifiedEdge(id);
|
|
4884
|
+
if (qualified) {
|
|
4885
|
+
const cacheKey = `${repo.owner}/${repo.repo}:${qualified.slug}`;
|
|
4886
|
+
let sibling = siblingTrancheCache.get(cacheKey);
|
|
4887
|
+
if (sibling === undefined) {
|
|
4888
|
+
sibling = await resolveSibling(qualified.slug, repo);
|
|
4889
|
+
siblingTrancheCache.set(cacheKey, sibling);
|
|
4890
|
+
}
|
|
4891
|
+
const siblingTask = sibling?.tasks.get(qualified.bareId);
|
|
4892
|
+
if (sibling && siblingTask) {
|
|
4893
|
+
const facts = siblingTask.issue !== null ? sibling.facts.get(siblingTask.id) : undefined;
|
|
4894
|
+
return {
|
|
4895
|
+
issue: siblingTask.issue,
|
|
4896
|
+
merged: facts?.prState === "merged",
|
|
4897
|
+
open: facts?.prState === "open",
|
|
4898
|
+
issueState: facts?.issueState ?? null,
|
|
4899
|
+
stateReason: facts?.stateReason ?? null,
|
|
4900
|
+
closedByActor: facts?.closedByActor ?? null,
|
|
4901
|
+
resolved: true
|
|
4902
|
+
};
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
4905
|
+
return {
|
|
4906
|
+
issue: null,
|
|
4907
|
+
merged: false,
|
|
4908
|
+
open: false,
|
|
4909
|
+
issueState: null,
|
|
4910
|
+
stateReason: null,
|
|
4911
|
+
closedByActor: null,
|
|
4912
|
+
resolved: false
|
|
4913
|
+
};
|
|
4451
4914
|
}
|
|
4452
4915
|
|
|
4453
4916
|
// src/checks/premise-reassert-logic.ts
|
|
@@ -4553,13 +5016,13 @@ function checkPremiseReassertion() {
|
|
|
4553
5016
|
const premiseFile = process.env.PREMISE_FILE;
|
|
4554
5017
|
if (!premiseFile)
|
|
4555
5018
|
return true;
|
|
4556
|
-
const body = existsSync2(premiseFile) ?
|
|
5019
|
+
const body = existsSync2(premiseFile) ? readFileSync3(premiseFile, "utf8") : null;
|
|
4557
5020
|
const result = reassertPremiseFile(CHECK_NAME, premiseFile, body, (p) => {
|
|
4558
5021
|
const real = containedRealPath(process.cwd(), p);
|
|
4559
5022
|
if (real === null)
|
|
4560
5023
|
return null;
|
|
4561
5024
|
try {
|
|
4562
|
-
return
|
|
5025
|
+
return readFileSync3(real, "utf8");
|
|
4563
5026
|
} catch {
|
|
4564
5027
|
return null;
|
|
4565
5028
|
}
|
|
@@ -4573,8 +5036,8 @@ function containedRealPath(root, p) {
|
|
|
4573
5036
|
if (abs === null)
|
|
4574
5037
|
return null;
|
|
4575
5038
|
try {
|
|
4576
|
-
const real =
|
|
4577
|
-
const realRoot =
|
|
5039
|
+
const real = realpathSync2(abs);
|
|
5040
|
+
const realRoot = realpathSync2(root);
|
|
4578
5041
|
return real === realRoot || real.startsWith(realRoot + sep2) ? real : null;
|
|
4579
5042
|
} catch {
|
|
4580
5043
|
return null;
|
|
@@ -4619,21 +5082,22 @@ async function main() {
|
|
|
4619
5082
|
const issueRationalePass = openIssueMatch ? checkIssueRationale(openIssueMatch.body).status !== "fail" : true;
|
|
4620
5083
|
const taskById = new Map(tranche.tasks.map((t) => [t.id, t]));
|
|
4621
5084
|
const factsByTaskId = snapshot.facts;
|
|
4622
|
-
const dependsOn = task.dependsOn.map((dep) => {
|
|
4623
|
-
const r = resolveEdge(dep, taskById, factsByTaskId, repo);
|
|
5085
|
+
const dependsOn = await Promise.all(task.dependsOn.map(async (dep) => {
|
|
5086
|
+
const r = await resolveEdge(dep, taskById, factsByTaskId, repo);
|
|
4624
5087
|
return {
|
|
4625
5088
|
id: dep,
|
|
4626
5089
|
issue: r.issue,
|
|
4627
5090
|
merged: r.merged,
|
|
5091
|
+
resolved: r.resolved,
|
|
4628
5092
|
issueState: r.issueState,
|
|
4629
5093
|
stateReason: r.stateReason,
|
|
4630
5094
|
closedByActor: r.closedByActor
|
|
4631
5095
|
};
|
|
4632
|
-
});
|
|
4633
|
-
const conflictsWith = task.conflictsWith.map((c) => {
|
|
4634
|
-
const r = resolveEdge(c, taskById, factsByTaskId, repo);
|
|
5096
|
+
}));
|
|
5097
|
+
const conflictsWith = await Promise.all(task.conflictsWith.map(async (c) => {
|
|
5098
|
+
const r = await resolveEdge(c, taskById, factsByTaskId, repo);
|
|
4635
5099
|
return { id: c, issue: r.issue, openOrInFlight: r.open };
|
|
4636
|
-
});
|
|
5100
|
+
}));
|
|
4637
5101
|
const priorTrancheArchival = [];
|
|
4638
5102
|
const input = {
|
|
4639
5103
|
trancheSlug,
|
|
@@ -4671,6 +5135,9 @@ function recoveryPromptFor(blocker) {
|
|
|
4671
5135
|
if (blocker.startsWith("dispatch-gate rationale:")) {
|
|
4672
5136
|
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`.";
|
|
4673
5137
|
}
|
|
5138
|
+
if (blocker.startsWith("dispatch-gate depends-on:") && blocker.includes("UNRESOLVABLE")) {
|
|
5139
|
+
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`.";
|
|
5140
|
+
}
|
|
4674
5141
|
if (blocker.startsWith("dispatch-gate depends-on:")) {
|
|
4675
5142
|
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`.";
|
|
4676
5143
|
}
|