@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-workspace-escape.ts
|
|
4
|
-
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
4
|
+
import { readdirSync, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
7
7
|
var GATE_AUDIENCE = {
|
|
@@ -190,6 +190,12 @@ var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
|
190
190
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
191
191
|
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
|
|
192
192
|
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
|
|
193
|
+
function splitSlugQualifiedEdge(edge) {
|
|
194
|
+
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
195
|
+
if (!m)
|
|
196
|
+
return null;
|
|
197
|
+
return { slug: m[1], bareId: m[2] };
|
|
198
|
+
}
|
|
193
199
|
function isEmptyMarker(s) {
|
|
194
200
|
const t = s.trim();
|
|
195
201
|
return t === "" || t === "—" || t === "-" || t === "–";
|
|
@@ -1786,6 +1792,257 @@ var DERIVED_STATUSES = [
|
|
|
1786
1792
|
"incoherent"
|
|
1787
1793
|
];
|
|
1788
1794
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1795
|
+
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1796
|
+
function rowFromCells(cells) {
|
|
1797
|
+
if (cells.length < 7)
|
|
1798
|
+
return null;
|
|
1799
|
+
const phase = (cells[0] ?? "").trim();
|
|
1800
|
+
if (!phase)
|
|
1801
|
+
return null;
|
|
1802
|
+
return {
|
|
1803
|
+
phase,
|
|
1804
|
+
role: (cells[1] ?? "").trim(),
|
|
1805
|
+
agentModel: (cells[2] ?? "").trim(),
|
|
1806
|
+
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1807
|
+
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1808
|
+
cost: parseCostCell(cells[5] ?? ""),
|
|
1809
|
+
date: (cells[6] ?? "").trim()
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
function parseIntCell(cell) {
|
|
1813
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1814
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1815
|
+
return null;
|
|
1816
|
+
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1817
|
+
if (!/^-?\d+$/.test(normalized))
|
|
1818
|
+
return null;
|
|
1819
|
+
return Number(normalized);
|
|
1820
|
+
}
|
|
1821
|
+
function parseCostCell(cell) {
|
|
1822
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1823
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1824
|
+
return null;
|
|
1825
|
+
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1826
|
+
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1827
|
+
return null;
|
|
1828
|
+
return Number(normalized);
|
|
1829
|
+
}
|
|
1830
|
+
function isEmDashOrDash(s) {
|
|
1831
|
+
const t = s.trim();
|
|
1832
|
+
return t === "—" || t === "-" || t === "–";
|
|
1833
|
+
}
|
|
1834
|
+
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1835
|
+
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1836
|
+
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;
|
|
1837
|
+
function parseTokenReportEntries(body) {
|
|
1838
|
+
const lines = body.split(/\r?\n/);
|
|
1839
|
+
const headingIdxs = [];
|
|
1840
|
+
lines.forEach((line, i) => {
|
|
1841
|
+
if (TOKEN_REPORT_HEADING.test(line))
|
|
1842
|
+
headingIdxs.push(i);
|
|
1843
|
+
});
|
|
1844
|
+
const out = [];
|
|
1845
|
+
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1846
|
+
const start = headingIdxs[h] + 1;
|
|
1847
|
+
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1848
|
+
const section = lines.slice(start, end).join(`
|
|
1849
|
+
`);
|
|
1850
|
+
const tableRows = parseTableSection(section);
|
|
1851
|
+
if (tableRows.length > 0) {
|
|
1852
|
+
out.push(...tableRows);
|
|
1853
|
+
continue;
|
|
1854
|
+
}
|
|
1855
|
+
const inlineRow = parseInlineFieldList(section);
|
|
1856
|
+
if (inlineRow)
|
|
1857
|
+
out.push(inlineRow);
|
|
1858
|
+
}
|
|
1859
|
+
return out;
|
|
1860
|
+
}
|
|
1861
|
+
function parseTableSection(section) {
|
|
1862
|
+
const lines = section.split(/\r?\n/);
|
|
1863
|
+
let i = 0;
|
|
1864
|
+
for (;i < lines.length; i++) {
|
|
1865
|
+
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1866
|
+
break;
|
|
1867
|
+
}
|
|
1868
|
+
if (i + 1 >= lines.length)
|
|
1869
|
+
return [];
|
|
1870
|
+
i += 2;
|
|
1871
|
+
const out = [];
|
|
1872
|
+
for (;i < lines.length; i++) {
|
|
1873
|
+
const trimmed = (lines[i] ?? "").trim();
|
|
1874
|
+
if (!trimmed.startsWith("|"))
|
|
1875
|
+
break;
|
|
1876
|
+
const row = rowFromCells(splitTableRow(trimmed));
|
|
1877
|
+
if (row)
|
|
1878
|
+
out.push(row);
|
|
1879
|
+
}
|
|
1880
|
+
return out;
|
|
1881
|
+
}
|
|
1882
|
+
function parseInlineFieldList(section) {
|
|
1883
|
+
const m = section.match(INLINE_FIELD_LIST);
|
|
1884
|
+
if (!m)
|
|
1885
|
+
return null;
|
|
1886
|
+
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1887
|
+
}
|
|
1888
|
+
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1889
|
+
var DASH_LOOKALIKES = {
|
|
1890
|
+
"-": "‑",
|
|
1891
|
+
"–": "‒",
|
|
1892
|
+
"—": "―"
|
|
1893
|
+
};
|
|
1894
|
+
var DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES));
|
|
1895
|
+
// ../../packages/aeg-core/src/claude-code-transcript.ts
|
|
1896
|
+
import { createHash } from "node:crypto";
|
|
1897
|
+
function summarizeTranscript(jsonl) {
|
|
1898
|
+
const seen = new Set;
|
|
1899
|
+
const components = {
|
|
1900
|
+
inputTokens: 0,
|
|
1901
|
+
outputTokens: 0,
|
|
1902
|
+
cacheCreationInputTokens: 0,
|
|
1903
|
+
cacheReadInputTokens: 0
|
|
1904
|
+
};
|
|
1905
|
+
let model = null;
|
|
1906
|
+
let messageCount = 0;
|
|
1907
|
+
for (const rawLine of jsonl.split(/\r?\n/)) {
|
|
1908
|
+
const line = rawLine.trim();
|
|
1909
|
+
if (!line)
|
|
1910
|
+
continue;
|
|
1911
|
+
let entry2;
|
|
1912
|
+
try {
|
|
1913
|
+
entry2 = JSON.parse(line);
|
|
1914
|
+
} catch {
|
|
1915
|
+
continue;
|
|
1916
|
+
}
|
|
1917
|
+
if (!entry2 || typeof entry2 !== "object")
|
|
1918
|
+
continue;
|
|
1919
|
+
const obj = entry2;
|
|
1920
|
+
if (obj.type !== "assistant")
|
|
1921
|
+
continue;
|
|
1922
|
+
const message = obj.message;
|
|
1923
|
+
const id = message?.id;
|
|
1924
|
+
const usage = message?.usage;
|
|
1925
|
+
if (typeof id !== "string" || !id || !usage || seen.has(id))
|
|
1926
|
+
continue;
|
|
1927
|
+
seen.add(id);
|
|
1928
|
+
messageCount++;
|
|
1929
|
+
components.inputTokens += numberOr(usage.input_tokens, 0);
|
|
1930
|
+
components.outputTokens += numberOr(usage.output_tokens, 0);
|
|
1931
|
+
components.cacheCreationInputTokens += numberOr(usage.cache_creation_input_tokens, 0);
|
|
1932
|
+
components.cacheReadInputTokens += numberOr(usage.cache_read_input_tokens, 0);
|
|
1933
|
+
const messageModel = message?.model;
|
|
1934
|
+
if (typeof messageModel === "string" && messageModel)
|
|
1935
|
+
model = messageModel;
|
|
1936
|
+
}
|
|
1937
|
+
return { components, model, messageCount };
|
|
1938
|
+
}
|
|
1939
|
+
function numberOr(value, fallback) {
|
|
1940
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1941
|
+
}
|
|
1942
|
+
function sanitizeKey(value) {
|
|
1943
|
+
return value.replace(/[^A-Za-z0-9]+/g, "-");
|
|
1944
|
+
}
|
|
1945
|
+
function collisionResistantKey(value) {
|
|
1946
|
+
const digest = createHash("sha256").update(value).digest("hex");
|
|
1947
|
+
return `${sanitizeKey(value)}-${digest}`;
|
|
1948
|
+
}
|
|
1949
|
+
function transcriptPointerPath(projectDir, tmpDir) {
|
|
1950
|
+
return `${tmpDir}/claude-transcript-${collisionResistantKey(projectDir)}.txt`;
|
|
1951
|
+
}
|
|
1952
|
+
function legacyTranscriptPointerPath(projectDir, tmpDir) {
|
|
1953
|
+
return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`;
|
|
1954
|
+
}
|
|
1955
|
+
function resolvePointer(explicitTranscriptPath, deps) {
|
|
1956
|
+
if (explicitTranscriptPath)
|
|
1957
|
+
return { path: explicitTranscriptPath, corroborated: true };
|
|
1958
|
+
const projectDir = deps.env.CLAUDE_PROJECT_DIR ?? deps.cwd;
|
|
1959
|
+
const tmpDir = deps.env.TMPDIR ?? "/tmp";
|
|
1960
|
+
const primaryPointerPath = transcriptPointerPath(projectDir, tmpDir);
|
|
1961
|
+
const legacyPointerPath = legacyTranscriptPointerPath(projectDir, tmpDir);
|
|
1962
|
+
const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID;
|
|
1963
|
+
const pointerPath = deps.exists(primaryPointerPath) ? primaryPointerPath : deps.exists(legacyPointerPath) ? legacyPointerPath : undefined;
|
|
1964
|
+
if (!pointerPath) {
|
|
1965
|
+
return {
|
|
1966
|
+
pointerExisted: false,
|
|
1967
|
+
corroborated: false,
|
|
1968
|
+
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."
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
let contents;
|
|
1972
|
+
try {
|
|
1973
|
+
contents = deps.readFile(pointerPath).replace(/\r?\n+$/, "");
|
|
1974
|
+
} catch (err) {
|
|
1975
|
+
return {
|
|
1976
|
+
pointerExisted: true,
|
|
1977
|
+
oursByLocation: true,
|
|
1978
|
+
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."
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
const [pointerSessionId, transcriptPath] = contents.split("\t");
|
|
1982
|
+
if (!transcriptPath) {
|
|
1983
|
+
return {
|
|
1984
|
+
pointerExisted: true,
|
|
1985
|
+
oursByLocation: true,
|
|
1986
|
+
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."
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
if (currentSessionId && pointerSessionId && currentSessionId !== pointerSessionId) {
|
|
1990
|
+
return {
|
|
1991
|
+
pointerExisted: true,
|
|
1992
|
+
corroborated: false,
|
|
1993
|
+
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."
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
return { path: transcriptPath, corroborated: Boolean(currentSessionId && pointerSessionId) };
|
|
1997
|
+
}
|
|
1998
|
+
function resolveMeteringCapability(deps, explicitTranscriptPath) {
|
|
1999
|
+
const resolved = resolvePointer(explicitTranscriptPath, deps);
|
|
2000
|
+
if ("error" in resolved) {
|
|
2001
|
+
const ours = resolved.pointerExisted && (resolved.corroborated || resolved.oursByLocation);
|
|
2002
|
+
if (ours)
|
|
2003
|
+
return { capable: false, reason: "pointer-unusable", detail: resolved.error };
|
|
2004
|
+
return {
|
|
2005
|
+
capable: false,
|
|
2006
|
+
reason: "no-transcript-resolved",
|
|
2007
|
+
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
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
const downstream = (r, detail) => resolved.corroborated ? { reason: r, detail } : {
|
|
2011
|
+
reason: "no-transcript-resolved",
|
|
2012
|
+
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})`
|
|
2013
|
+
};
|
|
2014
|
+
if (!deps.exists(resolved.path)) {
|
|
2015
|
+
return {
|
|
2016
|
+
capable: false,
|
|
2017
|
+
...downstream("transcript-unreadable", `Resolved transcript path ${resolved.path} is not readable as a regular file owned by this user.`)
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
let jsonl;
|
|
2021
|
+
try {
|
|
2022
|
+
jsonl = deps.readFile(resolved.path);
|
|
2023
|
+
} catch (err) {
|
|
2024
|
+
return {
|
|
2025
|
+
capable: false,
|
|
2026
|
+
...downstream("transcript-unreadable", `Transcript at ${resolved.path} could not be read: ${err.message}`)
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
const summary = summarizeTranscript(jsonl);
|
|
2030
|
+
if (summary.messageCount === 0) {
|
|
2031
|
+
return {
|
|
2032
|
+
capable: false,
|
|
2033
|
+
...downstream("transcript-empty", `Transcript at ${resolved.path} yielded zero assistant messages with usage data — ` + "it's empty, unparseable, or not yet flushed to disk.")
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
return { capable: true, transcriptPath: resolved.path, summary };
|
|
2037
|
+
}
|
|
2038
|
+
function isTokenCollectionWiringBroken(capability) {
|
|
2039
|
+
if (capability.capable)
|
|
2040
|
+
return false;
|
|
2041
|
+
return capability.reason !== "no-transcript-resolved";
|
|
2042
|
+
}
|
|
2043
|
+
// ../../packages/aeg-core/src/metering-io-guard.ts
|
|
2044
|
+
import { closeSync, constants as fsConstants, fstatSync, openSync, readFileSync } from "node:fs";
|
|
2045
|
+
var GUARD_OPEN_FLAGS = fsConstants.O_RDONLY | fsConstants.O_NONBLOCK | fsConstants.O_NOFOLLOW;
|
|
1789
2046
|
// ../../packages/aeg-core/src/file-classify.ts
|
|
1790
2047
|
function isCodeFile(p) {
|
|
1791
2048
|
if (p.endsWith(".md"))
|
|
@@ -1992,7 +2249,7 @@ function overrideActive(opts) {
|
|
|
1992
2249
|
return false;
|
|
1993
2250
|
}
|
|
1994
2251
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
1995
|
-
import { createHash } from "node:crypto";
|
|
2252
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
1996
2253
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
1997
2254
|
function isPremiseHeader(line) {
|
|
1998
2255
|
const stripped = line.replace(/[*#]/g, "").trim();
|
|
@@ -2037,7 +2294,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
2037
2294
|
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2038
2295
|
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2039
2296
|
} else if (a.kind === "sha256") {
|
|
2040
|
-
const actual =
|
|
2297
|
+
const actual = createHash2("sha256").update(content).digest("hex");
|
|
2041
2298
|
if (actual !== a.value.toLowerCase()) {
|
|
2042
2299
|
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.`);
|
|
2043
2300
|
}
|
|
@@ -3217,6 +3474,100 @@ function parseGlossaryTerms(glossaryContent) {
|
|
|
3217
3474
|
}
|
|
3218
3475
|
return terms;
|
|
3219
3476
|
}
|
|
3477
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3478
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3479
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3480
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3481
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3482
|
+
function isValidCitedFilePath(path) {
|
|
3483
|
+
if (path.length === 0)
|
|
3484
|
+
return false;
|
|
3485
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3486
|
+
return false;
|
|
3487
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3488
|
+
return false;
|
|
3489
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3490
|
+
}
|
|
3491
|
+
function quotedCommandLineAt(content, index) {
|
|
3492
|
+
let line = 1;
|
|
3493
|
+
for (let i = 0;i < index; i++) {
|
|
3494
|
+
if (content.charCodeAt(i) === 10)
|
|
3495
|
+
line++;
|
|
3496
|
+
}
|
|
3497
|
+
return line;
|
|
3498
|
+
}
|
|
3499
|
+
function extractQuotedText(raw) {
|
|
3500
|
+
const trimmed = raw.trim();
|
|
3501
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3502
|
+
if (fenced)
|
|
3503
|
+
return (fenced[1] ?? "").trim();
|
|
3504
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3505
|
+
if (inline)
|
|
3506
|
+
return (inline[1] ?? "").trim();
|
|
3507
|
+
return trimmed;
|
|
3508
|
+
}
|
|
3509
|
+
function findQuotesInFile(path, content) {
|
|
3510
|
+
const masked = maskCode(content);
|
|
3511
|
+
const quotes = [];
|
|
3512
|
+
START_PATTERN.lastIndex = 0;
|
|
3513
|
+
let start = START_PATTERN.exec(masked);
|
|
3514
|
+
while (start !== null) {
|
|
3515
|
+
const citedFile = start[1];
|
|
3516
|
+
const innerStart = start.index + start[0].length;
|
|
3517
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3518
|
+
if (end === null) {
|
|
3519
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3520
|
+
start = START_PATTERN.exec(masked);
|
|
3521
|
+
continue;
|
|
3522
|
+
}
|
|
3523
|
+
const innerEnd = innerStart + end.index;
|
|
3524
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3525
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3526
|
+
if (quotedText.length > 0) {
|
|
3527
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3531
|
+
start = START_PATTERN.exec(masked);
|
|
3532
|
+
}
|
|
3533
|
+
return quotes;
|
|
3534
|
+
}
|
|
3535
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3536
|
+
const quotes = [];
|
|
3537
|
+
for (const file of files) {
|
|
3538
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3539
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3540
|
+
continue;
|
|
3541
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3542
|
+
}
|
|
3543
|
+
return quotes;
|
|
3544
|
+
}
|
|
3545
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3546
|
+
const findings = [];
|
|
3547
|
+
for (const quote of citedQuotes) {
|
|
3548
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3549
|
+
if (content === undefined) {
|
|
3550
|
+
findings.push({
|
|
3551
|
+
file: quote.file,
|
|
3552
|
+
line: quote.line,
|
|
3553
|
+
citedFile: quote.citedFile,
|
|
3554
|
+
quotedText: quote.quotedText,
|
|
3555
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3556
|
+
});
|
|
3557
|
+
continue;
|
|
3558
|
+
}
|
|
3559
|
+
if (!content.includes(quote.quotedText)) {
|
|
3560
|
+
findings.push({
|
|
3561
|
+
file: quote.file,
|
|
3562
|
+
line: quote.line,
|
|
3563
|
+
citedFile: quote.citedFile,
|
|
3564
|
+
quotedText: quote.quotedText,
|
|
3565
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3566
|
+
});
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
return findings;
|
|
3570
|
+
}
|
|
3220
3571
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
3221
3572
|
var RETIRED_PATTERNS = [
|
|
3222
3573
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -3330,6 +3681,10 @@ function checkDispatchReadiness(input) {
|
|
|
3330
3681
|
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.`);
|
|
3331
3682
|
}
|
|
3332
3683
|
for (const dep of input.dependsOn) {
|
|
3684
|
+
if (dep.resolved === false) {
|
|
3685
|
+
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.`);
|
|
3686
|
+
continue;
|
|
3687
|
+
}
|
|
3333
3688
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
3334
3689
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
3335
3690
|
blockers.push(`dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|
|
@@ -3703,7 +4058,7 @@ function collectAllPaths(dir, out = []) {
|
|
|
3703
4058
|
function main() {
|
|
3704
4059
|
const allPaths = WORKSPACE_DIRS.flatMap((d) => collectAllPaths(d)).map((p) => p.split("\\").join("/"));
|
|
3705
4060
|
const knownPaths = new Set(allPaths);
|
|
3706
|
-
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).map((p) => ({ path: p, content:
|
|
4061
|
+
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).map((p) => ({ path: p, content: readFileSync2(p, "utf8") }));
|
|
3707
4062
|
const findings = findWorkspaceEscapes(sourceFiles, knownPaths, WORKSPACE_DIRS);
|
|
3708
4063
|
console.log(`${CHECK_NAME}: ${sourceFiles.length} source file(s) scanned under ${WORKSPACE_DIRS.join("/")}; ${findings.length} finding(s)`);
|
|
3709
4064
|
for (const finding of findings) {
|