@attalabs/vinaya 0.33.0 → 0.35.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/LICENSE +104 -201
- package/README.md +1 -1
- package/aeg-root/enforcement.md +1 -1
- package/aeg-root/glossary.md +4 -0
- package/aeg-root/roles/developer.md +3 -0
- package/aeg-root/roles/operator.md +30 -10
- package/aeg-root/roles/planner/reference.md +3 -2
- package/aeg-root/roles/planner.md +3 -1
- package/aeg-root/templates/brief-template.md +9 -7
- package/aeg-root/templates/pr-report-template.md +3 -1
- package/dist/checks/bin/check-body-bare-digits.js +107 -28
- package/dist/checks/bin/check-branch-topology.js +94 -25
- package/dist/checks/bin/check-brief-shape.js +113 -33
- package/dist/checks/bin/check-changeset-coverage.js +369 -92
- package/dist/checks/bin/check-closes-n.js +94 -25
- package/dist/checks/bin/check-coherence.js +124 -29
- package/dist/checks/bin/check-dead-branch-push.js +79 -25
- package/dist/checks/bin/check-dispatch-readiness.js +122 -28
- package/dist/checks/bin/check-doc-coverage-push.js +365 -88
- package/dist/checks/bin/check-doc-coverage.js +367 -90
- package/dist/checks/bin/check-doctrine-no-procedures.js +107 -28
- package/dist/checks/bin/check-doctrine-portability.js +366 -89
- package/dist/checks/bin/check-evidence-fresh.js +338 -61
- package/dist/checks/bin/check-exec-bits.js +363 -86
- package/dist/checks/bin/check-first-push-dispatch.js +122 -28
- package/dist/checks/bin/check-issue-assignment.js +94 -25
- package/dist/checks/bin/check-issue-milestone-attach.js +79 -25
- package/dist/checks/bin/check-issue-objectives-numbering.js +606 -26
- package/dist/checks/bin/check-issue-parts-coverage.js +79 -25
- package/dist/checks/bin/check-issue-surface-globs.js +162 -34
- package/dist/checks/bin/check-issue-title-grammar.js +79 -25
- package/dist/checks/bin/check-issue-tranche-label.js +79 -25
- package/dist/checks/bin/check-main-branch-refusal.js +79 -25
- package/dist/checks/bin/check-no-disk-state.js +79 -25
- package/dist/checks/bin/check-pr-premise-reassert.js +107 -28
- package/dist/checks/bin/check-pr-report-density.js +79 -25
- package/dist/checks/bin/check-principal-test-plan-wait.js +79 -25
- package/dist/checks/bin/check-quoted-command.js +282 -39
- package/dist/checks/bin/check-reader-resolvable-prose.js +333 -47
- package/dist/checks/bin/check-registry-gates.js +79 -25
- package/dist/checks/bin/check-retired-vocabulary.js +282 -39
- package/dist/checks/bin/check-review-gate.js +111 -31
- package/dist/checks/bin/check-single-plan-pr.js +79 -25
- package/dist/checks/bin/check-surface-scope.js +94 -25
- package/dist/checks/bin/check-test-plan.js +79 -25
- package/dist/checks/bin/check-token-collection-wired.js +79 -25
- package/dist/checks/bin/check-token-report.js +79 -25
- package/dist/checks/bin/check-workspace-escape.js +364 -87
- package/dist/index.js +2713 -1609
- package/dist/lib/pre-push-cache-test-run.js +226 -16
- package/dist/lib/pre-push-select-tests.js +48 -5
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +153 -37
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +87 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +9 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +13 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +7 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +116 -20
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +100 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-cutovers.ts +49 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +60 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +138 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +26 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives-cutover-config.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +15 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +122 -23
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +18 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +24 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +15 -10
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +16 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +194 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +312 -53
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +62 -8
- 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.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.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.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 +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.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/[root-of-the-server]__02a-3g8._.js +4 -4
- 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]__074w9nf._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__18paley._.js → [root-of-the-server]__0zc_0gx._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.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/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.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 +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{22s44f5k3ecmj.js → 3goaig_rysc6p.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1ce2dj27_cgbj.js → 3ip5z3cf43bgo.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{34hhdtbp20krb.js → 3u9emqjwpd0t9.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
- /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → ca66rAHI_w9D7S7ceXDvR}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → ca66rAHI_w9D7S7ceXDvR}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → ca66rAHI_w9D7S7ceXDvR}/_ssgManifest.js +0 -0
|
@@ -193,8 +193,8 @@ function maskIndentedCode(body, fill) {
|
|
|
193
193
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
194
194
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
195
195
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
196
|
-
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d
|
|
197
|
-
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+
|
|
196
|
+
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
|
|
197
|
+
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
|
|
198
198
|
function splitSlugQualifiedEdge(edge) {
|
|
199
199
|
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
200
200
|
if (!m)
|
|
@@ -2615,7 +2615,7 @@ function isIssueNotFoundError(err) {
|
|
|
2615
2615
|
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2616
2616
|
}
|
|
2617
2617
|
function resolveObjectivesSource(prBody, issue, cutoverIssue) {
|
|
2618
|
-
if (issue !== null && issue < cutoverIssue)
|
|
2618
|
+
if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
|
|
2619
2619
|
return { kind: "none" };
|
|
2620
2620
|
if (issue !== null)
|
|
2621
2621
|
return { kind: "issue", issue };
|
|
@@ -2891,9 +2891,18 @@ var COMMIT_TYPES = [
|
|
|
2891
2891
|
];
|
|
2892
2892
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2893
2893
|
function checkForgeTitle(title) {
|
|
2894
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
2894
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
|
|
2895
2895
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2896
2896
|
return { status: "pass", errors: [] };
|
|
2897
|
+
const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
|
|
2898
|
+
if (letteredTaskId) {
|
|
2899
|
+
return {
|
|
2900
|
+
status: "fail",
|
|
2901
|
+
errors: [
|
|
2902
|
+
`brief-validation title: "${title}" names task id \`${letteredTaskId[1]}\` — task ids are whole numbers (\`1\`, \`2\`), never lettered (\`2a\`). \`vinaya task run\` and \`task dispatch\` refuse a non-numeric id, so a plan titled this way names a task that cannot be started.`
|
|
2903
|
+
]
|
|
2904
|
+
};
|
|
2905
|
+
}
|
|
2897
2906
|
return {
|
|
2898
2907
|
status: "fail",
|
|
2899
2908
|
errors: [
|
|
@@ -2926,19 +2935,31 @@ function checkNoAgentBoxes(prBody) {
|
|
|
2926
2935
|
]
|
|
2927
2936
|
};
|
|
2928
2937
|
}
|
|
2929
|
-
function
|
|
2938
|
+
function rolloutRuleFor(message) {
|
|
2930
2939
|
if (message.startsWith("brief-validation unpinned code claim:") || message.startsWith("brief-validation commands carry output:") || message.startsWith("brief-validation consumer tests:") || message.startsWith("brief-validation defeat cases:")) {
|
|
2931
|
-
return
|
|
2940
|
+
return "briefRules";
|
|
2932
2941
|
}
|
|
2933
2942
|
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2934
|
-
return
|
|
2943
|
+
return "agentBoxes";
|
|
2935
2944
|
return null;
|
|
2936
2945
|
}
|
|
2937
|
-
|
|
2946
|
+
var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
|
|
2947
|
+
briefRulesSincePr: BRIEF_RULES_SINCE_PR,
|
|
2948
|
+
agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
|
|
2949
|
+
};
|
|
2950
|
+
function rolloutThresholdFor(message, cutovers) {
|
|
2951
|
+
const rule = rolloutRuleFor(message);
|
|
2952
|
+
if (rule === "briefRules")
|
|
2953
|
+
return cutovers.briefRulesSincePr;
|
|
2954
|
+
if (rule === "agentBoxes")
|
|
2955
|
+
return cutovers.agentBoxesRefusedSincePr;
|
|
2956
|
+
return null;
|
|
2957
|
+
}
|
|
2958
|
+
function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
|
|
2938
2959
|
const blocking = [];
|
|
2939
2960
|
const info = [];
|
|
2940
2961
|
for (const e of errors) {
|
|
2941
|
-
const threshold = rolloutThresholdFor(e);
|
|
2962
|
+
const threshold = rolloutThresholdFor(e, cutovers);
|
|
2942
2963
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2943
2964
|
(grandfathered ? info : blocking).push(e);
|
|
2944
2965
|
}
|
|
@@ -3406,8 +3427,8 @@ function checkIssueRationale(body) {
|
|
|
3406
3427
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3407
3428
|
}
|
|
3408
3429
|
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3409
|
-
function checkIssueObjectives(body, issueNumber) {
|
|
3410
|
-
if (issueNumber !== null && issueNumber <
|
|
3430
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3431
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3411
3432
|
return { status: "pass", errors: [] };
|
|
3412
3433
|
const result = objectivesOf(body);
|
|
3413
3434
|
if (result.ok)
|
|
@@ -3483,6 +3504,8 @@ function parseIssueSurface(body) {
|
|
|
3483
3504
|
function globCoversPath(glob, path) {
|
|
3484
3505
|
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3485
3506
|
const p = path.replace(/\/+$/, "");
|
|
3507
|
+
if (g === "*")
|
|
3508
|
+
return !p.includes("/");
|
|
3486
3509
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3487
3510
|
}
|
|
3488
3511
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
@@ -3852,7 +3875,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3852
3875
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3853
3876
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3854
3877
|
}
|
|
3855
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3878
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3856
3879
|
const failures = [];
|
|
3857
3880
|
for (const [slug, issues] of issuesBySlug) {
|
|
3858
3881
|
for (const issue of issues) {
|
|
@@ -3861,7 +3884,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3861
3884
|
const errors = [
|
|
3862
3885
|
...checkIssueRationale(issue.body).errors,
|
|
3863
3886
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3864
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3887
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3865
3888
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3866
3889
|
];
|
|
3867
3890
|
if (errors.length === 0)
|
|
@@ -4484,13 +4507,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4484
4507
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4485
4508
|
return `${shipsPrefix}tranches/completed/`;
|
|
4486
4509
|
}
|
|
4487
|
-
|
|
4488
|
-
|
|
4510
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4511
|
+
function normalizeSpecPath(entry) {
|
|
4512
|
+
let out = entry.replace(/\\/g, "/");
|
|
4513
|
+
while (out.startsWith("./"))
|
|
4514
|
+
out = out.slice(2);
|
|
4515
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4516
|
+
while (out.endsWith("/"))
|
|
4517
|
+
out = out.slice(0, -1);
|
|
4518
|
+
return out;
|
|
4519
|
+
}
|
|
4520
|
+
function isSpecFile2(path, specPaths) {
|
|
4521
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4522
|
+
return true;
|
|
4523
|
+
if (!path.endsWith(".md"))
|
|
4524
|
+
return false;
|
|
4525
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4489
4526
|
}
|
|
4490
4527
|
function isClaudeMdFile(path) {
|
|
4491
4528
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4492
4529
|
}
|
|
4493
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4530
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4494
4531
|
if (path.startsWith(shipsPrefix)) {
|
|
4495
4532
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4496
4533
|
}
|
|
@@ -4499,7 +4536,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4499
4536
|
}
|
|
4500
4537
|
if (isClaudeMdFile(path))
|
|
4501
4538
|
return "internal";
|
|
4502
|
-
if (isSpecFile2(path))
|
|
4539
|
+
if (isSpecFile2(path, specPaths))
|
|
4503
4540
|
return "spec";
|
|
4504
4541
|
if (isProductScopeFile(path))
|
|
4505
4542
|
return "product";
|
|
@@ -4528,13 +4565,14 @@ function lineAt(content, index) {
|
|
|
4528
4565
|
}
|
|
4529
4566
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4530
4567
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4568
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4531
4569
|
function legacySlugPattern(legacySlugs) {
|
|
4532
4570
|
if (legacySlugs.length === 0)
|
|
4533
4571
|
return null;
|
|
4534
4572
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4535
4573
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4536
4574
|
}
|
|
4537
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4575
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4538
4576
|
const findings = [];
|
|
4539
4577
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4540
4578
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4546,8 +4584,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4546
4584
|
const productPatterns = [
|
|
4547
4585
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4548
4586
|
];
|
|
4587
|
+
const specPatterns = [
|
|
4588
|
+
...patterns,
|
|
4589
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4590
|
+
];
|
|
4549
4591
|
for (const file of files) {
|
|
4550
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4592
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4551
4593
|
if (!cls || cls === "internal")
|
|
4552
4594
|
continue;
|
|
4553
4595
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4556,15 +4598,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4556
4598
|
continue;
|
|
4557
4599
|
const blocking = cls === "product" || cls === "spec";
|
|
4558
4600
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4559
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4601
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4560
4602
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4561
4603
|
pattern.lastIndex = 0;
|
|
4562
4604
|
let match = pattern.exec(scrubbed);
|
|
4563
4605
|
while (match !== null) {
|
|
4564
4606
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4607
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4565
4608
|
findings.push({
|
|
4566
4609
|
file: file.path,
|
|
4567
|
-
line: lineAt(scrubbed,
|
|
4610
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4568
4611
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4569
4612
|
blocking
|
|
4570
4613
|
});
|
|
@@ -4750,9 +4793,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4750
4793
|
}
|
|
4751
4794
|
return findings;
|
|
4752
4795
|
}
|
|
4753
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4796
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4754
4797
|
return [
|
|
4755
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4798
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4756
4799
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4757
4800
|
];
|
|
4758
4801
|
}
|
|
@@ -5217,7 +5260,8 @@ var TaskStatusItemSchema = z.object({
|
|
|
5217
5260
|
}).merge(ObservedSchema);
|
|
5218
5261
|
var TaskStatusResultSchema = z.object({
|
|
5219
5262
|
items: z.array(TaskStatusItemSchema),
|
|
5220
|
-
nextCursor: z.string().nullable()
|
|
5263
|
+
nextCursor: z.string().nullable(),
|
|
5264
|
+
table: z.string()
|
|
5221
5265
|
});
|
|
5222
5266
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5223
5267
|
var EscalationInputsSchema = z.object({
|
|
@@ -5561,6 +5605,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5561
5605
|
}
|
|
5562
5606
|
return findings;
|
|
5563
5607
|
}
|
|
5608
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5609
|
+
var NO_GATE_CUTOVERS = {
|
|
5610
|
+
objectivesSinceIssue: null,
|
|
5611
|
+
briefSectionsSinceIssue: null,
|
|
5612
|
+
documentationSinceIssue: null,
|
|
5613
|
+
briefRulesSincePr: null,
|
|
5614
|
+
agentBoxesRefusedSincePr: null
|
|
5615
|
+
};
|
|
5564
5616
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5565
5617
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5566
5618
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -6010,6 +6062,8 @@ function attemptFromEnv(value) {
|
|
|
6010
6062
|
function provenanceFor(input) {
|
|
6011
6063
|
if (input.provenance)
|
|
6012
6064
|
return input.provenance;
|
|
6065
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6066
|
+
return "unavailable";
|
|
6013
6067
|
if (input.env.role || input.env.task)
|
|
6014
6068
|
return "env_correlated";
|
|
6015
6069
|
return "unavailable";
|
|
@@ -6030,7 +6084,7 @@ function buildHeader(input) {
|
|
|
6030
6084
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6031
6085
|
const round = roundFromEnv(input.env.round);
|
|
6032
6086
|
const subject = {
|
|
6033
|
-
issue: issueFromTask(input.env.task),
|
|
6087
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6034
6088
|
role,
|
|
6035
6089
|
...round !== undefined ? { round } : {},
|
|
6036
6090
|
...input.subject ?? {}
|
|
@@ -6317,6 +6371,531 @@ function emitCheckError(error) {
|
|
|
6317
6371
|
`);
|
|
6318
6372
|
}
|
|
6319
6373
|
|
|
6374
|
+
// src/lib/config.ts
|
|
6375
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6376
|
+
import { promisify as promisify4 } from "node:util";
|
|
6377
|
+
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6378
|
+
import { homedir } from "node:os";
|
|
6379
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6380
|
+
import { z as z4 } from "zod";
|
|
6381
|
+
|
|
6382
|
+
// src/lib/agent-vendors.ts
|
|
6383
|
+
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
6384
|
+
|
|
6385
|
+
// src/lib/config.ts
|
|
6386
|
+
var EnvEntrySchema = z4.union([
|
|
6387
|
+
z4.literal(true),
|
|
6388
|
+
z4.object({ optional: z4.literal(true) }),
|
|
6389
|
+
z4.object({ anyOf: z4.array(z4.string()).min(2) }),
|
|
6390
|
+
z4.string()
|
|
6391
|
+
]);
|
|
6392
|
+
var CheckEntrySchema = z4.object({
|
|
6393
|
+
run: z4.string(),
|
|
6394
|
+
scope: z4.enum(["diff", "full"]),
|
|
6395
|
+
include: z4.array(z4.string()).optional(),
|
|
6396
|
+
args: z4.array(z4.string()).optional(),
|
|
6397
|
+
timeoutMs: z4.number().optional(),
|
|
6398
|
+
env: z4.record(z4.string(), EnvEntrySchema).optional(),
|
|
6399
|
+
requiresOpenPr: z4.boolean().optional(),
|
|
6400
|
+
ownWorkflow: z4.boolean().optional(),
|
|
6401
|
+
principalOwed: z4.literal(true).optional(),
|
|
6402
|
+
validates: z4.enum(["body", "issue"]).optional()
|
|
6403
|
+
}).superRefine((entry, ctx) => {
|
|
6404
|
+
if (!entry.env)
|
|
6405
|
+
return;
|
|
6406
|
+
for (const [key, value] of Object.entries(entry.env)) {
|
|
6407
|
+
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
6408
|
+
continue;
|
|
6409
|
+
const members = value.anyOf;
|
|
6410
|
+
if (new Set(members).size !== members.length) {
|
|
6411
|
+
ctx.addIssue({
|
|
6412
|
+
code: z4.ZodIssueCode.custom,
|
|
6413
|
+
message: `env.${key}.anyOf has duplicate members`,
|
|
6414
|
+
path: ["env", key, "anyOf"]
|
|
6415
|
+
});
|
|
6416
|
+
}
|
|
6417
|
+
if (!members.includes(key)) {
|
|
6418
|
+
ctx.addIssue({
|
|
6419
|
+
code: z4.ZodIssueCode.custom,
|
|
6420
|
+
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
6421
|
+
path: ["env", key, "anyOf"]
|
|
6422
|
+
});
|
|
6423
|
+
}
|
|
6424
|
+
}
|
|
6425
|
+
});
|
|
6426
|
+
var RoleEntrySchema = z4.object({
|
|
6427
|
+
contract: z4.string().refine((p) => p.includes("/"), {
|
|
6428
|
+
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
6429
|
+
})
|
|
6430
|
+
});
|
|
6431
|
+
var MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000;
|
|
6432
|
+
var BRIEF_BUILTINS = [
|
|
6433
|
+
"tier",
|
|
6434
|
+
"testPlan",
|
|
6435
|
+
"testPlanExclusivity",
|
|
6436
|
+
"principalPlaceholder",
|
|
6437
|
+
"surfaceMap",
|
|
6438
|
+
"docUpdateList",
|
|
6439
|
+
"worktreeStep0",
|
|
6440
|
+
"stopConditions",
|
|
6441
|
+
"autonomyClause",
|
|
6442
|
+
"project",
|
|
6443
|
+
"for",
|
|
6444
|
+
"closesN",
|
|
6445
|
+
"premiseCoverage",
|
|
6446
|
+
"issueRationale",
|
|
6447
|
+
"objectives",
|
|
6448
|
+
"briefSections",
|
|
6449
|
+
"milestoneShape"
|
|
6450
|
+
];
|
|
6451
|
+
var BriefSectionSchema = z4.union([
|
|
6452
|
+
z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
|
|
6453
|
+
z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
|
|
6454
|
+
z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
|
|
6455
|
+
z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
|
|
6456
|
+
]);
|
|
6457
|
+
var BriefSchemaSchema = z4.object({
|
|
6458
|
+
pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6459
|
+
issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6460
|
+
milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6461
|
+
ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
|
|
6462
|
+
});
|
|
6463
|
+
function isSafeRepoRelPath(p) {
|
|
6464
|
+
if (p.length === 0)
|
|
6465
|
+
return false;
|
|
6466
|
+
if (p.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(p))
|
|
6467
|
+
return false;
|
|
6468
|
+
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
6469
|
+
}
|
|
6470
|
+
var SafeRepoRelPath = z4.string().refine(isSafeRepoRelPath, {
|
|
6471
|
+
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
6472
|
+
});
|
|
6473
|
+
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
6474
|
+
function isCanonicalHookBlockPath(p) {
|
|
6475
|
+
return CANONICAL_HOOK_BLOCK_PREFIXES.some((prefix) => p.startsWith(prefix) && p.length > prefix.length);
|
|
6476
|
+
}
|
|
6477
|
+
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
6478
|
+
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
6479
|
+
});
|
|
6480
|
+
var ManagedBlockRecordSchema = z4.object({
|
|
6481
|
+
path: ManagedHookBlockPath,
|
|
6482
|
+
marker: z4.string(),
|
|
6483
|
+
comment: z4.enum(["hash", "html"])
|
|
6484
|
+
});
|
|
6485
|
+
var ManagedManifestSchema = z4.object({
|
|
6486
|
+
version: z4.number().int().positive(),
|
|
6487
|
+
files: z4.array(SafeRepoRelPath),
|
|
6488
|
+
blocks: z4.array(ManagedBlockRecordSchema),
|
|
6489
|
+
labels: z4.array(z4.string()),
|
|
6490
|
+
agents: z4.array(z4.enum(AGENT_VENDORS)).optional()
|
|
6491
|
+
});
|
|
6492
|
+
var ProjectEntrySchema = z4.object({
|
|
6493
|
+
name: z4.string().min(1),
|
|
6494
|
+
description: z4.string().min(1).optional(),
|
|
6495
|
+
path: z4.string().min(1).optional()
|
|
6496
|
+
});
|
|
6497
|
+
function parseTokensCollectDeclaration(value) {
|
|
6498
|
+
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
6499
|
+
if (!m)
|
|
6500
|
+
return null;
|
|
6501
|
+
const [, interpreter, script] = m;
|
|
6502
|
+
if (!isSafeRepoRelPath(script))
|
|
6503
|
+
return null;
|
|
6504
|
+
return { interpreter, script };
|
|
6505
|
+
}
|
|
6506
|
+
var VinayaConfigSchema = z4.object({
|
|
6507
|
+
rings: z4.object({
|
|
6508
|
+
ring1_forgeWriteInterception: z4.boolean(),
|
|
6509
|
+
ring2_asyncAudits: z4.boolean()
|
|
6510
|
+
}).optional(),
|
|
6511
|
+
checks: z4.record(z4.string(), CheckEntrySchema).optional(),
|
|
6512
|
+
roles: z4.record(z4.string(), RoleEntrySchema).optional(),
|
|
6513
|
+
briefSchema: BriefSchemaSchema.optional(),
|
|
6514
|
+
managed: ManagedManifestSchema.optional(),
|
|
6515
|
+
principals: z4.array(z4.string()).min(1).optional(),
|
|
6516
|
+
releaseActor: z4.string().min(1).optional(),
|
|
6517
|
+
ci: z4.object({ setup: z4.string().min(1) }).optional(),
|
|
6518
|
+
tokens: z4.object({
|
|
6519
|
+
collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
6520
|
+
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
6521
|
+
})
|
|
6522
|
+
}).optional(),
|
|
6523
|
+
blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
|
|
6524
|
+
proseGates: z4.object({
|
|
6525
|
+
doctrineRoot: z4.string().min(1).optional(),
|
|
6526
|
+
readerFacingPrefix: z4.string().min(1).optional(),
|
|
6527
|
+
readerFacingSuffix: z4.string().min(1).optional(),
|
|
6528
|
+
legacySlugDir: z4.string().min(1).optional(),
|
|
6529
|
+
sourceComments: z4.object({
|
|
6530
|
+
globs: z4.array(z4.string().min(1)).optional(),
|
|
6531
|
+
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6532
|
+
severity: z4.enum(["warning", "error"]).optional()
|
|
6533
|
+
}).optional(),
|
|
6534
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6535
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6536
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6537
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6538
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6539
|
+
})).optional()
|
|
6540
|
+
}).optional(),
|
|
6541
|
+
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6542
|
+
dispatch: z4.object({
|
|
6543
|
+
timeoutMs: z4.number().int().positive().optional(),
|
|
6544
|
+
killGraceMs: z4.number().int().positive().optional(),
|
|
6545
|
+
agent: z4.enum(["claude", "codex", "gemini"]).optional(),
|
|
6546
|
+
requireWorkerIsolation: z4.boolean().optional()
|
|
6547
|
+
}).optional(),
|
|
6548
|
+
reviewPolicy: z4.object({
|
|
6549
|
+
codeReviewThreshold: z4.string().min(1).optional(),
|
|
6550
|
+
securityThreshold: z4.string().min(1).optional(),
|
|
6551
|
+
maxRounds: z4.number().optional()
|
|
6552
|
+
}).optional(),
|
|
6553
|
+
gateCutovers: z4.object({
|
|
6554
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6555
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6556
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6557
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6558
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6559
|
+
}).optional(),
|
|
6560
|
+
prePush: z4.object({
|
|
6561
|
+
alwaysRun: z4.array(z4.string()).optional()
|
|
6562
|
+
}).optional(),
|
|
6563
|
+
report: z4.object({
|
|
6564
|
+
commandTimeoutMs: z4.number().int().positive().optional()
|
|
6565
|
+
}).superRefine((report, ctx) => {
|
|
6566
|
+
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6567
|
+
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6568
|
+
ctx.addIssue({
|
|
6569
|
+
code: z4.ZodIssueCode.custom,
|
|
6570
|
+
path: ["commandTimeoutMs"],
|
|
6571
|
+
message: "must be at most 3600000 (1 hour)"
|
|
6572
|
+
});
|
|
6573
|
+
}
|
|
6574
|
+
}).optional(),
|
|
6575
|
+
logPublish: z4.unknown().refine((v) => v === undefined, {
|
|
6576
|
+
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6577
|
+
}),
|
|
6578
|
+
runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6579
|
+
logs: z4.object({
|
|
6580
|
+
folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6581
|
+
url: z4.string().url().optional(),
|
|
6582
|
+
headers: z4.record(z4.string()).optional()
|
|
6583
|
+
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6584
|
+
message: "logs: set at most one of folder/url"
|
|
6585
|
+
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6586
|
+
message: "logs: headers requires url"
|
|
6587
|
+
}).optional()
|
|
6588
|
+
});
|
|
6589
|
+
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
6590
|
+
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
6591
|
+
var LOCAL_CONFIG_FILENAME = "vinaya.config.json";
|
|
6592
|
+
function findLocalConfig() {
|
|
6593
|
+
let dir = process.cwd();
|
|
6594
|
+
while (true) {
|
|
6595
|
+
const candidate = join(dir, LOCAL_CONFIG_FILENAME);
|
|
6596
|
+
if (existsSync(candidate))
|
|
6597
|
+
return candidate;
|
|
6598
|
+
if (existsSync(join(dir, ".git")))
|
|
6599
|
+
return null;
|
|
6600
|
+
const parent = dirname(dir);
|
|
6601
|
+
if (parent === dir)
|
|
6602
|
+
return null;
|
|
6603
|
+
dir = parent;
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
function configPath() {
|
|
6607
|
+
const local = findLocalConfig();
|
|
6608
|
+
if (local)
|
|
6609
|
+
return local;
|
|
6610
|
+
if (existsSync(GLOBAL_CONFIG_PATH))
|
|
6611
|
+
return GLOBAL_CONFIG_PATH;
|
|
6612
|
+
return null;
|
|
6613
|
+
}
|
|
6614
|
+
function globalChecksIgnoredWarning(path) {
|
|
6615
|
+
return `${path}: "checks" registration in the global config is ignored — checks may only be registered from a repo-local vinaya.config.json.`;
|
|
6616
|
+
}
|
|
6617
|
+
function globalPrincipalsIgnoredWarning(path) {
|
|
6618
|
+
return `${path}: "principals" in the global config is ignored — principals may only be declared from a repo-local vinaya.config.json.`;
|
|
6619
|
+
}
|
|
6620
|
+
function globalRolesIgnoredWarning(path) {
|
|
6621
|
+
return `${path}: "roles" registration in the global config is ignored — roles may only be registered from a repo-local vinaya.config.json.`;
|
|
6622
|
+
}
|
|
6623
|
+
function globalReleaseActorIgnoredWarning(path) {
|
|
6624
|
+
return `${path}: "releaseActor" in the global config is ignored — releaseActor may only be declared from a repo-local vinaya.config.json.`;
|
|
6625
|
+
}
|
|
6626
|
+
function globalTokensCollectIgnoredWarning(path) {
|
|
6627
|
+
return `${path}: "tokens" in the global config is ignored — tokens.collect may only be declared from a repo-local vinaya.config.json.`;
|
|
6628
|
+
}
|
|
6629
|
+
function globalRuntimeDirIgnoredWarning(path) {
|
|
6630
|
+
return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
|
|
6631
|
+
}
|
|
6632
|
+
var emittedGlobalKeyWarnings = new Set;
|
|
6633
|
+
function warnGlobalKeyIgnoredOnce(message) {
|
|
6634
|
+
if (emittedGlobalKeyWarnings.has(message))
|
|
6635
|
+
return;
|
|
6636
|
+
emittedGlobalKeyWarnings.add(message);
|
|
6637
|
+
console.error(`⚠ ${message}`);
|
|
6638
|
+
}
|
|
6639
|
+
function stripGlobalOnlyKeys(config, path) {
|
|
6640
|
+
if (path !== GLOBAL_CONFIG_PATH)
|
|
6641
|
+
return config;
|
|
6642
|
+
let result = config;
|
|
6643
|
+
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
6644
|
+
warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
|
|
6645
|
+
result = { ...result, checks: undefined };
|
|
6646
|
+
}
|
|
6647
|
+
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
6648
|
+
warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
|
|
6649
|
+
result = { ...result, roles: undefined };
|
|
6650
|
+
}
|
|
6651
|
+
if (result.principals && result.principals.length > 0) {
|
|
6652
|
+
warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
|
|
6653
|
+
result = { ...result, principals: undefined };
|
|
6654
|
+
}
|
|
6655
|
+
if (result.releaseActor) {
|
|
6656
|
+
warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
|
|
6657
|
+
result = { ...result, releaseActor: undefined };
|
|
6658
|
+
}
|
|
6659
|
+
if (result.tokens) {
|
|
6660
|
+
warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
|
|
6661
|
+
result = { ...result, tokens: undefined };
|
|
6662
|
+
}
|
|
6663
|
+
if (result.runtimeDir) {
|
|
6664
|
+
warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
|
|
6665
|
+
result = { ...result, runtimeDir: undefined };
|
|
6666
|
+
}
|
|
6667
|
+
return result;
|
|
6668
|
+
}
|
|
6669
|
+
function resolvePrincipalAllowlist(config) {
|
|
6670
|
+
return config?.principals ?? PRINCIPAL_ALLOWLIST;
|
|
6671
|
+
}
|
|
6672
|
+
function resolveReleaseActor(config) {
|
|
6673
|
+
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
6674
|
+
}
|
|
6675
|
+
function resolveReviewPolicy(config) {
|
|
6676
|
+
const raw = config?.reviewPolicy;
|
|
6677
|
+
if (!raw)
|
|
6678
|
+
return DEFAULT_REVIEW_POLICY;
|
|
6679
|
+
const codeReviewThreshold = raw.codeReviewThreshold ?? DEFAULT_REVIEW_POLICY.codeReviewThreshold;
|
|
6680
|
+
if (!isKnownSeverity(CODE_REVIEW_SEVERITY_ORDER, codeReviewThreshold)) {
|
|
6681
|
+
throw new Error(`vinaya.config.json: reviewPolicy.codeReviewThreshold "${codeReviewThreshold}" is not one of ${CODE_REVIEW_SEVERITY_ORDER.join(" > ")} — fix the config, this never falls back to a default.`);
|
|
6682
|
+
}
|
|
6683
|
+
const securityThreshold = raw.securityThreshold ?? DEFAULT_REVIEW_POLICY.securityThreshold;
|
|
6684
|
+
if (!isKnownSeverity(SECURITY_SEVERITY_ORDER, securityThreshold)) {
|
|
6685
|
+
throw new Error(`vinaya.config.json: reviewPolicy.securityThreshold "${securityThreshold}" is not one of ${SECURITY_SEVERITY_ORDER.join(" > ")} — fix the config, this never falls back to a default.`);
|
|
6686
|
+
}
|
|
6687
|
+
const maxRounds = raw.maxRounds ?? DEFAULT_REVIEW_POLICY.maxRounds;
|
|
6688
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6689
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6690
|
+
}
|
|
6691
|
+
return {
|
|
6692
|
+
codeReviewThreshold,
|
|
6693
|
+
securityThreshold,
|
|
6694
|
+
maxRounds
|
|
6695
|
+
};
|
|
6696
|
+
}
|
|
6697
|
+
function resolveGateCutovers(config) {
|
|
6698
|
+
const raw = config?.gateCutovers;
|
|
6699
|
+
if (!raw)
|
|
6700
|
+
return NO_GATE_CUTOVERS;
|
|
6701
|
+
return {
|
|
6702
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6703
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6704
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6705
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6706
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6707
|
+
};
|
|
6708
|
+
}
|
|
6709
|
+
function resolveRuntimeDirSetting(config) {
|
|
6710
|
+
return config?.runtimeDir ?? null;
|
|
6711
|
+
}
|
|
6712
|
+
function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
|
|
6713
|
+
const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
|
|
6714
|
+
return anchored !== null && anchored === localRuntimeDir ? anchored : null;
|
|
6715
|
+
}
|
|
6716
|
+
function resolveLogsSetting(config) {
|
|
6717
|
+
const raw = config?.logs;
|
|
6718
|
+
if (!raw)
|
|
6719
|
+
return null;
|
|
6720
|
+
if (raw.url !== undefined)
|
|
6721
|
+
return { url: raw.url, headers: raw.headers };
|
|
6722
|
+
if (raw.folder !== undefined)
|
|
6723
|
+
return { folder: raw.folder };
|
|
6724
|
+
return null;
|
|
6725
|
+
}
|
|
6726
|
+
function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
6727
|
+
const anchored = resolveLogsSetting(trustAnchorConfig);
|
|
6728
|
+
if (!anchored)
|
|
6729
|
+
return null;
|
|
6730
|
+
if ("url" in local)
|
|
6731
|
+
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6732
|
+
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6733
|
+
}
|
|
6734
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6735
|
+
if (!headers)
|
|
6736
|
+
return;
|
|
6737
|
+
const resolved = {};
|
|
6738
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
6739
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6740
|
+
}
|
|
6741
|
+
return resolved;
|
|
6742
|
+
}
|
|
6743
|
+
function trustAnchorRepo() {
|
|
6744
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6745
|
+
if (fromRunner)
|
|
6746
|
+
return fromRunner;
|
|
6747
|
+
try {
|
|
6748
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6749
|
+
encoding: "utf-8",
|
|
6750
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
6751
|
+
});
|
|
6752
|
+
return trustAnchorRepoFromRemoteUrl(url);
|
|
6753
|
+
} catch {
|
|
6754
|
+
return null;
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
async function trustAnchorRepoAsync() {
|
|
6758
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6759
|
+
if (fromRunner)
|
|
6760
|
+
return fromRunner;
|
|
6761
|
+
try {
|
|
6762
|
+
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6763
|
+
encoding: "utf-8",
|
|
6764
|
+
timeout: 1e4,
|
|
6765
|
+
killSignal: "SIGKILL"
|
|
6766
|
+
});
|
|
6767
|
+
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6768
|
+
} catch {
|
|
6769
|
+
return null;
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
function wellFormedRepoSlug(slug) {
|
|
6773
|
+
return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
6774
|
+
}
|
|
6775
|
+
function trustAnchorRepoFromRunner() {
|
|
6776
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
6777
|
+
return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
|
|
6778
|
+
}
|
|
6779
|
+
function trustAnchorRepoFromRemoteUrl(url) {
|
|
6780
|
+
const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
6781
|
+
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6782
|
+
}
|
|
6783
|
+
var execFileAsync4 = promisify4(execFile4);
|
|
6784
|
+
function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
6785
|
+
const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
|
|
6786
|
+
if (!ref)
|
|
6787
|
+
return null;
|
|
6788
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
6789
|
+
return null;
|
|
6790
|
+
if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
|
|
6791
|
+
return null;
|
|
6792
|
+
return ref;
|
|
6793
|
+
}
|
|
6794
|
+
function readTrustAnchorConfigAtRef(ref) {
|
|
6795
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6796
|
+
encoding: "utf-8",
|
|
6797
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6798
|
+
timeout: 1e4
|
|
6799
|
+
});
|
|
6800
|
+
return Buffer.from(raw, "utf-8").toString("base64");
|
|
6801
|
+
}
|
|
6802
|
+
function ghFetchTrustAnchorConfig() {
|
|
6803
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6804
|
+
if (probeRef)
|
|
6805
|
+
return readTrustAnchorConfigAtRef(probeRef);
|
|
6806
|
+
const repo = trustAnchorRepo();
|
|
6807
|
+
if (!repo)
|
|
6808
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6809
|
+
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
6810
|
+
encoding: "utf-8",
|
|
6811
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
6812
|
+
});
|
|
6813
|
+
}
|
|
6814
|
+
async function ghFetchTrustAnchorConfigAsync() {
|
|
6815
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6816
|
+
if (probeRef) {
|
|
6817
|
+
const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6818
|
+
encoding: "utf-8",
|
|
6819
|
+
timeout: 1e4
|
|
6820
|
+
});
|
|
6821
|
+
return Buffer.from(stdout, "utf-8").toString("base64");
|
|
6822
|
+
}
|
|
6823
|
+
const repo = await trustAnchorRepoAsync();
|
|
6824
|
+
if (!repo)
|
|
6825
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6826
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
6827
|
+
return stdout;
|
|
6828
|
+
}
|
|
6829
|
+
function firstLine(err) {
|
|
6830
|
+
return err?.message?.split(`
|
|
6831
|
+
`)[0] ?? "unknown error";
|
|
6832
|
+
}
|
|
6833
|
+
function isMissingFileError(err) {
|
|
6834
|
+
const stderr = err?.stderr;
|
|
6835
|
+
const haystack = [
|
|
6836
|
+
err?.message ?? "",
|
|
6837
|
+
typeof stderr === "string" ? stderr : stderr?.toString() ?? ""
|
|
6838
|
+
].join(`
|
|
6839
|
+
`);
|
|
6840
|
+
return /\b404\b|not found/i.test(haystack);
|
|
6841
|
+
}
|
|
6842
|
+
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
6843
|
+
let base64;
|
|
6844
|
+
try {
|
|
6845
|
+
base64 = fetcher();
|
|
6846
|
+
} catch (err) {
|
|
6847
|
+
return trustAnchorFetchFailed(err);
|
|
6848
|
+
}
|
|
6849
|
+
return parseTrustAnchorContent(base64);
|
|
6850
|
+
}
|
|
6851
|
+
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
6852
|
+
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
6853
|
+
let base64;
|
|
6854
|
+
try {
|
|
6855
|
+
base64 = await fetcher();
|
|
6856
|
+
} catch (err) {
|
|
6857
|
+
return trustAnchorFetchFailed(err, warn);
|
|
6858
|
+
}
|
|
6859
|
+
return parseTrustAnchorContent(base64, warn);
|
|
6860
|
+
}
|
|
6861
|
+
function warnTrustAnchorFallback(why) {
|
|
6862
|
+
process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6863
|
+
`);
|
|
6864
|
+
}
|
|
6865
|
+
function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
6866
|
+
if (!isMissingFileError(err))
|
|
6867
|
+
warn(firstLine(err));
|
|
6868
|
+
return null;
|
|
6869
|
+
}
|
|
6870
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
6871
|
+
const base64 = content.trim();
|
|
6872
|
+
if (!base64)
|
|
6873
|
+
return null;
|
|
6874
|
+
try {
|
|
6875
|
+
const raw = Buffer.from(base64, "base64").toString("utf-8");
|
|
6876
|
+
const parsed = VinayaConfigSchema.safeParse(JSON.parse(raw));
|
|
6877
|
+
if (parsed.success)
|
|
6878
|
+
return parsed.data;
|
|
6879
|
+
warn("it did not satisfy the config schema");
|
|
6880
|
+
return null;
|
|
6881
|
+
} catch {
|
|
6882
|
+
warn("it was not readable as JSON");
|
|
6883
|
+
return null;
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
function loadConfig() {
|
|
6887
|
+
const path = configPath();
|
|
6888
|
+
if (!path)
|
|
6889
|
+
return null;
|
|
6890
|
+
try {
|
|
6891
|
+
const raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
6892
|
+
return stripGlobalOnlyKeys(VinayaConfigSchema.parse(raw), path);
|
|
6893
|
+
} catch {
|
|
6894
|
+
return null;
|
|
6895
|
+
}
|
|
6896
|
+
}
|
|
6897
|
+
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
6898
|
+
|
|
6320
6899
|
// src/checks/issue-check-env.ts
|
|
6321
6900
|
function nullIfEmpty(value) {
|
|
6322
6901
|
return value && value.length > 0 ? value : null;
|
|
@@ -6341,7 +6920,8 @@ function main() {
|
|
|
6341
6920
|
const { body, issueNumber } = readIssueCheckEnv();
|
|
6342
6921
|
if (!body)
|
|
6343
6922
|
process.exit(0);
|
|
6344
|
-
const
|
|
6923
|
+
const { objectivesSinceIssue } = resolveGateCutovers(loadConfig());
|
|
6924
|
+
const result = checkIssueObjectives(body, issueNumber, objectivesSinceIssue);
|
|
6345
6925
|
if (result.status === "pass")
|
|
6346
6926
|
process.exit(0);
|
|
6347
6927
|
for (const message of result.errors) {
|