@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
|
@@ -197,8 +197,8 @@ function maskIndentedCode(body, fill) {
|
|
|
197
197
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
198
198
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
199
199
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
200
|
-
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d
|
|
201
|
-
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+
|
|
200
|
+
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
|
|
201
|
+
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
|
|
202
202
|
function splitSlugQualifiedEdge(edge) {
|
|
203
203
|
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
204
204
|
if (!m)
|
|
@@ -2619,7 +2619,7 @@ function isIssueNotFoundError(err) {
|
|
|
2619
2619
|
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2620
2620
|
}
|
|
2621
2621
|
function resolveObjectivesSource(prBody, issue, cutoverIssue) {
|
|
2622
|
-
if (issue !== null && issue < cutoverIssue)
|
|
2622
|
+
if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
|
|
2623
2623
|
return { kind: "none" };
|
|
2624
2624
|
if (issue !== null)
|
|
2625
2625
|
return { kind: "issue", issue };
|
|
@@ -2895,9 +2895,18 @@ var COMMIT_TYPES = [
|
|
|
2895
2895
|
];
|
|
2896
2896
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2897
2897
|
function checkForgeTitle(title) {
|
|
2898
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
2898
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
|
|
2899
2899
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2900
2900
|
return { status: "pass", errors: [] };
|
|
2901
|
+
const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
|
|
2902
|
+
if (letteredTaskId) {
|
|
2903
|
+
return {
|
|
2904
|
+
status: "fail",
|
|
2905
|
+
errors: [
|
|
2906
|
+
`brief-validation title: "${title}" names task id \`${letteredTaskId[1]}\` — task ids are whole numbers (\`1\`, \`2\`), never lettered (\`2a\`). \`vinaya task run\` and \`task dispatch\` refuse a non-numeric id, so a plan titled this way names a task that cannot be started.`
|
|
2907
|
+
]
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2901
2910
|
return {
|
|
2902
2911
|
status: "fail",
|
|
2903
2912
|
errors: [
|
|
@@ -2930,19 +2939,31 @@ function checkNoAgentBoxes(prBody) {
|
|
|
2930
2939
|
]
|
|
2931
2940
|
};
|
|
2932
2941
|
}
|
|
2933
|
-
function
|
|
2942
|
+
function rolloutRuleFor(message) {
|
|
2934
2943
|
if (message.startsWith("brief-validation unpinned code claim:") || message.startsWith("brief-validation commands carry output:") || message.startsWith("brief-validation consumer tests:") || message.startsWith("brief-validation defeat cases:")) {
|
|
2935
|
-
return
|
|
2944
|
+
return "briefRules";
|
|
2936
2945
|
}
|
|
2937
2946
|
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2938
|
-
return
|
|
2947
|
+
return "agentBoxes";
|
|
2939
2948
|
return null;
|
|
2940
2949
|
}
|
|
2941
|
-
|
|
2950
|
+
var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
|
|
2951
|
+
briefRulesSincePr: BRIEF_RULES_SINCE_PR,
|
|
2952
|
+
agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
|
|
2953
|
+
};
|
|
2954
|
+
function rolloutThresholdFor(message, cutovers) {
|
|
2955
|
+
const rule = rolloutRuleFor(message);
|
|
2956
|
+
if (rule === "briefRules")
|
|
2957
|
+
return cutovers.briefRulesSincePr;
|
|
2958
|
+
if (rule === "agentBoxes")
|
|
2959
|
+
return cutovers.agentBoxesRefusedSincePr;
|
|
2960
|
+
return null;
|
|
2961
|
+
}
|
|
2962
|
+
function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
|
|
2942
2963
|
const blocking = [];
|
|
2943
2964
|
const info = [];
|
|
2944
2965
|
for (const e of errors) {
|
|
2945
|
-
const threshold = rolloutThresholdFor(e);
|
|
2966
|
+
const threshold = rolloutThresholdFor(e, cutovers);
|
|
2946
2967
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2947
2968
|
(grandfathered ? info : blocking).push(e);
|
|
2948
2969
|
}
|
|
@@ -3410,8 +3431,8 @@ function checkIssueRationale(body) {
|
|
|
3410
3431
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3411
3432
|
}
|
|
3412
3433
|
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3413
|
-
function checkIssueObjectives(body, issueNumber) {
|
|
3414
|
-
if (issueNumber !== null && issueNumber <
|
|
3434
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3435
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3415
3436
|
return { status: "pass", errors: [] };
|
|
3416
3437
|
const result = objectivesOf(body);
|
|
3417
3438
|
if (result.ok)
|
|
@@ -3487,6 +3508,8 @@ function parseIssueSurface(body) {
|
|
|
3487
3508
|
function globCoversPath(glob, path) {
|
|
3488
3509
|
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3489
3510
|
const p = path.replace(/\/+$/, "");
|
|
3511
|
+
if (g === "*")
|
|
3512
|
+
return !p.includes("/");
|
|
3490
3513
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3491
3514
|
}
|
|
3492
3515
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
@@ -3856,7 +3879,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3856
3879
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3857
3880
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3858
3881
|
}
|
|
3859
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3882
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3860
3883
|
const failures = [];
|
|
3861
3884
|
for (const [slug, issues] of issuesBySlug) {
|
|
3862
3885
|
for (const issue of issues) {
|
|
@@ -3865,7 +3888,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3865
3888
|
const errors = [
|
|
3866
3889
|
...checkIssueRationale(issue.body).errors,
|
|
3867
3890
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3868
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3891
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3869
3892
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3870
3893
|
];
|
|
3871
3894
|
if (errors.length === 0)
|
|
@@ -4488,13 +4511,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4488
4511
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4489
4512
|
return `${shipsPrefix}tranches/completed/`;
|
|
4490
4513
|
}
|
|
4491
|
-
|
|
4492
|
-
|
|
4514
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4515
|
+
function normalizeSpecPath(entry) {
|
|
4516
|
+
let out = entry.replace(/\\/g, "/");
|
|
4517
|
+
while (out.startsWith("./"))
|
|
4518
|
+
out = out.slice(2);
|
|
4519
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4520
|
+
while (out.endsWith("/"))
|
|
4521
|
+
out = out.slice(0, -1);
|
|
4522
|
+
return out;
|
|
4523
|
+
}
|
|
4524
|
+
function isSpecFile2(path, specPaths) {
|
|
4525
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4526
|
+
return true;
|
|
4527
|
+
if (!path.endsWith(".md"))
|
|
4528
|
+
return false;
|
|
4529
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4493
4530
|
}
|
|
4494
4531
|
function isClaudeMdFile(path) {
|
|
4495
4532
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4496
4533
|
}
|
|
4497
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4534
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4498
4535
|
if (path.startsWith(shipsPrefix)) {
|
|
4499
4536
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4500
4537
|
}
|
|
@@ -4503,7 +4540,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4503
4540
|
}
|
|
4504
4541
|
if (isClaudeMdFile(path))
|
|
4505
4542
|
return "internal";
|
|
4506
|
-
if (isSpecFile2(path))
|
|
4543
|
+
if (isSpecFile2(path, specPaths))
|
|
4507
4544
|
return "spec";
|
|
4508
4545
|
if (isProductScopeFile(path))
|
|
4509
4546
|
return "product";
|
|
@@ -4532,13 +4569,14 @@ function lineAt(content, index) {
|
|
|
4532
4569
|
}
|
|
4533
4570
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4534
4571
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4572
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4535
4573
|
function legacySlugPattern(legacySlugs) {
|
|
4536
4574
|
if (legacySlugs.length === 0)
|
|
4537
4575
|
return null;
|
|
4538
4576
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4539
4577
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4540
4578
|
}
|
|
4541
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4579
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4542
4580
|
const findings = [];
|
|
4543
4581
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4544
4582
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4550,8 +4588,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4550
4588
|
const productPatterns = [
|
|
4551
4589
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4552
4590
|
];
|
|
4591
|
+
const specPatterns = [
|
|
4592
|
+
...patterns,
|
|
4593
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4594
|
+
];
|
|
4553
4595
|
for (const file of files) {
|
|
4554
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4596
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4555
4597
|
if (!cls || cls === "internal")
|
|
4556
4598
|
continue;
|
|
4557
4599
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4560,15 +4602,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4560
4602
|
continue;
|
|
4561
4603
|
const blocking = cls === "product" || cls === "spec";
|
|
4562
4604
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4563
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4605
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4564
4606
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4565
4607
|
pattern.lastIndex = 0;
|
|
4566
4608
|
let match = pattern.exec(scrubbed);
|
|
4567
4609
|
while (match !== null) {
|
|
4568
4610
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4611
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4569
4612
|
findings.push({
|
|
4570
4613
|
file: file.path,
|
|
4571
|
-
line: lineAt(scrubbed,
|
|
4614
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4572
4615
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4573
4616
|
blocking
|
|
4574
4617
|
});
|
|
@@ -4754,9 +4797,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4754
4797
|
}
|
|
4755
4798
|
return findings;
|
|
4756
4799
|
}
|
|
4757
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4800
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4758
4801
|
return [
|
|
4759
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4802
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4760
4803
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4761
4804
|
];
|
|
4762
4805
|
}
|
|
@@ -5221,7 +5264,8 @@ var TaskStatusItemSchema = z.object({
|
|
|
5221
5264
|
}).merge(ObservedSchema);
|
|
5222
5265
|
var TaskStatusResultSchema = z.object({
|
|
5223
5266
|
items: z.array(TaskStatusItemSchema),
|
|
5224
|
-
nextCursor: z.string().nullable()
|
|
5267
|
+
nextCursor: z.string().nullable(),
|
|
5268
|
+
table: z.string()
|
|
5225
5269
|
});
|
|
5226
5270
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5227
5271
|
var EscalationInputsSchema = z.object({
|
|
@@ -5565,6 +5609,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5565
5609
|
}
|
|
5566
5610
|
return findings;
|
|
5567
5611
|
}
|
|
5612
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5613
|
+
var NO_GATE_CUTOVERS = {
|
|
5614
|
+
objectivesSinceIssue: null,
|
|
5615
|
+
briefSectionsSinceIssue: null,
|
|
5616
|
+
documentationSinceIssue: null,
|
|
5617
|
+
briefRulesSincePr: null,
|
|
5618
|
+
agentBoxesRefusedSincePr: null
|
|
5619
|
+
};
|
|
5568
5620
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5569
5621
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5570
5622
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -6014,6 +6066,8 @@ function attemptFromEnv(value) {
|
|
|
6014
6066
|
function provenanceFor(input) {
|
|
6015
6067
|
if (input.provenance)
|
|
6016
6068
|
return input.provenance;
|
|
6069
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6070
|
+
return "unavailable";
|
|
6017
6071
|
if (input.env.role || input.env.task)
|
|
6018
6072
|
return "env_correlated";
|
|
6019
6073
|
return "unavailable";
|
|
@@ -6034,7 +6088,7 @@ function buildHeader(input) {
|
|
|
6034
6088
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6035
6089
|
const round = roundFromEnv(input.env.round);
|
|
6036
6090
|
const subject = {
|
|
6037
|
-
issue: issueFromTask(input.env.task),
|
|
6091
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6038
6092
|
role,
|
|
6039
6093
|
...round !== undefined ? { round } : {},
|
|
6040
6094
|
...input.subject ?? {}
|
|
@@ -6527,7 +6581,12 @@ var VinayaConfigSchema = z4.object({
|
|
|
6527
6581
|
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6528
6582
|
severity: z4.enum(["warning", "error"]).optional()
|
|
6529
6583
|
}).optional(),
|
|
6530
|
-
specGrandfather: z4.array(z4.string().min(1)).optional()
|
|
6584
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6585
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6586
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6587
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6588
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6589
|
+
})).optional()
|
|
6531
6590
|
}).optional(),
|
|
6532
6591
|
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6533
6592
|
dispatch: z4.object({
|
|
@@ -6541,6 +6600,13 @@ var VinayaConfigSchema = z4.object({
|
|
|
6541
6600
|
securityThreshold: z4.string().min(1).optional(),
|
|
6542
6601
|
maxRounds: z4.number().optional()
|
|
6543
6602
|
}).optional(),
|
|
6603
|
+
gateCutovers: z4.object({
|
|
6604
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6605
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6606
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6607
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6608
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6609
|
+
}).optional(),
|
|
6544
6610
|
prePush: z4.object({
|
|
6545
6611
|
alwaysRun: z4.array(z4.string()).optional()
|
|
6546
6612
|
}).optional(),
|
|
@@ -6678,6 +6744,18 @@ function resolveReviewPolicy(config) {
|
|
|
6678
6744
|
maxRounds
|
|
6679
6745
|
};
|
|
6680
6746
|
}
|
|
6747
|
+
function resolveGateCutovers(config) {
|
|
6748
|
+
const raw = config?.gateCutovers;
|
|
6749
|
+
if (!raw)
|
|
6750
|
+
return NO_GATE_CUTOVERS;
|
|
6751
|
+
return {
|
|
6752
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6753
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6754
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6755
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6756
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6757
|
+
};
|
|
6758
|
+
}
|
|
6681
6759
|
function resolveRuntimeDirSetting(config) {
|
|
6682
6760
|
return config?.runtimeDir ?? null;
|
|
6683
6761
|
}
|
|
@@ -6733,7 +6811,8 @@ async function trustAnchorRepoAsync() {
|
|
|
6733
6811
|
try {
|
|
6734
6812
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6735
6813
|
encoding: "utf-8",
|
|
6736
|
-
timeout: 1e4
|
|
6814
|
+
timeout: 1e4,
|
|
6815
|
+
killSignal: "SIGKILL"
|
|
6737
6816
|
});
|
|
6738
6817
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6739
6818
|
} catch {
|
|
@@ -6794,7 +6873,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
6794
6873
|
const repo = await trustAnchorRepoAsync();
|
|
6795
6874
|
if (!repo)
|
|
6796
6875
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6797
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6876
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
6798
6877
|
return stdout;
|
|
6799
6878
|
}
|
|
6800
6879
|
function firstLine(err) {
|
|
@@ -7387,6 +7466,10 @@ var COMMANDS = [
|
|
|
7387
7466
|
flag: "--role <name>",
|
|
7388
7467
|
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7389
7468
|
},
|
|
7469
|
+
{
|
|
7470
|
+
flag: "--template <name>",
|
|
7471
|
+
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7472
|
+
},
|
|
7390
7473
|
{
|
|
7391
7474
|
flag: "--print",
|
|
7392
7475
|
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."
|
|
@@ -7571,6 +7654,17 @@ var COMMANDS = [
|
|
|
7571
7654
|
"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)."
|
|
7572
7655
|
],
|
|
7573
7656
|
status: "shipped"
|
|
7657
|
+
},
|
|
7658
|
+
{
|
|
7659
|
+
name: "log send",
|
|
7660
|
+
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
7661
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7662
|
+
details: [
|
|
7663
|
+
"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.",
|
|
7664
|
+
"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.",
|
|
7665
|
+
"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."
|
|
7666
|
+
],
|
|
7667
|
+
status: "shipped"
|
|
7574
7668
|
}
|
|
7575
7669
|
];
|
|
7576
7670
|
// ../../packages/sources/src/forge-adapter.ts
|
|
@@ -8731,7 +8825,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
8731
8825
|
|
|
8732
8826
|
// src/lib/log-sink.ts
|
|
8733
8827
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8828
|
+
function describeFolderFallback(reason) {
|
|
8829
|
+
if (reason.kind === "anchor-unreadable") {
|
|
8830
|
+
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`";
|
|
8831
|
+
}
|
|
8832
|
+
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";
|
|
8833
|
+
}
|
|
8734
8834
|
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8835
|
+
var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
|
|
8735
8836
|
function withDeadline(work, ms, fallback) {
|
|
8736
8837
|
return new Promise((resolve) => {
|
|
8737
8838
|
const timer = setTimeout(() => resolve(fallback), ms);
|
|
@@ -8746,7 +8847,7 @@ function withDeadline(work, ms, fallback) {
|
|
|
8746
8847
|
});
|
|
8747
8848
|
}
|
|
8748
8849
|
async function safeLoadTrustAnchorConfig() {
|
|
8749
|
-
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
8850
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
8750
8851
|
}
|
|
8751
8852
|
function logsCredentialMissing(headers, env) {
|
|
8752
8853
|
if (!headers)
|
|
@@ -8763,8 +8864,16 @@ function logsCredentialMissing(headers, env) {
|
|
|
8763
8864
|
function resolveLogDestinationFrom(input) {
|
|
8764
8865
|
const local = resolveLogsSetting(input.localConfig);
|
|
8765
8866
|
let effective = null;
|
|
8867
|
+
let fallbackReason;
|
|
8766
8868
|
if (input.unattended) {
|
|
8767
|
-
|
|
8869
|
+
if (local) {
|
|
8870
|
+
effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
|
|
8871
|
+
if (effective === null && "url" in local) {
|
|
8872
|
+
fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
|
|
8873
|
+
}
|
|
8874
|
+
} else {
|
|
8875
|
+
effective = resolveLogsSetting(input.trustAnchorConfig);
|
|
8876
|
+
}
|
|
8768
8877
|
} else {
|
|
8769
8878
|
effective = local;
|
|
8770
8879
|
}
|
|
@@ -8790,7 +8899,7 @@ function resolveLogDestinationFrom(input) {
|
|
|
8790
8899
|
effective = null;
|
|
8791
8900
|
}
|
|
8792
8901
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8793
|
-
return { kind: "folder", folder };
|
|
8902
|
+
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8794
8903
|
}
|
|
8795
8904
|
var processTrustAnchorOnce;
|
|
8796
8905
|
function processTrustAnchor() {
|
|
@@ -8830,6 +8939,96 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8830
8939
|
return vinayaVersion;
|
|
8831
8940
|
}
|
|
8832
8941
|
}
|
|
8942
|
+
var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8943
|
+
function taskRefFromBranch2(branch) {
|
|
8944
|
+
const backlog = /^task\/issue-(\d+)$/.exec(branch);
|
|
8945
|
+
if (backlog) {
|
|
8946
|
+
const issue = Number(backlog[1]);
|
|
8947
|
+
return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
|
|
8948
|
+
}
|
|
8949
|
+
const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
8950
|
+
if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
|
|
8951
|
+
return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
|
|
8952
|
+
}
|
|
8953
|
+
return null;
|
|
8954
|
+
}
|
|
8955
|
+
var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
8956
|
+
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
8957
|
+
let stdout;
|
|
8958
|
+
try {
|
|
8959
|
+
({ stdout } = await execFileAsync5("gh", [
|
|
8960
|
+
"issue",
|
|
8961
|
+
"list",
|
|
8962
|
+
"--state",
|
|
8963
|
+
"all",
|
|
8964
|
+
"--label",
|
|
8965
|
+
`vinaya/tranche:${tranche}`,
|
|
8966
|
+
"--json",
|
|
8967
|
+
"number,title,labels",
|
|
8968
|
+
"--limit",
|
|
8969
|
+
String(TRANCHE_ISSUE_LIST_LIMIT),
|
|
8970
|
+
...repo === null ? [] : ["--repo", repo]
|
|
8971
|
+
], {
|
|
8972
|
+
cwd,
|
|
8973
|
+
encoding: "utf8",
|
|
8974
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
8975
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8976
|
+
killSignal: "SIGKILL"
|
|
8977
|
+
}));
|
|
8978
|
+
} catch {
|
|
8979
|
+
return null;
|
|
8980
|
+
}
|
|
8981
|
+
let issues;
|
|
8982
|
+
try {
|
|
8983
|
+
issues = JSON.parse(stdout);
|
|
8984
|
+
} catch {
|
|
8985
|
+
return null;
|
|
8986
|
+
}
|
|
8987
|
+
for (const issue of issues) {
|
|
8988
|
+
const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
|
|
8989
|
+
if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
|
|
8990
|
+
return issue.number;
|
|
8991
|
+
}
|
|
8992
|
+
return null;
|
|
8993
|
+
}
|
|
8994
|
+
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
8995
|
+
let stdout;
|
|
8996
|
+
try {
|
|
8997
|
+
({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
8998
|
+
cwd,
|
|
8999
|
+
encoding: "utf8",
|
|
9000
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
9001
|
+
killSignal: "SIGKILL"
|
|
9002
|
+
}));
|
|
9003
|
+
} catch (err) {
|
|
9004
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
9005
|
+
return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
|
|
9006
|
+
}
|
|
9007
|
+
try {
|
|
9008
|
+
return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
|
|
9009
|
+
} catch {
|
|
9010
|
+
return "unknown";
|
|
9011
|
+
}
|
|
9012
|
+
}
|
|
9013
|
+
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
9014
|
+
let branch;
|
|
9015
|
+
try {
|
|
9016
|
+
branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
9017
|
+
encoding: "utf8",
|
|
9018
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
9019
|
+
killSignal: "SIGKILL"
|
|
9020
|
+
})).stdout.trim();
|
|
9021
|
+
} catch {
|
|
9022
|
+
return null;
|
|
9023
|
+
}
|
|
9024
|
+
const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
|
|
9025
|
+
const ref = taskRefFromBranch2(named);
|
|
9026
|
+
if (ref === null)
|
|
9027
|
+
return null;
|
|
9028
|
+
if (ref.kind === "tranche")
|
|
9029
|
+
return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
|
|
9030
|
+
return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
|
|
9031
|
+
}
|
|
8833
9032
|
function readVinayaVersion() {
|
|
8834
9033
|
try {
|
|
8835
9034
|
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
@@ -8842,6 +9041,11 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
|
8842
9041
|
function isSafeRepoSegment3(segment) {
|
|
8843
9042
|
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8844
9043
|
}
|
|
9044
|
+
function safeRepoSlug(repo) {
|
|
9045
|
+
if (repo === null)
|
|
9046
|
+
return null;
|
|
9047
|
+
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
9048
|
+
}
|
|
8845
9049
|
function outboxPathFor(deps, repo, issue) {
|
|
8846
9050
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8847
9051
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
@@ -8863,6 +9067,18 @@ function defaultStderr(message) {
|
|
|
8863
9067
|
warnedThisProcess = true;
|
|
8864
9068
|
process.stderr.write(message);
|
|
8865
9069
|
}
|
|
9070
|
+
var branchIssueFallbackEnabled = true;
|
|
9071
|
+
var branchIssueByCwd = new Map;
|
|
9072
|
+
function branchIssueRead(key, read, shared) {
|
|
9073
|
+
if (!shared)
|
|
9074
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9075
|
+
const cached = branchIssueByCwd.get(key);
|
|
9076
|
+
if (cached !== undefined)
|
|
9077
|
+
return cached;
|
|
9078
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9079
|
+
branchIssueByCwd.set(key, reading);
|
|
9080
|
+
return reading;
|
|
9081
|
+
}
|
|
8866
9082
|
function defaultDeps() {
|
|
8867
9083
|
return {
|
|
8868
9084
|
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -8973,7 +9189,11 @@ function appendLine(path, line, warn) {
|
|
|
8973
9189
|
}
|
|
8974
9190
|
}
|
|
8975
9191
|
function createLogSink(overrides = {}) {
|
|
8976
|
-
const deps = {
|
|
9192
|
+
const deps = {
|
|
9193
|
+
...defaultDeps(),
|
|
9194
|
+
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9195
|
+
...overrides
|
|
9196
|
+
};
|
|
8977
9197
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8978
9198
|
const processId = randomUUID2();
|
|
8979
9199
|
let seq = 0;
|
|
@@ -8993,6 +9213,19 @@ function createLogSink(overrides = {}) {
|
|
|
8993
9213
|
}
|
|
8994
9214
|
return doctrineCache;
|
|
8995
9215
|
};
|
|
9216
|
+
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9217
|
+
let ownBranchIssue;
|
|
9218
|
+
const branchIssueOnce = (repo) => {
|
|
9219
|
+
if (!branchIssueFallbackEnabled)
|
|
9220
|
+
return Promise.resolve(null);
|
|
9221
|
+
const slug = safeRepoSlug(repo);
|
|
9222
|
+
const read = () => deps.resolveBranchIssue(slug);
|
|
9223
|
+
if (readerIsReal)
|
|
9224
|
+
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9225
|
+
if (ownBranchIssue === undefined)
|
|
9226
|
+
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9227
|
+
return ownBranchIssue;
|
|
9228
|
+
};
|
|
8996
9229
|
let resolveRepoCache;
|
|
8997
9230
|
const resolveRepoOnce = () => {
|
|
8998
9231
|
if (resolveRepoCache === undefined)
|
|
@@ -9015,6 +9248,7 @@ function createLogSink(overrides = {}) {
|
|
|
9015
9248
|
};
|
|
9016
9249
|
let drainChain = Promise.resolve();
|
|
9017
9250
|
const pendingWrites = new Set;
|
|
9251
|
+
let writeChain = Promise.resolve();
|
|
9018
9252
|
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
9019
9253
|
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
9020
9254
|
return;
|
|
@@ -9037,7 +9271,18 @@ function createLogSink(overrides = {}) {
|
|
|
9037
9271
|
attempt: env.VINAYA_ATTEMPT,
|
|
9038
9272
|
parent: env.VINAYA_PARENT_EVENT
|
|
9039
9273
|
};
|
|
9040
|
-
const
|
|
9274
|
+
const write = async () => {
|
|
9275
|
+
const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
|
|
9276
|
+
if (resolvedDestination.kind === "none") {
|
|
9277
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9278
|
+
`);
|
|
9279
|
+
return;
|
|
9280
|
+
}
|
|
9281
|
+
if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
|
|
9282
|
+
warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
|
|
9283
|
+
`);
|
|
9284
|
+
}
|
|
9285
|
+
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
9041
9286
|
const header = buildHeader({
|
|
9042
9287
|
now,
|
|
9043
9288
|
runId,
|
|
@@ -9048,15 +9293,11 @@ function createLogSink(overrides = {}) {
|
|
|
9048
9293
|
host,
|
|
9049
9294
|
hostname: deps.hostname(),
|
|
9050
9295
|
env: envFields,
|
|
9296
|
+
branchIssue,
|
|
9051
9297
|
eventId: randomUUID2(),
|
|
9052
9298
|
processId,
|
|
9053
9299
|
inputVersions: deps.inputVersions()
|
|
9054
9300
|
});
|
|
9055
|
-
if (resolvedDestination.kind === "none") {
|
|
9056
|
-
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9057
|
-
`);
|
|
9058
|
-
return;
|
|
9059
|
-
}
|
|
9060
9301
|
const full = { ...e, ...header };
|
|
9061
9302
|
const parsed = LogEventSchema.safeParse(full);
|
|
9062
9303
|
if (!parsed.success) {
|
|
@@ -9073,10 +9314,12 @@ function createLogSink(overrides = {}) {
|
|
|
9073
9314
|
} else {
|
|
9074
9315
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9075
9316
|
}
|
|
9076
|
-
}
|
|
9317
|
+
};
|
|
9318
|
+
const written = writeChain.then(write).catch((err) => {
|
|
9077
9319
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9078
9320
|
`);
|
|
9079
9321
|
});
|
|
9322
|
+
writeChain = written;
|
|
9080
9323
|
pendingWrites.add(written);
|
|
9081
9324
|
written.finally(() => pendingWrites.delete(written));
|
|
9082
9325
|
} catch (err) {
|