@attalabs/vinaya 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/aeg-root/contracts/principal-operator.md +18 -5
- 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 +89 -16
- package/aeg-root/roles/planner/reference.md +3 -2
- package/aeg-root/roles/planner.md +3 -1
- package/aeg-root/roles/tranche-archivist.md +1 -0
- package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
- package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -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 +213 -41
- package/dist/checks/bin/check-branch-topology.js +164 -41
- package/dist/checks/bin/check-brief-shape.js +219 -46
- package/dist/checks/bin/check-changeset-coverage.js +669 -152
- package/dist/checks/bin/check-closes-n.js +164 -41
- package/dist/checks/bin/check-coherence.js +220 -43
- package/dist/checks/bin/check-dead-branch-push.js +159 -40
- package/dist/checks/bin/check-dispatch-readiness.js +218 -42
- package/dist/checks/bin/check-doc-coverage-push.js +665 -148
- package/dist/checks/bin/check-doc-coverage.js +667 -150
- package/dist/checks/bin/check-doctrine-no-procedures.js +213 -41
- package/dist/checks/bin/check-doctrine-portability.js +666 -149
- package/dist/checks/bin/check-evidence-fresh.js +643 -125
- package/dist/checks/bin/check-exec-bits.js +663 -146
- package/dist/checks/bin/check-first-push-dispatch.js +218 -42
- package/dist/checks/bin/check-issue-assignment.js +164 -41
- package/dist/checks/bin/check-issue-milestone-attach.js +159 -40
- package/dist/checks/bin/check-issue-objectives-numbering.js +685 -41
- package/dist/checks/bin/check-issue-parts-coverage.js +159 -40
- package/dist/checks/bin/check-issue-surface-globs.js +258 -48
- package/dist/checks/bin/check-issue-title-grammar.js +159 -40
- package/dist/checks/bin/check-issue-tranche-label.js +159 -40
- package/dist/checks/bin/check-main-branch-refusal.js +159 -40
- package/dist/checks/bin/check-no-disk-state.js +159 -40
- package/dist/checks/bin/check-pr-premise-reassert.js +213 -41
- package/dist/checks/bin/check-pr-report-density.js +159 -40
- package/dist/checks/bin/check-principal-test-plan-wait.js +159 -40
- package/dist/checks/bin/check-quoted-command.js +586 -103
- package/dist/checks/bin/check-reader-resolvable-prose.js +637 -111
- package/dist/checks/bin/check-registry-gates.js +159 -40
- package/dist/checks/bin/check-retired-vocabulary.js +586 -103
- package/dist/checks/bin/check-review-gate.js +284 -152
- package/dist/checks/bin/check-single-plan-pr.js +159 -40
- package/dist/checks/bin/check-surface-scope.js +164 -41
- package/dist/checks/bin/check-test-plan.js +159 -40
- package/dist/checks/bin/check-token-collection-wired.js +159 -40
- package/dist/checks/bin/check-token-report.js +159 -40
- package/dist/checks/bin/check-workspace-escape.js +664 -147
- package/dist/index.js +3932 -1118
- package/dist/lib/pre-push-cache-test-run.js +507 -72
- package/dist/lib/pre-push-select-tests.js +136 -13
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +222 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +219 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +97 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +425 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +254 -110
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +208 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +80 -28
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +92 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -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 +712 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +368 -56
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
- 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 +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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
- 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 +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__07uhu5z._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
- 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/_0y1jv16._.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 +5 -5
- 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/0bjnj-5fy4e7l.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 0q9p7c6vn-x2w.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 2174nz5he_oc4.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3xnma0-359j17.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +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/{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/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-doc-coverage.ts
|
|
4
|
-
import { execFileSync as
|
|
5
|
-
import { existsSync as
|
|
4
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
5
|
+
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
6
6
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
7
7
|
var GATE_AUDIENCE = {
|
|
8
8
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -197,8 +197,8 @@ function maskIndentedCode(body, fill) {
|
|
|
197
197
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
198
198
|
var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
199
199
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
200
|
-
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d
|
|
201
|
-
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+
|
|
200
|
+
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
|
|
201
|
+
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
|
|
202
202
|
function splitSlugQualifiedEdge(edge) {
|
|
203
203
|
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
204
204
|
if (!m)
|
|
@@ -2046,12 +2046,24 @@ function extractBaseSha(comment) {
|
|
|
2046
2046
|
const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
|
|
2047
2047
|
return m ? m[1].toLowerCase() : null;
|
|
2048
2048
|
}
|
|
2049
|
-
var
|
|
2049
|
+
var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
|
|
2050
|
+
function parseFindingState(description) {
|
|
2051
|
+
const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
|
|
2052
|
+
if (!m)
|
|
2053
|
+
return { id: null, state: null };
|
|
2054
|
+
return { id: `F${m[1]}`, state: m[2] ?? null };
|
|
2055
|
+
}
|
|
2056
|
+
var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
|
|
2050
2057
|
function extractFindingSeverities(comment) {
|
|
2051
|
-
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) =>
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2058
|
+
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
|
|
2059
|
+
const { id, state } = parseFindingState(m[3] ?? "");
|
|
2060
|
+
return {
|
|
2061
|
+
severity: m[1],
|
|
2062
|
+
location: m[2],
|
|
2063
|
+
id,
|
|
2064
|
+
state
|
|
2065
|
+
};
|
|
2066
|
+
});
|
|
2055
2067
|
}
|
|
2056
2068
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
2057
2069
|
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
@@ -2465,6 +2477,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
|
|
|
2465
2477
|
});
|
|
2466
2478
|
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
|
|
2467
2479
|
}
|
|
2480
|
+
function isConsequentialFinding(finding) {
|
|
2481
|
+
return finding.state !== "resolved";
|
|
2482
|
+
}
|
|
2483
|
+
function consequentialFindings(findings) {
|
|
2484
|
+
return findings.filter((f) => isConsequentialFinding(f));
|
|
2485
|
+
}
|
|
2468
2486
|
function evaluateCodeReview(findings, policy) {
|
|
2469
2487
|
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2470
2488
|
}
|
|
@@ -2601,7 +2619,7 @@ function isIssueNotFoundError(err) {
|
|
|
2601
2619
|
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2602
2620
|
}
|
|
2603
2621
|
function resolveObjectivesSource(prBody, issue, cutoverIssue) {
|
|
2604
|
-
if (issue !== null && issue < cutoverIssue)
|
|
2622
|
+
if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
|
|
2605
2623
|
return { kind: "none" };
|
|
2606
2624
|
if (issue !== null)
|
|
2607
2625
|
return { kind: "issue", issue };
|
|
@@ -2877,9 +2895,18 @@ var COMMIT_TYPES = [
|
|
|
2877
2895
|
];
|
|
2878
2896
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2879
2897
|
function checkForgeTitle(title) {
|
|
2880
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
2898
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
|
|
2881
2899
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2882
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
|
+
}
|
|
2883
2910
|
return {
|
|
2884
2911
|
status: "fail",
|
|
2885
2912
|
errors: [
|
|
@@ -2912,19 +2939,31 @@ function checkNoAgentBoxes(prBody) {
|
|
|
2912
2939
|
]
|
|
2913
2940
|
};
|
|
2914
2941
|
}
|
|
2915
|
-
function
|
|
2942
|
+
function rolloutRuleFor(message) {
|
|
2916
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:")) {
|
|
2917
|
-
return
|
|
2944
|
+
return "briefRules";
|
|
2918
2945
|
}
|
|
2919
2946
|
if (message.startsWith("brief-validation no agent boxes:"))
|
|
2920
|
-
return
|
|
2947
|
+
return "agentBoxes";
|
|
2921
2948
|
return null;
|
|
2922
2949
|
}
|
|
2923
|
-
|
|
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) {
|
|
2924
2963
|
const blocking = [];
|
|
2925
2964
|
const info = [];
|
|
2926
2965
|
for (const e of errors) {
|
|
2927
|
-
const threshold = rolloutThresholdFor(e);
|
|
2966
|
+
const threshold = rolloutThresholdFor(e, cutovers);
|
|
2928
2967
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
|
|
2929
2968
|
(grandfathered ? info : blocking).push(e);
|
|
2930
2969
|
}
|
|
@@ -3392,8 +3431,8 @@ function checkIssueRationale(body) {
|
|
|
3392
3431
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3393
3432
|
}
|
|
3394
3433
|
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3395
|
-
function checkIssueObjectives(body, issueNumber) {
|
|
3396
|
-
if (issueNumber !== null && issueNumber <
|
|
3434
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3435
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3397
3436
|
return { status: "pass", errors: [] };
|
|
3398
3437
|
const result = objectivesOf(body);
|
|
3399
3438
|
if (result.ok)
|
|
@@ -3838,7 +3877,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
|
3838
3877
|
return issueToEntry.get(Number(issueMatch[1]));
|
|
3839
3878
|
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
3840
3879
|
}
|
|
3841
|
-
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
3880
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
3842
3881
|
const failures = [];
|
|
3843
3882
|
for (const [slug, issues] of issuesBySlug) {
|
|
3844
3883
|
for (const issue of issues) {
|
|
@@ -3847,7 +3886,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3847
3886
|
const errors = [
|
|
3848
3887
|
...checkIssueRationale(issue.body).errors,
|
|
3849
3888
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3850
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3889
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3851
3890
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3852
3891
|
];
|
|
3853
3892
|
if (errors.length === 0)
|
|
@@ -4097,8 +4136,8 @@ function checkReviewGate(input) {
|
|
|
4097
4136
|
let codeReviewPolicyEvaluation;
|
|
4098
4137
|
let securityPolicyEvaluation;
|
|
4099
4138
|
try {
|
|
4100
|
-
codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
|
|
4101
|
-
securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
|
|
4139
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
|
|
4140
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4102
4141
|
} catch (err) {
|
|
4103
4142
|
return {
|
|
4104
4143
|
verdict: "fail",
|
|
@@ -4470,13 +4509,27 @@ var SHIPS_PREFIX = "aeg-root/";
|
|
|
4470
4509
|
function shipsArchivePrefix(shipsPrefix) {
|
|
4471
4510
|
return `${shipsPrefix}tranches/completed/`;
|
|
4472
4511
|
}
|
|
4473
|
-
|
|
4474
|
-
|
|
4512
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4513
|
+
function normalizeSpecPath(entry) {
|
|
4514
|
+
let out = entry.replace(/\\/g, "/");
|
|
4515
|
+
while (out.startsWith("./"))
|
|
4516
|
+
out = out.slice(2);
|
|
4517
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
4518
|
+
while (out.endsWith("/"))
|
|
4519
|
+
out = out.slice(0, -1);
|
|
4520
|
+
return out;
|
|
4521
|
+
}
|
|
4522
|
+
function isSpecFile2(path, specPaths) {
|
|
4523
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4524
|
+
return true;
|
|
4525
|
+
if (!path.endsWith(".md"))
|
|
4526
|
+
return false;
|
|
4527
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4475
4528
|
}
|
|
4476
4529
|
function isClaudeMdFile(path) {
|
|
4477
4530
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4478
4531
|
}
|
|
4479
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4532
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4480
4533
|
if (path.startsWith(shipsPrefix)) {
|
|
4481
4534
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4482
4535
|
}
|
|
@@ -4485,7 +4538,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
4485
4538
|
}
|
|
4486
4539
|
if (isClaudeMdFile(path))
|
|
4487
4540
|
return "internal";
|
|
4488
|
-
if (isSpecFile2(path))
|
|
4541
|
+
if (isSpecFile2(path, specPaths))
|
|
4489
4542
|
return "spec";
|
|
4490
4543
|
if (isProductScopeFile(path))
|
|
4491
4544
|
return "product";
|
|
@@ -4514,13 +4567,14 @@ function lineAt(content, index) {
|
|
|
4514
4567
|
}
|
|
4515
4568
|
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
4516
4569
|
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
4570
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4517
4571
|
function legacySlugPattern(legacySlugs) {
|
|
4518
4572
|
if (legacySlugs.length === 0)
|
|
4519
4573
|
return null;
|
|
4520
4574
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4521
4575
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4522
4576
|
}
|
|
4523
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4577
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4524
4578
|
const findings = [];
|
|
4525
4579
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
4526
4580
|
const grandfathered = new Set(specGrandfather);
|
|
@@ -4532,8 +4586,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4532
4586
|
const productPatterns = [
|
|
4533
4587
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4534
4588
|
];
|
|
4589
|
+
const specPatterns = [
|
|
4590
|
+
...patterns,
|
|
4591
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4592
|
+
];
|
|
4535
4593
|
for (const file of files) {
|
|
4536
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
4594
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4537
4595
|
if (!cls || cls === "internal")
|
|
4538
4596
|
continue;
|
|
4539
4597
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
@@ -4542,15 +4600,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
4542
4600
|
continue;
|
|
4543
4601
|
const blocking = cls === "product" || cls === "spec";
|
|
4544
4602
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4545
|
-
const patternsToRun = cls === "product" ? productPatterns : patterns;
|
|
4603
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4546
4604
|
for (const { pattern, what, group } of patternsToRun) {
|
|
4547
4605
|
pattern.lastIndex = 0;
|
|
4548
4606
|
let match = pattern.exec(scrubbed);
|
|
4549
4607
|
while (match !== null) {
|
|
4550
4608
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4609
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4551
4610
|
findings.push({
|
|
4552
4611
|
file: file.path,
|
|
4553
|
-
line: lineAt(scrubbed,
|
|
4612
|
+
line: lineAt(scrubbed, citedIndex),
|
|
4554
4613
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4555
4614
|
blocking
|
|
4556
4615
|
});
|
|
@@ -4736,9 +4795,9 @@ function checkSourceComments(files, allowlist = []) {
|
|
|
4736
4795
|
}
|
|
4737
4796
|
return findings;
|
|
4738
4797
|
}
|
|
4739
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
|
|
4798
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4740
4799
|
return [
|
|
4741
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
|
|
4800
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4742
4801
|
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4743
4802
|
];
|
|
4744
4803
|
}
|
|
@@ -5179,15 +5238,32 @@ var ObservedSchema = z.object({
|
|
|
5179
5238
|
var TaskStatusInputSchema = z.object({
|
|
5180
5239
|
task: TaskToolRefSchema.optional()
|
|
5181
5240
|
}).merge(PageRequestSchema).strict();
|
|
5241
|
+
var TaskConfidenceSchema = z.object({
|
|
5242
|
+
round: z.number().int().positive(),
|
|
5243
|
+
percent: z.number().int().min(0).max(100).nullable(),
|
|
5244
|
+
source: z.enum(["stated", "published-summary"])
|
|
5245
|
+
}).strict();
|
|
5246
|
+
var TaskPhaseHistorySchema = z.object({
|
|
5247
|
+
typicalPhaseMinutes: z.number().nonnegative(),
|
|
5248
|
+
typicalPhaseSamples: z.number().int().positive()
|
|
5249
|
+
}).strict();
|
|
5182
5250
|
var TaskStatusItemSchema = z.object({
|
|
5183
5251
|
task: TaskToolRefSchema,
|
|
5184
5252
|
issue: z.number().int().positive(),
|
|
5185
5253
|
pr: z.number().int().positive().nullable(),
|
|
5186
|
-
state: z.string()
|
|
5254
|
+
state: z.string(),
|
|
5255
|
+
round: z.number().int().positive().nullable().optional(),
|
|
5256
|
+
phase: z.string().min(1).nullable().optional(),
|
|
5257
|
+
minutesInPhase: z.number().nonnegative().nullable().optional(),
|
|
5258
|
+
phaseIsCurrent: z.boolean().nullable().optional(),
|
|
5259
|
+
lastConfidence: TaskConfidenceSchema.nullable().optional(),
|
|
5260
|
+
lastConfidenceUnread: z.boolean().optional(),
|
|
5261
|
+
phaseHistory: TaskPhaseHistorySchema.nullable().optional()
|
|
5187
5262
|
}).merge(ObservedSchema);
|
|
5188
5263
|
var TaskStatusResultSchema = z.object({
|
|
5189
5264
|
items: z.array(TaskStatusItemSchema),
|
|
5190
|
-
nextCursor: z.string().nullable()
|
|
5265
|
+
nextCursor: z.string().nullable(),
|
|
5266
|
+
table: z.string()
|
|
5191
5267
|
});
|
|
5192
5268
|
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5193
5269
|
var EscalationInputsSchema = z.object({
|
|
@@ -5195,7 +5271,7 @@ var EscalationInputsSchema = z.object({
|
|
|
5195
5271
|
round: z.number().int().nonnegative(),
|
|
5196
5272
|
head: z.string(),
|
|
5197
5273
|
branch: z.string(),
|
|
5198
|
-
prNumber: z.number().int().positive()
|
|
5274
|
+
prNumber: z.number().int().positive().nullable()
|
|
5199
5275
|
});
|
|
5200
5276
|
var EscalationEvidenceSchema = z.object({
|
|
5201
5277
|
round: z.number().int().nonnegative(),
|
|
@@ -5231,13 +5307,45 @@ var TaskEscalationReadResultSchema = z.object({
|
|
|
5231
5307
|
items: z.array(TaskEscalationPacketSchema),
|
|
5232
5308
|
nextCursor: z.string().nullable()
|
|
5233
5309
|
}).merge(ObservedSchema);
|
|
5234
|
-
var
|
|
5235
|
-
|
|
5236
|
-
|
|
5310
|
+
var TaskPrCheckSchema = z.object({
|
|
5311
|
+
name: z.string(),
|
|
5312
|
+
required: z.boolean(),
|
|
5313
|
+
status: z.string(),
|
|
5314
|
+
conclusion: z.string().nullable(),
|
|
5315
|
+
detailsUrl: z.string().nullable(),
|
|
5316
|
+
failureSummary: z.string().nullable()
|
|
5317
|
+
});
|
|
5318
|
+
var TaskPrVerdictSchema = z.object({
|
|
5319
|
+
role: z.enum(["code-review", "security"]),
|
|
5320
|
+
value: z.string(),
|
|
5321
|
+
judgedHead: z.string().nullable(),
|
|
5322
|
+
objectivesVersion: z.string().nullable()
|
|
5323
|
+
});
|
|
5324
|
+
var TaskPrPauseSchema = z.object({
|
|
5325
|
+
reason: z.string(),
|
|
5326
|
+
body: z.string()
|
|
5327
|
+
});
|
|
5328
|
+
var TaskPrReviewRecordSchema = z.object({
|
|
5329
|
+
verdicts: z.array(TaskPrVerdictSchema),
|
|
5330
|
+
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5331
|
+
summaryTable: z.string().nullable(),
|
|
5332
|
+
pause: TaskPrPauseSchema.nullable()
|
|
5333
|
+
});
|
|
5334
|
+
var TaskPrReadInputSchema = z.object({
|
|
5335
|
+
task: TaskToolRefSchema,
|
|
5336
|
+
pr: z.number().int().positive().optional()
|
|
5237
5337
|
}).strict();
|
|
5338
|
+
var TaskPrReadResultSchema = z.object({
|
|
5339
|
+
task: TaskToolRefSchema,
|
|
5340
|
+
issue: z.number().int().positive(),
|
|
5341
|
+
pr: z.number().int().positive(),
|
|
5342
|
+
head: z.string().nullable(),
|
|
5343
|
+
checks: z.array(TaskPrCheckSchema),
|
|
5344
|
+
review: TaskPrReviewRecordSchema
|
|
5345
|
+
}).merge(ObservedSchema);
|
|
5238
5346
|
var TaskStartResultSchema = z.object({
|
|
5239
5347
|
requestId: z.string().min(1),
|
|
5240
|
-
run:
|
|
5348
|
+
run: TaskToolRefSchema,
|
|
5241
5349
|
started: z.boolean(),
|
|
5242
5350
|
startedAt: z.string(),
|
|
5243
5351
|
mode: z.literal("attended")
|
|
@@ -5251,7 +5359,7 @@ var TaskCancelInputSchema = z.object({
|
|
|
5251
5359
|
}).strict();
|
|
5252
5360
|
var TaskResumeResultSchema = z.object({
|
|
5253
5361
|
task: z.number().int().positive(),
|
|
5254
|
-
pr: z.number().int().positive(),
|
|
5362
|
+
pr: z.number().int().positive().nullable(),
|
|
5255
5363
|
escalationId: z.string().min(1),
|
|
5256
5364
|
outcome: z.enum(["started", "already_resumed"]),
|
|
5257
5365
|
authenticatedBy: z.string().min(1),
|
|
@@ -5260,7 +5368,7 @@ var TaskResumeResultSchema = z.object({
|
|
|
5260
5368
|
var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
|
|
5261
5369
|
var TaskCancelResultSchema = z.object({
|
|
5262
5370
|
task: z.number().int().positive(),
|
|
5263
|
-
pr: z.number().int().positive(),
|
|
5371
|
+
pr: z.number().int().positive().nullable(),
|
|
5264
5372
|
escalationId: z.string().min(1),
|
|
5265
5373
|
outcome: TaskCancelOutcomeSchema,
|
|
5266
5374
|
authenticatedBy: z.string().min(1),
|
|
@@ -5271,6 +5379,7 @@ var TASK_TOOL_NAMES = [
|
|
|
5271
5379
|
"task_start",
|
|
5272
5380
|
"task_status",
|
|
5273
5381
|
"task_escalation_read",
|
|
5382
|
+
"task_pr_read",
|
|
5274
5383
|
"task_resume",
|
|
5275
5384
|
"task_cancel"
|
|
5276
5385
|
];
|
|
@@ -5498,6 +5607,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5498
5607
|
}
|
|
5499
5608
|
return findings;
|
|
5500
5609
|
}
|
|
5610
|
+
// ../../packages/aeg-core/src/gate-cutovers.ts
|
|
5611
|
+
var NO_GATE_CUTOVERS = {
|
|
5612
|
+
objectivesSinceIssue: null,
|
|
5613
|
+
briefSectionsSinceIssue: null,
|
|
5614
|
+
documentationSinceIssue: null,
|
|
5615
|
+
briefRulesSincePr: null,
|
|
5616
|
+
agentBoxesRefusedSincePr: null
|
|
5617
|
+
};
|
|
5501
5618
|
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5502
5619
|
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5503
5620
|
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
@@ -5947,6 +6064,8 @@ function attemptFromEnv(value) {
|
|
|
5947
6064
|
function provenanceFor(input) {
|
|
5948
6065
|
if (input.provenance)
|
|
5949
6066
|
return input.provenance;
|
|
6067
|
+
if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
|
|
6068
|
+
return "unavailable";
|
|
5950
6069
|
if (input.env.role || input.env.task)
|
|
5951
6070
|
return "env_correlated";
|
|
5952
6071
|
return "unavailable";
|
|
@@ -5967,7 +6086,7 @@ function buildHeader(input) {
|
|
|
5967
6086
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
5968
6087
|
const round = roundFromEnv(input.env.round);
|
|
5969
6088
|
const subject = {
|
|
5970
|
-
issue: issueFromTask(input.env.task),
|
|
6089
|
+
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
5971
6090
|
role,
|
|
5972
6091
|
...round !== undefined ? { round } : {},
|
|
5973
6092
|
...input.subject ?? {}
|
|
@@ -6248,8 +6367,8 @@ var ResolutionRecordSchema = z3.object({
|
|
|
6248
6367
|
consumedAt: isoTimestamp
|
|
6249
6368
|
}).strict();
|
|
6250
6369
|
// src/lib/diff-evidence.ts
|
|
6251
|
-
import { execFileSync as
|
|
6252
|
-
import { join as
|
|
6370
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
6371
|
+
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
6253
6372
|
|
|
6254
6373
|
// src/lib/config.ts
|
|
6255
6374
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
@@ -6411,7 +6530,12 @@ var VinayaConfigSchema = z4.object({
|
|
|
6411
6530
|
allowlist: z4.array(z4.string().min(1)).optional(),
|
|
6412
6531
|
severity: z4.enum(["warning", "error"]).optional()
|
|
6413
6532
|
}).optional(),
|
|
6414
|
-
specGrandfather: z4.array(z4.string().min(1)).optional()
|
|
6533
|
+
specGrandfather: z4.array(z4.string().min(1)).optional(),
|
|
6534
|
+
specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6535
|
+
message: "must be a repository-relative path, not an absolute one"
|
|
6536
|
+
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6537
|
+
message: "must stay inside the repository — no `..` segment"
|
|
6538
|
+
})).optional()
|
|
6415
6539
|
}).optional(),
|
|
6416
6540
|
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6417
6541
|
dispatch: z4.object({
|
|
@@ -6425,6 +6549,13 @@ var VinayaConfigSchema = z4.object({
|
|
|
6425
6549
|
securityThreshold: z4.string().min(1).optional(),
|
|
6426
6550
|
maxRounds: z4.number().optional()
|
|
6427
6551
|
}).optional(),
|
|
6552
|
+
gateCutovers: z4.object({
|
|
6553
|
+
objectivesSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6554
|
+
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6555
|
+
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6556
|
+
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6557
|
+
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6558
|
+
}).optional(),
|
|
6428
6559
|
prePush: z4.object({
|
|
6429
6560
|
alwaysRun: z4.array(z4.string()).optional()
|
|
6430
6561
|
}).optional(),
|
|
@@ -6562,6 +6693,18 @@ function resolveReviewPolicy(config) {
|
|
|
6562
6693
|
maxRounds
|
|
6563
6694
|
};
|
|
6564
6695
|
}
|
|
6696
|
+
function resolveGateCutovers(config) {
|
|
6697
|
+
const raw = config?.gateCutovers;
|
|
6698
|
+
if (!raw)
|
|
6699
|
+
return NO_GATE_CUTOVERS;
|
|
6700
|
+
return {
|
|
6701
|
+
objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
|
|
6702
|
+
briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
|
|
6703
|
+
documentationSinceIssue: raw.documentationSinceIssue ?? null,
|
|
6704
|
+
briefRulesSincePr: raw.briefRulesSincePr ?? null,
|
|
6705
|
+
agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
|
|
6706
|
+
};
|
|
6707
|
+
}
|
|
6565
6708
|
function resolveRuntimeDirSetting(config) {
|
|
6566
6709
|
return config?.runtimeDir ?? null;
|
|
6567
6710
|
}
|
|
@@ -6636,7 +6779,28 @@ function trustAnchorRepoFromRemoteUrl(url) {
|
|
|
6636
6779
|
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6637
6780
|
}
|
|
6638
6781
|
var execFileAsync4 = promisify4(execFile4);
|
|
6782
|
+
function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
6783
|
+
const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
|
|
6784
|
+
if (!ref)
|
|
6785
|
+
return null;
|
|
6786
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
6787
|
+
return null;
|
|
6788
|
+
if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
|
|
6789
|
+
return null;
|
|
6790
|
+
return ref;
|
|
6791
|
+
}
|
|
6792
|
+
function readTrustAnchorConfigAtRef(ref) {
|
|
6793
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6794
|
+
encoding: "utf-8",
|
|
6795
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6796
|
+
timeout: 1e4
|
|
6797
|
+
});
|
|
6798
|
+
return Buffer.from(raw, "utf-8").toString("base64");
|
|
6799
|
+
}
|
|
6639
6800
|
function ghFetchTrustAnchorConfig() {
|
|
6801
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6802
|
+
if (probeRef)
|
|
6803
|
+
return readTrustAnchorConfigAtRef(probeRef);
|
|
6640
6804
|
const repo = trustAnchorRepo();
|
|
6641
6805
|
if (!repo)
|
|
6642
6806
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
@@ -6646,6 +6810,14 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6646
6810
|
});
|
|
6647
6811
|
}
|
|
6648
6812
|
async function ghFetchTrustAnchorConfigAsync() {
|
|
6813
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6814
|
+
if (probeRef) {
|
|
6815
|
+
const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6816
|
+
encoding: "utf-8",
|
|
6817
|
+
timeout: 1e4
|
|
6818
|
+
});
|
|
6819
|
+
return Buffer.from(stdout, "utf-8").toString("base64");
|
|
6820
|
+
}
|
|
6649
6821
|
const repo = await trustAnchorRepoAsync();
|
|
6650
6822
|
if (!repo)
|
|
6651
6823
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
@@ -6723,9 +6895,9 @@ function loadConfig() {
|
|
|
6723
6895
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
6724
6896
|
|
|
6725
6897
|
// src/lib/brief-assembly.ts
|
|
6726
|
-
import { execFileSync as
|
|
6727
|
-
import { existsSync as
|
|
6728
|
-
import { join as
|
|
6898
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6899
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
6900
|
+
import { join as join4 } from "node:path";
|
|
6729
6901
|
|
|
6730
6902
|
// ../../packages/sources/src/commands.ts
|
|
6731
6903
|
var COMMANDS = [
|
|
@@ -6920,7 +7092,7 @@ var COMMANDS = [
|
|
|
6920
7092
|
details: [
|
|
6921
7093
|
"Exposes the task-operator tool catalog (`packages/aeg-core/src/task-tools.ts`) to an agent runtime as one MCP server speaking newline-delimited JSON-RPC 2.0 (`initialize`/`tools/list`/`tools/call`). Claude registers it through the generated `.mcp.json`; Codex through its documented `~/.codex/config.toml` `[mcp_servers]` table — both point at this same command.",
|
|
6922
7094
|
"stdout carries JSON-RPC and nothing else: any stray write from the CLI (a forge-read warning) is redirected to stderr, so the protocol stream is never corrupted.",
|
|
6923
|
-
"`task_status`/`task_escalation_read` read; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
|
|
7095
|
+
"`task_status`/`task_escalation_read`/`task_pr_read` read; `task_pr_read` returns the selected task's OWN pull request — every required and reported check with its state, conclusion and failure summary, plus the principal-authored review record (newest verdicts and their judged head, round markers, published summary table, pause comment) — and refuses any other pull request; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
|
|
6924
7096
|
],
|
|
6925
7097
|
status: "shipped"
|
|
6926
7098
|
},
|
|
@@ -7231,6 +7403,10 @@ var COMMANDS = [
|
|
|
7231
7403
|
flag: "--role <name>",
|
|
7232
7404
|
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7233
7405
|
},
|
|
7406
|
+
{
|
|
7407
|
+
flag: "--template <name>",
|
|
7408
|
+
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7409
|
+
},
|
|
7234
7410
|
{
|
|
7235
7411
|
flag: "--print",
|
|
7236
7412
|
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."
|
|
@@ -7566,13 +7742,47 @@ function packageRoot(moduleUrl) {
|
|
|
7566
7742
|
return dir;
|
|
7567
7743
|
}
|
|
7568
7744
|
|
|
7745
|
+
// src/commands/doctrine.ts
|
|
7746
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7747
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7748
|
+
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
7749
|
+
import matter2 from "gray-matter";
|
|
7750
|
+
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7751
|
+
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7752
|
+
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
7753
|
+
}
|
|
7754
|
+
function gitToplevel(cwd) {
|
|
7755
|
+
try {
|
|
7756
|
+
return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7757
|
+
encoding: "utf8",
|
|
7758
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7759
|
+
}).trim();
|
|
7760
|
+
} catch {
|
|
7761
|
+
return null;
|
|
7762
|
+
}
|
|
7763
|
+
}
|
|
7764
|
+
function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7765
|
+
const toplevel = gitToplevel(cwd);
|
|
7766
|
+
if (toplevel !== null) {
|
|
7767
|
+
const treeRoot = join3(toplevel, "aeg-root");
|
|
7768
|
+
if (existsSync3(join3(treeRoot, "roles")))
|
|
7769
|
+
return { root: treeRoot, source: "tree" };
|
|
7770
|
+
}
|
|
7771
|
+
const fromSource = !pkg.split(sep).includes("node_modules");
|
|
7772
|
+
const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
|
|
7773
|
+
return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
|
|
7774
|
+
}
|
|
7775
|
+
function hasDoctrineEntry(root) {
|
|
7776
|
+
return existsSync3(join3(root, ...ENTRY_SEGMENTS));
|
|
7777
|
+
}
|
|
7778
|
+
|
|
7569
7779
|
// src/lib/brief-assembly.ts
|
|
7570
7780
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7571
|
-
var PACKAGED_TEMPLATE_PATH =
|
|
7572
|
-
var TEMPLATE_PATH =
|
|
7781
|
+
var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7782
|
+
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7573
7783
|
function git(args) {
|
|
7574
7784
|
try {
|
|
7575
|
-
return
|
|
7785
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7576
7786
|
} catch {
|
|
7577
7787
|
return "";
|
|
7578
7788
|
}
|
|
@@ -7585,14 +7795,14 @@ function expandGlob(glob) {
|
|
|
7585
7795
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7586
7796
|
|
|
7587
7797
|
// src/checks/registry.ts
|
|
7588
|
-
import { existsSync as
|
|
7589
|
-
import { join as
|
|
7590
|
-
var DIST_BIN_DIR =
|
|
7591
|
-
var SRC_BIN_DIR =
|
|
7592
|
-
var BIN_DIR =
|
|
7798
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
7799
|
+
import { join as join5 } from "node:path";
|
|
7800
|
+
var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7801
|
+
var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7802
|
+
var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7593
7803
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7594
7804
|
function bin(name) {
|
|
7595
|
-
return
|
|
7805
|
+
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7596
7806
|
}
|
|
7597
7807
|
var REGISTRY = [
|
|
7598
7808
|
[
|
|
@@ -8156,21 +8366,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
8156
8366
|
import {
|
|
8157
8367
|
closeSync as closeSync3,
|
|
8158
8368
|
constants as fsConstants3,
|
|
8159
|
-
existsSync as
|
|
8369
|
+
existsSync as existsSync7,
|
|
8160
8370
|
fstatSync as fstatSync2,
|
|
8161
8371
|
mkdirSync as mkdirSync3,
|
|
8162
8372
|
openSync as openSync3,
|
|
8163
|
-
readFileSync as
|
|
8373
|
+
readFileSync as readFileSync6,
|
|
8164
8374
|
renameSync as renameSync2,
|
|
8165
8375
|
writeSync as writeSync2
|
|
8166
8376
|
} from "node:fs";
|
|
8167
8377
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8168
|
-
import { dirname as
|
|
8378
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
8169
8379
|
import { promisify as promisify5 } from "node:util";
|
|
8170
8380
|
|
|
8171
8381
|
// src/lib/run-paths.ts
|
|
8172
|
-
import { chmodSync, existsSync as
|
|
8173
|
-
import { dirname as
|
|
8382
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
|
|
8383
|
+
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8174
8384
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8175
8385
|
function isSafeRepoSegment(segment) {
|
|
8176
8386
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8181,7 +8391,7 @@ function repoSegment(repo) {
|
|
|
8181
8391
|
return `${repo.owner}-${repo.repo}`;
|
|
8182
8392
|
}
|
|
8183
8393
|
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8184
|
-
return
|
|
8394
|
+
return join6(home, "runtime", repoSegment(repo));
|
|
8185
8395
|
}
|
|
8186
8396
|
function resolveRuntimeDir(input) {
|
|
8187
8397
|
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
@@ -8241,9 +8451,9 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8241
8451
|
return null;
|
|
8242
8452
|
}
|
|
8243
8453
|
for (;; ) {
|
|
8244
|
-
if (
|
|
8454
|
+
if (existsSync6(join6(dir, ".git")))
|
|
8245
8455
|
return dir;
|
|
8246
|
-
const parent =
|
|
8456
|
+
const parent = dirname4(dir);
|
|
8247
8457
|
if (parent === dir)
|
|
8248
8458
|
return null;
|
|
8249
8459
|
dir = parent;
|
|
@@ -8258,16 +8468,17 @@ import {
|
|
|
8258
8468
|
mkdirSync as mkdirSync2,
|
|
8259
8469
|
openSync as openSync2,
|
|
8260
8470
|
linkSync,
|
|
8261
|
-
readFileSync as
|
|
8471
|
+
readFileSync as readFileSync5,
|
|
8262
8472
|
renameSync,
|
|
8263
8473
|
statSync,
|
|
8264
8474
|
unlinkSync,
|
|
8475
|
+
utimesSync,
|
|
8265
8476
|
writeFileSync as writeFileSync2,
|
|
8266
8477
|
writeSync
|
|
8267
8478
|
} from "node:fs";
|
|
8268
8479
|
import { randomUUID } from "node:crypto";
|
|
8269
8480
|
import { homedir as homedir2 } from "node:os";
|
|
8270
|
-
import { dirname as
|
|
8481
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8271
8482
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8272
8483
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8273
8484
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8283,7 +8494,7 @@ function isEnoent(err) {
|
|
|
8283
8494
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8284
8495
|
function tryCreateLock(lockPath, token) {
|
|
8285
8496
|
try {
|
|
8286
|
-
mkdirSync2(
|
|
8497
|
+
mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
|
|
8287
8498
|
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8288
8499
|
try {
|
|
8289
8500
|
writeSync(fd, `${token}
|
|
@@ -8345,9 +8556,30 @@ function acquireDrainLock(lockPath) {
|
|
|
8345
8556
|
unlinkSync(claimed);
|
|
8346
8557
|
return tryCreateLock(lockPath, token) ? token : null;
|
|
8347
8558
|
}
|
|
8559
|
+
function renewDrainLock(lockPath, token) {
|
|
8560
|
+
let holder;
|
|
8561
|
+
try {
|
|
8562
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
8563
|
+
} catch (err) {
|
|
8564
|
+
if (!isEnoent(err))
|
|
8565
|
+
throw err;
|
|
8566
|
+
return false;
|
|
8567
|
+
}
|
|
8568
|
+
if (holder !== token)
|
|
8569
|
+
return false;
|
|
8570
|
+
const now = new Date;
|
|
8571
|
+
try {
|
|
8572
|
+
utimesSync(lockPath, now, now);
|
|
8573
|
+
} catch (err) {
|
|
8574
|
+
if (!isEnoent(err))
|
|
8575
|
+
throw err;
|
|
8576
|
+
return false;
|
|
8577
|
+
}
|
|
8578
|
+
return true;
|
|
8579
|
+
}
|
|
8348
8580
|
function releaseDrainLock(lockPath, token) {
|
|
8349
8581
|
try {
|
|
8350
|
-
const holder =
|
|
8582
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
8351
8583
|
if (holder !== token)
|
|
8352
8584
|
return;
|
|
8353
8585
|
unlinkSync(lockPath);
|
|
@@ -8364,68 +8596,205 @@ class WebhookDrainError extends Error {
|
|
|
8364
8596
|
this.code = code;
|
|
8365
8597
|
}
|
|
8366
8598
|
}
|
|
8599
|
+
function backupPathFor(queuePath) {
|
|
8600
|
+
return queuePath.replace(/\.ndjson$/, ".1.ndjson");
|
|
8601
|
+
}
|
|
8602
|
+
function drainingPathFor(queuePath) {
|
|
8603
|
+
return queuePath.replace(/\.ndjson$/, ".draining.ndjson");
|
|
8604
|
+
}
|
|
8605
|
+
function rejectedPathFor(queuePath) {
|
|
8606
|
+
return queuePath.replace(/\.ndjson$/, ".rejected.ndjson");
|
|
8607
|
+
}
|
|
8608
|
+
var rejectionWarnedThisProcess = false;
|
|
8609
|
+
function warnRejectionOnce(message) {
|
|
8610
|
+
if (rejectionWarnedThisProcess)
|
|
8611
|
+
return;
|
|
8612
|
+
rejectionWarnedThisProcess = true;
|
|
8613
|
+
try {
|
|
8614
|
+
process.stderr.write(message);
|
|
8615
|
+
} catch {}
|
|
8616
|
+
}
|
|
8617
|
+
function queueLines(buf) {
|
|
8618
|
+
const lines = [];
|
|
8619
|
+
let start = 0;
|
|
8620
|
+
for (let i = 0;i < buf.byteLength; i++) {
|
|
8621
|
+
if (buf[i] !== 10)
|
|
8622
|
+
continue;
|
|
8623
|
+
if (i > start)
|
|
8624
|
+
lines.push({ raw: buf.toString("utf8", start, i), end: i + 1 });
|
|
8625
|
+
start = i + 1;
|
|
8626
|
+
}
|
|
8627
|
+
if (start < buf.byteLength)
|
|
8628
|
+
lines.push({ raw: buf.toString("utf8", start), end: buf.byteLength });
|
|
8629
|
+
return lines;
|
|
8630
|
+
}
|
|
8631
|
+
function removeQueueHead(path, cut) {
|
|
8632
|
+
const remaining = readFileSync5(path);
|
|
8633
|
+
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8634
|
+
}
|
|
8635
|
+
function queueBucketSize(path) {
|
|
8636
|
+
let lstat;
|
|
8637
|
+
try {
|
|
8638
|
+
lstat = lstatSync(path);
|
|
8639
|
+
} catch (err) {
|
|
8640
|
+
if (!isEnoent(err))
|
|
8641
|
+
throw err;
|
|
8642
|
+
}
|
|
8643
|
+
if (lstat === undefined)
|
|
8644
|
+
return null;
|
|
8645
|
+
if (!lstat.isFile()) {
|
|
8646
|
+
throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
|
|
8647
|
+
}
|
|
8648
|
+
return Number(lstat.size);
|
|
8649
|
+
}
|
|
8650
|
+
function readQueueFile(path) {
|
|
8651
|
+
if (queueBucketSize(path) === null)
|
|
8652
|
+
return null;
|
|
8653
|
+
return readFileSync5(path);
|
|
8654
|
+
}
|
|
8655
|
+
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8656
|
+
const record = JSON.stringify({
|
|
8657
|
+
rejected_at: new Date().toISOString(),
|
|
8658
|
+
status,
|
|
8659
|
+
reason,
|
|
8660
|
+
identity,
|
|
8661
|
+
bytes: Buffer.byteLength(raw, "utf8"),
|
|
8662
|
+
raw
|
|
8663
|
+
});
|
|
8664
|
+
const failure = appendHardenedLine(rejectedPath, `${record}
|
|
8665
|
+
`);
|
|
8666
|
+
if (failure !== null) {
|
|
8667
|
+
throw new WebhookDrainError("log-webhook-drain-rejected-write", `log webhook drain: a queued line failed re-validation (${reason}) and could not be set aside in ${rejectedPath} — ${failure}; the line stays queued`);
|
|
8668
|
+
}
|
|
8669
|
+
warnRejectionOnce(`vinaya: log delivery set a queued line aside in ${rejectedPath} — ${reason}; later lines keep delivering
|
|
8670
|
+
`);
|
|
8671
|
+
}
|
|
8672
|
+
async function postChunk(webhookUrl, headers, body, fetchTimeoutMs, chunksAlreadyDelivered) {
|
|
8673
|
+
const delivered = chunksAlreadyDelivered > 0 ? ` after delivering ${chunksAlreadyDelivered} chunk(s)` : "";
|
|
8674
|
+
let response;
|
|
8675
|
+
try {
|
|
8676
|
+
response = await fetch(webhookUrl, {
|
|
8677
|
+
method: "POST",
|
|
8678
|
+
headers: { "content-type": "application/x-ndjson", ...headers },
|
|
8679
|
+
body,
|
|
8680
|
+
signal: AbortSignal.timeout(fetchTimeoutMs)
|
|
8681
|
+
});
|
|
8682
|
+
} catch (err) {
|
|
8683
|
+
const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
|
|
8684
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed${delivered}: ${reason}`);
|
|
8685
|
+
}
|
|
8686
|
+
if (!response.ok) {
|
|
8687
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}${delivered}`);
|
|
8688
|
+
}
|
|
8689
|
+
}
|
|
8690
|
+
async function drainQueueFile(args) {
|
|
8691
|
+
const { path, rejectedPath, webhookUrl, headers, fetchTimeoutMs, totals } = args;
|
|
8692
|
+
const buf = readQueueFile(path);
|
|
8693
|
+
if (buf === null || buf.byteLength === 0)
|
|
8694
|
+
return;
|
|
8695
|
+
const lines = queueLines(buf);
|
|
8696
|
+
if (lines.length === 0) {
|
|
8697
|
+
removeQueueHead(path, buf.byteLength);
|
|
8698
|
+
return;
|
|
8699
|
+
}
|
|
8700
|
+
let removed = 0;
|
|
8701
|
+
let pendingEnd = 0;
|
|
8702
|
+
let chunk = [];
|
|
8703
|
+
let chunkBytes = 0;
|
|
8704
|
+
const deliverChunk = async () => {
|
|
8705
|
+
const body = `${chunk.join(`
|
|
8706
|
+
`)}
|
|
8707
|
+
`;
|
|
8708
|
+
args.keepLock();
|
|
8709
|
+
await postChunk(webhookUrl, headers, body, fetchTimeoutMs, totals.chunks);
|
|
8710
|
+
totals.chunks += 1;
|
|
8711
|
+
totals.lineCount += chunk.length;
|
|
8712
|
+
totals.bytes += Buffer.byteLength(body, "utf8");
|
|
8713
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8714
|
+
removed = pendingEnd;
|
|
8715
|
+
chunk = [];
|
|
8716
|
+
chunkBytes = 0;
|
|
8717
|
+
};
|
|
8718
|
+
const setAside = async (reason, status, identity, line) => {
|
|
8719
|
+
if (chunk.length > 0)
|
|
8720
|
+
await deliverChunk();
|
|
8721
|
+
rejectLine(rejectedPath, reason, status, identity, line.raw);
|
|
8722
|
+
totals.rejected += 1;
|
|
8723
|
+
pendingEnd = line.end;
|
|
8724
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8725
|
+
removed = pendingEnd;
|
|
8726
|
+
};
|
|
8727
|
+
for (const line of lines) {
|
|
8728
|
+
const record = classifyStoredLine(line.raw, homedir2());
|
|
8729
|
+
if (record.status !== "ok") {
|
|
8730
|
+
await setAside(record.reason, record.status, record.identity, line);
|
|
8731
|
+
continue;
|
|
8732
|
+
}
|
|
8733
|
+
const lineBytes = Buffer.byteLength(record.postLine, "utf8") + 1;
|
|
8734
|
+
if (lineBytes > MAX_WEBHOOK_BODY_BYTES) {
|
|
8735
|
+
await setAside(`one line is ${lineBytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-POST cap — no chunking can carry it`, "too_large", record.identity, line);
|
|
8736
|
+
continue;
|
|
8737
|
+
}
|
|
8738
|
+
if (chunk.length > 0 && chunkBytes + lineBytes > MAX_WEBHOOK_BODY_BYTES)
|
|
8739
|
+
await deliverChunk();
|
|
8740
|
+
chunk.push(record.postLine);
|
|
8741
|
+
chunkBytes += lineBytes;
|
|
8742
|
+
pendingEnd = line.end;
|
|
8743
|
+
}
|
|
8744
|
+
pendingEnd = buf.byteLength;
|
|
8745
|
+
if (chunk.length > 0) {
|
|
8746
|
+
await deliverChunk();
|
|
8747
|
+
return;
|
|
8748
|
+
}
|
|
8749
|
+
if (pendingEnd > removed)
|
|
8750
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8751
|
+
}
|
|
8752
|
+
async function drainRenamedAside(args, livePath, source) {
|
|
8753
|
+
args.keepLock();
|
|
8754
|
+
const draining = drainingPathFor(livePath);
|
|
8755
|
+
try {
|
|
8756
|
+
renameSync(source, draining);
|
|
8757
|
+
} catch (err) {
|
|
8758
|
+
if (isEnoent(err))
|
|
8759
|
+
return;
|
|
8760
|
+
throw err;
|
|
8761
|
+
}
|
|
8762
|
+
await drainQueueFile({ ...args, path: draining });
|
|
8763
|
+
unlinkSync(draining);
|
|
8764
|
+
}
|
|
8367
8765
|
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8368
8766
|
const resolved = await resolveRepo();
|
|
8369
8767
|
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8370
|
-
const outboxRoot = () =>
|
|
8768
|
+
const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
|
|
8371
8769
|
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8372
8770
|
const lockPath = `${path}.flush-lock`;
|
|
8373
8771
|
const lockToken = acquireDrainLock(lockPath);
|
|
8772
|
+
const totals = { lineCount: 0, bytes: 0, chunks: 0, rejected: 0 };
|
|
8374
8773
|
if (lockToken === null)
|
|
8375
|
-
return { flushed: false };
|
|
8774
|
+
return { flushed: false, ...totals };
|
|
8376
8775
|
try {
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
const
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
throw new WebhookDrainError("log-webhook-drain-corrupt-line", `log webhook drain: outbox line ${i} failed schema re-validation — ${record.reason}`);
|
|
8400
|
-
}
|
|
8401
|
-
postLines.push(record.postLine);
|
|
8402
|
-
}
|
|
8403
|
-
const body = `${postLines.join(`
|
|
8404
|
-
`)}
|
|
8405
|
-
`;
|
|
8406
|
-
const bytes = Buffer.byteLength(body, "utf8");
|
|
8407
|
-
if (bytes > MAX_WEBHOOK_BODY_BYTES) {
|
|
8408
|
-
throw new WebhookDrainError("log-webhook-drain-too-large", `log webhook drain: outbox body is ${bytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-call cap — flush more often to drain it.`);
|
|
8409
|
-
}
|
|
8410
|
-
let response;
|
|
8411
|
-
try {
|
|
8412
|
-
response = await fetch(webhookUrl, {
|
|
8413
|
-
method: "POST",
|
|
8414
|
-
headers: { "content-type": "application/x-ndjson", ...headers },
|
|
8415
|
-
body,
|
|
8416
|
-
signal: AbortSignal.timeout(fetchTimeoutMs)
|
|
8417
|
-
});
|
|
8418
|
-
} catch (err) {
|
|
8419
|
-
const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
|
|
8420
|
-
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed: ${reason}`);
|
|
8421
|
-
}
|
|
8422
|
-
if (!response.ok) {
|
|
8423
|
-
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}`);
|
|
8424
|
-
}
|
|
8425
|
-
const liveNow = readFileSync4(path);
|
|
8426
|
-
const tail = liveNow.subarray(Math.min(startOffset, liveNow.byteLength));
|
|
8427
|
-
writeFileSync2(path, tail);
|
|
8428
|
-
return { flushed: true, lineCount: postLines.length, bytes };
|
|
8776
|
+
const keepLock = () => {
|
|
8777
|
+
if (renewDrainLock(lockPath, lockToken))
|
|
8778
|
+
return;
|
|
8779
|
+
throw new WebhookDrainError("log-webhook-drain-lock-lost", `log webhook drain: this drain's lock on ${lockPath} was taken over by another process — stopping here; that process delivers the rest`);
|
|
8780
|
+
};
|
|
8781
|
+
const shared = {
|
|
8782
|
+
rejectedPath: rejectedPathFor(path),
|
|
8783
|
+
webhookUrl,
|
|
8784
|
+
headers,
|
|
8785
|
+
fetchTimeoutMs,
|
|
8786
|
+
totals,
|
|
8787
|
+
keepLock
|
|
8788
|
+
};
|
|
8789
|
+
const draining = drainingPathFor(path);
|
|
8790
|
+
if (queueBucketSize(draining) !== null) {
|
|
8791
|
+
keepLock();
|
|
8792
|
+
await drainQueueFile({ ...shared, path: draining });
|
|
8793
|
+
unlinkSync(draining);
|
|
8794
|
+
}
|
|
8795
|
+
await drainRenamedAside(shared, path, backupPathFor(path));
|
|
8796
|
+
await drainRenamedAside(shared, path, path);
|
|
8797
|
+
return { flushed: totals.chunks > 0 || totals.rejected > 0, ...totals };
|
|
8429
8798
|
} finally {
|
|
8430
8799
|
releaseDrainLock(lockPath, lockToken);
|
|
8431
8800
|
}
|
|
@@ -8508,7 +8877,7 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
8508
8877
|
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8509
8878
|
unattended,
|
|
8510
8879
|
env,
|
|
8511
|
-
defaultFolder:
|
|
8880
|
+
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8512
8881
|
repoRoot: repoRootSync()
|
|
8513
8882
|
});
|
|
8514
8883
|
}
|
|
@@ -8523,7 +8892,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8523
8892
|
} catch (err) {
|
|
8524
8893
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8525
8894
|
}
|
|
8526
|
-
if (!
|
|
8895
|
+
if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
|
|
8527
8896
|
return vinayaVersion;
|
|
8528
8897
|
try {
|
|
8529
8898
|
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
@@ -8532,9 +8901,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8532
8901
|
return vinayaVersion;
|
|
8533
8902
|
}
|
|
8534
8903
|
}
|
|
8904
|
+
var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8905
|
+
function taskRefFromBranch2(branch) {
|
|
8906
|
+
const backlog = /^task\/issue-(\d+)$/.exec(branch);
|
|
8907
|
+
if (backlog) {
|
|
8908
|
+
const issue = Number(backlog[1]);
|
|
8909
|
+
return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
|
|
8910
|
+
}
|
|
8911
|
+
const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
8912
|
+
if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
|
|
8913
|
+
return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
|
|
8914
|
+
}
|
|
8915
|
+
return null;
|
|
8916
|
+
}
|
|
8917
|
+
var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
8918
|
+
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
8919
|
+
let stdout;
|
|
8920
|
+
try {
|
|
8921
|
+
({ stdout } = await execFileAsync5("gh", [
|
|
8922
|
+
"issue",
|
|
8923
|
+
"list",
|
|
8924
|
+
"--state",
|
|
8925
|
+
"all",
|
|
8926
|
+
"--label",
|
|
8927
|
+
`vinaya/tranche:${tranche}`,
|
|
8928
|
+
"--json",
|
|
8929
|
+
"number,title,labels",
|
|
8930
|
+
"--limit",
|
|
8931
|
+
String(TRANCHE_ISSUE_LIST_LIMIT),
|
|
8932
|
+
...repo === null ? [] : ["--repo", repo]
|
|
8933
|
+
], {
|
|
8934
|
+
cwd,
|
|
8935
|
+
encoding: "utf8",
|
|
8936
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
8937
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8938
|
+
killSignal: "SIGKILL"
|
|
8939
|
+
}));
|
|
8940
|
+
} catch {
|
|
8941
|
+
return null;
|
|
8942
|
+
}
|
|
8943
|
+
let issues;
|
|
8944
|
+
try {
|
|
8945
|
+
issues = JSON.parse(stdout);
|
|
8946
|
+
} catch {
|
|
8947
|
+
return null;
|
|
8948
|
+
}
|
|
8949
|
+
for (const issue of issues) {
|
|
8950
|
+
const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
|
|
8951
|
+
if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
|
|
8952
|
+
return issue.number;
|
|
8953
|
+
}
|
|
8954
|
+
return null;
|
|
8955
|
+
}
|
|
8956
|
+
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
8957
|
+
let stdout;
|
|
8958
|
+
try {
|
|
8959
|
+
({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
8960
|
+
cwd,
|
|
8961
|
+
encoding: "utf8",
|
|
8962
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8963
|
+
killSignal: "SIGKILL"
|
|
8964
|
+
}));
|
|
8965
|
+
} catch (err) {
|
|
8966
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
8967
|
+
return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
|
|
8968
|
+
}
|
|
8969
|
+
try {
|
|
8970
|
+
return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
|
|
8971
|
+
} catch {
|
|
8972
|
+
return "unknown";
|
|
8973
|
+
}
|
|
8974
|
+
}
|
|
8975
|
+
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
8976
|
+
let branch;
|
|
8977
|
+
try {
|
|
8978
|
+
branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
8979
|
+
encoding: "utf8",
|
|
8980
|
+
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
8981
|
+
killSignal: "SIGKILL"
|
|
8982
|
+
})).stdout.trim();
|
|
8983
|
+
} catch {
|
|
8984
|
+
return null;
|
|
8985
|
+
}
|
|
8986
|
+
const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
|
|
8987
|
+
const ref = taskRefFromBranch2(named);
|
|
8988
|
+
if (ref === null)
|
|
8989
|
+
return null;
|
|
8990
|
+
if (ref.kind === "tranche")
|
|
8991
|
+
return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
|
|
8992
|
+
return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
|
|
8993
|
+
}
|
|
8535
8994
|
function readVinayaVersion() {
|
|
8536
8995
|
try {
|
|
8537
|
-
const pkg = JSON.parse(
|
|
8996
|
+
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8538
8997
|
return pkg.version ?? "unknown";
|
|
8539
8998
|
} catch {
|
|
8540
8999
|
return "unknown";
|
|
@@ -8544,10 +9003,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
|
8544
9003
|
function isSafeRepoSegment3(segment) {
|
|
8545
9004
|
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8546
9005
|
}
|
|
9006
|
+
function safeRepoSlug(repo) {
|
|
9007
|
+
if (repo === null)
|
|
9008
|
+
return null;
|
|
9009
|
+
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
9010
|
+
}
|
|
8547
9011
|
function outboxPathFor(deps, repo, issue) {
|
|
8548
9012
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8549
9013
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8550
|
-
return
|
|
9014
|
+
return join8(deps.outboxRoot(), dirName, fileName);
|
|
8551
9015
|
}
|
|
8552
9016
|
function hostFromEnv(env) {
|
|
8553
9017
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8565,9 +9029,21 @@ function defaultStderr(message) {
|
|
|
8565
9029
|
warnedThisProcess = true;
|
|
8566
9030
|
process.stderr.write(message);
|
|
8567
9031
|
}
|
|
9032
|
+
var branchIssueFallbackEnabled = true;
|
|
9033
|
+
var branchIssueByCwd = new Map;
|
|
9034
|
+
function branchIssueRead(key, read, shared) {
|
|
9035
|
+
if (!shared)
|
|
9036
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9037
|
+
const cached = branchIssueByCwd.get(key);
|
|
9038
|
+
if (cached !== undefined)
|
|
9039
|
+
return cached;
|
|
9040
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9041
|
+
branchIssueByCwd.set(key, reading);
|
|
9042
|
+
return reading;
|
|
9043
|
+
}
|
|
8568
9044
|
function defaultDeps() {
|
|
8569
9045
|
return {
|
|
8570
|
-
outboxRoot: () =>
|
|
9046
|
+
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8571
9047
|
home: () => homedir3(),
|
|
8572
9048
|
hostname: () => osHostname(),
|
|
8573
9049
|
cwd: () => process.cwd(),
|
|
@@ -8590,10 +9066,28 @@ function guardedAppendOpen(path) {
|
|
|
8590
9066
|
return;
|
|
8591
9067
|
}
|
|
8592
9068
|
}
|
|
9069
|
+
function appendHardenedLine(path, line) {
|
|
9070
|
+
try {
|
|
9071
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
9072
|
+
const fd = guardedAppendOpen(path);
|
|
9073
|
+
if (fd === undefined)
|
|
9074
|
+
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
9075
|
+
try {
|
|
9076
|
+
if (!fstatSync2(fd).isFile())
|
|
9077
|
+
return `target is not a regular file: ${path}`;
|
|
9078
|
+
writeSync2(fd, line);
|
|
9079
|
+
} finally {
|
|
9080
|
+
closeSync3(fd);
|
|
9081
|
+
}
|
|
9082
|
+
return null;
|
|
9083
|
+
} catch (err) {
|
|
9084
|
+
return err instanceof Error ? err.message : String(err);
|
|
9085
|
+
}
|
|
9086
|
+
}
|
|
8593
9087
|
function reportRotationOverflow(backupPath, warn) {
|
|
8594
9088
|
let raw;
|
|
8595
9089
|
try {
|
|
8596
|
-
raw =
|
|
9090
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
8597
9091
|
} catch {
|
|
8598
9092
|
return;
|
|
8599
9093
|
}
|
|
@@ -8616,7 +9110,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8616
9110
|
}
|
|
8617
9111
|
function appendLine(path, line, warn) {
|
|
8618
9112
|
try {
|
|
8619
|
-
mkdirSync3(
|
|
9113
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8620
9114
|
let fd = guardedAppendOpen(path);
|
|
8621
9115
|
if (fd === undefined) {
|
|
8622
9116
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8657,7 +9151,11 @@ function appendLine(path, line, warn) {
|
|
|
8657
9151
|
}
|
|
8658
9152
|
}
|
|
8659
9153
|
function createLogSink(overrides = {}) {
|
|
8660
|
-
const deps = {
|
|
9154
|
+
const deps = {
|
|
9155
|
+
...defaultDeps(),
|
|
9156
|
+
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9157
|
+
...overrides
|
|
9158
|
+
};
|
|
8661
9159
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8662
9160
|
const processId = randomUUID2();
|
|
8663
9161
|
let seq = 0;
|
|
@@ -8677,6 +9175,19 @@ function createLogSink(overrides = {}) {
|
|
|
8677
9175
|
}
|
|
8678
9176
|
return doctrineCache;
|
|
8679
9177
|
};
|
|
9178
|
+
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9179
|
+
let ownBranchIssue;
|
|
9180
|
+
const branchIssueOnce = (repo) => {
|
|
9181
|
+
if (!branchIssueFallbackEnabled)
|
|
9182
|
+
return Promise.resolve(null);
|
|
9183
|
+
const slug = safeRepoSlug(repo);
|
|
9184
|
+
const read = () => deps.resolveBranchIssue(slug);
|
|
9185
|
+
if (readerIsReal)
|
|
9186
|
+
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9187
|
+
if (ownBranchIssue === undefined)
|
|
9188
|
+
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9189
|
+
return ownBranchIssue;
|
|
9190
|
+
};
|
|
8680
9191
|
let resolveRepoCache;
|
|
8681
9192
|
const resolveRepoOnce = () => {
|
|
8682
9193
|
if (resolveRepoCache === undefined)
|
|
@@ -8699,6 +9210,7 @@ function createLogSink(overrides = {}) {
|
|
|
8699
9210
|
};
|
|
8700
9211
|
let drainChain = Promise.resolve();
|
|
8701
9212
|
const pendingWrites = new Set;
|
|
9213
|
+
let writeChain = Promise.resolve();
|
|
8702
9214
|
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
8703
9215
|
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
8704
9216
|
return;
|
|
@@ -8721,7 +9233,14 @@ function createLogSink(overrides = {}) {
|
|
|
8721
9233
|
attempt: env.VINAYA_ATTEMPT,
|
|
8722
9234
|
parent: env.VINAYA_PARENT_EVENT
|
|
8723
9235
|
};
|
|
8724
|
-
const
|
|
9236
|
+
const write = async () => {
|
|
9237
|
+
const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
|
|
9238
|
+
if (resolvedDestination.kind === "none") {
|
|
9239
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9240
|
+
`);
|
|
9241
|
+
return;
|
|
9242
|
+
}
|
|
9243
|
+
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
8725
9244
|
const header = buildHeader({
|
|
8726
9245
|
now,
|
|
8727
9246
|
runId,
|
|
@@ -8732,15 +9251,11 @@ function createLogSink(overrides = {}) {
|
|
|
8732
9251
|
host,
|
|
8733
9252
|
hostname: deps.hostname(),
|
|
8734
9253
|
env: envFields,
|
|
9254
|
+
branchIssue,
|
|
8735
9255
|
eventId: randomUUID2(),
|
|
8736
9256
|
processId,
|
|
8737
9257
|
inputVersions: deps.inputVersions()
|
|
8738
9258
|
});
|
|
8739
|
-
if (resolvedDestination.kind === "none") {
|
|
8740
|
-
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
8741
|
-
`);
|
|
8742
|
-
return;
|
|
8743
|
-
}
|
|
8744
9259
|
const full = { ...e, ...header };
|
|
8745
9260
|
const parsed = LogEventSchema.safeParse(full);
|
|
8746
9261
|
if (!parsed.success) {
|
|
@@ -8757,10 +9272,12 @@ function createLogSink(overrides = {}) {
|
|
|
8757
9272
|
} else {
|
|
8758
9273
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
8759
9274
|
}
|
|
8760
|
-
}
|
|
9275
|
+
};
|
|
9276
|
+
const written = writeChain.then(write).catch((err) => {
|
|
8761
9277
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8762
9278
|
`);
|
|
8763
9279
|
});
|
|
9280
|
+
writeChain = written;
|
|
8764
9281
|
pendingWrites.add(written);
|
|
8765
9282
|
written.finally(() => pendingWrites.delete(written));
|
|
8766
9283
|
} catch (err) {
|
|
@@ -8836,7 +9353,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
8836
9353
|
function fileDiffAgainst(ref, path) {
|
|
8837
9354
|
let out;
|
|
8838
9355
|
try {
|
|
8839
|
-
out =
|
|
9356
|
+
out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
8840
9357
|
encoding: "utf8",
|
|
8841
9358
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8842
9359
|
}).trim();
|
|
@@ -8847,7 +9364,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
8847
9364
|
}
|
|
8848
9365
|
function revParse(ref) {
|
|
8849
9366
|
try {
|
|
8850
|
-
return
|
|
9367
|
+
return execFileSync6("git", ["rev-parse", "--verify", ref], {
|
|
8851
9368
|
encoding: "utf8",
|
|
8852
9369
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8853
9370
|
}).trim();
|
|
@@ -8857,7 +9374,7 @@ function revParse(ref) {
|
|
|
8857
9374
|
}
|
|
8858
9375
|
function repoRoot() {
|
|
8859
9376
|
try {
|
|
8860
|
-
return
|
|
9377
|
+
return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
|
|
8861
9378
|
encoding: "utf8",
|
|
8862
9379
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8863
9380
|
}).trim();
|
|
@@ -8868,7 +9385,7 @@ function repoRoot() {
|
|
|
8868
9385
|
function changedFiles(base) {
|
|
8869
9386
|
let out;
|
|
8870
9387
|
try {
|
|
8871
|
-
out =
|
|
9388
|
+
out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
8872
9389
|
encoding: "utf8",
|
|
8873
9390
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8874
9391
|
}).trim();
|
|
@@ -8893,7 +9410,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
8893
9410
|
const relPaths = changedFiles(ref);
|
|
8894
9411
|
if (relPaths === null)
|
|
8895
9412
|
continue;
|
|
8896
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
9413
|
+
return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
|
|
8897
9414
|
}
|
|
8898
9415
|
return null;
|
|
8899
9416
|
}
|
|
@@ -8928,7 +9445,7 @@ function findingsInThisDiff(findings) {
|
|
|
8928
9445
|
var CHECK_NAME = "doc-coverage";
|
|
8929
9446
|
function git2(args) {
|
|
8930
9447
|
try {
|
|
8931
|
-
return
|
|
9448
|
+
return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
8932
9449
|
} catch {
|
|
8933
9450
|
return "";
|
|
8934
9451
|
}
|
|
@@ -8942,7 +9459,7 @@ function resolvePrBody() {
|
|
|
8942
9459
|
return process.env.PR_BODY;
|
|
8943
9460
|
if (process.env.PR_BODY_FILE) {
|
|
8944
9461
|
try {
|
|
8945
|
-
return
|
|
9462
|
+
return readFileSync7(process.env.PR_BODY_FILE, "utf8");
|
|
8946
9463
|
} catch {
|
|
8947
9464
|
return "";
|
|
8948
9465
|
}
|
|
@@ -8951,7 +9468,7 @@ function resolvePrBody() {
|
|
|
8951
9468
|
}
|
|
8952
9469
|
function fetchPrLabels(prNumber) {
|
|
8953
9470
|
try {
|
|
8954
|
-
const out =
|
|
9471
|
+
const out = execFileSync7("gh", ["pr", "view", String(prNumber), "--json", "labels"], {
|
|
8955
9472
|
encoding: "utf8",
|
|
8956
9473
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8957
9474
|
});
|
|
@@ -8962,7 +9479,7 @@ function fetchPrLabels(prNumber) {
|
|
|
8962
9479
|
}
|
|
8963
9480
|
function fetchWaiverLabelActor(prNumber, label) {
|
|
8964
9481
|
try {
|
|
8965
|
-
const out =
|
|
9482
|
+
const out = execFileSync7("gh", ["api", `repos/{owner}/{repo}/issues/${prNumber}/timeline`, "--paginate"], {
|
|
8966
9483
|
encoding: "utf8",
|
|
8967
9484
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8968
9485
|
});
|
|
@@ -9000,8 +9517,8 @@ function main() {
|
|
|
9000
9517
|
if (changed.length === 0) {
|
|
9001
9518
|
process.exit(0);
|
|
9002
9519
|
}
|
|
9003
|
-
const content =
|
|
9004
|
-
const result = evaluateC5(changed, content, resolvePrBody(),
|
|
9520
|
+
const content = existsSync8(DOC_OWNERS_PATH) ? readFileSync7(DOC_OWNERS_PATH, "utf8") : null;
|
|
9521
|
+
const result = evaluateC5(changed, content, resolvePrBody(), existsSync8, waiverActive(), (p) => fileDiffAgainst(ref, p));
|
|
9005
9522
|
if (result.errors.length > 0) {
|
|
9006
9523
|
for (const message of result.errors) {
|
|
9007
9524
|
emitCheckError({
|