@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-doc-coverage.ts
|
|
4
|
-
import { execFileSync as
|
|
5
|
-
import { existsSync as
|
|
4
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
5
|
+
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
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)
|
|
@@ -3487,6 +3508,8 @@ function parseIssueSurface(body) {
|
|
|
3487
3508
|
function globCoversPath(glob, path) {
|
|
3488
3509
|
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3489
3510
|
const p = path.replace(/\/+$/, "");
|
|
3511
|
+
if (g === "*")
|
|
3512
|
+
return !p.includes("/");
|
|
3490
3513
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3491
3514
|
}
|
|
3492
3515
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
@@ -3856,7 +3879,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3856
3879
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3857
3880
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3858
3881
|
}
|
|
3859
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3882
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3860
3883
|
const failures = [];
|
|
3861
3884
|
for (const [slug, issues] of issuesBySlug) {
|
|
3862
3885
|
for (const issue of issues) {
|
|
@@ -3865,7 +3888,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3865
3888
|
const errors = [
|
|
3866
3889
|
...checkIssueRationale(issue.body).errors,
|
|
3867
3890
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3868
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3891
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3869
3892
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3870
3893
|
];
|
|
3871
3894
|
if (errors.length === 0)
|
|
@@ -4488,13 +4511,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4488
4511
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4489
4512
|
return `${shipsPrefix}tranches/completed/`;
|
|
4490
4513
|
}
|
|
4491
|
-
|
|
4492
|
-
|
|
4514
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4515
|
+
function normalizeSpecPath(entry) {
|
|
4516
|
+
let out = entry.replace(/\\/g, "/");
|
|
4517
|
+
while (out.startsWith("./"))
|
|
4518
|
+
out = out.slice(2);
|
|
4519
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4520
|
+
while (out.endsWith("/"))
|
|
4521
|
+
out = out.slice(0, -1);
|
|
4522
|
+
return out;
|
|
4523
|
+
}
|
|
4524
|
+
function isSpecFile2(path, specPaths) {
|
|
4525
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4526
|
+
return true;
|
|
4527
|
+
if (!path.endsWith(".md"))
|
|
4528
|
+
return false;
|
|
4529
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4493
4530
|
}
|
|
4494
4531
|
function isClaudeMdFile(path) {
|
|
4495
4532
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4496
4533
|
}
|
|
4497
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4534
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4498
4535
|
if (path.startsWith(shipsPrefix)) {
|
|
4499
4536
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4500
4537
|
}
|
|
@@ -4503,7 +4540,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4503
4540
|
}
|
|
4504
4541
|
if (isClaudeMdFile(path))
|
|
4505
4542
|
return "internal";
|
|
4506
|
-
if (isSpecFile2(path))
|
|
4543
|
+
if (isSpecFile2(path, specPaths))
|
|
4507
4544
|
return "spec";
|
|
4508
4545
|
if (isProductScopeFile(path))
|
|
4509
4546
|
return "product";
|
|
@@ -4532,13 +4569,14 @@ function lineAt(content, index) {
|
|
|
4532
4569
|
}
|
|
4533
4570
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4534
4571
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4572
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4535
4573
|
function legacySlugPattern(legacySlugs) {
|
|
4536
4574
|
if (legacySlugs.length === 0)
|
|
4537
4575
|
return null;
|
|
4538
4576
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4539
4577
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4540
4578
|
}
|
|
4541
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4579
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4542
4580
|
const findings = [];
|
|
4543
4581
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4544
4582
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4550,8 +4588,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4550
4588
|
const productPatterns = [
|
|
4551
4589
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4552
4590
|
];
|
|
4591
|
+
const specPatterns = [
|
|
4592
|
+
...patterns,
|
|
4593
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4594
|
+
];
|
|
4553
4595
|
for (const file of files) {
|
|
4554
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4596
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4555
4597
|
if (!cls || cls === "internal")
|
|
4556
4598
|
continue;
|
|
4557
4599
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4560,15 +4602,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4560
4602
|
continue;
|
|
4561
4603
|
const blocking = cls === "product" || cls === "spec";
|
|
4562
4604
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4563
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4605
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4564
4606
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4565
4607
|
pattern.lastIndex = 0;
|
|
4566
4608
|
let match = pattern.exec(scrubbed);
|
|
4567
4609
|
while (match !== null) {
|
|
4568
4610
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4611
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4569
4612
|
findings.push({
|
|
4570
4613
|
file: file.path,
|
|
4571
|
-
line: lineAt(scrubbed,
|
|
4614
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4572
4615
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4573
4616
|
blocking
|
|
4574
4617
|
});
|
|
@@ -4754,9 +4797,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4754
4797
|
}
|
|
4755
4798
|
return findings;
|
|
4756
4799
|
}
|
|
4757
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4800
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4758
4801
|
return [
|
|
4759
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4802
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4760
4803
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4761
4804
|
];
|
|
4762
4805
|
}
|
|
@@ -5221,7 +5264,8 @@ var TaskStatusItemSchema = z.object({
|
|
|
5221
5264
|
}).merge(ObservedSchema);
|
|
5222
5265
|
var TaskStatusResultSchema = z.object({
|
|
5223
5266
|
items: z.array(TaskStatusItemSchema),
|
|
5224
|
-
nextCursor: z.string().nullable()
|
|
5267
|
+
nextCursor: z.string().nullable(),
|
|
5268
|
+
table: z.string()
|
|
5225
5269
|
});
|
|
5226
5270
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5227
5271
|
var EscalationInputsSchema = z.object({
|
|
@@ -5565,6 +5609,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5565
5609
|
}
|
|
5566
5610
|
return findings;
|
|
5567
5611
|
}
|
|
5612
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5613
|
+
var NO_GATE_CUTOVERS = {
|
|
5614
|
+
objectivesSinceIssue: null,
|
|
5615
|
+
briefSectionsSinceIssue: null,
|
|
5616
|
+
documentationSinceIssue: null,
|
|
5617
|
+
briefRulesSincePr: null,
|
|
5618
|
+
agentBoxesRefusedSincePr: null
|
|
5619
|
+
};
|
|
5568
5620
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5569
5621
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5570
5622
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -6014,6 +6066,8 @@ function attemptFromEnv(value) {
|
|
|
6014
6066
|
function provenanceFor(input) {
|
|
6015
6067
|
if (input.provenance)
|
|
6016
6068
|
return input.provenance;
|
|
6069
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6070
|
+
return "unavailable";
|
|
6017
6071
|
if (input.env.role || input.env.task)
|
|
6018
6072
|
return "env_correlated";
|
|
6019
6073
|
return "unavailable";
|
|
@@ -6034,7 +6088,7 @@ function buildHeader(input) {
|
|
|
6034
6088
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6035
6089
|
const round = roundFromEnv(input.env.round);
|
|
6036
6090
|
const subject = {
|
|
6037
|
-
issue: issueFromTask(input.env.task),
|
|
6091
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6038
6092
|
role,
|
|
6039
6093
|
...round !== undefined ? { round } : {},
|
|
6040
6094
|
...input.subject ?? {}
|
|
@@ -6315,8 +6369,8 @@ var ResolutionRecordSchema = z3.object({
|
|
|
6315
6369
|
consumedAt: isoTimestamp
|
|
6316
6370
|
}).strict();
|
|
6317
6371
|
// src/lib/diff-evidence.ts
|
|
6318
|
-
import { execFileSync as
|
|
6319
|
-
import { join as
|
|
6372
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
6373
|
+
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
6320
6374
|
|
|
6321
6375
|
// src/lib/config.ts
|
|
6322
6376
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
@@ -6478,7 +6532,12 @@ var VinayaConfigSchema = z4.object({
|
|
|
6478
6532
|
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6479
6533
|
severity: z4.enum(["warning", "error"]).optional()
|
|
6480
6534
|
}).optional(),
|
|
6481
|
-
specGrandfather: z4.array(z4.string().min(1)).optional()
|
|
6535
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6536
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6537
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6538
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6539
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6540
|
+
})).optional()
|
|
6482
6541
|
}).optional(),
|
|
6483
6542
|
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6484
6543
|
dispatch: z4.object({
|
|
@@ -6492,6 +6551,13 @@ var VinayaConfigSchema = z4.object({
|
|
|
6492
6551
|
securityThreshold: z4.string().min(1).optional(),
|
|
6493
6552
|
maxRounds: z4.number().optional()
|
|
6494
6553
|
}).optional(),
|
|
6554
|
+
gateCutovers: z4.object({
|
|
6555
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6556
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6557
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6558
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6559
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6560
|
+
}).optional(),
|
|
6495
6561
|
prePush: z4.object({
|
|
6496
6562
|
alwaysRun: z4.array(z4.string()).optional()
|
|
6497
6563
|
}).optional(),
|
|
@@ -6629,6 +6695,18 @@ function resolveReviewPolicy(config) {
|
|
|
6629
6695
|
maxRounds
|
|
6630
6696
|
};
|
|
6631
6697
|
}
|
|
6698
|
+
function resolveGateCutovers(config) {
|
|
6699
|
+
const raw = config?.gateCutovers;
|
|
6700
|
+
if (!raw)
|
|
6701
|
+
return NO_GATE_CUTOVERS;
|
|
6702
|
+
return {
|
|
6703
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6704
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6705
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6706
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6707
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6708
|
+
};
|
|
6709
|
+
}
|
|
6632
6710
|
function resolveRuntimeDirSetting(config) {
|
|
6633
6711
|
return config?.runtimeDir ?? null;
|
|
6634
6712
|
}
|
|
@@ -6684,7 +6762,8 @@ async function trustAnchorRepoAsync() {
|
|
|
6684
6762
|
try {
|
|
6685
6763
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6686
6764
|
encoding: "utf-8",
|
|
6687
|
-
timeout: 1e4
|
|
6765
|
+
timeout: 1e4,
|
|
6766
|
+
killSignal: "SIGKILL"
|
|
6688
6767
|
});
|
|
6689
6768
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6690
6769
|
} catch {
|
|
@@ -6745,7 +6824,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
6745
6824
|
const repo = await trustAnchorRepoAsync();
|
|
6746
6825
|
if (!repo)
|
|
6747
6826
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6748
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6827
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
6749
6828
|
return stdout;
|
|
6750
6829
|
}
|
|
6751
6830
|
function firstLine(err) {
|
|
@@ -6819,9 +6898,9 @@ function loadConfig() {
|
|
|
6819
6898
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
6820
6899
|
|
|
6821
6900
|
// src/lib/brief-assembly.ts
|
|
6822
|
-
import { execFileSync as
|
|
6823
|
-
import { existsSync as
|
|
6824
|
-
import { join as
|
|
6901
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6902
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
6903
|
+
import { join as join4 } from "node:path";
|
|
6825
6904
|
|
|
6826
6905
|
// ../../packages/sources/src/commands.ts
|
|
6827
6906
|
var COMMANDS = [
|
|
@@ -7327,6 +7406,10 @@ var COMMANDS = [
|
|
|
7327
7406
|
flag: "--role <name>",
|
|
7328
7407
|
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7329
7408
|
},
|
|
7409
|
+
{
|
|
7410
|
+
flag: "--template <name>",
|
|
7411
|
+
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7412
|
+
},
|
|
7330
7413
|
{
|
|
7331
7414
|
flag: "--print",
|
|
7332
7415
|
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."
|
|
@@ -7511,6 +7594,17 @@ var COMMANDS = [
|
|
|
7511
7594
|
"issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
|
|
7512
7595
|
],
|
|
7513
7596
|
status: "shipped"
|
|
7597
|
+
},
|
|
7598
|
+
{
|
|
7599
|
+
name: "log send",
|
|
7600
|
+
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
7601
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7602
|
+
details: [
|
|
7603
|
+
"For a run whose events ended up on local disk instead of the configured server — an unattended run that fell back to the local folder because the trust-anchor read could not confirm its `logs.url` (a developer machine slower than the read deadline, or genuinely offline), or a retry queue holding a backlog or a `.draining.ndjson` a dead drain left behind. It moves the local folder's events into the retry queue and drains every queue for this repository through the SAME webhook delivery a live event uses.",
|
|
7604
|
+
"It resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — never a URL passed on the command line. A repository whose destination is a folder (or none) has nothing to send to a server and the command says so.",
|
|
7605
|
+
"Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
|
|
7606
|
+
],
|
|
7607
|
+
status: "shipped"
|
|
7514
7608
|
}
|
|
7515
7609
|
];
|
|
7516
7610
|
// ../../packages/sources/src/forge-adapter.ts
|
|
@@ -7662,13 +7756,47 @@ function packageRoot(moduleUrl) {
|
|
|
7662
7756
|
return dir;
|
|
7663
7757
|
}
|
|
7664
7758
|
|
|
7759
|
+
// src/commands/doctrine.ts
|
|
7760
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7761
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7762
|
+
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
7763
|
+
import matter2 from "gray-matter";
|
|
7764
|
+
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7765
|
+
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7766
|
+
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
7767
|
+
}
|
|
7768
|
+
function gitToplevel(cwd) {
|
|
7769
|
+
try {
|
|
7770
|
+
return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7771
|
+
encoding: "utf8",
|
|
7772
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7773
|
+
}).trim();
|
|
7774
|
+
} catch {
|
|
7775
|
+
return null;
|
|
7776
|
+
}
|
|
7777
|
+
}
|
|
7778
|
+
function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7779
|
+
const toplevel = gitToplevel(cwd);
|
|
7780
|
+
if (toplevel !== null) {
|
|
7781
|
+
const treeRoot = join3(toplevel, "aeg-root");
|
|
7782
|
+
if (existsSync3(join3(treeRoot, "roles")))
|
|
7783
|
+
return { root: treeRoot, source: "tree" };
|
|
7784
|
+
}
|
|
7785
|
+
const fromSource = !pkg.split(sep).includes("node_modules");
|
|
7786
|
+
const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
|
|
7787
|
+
return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
|
|
7788
|
+
}
|
|
7789
|
+
function hasDoctrineEntry(root) {
|
|
7790
|
+
return existsSync3(join3(root, ...ENTRY_SEGMENTS));
|
|
7791
|
+
}
|
|
7792
|
+
|
|
7665
7793
|
// src/lib/brief-assembly.ts
|
|
7666
7794
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7667
|
-
var PACKAGED_TEMPLATE_PATH =
|
|
7668
|
-
var TEMPLATE_PATH =
|
|
7795
|
+
var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7796
|
+
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7669
7797
|
function git(args) {
|
|
7670
7798
|
try {
|
|
7671
|
-
return
|
|
7799
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7672
7800
|
} catch {
|
|
7673
7801
|
return "";
|
|
7674
7802
|
}
|
|
@@ -7681,14 +7809,14 @@ function expandGlob(glob) {
|
|
|
7681
7809
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7682
7810
|
|
|
7683
7811
|
// src/checks/registry.ts
|
|
7684
|
-
import { existsSync as
|
|
7685
|
-
import { join as
|
|
7686
|
-
var DIST_BIN_DIR =
|
|
7687
|
-
var SRC_BIN_DIR =
|
|
7688
|
-
var BIN_DIR =
|
|
7812
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
7813
|
+
import { join as join5 } from "node:path";
|
|
7814
|
+
var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7815
|
+
var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7816
|
+
var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7689
7817
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7690
7818
|
function bin(name) {
|
|
7691
|
-
return
|
|
7819
|
+
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7692
7820
|
}
|
|
7693
7821
|
var REGISTRY = [
|
|
7694
7822
|
[
|
|
@@ -8252,21 +8380,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
8252
8380
|
import {
|
|
8253
8381
|
closeSync as closeSync3,
|
|
8254
8382
|
constants as fsConstants3,
|
|
8255
|
-
existsSync as
|
|
8383
|
+
existsSync as existsSync7,
|
|
8256
8384
|
fstatSync as fstatSync2,
|
|
8257
8385
|
mkdirSync as mkdirSync3,
|
|
8258
8386
|
openSync as openSync3,
|
|
8259
|
-
readFileSync as
|
|
8387
|
+
readFileSync as readFileSync6,
|
|
8260
8388
|
renameSync as renameSync2,
|
|
8261
8389
|
writeSync as writeSync2
|
|
8262
8390
|
} from "node:fs";
|
|
8263
8391
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8264
|
-
import { dirname as
|
|
8392
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
8265
8393
|
import { promisify as promisify5 } from "node:util";
|
|
8266
8394
|
|
|
8267
8395
|
// src/lib/run-paths.ts
|
|
8268
|
-
import { chmodSync, existsSync as
|
|
8269
|
-
import { dirname as
|
|
8396
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
|
|
8397
|
+
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8270
8398
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8271
8399
|
function isSafeRepoSegment(segment) {
|
|
8272
8400
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8277,7 +8405,7 @@ function repoSegment(repo) {
|
|
|
8277
8405
|
return `${repo.owner}-${repo.repo}`;
|
|
8278
8406
|
}
|
|
8279
8407
|
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8280
|
-
return
|
|
8408
|
+
return join6(home, "runtime", repoSegment(repo));
|
|
8281
8409
|
}
|
|
8282
8410
|
function resolveRuntimeDir(input) {
|
|
8283
8411
|
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
@@ -8337,9 +8465,9 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8337
8465
|
return null;
|
|
8338
8466
|
}
|
|
8339
8467
|
for (;; ) {
|
|
8340
|
-
if (
|
|
8468
|
+
if (existsSync6(join6(dir, ".git")))
|
|
8341
8469
|
return dir;
|
|
8342
|
-
const parent =
|
|
8470
|
+
const parent = dirname4(dir);
|
|
8343
8471
|
if (parent === dir)
|
|
8344
8472
|
return null;
|
|
8345
8473
|
dir = parent;
|
|
@@ -8354,7 +8482,7 @@ import {
|
|
|
8354
8482
|
mkdirSync as mkdirSync2,
|
|
8355
8483
|
openSync as openSync2,
|
|
8356
8484
|
linkSync,
|
|
8357
|
-
readFileSync as
|
|
8485
|
+
readFileSync as readFileSync5,
|
|
8358
8486
|
renameSync,
|
|
8359
8487
|
statSync,
|
|
8360
8488
|
unlinkSync,
|
|
@@ -8364,7 +8492,7 @@ import {
|
|
|
8364
8492
|
} from "node:fs";
|
|
8365
8493
|
import { randomUUID } from "node:crypto";
|
|
8366
8494
|
import { homedir as homedir2 } from "node:os";
|
|
8367
|
-
import { dirname as
|
|
8495
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8368
8496
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8369
8497
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8370
8498
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8380,7 +8508,7 @@ function isEnoent(err) {
|
|
|
8380
8508
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8381
8509
|
function tryCreateLock(lockPath, token) {
|
|
8382
8510
|
try {
|
|
8383
|
-
mkdirSync2(
|
|
8511
|
+
mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
|
|
8384
8512
|
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8385
8513
|
try {
|
|
8386
8514
|
writeSync(fd, `${token}
|
|
@@ -8445,7 +8573,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8445
8573
|
function renewDrainLock(lockPath, token) {
|
|
8446
8574
|
let holder;
|
|
8447
8575
|
try {
|
|
8448
|
-
holder =
|
|
8576
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
8449
8577
|
} catch (err) {
|
|
8450
8578
|
if (!isEnoent(err))
|
|
8451
8579
|
throw err;
|
|
@@ -8465,7 +8593,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
8465
8593
|
}
|
|
8466
8594
|
function releaseDrainLock(lockPath, token) {
|
|
8467
8595
|
try {
|
|
8468
|
-
const holder =
|
|
8596
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
8469
8597
|
if (holder !== token)
|
|
8470
8598
|
return;
|
|
8471
8599
|
unlinkSync(lockPath);
|
|
@@ -8515,7 +8643,7 @@ function queueLines(buf) {
|
|
|
8515
8643
|
return lines;
|
|
8516
8644
|
}
|
|
8517
8645
|
function removeQueueHead(path, cut) {
|
|
8518
|
-
const remaining =
|
|
8646
|
+
const remaining = readFileSync5(path);
|
|
8519
8647
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8520
8648
|
}
|
|
8521
8649
|
function queueBucketSize(path) {
|
|
@@ -8536,7 +8664,7 @@ function queueBucketSize(path) {
|
|
|
8536
8664
|
function readQueueFile(path) {
|
|
8537
8665
|
if (queueBucketSize(path) === null)
|
|
8538
8666
|
return null;
|
|
8539
|
-
return
|
|
8667
|
+
return readFileSync5(path);
|
|
8540
8668
|
}
|
|
8541
8669
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8542
8670
|
const record = JSON.stringify({
|
|
@@ -8651,7 +8779,7 @@ async function drainRenamedAside(args, livePath, source) {
|
|
|
8651
8779
|
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8652
8780
|
const resolved = await resolveRepo();
|
|
8653
8781
|
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8654
|
-
const outboxRoot = () =>
|
|
8782
|
+
const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
|
|
8655
8783
|
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8656
8784
|
const lockPath = `${path}.flush-lock`;
|
|
8657
8785
|
const lockToken = acquireDrainLock(lockPath);
|
|
@@ -8688,7 +8816,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
8688
8816
|
|
|
8689
8817
|
// src/lib/log-sink.ts
|
|
8690
8818
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8819
|
+
function describeFolderFallback(reason) {
|
|
8820
|
+
if (reason.kind === "anchor-unreadable") {
|
|
8821
|
+
return `not delivering to the configured log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json could not be read to confirm it (the trust-anchor read via `gh` was offline, " + "unauthenticated, or slower than its deadline); events are written to the local folder and can be " + "delivered later with `vinaya log send`";
|
|
8822
|
+
}
|
|
8823
|
+
return `not delivering to the working-tree log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json does not declare it, so an unattended run does not honour it (a pull request cannot " + "redirect telemetry); events are written to the local folder";
|
|
8824
|
+
}
|
|
8691
8825
|
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8826
|
+
var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
|
|
8692
8827
|
function withDeadline(work, ms, fallback) {
|
|
8693
8828
|
return new Promise((resolve) => {
|
|
8694
8829
|
const timer = setTimeout(() => resolve(fallback), ms);
|
|
@@ -8703,7 +8838,7 @@ function withDeadline(work, ms, fallback) {
|
|
|
8703
8838
|
});
|
|
8704
8839
|
}
|
|
8705
8840
|
async function safeLoadTrustAnchorConfig() {
|
|
8706
|
-
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
8841
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
8707
8842
|
}
|
|
8708
8843
|
function logsCredentialMissing(headers, env) {
|
|
8709
8844
|
if (!headers)
|
|
@@ -8720,8 +8855,16 @@ function logsCredentialMissing(headers, env) {
|
|
|
8720
8855
|
function resolveLogDestinationFrom(input) {
|
|
8721
8856
|
const local = resolveLogsSetting(input.localConfig);
|
|
8722
8857
|
let effective = null;
|
|
8858
|
+
let fallbackReason;
|
|
8723
8859
|
if (input.unattended) {
|
|
8724
|
-
|
|
8860
|
+
if (local) {
|
|
8861
|
+
effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
|
|
8862
|
+
if (effective === null && "url" in local) {
|
|
8863
|
+
fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
|
|
8864
|
+
}
|
|
8865
|
+
} else {
|
|
8866
|
+
effective = resolveLogsSetting(input.trustAnchorConfig);
|
|
8867
|
+
}
|
|
8725
8868
|
} else {
|
|
8726
8869
|
effective = local;
|
|
8727
8870
|
}
|
|
@@ -8747,7 +8890,7 @@ function resolveLogDestinationFrom(input) {
|
|
|
8747
8890
|
effective = null;
|
|
8748
8891
|
}
|
|
8749
8892
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8750
|
-
return { kind: "folder", folder };
|
|
8893
|
+
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8751
8894
|
}
|
|
8752
8895
|
var processTrustAnchorOnce;
|
|
8753
8896
|
function processTrustAnchor() {
|
|
@@ -8763,7 +8906,7 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
8763
8906
|
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8764
8907
|
unattended,
|
|
8765
8908
|
env,
|
|
8766
|
-
defaultFolder:
|
|
8909
|
+
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8767
8910
|
repoRoot: repoRootSync()
|
|
8768
8911
|
});
|
|
8769
8912
|
}
|
|
@@ -8778,7 +8921,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8778
8921
|
} catch (err) {
|
|
8779
8922
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8780
8923
|
}
|
|
8781
|
-
if (!
|
|
8924
|
+
if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
|
|
8782
8925
|
return vinayaVersion;
|
|
8783
8926
|
try {
|
|
8784
8927
|
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
@@ -8787,9 +8930,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8787
8930
|
return vinayaVersion;
|
|
8788
8931
|
}
|
|
8789
8932
|
}
|
|
8933
|
+
var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8934
|
+
function taskRefFromBranch2(branch) {
|
|
8935
|
+
const backlog = /^task\/issue-(\d+)$/.exec(branch);
|
|
8936
|
+
if (backlog) {
|
|
8937
|
+
const issue = Number(backlog[1]);
|
|
8938
|
+
return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
|
|
8939
|
+
}
|
|
8940
|
+
const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
8941
|
+
if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
|
|
8942
|
+
return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
|
|
8943
|
+
}
|
|
8944
|
+
return null;
|
|
8945
|
+
}
|
|
8946
|
+
var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
8947
|
+
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
8948
|
+
let stdout;
|
|
8949
|
+
try {
|
|
8950
|
+
({ stdout } = await execFileAsync5("gh", [
|
|
8951
|
+
"issue",
|
|
8952
|
+
"list",
|
|
8953
|
+
"--state",
|
|
8954
|
+
"all",
|
|
8955
|
+
"--label",
|
|
8956
|
+
`vinaya/tranche:${tranche}`,
|
|
8957
|
+
"--json",
|
|
8958
|
+
"number,title,labels",
|
|
8959
|
+
"--limit",
|
|
8960
|
+
String(TRANCHE_ISSUE_LIST_LIMIT),
|
|
8961
|
+
...repo === null ? [] : ["--repo", repo]
|
|
8962
|
+
], {
|
|
8963
|
+
cwd,
|
|
8964
|
+
encoding: "utf8",
|
|
8965
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
8966
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8967
|
+
killSignal: "SIGKILL"
|
|
8968
|
+
}));
|
|
8969
|
+
} catch {
|
|
8970
|
+
return null;
|
|
8971
|
+
}
|
|
8972
|
+
let issues;
|
|
8973
|
+
try {
|
|
8974
|
+
issues = JSON.parse(stdout);
|
|
8975
|
+
} catch {
|
|
8976
|
+
return null;
|
|
8977
|
+
}
|
|
8978
|
+
for (const issue of issues) {
|
|
8979
|
+
const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
|
|
8980
|
+
if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
|
|
8981
|
+
return issue.number;
|
|
8982
|
+
}
|
|
8983
|
+
return null;
|
|
8984
|
+
}
|
|
8985
|
+
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
8986
|
+
let stdout;
|
|
8987
|
+
try {
|
|
8988
|
+
({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
8989
|
+
cwd,
|
|
8990
|
+
encoding: "utf8",
|
|
8991
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8992
|
+
killSignal: "SIGKILL"
|
|
8993
|
+
}));
|
|
8994
|
+
} catch (err) {
|
|
8995
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
8996
|
+
return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
|
|
8997
|
+
}
|
|
8998
|
+
try {
|
|
8999
|
+
return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
|
|
9000
|
+
} catch {
|
|
9001
|
+
return "unknown";
|
|
9002
|
+
}
|
|
9003
|
+
}
|
|
9004
|
+
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
9005
|
+
let branch;
|
|
9006
|
+
try {
|
|
9007
|
+
branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
9008
|
+
encoding: "utf8",
|
|
9009
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
9010
|
+
killSignal: "SIGKILL"
|
|
9011
|
+
})).stdout.trim();
|
|
9012
|
+
} catch {
|
|
9013
|
+
return null;
|
|
9014
|
+
}
|
|
9015
|
+
const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
|
|
9016
|
+
const ref = taskRefFromBranch2(named);
|
|
9017
|
+
if (ref === null)
|
|
9018
|
+
return null;
|
|
9019
|
+
if (ref.kind === "tranche")
|
|
9020
|
+
return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
|
|
9021
|
+
return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
|
|
9022
|
+
}
|
|
8790
9023
|
function readVinayaVersion() {
|
|
8791
9024
|
try {
|
|
8792
|
-
const pkg = JSON.parse(
|
|
9025
|
+
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8793
9026
|
return pkg.version ?? "unknown";
|
|
8794
9027
|
} catch {
|
|
8795
9028
|
return "unknown";
|
|
@@ -8799,10 +9032,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
|
8799
9032
|
function isSafeRepoSegment3(segment) {
|
|
8800
9033
|
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8801
9034
|
}
|
|
9035
|
+
function safeRepoSlug(repo) {
|
|
9036
|
+
if (repo === null)
|
|
9037
|
+
return null;
|
|
9038
|
+
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
9039
|
+
}
|
|
8802
9040
|
function outboxPathFor(deps, repo, issue) {
|
|
8803
9041
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8804
9042
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8805
|
-
return
|
|
9043
|
+
return join8(deps.outboxRoot(), dirName, fileName);
|
|
8806
9044
|
}
|
|
8807
9045
|
function hostFromEnv(env) {
|
|
8808
9046
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8820,9 +9058,21 @@ function defaultStderr(message) {
|
|
|
8820
9058
|
warnedThisProcess = true;
|
|
8821
9059
|
process.stderr.write(message);
|
|
8822
9060
|
}
|
|
9061
|
+
var branchIssueFallbackEnabled = true;
|
|
9062
|
+
var branchIssueByCwd = new Map;
|
|
9063
|
+
function branchIssueRead(key, read, shared) {
|
|
9064
|
+
if (!shared)
|
|
9065
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9066
|
+
const cached = branchIssueByCwd.get(key);
|
|
9067
|
+
if (cached !== undefined)
|
|
9068
|
+
return cached;
|
|
9069
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9070
|
+
branchIssueByCwd.set(key, reading);
|
|
9071
|
+
return reading;
|
|
9072
|
+
}
|
|
8823
9073
|
function defaultDeps() {
|
|
8824
9074
|
return {
|
|
8825
|
-
outboxRoot: () =>
|
|
9075
|
+
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8826
9076
|
home: () => homedir3(),
|
|
8827
9077
|
hostname: () => osHostname(),
|
|
8828
9078
|
cwd: () => process.cwd(),
|
|
@@ -8847,7 +9097,7 @@ function guardedAppendOpen(path) {
|
|
|
8847
9097
|
}
|
|
8848
9098
|
function appendHardenedLine(path, line) {
|
|
8849
9099
|
try {
|
|
8850
|
-
mkdirSync3(
|
|
9100
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8851
9101
|
const fd = guardedAppendOpen(path);
|
|
8852
9102
|
if (fd === undefined)
|
|
8853
9103
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
@@ -8866,7 +9116,7 @@ function appendHardenedLine(path, line) {
|
|
|
8866
9116
|
function reportRotationOverflow(backupPath, warn) {
|
|
8867
9117
|
let raw;
|
|
8868
9118
|
try {
|
|
8869
|
-
raw =
|
|
9119
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
8870
9120
|
} catch {
|
|
8871
9121
|
return;
|
|
8872
9122
|
}
|
|
@@ -8889,7 +9139,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8889
9139
|
}
|
|
8890
9140
|
function appendLine(path, line, warn) {
|
|
8891
9141
|
try {
|
|
8892
|
-
mkdirSync3(
|
|
9142
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8893
9143
|
let fd = guardedAppendOpen(path);
|
|
8894
9144
|
if (fd === undefined) {
|
|
8895
9145
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8930,7 +9180,11 @@ function appendLine(path, line, warn) {
|
|
|
8930
9180
|
}
|
|
8931
9181
|
}
|
|
8932
9182
|
function createLogSink(overrides = {}) {
|
|
8933
|
-
const deps = {
|
|
9183
|
+
const deps = {
|
|
9184
|
+
...defaultDeps(),
|
|
9185
|
+
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9186
|
+
...overrides
|
|
9187
|
+
};
|
|
8934
9188
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8935
9189
|
const processId = randomUUID2();
|
|
8936
9190
|
let seq = 0;
|
|
@@ -8950,6 +9204,19 @@ function createLogSink(overrides = {}) {
|
|
|
8950
9204
|
}
|
|
8951
9205
|
return doctrineCache;
|
|
8952
9206
|
};
|
|
9207
|
+
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9208
|
+
let ownBranchIssue;
|
|
9209
|
+
const branchIssueOnce = (repo) => {
|
|
9210
|
+
if (!branchIssueFallbackEnabled)
|
|
9211
|
+
return Promise.resolve(null);
|
|
9212
|
+
const slug = safeRepoSlug(repo);
|
|
9213
|
+
const read = () => deps.resolveBranchIssue(slug);
|
|
9214
|
+
if (readerIsReal)
|
|
9215
|
+
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9216
|
+
if (ownBranchIssue === undefined)
|
|
9217
|
+
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9218
|
+
return ownBranchIssue;
|
|
9219
|
+
};
|
|
8953
9220
|
let resolveRepoCache;
|
|
8954
9221
|
const resolveRepoOnce = () => {
|
|
8955
9222
|
if (resolveRepoCache === undefined)
|
|
@@ -8972,6 +9239,7 @@ function createLogSink(overrides = {}) {
|
|
|
8972
9239
|
};
|
|
8973
9240
|
let drainChain = Promise.resolve();
|
|
8974
9241
|
const pendingWrites = new Set;
|
|
9242
|
+
let writeChain = Promise.resolve();
|
|
8975
9243
|
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
8976
9244
|
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
8977
9245
|
return;
|
|
@@ -8994,7 +9262,18 @@ function createLogSink(overrides = {}) {
|
|
|
8994
9262
|
attempt: env.VINAYA_ATTEMPT,
|
|
8995
9263
|
parent: env.VINAYA_PARENT_EVENT
|
|
8996
9264
|
};
|
|
8997
|
-
const
|
|
9265
|
+
const write = async () => {
|
|
9266
|
+
const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
|
|
9267
|
+
if (resolvedDestination.kind === "none") {
|
|
9268
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9269
|
+
`);
|
|
9270
|
+
return;
|
|
9271
|
+
}
|
|
9272
|
+
if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
|
|
9273
|
+
warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
|
|
9274
|
+
`);
|
|
9275
|
+
}
|
|
9276
|
+
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
8998
9277
|
const header = buildHeader({
|
|
8999
9278
|
now,
|
|
9000
9279
|
runId,
|
|
@@ -9005,15 +9284,11 @@ function createLogSink(overrides = {}) {
|
|
|
9005
9284
|
host,
|
|
9006
9285
|
hostname: deps.hostname(),
|
|
9007
9286
|
env: envFields,
|
|
9287
|
+
branchIssue,
|
|
9008
9288
|
eventId: randomUUID2(),
|
|
9009
9289
|
processId,
|
|
9010
9290
|
inputVersions: deps.inputVersions()
|
|
9011
9291
|
});
|
|
9012
|
-
if (resolvedDestination.kind === "none") {
|
|
9013
|
-
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9014
|
-
`);
|
|
9015
|
-
return;
|
|
9016
|
-
}
|
|
9017
9292
|
const full = { ...e, ...header };
|
|
9018
9293
|
const parsed = LogEventSchema.safeParse(full);
|
|
9019
9294
|
if (!parsed.success) {
|
|
@@ -9030,10 +9305,12 @@ function createLogSink(overrides = {}) {
|
|
|
9030
9305
|
} else {
|
|
9031
9306
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9032
9307
|
}
|
|
9033
|
-
}
|
|
9308
|
+
};
|
|
9309
|
+
const written = writeChain.then(write).catch((err) => {
|
|
9034
9310
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9035
9311
|
`);
|
|
9036
9312
|
});
|
|
9313
|
+
writeChain = written;
|
|
9037
9314
|
pendingWrites.add(written);
|
|
9038
9315
|
written.finally(() => pendingWrites.delete(written));
|
|
9039
9316
|
} catch (err) {
|
|
@@ -9109,7 +9386,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
9109
9386
|
function fileDiffAgainst(ref, path) {
|
|
9110
9387
|
let out;
|
|
9111
9388
|
try {
|
|
9112
|
-
out =
|
|
9389
|
+
out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
9113
9390
|
encoding: "utf8",
|
|
9114
9391
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9115
9392
|
}).trim();
|
|
@@ -9120,7 +9397,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
9120
9397
|
}
|
|
9121
9398
|
function revParse(ref) {
|
|
9122
9399
|
try {
|
|
9123
|
-
return
|
|
9400
|
+
return execFileSync6("git", ["rev-parse", "--verify", ref], {
|
|
9124
9401
|
encoding: "utf8",
|
|
9125
9402
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9126
9403
|
}).trim();
|
|
@@ -9130,7 +9407,7 @@ function revParse(ref) {
|
|
|
9130
9407
|
}
|
|
9131
9408
|
function repoRoot() {
|
|
9132
9409
|
try {
|
|
9133
|
-
return
|
|
9410
|
+
return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
|
|
9134
9411
|
encoding: "utf8",
|
|
9135
9412
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9136
9413
|
}).trim();
|
|
@@ -9141,7 +9418,7 @@ function repoRoot() {
|
|
|
9141
9418
|
function changedFiles(base) {
|
|
9142
9419
|
let out;
|
|
9143
9420
|
try {
|
|
9144
|
-
out =
|
|
9421
|
+
out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
9145
9422
|
encoding: "utf8",
|
|
9146
9423
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9147
9424
|
}).trim();
|
|
@@ -9166,7 +9443,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
9166
9443
|
const relPaths = changedFiles(ref);
|
|
9167
9444
|
if (relPaths === null)
|
|
9168
9445
|
continue;
|
|
9169
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
9446
|
+
return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
|
|
9170
9447
|
}
|
|
9171
9448
|
return null;
|
|
9172
9449
|
}
|
|
@@ -9201,7 +9478,7 @@ function findingsInThisDiff(findings) {
|
|
|
9201
9478
|
var CHECK_NAME = "doc-coverage";
|
|
9202
9479
|
function git2(args) {
|
|
9203
9480
|
try {
|
|
9204
|
-
return
|
|
9481
|
+
return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
9205
9482
|
} catch {
|
|
9206
9483
|
return "";
|
|
9207
9484
|
}
|
|
@@ -9215,7 +9492,7 @@ function resolvePrBody() {
|
|
|
9215
9492
|
return process.env.PR_BODY;
|
|
9216
9493
|
if (process.env.PR_BODY_FILE) {
|
|
9217
9494
|
try {
|
|
9218
|
-
return
|
|
9495
|
+
return readFileSync7(process.env.PR_BODY_FILE, "utf8");
|
|
9219
9496
|
} catch {
|
|
9220
9497
|
return "";
|
|
9221
9498
|
}
|
|
@@ -9224,7 +9501,7 @@ function resolvePrBody() {
|
|
|
9224
9501
|
}
|
|
9225
9502
|
function fetchPrLabels(prNumber) {
|
|
9226
9503
|
try {
|
|
9227
|
-
const out =
|
|
9504
|
+
const out = execFileSync7("gh", ["pr", "view", String(prNumber), "--json", "labels"], {
|
|
9228
9505
|
encoding: "utf8",
|
|
9229
9506
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9230
9507
|
});
|
|
@@ -9235,7 +9512,7 @@ function fetchPrLabels(prNumber) {
|
|
|
9235
9512
|
}
|
|
9236
9513
|
function fetchWaiverLabelActor(prNumber, label) {
|
|
9237
9514
|
try {
|
|
9238
|
-
const out =
|
|
9515
|
+
const out = execFileSync7("gh", ["api", `repos/{owner}/{repo}/issues/${prNumber}/timeline`, "--paginate"], {
|
|
9239
9516
|
encoding: "utf8",
|
|
9240
9517
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9241
9518
|
});
|
|
@@ -9273,8 +9550,8 @@ function main() {
|
|
|
9273
9550
|
if (changed.length === 0) {
|
|
9274
9551
|
process.exit(0);
|
|
9275
9552
|
}
|
|
9276
|
-
const content =
|
|
9277
|
-
const result = evaluateC5(changed, content, resolvePrBody(),
|
|
9553
|
+
const content = existsSync8(DOC_OWNERS_PATH) ? readFileSync7(DOC_OWNERS_PATH, "utf8") : null;
|
|
9554
|
+
const result = evaluateC5(changed, content, resolvePrBody(), existsSync8, waiverActive(), (p) => fileDiffAgainst(ref, p));
|
|
9278
9555
|
if (result.errors.length > 0) {
|
|
9279
9556
|
for (const message of result.errors) {
|
|
9280
9557
|
emitCheckError({
|