@attalabs/vinaya 0.33.0 → 0.34.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/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 +2 -1
- 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 +102 -26
- package/dist/checks/bin/check-branch-topology.js +81 -25
- package/dist/checks/bin/check-brief-shape.js +108 -31
- package/dist/checks/bin/check-changeset-coverage.js +331 -87
- package/dist/checks/bin/check-closes-n.js +81 -25
- package/dist/checks/bin/check-coherence.js +108 -27
- package/dist/checks/bin/check-dead-branch-push.js +77 -25
- package/dist/checks/bin/check-dispatch-readiness.js +106 -26
- package/dist/checks/bin/check-doc-coverage-push.js +327 -83
- package/dist/checks/bin/check-doc-coverage.js +329 -85
- package/dist/checks/bin/check-doctrine-no-procedures.js +102 -26
- package/dist/checks/bin/check-doctrine-portability.js +328 -84
- package/dist/checks/bin/check-evidence-fresh.js +300 -56
- package/dist/checks/bin/check-exec-bits.js +325 -81
- package/dist/checks/bin/check-first-push-dispatch.js +106 -26
- package/dist/checks/bin/check-issue-assignment.js +81 -25
- package/dist/checks/bin/check-issue-milestone-attach.js +77 -25
- package/dist/checks/bin/check-issue-objectives-numbering.js +603 -26
- package/dist/checks/bin/check-issue-parts-coverage.js +77 -25
- package/dist/checks/bin/check-issue-surface-globs.js +146 -32
- package/dist/checks/bin/check-issue-title-grammar.js +77 -25
- package/dist/checks/bin/check-issue-tranche-label.js +77 -25
- package/dist/checks/bin/check-main-branch-refusal.js +77 -25
- package/dist/checks/bin/check-no-disk-state.js +77 -25
- package/dist/checks/bin/check-pr-premise-reassert.js +102 -26
- package/dist/checks/bin/check-pr-report-density.js +77 -25
- package/dist/checks/bin/check-principal-test-plan-wait.js +77 -25
- package/dist/checks/bin/check-quoted-command.js +244 -34
- package/dist/checks/bin/check-reader-resolvable-prose.js +295 -42
- package/dist/checks/bin/check-registry-gates.js +77 -25
- package/dist/checks/bin/check-retired-vocabulary.js +244 -34
- package/dist/checks/bin/check-review-gate.js +106 -29
- package/dist/checks/bin/check-single-plan-pr.js +77 -25
- package/dist/checks/bin/check-surface-scope.js +81 -25
- package/dist/checks/bin/check-test-plan.js +77 -25
- package/dist/checks/bin/check-token-collection-wired.js +77 -25
- package/dist/checks/bin/check-token-report.js +77 -25
- package/dist/checks/bin/check-workspace-escape.js +326 -82
- package/dist/index.js +2862 -1953
- package/dist/lib/pre-push-cache-test-run.js +190 -11
- package/dist/lib/pre-push-select-tests.js +45 -3
- package/package.json +1 -1
- 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/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 +72 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +48 -2
- 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 +276 -52
- 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]__18paley._.js → [root-of-the-server]__07uhu5z._.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]__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 +1 -1
- 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/{1ce2dj27_cgbj.js → 0q9p7c6vn-x2w.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{22s44f5k3ecmj.js → 2174nz5he_oc4.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{34hhdtbp20krb.js → 3xnma0-359j17.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/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{vl7QVqELe1AQ-9kaOd9mR → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-reader-resolvable-prose.ts
|
|
4
|
-
import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync7, statSync as statSync2 } from "node:fs";
|
|
5
|
-
import { extname, join as join10 } from "node:path";
|
|
4
|
+
import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync7, realpathSync as realpathSync3, statSync as statSync2 } from "node:fs";
|
|
5
|
+
import { extname, isAbsolute as isAbsolute2, join as join10, relative as relative2, resolve as resolve3, sep as sep2 } from "node:path";
|
|
6
6
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
7
7
|
var GATE_AUDIENCE = {
|
|
8
8
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -197,8 +197,8 @@ function maskIndentedCode(body, fill) {
|
|
|
197
197
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
198
198
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
199
199
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
200
|
-
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d
|
|
201
|
-
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+
|
|
200
|
+
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
|
|
201
|
+
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
|
|
202
202
|
function splitSlugQualifiedEdge(edge) {
|
|
203
203
|
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
204
204
|
if (!m)
|
|
@@ -2619,7 +2619,7 @@ function isIssueNotFoundError(err) {
|
|
|
2619
2619
|
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2620
2620
|
}
|
|
2621
2621
|
function resolveObjectivesSource(prBody, issue, cutoverIssue) {
|
|
2622
|
-
if (issue !== null && issue < cutoverIssue)
|
|
2622
|
+
if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
|
|
2623
2623
|
return { kind: "none" };
|
|
2624
2624
|
if (issue !== null)
|
|
2625
2625
|
return { kind: "issue", issue };
|
|
@@ -2895,9 +2895,18 @@ var COMMIT_TYPES = [
|
|
|
2895
2895
|
];
|
|
2896
2896
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2897
2897
|
function checkForgeTitle(title) {
|
|
2898
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
2898
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
|
|
2899
2899
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2900
2900
|
return { status: "pass", errors: [] };
|
|
2901
|
+
const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
|
|
2902
|
+
if (letteredTaskId) {
|
|
2903
|
+
return {
|
|
2904
|
+
status: "fail",
|
|
2905
|
+
errors: [
|
|
2906
|
+
`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.`
|
|
2907
|
+
]
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2901
2910
|
return {
|
|
2902
2911
|
status: "fail",
|
|
2903
2912
|
errors: [
|
|
@@ -2930,19 +2939,31 @@ function checkNoAgentBoxes(prBody) {
|
|
|
2930
2939
|
]
|
|
2931
2940
|
};
|
|
2932
2941
|
}
|
|
2933
|
-
function
|
|
2942
|
+
function rolloutRuleFor(message) {
|
|
2934
2943
|
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:")) {
|
|
2935
|
-
return
|
|
2944
|
+
return "briefRules";
|
|
2936
2945
|
}
|
|
2937
2946
|
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2938
|
-
return
|
|
2947
|
+
return "agentBoxes";
|
|
2939
2948
|
return null;
|
|
2940
2949
|
}
|
|
2941
|
-
|
|
2950
|
+
var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
|
|
2951
|
+
briefRulesSincePr: BRIEF_RULES_SINCE_PR,
|
|
2952
|
+
agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
|
|
2953
|
+
};
|
|
2954
|
+
function rolloutThresholdFor(message, cutovers) {
|
|
2955
|
+
const rule = rolloutRuleFor(message);
|
|
2956
|
+
if (rule === "briefRules")
|
|
2957
|
+
return cutovers.briefRulesSincePr;
|
|
2958
|
+
if (rule === "agentBoxes")
|
|
2959
|
+
return cutovers.agentBoxesRefusedSincePr;
|
|
2960
|
+
return null;
|
|
2961
|
+
}
|
|
2962
|
+
function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
|
|
2942
2963
|
const blocking = [];
|
|
2943
2964
|
const info = [];
|
|
2944
2965
|
for (const e of errors) {
|
|
2945
|
-
const threshold = rolloutThresholdFor(e);
|
|
2966
|
+
const threshold = rolloutThresholdFor(e, cutovers);
|
|
2946
2967
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2947
2968
|
(grandfathered ? info : blocking).push(e);
|
|
2948
2969
|
}
|
|
@@ -3410,8 +3431,8 @@ function checkIssueRationale(body) {
|
|
|
3410
3431
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3411
3432
|
}
|
|
3412
3433
|
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3413
|
-
function checkIssueObjectives(body, issueNumber) {
|
|
3414
|
-
if (issueNumber !== null && issueNumber <
|
|
3434
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3435
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3415
3436
|
return { status: "pass", errors: [] };
|
|
3416
3437
|
const result = objectivesOf(body);
|
|
3417
3438
|
if (result.ok)
|
|
@@ -3856,7 +3877,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3856
3877
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3857
3878
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3858
3879
|
}
|
|
3859
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3880
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3860
3881
|
const failures = [];
|
|
3861
3882
|
for (const [slug, issues] of issuesBySlug) {
|
|
3862
3883
|
for (const issue of issues) {
|
|
@@ -3865,7 +3886,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3865
3886
|
const errors = [
|
|
3866
3887
|
...checkIssueRationale(issue.body).errors,
|
|
3867
3888
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3868
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3889
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3869
3890
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3870
3891
|
];
|
|
3871
3892
|
if (errors.length === 0)
|
|
@@ -4488,13 +4509,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4488
4509
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4489
4510
|
return `${shipsPrefix}tranches/completed/`;
|
|
4490
4511
|
}
|
|
4491
|
-
|
|
4492
|
-
|
|
4512
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4513
|
+
function normalizeSpecPath(entry) {
|
|
4514
|
+
let out = entry.replace(/\\/g, "/");
|
|
4515
|
+
while (out.startsWith("./"))
|
|
4516
|
+
out = out.slice(2);
|
|
4517
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4518
|
+
while (out.endsWith("/"))
|
|
4519
|
+
out = out.slice(0, -1);
|
|
4520
|
+
return out;
|
|
4521
|
+
}
|
|
4522
|
+
function isSpecFile2(path, specPaths) {
|
|
4523
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4524
|
+
return true;
|
|
4525
|
+
if (!path.endsWith(".md"))
|
|
4526
|
+
return false;
|
|
4527
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4493
4528
|
}
|
|
4494
4529
|
function isClaudeMdFile(path) {
|
|
4495
4530
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4496
4531
|
}
|
|
4497
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4532
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4498
4533
|
if (path.startsWith(shipsPrefix)) {
|
|
4499
4534
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4500
4535
|
}
|
|
@@ -4503,7 +4538,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4503
4538
|
}
|
|
4504
4539
|
if (isClaudeMdFile(path))
|
|
4505
4540
|
return "internal";
|
|
4506
|
-
if (isSpecFile2(path))
|
|
4541
|
+
if (isSpecFile2(path, specPaths))
|
|
4507
4542
|
return "spec";
|
|
4508
4543
|
if (isProductScopeFile(path))
|
|
4509
4544
|
return "product";
|
|
@@ -4532,13 +4567,14 @@ function lineAt(content, index) {
|
|
|
4532
4567
|
}
|
|
4533
4568
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4534
4569
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4570
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4535
4571
|
function legacySlugPattern(legacySlugs) {
|
|
4536
4572
|
if (legacySlugs.length === 0)
|
|
4537
4573
|
return null;
|
|
4538
4574
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4539
4575
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4540
4576
|
}
|
|
4541
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4577
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4542
4578
|
const findings = [];
|
|
4543
4579
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4544
4580
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4550,8 +4586,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4550
4586
|
const productPatterns = [
|
|
4551
4587
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4552
4588
|
];
|
|
4589
|
+
const specPatterns = [
|
|
4590
|
+
...patterns,
|
|
4591
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4592
|
+
];
|
|
4553
4593
|
for (const file of files) {
|
|
4554
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4594
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4555
4595
|
if (!cls || cls === "internal")
|
|
4556
4596
|
continue;
|
|
4557
4597
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4560,15 +4600,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4560
4600
|
continue;
|
|
4561
4601
|
const blocking = cls === "product" || cls === "spec";
|
|
4562
4602
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4563
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4603
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4564
4604
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4565
4605
|
pattern.lastIndex = 0;
|
|
4566
4606
|
let match = pattern.exec(scrubbed);
|
|
4567
4607
|
while (match !== null) {
|
|
4568
4608
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4609
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4569
4610
|
findings.push({
|
|
4570
4611
|
file: file.path,
|
|
4571
|
-
line: lineAt(scrubbed,
|
|
4612
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4572
4613
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4573
4614
|
blocking
|
|
4574
4615
|
});
|
|
@@ -4754,9 +4795,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4754
4795
|
}
|
|
4755
4796
|
return findings;
|
|
4756
4797
|
}
|
|
4757
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4798
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4758
4799
|
return [
|
|
4759
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4800
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4760
4801
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4761
4802
|
];
|
|
4762
4803
|
}
|
|
@@ -5221,7 +5262,8 @@ var TaskStatusItemSchema = z.object({
|
|
|
5221
5262
|
}).merge(ObservedSchema);
|
|
5222
5263
|
var TaskStatusResultSchema = z.object({
|
|
5223
5264
|
items: z.array(TaskStatusItemSchema),
|
|
5224
|
-
nextCursor: z.string().nullable()
|
|
5265
|
+
nextCursor: z.string().nullable(),
|
|
5266
|
+
table: z.string()
|
|
5225
5267
|
});
|
|
5226
5268
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5227
5269
|
var EscalationInputsSchema = z.object({
|
|
@@ -5565,6 +5607,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5565
5607
|
}
|
|
5566
5608
|
return findings;
|
|
5567
5609
|
}
|
|
5610
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5611
|
+
var NO_GATE_CUTOVERS = {
|
|
5612
|
+
objectivesSinceIssue: null,
|
|
5613
|
+
briefSectionsSinceIssue: null,
|
|
5614
|
+
documentationSinceIssue: null,
|
|
5615
|
+
briefRulesSincePr: null,
|
|
5616
|
+
agentBoxesRefusedSincePr: null
|
|
5617
|
+
};
|
|
5568
5618
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5569
5619
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5570
5620
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -6014,6 +6064,8 @@ function attemptFromEnv(value) {
|
|
|
6014
6064
|
function provenanceFor(input) {
|
|
6015
6065
|
if (input.provenance)
|
|
6016
6066
|
return input.provenance;
|
|
6067
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6068
|
+
return "unavailable";
|
|
6017
6069
|
if (input.env.role || input.env.task)
|
|
6018
6070
|
return "env_correlated";
|
|
6019
6071
|
return "unavailable";
|
|
@@ -6034,7 +6086,7 @@ function buildHeader(input) {
|
|
|
6034
6086
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6035
6087
|
const round = roundFromEnv(input.env.round);
|
|
6036
6088
|
const subject = {
|
|
6037
|
-
issue: issueFromTask(input.env.task),
|
|
6089
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6038
6090
|
role,
|
|
6039
6091
|
...round !== undefined ? { round } : {},
|
|
6040
6092
|
...input.subject ?? {}
|
|
@@ -6527,7 +6579,12 @@ var VinayaConfigSchema = z4.object({
|
|
|
6527
6579
|
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6528
6580
|
severity: z4.enum(["warning", "error"]).optional()
|
|
6529
6581
|
}).optional(),
|
|
6530
|
-
specGrandfather: z4.array(z4.string().min(1)).optional()
|
|
6582
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6583
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6584
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6585
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6586
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6587
|
+
})).optional()
|
|
6531
6588
|
}).optional(),
|
|
6532
6589
|
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6533
6590
|
dispatch: z4.object({
|
|
@@ -6541,6 +6598,13 @@ var VinayaConfigSchema = z4.object({
|
|
|
6541
6598
|
securityThreshold: z4.string().min(1).optional(),
|
|
6542
6599
|
maxRounds: z4.number().optional()
|
|
6543
6600
|
}).optional(),
|
|
6601
|
+
gateCutovers: z4.object({
|
|
6602
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6603
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6604
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6605
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6606
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6607
|
+
}).optional(),
|
|
6544
6608
|
prePush: z4.object({
|
|
6545
6609
|
alwaysRun: z4.array(z4.string()).optional()
|
|
6546
6610
|
}).optional(),
|
|
@@ -6678,6 +6742,18 @@ function resolveReviewPolicy(config) {
|
|
|
6678
6742
|
maxRounds
|
|
6679
6743
|
};
|
|
6680
6744
|
}
|
|
6745
|
+
function resolveGateCutovers(config) {
|
|
6746
|
+
const raw = config?.gateCutovers;
|
|
6747
|
+
if (!raw)
|
|
6748
|
+
return NO_GATE_CUTOVERS;
|
|
6749
|
+
return {
|
|
6750
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6751
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6752
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6753
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6754
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6755
|
+
};
|
|
6756
|
+
}
|
|
6681
6757
|
function resolveRuntimeDirSetting(config) {
|
|
6682
6758
|
return config?.runtimeDir ?? null;
|
|
6683
6759
|
}
|
|
@@ -7387,6 +7463,10 @@ var COMMANDS = [
|
|
|
7387
7463
|
flag: "--role <name>",
|
|
7388
7464
|
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7389
7465
|
},
|
|
7466
|
+
{
|
|
7467
|
+
flag: "--template <name>",
|
|
7468
|
+
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7469
|
+
},
|
|
7390
7470
|
{
|
|
7391
7471
|
flag: "--print",
|
|
7392
7472
|
description: "Emit the resolved file's body (frontmatter stripped) instead of its path — the one-hop mode every generated skill and slash command invokes. A role file whose frontmatter carries an `ack-token` emits that token as the output's own first line."
|
|
@@ -8830,6 +8910,96 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8830
8910
|
return vinayaVersion;
|
|
8831
8911
|
}
|
|
8832
8912
|
}
|
|
8913
|
+
var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8914
|
+
function taskRefFromBranch2(branch) {
|
|
8915
|
+
const backlog = /^task\/issue-(\d+)$/.exec(branch);
|
|
8916
|
+
if (backlog) {
|
|
8917
|
+
const issue = Number(backlog[1]);
|
|
8918
|
+
return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
|
|
8919
|
+
}
|
|
8920
|
+
const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
8921
|
+
if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
|
|
8922
|
+
return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
|
|
8923
|
+
}
|
|
8924
|
+
return null;
|
|
8925
|
+
}
|
|
8926
|
+
var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
8927
|
+
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
8928
|
+
let stdout;
|
|
8929
|
+
try {
|
|
8930
|
+
({ stdout } = await execFileAsync5("gh", [
|
|
8931
|
+
"issue",
|
|
8932
|
+
"list",
|
|
8933
|
+
"--state",
|
|
8934
|
+
"all",
|
|
8935
|
+
"--label",
|
|
8936
|
+
`vinaya/tranche:${tranche}`,
|
|
8937
|
+
"--json",
|
|
8938
|
+
"number,title,labels",
|
|
8939
|
+
"--limit",
|
|
8940
|
+
String(TRANCHE_ISSUE_LIST_LIMIT),
|
|
8941
|
+
...repo === null ? [] : ["--repo", repo]
|
|
8942
|
+
], {
|
|
8943
|
+
cwd,
|
|
8944
|
+
encoding: "utf8",
|
|
8945
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
8946
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8947
|
+
killSignal: "SIGKILL"
|
|
8948
|
+
}));
|
|
8949
|
+
} catch {
|
|
8950
|
+
return null;
|
|
8951
|
+
}
|
|
8952
|
+
let issues;
|
|
8953
|
+
try {
|
|
8954
|
+
issues = JSON.parse(stdout);
|
|
8955
|
+
} catch {
|
|
8956
|
+
return null;
|
|
8957
|
+
}
|
|
8958
|
+
for (const issue of issues) {
|
|
8959
|
+
const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
|
|
8960
|
+
if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
|
|
8961
|
+
return issue.number;
|
|
8962
|
+
}
|
|
8963
|
+
return null;
|
|
8964
|
+
}
|
|
8965
|
+
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
8966
|
+
let stdout;
|
|
8967
|
+
try {
|
|
8968
|
+
({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
8969
|
+
cwd,
|
|
8970
|
+
encoding: "utf8",
|
|
8971
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8972
|
+
killSignal: "SIGKILL"
|
|
8973
|
+
}));
|
|
8974
|
+
} catch (err) {
|
|
8975
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
8976
|
+
return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
|
|
8977
|
+
}
|
|
8978
|
+
try {
|
|
8979
|
+
return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
|
|
8980
|
+
} catch {
|
|
8981
|
+
return "unknown";
|
|
8982
|
+
}
|
|
8983
|
+
}
|
|
8984
|
+
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
8985
|
+
let branch;
|
|
8986
|
+
try {
|
|
8987
|
+
branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
8988
|
+
encoding: "utf8",
|
|
8989
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8990
|
+
killSignal: "SIGKILL"
|
|
8991
|
+
})).stdout.trim();
|
|
8992
|
+
} catch {
|
|
8993
|
+
return null;
|
|
8994
|
+
}
|
|
8995
|
+
const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
|
|
8996
|
+
const ref = taskRefFromBranch2(named);
|
|
8997
|
+
if (ref === null)
|
|
8998
|
+
return null;
|
|
8999
|
+
if (ref.kind === "tranche")
|
|
9000
|
+
return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
|
|
9001
|
+
return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
|
|
9002
|
+
}
|
|
8833
9003
|
function readVinayaVersion() {
|
|
8834
9004
|
try {
|
|
8835
9005
|
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
@@ -8842,6 +9012,11 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
|
8842
9012
|
function isSafeRepoSegment3(segment) {
|
|
8843
9013
|
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8844
9014
|
}
|
|
9015
|
+
function safeRepoSlug(repo) {
|
|
9016
|
+
if (repo === null)
|
|
9017
|
+
return null;
|
|
9018
|
+
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
9019
|
+
}
|
|
8845
9020
|
function outboxPathFor(deps, repo, issue) {
|
|
8846
9021
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8847
9022
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
@@ -8863,6 +9038,18 @@ function defaultStderr(message) {
|
|
|
8863
9038
|
warnedThisProcess = true;
|
|
8864
9039
|
process.stderr.write(message);
|
|
8865
9040
|
}
|
|
9041
|
+
var branchIssueFallbackEnabled = true;
|
|
9042
|
+
var branchIssueByCwd = new Map;
|
|
9043
|
+
function branchIssueRead(key, read, shared) {
|
|
9044
|
+
if (!shared)
|
|
9045
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9046
|
+
const cached = branchIssueByCwd.get(key);
|
|
9047
|
+
if (cached !== undefined)
|
|
9048
|
+
return cached;
|
|
9049
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9050
|
+
branchIssueByCwd.set(key, reading);
|
|
9051
|
+
return reading;
|
|
9052
|
+
}
|
|
8866
9053
|
function defaultDeps() {
|
|
8867
9054
|
return {
|
|
8868
9055
|
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -8973,7 +9160,11 @@ function appendLine(path, line, warn) {
|
|
|
8973
9160
|
}
|
|
8974
9161
|
}
|
|
8975
9162
|
function createLogSink(overrides = {}) {
|
|
8976
|
-
const deps = {
|
|
9163
|
+
const deps = {
|
|
9164
|
+
...defaultDeps(),
|
|
9165
|
+
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9166
|
+
...overrides
|
|
9167
|
+
};
|
|
8977
9168
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8978
9169
|
const processId = randomUUID2();
|
|
8979
9170
|
let seq = 0;
|
|
@@ -8993,6 +9184,19 @@ function createLogSink(overrides = {}) {
|
|
|
8993
9184
|
}
|
|
8994
9185
|
return doctrineCache;
|
|
8995
9186
|
};
|
|
9187
|
+
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9188
|
+
let ownBranchIssue;
|
|
9189
|
+
const branchIssueOnce = (repo) => {
|
|
9190
|
+
if (!branchIssueFallbackEnabled)
|
|
9191
|
+
return Promise.resolve(null);
|
|
9192
|
+
const slug = safeRepoSlug(repo);
|
|
9193
|
+
const read = () => deps.resolveBranchIssue(slug);
|
|
9194
|
+
if (readerIsReal)
|
|
9195
|
+
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9196
|
+
if (ownBranchIssue === undefined)
|
|
9197
|
+
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9198
|
+
return ownBranchIssue;
|
|
9199
|
+
};
|
|
8996
9200
|
let resolveRepoCache;
|
|
8997
9201
|
const resolveRepoOnce = () => {
|
|
8998
9202
|
if (resolveRepoCache === undefined)
|
|
@@ -9015,6 +9219,7 @@ function createLogSink(overrides = {}) {
|
|
|
9015
9219
|
};
|
|
9016
9220
|
let drainChain = Promise.resolve();
|
|
9017
9221
|
const pendingWrites = new Set;
|
|
9222
|
+
let writeChain = Promise.resolve();
|
|
9018
9223
|
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
9019
9224
|
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
9020
9225
|
return;
|
|
@@ -9037,7 +9242,14 @@ function createLogSink(overrides = {}) {
|
|
|
9037
9242
|
attempt: env.VINAYA_ATTEMPT,
|
|
9038
9243
|
parent: env.VINAYA_PARENT_EVENT
|
|
9039
9244
|
};
|
|
9040
|
-
const
|
|
9245
|
+
const write = async () => {
|
|
9246
|
+
const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
|
|
9247
|
+
if (resolvedDestination.kind === "none") {
|
|
9248
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9249
|
+
`);
|
|
9250
|
+
return;
|
|
9251
|
+
}
|
|
9252
|
+
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
9041
9253
|
const header = buildHeader({
|
|
9042
9254
|
now,
|
|
9043
9255
|
runId,
|
|
@@ -9048,15 +9260,11 @@ function createLogSink(overrides = {}) {
|
|
|
9048
9260
|
host,
|
|
9049
9261
|
hostname: deps.hostname(),
|
|
9050
9262
|
env: envFields,
|
|
9263
|
+
branchIssue,
|
|
9051
9264
|
eventId: randomUUID2(),
|
|
9052
9265
|
processId,
|
|
9053
9266
|
inputVersions: deps.inputVersions()
|
|
9054
9267
|
});
|
|
9055
|
-
if (resolvedDestination.kind === "none") {
|
|
9056
|
-
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9057
|
-
`);
|
|
9058
|
-
return;
|
|
9059
|
-
}
|
|
9060
9268
|
const full = { ...e, ...header };
|
|
9061
9269
|
const parsed = LogEventSchema.safeParse(full);
|
|
9062
9270
|
if (!parsed.success) {
|
|
@@ -9073,10 +9281,12 @@ function createLogSink(overrides = {}) {
|
|
|
9073
9281
|
} else {
|
|
9074
9282
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9075
9283
|
}
|
|
9076
|
-
}
|
|
9284
|
+
};
|
|
9285
|
+
const written = writeChain.then(write).catch((err) => {
|
|
9077
9286
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9078
9287
|
`);
|
|
9079
9288
|
});
|
|
9289
|
+
writeChain = written;
|
|
9080
9290
|
pendingWrites.add(written);
|
|
9081
9291
|
written.finally(() => pendingWrites.delete(written));
|
|
9082
9292
|
} catch (err) {
|
|
@@ -9256,6 +9466,26 @@ var SOURCE_COMMENTS_GLOBS = proseGates?.sourceComments?.globs ?? [];
|
|
|
9256
9466
|
var SOURCE_COMMENTS_ALLOWLIST = proseGates?.sourceComments?.allowlist ?? [];
|
|
9257
9467
|
var SOURCE_COMMENTS_SEVERITY = proseGates?.sourceComments?.severity ?? "warning";
|
|
9258
9468
|
var SPEC_GRANDFATHER = proseGates?.specGrandfather ?? [];
|
|
9469
|
+
var SPEC_PATHS = [...DEFAULT_SPEC_PATHS, ...proseGates?.specPaths ?? []].map(normalizeSpecPath);
|
|
9470
|
+
function containedRelativePath(root, path) {
|
|
9471
|
+
const abs = resolve3(root, path);
|
|
9472
|
+
const lexical = relative2(resolve3(root), abs);
|
|
9473
|
+
if (escapesRoot(lexical))
|
|
9474
|
+
return null;
|
|
9475
|
+
if (existsSync8(abs) && escapesRoot(relative2(realPathOrSelf(resolve3(root)), realPathOrSelf(abs))))
|
|
9476
|
+
return null;
|
|
9477
|
+
return normalizeSpecPath(lexical);
|
|
9478
|
+
}
|
|
9479
|
+
function escapesRoot(rel) {
|
|
9480
|
+
return rel === "" || rel === ".." || rel.startsWith(`..${sep2}`) || rel.startsWith("../") || isAbsolute2(rel);
|
|
9481
|
+
}
|
|
9482
|
+
function realPathOrSelf(path) {
|
|
9483
|
+
try {
|
|
9484
|
+
return realpathSync3(path);
|
|
9485
|
+
} catch {
|
|
9486
|
+
return path;
|
|
9487
|
+
}
|
|
9488
|
+
}
|
|
9259
9489
|
function collect(dir, out = []) {
|
|
9260
9490
|
let entries;
|
|
9261
9491
|
try {
|
|
@@ -9310,8 +9540,31 @@ function collectProductScopeFiles(root) {
|
|
|
9310
9540
|
function readProductFiles(root, relPaths) {
|
|
9311
9541
|
return relPaths.map((rel) => ({ path: rel, content: readFileSync7(join10(root, rel), "utf8") }));
|
|
9312
9542
|
}
|
|
9313
|
-
function collectSpecFiles(root) {
|
|
9543
|
+
function collectSpecFiles(root, specPaths) {
|
|
9314
9544
|
const out = [];
|
|
9545
|
+
for (const entry of specPaths) {
|
|
9546
|
+
const rel = containedRelativePath(root, entry);
|
|
9547
|
+
if (rel === null) {
|
|
9548
|
+
console.log(`${CHECK_NAME}: ignoring spec path "${entry}" — it resolves outside the repository under check, and this class only ever reads this repository's own files.`);
|
|
9549
|
+
continue;
|
|
9550
|
+
}
|
|
9551
|
+
const abs = join10(root, rel);
|
|
9552
|
+
let isDir;
|
|
9553
|
+
try {
|
|
9554
|
+
isDir = statSync2(abs).isDirectory();
|
|
9555
|
+
} catch {
|
|
9556
|
+
continue;
|
|
9557
|
+
}
|
|
9558
|
+
if (isDir) {
|
|
9559
|
+
for (const f of collect(abs)) {
|
|
9560
|
+
const child = containedRelativePath(root, f);
|
|
9561
|
+
if (child?.endsWith(".md"))
|
|
9562
|
+
out.push(child);
|
|
9563
|
+
}
|
|
9564
|
+
} else if (rel.endsWith(".md")) {
|
|
9565
|
+
out.push(rel);
|
|
9566
|
+
}
|
|
9567
|
+
}
|
|
9315
9568
|
const appsDir = join10(root, "apps");
|
|
9316
9569
|
let appNames;
|
|
9317
9570
|
try {
|
|
@@ -9323,7 +9576,7 @@ function collectSpecFiles(root) {
|
|
|
9323
9576
|
}
|
|
9324
9577
|
});
|
|
9325
9578
|
} catch {
|
|
9326
|
-
return out;
|
|
9579
|
+
return [...new Set(out)];
|
|
9327
9580
|
}
|
|
9328
9581
|
for (const app of appNames) {
|
|
9329
9582
|
const specsDir = join10(appsDir, app, "specs");
|
|
@@ -9341,7 +9594,7 @@ function collectSpecFiles(root) {
|
|
|
9341
9594
|
out.push(rel);
|
|
9342
9595
|
}
|
|
9343
9596
|
}
|
|
9344
|
-
return out;
|
|
9597
|
+
return [...new Set(out)];
|
|
9345
9598
|
}
|
|
9346
9599
|
function collectSourceCommentFiles(root, globs) {
|
|
9347
9600
|
const out = [];
|
|
@@ -9396,7 +9649,7 @@ function main() {
|
|
|
9396
9649
|
const productFiles = readProductFiles(productRoot, productRelPaths);
|
|
9397
9650
|
const sourceCommentRelPaths = collectSourceCommentFiles(productRoot, SOURCE_COMMENTS_GLOBS);
|
|
9398
9651
|
const sourceCommentFiles = readProductFiles(productRoot, sourceCommentRelPaths);
|
|
9399
|
-
const specRelPaths = collectSpecFiles(productRoot);
|
|
9652
|
+
const specRelPaths = collectSpecFiles(productRoot, SPEC_PATHS);
|
|
9400
9653
|
const specFiles = readProductFiles(productRoot, specRelPaths);
|
|
9401
9654
|
const files = [...readAll([...shipsPaths, ...readerFacingPaths]), ...productFiles, ...specFiles];
|
|
9402
9655
|
const glossaryPath = join10(DOCTRINE_ROOT, "glossary.md");
|
|
@@ -9405,7 +9658,7 @@ function main() {
|
|
|
9405
9658
|
const { slugs, dormant: legacySlugsDormant } = legacySlugs(legacySlugDir);
|
|
9406
9659
|
const readerFacingPrefix = READER_FACING_ACTIVE && READER_FACING_PREFIX !== null ? `${READER_FACING_PREFIX}/` : "/no-reader-facing-surface";
|
|
9407
9660
|
const readerFacingSuffix = READER_FACING_ACTIVE && READER_FACING_SUFFIX !== null ? READER_FACING_SUFFIX : "/page.tsx";
|
|
9408
|
-
const findings = checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, slugs, shipsPrefix, SPEC_GRANDFATHER);
|
|
9661
|
+
const findings = checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, slugs, shipsPrefix, SPEC_GRANDFATHER, SPEC_PATHS);
|
|
9409
9662
|
const reportable = findingsInThisDiff(findings);
|
|
9410
9663
|
const sourceCommentFindings = checkSourceComments(sourceCommentFiles, SOURCE_COMMENTS_ALLOWLIST);
|
|
9411
9664
|
const reportableSourceComments = findingsInThisDiff(sourceCommentFindings);
|
|
@@ -9421,7 +9674,7 @@ function main() {
|
|
|
9421
9674
|
message: `${finding.file}:${finding.line}: ${finding.message}`,
|
|
9422
9675
|
file: finding.file,
|
|
9423
9676
|
line: finding.line,
|
|
9424
|
-
agent_recovery_prompt: finding.message.includes("coined term") ? "This page uses AEG/Vinaya-internal vocabulary a first-time reader cannot resolve. Either define the term " + 'inline (the same "Term — one-sentence definition" shape the glossary uses) at its first use on this page, ' + "or link to the glossary. Do not simply delete the word if the sentence needs it." : finding.blocking && finding.
|
|
9677
|
+
agent_recovery_prompt: finding.message.includes("coined term") ? "This page uses AEG/Vinaya-internal vocabulary a first-time reader cannot resolve. Either define the term " + 'inline (the same "Term — one-sentence definition" shape the glossary uses) at its first use on this page, ' + "or link to the glossary. Do not simply delete the word if the sentence needs it." : finding.blocking && !finding.message.includes("in product code") ? "This spec cites a tranche, a task number, an Issue/PR number, or names a document outside this " + "repository as its authority — a reader with no forge to resolve it against (a fork, an export, someone " + "reading this spec after the Issue is closed) gets nothing from the citation, and a copied task number " + "goes stale the moment the plan is renumbered. Rewrite the sentence to state the fact " + "plainly instead. If this spec is pre-existing backlog, list its path in " + "`proseGates.specGrandfather` rather than fixing it as a drive-by in an unrelated PR — do not add a " + "NEW citation to a spec even while it is grandfathered." : finding.blocking ? "This product-code file cites an internal tranche slug a reader outside this repo cannot resolve " + "(the reader-resolvable-prose product class). Remove the citation or rewrite the comment/doc to state " + "the fact plainly instead of pointing at the tranche that did it. This finding blocks the push and CI." : "This doctrine or page cites a forge number or an internal tranche slug the reader has no tracker to " + "resolve. Rewrite the sentence to state the fact plainly instead of pointing at the citation — say " + "what was learned/decided, not where it was logged."
|
|
9425
9678
|
});
|
|
9426
9679
|
}
|
|
9427
9680
|
for (const finding of reportableSourceComments) {
|