@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,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-doctrine-portability.ts
|
|
4
|
-
import { execFileSync as
|
|
5
|
-
import { readdirSync as
|
|
6
|
-
import { join as
|
|
4
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
5
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync7, statSync as statSync2 } from "node:fs";
|
|
6
|
+
import { join as join10 } from "node:path";
|
|
7
7
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
8
|
var GATE_AUDIENCE = {
|
|
9
9
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -198,8 +198,8 @@ function maskIndentedCode(body, fill) {
|
|
|
198
198
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
199
199
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
200
200
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
201
|
-
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d
|
|
202
|
-
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+
|
|
201
|
+
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
|
|
202
|
+
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
|
|
203
203
|
function splitSlugQualifiedEdge(edge) {
|
|
204
204
|
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
205
205
|
if (!m)
|
|
@@ -2620,7 +2620,7 @@ function isIssueNotFoundError(err) {
|
|
|
2620
2620
|
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2621
2621
|
}
|
|
2622
2622
|
function resolveObjectivesSource(prBody, issue, cutoverIssue) {
|
|
2623
|
-
if (issue !== null && issue < cutoverIssue)
|
|
2623
|
+
if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
|
|
2624
2624
|
return { kind: "none" };
|
|
2625
2625
|
if (issue !== null)
|
|
2626
2626
|
return { kind: "issue", issue };
|
|
@@ -2896,9 +2896,18 @@ var COMMIT_TYPES = [
|
|
|
2896
2896
|
];
|
|
2897
2897
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2898
2898
|
function checkForgeTitle(title) {
|
|
2899
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
2899
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
|
|
2900
2900
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2901
2901
|
return { status: "pass", errors: [] };
|
|
2902
|
+
const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
|
|
2903
|
+
if (letteredTaskId) {
|
|
2904
|
+
return {
|
|
2905
|
+
status: "fail",
|
|
2906
|
+
errors: [
|
|
2907
|
+
`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.`
|
|
2908
|
+
]
|
|
2909
|
+
};
|
|
2910
|
+
}
|
|
2902
2911
|
return {
|
|
2903
2912
|
status: "fail",
|
|
2904
2913
|
errors: [
|
|
@@ -2931,19 +2940,31 @@ function checkNoAgentBoxes(prBody) {
|
|
|
2931
2940
|
]
|
|
2932
2941
|
};
|
|
2933
2942
|
}
|
|
2934
|
-
function
|
|
2943
|
+
function rolloutRuleFor(message) {
|
|
2935
2944
|
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:")) {
|
|
2936
|
-
return
|
|
2945
|
+
return "briefRules";
|
|
2937
2946
|
}
|
|
2938
2947
|
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2939
|
-
return
|
|
2948
|
+
return "agentBoxes";
|
|
2940
2949
|
return null;
|
|
2941
2950
|
}
|
|
2942
|
-
|
|
2951
|
+
var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
|
|
2952
|
+
briefRulesSincePr: BRIEF_RULES_SINCE_PR,
|
|
2953
|
+
agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
|
|
2954
|
+
};
|
|
2955
|
+
function rolloutThresholdFor(message, cutovers) {
|
|
2956
|
+
const rule = rolloutRuleFor(message);
|
|
2957
|
+
if (rule === "briefRules")
|
|
2958
|
+
return cutovers.briefRulesSincePr;
|
|
2959
|
+
if (rule === "agentBoxes")
|
|
2960
|
+
return cutovers.agentBoxesRefusedSincePr;
|
|
2961
|
+
return null;
|
|
2962
|
+
}
|
|
2963
|
+
function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
|
|
2943
2964
|
const blocking = [];
|
|
2944
2965
|
const info = [];
|
|
2945
2966
|
for (const e of errors) {
|
|
2946
|
-
const threshold = rolloutThresholdFor(e);
|
|
2967
|
+
const threshold = rolloutThresholdFor(e, cutovers);
|
|
2947
2968
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2948
2969
|
(grandfathered ? info : blocking).push(e);
|
|
2949
2970
|
}
|
|
@@ -3411,8 +3432,8 @@ function checkIssueRationale(body) {
|
|
|
3411
3432
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3412
3433
|
}
|
|
3413
3434
|
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3414
|
-
function checkIssueObjectives(body, issueNumber) {
|
|
3415
|
-
if (issueNumber !== null && issueNumber <
|
|
3435
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3436
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3416
3437
|
return { status: "pass", errors: [] };
|
|
3417
3438
|
const result = objectivesOf(body);
|
|
3418
3439
|
if (result.ok)
|
|
@@ -3488,6 +3509,8 @@ function parseIssueSurface(body) {
|
|
|
3488
3509
|
function globCoversPath(glob, path) {
|
|
3489
3510
|
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3490
3511
|
const p = path.replace(/\/+$/, "");
|
|
3512
|
+
if (g === "*")
|
|
3513
|
+
return !p.includes("/");
|
|
3491
3514
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3492
3515
|
}
|
|
3493
3516
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
@@ -3857,7 +3880,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3857
3880
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3858
3881
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3859
3882
|
}
|
|
3860
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3883
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3861
3884
|
const failures = [];
|
|
3862
3885
|
for (const [slug, issues] of issuesBySlug) {
|
|
3863
3886
|
for (const issue of issues) {
|
|
@@ -3866,7 +3889,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3866
3889
|
const errors = [
|
|
3867
3890
|
...checkIssueRationale(issue.body).errors,
|
|
3868
3891
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3869
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3892
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3870
3893
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3871
3894
|
];
|
|
3872
3895
|
if (errors.length === 0)
|
|
@@ -4489,13 +4512,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4489
4512
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4490
4513
|
return `${shipsPrefix}tranches/completed/`;
|
|
4491
4514
|
}
|
|
4492
|
-
|
|
4493
|
-
|
|
4515
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4516
|
+
function normalizeSpecPath(entry) {
|
|
4517
|
+
let out = entry.replace(/\\/g, "/");
|
|
4518
|
+
while (out.startsWith("./"))
|
|
4519
|
+
out = out.slice(2);
|
|
4520
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4521
|
+
while (out.endsWith("/"))
|
|
4522
|
+
out = out.slice(0, -1);
|
|
4523
|
+
return out;
|
|
4524
|
+
}
|
|
4525
|
+
function isSpecFile2(path, specPaths) {
|
|
4526
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4527
|
+
return true;
|
|
4528
|
+
if (!path.endsWith(".md"))
|
|
4529
|
+
return false;
|
|
4530
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4494
4531
|
}
|
|
4495
4532
|
function isClaudeMdFile(path) {
|
|
4496
4533
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4497
4534
|
}
|
|
4498
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4535
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4499
4536
|
if (path.startsWith(shipsPrefix)) {
|
|
4500
4537
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4501
4538
|
}
|
|
@@ -4504,7 +4541,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4504
4541
|
}
|
|
4505
4542
|
if (isClaudeMdFile(path))
|
|
4506
4543
|
return "internal";
|
|
4507
|
-
if (isSpecFile2(path))
|
|
4544
|
+
if (isSpecFile2(path, specPaths))
|
|
4508
4545
|
return "spec";
|
|
4509
4546
|
if (isProductScopeFile(path))
|
|
4510
4547
|
return "product";
|
|
@@ -4533,13 +4570,14 @@ function lineAt(content, index) {
|
|
|
4533
4570
|
}
|
|
4534
4571
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4535
4572
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4573
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4536
4574
|
function legacySlugPattern(legacySlugs) {
|
|
4537
4575
|
if (legacySlugs.length === 0)
|
|
4538
4576
|
return null;
|
|
4539
4577
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4540
4578
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4541
4579
|
}
|
|
4542
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4580
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4543
4581
|
const findings = [];
|
|
4544
4582
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4545
4583
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4551,8 +4589,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4551
4589
|
const productPatterns = [
|
|
4552
4590
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4553
4591
|
];
|
|
4592
|
+
const specPatterns = [
|
|
4593
|
+
...patterns,
|
|
4594
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4595
|
+
];
|
|
4554
4596
|
for (const file of files) {
|
|
4555
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4597
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4556
4598
|
if (!cls || cls === "internal")
|
|
4557
4599
|
continue;
|
|
4558
4600
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4561,15 +4603,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4561
4603
|
continue;
|
|
4562
4604
|
const blocking = cls === "product" || cls === "spec";
|
|
4563
4605
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4564
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4606
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4565
4607
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4566
4608
|
pattern.lastIndex = 0;
|
|
4567
4609
|
let match = pattern.exec(scrubbed);
|
|
4568
4610
|
while (match !== null) {
|
|
4569
4611
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4612
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4570
4613
|
findings.push({
|
|
4571
4614
|
file: file.path,
|
|
4572
|
-
line: lineAt(scrubbed,
|
|
4615
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4573
4616
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4574
4617
|
blocking
|
|
4575
4618
|
});
|
|
@@ -4755,9 +4798,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4755
4798
|
}
|
|
4756
4799
|
return findings;
|
|
4757
4800
|
}
|
|
4758
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4801
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4759
4802
|
return [
|
|
4760
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4803
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4761
4804
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4762
4805
|
];
|
|
4763
4806
|
}
|
|
@@ -5222,7 +5265,8 @@ var TaskStatusItemSchema = z.object({
|
|
|
5222
5265
|
}).merge(ObservedSchema);
|
|
5223
5266
|
var TaskStatusResultSchema = z.object({
|
|
5224
5267
|
items: z.array(TaskStatusItemSchema),
|
|
5225
|
-
nextCursor: z.string().nullable()
|
|
5268
|
+
nextCursor: z.string().nullable(),
|
|
5269
|
+
table: z.string()
|
|
5226
5270
|
});
|
|
5227
5271
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5228
5272
|
var EscalationInputsSchema = z.object({
|
|
@@ -5566,6 +5610,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5566
5610
|
}
|
|
5567
5611
|
return findings;
|
|
5568
5612
|
}
|
|
5613
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5614
|
+
var NO_GATE_CUTOVERS = {
|
|
5615
|
+
objectivesSinceIssue: null,
|
|
5616
|
+
briefSectionsSinceIssue: null,
|
|
5617
|
+
documentationSinceIssue: null,
|
|
5618
|
+
briefRulesSincePr: null,
|
|
5619
|
+
agentBoxesRefusedSincePr: null
|
|
5620
|
+
};
|
|
5569
5621
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5570
5622
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5571
5623
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -6015,6 +6067,8 @@ function attemptFromEnv(value) {
|
|
|
6015
6067
|
function provenanceFor(input) {
|
|
6016
6068
|
if (input.provenance)
|
|
6017
6069
|
return input.provenance;
|
|
6070
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6071
|
+
return "unavailable";
|
|
6018
6072
|
if (input.env.role || input.env.task)
|
|
6019
6073
|
return "env_correlated";
|
|
6020
6074
|
return "unavailable";
|
|
@@ -6035,7 +6089,7 @@ function buildHeader(input) {
|
|
|
6035
6089
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6036
6090
|
const round = roundFromEnv(input.env.round);
|
|
6037
6091
|
const subject = {
|
|
6038
|
-
issue: issueFromTask(input.env.task),
|
|
6092
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6039
6093
|
role,
|
|
6040
6094
|
...round !== undefined ? { round } : {},
|
|
6041
6095
|
...input.subject ?? {}
|
|
@@ -6475,7 +6529,12 @@ var VinayaConfigSchema = z4.object({
|
|
|
6475
6529
|
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6476
6530
|
severity: z4.enum(["warning", "error"]).optional()
|
|
6477
6531
|
}).optional(),
|
|
6478
|
-
specGrandfather: z4.array(z4.string().min(1)).optional()
|
|
6532
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6533
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6534
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6535
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6536
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6537
|
+
})).optional()
|
|
6479
6538
|
}).optional(),
|
|
6480
6539
|
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6481
6540
|
dispatch: z4.object({
|
|
@@ -6489,6 +6548,13 @@ var VinayaConfigSchema = z4.object({
|
|
|
6489
6548
|
securityThreshold: z4.string().min(1).optional(),
|
|
6490
6549
|
maxRounds: z4.number().optional()
|
|
6491
6550
|
}).optional(),
|
|
6551
|
+
gateCutovers: z4.object({
|
|
6552
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6553
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6554
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6555
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6556
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6557
|
+
}).optional(),
|
|
6492
6558
|
prePush: z4.object({
|
|
6493
6559
|
alwaysRun: z4.array(z4.string()).optional()
|
|
6494
6560
|
}).optional(),
|
|
@@ -6626,6 +6692,18 @@ function resolveReviewPolicy(config) {
|
|
|
6626
6692
|
maxRounds
|
|
6627
6693
|
};
|
|
6628
6694
|
}
|
|
6695
|
+
function resolveGateCutovers(config) {
|
|
6696
|
+
const raw = config?.gateCutovers;
|
|
6697
|
+
if (!raw)
|
|
6698
|
+
return NO_GATE_CUTOVERS;
|
|
6699
|
+
return {
|
|
6700
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6701
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6702
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6703
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6704
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6705
|
+
};
|
|
6706
|
+
}
|
|
6629
6707
|
function resolveRuntimeDirSetting(config) {
|
|
6630
6708
|
return config?.runtimeDir ?? null;
|
|
6631
6709
|
}
|
|
@@ -6681,7 +6759,8 @@ async function trustAnchorRepoAsync() {
|
|
|
6681
6759
|
try {
|
|
6682
6760
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6683
6761
|
encoding: "utf-8",
|
|
6684
|
-
timeout: 1e4
|
|
6762
|
+
timeout: 1e4,
|
|
6763
|
+
killSignal: "SIGKILL"
|
|
6685
6764
|
});
|
|
6686
6765
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6687
6766
|
} catch {
|
|
@@ -6742,7 +6821,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
6742
6821
|
const repo = await trustAnchorRepoAsync();
|
|
6743
6822
|
if (!repo)
|
|
6744
6823
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6745
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6824
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
6746
6825
|
return stdout;
|
|
6747
6826
|
}
|
|
6748
6827
|
function firstLine(err) {
|
|
@@ -6816,13 +6895,13 @@ function loadConfig() {
|
|
|
6816
6895
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
6817
6896
|
|
|
6818
6897
|
// src/lib/diff-evidence.ts
|
|
6819
|
-
import { execFileSync as
|
|
6820
|
-
import { join as
|
|
6898
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
6899
|
+
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
6821
6900
|
|
|
6822
6901
|
// src/lib/brief-assembly.ts
|
|
6823
|
-
import { execFileSync as
|
|
6824
|
-
import { existsSync as
|
|
6825
|
-
import { join as
|
|
6902
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6903
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
6904
|
+
import { join as join4 } from "node:path";
|
|
6826
6905
|
|
|
6827
6906
|
// ../../packages/sources/src/commands.ts
|
|
6828
6907
|
var COMMANDS = [
|
|
@@ -7328,6 +7407,10 @@ var COMMANDS = [
|
|
|
7328
7407
|
flag: "--role <name>",
|
|
7329
7408
|
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7330
7409
|
},
|
|
7410
|
+
{
|
|
7411
|
+
flag: "--template <name>",
|
|
7412
|
+
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7413
|
+
},
|
|
7331
7414
|
{
|
|
7332
7415
|
flag: "--print",
|
|
7333
7416
|
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."
|
|
@@ -7512,6 +7595,17 @@ var COMMANDS = [
|
|
|
7512
7595
|
"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)."
|
|
7513
7596
|
],
|
|
7514
7597
|
status: "shipped"
|
|
7598
|
+
},
|
|
7599
|
+
{
|
|
7600
|
+
name: "log send",
|
|
7601
|
+
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
7602
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7603
|
+
details: [
|
|
7604
|
+
"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.",
|
|
7605
|
+
"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.",
|
|
7606
|
+
"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."
|
|
7607
|
+
],
|
|
7608
|
+
status: "shipped"
|
|
7515
7609
|
}
|
|
7516
7610
|
];
|
|
7517
7611
|
// ../../packages/sources/src/forge-adapter.ts
|
|
@@ -7663,13 +7757,47 @@ function packageRoot(moduleUrl) {
|
|
|
7663
7757
|
return dir;
|
|
7664
7758
|
}
|
|
7665
7759
|
|
|
7760
|
+
// src/commands/doctrine.ts
|
|
7761
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7762
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7763
|
+
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
7764
|
+
import matter2 from "gray-matter";
|
|
7765
|
+
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7766
|
+
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7767
|
+
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
7768
|
+
}
|
|
7769
|
+
function gitToplevel(cwd) {
|
|
7770
|
+
try {
|
|
7771
|
+
return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7772
|
+
encoding: "utf8",
|
|
7773
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7774
|
+
}).trim();
|
|
7775
|
+
} catch {
|
|
7776
|
+
return null;
|
|
7777
|
+
}
|
|
7778
|
+
}
|
|
7779
|
+
function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7780
|
+
const toplevel = gitToplevel(cwd);
|
|
7781
|
+
if (toplevel !== null) {
|
|
7782
|
+
const treeRoot = join3(toplevel, "aeg-root");
|
|
7783
|
+
if (existsSync3(join3(treeRoot, "roles")))
|
|
7784
|
+
return { root: treeRoot, source: "tree" };
|
|
7785
|
+
}
|
|
7786
|
+
const fromSource = !pkg.split(sep).includes("node_modules");
|
|
7787
|
+
const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
|
|
7788
|
+
return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
|
|
7789
|
+
}
|
|
7790
|
+
function hasDoctrineEntry(root) {
|
|
7791
|
+
return existsSync3(join3(root, ...ENTRY_SEGMENTS));
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7666
7794
|
// src/lib/brief-assembly.ts
|
|
7667
7795
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7668
|
-
var PACKAGED_TEMPLATE_PATH =
|
|
7669
|
-
var TEMPLATE_PATH =
|
|
7796
|
+
var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7797
|
+
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7670
7798
|
function git(args) {
|
|
7671
7799
|
try {
|
|
7672
|
-
return
|
|
7800
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7673
7801
|
} catch {
|
|
7674
7802
|
return "";
|
|
7675
7803
|
}
|
|
@@ -7682,14 +7810,14 @@ function expandGlob(glob) {
|
|
|
7682
7810
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7683
7811
|
|
|
7684
7812
|
// src/checks/registry.ts
|
|
7685
|
-
import { existsSync as
|
|
7686
|
-
import { join as
|
|
7687
|
-
var DIST_BIN_DIR =
|
|
7688
|
-
var SRC_BIN_DIR =
|
|
7689
|
-
var BIN_DIR =
|
|
7813
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
7814
|
+
import { join as join5 } from "node:path";
|
|
7815
|
+
var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7816
|
+
var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7817
|
+
var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7690
7818
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7691
7819
|
function bin(name) {
|
|
7692
|
-
return
|
|
7820
|
+
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7693
7821
|
}
|
|
7694
7822
|
var REGISTRY = [
|
|
7695
7823
|
[
|
|
@@ -8253,21 +8381,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
8253
8381
|
import {
|
|
8254
8382
|
closeSync as closeSync3,
|
|
8255
8383
|
constants as fsConstants3,
|
|
8256
|
-
existsSync as
|
|
8384
|
+
existsSync as existsSync7,
|
|
8257
8385
|
fstatSync as fstatSync2,
|
|
8258
8386
|
mkdirSync as mkdirSync3,
|
|
8259
8387
|
openSync as openSync3,
|
|
8260
|
-
readFileSync as
|
|
8388
|
+
readFileSync as readFileSync6,
|
|
8261
8389
|
renameSync as renameSync2,
|
|
8262
8390
|
writeSync as writeSync2
|
|
8263
8391
|
} from "node:fs";
|
|
8264
8392
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8265
|
-
import { dirname as
|
|
8393
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
8266
8394
|
import { promisify as promisify5 } from "node:util";
|
|
8267
8395
|
|
|
8268
8396
|
// src/lib/run-paths.ts
|
|
8269
|
-
import { chmodSync, existsSync as
|
|
8270
|
-
import { dirname as
|
|
8397
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
|
|
8398
|
+
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8271
8399
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8272
8400
|
function isSafeRepoSegment(segment) {
|
|
8273
8401
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8278,7 +8406,7 @@ function repoSegment(repo) {
|
|
|
8278
8406
|
return `${repo.owner}-${repo.repo}`;
|
|
8279
8407
|
}
|
|
8280
8408
|
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8281
|
-
return
|
|
8409
|
+
return join6(home, "runtime", repoSegment(repo));
|
|
8282
8410
|
}
|
|
8283
8411
|
function resolveRuntimeDir(input) {
|
|
8284
8412
|
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
@@ -8338,9 +8466,9 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8338
8466
|
return null;
|
|
8339
8467
|
}
|
|
8340
8468
|
for (;; ) {
|
|
8341
|
-
if (
|
|
8469
|
+
if (existsSync6(join6(dir, ".git")))
|
|
8342
8470
|
return dir;
|
|
8343
|
-
const parent =
|
|
8471
|
+
const parent = dirname4(dir);
|
|
8344
8472
|
if (parent === dir)
|
|
8345
8473
|
return null;
|
|
8346
8474
|
dir = parent;
|
|
@@ -8355,7 +8483,7 @@ import {
|
|
|
8355
8483
|
mkdirSync as mkdirSync2,
|
|
8356
8484
|
openSync as openSync2,
|
|
8357
8485
|
linkSync,
|
|
8358
|
-
readFileSync as
|
|
8486
|
+
readFileSync as readFileSync5,
|
|
8359
8487
|
renameSync,
|
|
8360
8488
|
statSync,
|
|
8361
8489
|
unlinkSync,
|
|
@@ -8365,7 +8493,7 @@ import {
|
|
|
8365
8493
|
} from "node:fs";
|
|
8366
8494
|
import { randomUUID } from "node:crypto";
|
|
8367
8495
|
import { homedir as homedir2 } from "node:os";
|
|
8368
|
-
import { dirname as
|
|
8496
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8369
8497
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8370
8498
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8371
8499
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8381,7 +8509,7 @@ function isEnoent(err) {
|
|
|
8381
8509
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8382
8510
|
function tryCreateLock(lockPath, token) {
|
|
8383
8511
|
try {
|
|
8384
|
-
mkdirSync2(
|
|
8512
|
+
mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
|
|
8385
8513
|
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8386
8514
|
try {
|
|
8387
8515
|
writeSync(fd, `${token}
|
|
@@ -8446,7 +8574,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8446
8574
|
function renewDrainLock(lockPath, token) {
|
|
8447
8575
|
let holder;
|
|
8448
8576
|
try {
|
|
8449
|
-
holder =
|
|
8577
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
8450
8578
|
} catch (err) {
|
|
8451
8579
|
if (!isEnoent(err))
|
|
8452
8580
|
throw err;
|
|
@@ -8466,7 +8594,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
8466
8594
|
}
|
|
8467
8595
|
function releaseDrainLock(lockPath, token) {
|
|
8468
8596
|
try {
|
|
8469
|
-
const holder =
|
|
8597
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
8470
8598
|
if (holder !== token)
|
|
8471
8599
|
return;
|
|
8472
8600
|
unlinkSync(lockPath);
|
|
@@ -8516,7 +8644,7 @@ function queueLines(buf) {
|
|
|
8516
8644
|
return lines;
|
|
8517
8645
|
}
|
|
8518
8646
|
function removeQueueHead(path, cut) {
|
|
8519
|
-
const remaining =
|
|
8647
|
+
const remaining = readFileSync5(path);
|
|
8520
8648
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8521
8649
|
}
|
|
8522
8650
|
function queueBucketSize(path) {
|
|
@@ -8537,7 +8665,7 @@ function queueBucketSize(path) {
|
|
|
8537
8665
|
function readQueueFile(path) {
|
|
8538
8666
|
if (queueBucketSize(path) === null)
|
|
8539
8667
|
return null;
|
|
8540
|
-
return
|
|
8668
|
+
return readFileSync5(path);
|
|
8541
8669
|
}
|
|
8542
8670
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8543
8671
|
const record = JSON.stringify({
|
|
@@ -8652,7 +8780,7 @@ async function drainRenamedAside(args, livePath, source) {
|
|
|
8652
8780
|
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8653
8781
|
const resolved = await resolveRepo();
|
|
8654
8782
|
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8655
|
-
const outboxRoot = () =>
|
|
8783
|
+
const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
|
|
8656
8784
|
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8657
8785
|
const lockPath = `${path}.flush-lock`;
|
|
8658
8786
|
const lockToken = acquireDrainLock(lockPath);
|
|
@@ -8689,7 +8817,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
8689
8817
|
|
|
8690
8818
|
// src/lib/log-sink.ts
|
|
8691
8819
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8820
|
+
function describeFolderFallback(reason) {
|
|
8821
|
+
if (reason.kind === "anchor-unreadable") {
|
|
8822
|
+
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`";
|
|
8823
|
+
}
|
|
8824
|
+
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";
|
|
8825
|
+
}
|
|
8692
8826
|
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8827
|
+
var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
|
|
8693
8828
|
function withDeadline(work, ms, fallback) {
|
|
8694
8829
|
return new Promise((resolve) => {
|
|
8695
8830
|
const timer = setTimeout(() => resolve(fallback), ms);
|
|
@@ -8704,7 +8839,7 @@ function withDeadline(work, ms, fallback) {
|
|
|
8704
8839
|
});
|
|
8705
8840
|
}
|
|
8706
8841
|
async function safeLoadTrustAnchorConfig() {
|
|
8707
|
-
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
8842
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
8708
8843
|
}
|
|
8709
8844
|
function logsCredentialMissing(headers, env) {
|
|
8710
8845
|
if (!headers)
|
|
@@ -8721,8 +8856,16 @@ function logsCredentialMissing(headers, env) {
|
|
|
8721
8856
|
function resolveLogDestinationFrom(input) {
|
|
8722
8857
|
const local = resolveLogsSetting(input.localConfig);
|
|
8723
8858
|
let effective = null;
|
|
8859
|
+
let fallbackReason;
|
|
8724
8860
|
if (input.unattended) {
|
|
8725
|
-
|
|
8861
|
+
if (local) {
|
|
8862
|
+
effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
|
|
8863
|
+
if (effective === null && "url" in local) {
|
|
8864
|
+
fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
|
|
8865
|
+
}
|
|
8866
|
+
} else {
|
|
8867
|
+
effective = resolveLogsSetting(input.trustAnchorConfig);
|
|
8868
|
+
}
|
|
8726
8869
|
} else {
|
|
8727
8870
|
effective = local;
|
|
8728
8871
|
}
|
|
@@ -8748,7 +8891,7 @@ function resolveLogDestinationFrom(input) {
|
|
|
8748
8891
|
effective = null;
|
|
8749
8892
|
}
|
|
8750
8893
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8751
|
-
return { kind: "folder", folder };
|
|
8894
|
+
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8752
8895
|
}
|
|
8753
8896
|
var processTrustAnchorOnce;
|
|
8754
8897
|
function processTrustAnchor() {
|
|
@@ -8764,7 +8907,7 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
8764
8907
|
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8765
8908
|
unattended,
|
|
8766
8909
|
env,
|
|
8767
|
-
defaultFolder:
|
|
8910
|
+
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8768
8911
|
repoRoot: repoRootSync()
|
|
8769
8912
|
});
|
|
8770
8913
|
}
|
|
@@ -8779,7 +8922,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8779
8922
|
} catch (err) {
|
|
8780
8923
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8781
8924
|
}
|
|
8782
|
-
if (!
|
|
8925
|
+
if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
|
|
8783
8926
|
return vinayaVersion;
|
|
8784
8927
|
try {
|
|
8785
8928
|
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
@@ -8788,9 +8931,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8788
8931
|
return vinayaVersion;
|
|
8789
8932
|
}
|
|
8790
8933
|
}
|
|
8934
|
+
var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8935
|
+
function taskRefFromBranch2(branch) {
|
|
8936
|
+
const backlog = /^task\/issue-(\d+)$/.exec(branch);
|
|
8937
|
+
if (backlog) {
|
|
8938
|
+
const issue = Number(backlog[1]);
|
|
8939
|
+
return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
|
|
8940
|
+
}
|
|
8941
|
+
const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
8942
|
+
if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
|
|
8943
|
+
return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
|
|
8944
|
+
}
|
|
8945
|
+
return null;
|
|
8946
|
+
}
|
|
8947
|
+
var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
8948
|
+
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
8949
|
+
let stdout;
|
|
8950
|
+
try {
|
|
8951
|
+
({ stdout } = await execFileAsync5("gh", [
|
|
8952
|
+
"issue",
|
|
8953
|
+
"list",
|
|
8954
|
+
"--state",
|
|
8955
|
+
"all",
|
|
8956
|
+
"--label",
|
|
8957
|
+
`vinaya/tranche:${tranche}`,
|
|
8958
|
+
"--json",
|
|
8959
|
+
"number,title,labels",
|
|
8960
|
+
"--limit",
|
|
8961
|
+
String(TRANCHE_ISSUE_LIST_LIMIT),
|
|
8962
|
+
...repo === null ? [] : ["--repo", repo]
|
|
8963
|
+
], {
|
|
8964
|
+
cwd,
|
|
8965
|
+
encoding: "utf8",
|
|
8966
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
8967
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8968
|
+
killSignal: "SIGKILL"
|
|
8969
|
+
}));
|
|
8970
|
+
} catch {
|
|
8971
|
+
return null;
|
|
8972
|
+
}
|
|
8973
|
+
let issues;
|
|
8974
|
+
try {
|
|
8975
|
+
issues = JSON.parse(stdout);
|
|
8976
|
+
} catch {
|
|
8977
|
+
return null;
|
|
8978
|
+
}
|
|
8979
|
+
for (const issue of issues) {
|
|
8980
|
+
const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
|
|
8981
|
+
if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
|
|
8982
|
+
return issue.number;
|
|
8983
|
+
}
|
|
8984
|
+
return null;
|
|
8985
|
+
}
|
|
8986
|
+
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
8987
|
+
let stdout;
|
|
8988
|
+
try {
|
|
8989
|
+
({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
8990
|
+
cwd,
|
|
8991
|
+
encoding: "utf8",
|
|
8992
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8993
|
+
killSignal: "SIGKILL"
|
|
8994
|
+
}));
|
|
8995
|
+
} catch (err) {
|
|
8996
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
8997
|
+
return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
|
|
8998
|
+
}
|
|
8999
|
+
try {
|
|
9000
|
+
return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
|
|
9001
|
+
} catch {
|
|
9002
|
+
return "unknown";
|
|
9003
|
+
}
|
|
9004
|
+
}
|
|
9005
|
+
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
9006
|
+
let branch;
|
|
9007
|
+
try {
|
|
9008
|
+
branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
9009
|
+
encoding: "utf8",
|
|
9010
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
9011
|
+
killSignal: "SIGKILL"
|
|
9012
|
+
})).stdout.trim();
|
|
9013
|
+
} catch {
|
|
9014
|
+
return null;
|
|
9015
|
+
}
|
|
9016
|
+
const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
|
|
9017
|
+
const ref = taskRefFromBranch2(named);
|
|
9018
|
+
if (ref === null)
|
|
9019
|
+
return null;
|
|
9020
|
+
if (ref.kind === "tranche")
|
|
9021
|
+
return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
|
|
9022
|
+
return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
|
|
9023
|
+
}
|
|
8791
9024
|
function readVinayaVersion() {
|
|
8792
9025
|
try {
|
|
8793
|
-
const pkg = JSON.parse(
|
|
9026
|
+
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8794
9027
|
return pkg.version ?? "unknown";
|
|
8795
9028
|
} catch {
|
|
8796
9029
|
return "unknown";
|
|
@@ -8800,10 +9033,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
|
8800
9033
|
function isSafeRepoSegment3(segment) {
|
|
8801
9034
|
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8802
9035
|
}
|
|
9036
|
+
function safeRepoSlug(repo) {
|
|
9037
|
+
if (repo === null)
|
|
9038
|
+
return null;
|
|
9039
|
+
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
9040
|
+
}
|
|
8803
9041
|
function outboxPathFor(deps, repo, issue) {
|
|
8804
9042
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8805
9043
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8806
|
-
return
|
|
9044
|
+
return join8(deps.outboxRoot(), dirName, fileName);
|
|
8807
9045
|
}
|
|
8808
9046
|
function hostFromEnv(env) {
|
|
8809
9047
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8821,9 +9059,21 @@ function defaultStderr(message) {
|
|
|
8821
9059
|
warnedThisProcess = true;
|
|
8822
9060
|
process.stderr.write(message);
|
|
8823
9061
|
}
|
|
9062
|
+
var branchIssueFallbackEnabled = true;
|
|
9063
|
+
var branchIssueByCwd = new Map;
|
|
9064
|
+
function branchIssueRead(key, read, shared) {
|
|
9065
|
+
if (!shared)
|
|
9066
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9067
|
+
const cached = branchIssueByCwd.get(key);
|
|
9068
|
+
if (cached !== undefined)
|
|
9069
|
+
return cached;
|
|
9070
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9071
|
+
branchIssueByCwd.set(key, reading);
|
|
9072
|
+
return reading;
|
|
9073
|
+
}
|
|
8824
9074
|
function defaultDeps() {
|
|
8825
9075
|
return {
|
|
8826
|
-
outboxRoot: () =>
|
|
9076
|
+
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8827
9077
|
home: () => homedir3(),
|
|
8828
9078
|
hostname: () => osHostname(),
|
|
8829
9079
|
cwd: () => process.cwd(),
|
|
@@ -8848,7 +9098,7 @@ function guardedAppendOpen(path) {
|
|
|
8848
9098
|
}
|
|
8849
9099
|
function appendHardenedLine(path, line) {
|
|
8850
9100
|
try {
|
|
8851
|
-
mkdirSync3(
|
|
9101
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8852
9102
|
const fd = guardedAppendOpen(path);
|
|
8853
9103
|
if (fd === undefined)
|
|
8854
9104
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
@@ -8867,7 +9117,7 @@ function appendHardenedLine(path, line) {
|
|
|
8867
9117
|
function reportRotationOverflow(backupPath, warn) {
|
|
8868
9118
|
let raw;
|
|
8869
9119
|
try {
|
|
8870
|
-
raw =
|
|
9120
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
8871
9121
|
} catch {
|
|
8872
9122
|
return;
|
|
8873
9123
|
}
|
|
@@ -8890,7 +9140,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8890
9140
|
}
|
|
8891
9141
|
function appendLine(path, line, warn) {
|
|
8892
9142
|
try {
|
|
8893
|
-
mkdirSync3(
|
|
9143
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8894
9144
|
let fd = guardedAppendOpen(path);
|
|
8895
9145
|
if (fd === undefined) {
|
|
8896
9146
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8931,7 +9181,11 @@ function appendLine(path, line, warn) {
|
|
|
8931
9181
|
}
|
|
8932
9182
|
}
|
|
8933
9183
|
function createLogSink(overrides = {}) {
|
|
8934
|
-
const deps = {
|
|
9184
|
+
const deps = {
|
|
9185
|
+
...defaultDeps(),
|
|
9186
|
+
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9187
|
+
...overrides
|
|
9188
|
+
};
|
|
8935
9189
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8936
9190
|
const processId = randomUUID2();
|
|
8937
9191
|
let seq = 0;
|
|
@@ -8951,6 +9205,19 @@ function createLogSink(overrides = {}) {
|
|
|
8951
9205
|
}
|
|
8952
9206
|
return doctrineCache;
|
|
8953
9207
|
};
|
|
9208
|
+
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9209
|
+
let ownBranchIssue;
|
|
9210
|
+
const branchIssueOnce = (repo) => {
|
|
9211
|
+
if (!branchIssueFallbackEnabled)
|
|
9212
|
+
return Promise.resolve(null);
|
|
9213
|
+
const slug = safeRepoSlug(repo);
|
|
9214
|
+
const read = () => deps.resolveBranchIssue(slug);
|
|
9215
|
+
if (readerIsReal)
|
|
9216
|
+
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9217
|
+
if (ownBranchIssue === undefined)
|
|
9218
|
+
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9219
|
+
return ownBranchIssue;
|
|
9220
|
+
};
|
|
8954
9221
|
let resolveRepoCache;
|
|
8955
9222
|
const resolveRepoOnce = () => {
|
|
8956
9223
|
if (resolveRepoCache === undefined)
|
|
@@ -8973,6 +9240,7 @@ function createLogSink(overrides = {}) {
|
|
|
8973
9240
|
};
|
|
8974
9241
|
let drainChain = Promise.resolve();
|
|
8975
9242
|
const pendingWrites = new Set;
|
|
9243
|
+
let writeChain = Promise.resolve();
|
|
8976
9244
|
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
8977
9245
|
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
8978
9246
|
return;
|
|
@@ -8995,7 +9263,18 @@ function createLogSink(overrides = {}) {
|
|
|
8995
9263
|
attempt: env.VINAYA_ATTEMPT,
|
|
8996
9264
|
parent: env.VINAYA_PARENT_EVENT
|
|
8997
9265
|
};
|
|
8998
|
-
const
|
|
9266
|
+
const write = async () => {
|
|
9267
|
+
const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
|
|
9268
|
+
if (resolvedDestination.kind === "none") {
|
|
9269
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9270
|
+
`);
|
|
9271
|
+
return;
|
|
9272
|
+
}
|
|
9273
|
+
if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
|
|
9274
|
+
warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
|
|
9275
|
+
`);
|
|
9276
|
+
}
|
|
9277
|
+
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
8999
9278
|
const header = buildHeader({
|
|
9000
9279
|
now,
|
|
9001
9280
|
runId,
|
|
@@ -9006,15 +9285,11 @@ function createLogSink(overrides = {}) {
|
|
|
9006
9285
|
host,
|
|
9007
9286
|
hostname: deps.hostname(),
|
|
9008
9287
|
env: envFields,
|
|
9288
|
+
branchIssue,
|
|
9009
9289
|
eventId: randomUUID2(),
|
|
9010
9290
|
processId,
|
|
9011
9291
|
inputVersions: deps.inputVersions()
|
|
9012
9292
|
});
|
|
9013
|
-
if (resolvedDestination.kind === "none") {
|
|
9014
|
-
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9015
|
-
`);
|
|
9016
|
-
return;
|
|
9017
|
-
}
|
|
9018
9293
|
const full = { ...e, ...header };
|
|
9019
9294
|
const parsed = LogEventSchema.safeParse(full);
|
|
9020
9295
|
if (!parsed.success) {
|
|
@@ -9031,10 +9306,12 @@ function createLogSink(overrides = {}) {
|
|
|
9031
9306
|
} else {
|
|
9032
9307
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9033
9308
|
}
|
|
9034
|
-
}
|
|
9309
|
+
};
|
|
9310
|
+
const written = writeChain.then(write).catch((err) => {
|
|
9035
9311
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9036
9312
|
`);
|
|
9037
9313
|
});
|
|
9314
|
+
writeChain = written;
|
|
9038
9315
|
pendingWrites.add(written);
|
|
9039
9316
|
written.finally(() => pendingWrites.delete(written));
|
|
9040
9317
|
} catch (err) {
|
|
@@ -9110,7 +9387,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
9110
9387
|
function fileDiffAgainst(ref, path) {
|
|
9111
9388
|
let out;
|
|
9112
9389
|
try {
|
|
9113
|
-
out =
|
|
9390
|
+
out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
9114
9391
|
encoding: "utf8",
|
|
9115
9392
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9116
9393
|
}).trim();
|
|
@@ -9121,7 +9398,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
9121
9398
|
}
|
|
9122
9399
|
function revParse(ref) {
|
|
9123
9400
|
try {
|
|
9124
|
-
return
|
|
9401
|
+
return execFileSync6("git", ["rev-parse", "--verify", ref], {
|
|
9125
9402
|
encoding: "utf8",
|
|
9126
9403
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9127
9404
|
}).trim();
|
|
@@ -9131,7 +9408,7 @@ function revParse(ref) {
|
|
|
9131
9408
|
}
|
|
9132
9409
|
function repoRoot() {
|
|
9133
9410
|
try {
|
|
9134
|
-
return
|
|
9411
|
+
return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
|
|
9135
9412
|
encoding: "utf8",
|
|
9136
9413
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9137
9414
|
}).trim();
|
|
@@ -9142,7 +9419,7 @@ function repoRoot() {
|
|
|
9142
9419
|
function changedFiles(base) {
|
|
9143
9420
|
let out;
|
|
9144
9421
|
try {
|
|
9145
|
-
out =
|
|
9422
|
+
out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
9146
9423
|
encoding: "utf8",
|
|
9147
9424
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9148
9425
|
}).trim();
|
|
@@ -9167,7 +9444,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
9167
9444
|
const relPaths = changedFiles(ref);
|
|
9168
9445
|
if (relPaths === null)
|
|
9169
9446
|
continue;
|
|
9170
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
9447
|
+
return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
|
|
9171
9448
|
}
|
|
9172
9449
|
return null;
|
|
9173
9450
|
}
|
|
@@ -9204,7 +9481,7 @@ var DOCTRINE_ROOT = loadConfig()?.proseGates?.doctrineRoot ?? "aeg-root";
|
|
|
9204
9481
|
var SHIPS_PREFIX2 = `${DOCTRINE_ROOT}/`;
|
|
9205
9482
|
function git2(args) {
|
|
9206
9483
|
try {
|
|
9207
|
-
return
|
|
9484
|
+
return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
9208
9485
|
} catch {
|
|
9209
9486
|
return "";
|
|
9210
9487
|
}
|
|
@@ -9212,12 +9489,12 @@ function git2(args) {
|
|
|
9212
9489
|
function collectWorkingTree(dir, out = []) {
|
|
9213
9490
|
let entries;
|
|
9214
9491
|
try {
|
|
9215
|
-
entries =
|
|
9492
|
+
entries = readdirSync3(dir);
|
|
9216
9493
|
} catch {
|
|
9217
9494
|
return out;
|
|
9218
9495
|
}
|
|
9219
9496
|
for (const name of entries) {
|
|
9220
|
-
const full =
|
|
9497
|
+
const full = join10(dir, name);
|
|
9221
9498
|
let isDir;
|
|
9222
9499
|
try {
|
|
9223
9500
|
isDir = statSync2(full).isDirectory();
|
|
@@ -9235,7 +9512,7 @@ function collectWorkingTree(dir, out = []) {
|
|
|
9235
9512
|
return out;
|
|
9236
9513
|
}
|
|
9237
9514
|
function readWorkingTree(paths) {
|
|
9238
|
-
return paths.map((p) => ({ path: p, content:
|
|
9515
|
+
return paths.map((p) => ({ path: p, content: readFileSync7(p, "utf8") }));
|
|
9239
9516
|
}
|
|
9240
9517
|
function collectAtRef(ref, dir) {
|
|
9241
9518
|
const listing = git2(["ls-tree", "-r", "--name-only", ref, "--", dir]);
|