@attalabs/vinaya 0.9.0 → 0.12.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 +7 -5
- package/aeg-root/enforcement.md +3 -3
- package/aeg-root/glossary.md +4 -0
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer.md +29 -5
- package/aeg-root/roles/planner.md +1 -1
- package/aeg-root/roles/reviewer.md +1 -1
- package/aeg-root/roles/security.md +1 -1
- package/aeg-root/roles/tranche-archivist.md +1 -1
- package/aeg-root/state-machine.md +6 -6
- package/aeg-root/templates/pr-report-template.md +8 -4
- package/aeg-root/tranche-model.md +33 -11
- package/dist/checks/bin/check-branch-topology.js +204 -115
- package/dist/checks/bin/check-brief-shape.js +204 -115
- package/dist/checks/bin/check-closes-n.js +204 -115
- package/dist/checks/bin/check-coherence.js +204 -115
- package/dist/checks/bin/check-dead-branch-push.js +204 -115
- package/dist/checks/bin/check-dispatch-readiness.js +204 -115
- package/dist/checks/bin/check-doc-coverage-push.js +231 -124
- package/dist/checks/bin/check-doc-coverage.js +233 -126
- package/dist/checks/bin/check-evidence-fresh.js +3173 -0
- package/dist/checks/bin/check-first-push-dispatch.js +204 -115
- package/dist/checks/bin/check-issue-assignment.js +204 -115
- package/dist/checks/bin/check-no-disk-state.js +204 -115
- package/dist/checks/bin/check-reader-resolvable-prose.js +204 -115
- package/dist/checks/bin/check-registry-gates.js +204 -115
- package/dist/checks/bin/check-review-gate.js +204 -115
- package/dist/checks/bin/check-single-plan-pr.js +204 -115
- package/dist/checks/bin/check-test-plan.js +204 -115
- package/dist/index.js +487 -221
- 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/required-server-files.json +3 -1
- 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/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.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.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 +2 -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.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.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.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__029-1ch._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05t6482._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0gw1_g2._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0mdkphe._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0plfbyn._.js +45 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0q56ohl._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0rr_lq7._.js +51 -0
- 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]__1_ojzp1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1d_8nm4._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1p19382._.js → [root-of-the-server]__1wsl6ro._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1zkwtx8._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__210ehg9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_00yjcv1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rix02i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_18-d2be._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1fqw88f._.js +5 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1gw6vc9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_20yap_f._.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/{3zyedaek9nvr_.js → 1eo32v1tbjy7c.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1t7yy_s34022p.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3antrj5z0uf_c.js → 2ieu4oi-pp_bz.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/templates/custom-check.template.ts +5 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1s7kj3s._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1tswrm4._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_01jl99k._.js +0 -45
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_20c6-3m._.js +0 -45
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2e68sbtdhi5dg.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{pY8RKWuVAUZOjj2-bAYCY → ZHVE9Y9G8XKR91g27SgVX}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{pY8RKWuVAUZOjj2-bAYCY → ZHVE9Y9G8XKR91g27SgVX}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{pY8RKWuVAUZOjj2-bAYCY → ZHVE9Y9G8XKR91g27SgVX}/_ssgManifest.js +0 -0
|
@@ -5,7 +5,7 @@ import { execFile as execFile4, execFileSync as execFileSync3 } from "node:child
|
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import { join as join2 } from "node:path";
|
|
7
7
|
import { promisify as promisify4 } from "node:util";
|
|
8
|
-
// ../../packages/aeg-
|
|
8
|
+
// ../../packages/aeg-forge-state/src/strip-code.ts
|
|
9
9
|
function maskCode(body) {
|
|
10
10
|
const fill = (line) => " ".repeat(line.length);
|
|
11
11
|
return maskIndentedCode(maskFencedCode(body, fill), fill).replace(/(`+)[^\n]*?\1/g, (m) => " ".repeat(m.length));
|
|
@@ -22,29 +22,38 @@ function stripCode(body, options = {}) {
|
|
|
22
22
|
var FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})([^\r\n]*)\r?$/;
|
|
23
23
|
var FENCE_CLOSE = /^ {0,3}(`+|~+)[ \t]*\r?$/;
|
|
24
24
|
function maskFencedCode(body, fill) {
|
|
25
|
+
const { lines } = scanFencedCode(body);
|
|
26
|
+
return lines.map(({ line, inCode }) => inCode ? fill(line) : line).join(`
|
|
27
|
+
`);
|
|
28
|
+
}
|
|
29
|
+
function scanFencedCode(body) {
|
|
25
30
|
let fenceChar = null;
|
|
26
31
|
let fenceLen = 0;
|
|
27
|
-
|
|
32
|
+
const lines = body.split(`
|
|
28
33
|
`).map((line) => {
|
|
29
34
|
if (fenceChar === null) {
|
|
30
35
|
const open = line.match(FENCE_OPEN);
|
|
31
36
|
if (!open)
|
|
32
|
-
return line;
|
|
37
|
+
return { line, inCode: false };
|
|
33
38
|
const marker = open[1];
|
|
34
39
|
if (marker[0] === "`" && open[2].includes("`"))
|
|
35
|
-
return line;
|
|
40
|
+
return { line, inCode: false };
|
|
36
41
|
fenceChar = marker[0];
|
|
37
42
|
fenceLen = marker.length;
|
|
38
|
-
return
|
|
43
|
+
return { line, inCode: true };
|
|
39
44
|
}
|
|
40
45
|
const close = line.match(FENCE_CLOSE);
|
|
41
46
|
if (close && close[1][0] === fenceChar && close[1].length >= fenceLen) {
|
|
42
47
|
fenceChar = null;
|
|
43
48
|
fenceLen = 0;
|
|
44
49
|
}
|
|
45
|
-
return
|
|
46
|
-
})
|
|
47
|
-
|
|
50
|
+
return { line, inCode: true };
|
|
51
|
+
});
|
|
52
|
+
return { lines, unterminated: fenceChar !== null };
|
|
53
|
+
}
|
|
54
|
+
function hasUnterminatedFence(body) {
|
|
55
|
+
return scanFencedCode(body.replace(/\r\n?/g, `
|
|
56
|
+
`)).unterminated;
|
|
48
57
|
}
|
|
49
58
|
var LIST_MARKER = /^ {0,3}(?:[-*+]|\d{1,9}[.)])(?:\s|$)/;
|
|
50
59
|
function indentWidth(line) {
|
|
@@ -87,88 +96,7 @@ function maskIndentedCode(body, fill) {
|
|
|
87
96
|
return out.join(`
|
|
88
97
|
`);
|
|
89
98
|
}
|
|
90
|
-
|
|
91
|
-
const masked = maskCode(body);
|
|
92
|
-
const start = new RegExp(`<!--\\s*AEG:${field}:START\\s*-->`).exec(masked);
|
|
93
|
-
if (!start)
|
|
94
|
-
return null;
|
|
95
|
-
const afterStart = start.index + start[0].length;
|
|
96
|
-
const end = new RegExp(`<!--\\s*AEG:${field}:END\\s*-->`).exec(masked.slice(afterStart));
|
|
97
|
-
if (!end)
|
|
98
|
-
return null;
|
|
99
|
-
return body.slice(afterStart, afterStart + end.index);
|
|
100
|
-
}
|
|
101
|
-
// ../../packages/aeg-core/src/parse-registry.ts
|
|
102
|
-
function parseRegistry(md) {
|
|
103
|
-
const rows = readMarkdownTable(md, /^##\s+Registry\b/i);
|
|
104
|
-
const projects = [];
|
|
105
|
-
for (const row of rows) {
|
|
106
|
-
if (row.length < 4)
|
|
107
|
-
continue;
|
|
108
|
-
const name = stripBackticks(row[0] ?? "").trim();
|
|
109
|
-
const path = stripBackticks(row[1] ?? "").trim();
|
|
110
|
-
const specsPath = stripBackticks(row[2] ?? "").trim();
|
|
111
|
-
const stateCell = (row[3] ?? "").trim();
|
|
112
|
-
if (!name || !path || !specsPath)
|
|
113
|
-
continue;
|
|
114
|
-
projects.push({
|
|
115
|
-
name,
|
|
116
|
-
path,
|
|
117
|
-
specsPath,
|
|
118
|
-
statePath: parseStateCell(stateCell)
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return projects;
|
|
122
|
-
}
|
|
123
|
-
function parseStateCell(cell) {
|
|
124
|
-
if (!cell)
|
|
125
|
-
return null;
|
|
126
|
-
const stripped = stripBackticks(cell).trim();
|
|
127
|
-
if (/^[\w./@-]+\/?$/.test(stripped) && cell.includes("`")) {
|
|
128
|
-
return stripped;
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
function stripBackticks(s) {
|
|
133
|
-
return s.replace(/`/g, "");
|
|
134
|
-
}
|
|
135
|
-
function readMarkdownTable(md, headingMatcher) {
|
|
136
|
-
const lines = md.split(/\r?\n/);
|
|
137
|
-
let i = 0;
|
|
138
|
-
for (;i < lines.length; i++) {
|
|
139
|
-
if (headingMatcher.test(lines[i] ?? "")) {
|
|
140
|
-
i++;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (i >= lines.length)
|
|
145
|
-
return [];
|
|
146
|
-
for (;i < lines.length; i++) {
|
|
147
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
if (i + 1 >= lines.length)
|
|
151
|
-
return [];
|
|
152
|
-
i += 2;
|
|
153
|
-
const out = [];
|
|
154
|
-
for (;i < lines.length; i++) {
|
|
155
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
156
|
-
if (!trimmed.startsWith("|"))
|
|
157
|
-
break;
|
|
158
|
-
out.push(splitTableRow(trimmed));
|
|
159
|
-
}
|
|
160
|
-
return out;
|
|
161
|
-
}
|
|
162
|
-
function splitTableRow(row) {
|
|
163
|
-
const PLACEHOLDER = "\x00PIPE\x00";
|
|
164
|
-
const escaped = row.replace(/\\\|/g, PLACEHOLDER);
|
|
165
|
-
const parts = escaped.split("|").map((s) => s.trim());
|
|
166
|
-
if (parts.length && parts[0] === "")
|
|
167
|
-
parts.shift();
|
|
168
|
-
if (parts.length && parts[parts.length - 1] === "")
|
|
169
|
-
parts.pop();
|
|
170
|
-
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
171
|
-
}
|
|
99
|
+
|
|
172
100
|
// ../../packages/aeg-forge-state/src/parse-rationale-deps.ts
|
|
173
101
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
174
102
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
@@ -466,11 +394,37 @@ function findTrancheSlug(names) {
|
|
|
466
394
|
var TITLE_PATTERN = /^\[([^\]]+)]\s*(\S+)\s*—\s*(.+)$/;
|
|
467
395
|
var PROJECT_SLUG = /^[a-z0-9][a-z0-9-]*$/i;
|
|
468
396
|
var PROJECT_FIELD = /^\s*(?:\*\*)?Project(?:\(s\))?(?:\*\*)?\s*:\s*(?:\*\*)?\s*(.+)$/im;
|
|
397
|
+
var VALUE_EDGE_MARKUP = /^[`.;\s]+|[`.;\s]+$/g;
|
|
398
|
+
function unwrapValue(raw) {
|
|
399
|
+
return raw.replace(/\*\*/g, "").replace(VALUE_EDGE_MARKUP, "");
|
|
400
|
+
}
|
|
401
|
+
function projectFieldFromBody(body) {
|
|
402
|
+
const m = stripCode(body, { inlineSpans: "keep" }).match(PROJECT_FIELD);
|
|
403
|
+
if (m)
|
|
404
|
+
return parseFieldValue(m[1] ?? "");
|
|
405
|
+
if (hasUnterminatedFence(body)) {
|
|
406
|
+
const raw = body.match(PROJECT_FIELD);
|
|
407
|
+
if (raw)
|
|
408
|
+
return { declared: true, names: [], unparsed: [(raw[1] ?? "").trim()], unreadable: true };
|
|
409
|
+
}
|
|
410
|
+
return { declared: false, names: [], unparsed: [], unreadable: false };
|
|
411
|
+
}
|
|
412
|
+
function parseFieldValue(value) {
|
|
413
|
+
const names = [];
|
|
414
|
+
const unparsed = [];
|
|
415
|
+
for (const raw of value.split(",")) {
|
|
416
|
+
const name = unwrapValue(raw);
|
|
417
|
+
if (name.length === 0)
|
|
418
|
+
continue;
|
|
419
|
+
if (PROJECT_SLUG.test(name))
|
|
420
|
+
names.push(name);
|
|
421
|
+
else
|
|
422
|
+
unparsed.push(raw.trim());
|
|
423
|
+
}
|
|
424
|
+
return { declared: true, names: [...new Set(names)], unparsed, unreadable: false };
|
|
425
|
+
}
|
|
469
426
|
function projectsFromBody(body) {
|
|
470
|
-
|
|
471
|
-
if (!m)
|
|
472
|
-
return [];
|
|
473
|
-
return (m[1] ?? "").split(",").map((s) => s.trim()).filter((s) => PROJECT_SLUG.test(s));
|
|
427
|
+
return projectFieldFromBody(body).names;
|
|
474
428
|
}
|
|
475
429
|
function taskFromIssue(issue) {
|
|
476
430
|
const m = issue.title.match(TITLE_PATTERN);
|
|
@@ -512,8 +466,8 @@ function tasksFromIssues(issues) {
|
|
|
512
466
|
}
|
|
513
467
|
return tasks.sort((a, b) => compareTaskIds(a.id, b.id));
|
|
514
468
|
}
|
|
515
|
-
async function
|
|
516
|
-
return
|
|
469
|
+
async function fetchTrancheIssuesAsync(owner, repo, slug) {
|
|
470
|
+
return ghIssueListByAnyLabelAsync(owner, repo, [trancheLabel(slug)]);
|
|
517
471
|
}
|
|
518
472
|
function resolveTaskIssueRef(title, labels) {
|
|
519
473
|
const m = title.match(TITLE_PATTERN);
|
|
@@ -529,17 +483,20 @@ function resolveTaskIssueRef(title, labels) {
|
|
|
529
483
|
}
|
|
530
484
|
|
|
531
485
|
// ../../packages/aeg-forge-state/src/derive-from-forge.ts
|
|
532
|
-
|
|
533
|
-
const milestone = known ?? findMilestoneForSlug(owner, repo, slug);
|
|
534
|
-
const tasks = await listTasksForSlugAsync(owner, repo, slug);
|
|
486
|
+
function trancheFromIssues(slug, issues, known) {
|
|
535
487
|
return {
|
|
536
488
|
name: slug,
|
|
537
|
-
lifecycle:
|
|
538
|
-
goal:
|
|
539
|
-
tasks,
|
|
489
|
+
lifecycle: known?.lifecycle ?? "active",
|
|
490
|
+
goal: known?.goal ?? "",
|
|
491
|
+
tasks: tasksFromIssues(issues),
|
|
540
492
|
backlog: []
|
|
541
493
|
};
|
|
542
494
|
}
|
|
495
|
+
async function deriveTrancheFromForge(owner, repo, slug, known) {
|
|
496
|
+
const milestone = known ?? findMilestoneForSlug(owner, repo, slug);
|
|
497
|
+
const issues = await fetchTrancheIssuesAsync(owner, repo, slug);
|
|
498
|
+
return trancheFromIssues(slug, issues, milestone);
|
|
499
|
+
}
|
|
543
500
|
// ../../node_modules/universal-user-agent/index.js
|
|
544
501
|
function getUserAgent() {
|
|
545
502
|
if (typeof navigator === "object" && "userAgent" in navigator) {
|
|
@@ -1459,6 +1416,96 @@ var systemEnv3 = {
|
|
|
1459
1416
|
...process.env,
|
|
1460
1417
|
PATH: [process.env.PATH, "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"].filter(Boolean).join(":")
|
|
1461
1418
|
};
|
|
1419
|
+
// ../../packages/aeg-core/src/anchored-region.ts
|
|
1420
|
+
function anchoredRegionBounds(body, field) {
|
|
1421
|
+
const masked = maskCode(body);
|
|
1422
|
+
const start = new RegExp(`<!--\\s*AEG:${field}:START\\s*-->`).exec(masked);
|
|
1423
|
+
if (!start)
|
|
1424
|
+
return null;
|
|
1425
|
+
const innerStart = start.index + start[0].length;
|
|
1426
|
+
const end = new RegExp(`<!--\\s*AEG:${field}:END\\s*-->`).exec(masked.slice(innerStart));
|
|
1427
|
+
if (!end)
|
|
1428
|
+
return null;
|
|
1429
|
+
const innerEnd = innerStart + end.index;
|
|
1430
|
+
return { outerStart: start.index, outerEnd: innerEnd + end[0].length, innerStart, innerEnd };
|
|
1431
|
+
}
|
|
1432
|
+
function anchoredRegion(body, field) {
|
|
1433
|
+
const bounds = anchoredRegionBounds(body, field);
|
|
1434
|
+
if (!bounds)
|
|
1435
|
+
return null;
|
|
1436
|
+
return body.slice(bounds.innerStart, bounds.innerEnd);
|
|
1437
|
+
}
|
|
1438
|
+
// ../../packages/aeg-core/src/parse-registry.ts
|
|
1439
|
+
function parseRegistry(md) {
|
|
1440
|
+
const rows = readMarkdownTable(md, /^##\s+Registry\b/i);
|
|
1441
|
+
const projects = [];
|
|
1442
|
+
for (const row of rows) {
|
|
1443
|
+
if (row.length < 4)
|
|
1444
|
+
continue;
|
|
1445
|
+
const name = stripBackticks(row[0] ?? "").trim();
|
|
1446
|
+
const path = stripBackticks(row[1] ?? "").trim();
|
|
1447
|
+
const specsPath = stripBackticks(row[2] ?? "").trim();
|
|
1448
|
+
const stateCell = (row[3] ?? "").trim();
|
|
1449
|
+
if (!name || !path || !specsPath)
|
|
1450
|
+
continue;
|
|
1451
|
+
projects.push({
|
|
1452
|
+
name,
|
|
1453
|
+
path,
|
|
1454
|
+
specsPath,
|
|
1455
|
+
statePath: parseStateCell(stateCell)
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
return projects;
|
|
1459
|
+
}
|
|
1460
|
+
function parseStateCell(cell) {
|
|
1461
|
+
if (!cell)
|
|
1462
|
+
return null;
|
|
1463
|
+
const stripped = stripBackticks(cell).trim();
|
|
1464
|
+
if (/^[\w./@-]+\/?$/.test(stripped) && cell.includes("`")) {
|
|
1465
|
+
return stripped;
|
|
1466
|
+
}
|
|
1467
|
+
return null;
|
|
1468
|
+
}
|
|
1469
|
+
function stripBackticks(s) {
|
|
1470
|
+
return s.replace(/`/g, "");
|
|
1471
|
+
}
|
|
1472
|
+
function readMarkdownTable(md, headingMatcher) {
|
|
1473
|
+
const lines = md.split(/\r?\n/);
|
|
1474
|
+
let i = 0;
|
|
1475
|
+
for (;i < lines.length; i++) {
|
|
1476
|
+
if (headingMatcher.test(lines[i] ?? "")) {
|
|
1477
|
+
i++;
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
if (i >= lines.length)
|
|
1482
|
+
return [];
|
|
1483
|
+
for (;i < lines.length; i++) {
|
|
1484
|
+
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1485
|
+
break;
|
|
1486
|
+
}
|
|
1487
|
+
if (i + 1 >= lines.length)
|
|
1488
|
+
return [];
|
|
1489
|
+
i += 2;
|
|
1490
|
+
const out = [];
|
|
1491
|
+
for (;i < lines.length; i++) {
|
|
1492
|
+
const trimmed = (lines[i] ?? "").trim();
|
|
1493
|
+
if (!trimmed.startsWith("|"))
|
|
1494
|
+
break;
|
|
1495
|
+
out.push(splitTableRow(trimmed));
|
|
1496
|
+
}
|
|
1497
|
+
return out;
|
|
1498
|
+
}
|
|
1499
|
+
function splitTableRow(row) {
|
|
1500
|
+
const PLACEHOLDER = "\x00PIPE\x00";
|
|
1501
|
+
const escaped = row.replace(/\\\|/g, PLACEHOLDER);
|
|
1502
|
+
const parts = escaped.split("|").map((s) => s.trim());
|
|
1503
|
+
if (parts.length && parts[0] === "")
|
|
1504
|
+
parts.shift();
|
|
1505
|
+
if (parts.length && parts[parts.length - 1] === "")
|
|
1506
|
+
parts.pop();
|
|
1507
|
+
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1508
|
+
}
|
|
1462
1509
|
// ../../packages/aeg-core/src/state-machine-model.ts
|
|
1463
1510
|
var FORGE_FACT_INPUTS = [
|
|
1464
1511
|
{
|
|
@@ -1962,23 +2009,65 @@ function checkIssueRationale(body) {
|
|
|
1962
2009
|
function isTaskIssueLabelSet(labels) {
|
|
1963
2010
|
return hasLabel("tranche", labels);
|
|
1964
2011
|
}
|
|
2012
|
+
function isControlCodePoint(codePoint) {
|
|
2013
|
+
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
2014
|
+
}
|
|
2015
|
+
function isDisplayControlCodePoint(codePoint) {
|
|
2016
|
+
return codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
2017
|
+
}
|
|
2018
|
+
var MESSAGE_VALUE_COUNT_MAX = 5;
|
|
2019
|
+
function residueForMessage(values) {
|
|
2020
|
+
const shown = values.slice(0, MESSAGE_VALUE_COUNT_MAX).map((v) => `\`${forMessage(v)}\``);
|
|
2021
|
+
const rest = values.length - shown.length;
|
|
2022
|
+
return rest > 0 ? `${shown.join(", ")} and ${rest} more` : shown.join(", ");
|
|
2023
|
+
}
|
|
2024
|
+
var MESSAGE_VALUE_MAX = 64;
|
|
2025
|
+
function forMessage(value) {
|
|
2026
|
+
const kept = [];
|
|
2027
|
+
for (const ch of value.replace(/\s+/g, " ")) {
|
|
2028
|
+
const codePoint = ch.codePointAt(0) ?? 0;
|
|
2029
|
+
if (isControlCodePoint(codePoint) || isDisplayControlCodePoint(codePoint))
|
|
2030
|
+
continue;
|
|
2031
|
+
kept.push(ch);
|
|
2032
|
+
}
|
|
2033
|
+
const cleaned = kept.join("").trim();
|
|
2034
|
+
if (cleaned.length === 0)
|
|
2035
|
+
return "(unprintable)";
|
|
2036
|
+
const points = Array.from(cleaned);
|
|
2037
|
+
return points.length > MESSAGE_VALUE_MAX ? `${points.slice(0, MESSAGE_VALUE_MAX).join("")}…` : cleaned;
|
|
2038
|
+
}
|
|
1965
2039
|
function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
1966
2040
|
if (registeredNames.length === 0)
|
|
1967
2041
|
return { status: "pass", errors: [] };
|
|
1968
|
-
const
|
|
1969
|
-
|
|
1970
|
-
if (unregistered.length === 0)
|
|
2042
|
+
const field = projectFieldFromBody(body);
|
|
2043
|
+
if (!field.declared)
|
|
1971
2044
|
return { status: "pass", errors: [] };
|
|
1972
|
-
const
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2045
|
+
const known = new Set(registeredNames.map((n) => n.trim()));
|
|
2046
|
+
const registeredList = [...registeredNames].map(forMessage).join(", ");
|
|
2047
|
+
const errors = [];
|
|
2048
|
+
if (field.unreadable) {
|
|
2049
|
+
return {
|
|
2050
|
+
status: "fail",
|
|
2051
|
+
errors: [
|
|
2052
|
+
`issue-validation project registry: the body has an unterminated code fence, so its \`**Project:**\` field could not be read reliably — the fence runs to end of body (CommonMark, and how the forge renders it), swallowing everything after it including the foot field where the declaration lives by convention. Read from the raw body the field says ${residueForMessage(field.unparsed) || "(nothing)"}, but a line inside a swallowed region may be a quoted example rather than a real declaration, so this gate refuses rather than guessing which. Balance the fences — every opening run of backticks or tildes needs a closing run at least as long — and the field reads normally.`
|
|
2053
|
+
]
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
const unregistered = field.names.filter((p) => !known.has(p));
|
|
2057
|
+
if (unregistered.length > 0) {
|
|
2058
|
+
const caseHints = unregistered.map((p) => {
|
|
2059
|
+
const row = [...known].find((k) => k.toLowerCase() === p.toLowerCase());
|
|
2060
|
+
return row ? `\`${forMessage(p)}\` differs from the registered \`${forMessage(row)}\` only in case` : null;
|
|
2061
|
+
}).filter((h) => h !== null);
|
|
2062
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field declares ${unregistered.map(forMessage).join(", ")} — no such row in \`.vinaya/projects.md\`, which is the authority for valid project names (registered: ${registeredList}). Fix the name, or register the project with \`vinaya init product <name> --path <folder>\` first; an unregistered project has no specs to read and no per-project state to update.${caseHints.length > 0 ? ` Note: ${caseHints.join("; ")} — project names are matched exactly, because every downstream consumer compares them literally.` : ""} This reads the same field \`projectsFromBody\` derives the task's project from, so a name here that is not a row is a task that resolves to a project that does not exist.`);
|
|
2063
|
+
}
|
|
2064
|
+
if (field.names.length === 0) {
|
|
2065
|
+
const residue = field.unparsed.length > 0 ? ` — ${residueForMessage(field.unparsed)}` : " — the field is empty";
|
|
2066
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field is present but resolves to no project name${residue} (registered: ${registeredList}). A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); prose, a parenthetical, or a sentence in this field resolves to no project at all, and this gate cannot check a name it never receives — which is how a declaration like this used to pass. Write the registered name on its own, or register the project with \`vinaya init product <name> --path <folder>\` first. If the task genuinely touches no registered project, omit the field rather than explaining its absence inside it — \`checkIssueRationale\` already requires the \`Project(s) + blast radius\` narrative field for that.`);
|
|
2067
|
+
} else if (field.unparsed.length > 0) {
|
|
2068
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field declares a value that is not a project name — ${residueForMessage(field.unparsed)} (registered: ${registeredList}). The rest of the field parsed, so this is a name the gate silently could not check rather than a field it could not read at all. A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); write it on its own, or drop it if it names no project.`);
|
|
2069
|
+
}
|
|
2070
|
+
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
1982
2071
|
}
|
|
1983
2072
|
|
|
1984
2073
|
// ../../packages/aeg-core/src/coherence-checks.ts
|