@attalabs/vinaya 0.31.0 → 0.33.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 +2 -3
- package/aeg-root/contracts/principal-operator.md +18 -5
- package/aeg-root/roles/developer/reference.md +3 -3
- package/aeg-root/roles/operator.md +69 -16
- package/aeg-root/roles/planner/reference.md +1 -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/pr-report-template.md +7 -2
- package/dist/checks/bin/check-body-bare-digits.js +340 -101
- package/dist/checks/bin/check-branch-topology.js +184 -105
- package/dist/checks/bin/check-brief-shape.js +333 -94
- package/dist/checks/bin/check-changeset-coverage.js +1028 -248
- package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
- package/dist/checks/bin/check-closes-n.js +184 -105
- package/dist/checks/bin/check-coherence.js +345 -145
- package/dist/checks/bin/check-dead-branch-push.js +179 -59
- package/dist/checks/bin/check-dispatch-readiness.js +350 -150
- package/dist/checks/bin/check-doc-coverage-push.js +1011 -231
- package/dist/checks/bin/check-doc-coverage.js +1015 -235
- package/dist/checks/bin/check-doctrine-no-procedures.js +333 -94
- package/dist/checks/bin/check-doctrine-portability.js +1013 -233
- package/dist/checks/bin/check-evidence-fresh.js +1010 -222
- package/dist/checks/bin/check-exec-bits.js +1009 -229
- package/dist/checks/bin/check-first-push-dispatch.js +343 -145
- package/dist/checks/bin/check-issue-assignment.js +186 -107
- package/dist/checks/bin/check-issue-milestone-attach.js +176 -56
- package/dist/checks/bin/check-issue-objectives-numbering.js +176 -56
- package/dist/checks/bin/check-issue-parts-coverage.js +176 -56
- package/dist/checks/bin/check-issue-surface-globs.js +363 -143
- package/dist/checks/bin/check-issue-title-grammar.js +176 -56
- package/dist/checks/bin/check-issue-tranche-label.js +176 -56
- package/dist/checks/bin/check-main-branch-refusal.js +176 -56
- package/dist/checks/bin/check-no-disk-state.js +176 -56
- package/dist/checks/bin/check-pr-premise-reassert.js +333 -92
- package/dist/checks/bin/check-pr-report-density.js +176 -56
- package/dist/checks/bin/check-principal-test-plan-wait.js +176 -54
- package/dist/checks/bin/check-quoted-command.js +999 -217
- package/dist/checks/bin/check-reader-resolvable-prose.js +1011 -229
- package/dist/checks/bin/check-registry-gates.js +186 -56
- package/dist/checks/bin/check-retired-vocabulary.js +997 -215
- package/dist/checks/bin/check-review-gate.js +403 -203
- package/dist/checks/bin/check-single-plan-pr.js +176 -56
- package/dist/checks/bin/check-surface-scope.js +184 -105
- package/dist/checks/bin/check-test-plan.js +176 -54
- package/dist/checks/bin/check-token-collection-wired.js +182 -57
- package/dist/checks/bin/check-token-report.js +178 -58
- package/dist/checks/bin/check-workspace-escape.js +1011 -229
- package/dist/index.js +5971 -3489
- package/dist/lib/pre-push-cache-test-run.js +4431 -0
- package/dist/lib/pre-push-select-tests.js +799 -110
- package/package.json +3 -2
- 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 +212 -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 +27 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -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 +379 -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 +239 -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 +184 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -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-tools.ts +488 -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 +314 -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]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__18paley._.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/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.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/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/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
2
|
|
|
5
3
|
// src/checks/bin/check-changeset-coverage.ts
|
|
6
|
-
import { execFileSync as
|
|
7
|
-
import { readdirSync, readFileSync as
|
|
8
|
-
import { join as
|
|
4
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
5
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync6 } from "node:fs";
|
|
6
|
+
import { join as join9, relative as relative2 } from "node:path";
|
|
9
7
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
10
8
|
var GATE_AUDIENCE = {
|
|
11
9
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1039,7 +1037,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
1039
1037
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
1040
1038
|
|
|
1041
1039
|
// ../../node_modules/fast-content-type-parse/index.js
|
|
1042
|
-
var NullObject = function
|
|
1040
|
+
var NullObject = function NullObject() {};
|
|
1043
1041
|
NullObject.prototype = Object.create(null);
|
|
1044
1042
|
var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
|
|
1045
1043
|
var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
|
|
@@ -1133,8 +1131,8 @@ function isPlainObject2(value) {
|
|
|
1133
1131
|
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
|
1134
1132
|
}
|
|
1135
1133
|
async function fetchWrapper(requestOptions) {
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1134
|
+
const fetch2 = requestOptions.request?.fetch || globalThis.fetch;
|
|
1135
|
+
if (!fetch2) {
|
|
1138
1136
|
throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");
|
|
1139
1137
|
}
|
|
1140
1138
|
const log = requestOptions.request?.log || console;
|
|
@@ -1146,7 +1144,7 @@ async function fetchWrapper(requestOptions) {
|
|
|
1146
1144
|
]));
|
|
1147
1145
|
let fetchResponse;
|
|
1148
1146
|
try {
|
|
1149
|
-
fetchResponse = await
|
|
1147
|
+
fetchResponse = await fetch2(requestOptions.url, {
|
|
1150
1148
|
method: requestOptions.method,
|
|
1151
1149
|
body,
|
|
1152
1150
|
redirect: requestOptions.request?.redirect,
|
|
@@ -1783,27 +1781,27 @@ function splitTableRow(row) {
|
|
|
1783
1781
|
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1784
1782
|
}
|
|
1785
1783
|
// ../../packages/aeg-core/src/blast-radius-domains.ts
|
|
1786
|
-
function resolveWorkspaceEntry(
|
|
1787
|
-
if (
|
|
1788
|
-
const baseDir =
|
|
1784
|
+
function resolveWorkspaceEntry(entry, listDirs) {
|
|
1785
|
+
if (entry.endsWith("/*")) {
|
|
1786
|
+
const baseDir = entry.slice(0, -2);
|
|
1789
1787
|
return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
|
|
1790
1788
|
}
|
|
1791
|
-
if (
|
|
1789
|
+
if (entry.includes("*"))
|
|
1792
1790
|
return [];
|
|
1793
|
-
return [
|
|
1791
|
+
return [entry];
|
|
1794
1792
|
}
|
|
1795
1793
|
// ../../packages/aeg-core/src/consumer-enumeration.ts
|
|
1796
1794
|
function deriveWorkspaceMemberDirs(workspaces, listDirs) {
|
|
1797
|
-
const positive = workspaces.filter((
|
|
1798
|
-
const negative = workspaces.filter((
|
|
1795
|
+
const positive = workspaces.filter((entry) => !entry.startsWith("!"));
|
|
1796
|
+
const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
|
|
1799
1797
|
const excluded = new Set;
|
|
1800
|
-
for (const
|
|
1801
|
-
for (const member of resolveWorkspaceEntry(
|
|
1798
|
+
for (const entry of negative) {
|
|
1799
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs))
|
|
1802
1800
|
excluded.add(member);
|
|
1803
1801
|
}
|
|
1804
1802
|
const members = new Set;
|
|
1805
|
-
for (const
|
|
1806
|
-
for (const member of resolveWorkspaceEntry(
|
|
1803
|
+
for (const entry of positive) {
|
|
1804
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs)) {
|
|
1807
1805
|
if (!excluded.has(member))
|
|
1808
1806
|
members.add(member);
|
|
1809
1807
|
}
|
|
@@ -2049,12 +2047,24 @@ function extractBaseSha(comment) {
|
|
|
2049
2047
|
const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
|
|
2050
2048
|
return m ? m[1].toLowerCase() : null;
|
|
2051
2049
|
}
|
|
2052
|
-
var
|
|
2050
|
+
var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
|
|
2051
|
+
function parseFindingState(description) {
|
|
2052
|
+
const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
|
|
2053
|
+
if (!m)
|
|
2054
|
+
return { id: null, state: null };
|
|
2055
|
+
return { id: `F${m[1]}`, state: m[2] ?? null };
|
|
2056
|
+
}
|
|
2057
|
+
var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
|
|
2053
2058
|
function extractFindingSeverities(comment) {
|
|
2054
|
-
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) =>
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2059
|
+
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
|
|
2060
|
+
const { id, state } = parseFindingState(m[3] ?? "");
|
|
2061
|
+
return {
|
|
2062
|
+
severity: m[1],
|
|
2063
|
+
location: m[2],
|
|
2064
|
+
id,
|
|
2065
|
+
state
|
|
2066
|
+
};
|
|
2067
|
+
});
|
|
2058
2068
|
}
|
|
2059
2069
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
2060
2070
|
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
@@ -2127,15 +2137,15 @@ function summarizeTranscript(jsonl) {
|
|
|
2127
2137
|
const line = rawLine.trim();
|
|
2128
2138
|
if (!line)
|
|
2129
2139
|
continue;
|
|
2130
|
-
let
|
|
2140
|
+
let entry;
|
|
2131
2141
|
try {
|
|
2132
|
-
|
|
2142
|
+
entry = JSON.parse(line);
|
|
2133
2143
|
} catch {
|
|
2134
2144
|
continue;
|
|
2135
2145
|
}
|
|
2136
|
-
if (!
|
|
2146
|
+
if (!entry || typeof entry !== "object")
|
|
2137
2147
|
continue;
|
|
2138
|
-
const obj =
|
|
2148
|
+
const obj = entry;
|
|
2139
2149
|
if (obj.type !== "assistant")
|
|
2140
2150
|
continue;
|
|
2141
2151
|
const message = obj.message;
|
|
@@ -2468,6 +2478,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
|
|
|
2468
2478
|
});
|
|
2469
2479
|
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
|
|
2470
2480
|
}
|
|
2481
|
+
function isConsequentialFinding(finding) {
|
|
2482
|
+
return finding.state !== "resolved";
|
|
2483
|
+
}
|
|
2484
|
+
function consequentialFindings(findings) {
|
|
2485
|
+
return findings.filter((f) => isConsequentialFinding(f));
|
|
2486
|
+
}
|
|
2471
2487
|
function evaluateCodeReview(findings, policy) {
|
|
2472
2488
|
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2473
2489
|
}
|
|
@@ -2983,7 +2999,7 @@ function isStep0Block(content) {
|
|
|
2983
2999
|
}
|
|
2984
3000
|
function checkCommandsCarryOutput(prBody) {
|
|
2985
3001
|
const errors = [];
|
|
2986
|
-
for (const [
|
|
3002
|
+
for (const [label, num] of [
|
|
2987
3003
|
["5", 5],
|
|
2988
3004
|
["6", 6]
|
|
2989
3005
|
]) {
|
|
@@ -2997,7 +3013,7 @@ function checkCommandsCarryOutput(prBody) {
|
|
|
2997
3013
|
continue;
|
|
2998
3014
|
const next = blocks[i + 1];
|
|
2999
3015
|
if (!next || isCommandBlock(next.content)) {
|
|
3000
|
-
errors.push(`brief-validation commands carry output: §${
|
|
3016
|
+
errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
|
|
3001
3017
|
}
|
|
3002
3018
|
}
|
|
3003
3019
|
}
|
|
@@ -3434,8 +3450,8 @@ function stripPartBackticks(text) {
|
|
|
3434
3450
|
function partWordCount(text) {
|
|
3435
3451
|
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3436
3452
|
}
|
|
3437
|
-
function looksLikeFilePath(
|
|
3438
|
-
const stripped =
|
|
3453
|
+
function looksLikeFilePath(entry) {
|
|
3454
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3439
3455
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3440
3456
|
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3441
3457
|
return extMatch !== null && extMatch.index > 0;
|
|
@@ -3921,14 +3937,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3921
3937
|
const referenced = extractClosesReferences(prBody);
|
|
3922
3938
|
if (taskIssueRefs) {
|
|
3923
3939
|
for (const n of referenced) {
|
|
3924
|
-
const
|
|
3925
|
-
if (!
|
|
3940
|
+
const ref = taskIssueRefs.get(n);
|
|
3941
|
+
if (!ref)
|
|
3926
3942
|
continue;
|
|
3927
|
-
const expectedBranch = `task/${
|
|
3943
|
+
const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
|
|
3928
3944
|
if (branch !== expectedBranch) {
|
|
3929
3945
|
return {
|
|
3930
3946
|
ok: false,
|
|
3931
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3947
|
+
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
|
|
3932
3948
|
};
|
|
3933
3949
|
}
|
|
3934
3950
|
}
|
|
@@ -3937,15 +3953,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3937
3953
|
if (!ref)
|
|
3938
3954
|
return { ok: true };
|
|
3939
3955
|
if (ref.kind === "issue") {
|
|
3940
|
-
const
|
|
3941
|
-
if (!referenced.has(
|
|
3956
|
+
const expectedIssue = ref.issueNumber;
|
|
3957
|
+
if (!referenced.has(expectedIssue)) {
|
|
3942
3958
|
return {
|
|
3943
3959
|
ok: false,
|
|
3944
|
-
expectedIssue
|
|
3945
|
-
message: `closes-n: PR body does not contain \`Closes #${
|
|
3960
|
+
expectedIssue,
|
|
3961
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3946
3962
|
};
|
|
3947
3963
|
}
|
|
3948
|
-
return { ok: true, expectedIssue
|
|
3964
|
+
return { ok: true, expectedIssue };
|
|
3949
3965
|
}
|
|
3950
3966
|
const trancheSlug = ref.tranche;
|
|
3951
3967
|
const taskId = ref.taskId;
|
|
@@ -3991,8 +4007,8 @@ function extractIssue(body) {
|
|
|
3991
4007
|
const anchorNums = closesRefs(anchored);
|
|
3992
4008
|
if (anchorNums.length === 0)
|
|
3993
4009
|
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
3994
|
-
const
|
|
3995
|
-
return { issue
|
|
4010
|
+
const issue = anchorNums[0];
|
|
4011
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
|
|
3996
4012
|
}
|
|
3997
4013
|
const headerNums = closesRefs(headerRegion(stripped));
|
|
3998
4014
|
if (bodyNums.length === 0)
|
|
@@ -4061,15 +4077,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4061
4077
|
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4062
4078
|
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4063
4079
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4064
|
-
const
|
|
4080
|
+
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4065
4081
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4066
4082
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4067
4083
|
return {
|
|
4068
|
-
bound: head && base && briefHashBound &&
|
|
4084
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4069
4085
|
head,
|
|
4070
4086
|
base,
|
|
4071
4087
|
briefHash: briefHashBound,
|
|
4072
|
-
objectivesVersion
|
|
4088
|
+
objectivesVersion,
|
|
4073
4089
|
rulingOrdinal,
|
|
4074
4090
|
policyDigest: policyDigestBound
|
|
4075
4091
|
};
|
|
@@ -4100,8 +4116,8 @@ function checkReviewGate(input) {
|
|
|
4100
4116
|
let codeReviewPolicyEvaluation;
|
|
4101
4117
|
let securityPolicyEvaluation;
|
|
4102
4118
|
try {
|
|
4103
|
-
codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
|
|
4104
|
-
securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
|
|
4119
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
|
|
4120
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4105
4121
|
} catch (err) {
|
|
4106
4122
|
return {
|
|
4107
4123
|
verdict: "fail",
|
|
@@ -5182,11 +5198,27 @@ var ObservedSchema = z.object({
|
|
|
5182
5198
|
var TaskStatusInputSchema = z.object({
|
|
5183
5199
|
task: TaskToolRefSchema.optional()
|
|
5184
5200
|
}).merge(PageRequestSchema).strict();
|
|
5201
|
+
var TaskConfidenceSchema = z.object({
|
|
5202
|
+
round: z.number().int().positive(),
|
|
5203
|
+
percent: z.number().int().min(0).max(100).nullable(),
|
|
5204
|
+
source: z.enum(["stated", "published-summary"])
|
|
5205
|
+
}).strict();
|
|
5206
|
+
var TaskPhaseHistorySchema = z.object({
|
|
5207
|
+
typicalPhaseMinutes: z.number().nonnegative(),
|
|
5208
|
+
typicalPhaseSamples: z.number().int().positive()
|
|
5209
|
+
}).strict();
|
|
5185
5210
|
var TaskStatusItemSchema = z.object({
|
|
5186
5211
|
task: TaskToolRefSchema,
|
|
5187
5212
|
issue: z.number().int().positive(),
|
|
5188
5213
|
pr: z.number().int().positive().nullable(),
|
|
5189
|
-
state: z.string()
|
|
5214
|
+
state: z.string(),
|
|
5215
|
+
round: z.number().int().positive().nullable().optional(),
|
|
5216
|
+
phase: z.string().min(1).nullable().optional(),
|
|
5217
|
+
minutesInPhase: z.number().nonnegative().nullable().optional(),
|
|
5218
|
+
phaseIsCurrent: z.boolean().nullable().optional(),
|
|
5219
|
+
lastConfidence: TaskConfidenceSchema.nullable().optional(),
|
|
5220
|
+
lastConfidenceUnread: z.boolean().optional(),
|
|
5221
|
+
phaseHistory: TaskPhaseHistorySchema.nullable().optional()
|
|
5190
5222
|
}).merge(ObservedSchema);
|
|
5191
5223
|
var TaskStatusResultSchema = z.object({
|
|
5192
5224
|
items: z.array(TaskStatusItemSchema),
|
|
@@ -5198,7 +5230,7 @@ var EscalationInputsSchema = z.object({
|
|
|
5198
5230
|
round: z.number().int().nonnegative(),
|
|
5199
5231
|
head: z.string(),
|
|
5200
5232
|
branch: z.string(),
|
|
5201
|
-
prNumber: z.number().int().positive()
|
|
5233
|
+
prNumber: z.number().int().positive().nullable()
|
|
5202
5234
|
});
|
|
5203
5235
|
var EscalationEvidenceSchema = z.object({
|
|
5204
5236
|
round: z.number().int().nonnegative(),
|
|
@@ -5234,13 +5266,45 @@ var TaskEscalationReadResultSchema = z.object({
|
|
|
5234
5266
|
items: z.array(TaskEscalationPacketSchema),
|
|
5235
5267
|
nextCursor: z.string().nullable()
|
|
5236
5268
|
}).merge(ObservedSchema);
|
|
5237
|
-
var
|
|
5238
|
-
|
|
5239
|
-
|
|
5269
|
+
var TaskPrCheckSchema = z.object({
|
|
5270
|
+
name: z.string(),
|
|
5271
|
+
required: z.boolean(),
|
|
5272
|
+
status: z.string(),
|
|
5273
|
+
conclusion: z.string().nullable(),
|
|
5274
|
+
detailsUrl: z.string().nullable(),
|
|
5275
|
+
failureSummary: z.string().nullable()
|
|
5276
|
+
});
|
|
5277
|
+
var TaskPrVerdictSchema = z.object({
|
|
5278
|
+
role: z.enum(["code-review", "security"]),
|
|
5279
|
+
value: z.string(),
|
|
5280
|
+
judgedHead: z.string().nullable(),
|
|
5281
|
+
objectivesVersion: z.string().nullable()
|
|
5282
|
+
});
|
|
5283
|
+
var TaskPrPauseSchema = z.object({
|
|
5284
|
+
reason: z.string(),
|
|
5285
|
+
body: z.string()
|
|
5286
|
+
});
|
|
5287
|
+
var TaskPrReviewRecordSchema = z.object({
|
|
5288
|
+
verdicts: z.array(TaskPrVerdictSchema),
|
|
5289
|
+
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5290
|
+
summaryTable: z.string().nullable(),
|
|
5291
|
+
pause: TaskPrPauseSchema.nullable()
|
|
5292
|
+
});
|
|
5293
|
+
var TaskPrReadInputSchema = z.object({
|
|
5294
|
+
task: TaskToolRefSchema,
|
|
5295
|
+
pr: z.number().int().positive().optional()
|
|
5240
5296
|
}).strict();
|
|
5297
|
+
var TaskPrReadResultSchema = z.object({
|
|
5298
|
+
task: TaskToolRefSchema,
|
|
5299
|
+
issue: z.number().int().positive(),
|
|
5300
|
+
pr: z.number().int().positive(),
|
|
5301
|
+
head: z.string().nullable(),
|
|
5302
|
+
checks: z.array(TaskPrCheckSchema),
|
|
5303
|
+
review: TaskPrReviewRecordSchema
|
|
5304
|
+
}).merge(ObservedSchema);
|
|
5241
5305
|
var TaskStartResultSchema = z.object({
|
|
5242
5306
|
requestId: z.string().min(1),
|
|
5243
|
-
run:
|
|
5307
|
+
run: TaskToolRefSchema,
|
|
5244
5308
|
started: z.boolean(),
|
|
5245
5309
|
startedAt: z.string(),
|
|
5246
5310
|
mode: z.literal("attended")
|
|
@@ -5254,7 +5318,7 @@ var TaskCancelInputSchema = z.object({
|
|
|
5254
5318
|
}).strict();
|
|
5255
5319
|
var TaskResumeResultSchema = z.object({
|
|
5256
5320
|
task: z.number().int().positive(),
|
|
5257
|
-
pr: z.number().int().positive(),
|
|
5321
|
+
pr: z.number().int().positive().nullable(),
|
|
5258
5322
|
escalationId: z.string().min(1),
|
|
5259
5323
|
outcome: z.enum(["started", "already_resumed"]),
|
|
5260
5324
|
authenticatedBy: z.string().min(1),
|
|
@@ -5263,7 +5327,7 @@ var TaskResumeResultSchema = z.object({
|
|
|
5263
5327
|
var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
|
|
5264
5328
|
var TaskCancelResultSchema = z.object({
|
|
5265
5329
|
task: z.number().int().positive(),
|
|
5266
|
-
pr: z.number().int().positive(),
|
|
5330
|
+
pr: z.number().int().positive().nullable(),
|
|
5267
5331
|
escalationId: z.string().min(1),
|
|
5268
5332
|
outcome: TaskCancelOutcomeSchema,
|
|
5269
5333
|
authenticatedBy: z.string().min(1),
|
|
@@ -5274,6 +5338,7 @@ var TASK_TOOL_NAMES = [
|
|
|
5274
5338
|
"task_start",
|
|
5275
5339
|
"task_status",
|
|
5276
5340
|
"task_escalation_read",
|
|
5341
|
+
"task_pr_read",
|
|
5277
5342
|
"task_resume",
|
|
5278
5343
|
"task_cancel"
|
|
5279
5344
|
];
|
|
@@ -5501,6 +5566,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5501
5566
|
}
|
|
5502
5567
|
return findings;
|
|
5503
5568
|
}
|
|
5569
|
+
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5570
|
+
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5571
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5572
|
+
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5504
5573
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5505
5574
|
import { createHash as createHash5 } from "node:crypto";
|
|
5506
5575
|
|
|
@@ -6039,6 +6108,7 @@ function redact(value, home) {
|
|
|
6039
6108
|
return value;
|
|
6040
6109
|
}
|
|
6041
6110
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6111
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6042
6112
|
function metaOf(obj) {
|
|
6043
6113
|
if (obj === null || typeof obj !== "object")
|
|
6044
6114
|
return null;
|
|
@@ -6061,11 +6131,61 @@ function recordIdentity(obj) {
|
|
|
6061
6131
|
}
|
|
6062
6132
|
return null;
|
|
6063
6133
|
}
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6134
|
+
function schemaVersionOf(obj) {
|
|
6135
|
+
const meta = metaOf(obj);
|
|
6136
|
+
const schema = meta?.schema;
|
|
6137
|
+
return typeof schema === "number" ? schema : null;
|
|
6138
|
+
}
|
|
6139
|
+
function isKnownSchema(version) {
|
|
6140
|
+
return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
|
|
6141
|
+
}
|
|
6142
|
+
function classifyStoredLine(raw, home) {
|
|
6143
|
+
let obj;
|
|
6144
|
+
try {
|
|
6145
|
+
obj = JSON.parse(raw);
|
|
6146
|
+
} catch {
|
|
6147
|
+
return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
|
|
6148
|
+
}
|
|
6149
|
+
const version = schemaVersionOf(obj);
|
|
6150
|
+
if (version === null) {
|
|
6151
|
+
return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
|
|
6152
|
+
}
|
|
6153
|
+
if (!isKnownSchema(version)) {
|
|
6154
|
+
return {
|
|
6155
|
+
status: "unknown_version",
|
|
6156
|
+
identity: recordIdentity(obj),
|
|
6157
|
+
schema: version,
|
|
6158
|
+
raw,
|
|
6159
|
+
reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
|
|
6160
|
+
};
|
|
6161
|
+
}
|
|
6162
|
+
const result = LogEventSchema.safeParse(obj);
|
|
6163
|
+
if (!result.success) {
|
|
6164
|
+
return {
|
|
6165
|
+
status: "invalid",
|
|
6166
|
+
identity: recordIdentity(obj),
|
|
6167
|
+
raw,
|
|
6168
|
+
reason: result.error.issues[0]?.message ?? "schema violation"
|
|
6169
|
+
};
|
|
6170
|
+
}
|
|
6171
|
+
const event = result.data;
|
|
6172
|
+
const identity = recordIdentity(event);
|
|
6173
|
+
if (identity === null) {
|
|
6174
|
+
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6175
|
+
}
|
|
6176
|
+
const redacted = redact(event, home);
|
|
6177
|
+
const provenance = version === 2 ? event.meta.provenance ?? null : null;
|
|
6178
|
+
return {
|
|
6179
|
+
status: "ok",
|
|
6180
|
+
identity,
|
|
6181
|
+
runId: event.meta.run_id,
|
|
6182
|
+
seq: event.meta.seq,
|
|
6183
|
+
schema: version,
|
|
6184
|
+
provenance,
|
|
6185
|
+
event,
|
|
6186
|
+
postLine: JSON.stringify(redacted)
|
|
6187
|
+
};
|
|
6188
|
+
}
|
|
6069
6189
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6070
6190
|
import { z as z3 } from "zod";
|
|
6071
6191
|
var isoTimestamp = z3.string().min(1);
|
|
@@ -6196,11 +6316,12 @@ var ResolutionRecordSchema = z3.object({
|
|
|
6196
6316
|
consumedAt: isoTimestamp
|
|
6197
6317
|
}).strict();
|
|
6198
6318
|
// src/lib/diff-evidence.ts
|
|
6199
|
-
import { execFileSync as
|
|
6200
|
-
import { join as
|
|
6319
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6320
|
+
import { join as join8, relative, resolve as resolve2 } from "node:path";
|
|
6201
6321
|
|
|
6202
6322
|
// src/lib/config.ts
|
|
6203
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
6323
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6324
|
+
import { promisify as promisify4 } from "node:util";
|
|
6204
6325
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6205
6326
|
import { homedir } from "node:os";
|
|
6206
6327
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -6227,10 +6348,10 @@ var CheckEntrySchema = z4.object({
|
|
|
6227
6348
|
ownWorkflow: z4.boolean().optional(),
|
|
6228
6349
|
principalOwed: z4.literal(true).optional(),
|
|
6229
6350
|
validates: z4.enum(["body", "issue"]).optional()
|
|
6230
|
-
}).superRefine((
|
|
6231
|
-
if (!
|
|
6351
|
+
}).superRefine((entry, ctx) => {
|
|
6352
|
+
if (!entry.env)
|
|
6232
6353
|
return;
|
|
6233
|
-
for (const [key, value] of Object.entries(
|
|
6354
|
+
for (const [key, value] of Object.entries(entry.env)) {
|
|
6234
6355
|
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
6235
6356
|
continue;
|
|
6236
6357
|
const members = value.anyOf;
|
|
@@ -6387,18 +6508,19 @@ var VinayaConfigSchema = z4.object({
|
|
|
6387
6508
|
});
|
|
6388
6509
|
}
|
|
6389
6510
|
}).optional(),
|
|
6390
|
-
logPublish: z4.
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
}).refine((v) => v.
|
|
6399
|
-
message: "
|
|
6400
|
-
}).
|
|
6401
|
-
|
|
6511
|
+
logPublish: z4.unknown().refine((v) => v === undefined, {
|
|
6512
|
+
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6513
|
+
}),
|
|
6514
|
+
runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6515
|
+
logs: z4.object({
|
|
6516
|
+
folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6517
|
+
url: z4.string().url().optional(),
|
|
6518
|
+
headers: z4.record(z4.string()).optional()
|
|
6519
|
+
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6520
|
+
message: "logs: set at most one of folder/url"
|
|
6521
|
+
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6522
|
+
message: "logs: headers requires url"
|
|
6523
|
+
}).optional()
|
|
6402
6524
|
});
|
|
6403
6525
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
6404
6526
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -6443,32 +6565,39 @@ function globalTokensCollectIgnoredWarning(path) {
|
|
|
6443
6565
|
function globalRuntimeDirIgnoredWarning(path) {
|
|
6444
6566
|
return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
|
|
6445
6567
|
}
|
|
6568
|
+
var emittedGlobalKeyWarnings = new Set;
|
|
6569
|
+
function warnGlobalKeyIgnoredOnce(message) {
|
|
6570
|
+
if (emittedGlobalKeyWarnings.has(message))
|
|
6571
|
+
return;
|
|
6572
|
+
emittedGlobalKeyWarnings.add(message);
|
|
6573
|
+
console.error(`⚠ ${message}`);
|
|
6574
|
+
}
|
|
6446
6575
|
function stripGlobalOnlyKeys(config, path) {
|
|
6447
6576
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
6448
6577
|
return config;
|
|
6449
6578
|
let result = config;
|
|
6450
6579
|
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
6451
|
-
|
|
6580
|
+
warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
|
|
6452
6581
|
result = { ...result, checks: undefined };
|
|
6453
6582
|
}
|
|
6454
6583
|
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
6455
|
-
|
|
6584
|
+
warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
|
|
6456
6585
|
result = { ...result, roles: undefined };
|
|
6457
6586
|
}
|
|
6458
6587
|
if (result.principals && result.principals.length > 0) {
|
|
6459
|
-
|
|
6588
|
+
warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
|
|
6460
6589
|
result = { ...result, principals: undefined };
|
|
6461
6590
|
}
|
|
6462
6591
|
if (result.releaseActor) {
|
|
6463
|
-
|
|
6592
|
+
warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
|
|
6464
6593
|
result = { ...result, releaseActor: undefined };
|
|
6465
6594
|
}
|
|
6466
6595
|
if (result.tokens) {
|
|
6467
|
-
|
|
6596
|
+
warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
|
|
6468
6597
|
result = { ...result, tokens: undefined };
|
|
6469
6598
|
}
|
|
6470
6599
|
if (result.runtimeDir) {
|
|
6471
|
-
|
|
6600
|
+
warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
|
|
6472
6601
|
result = { ...result, runtimeDir: undefined };
|
|
6473
6602
|
}
|
|
6474
6603
|
return result;
|
|
@@ -6501,26 +6630,102 @@ function resolveReviewPolicy(config) {
|
|
|
6501
6630
|
maxRounds
|
|
6502
6631
|
};
|
|
6503
6632
|
}
|
|
6504
|
-
function
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6633
|
+
function resolveRuntimeDirSetting(config) {
|
|
6634
|
+
return config?.runtimeDir ?? null;
|
|
6635
|
+
}
|
|
6636
|
+
function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
|
|
6637
|
+
const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
|
|
6638
|
+
return anchored !== null && anchored === localRuntimeDir ? anchored : null;
|
|
6639
|
+
}
|
|
6640
|
+
function resolveLogsSetting(config) {
|
|
6641
|
+
const raw = config?.logs;
|
|
6642
|
+
if (!raw)
|
|
6643
|
+
return null;
|
|
6644
|
+
if (raw.url !== undefined)
|
|
6645
|
+
return { url: raw.url, headers: raw.headers };
|
|
6646
|
+
if (raw.folder !== undefined)
|
|
6647
|
+
return { folder: raw.folder };
|
|
6648
|
+
return null;
|
|
6649
|
+
}
|
|
6650
|
+
function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
6651
|
+
const anchored = resolveLogsSetting(trustAnchorConfig);
|
|
6652
|
+
if (!anchored)
|
|
6653
|
+
return null;
|
|
6654
|
+
if ("url" in local)
|
|
6655
|
+
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6656
|
+
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6657
|
+
}
|
|
6658
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6659
|
+
if (!headers)
|
|
6660
|
+
return;
|
|
6661
|
+
const resolved = {};
|
|
6662
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
6663
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6511
6664
|
}
|
|
6665
|
+
return resolved;
|
|
6666
|
+
}
|
|
6667
|
+
function trustAnchorRepo() {
|
|
6668
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6669
|
+
if (fromRunner)
|
|
6670
|
+
return fromRunner;
|
|
6512
6671
|
try {
|
|
6513
6672
|
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6514
6673
|
encoding: "utf-8",
|
|
6515
6674
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6516
|
-
})
|
|
6517
|
-
|
|
6518
|
-
return m?.[1] && m[2] ? wellFormed(`${m[1]}/${m[2]}`) : null;
|
|
6675
|
+
});
|
|
6676
|
+
return trustAnchorRepoFromRemoteUrl(url);
|
|
6519
6677
|
} catch {
|
|
6520
6678
|
return null;
|
|
6521
6679
|
}
|
|
6522
6680
|
}
|
|
6681
|
+
async function trustAnchorRepoAsync() {
|
|
6682
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6683
|
+
if (fromRunner)
|
|
6684
|
+
return fromRunner;
|
|
6685
|
+
try {
|
|
6686
|
+
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6687
|
+
encoding: "utf-8",
|
|
6688
|
+
timeout: 1e4
|
|
6689
|
+
});
|
|
6690
|
+
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6691
|
+
} catch {
|
|
6692
|
+
return null;
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
function wellFormedRepoSlug(slug) {
|
|
6696
|
+
return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
6697
|
+
}
|
|
6698
|
+
function trustAnchorRepoFromRunner() {
|
|
6699
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
6700
|
+
return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
|
|
6701
|
+
}
|
|
6702
|
+
function trustAnchorRepoFromRemoteUrl(url) {
|
|
6703
|
+
const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
6704
|
+
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6705
|
+
}
|
|
6706
|
+
var execFileAsync4 = promisify4(execFile4);
|
|
6707
|
+
function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
6708
|
+
const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
|
|
6709
|
+
if (!ref)
|
|
6710
|
+
return null;
|
|
6711
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
6712
|
+
return null;
|
|
6713
|
+
if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
|
|
6714
|
+
return null;
|
|
6715
|
+
return ref;
|
|
6716
|
+
}
|
|
6717
|
+
function readTrustAnchorConfigAtRef(ref) {
|
|
6718
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6719
|
+
encoding: "utf-8",
|
|
6720
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6721
|
+
timeout: 1e4
|
|
6722
|
+
});
|
|
6723
|
+
return Buffer.from(raw, "utf-8").toString("base64");
|
|
6724
|
+
}
|
|
6523
6725
|
function ghFetchTrustAnchorConfig() {
|
|
6726
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6727
|
+
if (probeRef)
|
|
6728
|
+
return readTrustAnchorConfigAtRef(probeRef);
|
|
6524
6729
|
const repo = trustAnchorRepo();
|
|
6525
6730
|
if (!repo)
|
|
6526
6731
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
@@ -6529,6 +6734,21 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6529
6734
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6530
6735
|
});
|
|
6531
6736
|
}
|
|
6737
|
+
async function ghFetchTrustAnchorConfigAsync() {
|
|
6738
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6739
|
+
if (probeRef) {
|
|
6740
|
+
const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6741
|
+
encoding: "utf-8",
|
|
6742
|
+
timeout: 1e4
|
|
6743
|
+
});
|
|
6744
|
+
return Buffer.from(stdout, "utf-8").toString("base64");
|
|
6745
|
+
}
|
|
6746
|
+
const repo = await trustAnchorRepoAsync();
|
|
6747
|
+
if (!repo)
|
|
6748
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6749
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6750
|
+
return stdout;
|
|
6751
|
+
}
|
|
6532
6752
|
function firstLine(err) {
|
|
6533
6753
|
return err?.message?.split(`
|
|
6534
6754
|
`)[0] ?? "unknown error";
|
|
@@ -6543,16 +6763,35 @@ function isMissingFileError(err) {
|
|
|
6543
6763
|
return /\b404\b|not found/i.test(haystack);
|
|
6544
6764
|
}
|
|
6545
6765
|
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
6546
|
-
const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6547
|
-
`);
|
|
6548
6766
|
let base64;
|
|
6549
6767
|
try {
|
|
6550
|
-
base64 = fetcher()
|
|
6768
|
+
base64 = fetcher();
|
|
6551
6769
|
} catch (err) {
|
|
6552
|
-
|
|
6553
|
-
warn(firstLine(err));
|
|
6554
|
-
return null;
|
|
6770
|
+
return trustAnchorFetchFailed(err);
|
|
6555
6771
|
}
|
|
6772
|
+
return parseTrustAnchorContent(base64);
|
|
6773
|
+
}
|
|
6774
|
+
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
6775
|
+
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
6776
|
+
let base64;
|
|
6777
|
+
try {
|
|
6778
|
+
base64 = await fetcher();
|
|
6779
|
+
} catch (err) {
|
|
6780
|
+
return trustAnchorFetchFailed(err, warn);
|
|
6781
|
+
}
|
|
6782
|
+
return parseTrustAnchorContent(base64, warn);
|
|
6783
|
+
}
|
|
6784
|
+
function warnTrustAnchorFallback(why) {
|
|
6785
|
+
process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6786
|
+
`);
|
|
6787
|
+
}
|
|
6788
|
+
function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
6789
|
+
if (!isMissingFileError(err))
|
|
6790
|
+
warn(firstLine(err));
|
|
6791
|
+
return null;
|
|
6792
|
+
}
|
|
6793
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
6794
|
+
const base64 = content.trim();
|
|
6556
6795
|
if (!base64)
|
|
6557
6796
|
return null;
|
|
6558
6797
|
try {
|
|
@@ -6582,6 +6821,8 @@ var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.j
|
|
|
6582
6821
|
|
|
6583
6822
|
// src/lib/brief-assembly.ts
|
|
6584
6823
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
6824
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync } from "node:fs";
|
|
6825
|
+
import { join as join3 } from "node:path";
|
|
6585
6826
|
|
|
6586
6827
|
// ../../packages/sources/src/commands.ts
|
|
6587
6828
|
var COMMANDS = [
|
|
@@ -6734,10 +6975,10 @@ var COMMANDS = [
|
|
|
6734
6975
|
}
|
|
6735
6976
|
],
|
|
6736
6977
|
details: [
|
|
6737
|
-
"Composes `task brief`'s own preparation (`prepareTask`) with `dev-review-loop`
|
|
6978
|
+
"Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
6738
6979
|
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
6739
|
-
"Refuses when the frozen brief's developer branch already has an open pull request —
|
|
6740
|
-
"Exit and printed summary distinguish a published
|
|
6980
|
+
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
6981
|
+
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the exact `vinaya task run <tranche> <n>` command to continue by hand), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
6741
6982
|
],
|
|
6742
6983
|
status: "shipped"
|
|
6743
6984
|
},
|
|
@@ -6776,7 +7017,7 @@ var COMMANDS = [
|
|
|
6776
7017
|
details: [
|
|
6777
7018
|
"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.",
|
|
6778
7019
|
"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.",
|
|
6779
|
-
"`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."
|
|
7020
|
+
"`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."
|
|
6780
7021
|
],
|
|
6781
7022
|
status: "shipped"
|
|
6782
7023
|
},
|
|
@@ -6906,48 +7147,6 @@ var COMMANDS = [
|
|
|
6906
7147
|
],
|
|
6907
7148
|
status: "shipped"
|
|
6908
7149
|
},
|
|
6909
|
-
{
|
|
6910
|
-
name: "log flush",
|
|
6911
|
-
description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
|
|
6912
|
-
flags: [
|
|
6913
|
-
{ flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
|
|
6914
|
-
{
|
|
6915
|
-
flag: "--pr",
|
|
6916
|
-
description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
|
|
6917
|
-
},
|
|
6918
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6919
|
-
],
|
|
6920
|
-
details: [
|
|
6921
|
-
"Exactly one of `--issue`/`--pr` is required. `--pr` resolves the Issue from the PR body's `Closes #N` line — the same anchor every gate reads — and refuses with a check error naming the missing line when the body carries none.",
|
|
6922
|
-
"Splits the outbox first at `run_id` boundaries (a maximal run of consecutive lines sharing one `run_id`, never a global group-by, so an interleaved outbox never produces a range spanning a gap), then at `FORGE_COMMENT_MAX_CHARS` (65536) within each run. Each comment opens with `<!-- aeg:log:<run_id>:<seq_from>-<seq_to> -->` on its own line, then one fenced `ndjson` block, one outbox line per line, verbatim. A single line too large to fit alone is refused by name, never split across two comments.",
|
|
6923
|
-
"Logs its own `forge_write` line — `validated` before posting, `written` (with every returned comment id) after the last post succeeds, or `refused` (with gh's error) on any failure — through the same `log()` every other family uses, into the same outbox, before truncating. The outbox is truncated only to the lines confirmed posted; a failed chunk's lines, and anything appended to the outbox during the flush (including the flush's own `validated`/`written`/`refused` line), always survive to ride the next flush."
|
|
6924
|
-
],
|
|
6925
|
-
status: "shipped"
|
|
6926
|
-
},
|
|
6927
|
-
{
|
|
6928
|
-
name: "log export-artifact",
|
|
6929
|
-
description: "Copy this run's own local outbox into a file, for the generated task-path workflow's own upload step",
|
|
6930
|
-
flags: [],
|
|
6931
|
-
details: [
|
|
6932
|
-
"Concatenates every `*.ndjson` file under `~/.vinaya/outbox/` into `<dest>`, verbatim — no filtering, no second redaction pass (lines are already redacted at `log()`'s own write boundary). Writes nothing when the outbox is empty, and exits 0 either way: no gate events this run is a legitimate outcome, never a failure.",
|
|
6933
|
-
"Runs inside the generated `vinaya-checks.yml` job, which holds no forge-write credential — this command never calls the forge. Both this step and the `actions/upload-artifact` step after it run `if: always()`, so a cancelled or failed job still exports whatever partial outbox it has."
|
|
6934
|
-
],
|
|
6935
|
-
status: "shipped"
|
|
6936
|
-
},
|
|
6937
|
-
{
|
|
6938
|
-
name: "log collect-artifact",
|
|
6939
|
-
description: "Validate a downloaded task-log artifact and publish the valid records through the existing flush path",
|
|
6940
|
-
flags: [
|
|
6941
|
-
{ flag: "--pr", description: "The pull request this artifact belongs to" },
|
|
6942
|
-
{ flag: "--repo", description: "Expected `owner/repo` — a provenance cross-check against each record" }
|
|
6943
|
-
],
|
|
6944
|
-
details: [
|
|
6945
|
-
"Runs inside the generated `vinaya-task-log-collector.yml` workflow — a `workflow_run`-triggered job on the default branch, holding the write credential the task-path job that produced the artifact never gets. `<path>` is already downloaded by that workflow, scoped to a specific, API-verified run id — a provenance guarantee this command never re-derives from the artifact bytes.",
|
|
6946
|
-
"Never executes, imports, or evaluates the artifact's content: every line is read as text and validated (schema, an 8 MiB whole-artifact size cap, redaction, and a repo cross-check) before anything is trusted. A rejected line becomes a named gap — printed, never a silent drop — and the artifact is never partially trusted past that check into executing anything.",
|
|
6947
|
-
"The valid, re-redacted survivors are appended into the same local outbox `vinaya log flush` would read for that PR's Issue, then published through the existing `flushOutbox` unmodified — reusing its chunking, its `<!-- aeg:log:… -->` marker, and its idempotent-retry read, rather than a second publisher. A retried collector run (a fresh runner, the same forge state) therefore dedupes for free: the marker already on the forge is acknowledged, never re-posted."
|
|
6948
|
-
],
|
|
6949
|
-
status: "shipped"
|
|
6950
|
-
},
|
|
6951
7150
|
{
|
|
6952
7151
|
name: "milestone create",
|
|
6953
7152
|
description: "Create a GitHub Milestone from a validated body",
|
|
@@ -7277,7 +7476,7 @@ var COMMANDS = [
|
|
|
7277
7476
|
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
7278
7477
|
{
|
|
7279
7478
|
flag: "--pr",
|
|
7280
|
-
description: "
|
|
7479
|
+
description: "This dispatch's pull request number, for attribution — mutually exclusive with `--task`"
|
|
7281
7480
|
},
|
|
7282
7481
|
{ flag: "--round", description: "Round number, for a dispatch inside a review loop" },
|
|
7283
7482
|
{
|
|
@@ -7289,7 +7488,7 @@ var COMMANDS = [
|
|
|
7289
7488
|
details: [
|
|
7290
7489
|
"Sets `VINAYA_RUN_ID`/`VINAYA_ROLE`/`VINAYA_TASK`/`VINAYA_ROUND` on the child only — never on this process's own environment — and refuses by name, before any spawn attempt, when the named vendor binary is absent from `PATH` or present but not executable.",
|
|
7291
7490
|
"Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, or `refused`) through the Vinaya Log's one `dispatch` family writer, `dispatchRole`. A wall-time ceiling (`dispatch.timeoutMs` in config, default one hour) sends `SIGTERM` then, after a grace window, `SIGKILL`.",
|
|
7292
|
-
"
|
|
7491
|
+
"Runs no flush of its own after the dispatch returns: every log line `dispatchRole` emits reaches its configured `logs` destination live, as it is emitted, so there is nothing left to ship in a trailing step. `--task`/`--pr` are attribution only, and remain mutually exclusive.",
|
|
7293
7492
|
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude/gemini: `session_id`; codex: `thread_id`), parsed from its stdout, `null` on any failure. Passing that value as `--resume <id>` on a later call swaps in that vendor's own resume invocation (`claude -p -r <id> ...`; `codex exec resume <id> ...`; `gemini ... --resume <id> ...`) in place of its first-dispatch args."
|
|
7294
7493
|
],
|
|
7295
7494
|
status: "shipped"
|
|
@@ -7309,7 +7508,8 @@ var COMMANDS = [
|
|
|
7309
7508
|
"Dispatches the developer through `dispatchRole` with the brief read from the Issue, waits for the PR it opens, then runs `assessRound` (`@attalabs/aeg-core`) — the entire policy — against observations this command reads from the forge: the head via `git ls-remote` only (never `gh pr view headRefOid`, which can lag a push), CI conclusion via the check-runs API (never run locally), and ruling comments matching `<!-- aeg:principal:ruling:<pr>-<k> -->`.",
|
|
7310
7509
|
"Nothing is posted to the PR before the policy decides `publish`: each round's reviewer and security verdicts are dispatched fresh (never a resumed session) through `dispatchRole`, rendered through `review post`'s own render functions, and written to a local file under the outbox — never `gh pr comment`/`gh pr review`. Posting the held verdicts is a separate, later task.",
|
|
7311
7510
|
"The developer's session is resumed every round via `dispatchRole`'s `resumeId` — never a fresh session — for every vendor; a round whose resume fails for a vendor that resumed successfully the round before stops the loop rather than silently falling back to a fresh developer session.",
|
|
7312
|
-
"Every dispatch and round transition is a log line through the Vinaya Log,
|
|
7511
|
+
"Every dispatch and round transition is a log line through the Vinaya Log, delivered live to its configured `logs` destination as it is emitted — never a tracker comment.",
|
|
7512
|
+
"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)."
|
|
7313
7513
|
],
|
|
7314
7514
|
status: "shipped"
|
|
7315
7515
|
}
|
|
@@ -7446,25 +7646,6 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
7446
7646
|
};
|
|
7447
7647
|
}
|
|
7448
7648
|
|
|
7449
|
-
// src/lib/brief-assembly.ts
|
|
7450
|
-
function git(args) {
|
|
7451
|
-
try {
|
|
7452
|
-
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7453
|
-
} catch {
|
|
7454
|
-
return "";
|
|
7455
|
-
}
|
|
7456
|
-
}
|
|
7457
|
-
function expandGlob(glob) {
|
|
7458
|
-
const out = git(["ls-files", "--", glob]);
|
|
7459
|
-
return out.split(`
|
|
7460
|
-
`).map((s) => s.trim()).filter(Boolean);
|
|
7461
|
-
}
|
|
7462
|
-
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7463
|
-
|
|
7464
|
-
// src/checks/registry.ts
|
|
7465
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
7466
|
-
import { join as join3 } from "node:path";
|
|
7467
|
-
|
|
7468
7649
|
// src/lib/package-root.ts
|
|
7469
7650
|
import { existsSync as existsSync2 } from "node:fs";
|
|
7470
7651
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
@@ -7482,13 +7663,33 @@ function packageRoot(moduleUrl) {
|
|
|
7482
7663
|
return dir;
|
|
7483
7664
|
}
|
|
7484
7665
|
|
|
7666
|
+
// src/lib/brief-assembly.ts
|
|
7667
|
+
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7668
|
+
var PACKAGED_TEMPLATE_PATH = join3(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7669
|
+
var TEMPLATE_PATH = existsSync3(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join3(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7670
|
+
function git(args) {
|
|
7671
|
+
try {
|
|
7672
|
+
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7673
|
+
} catch {
|
|
7674
|
+
return "";
|
|
7675
|
+
}
|
|
7676
|
+
}
|
|
7677
|
+
function expandGlob(glob) {
|
|
7678
|
+
const out = git(["ls-files", "--", glob]);
|
|
7679
|
+
return out.split(`
|
|
7680
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
7681
|
+
}
|
|
7682
|
+
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7683
|
+
|
|
7485
7684
|
// src/checks/registry.ts
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
var
|
|
7685
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
7686
|
+
import { join as join4 } from "node:path";
|
|
7687
|
+
var DIST_BIN_DIR = join4(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7688
|
+
var SRC_BIN_DIR = join4(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7689
|
+
var BIN_DIR = existsSync4(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7489
7690
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7490
7691
|
function bin(name) {
|
|
7491
|
-
return
|
|
7692
|
+
return join4(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7492
7693
|
}
|
|
7493
7694
|
var REGISTRY = [
|
|
7494
7695
|
[
|
|
@@ -7900,6 +8101,16 @@ var REGISTRY = [
|
|
|
7900
8101
|
},
|
|
7901
8102
|
0
|
|
7902
8103
|
],
|
|
8104
|
+
[
|
|
8105
|
+
{
|
|
8106
|
+
name: "ci-shard-coverage",
|
|
8107
|
+
run: bin("check-ci-shard-coverage"),
|
|
8108
|
+
scope: "diff",
|
|
8109
|
+
timeoutMs: 15000,
|
|
8110
|
+
env: {}
|
|
8111
|
+
},
|
|
8112
|
+
0
|
|
8113
|
+
],
|
|
7903
8114
|
[
|
|
7904
8115
|
{
|
|
7905
8116
|
name: "workspace-escape",
|
|
@@ -8037,42 +8248,541 @@ function coreCheckRegistry() {
|
|
|
8037
8248
|
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
8038
8249
|
|
|
8039
8250
|
// src/lib/log-sink.ts
|
|
8040
|
-
import {
|
|
8041
|
-
import { randomUUID } from "node:crypto";
|
|
8251
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
8252
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8253
|
+
import {
|
|
8254
|
+
closeSync as closeSync3,
|
|
8255
|
+
constants as fsConstants3,
|
|
8256
|
+
existsSync as existsSync6,
|
|
8257
|
+
fstatSync as fstatSync2,
|
|
8258
|
+
mkdirSync as mkdirSync3,
|
|
8259
|
+
openSync as openSync3,
|
|
8260
|
+
readFileSync as readFileSync5,
|
|
8261
|
+
renameSync as renameSync2,
|
|
8262
|
+
writeSync as writeSync2
|
|
8263
|
+
} from "node:fs";
|
|
8264
|
+
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8265
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8266
|
+
import { promisify as promisify5 } from "node:util";
|
|
8267
|
+
|
|
8268
|
+
// src/lib/run-paths.ts
|
|
8269
|
+
import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
8270
|
+
import { dirname as dirname3, join as join5, resolve as resolvePath } from "node:path";
|
|
8271
|
+
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8272
|
+
function isSafeRepoSegment(segment) {
|
|
8273
|
+
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
8274
|
+
}
|
|
8275
|
+
function repoSegment(repo) {
|
|
8276
|
+
if (!repo || !isSafeRepoSegment(repo.owner) || !isSafeRepoSegment(repo.repo))
|
|
8277
|
+
return "unresolved";
|
|
8278
|
+
return `${repo.owner}-${repo.repo}`;
|
|
8279
|
+
}
|
|
8280
|
+
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8281
|
+
return join5(home, "runtime", repoSegment(repo));
|
|
8282
|
+
}
|
|
8283
|
+
function resolveRuntimeDir(input) {
|
|
8284
|
+
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
8285
|
+
if (local === null)
|
|
8286
|
+
return defaultRuntimeDir(input.repo, input.home);
|
|
8287
|
+
if (isInsideRepo(local, input.repoRoot))
|
|
8288
|
+
return defaultRuntimeDir(input.repo, input.home);
|
|
8289
|
+
if (!input.unattended)
|
|
8290
|
+
return local;
|
|
8291
|
+
const anchored = resolveTrustAnchorRuntimeDir(local, input.trustAnchorConfig ?? null);
|
|
8292
|
+
return anchored ?? defaultRuntimeDir(input.repo, input.home);
|
|
8293
|
+
}
|
|
8294
|
+
function isInsideRepo(candidate, repoRoot) {
|
|
8295
|
+
if (!repoRoot)
|
|
8296
|
+
return false;
|
|
8297
|
+
const root = resolvePath(repoRoot);
|
|
8298
|
+
const target = resolvePath(candidate);
|
|
8299
|
+
return target === root || target.startsWith(`${root}/`);
|
|
8300
|
+
}
|
|
8301
|
+
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
8302
|
+
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
8303
|
+
function isUnattendedProcess(env = process.env) {
|
|
8304
|
+
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
8305
|
+
}
|
|
8306
|
+
var memoized = null;
|
|
8307
|
+
async function runtimeDirForRepoAsync(repo) {
|
|
8308
|
+
const key = repoSegment(repo);
|
|
8309
|
+
if (memoized?.key === key)
|
|
8310
|
+
return memoized.value;
|
|
8311
|
+
const inputs = runtimeDirInputs();
|
|
8312
|
+
if (typeof inputs === "string")
|
|
8313
|
+
return inputs;
|
|
8314
|
+
const value = resolveRuntimeDir({
|
|
8315
|
+
repo,
|
|
8316
|
+
...inputs.base,
|
|
8317
|
+
trustAnchorConfig: inputs.needsAnchor ? await loadTrustAnchorConfigAsync() : null
|
|
8318
|
+
});
|
|
8319
|
+
memoized = { key, value };
|
|
8320
|
+
return value;
|
|
8321
|
+
}
|
|
8322
|
+
function runtimeDirInputs() {
|
|
8323
|
+
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
8324
|
+
if (handedDown)
|
|
8325
|
+
return handedDown;
|
|
8326
|
+
const localConfig = loadConfig();
|
|
8327
|
+
const unattended = isUnattendedProcess();
|
|
8328
|
+
return {
|
|
8329
|
+
base: { localConfig, unattended, repoRoot: repoRootSync() },
|
|
8330
|
+
needsAnchor: unattended && resolveRuntimeDirSetting(localConfig) !== null
|
|
8331
|
+
};
|
|
8332
|
+
}
|
|
8333
|
+
function repoRootSync(start = process.cwd()) {
|
|
8334
|
+
let dir;
|
|
8335
|
+
try {
|
|
8336
|
+
dir = realpathSync2(start);
|
|
8337
|
+
} catch {
|
|
8338
|
+
return null;
|
|
8339
|
+
}
|
|
8340
|
+
for (;; ) {
|
|
8341
|
+
if (existsSync5(join5(dir, ".git")))
|
|
8342
|
+
return dir;
|
|
8343
|
+
const parent = dirname3(dir);
|
|
8344
|
+
if (parent === dir)
|
|
8345
|
+
return null;
|
|
8346
|
+
dir = parent;
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8349
|
+
|
|
8350
|
+
// src/lib/log-webhook-drain.ts
|
|
8042
8351
|
import {
|
|
8043
8352
|
closeSync as closeSync2,
|
|
8044
8353
|
constants as fsConstants2,
|
|
8045
|
-
|
|
8046
|
-
fstatSync as fstatSync2,
|
|
8354
|
+
lstatSync,
|
|
8047
8355
|
mkdirSync as mkdirSync2,
|
|
8048
8356
|
openSync as openSync2,
|
|
8049
|
-
|
|
8357
|
+
linkSync,
|
|
8358
|
+
readFileSync as readFileSync4,
|
|
8050
8359
|
renameSync,
|
|
8360
|
+
statSync,
|
|
8361
|
+
unlinkSync,
|
|
8362
|
+
utimesSync,
|
|
8363
|
+
writeFileSync as writeFileSync2,
|
|
8051
8364
|
writeSync
|
|
8052
8365
|
} from "node:fs";
|
|
8053
|
-
import {
|
|
8054
|
-
import {
|
|
8055
|
-
|
|
8366
|
+
import { randomUUID } from "node:crypto";
|
|
8367
|
+
import { homedir as homedir2 } from "node:os";
|
|
8368
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
8369
|
+
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8370
|
+
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8371
|
+
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8372
|
+
function isSafeRepoSegment2(segment) {
|
|
8373
|
+
return SAFE_PATH_SEGMENT2.test(segment) && !segment.includes("..");
|
|
8374
|
+
}
|
|
8375
|
+
function isErrnoCode(err, code) {
|
|
8376
|
+
return typeof err === "object" && err !== null && err.code === code;
|
|
8377
|
+
}
|
|
8056
8378
|
function isEnoent(err) {
|
|
8379
|
+
return isErrnoCode(err, "ENOENT");
|
|
8380
|
+
}
|
|
8381
|
+
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8382
|
+
function tryCreateLock(lockPath, token) {
|
|
8383
|
+
try {
|
|
8384
|
+
mkdirSync2(dirname4(lockPath), { recursive: true, mode: 448 });
|
|
8385
|
+
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8386
|
+
try {
|
|
8387
|
+
writeSync(fd, `${token}
|
|
8388
|
+
`);
|
|
8389
|
+
} finally {
|
|
8390
|
+
closeSync2(fd);
|
|
8391
|
+
}
|
|
8392
|
+
return true;
|
|
8393
|
+
} catch (err) {
|
|
8394
|
+
if (isErrnoCode(err, "EEXIST"))
|
|
8395
|
+
return false;
|
|
8396
|
+
throw err;
|
|
8397
|
+
}
|
|
8398
|
+
}
|
|
8399
|
+
function acquireDrainLock(lockPath) {
|
|
8400
|
+
const token = `${process.pid}:${randomUUID()}`;
|
|
8401
|
+
if (tryCreateLock(lockPath, token))
|
|
8402
|
+
return token;
|
|
8403
|
+
let observedMtimeMs;
|
|
8404
|
+
try {
|
|
8405
|
+
observedMtimeMs = statSync(lockPath).mtimeMs;
|
|
8406
|
+
} catch (err) {
|
|
8407
|
+
if (!isEnoent(err))
|
|
8408
|
+
throw err;
|
|
8409
|
+
return tryCreateLock(lockPath, token) ? token : null;
|
|
8410
|
+
}
|
|
8411
|
+
if (Date.now() - observedMtimeMs <= WEBHOOK_DRAIN_LOCK_STALE_MS)
|
|
8412
|
+
return null;
|
|
8413
|
+
const claimed = `${lockPath}.claimed-${randomUUID()}`;
|
|
8414
|
+
try {
|
|
8415
|
+
renameSync(lockPath, claimed);
|
|
8416
|
+
} catch (err) {
|
|
8417
|
+
if (isEnoent(err))
|
|
8418
|
+
return null;
|
|
8419
|
+
throw err;
|
|
8420
|
+
}
|
|
8421
|
+
let claimedMtimeMs = null;
|
|
8422
|
+
try {
|
|
8423
|
+
claimedMtimeMs = statSync(claimed).mtimeMs;
|
|
8424
|
+
} catch (err) {
|
|
8425
|
+
if (!isEnoent(err))
|
|
8426
|
+
throw err;
|
|
8427
|
+
}
|
|
8428
|
+
if (claimedMtimeMs !== observedMtimeMs) {
|
|
8429
|
+
try {
|
|
8430
|
+
linkSync(claimed, lockPath);
|
|
8431
|
+
} catch (err) {
|
|
8432
|
+
if (!isErrnoCode(err, "EEXIST"))
|
|
8433
|
+
throw err;
|
|
8434
|
+
}
|
|
8435
|
+
try {
|
|
8436
|
+
unlinkSync(claimed);
|
|
8437
|
+
} catch (err) {
|
|
8438
|
+
if (!isEnoent(err))
|
|
8439
|
+
throw err;
|
|
8440
|
+
}
|
|
8441
|
+
return null;
|
|
8442
|
+
}
|
|
8443
|
+
unlinkSync(claimed);
|
|
8444
|
+
return tryCreateLock(lockPath, token) ? token : null;
|
|
8445
|
+
}
|
|
8446
|
+
function renewDrainLock(lockPath, token) {
|
|
8447
|
+
let holder;
|
|
8448
|
+
try {
|
|
8449
|
+
holder = readFileSync4(lockPath, "utf8").trim();
|
|
8450
|
+
} catch (err) {
|
|
8451
|
+
if (!isEnoent(err))
|
|
8452
|
+
throw err;
|
|
8453
|
+
return false;
|
|
8454
|
+
}
|
|
8455
|
+
if (holder !== token)
|
|
8456
|
+
return false;
|
|
8457
|
+
const now = new Date;
|
|
8458
|
+
try {
|
|
8459
|
+
utimesSync(lockPath, now, now);
|
|
8460
|
+
} catch (err) {
|
|
8461
|
+
if (!isEnoent(err))
|
|
8462
|
+
throw err;
|
|
8463
|
+
return false;
|
|
8464
|
+
}
|
|
8465
|
+
return true;
|
|
8466
|
+
}
|
|
8467
|
+
function releaseDrainLock(lockPath, token) {
|
|
8468
|
+
try {
|
|
8469
|
+
const holder = readFileSync4(lockPath, "utf8").trim();
|
|
8470
|
+
if (holder !== token)
|
|
8471
|
+
return;
|
|
8472
|
+
unlinkSync(lockPath);
|
|
8473
|
+
} catch (err) {
|
|
8474
|
+
if (!isEnoent(err))
|
|
8475
|
+
throw err;
|
|
8476
|
+
}
|
|
8477
|
+
}
|
|
8478
|
+
|
|
8479
|
+
class WebhookDrainError extends Error {
|
|
8480
|
+
code;
|
|
8481
|
+
constructor(code, message) {
|
|
8482
|
+
super(message);
|
|
8483
|
+
this.code = code;
|
|
8484
|
+
}
|
|
8485
|
+
}
|
|
8486
|
+
function backupPathFor(queuePath) {
|
|
8487
|
+
return queuePath.replace(/\.ndjson$/, ".1.ndjson");
|
|
8488
|
+
}
|
|
8489
|
+
function drainingPathFor(queuePath) {
|
|
8490
|
+
return queuePath.replace(/\.ndjson$/, ".draining.ndjson");
|
|
8491
|
+
}
|
|
8492
|
+
function rejectedPathFor(queuePath) {
|
|
8493
|
+
return queuePath.replace(/\.ndjson$/, ".rejected.ndjson");
|
|
8494
|
+
}
|
|
8495
|
+
var rejectionWarnedThisProcess = false;
|
|
8496
|
+
function warnRejectionOnce(message) {
|
|
8497
|
+
if (rejectionWarnedThisProcess)
|
|
8498
|
+
return;
|
|
8499
|
+
rejectionWarnedThisProcess = true;
|
|
8500
|
+
try {
|
|
8501
|
+
process.stderr.write(message);
|
|
8502
|
+
} catch {}
|
|
8503
|
+
}
|
|
8504
|
+
function queueLines(buf) {
|
|
8505
|
+
const lines = [];
|
|
8506
|
+
let start = 0;
|
|
8507
|
+
for (let i = 0;i < buf.byteLength; i++) {
|
|
8508
|
+
if (buf[i] !== 10)
|
|
8509
|
+
continue;
|
|
8510
|
+
if (i > start)
|
|
8511
|
+
lines.push({ raw: buf.toString("utf8", start, i), end: i + 1 });
|
|
8512
|
+
start = i + 1;
|
|
8513
|
+
}
|
|
8514
|
+
if (start < buf.byteLength)
|
|
8515
|
+
lines.push({ raw: buf.toString("utf8", start), end: buf.byteLength });
|
|
8516
|
+
return lines;
|
|
8517
|
+
}
|
|
8518
|
+
function removeQueueHead(path, cut) {
|
|
8519
|
+
const remaining = readFileSync4(path);
|
|
8520
|
+
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8521
|
+
}
|
|
8522
|
+
function queueBucketSize(path) {
|
|
8523
|
+
let lstat;
|
|
8524
|
+
try {
|
|
8525
|
+
lstat = lstatSync(path);
|
|
8526
|
+
} catch (err) {
|
|
8527
|
+
if (!isEnoent(err))
|
|
8528
|
+
throw err;
|
|
8529
|
+
}
|
|
8530
|
+
if (lstat === undefined)
|
|
8531
|
+
return null;
|
|
8532
|
+
if (!lstat.isFile()) {
|
|
8533
|
+
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}`);
|
|
8534
|
+
}
|
|
8535
|
+
return Number(lstat.size);
|
|
8536
|
+
}
|
|
8537
|
+
function readQueueFile(path) {
|
|
8538
|
+
if (queueBucketSize(path) === null)
|
|
8539
|
+
return null;
|
|
8540
|
+
return readFileSync4(path);
|
|
8541
|
+
}
|
|
8542
|
+
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8543
|
+
const record = JSON.stringify({
|
|
8544
|
+
rejected_at: new Date().toISOString(),
|
|
8545
|
+
status,
|
|
8546
|
+
reason,
|
|
8547
|
+
identity,
|
|
8548
|
+
bytes: Buffer.byteLength(raw, "utf8"),
|
|
8549
|
+
raw
|
|
8550
|
+
});
|
|
8551
|
+
const failure = appendHardenedLine(rejectedPath, `${record}
|
|
8552
|
+
`);
|
|
8553
|
+
if (failure !== null) {
|
|
8554
|
+
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`);
|
|
8555
|
+
}
|
|
8556
|
+
warnRejectionOnce(`vinaya: log delivery set a queued line aside in ${rejectedPath} — ${reason}; later lines keep delivering
|
|
8557
|
+
`);
|
|
8558
|
+
}
|
|
8559
|
+
async function postChunk(webhookUrl, headers, body, fetchTimeoutMs, chunksAlreadyDelivered) {
|
|
8560
|
+
const delivered = chunksAlreadyDelivered > 0 ? ` after delivering ${chunksAlreadyDelivered} chunk(s)` : "";
|
|
8561
|
+
let response;
|
|
8562
|
+
try {
|
|
8563
|
+
response = await fetch(webhookUrl, {
|
|
8564
|
+
method: "POST",
|
|
8565
|
+
headers: { "content-type": "application/x-ndjson", ...headers },
|
|
8566
|
+
body,
|
|
8567
|
+
signal: AbortSignal.timeout(fetchTimeoutMs)
|
|
8568
|
+
});
|
|
8569
|
+
} catch (err) {
|
|
8570
|
+
const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
|
|
8571
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed${delivered}: ${reason}`);
|
|
8572
|
+
}
|
|
8573
|
+
if (!response.ok) {
|
|
8574
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}${delivered}`);
|
|
8575
|
+
}
|
|
8576
|
+
}
|
|
8577
|
+
async function drainQueueFile(args) {
|
|
8578
|
+
const { path, rejectedPath, webhookUrl, headers, fetchTimeoutMs, totals } = args;
|
|
8579
|
+
const buf = readQueueFile(path);
|
|
8580
|
+
if (buf === null || buf.byteLength === 0)
|
|
8581
|
+
return;
|
|
8582
|
+
const lines = queueLines(buf);
|
|
8583
|
+
if (lines.length === 0) {
|
|
8584
|
+
removeQueueHead(path, buf.byteLength);
|
|
8585
|
+
return;
|
|
8586
|
+
}
|
|
8587
|
+
let removed = 0;
|
|
8588
|
+
let pendingEnd = 0;
|
|
8589
|
+
let chunk = [];
|
|
8590
|
+
let chunkBytes = 0;
|
|
8591
|
+
const deliverChunk = async () => {
|
|
8592
|
+
const body = `${chunk.join(`
|
|
8593
|
+
`)}
|
|
8594
|
+
`;
|
|
8595
|
+
args.keepLock();
|
|
8596
|
+
await postChunk(webhookUrl, headers, body, fetchTimeoutMs, totals.chunks);
|
|
8597
|
+
totals.chunks += 1;
|
|
8598
|
+
totals.lineCount += chunk.length;
|
|
8599
|
+
totals.bytes += Buffer.byteLength(body, "utf8");
|
|
8600
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8601
|
+
removed = pendingEnd;
|
|
8602
|
+
chunk = [];
|
|
8603
|
+
chunkBytes = 0;
|
|
8604
|
+
};
|
|
8605
|
+
const setAside = async (reason, status, identity, line) => {
|
|
8606
|
+
if (chunk.length > 0)
|
|
8607
|
+
await deliverChunk();
|
|
8608
|
+
rejectLine(rejectedPath, reason, status, identity, line.raw);
|
|
8609
|
+
totals.rejected += 1;
|
|
8610
|
+
pendingEnd = line.end;
|
|
8611
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8612
|
+
removed = pendingEnd;
|
|
8613
|
+
};
|
|
8614
|
+
for (const line of lines) {
|
|
8615
|
+
const record = classifyStoredLine(line.raw, homedir2());
|
|
8616
|
+
if (record.status !== "ok") {
|
|
8617
|
+
await setAside(record.reason, record.status, record.identity, line);
|
|
8618
|
+
continue;
|
|
8619
|
+
}
|
|
8620
|
+
const lineBytes = Buffer.byteLength(record.postLine, "utf8") + 1;
|
|
8621
|
+
if (lineBytes > MAX_WEBHOOK_BODY_BYTES) {
|
|
8622
|
+
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);
|
|
8623
|
+
continue;
|
|
8624
|
+
}
|
|
8625
|
+
if (chunk.length > 0 && chunkBytes + lineBytes > MAX_WEBHOOK_BODY_BYTES)
|
|
8626
|
+
await deliverChunk();
|
|
8627
|
+
chunk.push(record.postLine);
|
|
8628
|
+
chunkBytes += lineBytes;
|
|
8629
|
+
pendingEnd = line.end;
|
|
8630
|
+
}
|
|
8631
|
+
pendingEnd = buf.byteLength;
|
|
8632
|
+
if (chunk.length > 0) {
|
|
8633
|
+
await deliverChunk();
|
|
8634
|
+
return;
|
|
8635
|
+
}
|
|
8636
|
+
if (pendingEnd > removed)
|
|
8637
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8638
|
+
}
|
|
8639
|
+
async function drainRenamedAside(args, livePath, source) {
|
|
8640
|
+
args.keepLock();
|
|
8641
|
+
const draining = drainingPathFor(livePath);
|
|
8642
|
+
try {
|
|
8643
|
+
renameSync(source, draining);
|
|
8644
|
+
} catch (err) {
|
|
8645
|
+
if (isEnoent(err))
|
|
8646
|
+
return;
|
|
8647
|
+
throw err;
|
|
8648
|
+
}
|
|
8649
|
+
await drainQueueFile({ ...args, path: draining });
|
|
8650
|
+
unlinkSync(draining);
|
|
8651
|
+
}
|
|
8652
|
+
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8653
|
+
const resolved = await resolveRepo();
|
|
8654
|
+
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8655
|
+
const outboxRoot = () => join6(GLOBAL_VINAYA_HOME, "outbox");
|
|
8656
|
+
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8657
|
+
const lockPath = `${path}.flush-lock`;
|
|
8658
|
+
const lockToken = acquireDrainLock(lockPath);
|
|
8659
|
+
const totals = { lineCount: 0, bytes: 0, chunks: 0, rejected: 0 };
|
|
8660
|
+
if (lockToken === null)
|
|
8661
|
+
return { flushed: false, ...totals };
|
|
8662
|
+
try {
|
|
8663
|
+
const keepLock = () => {
|
|
8664
|
+
if (renewDrainLock(lockPath, lockToken))
|
|
8665
|
+
return;
|
|
8666
|
+
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`);
|
|
8667
|
+
};
|
|
8668
|
+
const shared = {
|
|
8669
|
+
rejectedPath: rejectedPathFor(path),
|
|
8670
|
+
webhookUrl,
|
|
8671
|
+
headers,
|
|
8672
|
+
fetchTimeoutMs,
|
|
8673
|
+
totals,
|
|
8674
|
+
keepLock
|
|
8675
|
+
};
|
|
8676
|
+
const draining = drainingPathFor(path);
|
|
8677
|
+
if (queueBucketSize(draining) !== null) {
|
|
8678
|
+
keepLock();
|
|
8679
|
+
await drainQueueFile({ ...shared, path: draining });
|
|
8680
|
+
unlinkSync(draining);
|
|
8681
|
+
}
|
|
8682
|
+
await drainRenamedAside(shared, path, backupPathFor(path));
|
|
8683
|
+
await drainRenamedAside(shared, path, path);
|
|
8684
|
+
return { flushed: totals.chunks > 0 || totals.rejected > 0, ...totals };
|
|
8685
|
+
} finally {
|
|
8686
|
+
releaseDrainLock(lockPath, lockToken);
|
|
8687
|
+
}
|
|
8688
|
+
}
|
|
8689
|
+
|
|
8690
|
+
// src/lib/log-sink.ts
|
|
8691
|
+
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8692
|
+
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8693
|
+
function withDeadline(work, ms, fallback) {
|
|
8694
|
+
return new Promise((resolve) => {
|
|
8695
|
+
const timer = setTimeout(() => resolve(fallback), ms);
|
|
8696
|
+
timer.unref?.();
|
|
8697
|
+
work.then((value) => {
|
|
8698
|
+
clearTimeout(timer);
|
|
8699
|
+
resolve(value);
|
|
8700
|
+
}, () => {
|
|
8701
|
+
clearTimeout(timer);
|
|
8702
|
+
resolve(fallback);
|
|
8703
|
+
});
|
|
8704
|
+
});
|
|
8705
|
+
}
|
|
8706
|
+
async function safeLoadTrustAnchorConfig() {
|
|
8707
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
8708
|
+
}
|
|
8709
|
+
function logsCredentialMissing(headers, env) {
|
|
8710
|
+
if (!headers)
|
|
8711
|
+
return false;
|
|
8712
|
+
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8713
|
+
for (const value of Object.values(headers)) {
|
|
8714
|
+
for (const match of value.matchAll(varPattern)) {
|
|
8715
|
+
if (!env[match[1]])
|
|
8716
|
+
return true;
|
|
8717
|
+
}
|
|
8718
|
+
}
|
|
8719
|
+
return false;
|
|
8720
|
+
}
|
|
8721
|
+
function resolveLogDestinationFrom(input) {
|
|
8722
|
+
const local = resolveLogsSetting(input.localConfig);
|
|
8723
|
+
let effective = null;
|
|
8724
|
+
if (input.unattended) {
|
|
8725
|
+
effective = local ? resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig) : resolveLogsSetting(input.trustAnchorConfig);
|
|
8726
|
+
} else {
|
|
8727
|
+
effective = local;
|
|
8728
|
+
}
|
|
8729
|
+
if (hostFromEnv(input.env) === "ci") {
|
|
8730
|
+
if (effective && "url" in effective) {
|
|
8731
|
+
if (logsCredentialMissing(effective.headers, input.env)) {
|
|
8732
|
+
return {
|
|
8733
|
+
kind: "none",
|
|
8734
|
+
reason: "a logs.url server destination is configured, but this job holds no delivery credential (a fork pull request, or a missing repository secret)"
|
|
8735
|
+
};
|
|
8736
|
+
}
|
|
8737
|
+
return { kind: "server", url: effective.url, headers: resolveLogsHeaderValues(effective.headers, input.env) };
|
|
8738
|
+
}
|
|
8739
|
+
return {
|
|
8740
|
+
kind: "none",
|
|
8741
|
+
reason: "no server destination is configured for CI delivery (vinaya.config.json logs.url)"
|
|
8742
|
+
};
|
|
8743
|
+
}
|
|
8744
|
+
if (effective && "url" in effective) {
|
|
8745
|
+
return { kind: "server", url: effective.url, headers: resolveLogsHeaderValues(effective.headers, input.env) };
|
|
8746
|
+
}
|
|
8747
|
+
if (effective && "folder" in effective && isInsideRepo(effective.folder, input.repoRoot)) {
|
|
8748
|
+
effective = null;
|
|
8749
|
+
}
|
|
8750
|
+
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8751
|
+
return { kind: "folder", folder };
|
|
8752
|
+
}
|
|
8753
|
+
var processTrustAnchorOnce;
|
|
8754
|
+
function processTrustAnchor() {
|
|
8755
|
+
if (processTrustAnchorOnce === undefined)
|
|
8756
|
+
processTrustAnchorOnce = safeLoadTrustAnchorConfig();
|
|
8757
|
+
return processTrustAnchorOnce;
|
|
8758
|
+
}
|
|
8759
|
+
async function defaultResolveLogDestination(repo, env) {
|
|
8760
|
+
const localConfig = loadConfig();
|
|
8761
|
+
const unattended = isUnattendedProcess(process.env);
|
|
8762
|
+
return resolveLogDestinationFrom({
|
|
8763
|
+
localConfig,
|
|
8764
|
+
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8765
|
+
unattended,
|
|
8766
|
+
env,
|
|
8767
|
+
defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8768
|
+
repoRoot: repoRootSync()
|
|
8769
|
+
});
|
|
8770
|
+
}
|
|
8771
|
+
function isEnoent2(err) {
|
|
8057
8772
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
8058
8773
|
}
|
|
8059
|
-
|
|
8774
|
+
var execFileAsync5 = promisify5(execFile5);
|
|
8775
|
+
async function resolveDoctrine(cwd, vinayaVersion) {
|
|
8060
8776
|
let toplevel;
|
|
8061
8777
|
try {
|
|
8062
|
-
toplevel =
|
|
8063
|
-
encoding: "utf8",
|
|
8064
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
8065
|
-
}).trim();
|
|
8778
|
+
toplevel = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { encoding: "utf8" })).stdout.trim();
|
|
8066
8779
|
} catch (err) {
|
|
8067
|
-
return
|
|
8780
|
+
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8068
8781
|
}
|
|
8069
|
-
if (!
|
|
8782
|
+
if (!existsSync6(join7(toplevel, "aeg-root", "roles")))
|
|
8070
8783
|
return vinayaVersion;
|
|
8071
8784
|
try {
|
|
8072
|
-
const sha =
|
|
8073
|
-
encoding: "utf8",
|
|
8074
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
8075
|
-
}).trim();
|
|
8785
|
+
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
8076
8786
|
return `aeg-root@${sha}`;
|
|
8077
8787
|
} catch {
|
|
8078
8788
|
return vinayaVersion;
|
|
@@ -8080,20 +8790,20 @@ function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8080
8790
|
}
|
|
8081
8791
|
function readVinayaVersion() {
|
|
8082
8792
|
try {
|
|
8083
|
-
const pkg = JSON.parse(
|
|
8793
|
+
const pkg = JSON.parse(readFileSync5(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8084
8794
|
return pkg.version ?? "unknown";
|
|
8085
8795
|
} catch {
|
|
8086
8796
|
return "unknown";
|
|
8087
8797
|
}
|
|
8088
8798
|
}
|
|
8089
|
-
var
|
|
8090
|
-
function
|
|
8091
|
-
return
|
|
8799
|
+
var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8800
|
+
function isSafeRepoSegment3(segment) {
|
|
8801
|
+
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8092
8802
|
}
|
|
8093
8803
|
function outboxPathFor(deps, repo, issue) {
|
|
8094
8804
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8095
8805
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8096
|
-
return
|
|
8806
|
+
return join7(deps.outboxRoot(), dirName, fileName);
|
|
8097
8807
|
}
|
|
8098
8808
|
function hostFromEnv(env) {
|
|
8099
8809
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8104,36 +8814,60 @@ function hostFromEnv(env) {
|
|
|
8104
8814
|
return "loop";
|
|
8105
8815
|
return "cli";
|
|
8106
8816
|
}
|
|
8817
|
+
var warnedThisProcess = false;
|
|
8818
|
+
function defaultStderr(message) {
|
|
8819
|
+
if (warnedThisProcess)
|
|
8820
|
+
return;
|
|
8821
|
+
warnedThisProcess = true;
|
|
8822
|
+
process.stderr.write(message);
|
|
8823
|
+
}
|
|
8107
8824
|
function defaultDeps() {
|
|
8108
8825
|
return {
|
|
8109
|
-
outboxRoot: () =>
|
|
8110
|
-
home: () =>
|
|
8826
|
+
outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8827
|
+
home: () => homedir3(),
|
|
8111
8828
|
hostname: () => osHostname(),
|
|
8112
8829
|
cwd: () => process.cwd(),
|
|
8113
8830
|
now: () => new Date,
|
|
8114
8831
|
env: () => process.env,
|
|
8115
8832
|
resolveRepo: () => resolveRepo(),
|
|
8116
8833
|
vinayaVersion: () => readVinayaVersion(),
|
|
8117
|
-
stderr:
|
|
8118
|
-
process.stderr.write(message);
|
|
8119
|
-
},
|
|
8834
|
+
stderr: defaultStderr,
|
|
8120
8835
|
inputVersions: () => {
|
|
8121
8836
|
return;
|
|
8122
|
-
}
|
|
8837
|
+
},
|
|
8838
|
+
resolveLogDestination: defaultResolveLogDestination
|
|
8123
8839
|
};
|
|
8124
8840
|
}
|
|
8125
|
-
var APPEND_OPEN_FLAGS =
|
|
8841
|
+
var APPEND_OPEN_FLAGS = fsConstants3.O_WRONLY | fsConstants3.O_APPEND | fsConstants3.O_CREAT | fsConstants3.O_NOFOLLOW | fsConstants3.O_NONBLOCK;
|
|
8126
8842
|
function guardedAppendOpen(path) {
|
|
8127
8843
|
try {
|
|
8128
|
-
return
|
|
8844
|
+
return openSync3(path, APPEND_OPEN_FLAGS, 384);
|
|
8129
8845
|
} catch {
|
|
8130
8846
|
return;
|
|
8131
8847
|
}
|
|
8132
8848
|
}
|
|
8849
|
+
function appendHardenedLine(path, line) {
|
|
8850
|
+
try {
|
|
8851
|
+
mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
|
|
8852
|
+
const fd = guardedAppendOpen(path);
|
|
8853
|
+
if (fd === undefined)
|
|
8854
|
+
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
8855
|
+
try {
|
|
8856
|
+
if (!fstatSync2(fd).isFile())
|
|
8857
|
+
return `target is not a regular file: ${path}`;
|
|
8858
|
+
writeSync2(fd, line);
|
|
8859
|
+
} finally {
|
|
8860
|
+
closeSync3(fd);
|
|
8861
|
+
}
|
|
8862
|
+
return null;
|
|
8863
|
+
} catch (err) {
|
|
8864
|
+
return err instanceof Error ? err.message : String(err);
|
|
8865
|
+
}
|
|
8866
|
+
}
|
|
8133
8867
|
function reportRotationOverflow(backupPath, warn) {
|
|
8134
8868
|
let raw;
|
|
8135
8869
|
try {
|
|
8136
|
-
raw =
|
|
8870
|
+
raw = readFileSync5(backupPath, "utf8");
|
|
8137
8871
|
} catch {
|
|
8138
8872
|
return;
|
|
8139
8873
|
}
|
|
@@ -8156,7 +8890,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8156
8890
|
}
|
|
8157
8891
|
function appendLine(path, line, warn) {
|
|
8158
8892
|
try {
|
|
8159
|
-
|
|
8893
|
+
mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
|
|
8160
8894
|
let fd = guardedAppendOpen(path);
|
|
8161
8895
|
if (fd === undefined) {
|
|
8162
8896
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8172,11 +8906,11 @@ function appendLine(path, line, warn) {
|
|
|
8172
8906
|
return;
|
|
8173
8907
|
}
|
|
8174
8908
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
8175
|
-
|
|
8909
|
+
closeSync3(fd);
|
|
8176
8910
|
closed = true;
|
|
8177
8911
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
8178
8912
|
reportRotationOverflow(backupPath, warn);
|
|
8179
|
-
|
|
8913
|
+
renameSync2(path, backupPath);
|
|
8180
8914
|
const rotated = guardedAppendOpen(path);
|
|
8181
8915
|
if (rotated === undefined) {
|
|
8182
8916
|
warn(`vinaya: log outbox target could not be reopened after rotation — refusing: ${path}
|
|
@@ -8186,10 +8920,10 @@ function appendLine(path, line, warn) {
|
|
|
8186
8920
|
fd = rotated;
|
|
8187
8921
|
closed = false;
|
|
8188
8922
|
}
|
|
8189
|
-
|
|
8923
|
+
writeSync2(fd, line);
|
|
8190
8924
|
} finally {
|
|
8191
8925
|
if (!closed)
|
|
8192
|
-
|
|
8926
|
+
closeSync3(fd);
|
|
8193
8927
|
}
|
|
8194
8928
|
} catch (err) {
|
|
8195
8929
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -8198,8 +8932,8 @@ function appendLine(path, line, warn) {
|
|
|
8198
8932
|
}
|
|
8199
8933
|
function createLogSink(overrides = {}) {
|
|
8200
8934
|
const deps = { ...defaultDeps(), ...overrides };
|
|
8201
|
-
const runId = deps.env().VINAYA_RUN_ID ||
|
|
8202
|
-
const processId =
|
|
8935
|
+
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8936
|
+
const processId = randomUUID2();
|
|
8203
8937
|
let seq = 0;
|
|
8204
8938
|
let warned = false;
|
|
8205
8939
|
const warnOnce = (message) => {
|
|
@@ -8212,8 +8946,9 @@ function createLogSink(overrides = {}) {
|
|
|
8212
8946
|
};
|
|
8213
8947
|
let doctrineCache;
|
|
8214
8948
|
const doctrine = () => {
|
|
8215
|
-
if (doctrineCache === undefined)
|
|
8216
|
-
doctrineCache = resolveDoctrine(deps.cwd(), deps.vinayaVersion());
|
|
8949
|
+
if (doctrineCache === undefined) {
|
|
8950
|
+
doctrineCache = withDeadline(resolveDoctrine(deps.cwd(), deps.vinayaVersion()), LOG_CONTEXT_LOOKUP_DEADLINE_MS, deps.vinayaVersion());
|
|
8951
|
+
}
|
|
8217
8952
|
return doctrineCache;
|
|
8218
8953
|
};
|
|
8219
8954
|
let resolveRepoCache;
|
|
@@ -8222,6 +8957,30 @@ function createLogSink(overrides = {}) {
|
|
|
8222
8957
|
resolveRepoCache = deps.resolveRepo();
|
|
8223
8958
|
return resolveRepoCache;
|
|
8224
8959
|
};
|
|
8960
|
+
let contextCache;
|
|
8961
|
+
const context = () => {
|
|
8962
|
+
if (contextCache === undefined) {
|
|
8963
|
+
const env = deps.env();
|
|
8964
|
+
contextCache = Promise.all([
|
|
8965
|
+
withDeadline(resolveRepoOnce(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null),
|
|
8966
|
+
doctrine()
|
|
8967
|
+
]).then(async ([resolved, doctrineValue]) => {
|
|
8968
|
+
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
8969
|
+
return { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
8970
|
+
});
|
|
8971
|
+
}
|
|
8972
|
+
return contextCache;
|
|
8973
|
+
};
|
|
8974
|
+
let drainChain = Promise.resolve();
|
|
8975
|
+
const pendingWrites = new Set;
|
|
8976
|
+
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
8977
|
+
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
8978
|
+
return;
|
|
8979
|
+
}).catch((err) => {
|
|
8980
|
+
warnOnce(`vinaya: log delivery to ${url} failed — queued in the local outbox, retried on the next event: ${err instanceof Error ? err.message : String(err)}
|
|
8981
|
+
`);
|
|
8982
|
+
});
|
|
8983
|
+
};
|
|
8225
8984
|
function log(e) {
|
|
8226
8985
|
try {
|
|
8227
8986
|
const env = deps.env();
|
|
@@ -8236,22 +8995,26 @@ function createLogSink(overrides = {}) {
|
|
|
8236
8995
|
attempt: env.VINAYA_ATTEMPT,
|
|
8237
8996
|
parent: env.VINAYA_PARENT_EVENT
|
|
8238
8997
|
};
|
|
8239
|
-
|
|
8240
|
-
const repo = resolved && isSafeRepoSegment(resolved.owner) && isSafeRepoSegment(resolved.repo) ? resolved : null;
|
|
8998
|
+
const written = context().then(({ repo, doctrine: doctrineValue, destination: resolvedDestination }) => {
|
|
8241
8999
|
const header = buildHeader({
|
|
8242
9000
|
now,
|
|
8243
9001
|
runId,
|
|
8244
9002
|
seq: mySeq,
|
|
8245
9003
|
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
8246
9004
|
vinaya: deps.vinayaVersion(),
|
|
8247
|
-
doctrine:
|
|
9005
|
+
doctrine: doctrineValue,
|
|
8248
9006
|
host,
|
|
8249
9007
|
hostname: deps.hostname(),
|
|
8250
9008
|
env: envFields,
|
|
8251
|
-
eventId:
|
|
9009
|
+
eventId: randomUUID2(),
|
|
8252
9010
|
processId,
|
|
8253
9011
|
inputVersions: deps.inputVersions()
|
|
8254
9012
|
});
|
|
9013
|
+
if (resolvedDestination.kind === "none") {
|
|
9014
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9015
|
+
`);
|
|
9016
|
+
return;
|
|
9017
|
+
}
|
|
8255
9018
|
const full = { ...e, ...header };
|
|
8256
9019
|
const parsed = LogEventSchema.safeParse(full);
|
|
8257
9020
|
if (!parsed.success) {
|
|
@@ -8261,25 +9024,42 @@ function createLogSink(overrides = {}) {
|
|
|
8261
9024
|
}
|
|
8262
9025
|
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
8263
9026
|
`;
|
|
8264
|
-
|
|
9027
|
+
const destination = resolvedDestination;
|
|
9028
|
+
if (destination.kind === "server") {
|
|
9029
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
9030
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
9031
|
+
} else {
|
|
9032
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9033
|
+
}
|
|
8265
9034
|
}).catch((err) => {
|
|
8266
9035
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8267
9036
|
`);
|
|
8268
9037
|
});
|
|
9038
|
+
pendingWrites.add(written);
|
|
9039
|
+
written.finally(() => pendingWrites.delete(written));
|
|
8269
9040
|
} catch (err) {
|
|
8270
9041
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8271
9042
|
`);
|
|
8272
9043
|
}
|
|
8273
9044
|
}
|
|
8274
9045
|
const warmup = () => {
|
|
8275
|
-
doctrine();
|
|
8276
9046
|
const originalWarn = console.warn;
|
|
8277
9047
|
console.warn = () => {};
|
|
8278
9048
|
resolveRepoOnce().finally(() => {
|
|
8279
9049
|
console.warn = originalWarn;
|
|
8280
9050
|
});
|
|
9051
|
+
context().catch(() => {
|
|
9052
|
+
return;
|
|
9053
|
+
});
|
|
9054
|
+
};
|
|
9055
|
+
const drain = async () => {
|
|
9056
|
+
if (pendingWrites.size > 0)
|
|
9057
|
+
await Promise.allSettled(Array.from(pendingWrites));
|
|
9058
|
+
await drainChain.catch(() => {
|
|
9059
|
+
return;
|
|
9060
|
+
});
|
|
8281
9061
|
};
|
|
8282
|
-
return { log, runId, warmup };
|
|
9062
|
+
return { log, runId, warmup, drain };
|
|
8283
9063
|
}
|
|
8284
9064
|
var defaultSink = createLogSink();
|
|
8285
9065
|
|
|
@@ -8330,7 +9110,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
8330
9110
|
function fileDiffAgainst(ref, path) {
|
|
8331
9111
|
let out;
|
|
8332
9112
|
try {
|
|
8333
|
-
out =
|
|
9113
|
+
out = execFileSync5("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
8334
9114
|
encoding: "utf8",
|
|
8335
9115
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8336
9116
|
}).trim();
|
|
@@ -8341,7 +9121,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
8341
9121
|
}
|
|
8342
9122
|
function revParse(ref) {
|
|
8343
9123
|
try {
|
|
8344
|
-
return
|
|
9124
|
+
return execFileSync5("git", ["rev-parse", "--verify", ref], {
|
|
8345
9125
|
encoding: "utf8",
|
|
8346
9126
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8347
9127
|
}).trim();
|
|
@@ -8351,7 +9131,7 @@ function revParse(ref) {
|
|
|
8351
9131
|
}
|
|
8352
9132
|
function repoRoot() {
|
|
8353
9133
|
try {
|
|
8354
|
-
return
|
|
9134
|
+
return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
|
|
8355
9135
|
encoding: "utf8",
|
|
8356
9136
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8357
9137
|
}).trim();
|
|
@@ -8362,7 +9142,7 @@ function repoRoot() {
|
|
|
8362
9142
|
function changedFiles(base) {
|
|
8363
9143
|
let out;
|
|
8364
9144
|
try {
|
|
8365
|
-
out =
|
|
9145
|
+
out = execFileSync5("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
8366
9146
|
encoding: "utf8",
|
|
8367
9147
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8368
9148
|
}).trim();
|
|
@@ -8387,7 +9167,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
8387
9167
|
const relPaths = changedFiles(ref);
|
|
8388
9168
|
if (relPaths === null)
|
|
8389
9169
|
continue;
|
|
8390
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
9170
|
+
return { base: ref, root, files: relPaths.map((p) => join8(root, p)) };
|
|
8391
9171
|
}
|
|
8392
9172
|
return null;
|
|
8393
9173
|
}
|
|
@@ -8419,8 +9199,8 @@ function findingsInThisDiff(findings) {
|
|
|
8419
9199
|
}
|
|
8420
9200
|
|
|
8421
9201
|
// src/checks/changeset-coverage-logic.ts
|
|
8422
|
-
function stripTrailingSlash(
|
|
8423
|
-
return
|
|
9202
|
+
function stripTrailingSlash(entry) {
|
|
9203
|
+
return entry.endsWith("/") ? entry.slice(0, -1) : entry;
|
|
8424
9204
|
}
|
|
8425
9205
|
function escapeRegexChar(c) {
|
|
8426
9206
|
return /[.+^${}()|[\]\\]/.test(c) ? `\\${c}` : c;
|
|
@@ -8450,19 +9230,19 @@ function filesGlobToRegex(pattern) {
|
|
|
8450
9230
|
re += "$";
|
|
8451
9231
|
return new RegExp(re);
|
|
8452
9232
|
}
|
|
8453
|
-
function matchesFilesEntry(
|
|
8454
|
-
const clean = stripTrailingSlash(
|
|
9233
|
+
function matchesFilesEntry(entry, relPath) {
|
|
9234
|
+
const clean = stripTrailingSlash(entry);
|
|
8455
9235
|
if (!clean.includes("*")) {
|
|
8456
9236
|
return relPath === clean || relPath.startsWith(`${clean}/`);
|
|
8457
9237
|
}
|
|
8458
9238
|
return filesGlobToRegex(clean).test(relPath);
|
|
8459
9239
|
}
|
|
8460
9240
|
function isShippedRelPath(files, relPath) {
|
|
8461
|
-
const positive = files.filter((
|
|
8462
|
-
const negative = files.filter((
|
|
8463
|
-
if (!positive.some((
|
|
9241
|
+
const positive = files.filter((entry) => !entry.startsWith("!"));
|
|
9242
|
+
const negative = files.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
|
|
9243
|
+
if (!positive.some((entry) => matchesFilesEntry(entry, relPath)))
|
|
8464
9244
|
return false;
|
|
8465
|
-
return !negative.some((
|
|
9245
|
+
return !negative.some((entry) => matchesFilesEntry(entry, relPath));
|
|
8466
9246
|
}
|
|
8467
9247
|
function isShippedPath(member, repoRelativePath) {
|
|
8468
9248
|
const prefix = `${stripTrailingSlash(member.dir)}/`;
|
|
@@ -8473,13 +9253,13 @@ function isShippedPath(member, repoRelativePath) {
|
|
|
8473
9253
|
function isChangesetFile(repoRelativePath) {
|
|
8474
9254
|
return /^\.changeset\/(?!README\.md$).+\.md$/.test(repoRelativePath);
|
|
8475
9255
|
}
|
|
8476
|
-
function evaluateChangesetCoverage(fixedGroup,
|
|
9256
|
+
function evaluateChangesetCoverage(fixedGroup, changedFiles, isReleaseBranch) {
|
|
8477
9257
|
if (isReleaseBranch)
|
|
8478
9258
|
return { status: "pass" };
|
|
8479
|
-
const shippedPathsHit =
|
|
9259
|
+
const shippedPathsHit = changedFiles.filter((path) => fixedGroup.some((member) => isShippedPath(member, path)));
|
|
8480
9260
|
if (shippedPathsHit.length === 0)
|
|
8481
9261
|
return { status: "pass" };
|
|
8482
|
-
if (
|
|
9262
|
+
if (changedFiles.some(isChangesetFile))
|
|
8483
9263
|
return { status: "pass" };
|
|
8484
9264
|
return { status: "finding", shippedPathsHit };
|
|
8485
9265
|
}
|
|
@@ -8488,7 +9268,7 @@ function evaluateChangesetCoverage(fixedGroup, changedFiles2, isReleaseBranch) {
|
|
|
8488
9268
|
var CHECK_NAME = "changeset-coverage";
|
|
8489
9269
|
function git2(args) {
|
|
8490
9270
|
try {
|
|
8491
|
-
return
|
|
9271
|
+
return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
8492
9272
|
} catch {
|
|
8493
9273
|
return "";
|
|
8494
9274
|
}
|
|
@@ -8505,7 +9285,7 @@ function toPosix(p) {
|
|
|
8505
9285
|
}
|
|
8506
9286
|
function readPackageJson(path) {
|
|
8507
9287
|
try {
|
|
8508
|
-
const parsed = JSON.parse(
|
|
9288
|
+
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
8509
9289
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
8510
9290
|
} catch {
|
|
8511
9291
|
return null;
|
|
@@ -8518,7 +9298,7 @@ function workspacePatterns(pkg) {
|
|
|
8518
9298
|
}
|
|
8519
9299
|
function childDirs(absoluteDir) {
|
|
8520
9300
|
try {
|
|
8521
|
-
return
|
|
9301
|
+
return readdirSync2(absoluteDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "node_modules" && !e.name.startsWith(".")).map((e) => e.name);
|
|
8522
9302
|
} catch {
|
|
8523
9303
|
return [];
|
|
8524
9304
|
}
|
|
@@ -8526,18 +9306,18 @@ function childDirs(absoluteDir) {
|
|
|
8526
9306
|
function candidateMemberDirs(root, pattern) {
|
|
8527
9307
|
if (pattern.endsWith("/*")) {
|
|
8528
9308
|
const prefix = pattern.slice(0, -2);
|
|
8529
|
-
return childDirs(
|
|
9309
|
+
return childDirs(join9(root, prefix)).map((name) => `${prefix}/${name}`);
|
|
8530
9310
|
}
|
|
8531
9311
|
if (!pattern.includes("*"))
|
|
8532
9312
|
return [pattern];
|
|
8533
9313
|
return [];
|
|
8534
9314
|
}
|
|
8535
9315
|
function resolveWorkspaceMembers(root) {
|
|
8536
|
-
const rootPkg = readPackageJson(
|
|
9316
|
+
const rootPkg = readPackageJson(join9(root, "package.json"));
|
|
8537
9317
|
const members = new Map;
|
|
8538
9318
|
for (const pattern of workspacePatterns(rootPkg)) {
|
|
8539
9319
|
for (const dir of candidateMemberDirs(root, pattern)) {
|
|
8540
|
-
const pkg = readPackageJson(
|
|
9320
|
+
const pkg = readPackageJson(join9(root, dir, "package.json"));
|
|
8541
9321
|
const name = pkg?.name;
|
|
8542
9322
|
const files = pkg?.files;
|
|
8543
9323
|
if (typeof name !== "string" || !Array.isArray(files))
|
|
@@ -8548,7 +9328,7 @@ function resolveWorkspaceMembers(root) {
|
|
|
8548
9328
|
return members;
|
|
8549
9329
|
}
|
|
8550
9330
|
function fixedGroupNames(root) {
|
|
8551
|
-
const pkg = readPackageJson(
|
|
9331
|
+
const pkg = readPackageJson(join9(root, ".changeset", "config.json"));
|
|
8552
9332
|
const fixed = pkg?.fixed;
|
|
8553
9333
|
if (!Array.isArray(fixed))
|
|
8554
9334
|
return [];
|
|
@@ -8575,7 +9355,7 @@ function main() {
|
|
|
8575
9355
|
if (changedAbs.length === 0) {
|
|
8576
9356
|
process.exit(0);
|
|
8577
9357
|
}
|
|
8578
|
-
const
|
|
9358
|
+
const changedFiles = changedAbs.map((p) => toPosix(relative2(root, p)));
|
|
8579
9359
|
const branch = git2(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
8580
9360
|
const isReleaseBranch = branch === CHANGESET_RELEASE_BRANCH;
|
|
8581
9361
|
const workspaceMembers = resolveWorkspaceMembers(root);
|
|
@@ -8583,7 +9363,7 @@ function main() {
|
|
|
8583
9363
|
const member = workspaceMembers.get(name);
|
|
8584
9364
|
return member ? { name, dir: member.dir, files: member.files } : null;
|
|
8585
9365
|
}).filter((m) => m !== null);
|
|
8586
|
-
const result = evaluateChangesetCoverage(fixedGroup,
|
|
9366
|
+
const result = evaluateChangesetCoverage(fixedGroup, changedFiles, isReleaseBranch);
|
|
8587
9367
|
console.log(`${CHECK_NAME}: ${fixedGroup.length} fixed-group member(s) resolved; ${result.status === "finding" ? result.shippedPathsHit.length : 0} shipped path(s) hit`);
|
|
8588
9368
|
if (result.status === "finding") {
|
|
8589
9369
|
emitCheckError({
|