@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-exec-bits.ts
|
|
4
|
-
import { execFileSync as
|
|
5
|
-
import { readFileSync as
|
|
4
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
5
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
6
6
|
|
|
7
7
|
// src/checks/contract.ts
|
|
8
8
|
var CHECK_SCHEMA_VERSION = 1;
|
|
@@ -12,8 +12,8 @@ function emitCheckError(error) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// src/lib/diff-evidence.ts
|
|
15
|
-
import { execFileSync as
|
|
16
|
-
import { join as
|
|
15
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
16
|
+
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
17
17
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
18
18
|
var GATE_AUDIENCE = {
|
|
19
19
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -208,8 +208,8 @@ function maskIndentedCode(body, fill) {
|
|
|
208
208
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
209
209
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
210
210
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
211
|
-
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d
|
|
212
|
-
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+
|
|
211
|
+
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
|
|
212
|
+
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
|
|
213
213
|
function splitSlugQualifiedEdge(edge) {
|
|
214
214
|
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
215
215
|
if (!m)
|
|
@@ -2630,7 +2630,7 @@ function isIssueNotFoundError(err) {
|
|
|
2630
2630
|
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2631
2631
|
}
|
|
2632
2632
|
function resolveObjectivesSource(prBody, issue, cutoverIssue) {
|
|
2633
|
-
if (issue !== null && issue < cutoverIssue)
|
|
2633
|
+
if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
|
|
2634
2634
|
return { kind: "none" };
|
|
2635
2635
|
if (issue !== null)
|
|
2636
2636
|
return { kind: "issue", issue };
|
|
@@ -2906,9 +2906,18 @@ var COMMIT_TYPES = [
|
|
|
2906
2906
|
];
|
|
2907
2907
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2908
2908
|
function checkForgeTitle(title) {
|
|
2909
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
2909
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
|
|
2910
2910
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2911
2911
|
return { status: "pass", errors: [] };
|
|
2912
|
+
const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
|
|
2913
|
+
if (letteredTaskId) {
|
|
2914
|
+
return {
|
|
2915
|
+
status: "fail",
|
|
2916
|
+
errors: [
|
|
2917
|
+
`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.`
|
|
2918
|
+
]
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2912
2921
|
return {
|
|
2913
2922
|
status: "fail",
|
|
2914
2923
|
errors: [
|
|
@@ -2941,19 +2950,31 @@ function checkNoAgentBoxes(prBody) {
|
|
|
2941
2950
|
]
|
|
2942
2951
|
};
|
|
2943
2952
|
}
|
|
2944
|
-
function
|
|
2953
|
+
function rolloutRuleFor(message) {
|
|
2945
2954
|
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:")) {
|
|
2946
|
-
return
|
|
2955
|
+
return "briefRules";
|
|
2947
2956
|
}
|
|
2948
2957
|
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2949
|
-
return
|
|
2958
|
+
return "agentBoxes";
|
|
2959
|
+
return null;
|
|
2960
|
+
}
|
|
2961
|
+
var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
|
|
2962
|
+
briefRulesSincePr: BRIEF_RULES_SINCE_PR,
|
|
2963
|
+
agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
|
|
2964
|
+
};
|
|
2965
|
+
function rolloutThresholdFor(message, cutovers) {
|
|
2966
|
+
const rule = rolloutRuleFor(message);
|
|
2967
|
+
if (rule === "briefRules")
|
|
2968
|
+
return cutovers.briefRulesSincePr;
|
|
2969
|
+
if (rule === "agentBoxes")
|
|
2970
|
+
return cutovers.agentBoxesRefusedSincePr;
|
|
2950
2971
|
return null;
|
|
2951
2972
|
}
|
|
2952
|
-
function partitionBriefErrorsByRollout(errors, prNumber) {
|
|
2973
|
+
function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
|
|
2953
2974
|
const blocking = [];
|
|
2954
2975
|
const info = [];
|
|
2955
2976
|
for (const e of errors) {
|
|
2956
|
-
const threshold = rolloutThresholdFor(e);
|
|
2977
|
+
const threshold = rolloutThresholdFor(e, cutovers);
|
|
2957
2978
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2958
2979
|
(grandfathered ? info : blocking).push(e);
|
|
2959
2980
|
}
|
|
@@ -3421,8 +3442,8 @@ function checkIssueRationale(body) {
|
|
|
3421
3442
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3422
3443
|
}
|
|
3423
3444
|
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3424
|
-
function checkIssueObjectives(body, issueNumber) {
|
|
3425
|
-
if (issueNumber !== null && issueNumber <
|
|
3445
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3446
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3426
3447
|
return { status: "pass", errors: [] };
|
|
3427
3448
|
const result = objectivesOf(body);
|
|
3428
3449
|
if (result.ok)
|
|
@@ -3498,6 +3519,8 @@ function parseIssueSurface(body) {
|
|
|
3498
3519
|
function globCoversPath(glob, path) {
|
|
3499
3520
|
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3500
3521
|
const p = path.replace(/\/+$/, "");
|
|
3522
|
+
if (g === "*")
|
|
3523
|
+
return !p.includes("/");
|
|
3501
3524
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3502
3525
|
}
|
|
3503
3526
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
@@ -3867,7 +3890,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3867
3890
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3868
3891
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3869
3892
|
}
|
|
3870
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3893
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3871
3894
|
const failures = [];
|
|
3872
3895
|
for (const [slug, issues] of issuesBySlug) {
|
|
3873
3896
|
for (const issue of issues) {
|
|
@@ -3876,7 +3899,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3876
3899
|
const errors = [
|
|
3877
3900
|
...checkIssueRationale(issue.body).errors,
|
|
3878
3901
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3879
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3902
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3880
3903
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3881
3904
|
];
|
|
3882
3905
|
if (errors.length === 0)
|
|
@@ -4499,13 +4522,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4499
4522
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4500
4523
|
return `${shipsPrefix}tranches/completed/`;
|
|
4501
4524
|
}
|
|
4502
|
-
|
|
4503
|
-
|
|
4525
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4526
|
+
function normalizeSpecPath(entry) {
|
|
4527
|
+
let out = entry.replace(/\\/g, "/");
|
|
4528
|
+
while (out.startsWith("./"))
|
|
4529
|
+
out = out.slice(2);
|
|
4530
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4531
|
+
while (out.endsWith("/"))
|
|
4532
|
+
out = out.slice(0, -1);
|
|
4533
|
+
return out;
|
|
4534
|
+
}
|
|
4535
|
+
function isSpecFile2(path, specPaths) {
|
|
4536
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4537
|
+
return true;
|
|
4538
|
+
if (!path.endsWith(".md"))
|
|
4539
|
+
return false;
|
|
4540
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4504
4541
|
}
|
|
4505
4542
|
function isClaudeMdFile(path) {
|
|
4506
4543
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4507
4544
|
}
|
|
4508
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4545
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4509
4546
|
if (path.startsWith(shipsPrefix)) {
|
|
4510
4547
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4511
4548
|
}
|
|
@@ -4514,7 +4551,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4514
4551
|
}
|
|
4515
4552
|
if (isClaudeMdFile(path))
|
|
4516
4553
|
return "internal";
|
|
4517
|
-
if (isSpecFile2(path))
|
|
4554
|
+
if (isSpecFile2(path, specPaths))
|
|
4518
4555
|
return "spec";
|
|
4519
4556
|
if (isProductScopeFile(path))
|
|
4520
4557
|
return "product";
|
|
@@ -4543,13 +4580,14 @@ function lineAt(content, index) {
|
|
|
4543
4580
|
}
|
|
4544
4581
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4545
4582
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4583
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4546
4584
|
function legacySlugPattern(legacySlugs) {
|
|
4547
4585
|
if (legacySlugs.length === 0)
|
|
4548
4586
|
return null;
|
|
4549
4587
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4550
4588
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4551
4589
|
}
|
|
4552
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4590
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4553
4591
|
const findings = [];
|
|
4554
4592
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4555
4593
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4561,8 +4599,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4561
4599
|
const productPatterns = [
|
|
4562
4600
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4563
4601
|
];
|
|
4602
|
+
const specPatterns = [
|
|
4603
|
+
...patterns,
|
|
4604
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4605
|
+
];
|
|
4564
4606
|
for (const file of files) {
|
|
4565
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4607
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4566
4608
|
if (!cls || cls === "internal")
|
|
4567
4609
|
continue;
|
|
4568
4610
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4571,15 +4613,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4571
4613
|
continue;
|
|
4572
4614
|
const blocking = cls === "product" || cls === "spec";
|
|
4573
4615
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4574
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4616
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4575
4617
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4576
4618
|
pattern.lastIndex = 0;
|
|
4577
4619
|
let match = pattern.exec(scrubbed);
|
|
4578
4620
|
while (match !== null) {
|
|
4579
4621
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4622
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4580
4623
|
findings.push({
|
|
4581
4624
|
file: file.path,
|
|
4582
|
-
line: lineAt(scrubbed,
|
|
4625
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4583
4626
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4584
4627
|
blocking
|
|
4585
4628
|
});
|
|
@@ -4765,9 +4808,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4765
4808
|
}
|
|
4766
4809
|
return findings;
|
|
4767
4810
|
}
|
|
4768
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4811
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4769
4812
|
return [
|
|
4770
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4813
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4771
4814
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4772
4815
|
];
|
|
4773
4816
|
}
|
|
@@ -5232,7 +5275,8 @@ var TaskStatusItemSchema = z.object({
|
|
|
5232
5275
|
}).merge(ObservedSchema);
|
|
5233
5276
|
var TaskStatusResultSchema = z.object({
|
|
5234
5277
|
items: z.array(TaskStatusItemSchema),
|
|
5235
|
-
nextCursor: z.string().nullable()
|
|
5278
|
+
nextCursor: z.string().nullable(),
|
|
5279
|
+
table: z.string()
|
|
5236
5280
|
});
|
|
5237
5281
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5238
5282
|
var EscalationInputsSchema = z.object({
|
|
@@ -5576,6 +5620,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5576
5620
|
}
|
|
5577
5621
|
return findings;
|
|
5578
5622
|
}
|
|
5623
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5624
|
+
var NO_GATE_CUTOVERS = {
|
|
5625
|
+
objectivesSinceIssue: null,
|
|
5626
|
+
briefSectionsSinceIssue: null,
|
|
5627
|
+
documentationSinceIssue: null,
|
|
5628
|
+
briefRulesSincePr: null,
|
|
5629
|
+
agentBoxesRefusedSincePr: null
|
|
5630
|
+
};
|
|
5579
5631
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5580
5632
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5581
5633
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -6025,6 +6077,8 @@ function attemptFromEnv(value) {
|
|
|
6025
6077
|
function provenanceFor(input) {
|
|
6026
6078
|
if (input.provenance)
|
|
6027
6079
|
return input.provenance;
|
|
6080
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6081
|
+
return "unavailable";
|
|
6028
6082
|
if (input.env.role || input.env.task)
|
|
6029
6083
|
return "env_correlated";
|
|
6030
6084
|
return "unavailable";
|
|
@@ -6045,7 +6099,7 @@ function buildHeader(input) {
|
|
|
6045
6099
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6046
6100
|
const round = roundFromEnv(input.env.round);
|
|
6047
6101
|
const subject = {
|
|
6048
|
-
issue: issueFromTask(input.env.task),
|
|
6102
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6049
6103
|
role,
|
|
6050
6104
|
...round !== undefined ? { round } : {},
|
|
6051
6105
|
...input.subject ?? {}
|
|
@@ -6485,7 +6539,12 @@ var VinayaConfigSchema = z4.object({
|
|
|
6485
6539
|
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6486
6540
|
severity: z4.enum(["warning", "error"]).optional()
|
|
6487
6541
|
}).optional(),
|
|
6488
|
-
specGrandfather: z4.array(z4.string().min(1)).optional()
|
|
6542
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6543
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6544
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6545
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6546
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6547
|
+
})).optional()
|
|
6489
6548
|
}).optional(),
|
|
6490
6549
|
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6491
6550
|
dispatch: z4.object({
|
|
@@ -6499,6 +6558,13 @@ var VinayaConfigSchema = z4.object({
|
|
|
6499
6558
|
securityThreshold: z4.string().min(1).optional(),
|
|
6500
6559
|
maxRounds: z4.number().optional()
|
|
6501
6560
|
}).optional(),
|
|
6561
|
+
gateCutovers: z4.object({
|
|
6562
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6563
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6564
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6565
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6566
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6567
|
+
}).optional(),
|
|
6502
6568
|
prePush: z4.object({
|
|
6503
6569
|
alwaysRun: z4.array(z4.string()).optional()
|
|
6504
6570
|
}).optional(),
|
|
@@ -6636,6 +6702,18 @@ function resolveReviewPolicy(config) {
|
|
|
6636
6702
|
maxRounds
|
|
6637
6703
|
};
|
|
6638
6704
|
}
|
|
6705
|
+
function resolveGateCutovers(config) {
|
|
6706
|
+
const raw = config?.gateCutovers;
|
|
6707
|
+
if (!raw)
|
|
6708
|
+
return NO_GATE_CUTOVERS;
|
|
6709
|
+
return {
|
|
6710
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6711
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6712
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6713
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6714
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6715
|
+
};
|
|
6716
|
+
}
|
|
6639
6717
|
function resolveRuntimeDirSetting(config) {
|
|
6640
6718
|
return config?.runtimeDir ?? null;
|
|
6641
6719
|
}
|
|
@@ -6691,7 +6769,8 @@ async function trustAnchorRepoAsync() {
|
|
|
6691
6769
|
try {
|
|
6692
6770
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6693
6771
|
encoding: "utf-8",
|
|
6694
|
-
timeout: 1e4
|
|
6772
|
+
timeout: 1e4,
|
|
6773
|
+
killSignal: "SIGKILL"
|
|
6695
6774
|
});
|
|
6696
6775
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6697
6776
|
} catch {
|
|
@@ -6752,7 +6831,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
6752
6831
|
const repo = await trustAnchorRepoAsync();
|
|
6753
6832
|
if (!repo)
|
|
6754
6833
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6755
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6834
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
6756
6835
|
return stdout;
|
|
6757
6836
|
}
|
|
6758
6837
|
function firstLine(err) {
|
|
@@ -6826,9 +6905,9 @@ function loadConfig() {
|
|
|
6826
6905
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
6827
6906
|
|
|
6828
6907
|
// src/lib/brief-assembly.ts
|
|
6829
|
-
import { execFileSync as
|
|
6830
|
-
import { existsSync as
|
|
6831
|
-
import { join as
|
|
6908
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6909
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
6910
|
+
import { join as join4 } from "node:path";
|
|
6832
6911
|
|
|
6833
6912
|
// ../../packages/sources/src/commands.ts
|
|
6834
6913
|
var COMMANDS = [
|
|
@@ -7334,6 +7413,10 @@ var COMMANDS = [
|
|
|
7334
7413
|
flag: "--role <name>",
|
|
7335
7414
|
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7336
7415
|
},
|
|
7416
|
+
{
|
|
7417
|
+
flag: "--template <name>",
|
|
7418
|
+
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7419
|
+
},
|
|
7337
7420
|
{
|
|
7338
7421
|
flag: "--print",
|
|
7339
7422
|
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."
|
|
@@ -7518,6 +7601,17 @@ var COMMANDS = [
|
|
|
7518
7601
|
"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)."
|
|
7519
7602
|
],
|
|
7520
7603
|
status: "shipped"
|
|
7604
|
+
},
|
|
7605
|
+
{
|
|
7606
|
+
name: "log send",
|
|
7607
|
+
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
7608
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7609
|
+
details: [
|
|
7610
|
+
"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.",
|
|
7611
|
+
"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.",
|
|
7612
|
+
"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."
|
|
7613
|
+
],
|
|
7614
|
+
status: "shipped"
|
|
7521
7615
|
}
|
|
7522
7616
|
];
|
|
7523
7617
|
// ../../packages/sources/src/forge-adapter.ts
|
|
@@ -7669,13 +7763,47 @@ function packageRoot(moduleUrl) {
|
|
|
7669
7763
|
return dir;
|
|
7670
7764
|
}
|
|
7671
7765
|
|
|
7766
|
+
// src/commands/doctrine.ts
|
|
7767
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7768
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7769
|
+
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
7770
|
+
import matter2 from "gray-matter";
|
|
7771
|
+
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7772
|
+
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7773
|
+
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
7774
|
+
}
|
|
7775
|
+
function gitToplevel(cwd) {
|
|
7776
|
+
try {
|
|
7777
|
+
return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7778
|
+
encoding: "utf8",
|
|
7779
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7780
|
+
}).trim();
|
|
7781
|
+
} catch {
|
|
7782
|
+
return null;
|
|
7783
|
+
}
|
|
7784
|
+
}
|
|
7785
|
+
function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7786
|
+
const toplevel = gitToplevel(cwd);
|
|
7787
|
+
if (toplevel !== null) {
|
|
7788
|
+
const treeRoot = join3(toplevel, "aeg-root");
|
|
7789
|
+
if (existsSync3(join3(treeRoot, "roles")))
|
|
7790
|
+
return { root: treeRoot, source: "tree" };
|
|
7791
|
+
}
|
|
7792
|
+
const fromSource = !pkg.split(sep).includes("node_modules");
|
|
7793
|
+
const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
|
|
7794
|
+
return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
|
|
7795
|
+
}
|
|
7796
|
+
function hasDoctrineEntry(root) {
|
|
7797
|
+
return existsSync3(join3(root, ...ENTRY_SEGMENTS));
|
|
7798
|
+
}
|
|
7799
|
+
|
|
7672
7800
|
// src/lib/brief-assembly.ts
|
|
7673
7801
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7674
|
-
var PACKAGED_TEMPLATE_PATH =
|
|
7675
|
-
var TEMPLATE_PATH =
|
|
7802
|
+
var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7803
|
+
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7676
7804
|
function git(args) {
|
|
7677
7805
|
try {
|
|
7678
|
-
return
|
|
7806
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7679
7807
|
} catch {
|
|
7680
7808
|
return "";
|
|
7681
7809
|
}
|
|
@@ -7688,14 +7816,14 @@ function expandGlob(glob) {
|
|
|
7688
7816
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7689
7817
|
|
|
7690
7818
|
// src/checks/registry.ts
|
|
7691
|
-
import { existsSync as
|
|
7692
|
-
import { join as
|
|
7693
|
-
var DIST_BIN_DIR =
|
|
7694
|
-
var SRC_BIN_DIR =
|
|
7695
|
-
var BIN_DIR =
|
|
7819
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
7820
|
+
import { join as join5 } from "node:path";
|
|
7821
|
+
var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7822
|
+
var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7823
|
+
var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7696
7824
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7697
7825
|
function bin(name) {
|
|
7698
|
-
return
|
|
7826
|
+
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7699
7827
|
}
|
|
7700
7828
|
var REGISTRY = [
|
|
7701
7829
|
[
|
|
@@ -8259,21 +8387,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
8259
8387
|
import {
|
|
8260
8388
|
closeSync as closeSync3,
|
|
8261
8389
|
constants as fsConstants3,
|
|
8262
|
-
existsSync as
|
|
8390
|
+
existsSync as existsSync7,
|
|
8263
8391
|
fstatSync as fstatSync2,
|
|
8264
8392
|
mkdirSync as mkdirSync3,
|
|
8265
8393
|
openSync as openSync3,
|
|
8266
|
-
readFileSync as
|
|
8394
|
+
readFileSync as readFileSync6,
|
|
8267
8395
|
renameSync as renameSync2,
|
|
8268
8396
|
writeSync as writeSync2
|
|
8269
8397
|
} from "node:fs";
|
|
8270
8398
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8271
|
-
import { dirname as
|
|
8399
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
8272
8400
|
import { promisify as promisify5 } from "node:util";
|
|
8273
8401
|
|
|
8274
8402
|
// src/lib/run-paths.ts
|
|
8275
|
-
import { chmodSync, existsSync as
|
|
8276
|
-
import { dirname as
|
|
8403
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
|
|
8404
|
+
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8277
8405
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8278
8406
|
function isSafeRepoSegment(segment) {
|
|
8279
8407
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8284,7 +8412,7 @@ function repoSegment(repo) {
|
|
|
8284
8412
|
return `${repo.owner}-${repo.repo}`;
|
|
8285
8413
|
}
|
|
8286
8414
|
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8287
|
-
return
|
|
8415
|
+
return join6(home, "runtime", repoSegment(repo));
|
|
8288
8416
|
}
|
|
8289
8417
|
function resolveRuntimeDir(input) {
|
|
8290
8418
|
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
@@ -8344,9 +8472,9 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8344
8472
|
return null;
|
|
8345
8473
|
}
|
|
8346
8474
|
for (;; ) {
|
|
8347
|
-
if (
|
|
8475
|
+
if (existsSync6(join6(dir, ".git")))
|
|
8348
8476
|
return dir;
|
|
8349
|
-
const parent =
|
|
8477
|
+
const parent = dirname4(dir);
|
|
8350
8478
|
if (parent === dir)
|
|
8351
8479
|
return null;
|
|
8352
8480
|
dir = parent;
|
|
@@ -8361,7 +8489,7 @@ import {
|
|
|
8361
8489
|
mkdirSync as mkdirSync2,
|
|
8362
8490
|
openSync as openSync2,
|
|
8363
8491
|
linkSync,
|
|
8364
|
-
readFileSync as
|
|
8492
|
+
readFileSync as readFileSync5,
|
|
8365
8493
|
renameSync,
|
|
8366
8494
|
statSync,
|
|
8367
8495
|
unlinkSync,
|
|
@@ -8371,7 +8499,7 @@ import {
|
|
|
8371
8499
|
} from "node:fs";
|
|
8372
8500
|
import { randomUUID } from "node:crypto";
|
|
8373
8501
|
import { homedir as homedir2 } from "node:os";
|
|
8374
|
-
import { dirname as
|
|
8502
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8375
8503
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8376
8504
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8377
8505
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8387,7 +8515,7 @@ function isEnoent(err) {
|
|
|
8387
8515
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8388
8516
|
function tryCreateLock(lockPath, token) {
|
|
8389
8517
|
try {
|
|
8390
|
-
mkdirSync2(
|
|
8518
|
+
mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
|
|
8391
8519
|
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8392
8520
|
try {
|
|
8393
8521
|
writeSync(fd, `${token}
|
|
@@ -8452,7 +8580,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8452
8580
|
function renewDrainLock(lockPath, token) {
|
|
8453
8581
|
let holder;
|
|
8454
8582
|
try {
|
|
8455
|
-
holder =
|
|
8583
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
8456
8584
|
} catch (err) {
|
|
8457
8585
|
if (!isEnoent(err))
|
|
8458
8586
|
throw err;
|
|
@@ -8472,7 +8600,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
8472
8600
|
}
|
|
8473
8601
|
function releaseDrainLock(lockPath, token) {
|
|
8474
8602
|
try {
|
|
8475
|
-
const holder =
|
|
8603
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
8476
8604
|
if (holder !== token)
|
|
8477
8605
|
return;
|
|
8478
8606
|
unlinkSync(lockPath);
|
|
@@ -8522,7 +8650,7 @@ function queueLines(buf) {
|
|
|
8522
8650
|
return lines;
|
|
8523
8651
|
}
|
|
8524
8652
|
function removeQueueHead(path, cut) {
|
|
8525
|
-
const remaining =
|
|
8653
|
+
const remaining = readFileSync5(path);
|
|
8526
8654
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8527
8655
|
}
|
|
8528
8656
|
function queueBucketSize(path) {
|
|
@@ -8543,7 +8671,7 @@ function queueBucketSize(path) {
|
|
|
8543
8671
|
function readQueueFile(path) {
|
|
8544
8672
|
if (queueBucketSize(path) === null)
|
|
8545
8673
|
return null;
|
|
8546
|
-
return
|
|
8674
|
+
return readFileSync5(path);
|
|
8547
8675
|
}
|
|
8548
8676
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8549
8677
|
const record = JSON.stringify({
|
|
@@ -8658,7 +8786,7 @@ async function drainRenamedAside(args, livePath, source) {
|
|
|
8658
8786
|
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8659
8787
|
const resolved = await resolveRepo();
|
|
8660
8788
|
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8661
|
-
const outboxRoot = () =>
|
|
8789
|
+
const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
|
|
8662
8790
|
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8663
8791
|
const lockPath = `${path}.flush-lock`;
|
|
8664
8792
|
const lockToken = acquireDrainLock(lockPath);
|
|
@@ -8695,7 +8823,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
8695
8823
|
|
|
8696
8824
|
// src/lib/log-sink.ts
|
|
8697
8825
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8826
|
+
function describeFolderFallback(reason) {
|
|
8827
|
+
if (reason.kind === "anchor-unreadable") {
|
|
8828
|
+
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`";
|
|
8829
|
+
}
|
|
8830
|
+
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";
|
|
8831
|
+
}
|
|
8698
8832
|
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8833
|
+
var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
|
|
8699
8834
|
function withDeadline(work, ms, fallback) {
|
|
8700
8835
|
return new Promise((resolve) => {
|
|
8701
8836
|
const timer = setTimeout(() => resolve(fallback), ms);
|
|
@@ -8710,7 +8845,7 @@ function withDeadline(work, ms, fallback) {
|
|
|
8710
8845
|
});
|
|
8711
8846
|
}
|
|
8712
8847
|
async function safeLoadTrustAnchorConfig() {
|
|
8713
|
-
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
8848
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
8714
8849
|
}
|
|
8715
8850
|
function logsCredentialMissing(headers, env) {
|
|
8716
8851
|
if (!headers)
|
|
@@ -8727,8 +8862,16 @@ function logsCredentialMissing(headers, env) {
|
|
|
8727
8862
|
function resolveLogDestinationFrom(input) {
|
|
8728
8863
|
const local = resolveLogsSetting(input.localConfig);
|
|
8729
8864
|
let effective = null;
|
|
8865
|
+
let fallbackReason;
|
|
8730
8866
|
if (input.unattended) {
|
|
8731
|
-
|
|
8867
|
+
if (local) {
|
|
8868
|
+
effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
|
|
8869
|
+
if (effective === null && "url" in local) {
|
|
8870
|
+
fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
|
|
8871
|
+
}
|
|
8872
|
+
} else {
|
|
8873
|
+
effective = resolveLogsSetting(input.trustAnchorConfig);
|
|
8874
|
+
}
|
|
8732
8875
|
} else {
|
|
8733
8876
|
effective = local;
|
|
8734
8877
|
}
|
|
@@ -8754,7 +8897,7 @@ function resolveLogDestinationFrom(input) {
|
|
|
8754
8897
|
effective = null;
|
|
8755
8898
|
}
|
|
8756
8899
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8757
|
-
return { kind: "folder", folder };
|
|
8900
|
+
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8758
8901
|
}
|
|
8759
8902
|
var processTrustAnchorOnce;
|
|
8760
8903
|
function processTrustAnchor() {
|
|
@@ -8770,7 +8913,7 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
8770
8913
|
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8771
8914
|
unattended,
|
|
8772
8915
|
env,
|
|
8773
|
-
defaultFolder:
|
|
8916
|
+
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8774
8917
|
repoRoot: repoRootSync()
|
|
8775
8918
|
});
|
|
8776
8919
|
}
|
|
@@ -8785,7 +8928,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8785
8928
|
} catch (err) {
|
|
8786
8929
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8787
8930
|
}
|
|
8788
|
-
if (!
|
|
8931
|
+
if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
|
|
8789
8932
|
return vinayaVersion;
|
|
8790
8933
|
try {
|
|
8791
8934
|
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
@@ -8794,9 +8937,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8794
8937
|
return vinayaVersion;
|
|
8795
8938
|
}
|
|
8796
8939
|
}
|
|
8940
|
+
var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8941
|
+
function taskRefFromBranch2(branch) {
|
|
8942
|
+
const backlog = /^task\/issue-(\d+)$/.exec(branch);
|
|
8943
|
+
if (backlog) {
|
|
8944
|
+
const issue = Number(backlog[1]);
|
|
8945
|
+
return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
|
|
8946
|
+
}
|
|
8947
|
+
const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
8948
|
+
if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
|
|
8949
|
+
return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
|
|
8950
|
+
}
|
|
8951
|
+
return null;
|
|
8952
|
+
}
|
|
8953
|
+
var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
8954
|
+
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
8955
|
+
let stdout;
|
|
8956
|
+
try {
|
|
8957
|
+
({ stdout } = await execFileAsync5("gh", [
|
|
8958
|
+
"issue",
|
|
8959
|
+
"list",
|
|
8960
|
+
"--state",
|
|
8961
|
+
"all",
|
|
8962
|
+
"--label",
|
|
8963
|
+
`vinaya/tranche:${tranche}`,
|
|
8964
|
+
"--json",
|
|
8965
|
+
"number,title,labels",
|
|
8966
|
+
"--limit",
|
|
8967
|
+
String(TRANCHE_ISSUE_LIST_LIMIT),
|
|
8968
|
+
...repo === null ? [] : ["--repo", repo]
|
|
8969
|
+
], {
|
|
8970
|
+
cwd,
|
|
8971
|
+
encoding: "utf8",
|
|
8972
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
8973
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8974
|
+
killSignal: "SIGKILL"
|
|
8975
|
+
}));
|
|
8976
|
+
} catch {
|
|
8977
|
+
return null;
|
|
8978
|
+
}
|
|
8979
|
+
let issues;
|
|
8980
|
+
try {
|
|
8981
|
+
issues = JSON.parse(stdout);
|
|
8982
|
+
} catch {
|
|
8983
|
+
return null;
|
|
8984
|
+
}
|
|
8985
|
+
for (const issue of issues) {
|
|
8986
|
+
const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
|
|
8987
|
+
if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
|
|
8988
|
+
return issue.number;
|
|
8989
|
+
}
|
|
8990
|
+
return null;
|
|
8991
|
+
}
|
|
8992
|
+
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
8993
|
+
let stdout;
|
|
8994
|
+
try {
|
|
8995
|
+
({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
8996
|
+
cwd,
|
|
8997
|
+
encoding: "utf8",
|
|
8998
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8999
|
+
killSignal: "SIGKILL"
|
|
9000
|
+
}));
|
|
9001
|
+
} catch (err) {
|
|
9002
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
9003
|
+
return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
|
|
9004
|
+
}
|
|
9005
|
+
try {
|
|
9006
|
+
return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
|
|
9007
|
+
} catch {
|
|
9008
|
+
return "unknown";
|
|
9009
|
+
}
|
|
9010
|
+
}
|
|
9011
|
+
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
9012
|
+
let branch;
|
|
9013
|
+
try {
|
|
9014
|
+
branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
9015
|
+
encoding: "utf8",
|
|
9016
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
9017
|
+
killSignal: "SIGKILL"
|
|
9018
|
+
})).stdout.trim();
|
|
9019
|
+
} catch {
|
|
9020
|
+
return null;
|
|
9021
|
+
}
|
|
9022
|
+
const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
|
|
9023
|
+
const ref = taskRefFromBranch2(named);
|
|
9024
|
+
if (ref === null)
|
|
9025
|
+
return null;
|
|
9026
|
+
if (ref.kind === "tranche")
|
|
9027
|
+
return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
|
|
9028
|
+
return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
|
|
9029
|
+
}
|
|
8797
9030
|
function readVinayaVersion() {
|
|
8798
9031
|
try {
|
|
8799
|
-
const pkg = JSON.parse(
|
|
9032
|
+
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8800
9033
|
return pkg.version ?? "unknown";
|
|
8801
9034
|
} catch {
|
|
8802
9035
|
return "unknown";
|
|
@@ -8806,10 +9039,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
|
8806
9039
|
function isSafeRepoSegment3(segment) {
|
|
8807
9040
|
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8808
9041
|
}
|
|
9042
|
+
function safeRepoSlug(repo) {
|
|
9043
|
+
if (repo === null)
|
|
9044
|
+
return null;
|
|
9045
|
+
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
9046
|
+
}
|
|
8809
9047
|
function outboxPathFor(deps, repo, issue) {
|
|
8810
9048
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8811
9049
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8812
|
-
return
|
|
9050
|
+
return join8(deps.outboxRoot(), dirName, fileName);
|
|
8813
9051
|
}
|
|
8814
9052
|
function hostFromEnv(env) {
|
|
8815
9053
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8827,9 +9065,21 @@ function defaultStderr(message) {
|
|
|
8827
9065
|
warnedThisProcess = true;
|
|
8828
9066
|
process.stderr.write(message);
|
|
8829
9067
|
}
|
|
9068
|
+
var branchIssueFallbackEnabled = true;
|
|
9069
|
+
var branchIssueByCwd = new Map;
|
|
9070
|
+
function branchIssueRead(key, read, shared) {
|
|
9071
|
+
if (!shared)
|
|
9072
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9073
|
+
const cached = branchIssueByCwd.get(key);
|
|
9074
|
+
if (cached !== undefined)
|
|
9075
|
+
return cached;
|
|
9076
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9077
|
+
branchIssueByCwd.set(key, reading);
|
|
9078
|
+
return reading;
|
|
9079
|
+
}
|
|
8830
9080
|
function defaultDeps() {
|
|
8831
9081
|
return {
|
|
8832
|
-
outboxRoot: () =>
|
|
9082
|
+
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8833
9083
|
home: () => homedir3(),
|
|
8834
9084
|
hostname: () => osHostname(),
|
|
8835
9085
|
cwd: () => process.cwd(),
|
|
@@ -8854,7 +9104,7 @@ function guardedAppendOpen(path) {
|
|
|
8854
9104
|
}
|
|
8855
9105
|
function appendHardenedLine(path, line) {
|
|
8856
9106
|
try {
|
|
8857
|
-
mkdirSync3(
|
|
9107
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8858
9108
|
const fd = guardedAppendOpen(path);
|
|
8859
9109
|
if (fd === undefined)
|
|
8860
9110
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
@@ -8873,7 +9123,7 @@ function appendHardenedLine(path, line) {
|
|
|
8873
9123
|
function reportRotationOverflow(backupPath, warn) {
|
|
8874
9124
|
let raw;
|
|
8875
9125
|
try {
|
|
8876
|
-
raw =
|
|
9126
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
8877
9127
|
} catch {
|
|
8878
9128
|
return;
|
|
8879
9129
|
}
|
|
@@ -8896,7 +9146,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8896
9146
|
}
|
|
8897
9147
|
function appendLine(path, line, warn) {
|
|
8898
9148
|
try {
|
|
8899
|
-
mkdirSync3(
|
|
9149
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8900
9150
|
let fd = guardedAppendOpen(path);
|
|
8901
9151
|
if (fd === undefined) {
|
|
8902
9152
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8937,7 +9187,11 @@ function appendLine(path, line, warn) {
|
|
|
8937
9187
|
}
|
|
8938
9188
|
}
|
|
8939
9189
|
function createLogSink(overrides = {}) {
|
|
8940
|
-
const deps = {
|
|
9190
|
+
const deps = {
|
|
9191
|
+
...defaultDeps(),
|
|
9192
|
+
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9193
|
+
...overrides
|
|
9194
|
+
};
|
|
8941
9195
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8942
9196
|
const processId = randomUUID2();
|
|
8943
9197
|
let seq = 0;
|
|
@@ -8957,6 +9211,19 @@ function createLogSink(overrides = {}) {
|
|
|
8957
9211
|
}
|
|
8958
9212
|
return doctrineCache;
|
|
8959
9213
|
};
|
|
9214
|
+
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9215
|
+
let ownBranchIssue;
|
|
9216
|
+
const branchIssueOnce = (repo) => {
|
|
9217
|
+
if (!branchIssueFallbackEnabled)
|
|
9218
|
+
return Promise.resolve(null);
|
|
9219
|
+
const slug = safeRepoSlug(repo);
|
|
9220
|
+
const read = () => deps.resolveBranchIssue(slug);
|
|
9221
|
+
if (readerIsReal)
|
|
9222
|
+
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9223
|
+
if (ownBranchIssue === undefined)
|
|
9224
|
+
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9225
|
+
return ownBranchIssue;
|
|
9226
|
+
};
|
|
8960
9227
|
let resolveRepoCache;
|
|
8961
9228
|
const resolveRepoOnce = () => {
|
|
8962
9229
|
if (resolveRepoCache === undefined)
|
|
@@ -8979,6 +9246,7 @@ function createLogSink(overrides = {}) {
|
|
|
8979
9246
|
};
|
|
8980
9247
|
let drainChain = Promise.resolve();
|
|
8981
9248
|
const pendingWrites = new Set;
|
|
9249
|
+
let writeChain = Promise.resolve();
|
|
8982
9250
|
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
8983
9251
|
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
8984
9252
|
return;
|
|
@@ -9001,7 +9269,18 @@ function createLogSink(overrides = {}) {
|
|
|
9001
9269
|
attempt: env.VINAYA_ATTEMPT,
|
|
9002
9270
|
parent: env.VINAYA_PARENT_EVENT
|
|
9003
9271
|
};
|
|
9004
|
-
const
|
|
9272
|
+
const write = async () => {
|
|
9273
|
+
const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
|
|
9274
|
+
if (resolvedDestination.kind === "none") {
|
|
9275
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9276
|
+
`);
|
|
9277
|
+
return;
|
|
9278
|
+
}
|
|
9279
|
+
if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
|
|
9280
|
+
warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
|
|
9281
|
+
`);
|
|
9282
|
+
}
|
|
9283
|
+
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
9005
9284
|
const header = buildHeader({
|
|
9006
9285
|
now,
|
|
9007
9286
|
runId,
|
|
@@ -9012,15 +9291,11 @@ function createLogSink(overrides = {}) {
|
|
|
9012
9291
|
host,
|
|
9013
9292
|
hostname: deps.hostname(),
|
|
9014
9293
|
env: envFields,
|
|
9294
|
+
branchIssue,
|
|
9015
9295
|
eventId: randomUUID2(),
|
|
9016
9296
|
processId,
|
|
9017
9297
|
inputVersions: deps.inputVersions()
|
|
9018
9298
|
});
|
|
9019
|
-
if (resolvedDestination.kind === "none") {
|
|
9020
|
-
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9021
|
-
`);
|
|
9022
|
-
return;
|
|
9023
|
-
}
|
|
9024
9299
|
const full = { ...e, ...header };
|
|
9025
9300
|
const parsed = LogEventSchema.safeParse(full);
|
|
9026
9301
|
if (!parsed.success) {
|
|
@@ -9037,10 +9312,12 @@ function createLogSink(overrides = {}) {
|
|
|
9037
9312
|
} else {
|
|
9038
9313
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9039
9314
|
}
|
|
9040
|
-
}
|
|
9315
|
+
};
|
|
9316
|
+
const written = writeChain.then(write).catch((err) => {
|
|
9041
9317
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9042
9318
|
`);
|
|
9043
9319
|
});
|
|
9320
|
+
writeChain = written;
|
|
9044
9321
|
pendingWrites.add(written);
|
|
9045
9322
|
written.finally(() => pendingWrites.delete(written));
|
|
9046
9323
|
} 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
|
}
|
|
@@ -9202,7 +9479,7 @@ var CHECK_NAME = "exec-bits";
|
|
|
9202
9479
|
var EXECUTABLE_MODE = "100755";
|
|
9203
9480
|
function git2(args) {
|
|
9204
9481
|
try {
|
|
9205
|
-
return
|
|
9482
|
+
return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
9206
9483
|
} catch {
|
|
9207
9484
|
return null;
|
|
9208
9485
|
}
|
|
@@ -9216,7 +9493,7 @@ function indexMode(path) {
|
|
|
9216
9493
|
}
|
|
9217
9494
|
function hasShebang(path) {
|
|
9218
9495
|
try {
|
|
9219
|
-
return
|
|
9496
|
+
return readFileSync7(path, "utf8").startsWith("#!");
|
|
9220
9497
|
} catch {
|
|
9221
9498
|
return false;
|
|
9222
9499
|
}
|