@attalabs/vinaya 0.35.0 → 0.37.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 +6 -6
- package/aeg-root/contracts/developer-reviewer.md +1 -1
- package/aeg-root/contracts/planner-operator.md +1 -1
- package/aeg-root/contracts/principal-operator.md +6 -6
- package/aeg-root/contracts/security-archivist.md +1 -1
- package/aeg-root/enforcement.md +9 -10
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +13 -16
- package/aeg-root/roles/developer.md +7 -3
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +23 -8
- package/aeg-root/roles/planner.md +2 -0
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +11 -3
- package/aeg-root/roles/security.md +19 -9
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +11 -10
- package/aeg-root/templates/brief-template.md +10 -4
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +4 -4
- package/dist/checks/bin/check-body-bare-digits.js +2081 -1883
- package/dist/checks/bin/check-branch-topology.js +1376 -1139
- package/dist/checks/bin/check-brief-shape.js +2081 -1883
- package/dist/checks/bin/check-changeset-coverage.js +2564 -2025
- package/dist/checks/bin/check-closes-n.js +1376 -1139
- package/dist/checks/bin/check-coherence.js +1480 -1228
- package/dist/checks/bin/check-dead-branch-push.js +1339 -1156
- package/dist/checks/bin/check-dispatch-readiness.js +1480 -1228
- package/dist/checks/bin/check-doc-coverage-push.js +2563 -2024
- package/dist/checks/bin/check-doc-coverage.js +2565 -2026
- package/dist/checks/bin/check-doctrine-no-procedures.js +2081 -1883
- package/dist/checks/bin/check-doctrine-portability.js +2563 -2024
- package/dist/checks/bin/check-evidence-fresh.js +1906 -1536
- package/dist/checks/bin/check-exec-bits.js +2136 -1597
- package/dist/checks/bin/check-first-push-dispatch.js +1480 -1228
- package/dist/checks/bin/check-issue-assignment.js +1376 -1139
- package/dist/checks/bin/check-issue-milestone-attach.js +1339 -1156
- package/dist/checks/bin/check-issue-objectives-numbering.js +2081 -1883
- package/dist/checks/bin/check-issue-parts-coverage.js +1339 -1156
- package/dist/checks/bin/check-issue-surface-globs.js +1488 -1227
- package/dist/checks/bin/check-issue-title-grammar.js +1339 -1156
- package/dist/checks/bin/check-issue-tranche-label.js +1339 -1156
- package/dist/checks/bin/check-main-branch-refusal.js +1342 -1159
- package/dist/checks/bin/check-no-disk-state.js +1342 -1159
- package/dist/checks/bin/check-pr-premise-reassert.js +2081 -1883
- package/dist/checks/bin/check-pr-report-density.js +1342 -1159
- package/dist/checks/bin/check-principal-test-plan-wait.js +1342 -1159
- package/dist/checks/bin/check-quoted-command.js +4063 -3526
- package/dist/checks/bin/check-reader-resolvable-prose.js +4082 -3533
- package/dist/checks/bin/check-registry-gates.js +1363 -1167
- package/dist/checks/bin/check-retired-vocabulary.js +4057 -3520
- package/dist/checks/bin/check-review-gate.js +2081 -1883
- package/dist/checks/bin/check-single-plan-pr.js +1339 -1156
- package/dist/checks/bin/check-surface-scope.js +1376 -1139
- package/dist/checks/bin/check-test-plan.js +1339 -1156
- package/dist/checks/bin/check-token-collection-wired.js +1342 -1159
- package/dist/checks/bin/check-token-report.js +1409 -1342
- package/dist/checks/bin/check-workspace-escape.js +2562 -2023
- package/dist/index.js +14171 -6490
- package/dist/lib/pre-push-cache-test-run.js +1044 -641
- package/dist/lib/pre-push-select-tests.js +641 -444
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +257 -10
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +2 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +69 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +139 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +27 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +757 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -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/required-server-files.json +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
- 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 +1 -1
- 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/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +5 -5
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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/app-paths-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
- 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]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.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]__10riywf._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0zc_0gx._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
- 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]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
- 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/_1o4v6lb._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
- 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/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
- 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/09fcolor69bun.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vtfb0g813gki.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3ip5z3cf43bgo.js → 3l56x8wjdzvaw.js} +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3goaig_rysc6p.js → 3qtt1v3ya-ofe.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
- package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3u9emqjwpd0t9.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-exec-bits.ts
|
|
4
|
-
import { execFileSync as
|
|
5
|
-
import { readFileSync as
|
|
4
|
+
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
5
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
6
6
|
|
|
7
7
|
// src/checks/contract.ts
|
|
8
8
|
var CHECK_SCHEMA_VERSION = 1;
|
|
@@ -12,8 +12,8 @@ function emitCheckError(error) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// src/lib/diff-evidence.ts
|
|
15
|
-
import { execFileSync as
|
|
16
|
-
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
15
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
16
|
+
import { join as join9, relative as relative2, resolve as resolve2 } from "node:path";
|
|
17
17
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
18
18
|
var GATE_AUDIENCE = {
|
|
19
19
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1897,45 +1897,6 @@ var DERIVED_STATUSES = [
|
|
|
1897
1897
|
"incoherent"
|
|
1898
1898
|
];
|
|
1899
1899
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1900
|
-
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1901
|
-
function rowFromCells(cells) {
|
|
1902
|
-
if (cells.length < 7)
|
|
1903
|
-
return null;
|
|
1904
|
-
const phase = (cells[0] ?? "").trim();
|
|
1905
|
-
if (!phase)
|
|
1906
|
-
return null;
|
|
1907
|
-
return {
|
|
1908
|
-
phase,
|
|
1909
|
-
role: (cells[1] ?? "").trim(),
|
|
1910
|
-
agentModel: (cells[2] ?? "").trim(),
|
|
1911
|
-
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1912
|
-
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1913
|
-
cost: parseCostCell(cells[5] ?? ""),
|
|
1914
|
-
date: (cells[6] ?? "").trim()
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
function parseIntCell(cell) {
|
|
1918
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1919
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1920
|
-
return null;
|
|
1921
|
-
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1922
|
-
if (!/^-?\d+$/.test(normalized))
|
|
1923
|
-
return null;
|
|
1924
|
-
return Number(normalized);
|
|
1925
|
-
}
|
|
1926
|
-
function parseCostCell(cell) {
|
|
1927
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1928
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1929
|
-
return null;
|
|
1930
|
-
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1931
|
-
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1932
|
-
return null;
|
|
1933
|
-
return Number(normalized);
|
|
1934
|
-
}
|
|
1935
|
-
function isEmDashOrDash(s) {
|
|
1936
|
-
const t = s.trim();
|
|
1937
|
-
return t === "—" || t === "-" || t === "–";
|
|
1938
|
-
}
|
|
1939
1900
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1940
1901
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1941
1902
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1951,61 +1912,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1951
1912
|
return false;
|
|
1952
1913
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1953
1914
|
}
|
|
1954
|
-
|
|
1955
|
-
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1956
|
-
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1957
|
-
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1958
|
-
function parseTokenReportEntries(body) {
|
|
1959
|
-
const lines = body.split(/\r?\n/);
|
|
1960
|
-
const headingIdxs = [];
|
|
1961
|
-
lines.forEach((line, i) => {
|
|
1962
|
-
if (TOKEN_REPORT_HEADING.test(line))
|
|
1963
|
-
headingIdxs.push(i);
|
|
1964
|
-
});
|
|
1965
|
-
const out = [];
|
|
1966
|
-
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1967
|
-
const start = headingIdxs[h] + 1;
|
|
1968
|
-
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1969
|
-
const section = lines.slice(start, end).join(`
|
|
1970
|
-
`);
|
|
1971
|
-
const tableRows = parseTableSection(section);
|
|
1972
|
-
if (tableRows.length > 0) {
|
|
1973
|
-
out.push(...tableRows);
|
|
1974
|
-
continue;
|
|
1975
|
-
}
|
|
1976
|
-
const inlineRow = parseInlineFieldList(section);
|
|
1977
|
-
if (inlineRow)
|
|
1978
|
-
out.push(inlineRow);
|
|
1979
|
-
}
|
|
1980
|
-
return out;
|
|
1981
|
-
}
|
|
1982
|
-
function parseTableSection(section) {
|
|
1983
|
-
const lines = section.split(/\r?\n/);
|
|
1984
|
-
let i = 0;
|
|
1985
|
-
for (;i < lines.length; i++) {
|
|
1986
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1987
|
-
break;
|
|
1988
|
-
}
|
|
1989
|
-
if (i + 1 >= lines.length)
|
|
1990
|
-
return [];
|
|
1991
|
-
i += 2;
|
|
1992
|
-
const out = [];
|
|
1993
|
-
for (;i < lines.length; i++) {
|
|
1994
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
1995
|
-
if (!trimmed.startsWith("|"))
|
|
1996
|
-
break;
|
|
1997
|
-
const row = rowFromCells(splitTableRow(trimmed));
|
|
1998
|
-
if (row)
|
|
1999
|
-
out.push(row);
|
|
2000
|
-
}
|
|
2001
|
-
return out;
|
|
2002
|
-
}
|
|
2003
|
-
function parseInlineFieldList(section) {
|
|
2004
|
-
const m = section.match(INLINE_FIELD_LIST);
|
|
2005
|
-
if (!m)
|
|
2006
|
-
return null;
|
|
2007
|
-
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
2008
|
-
}
|
|
2009
1915
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2010
1916
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2011
1917
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2454,10 +2360,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2454
2360
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2455
2361
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2456
2362
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2363
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2457
2364
|
var DEFAULT_REVIEW_POLICY = {
|
|
2458
2365
|
codeReviewThreshold: "BLOCKER",
|
|
2459
2366
|
securityThreshold: "HIGH",
|
|
2460
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2367
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2368
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2461
2369
|
};
|
|
2462
2370
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2463
2371
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2477,16 +2385,42 @@ function blockingSeverities(scale, threshold) {
|
|
|
2477
2385
|
}
|
|
2478
2386
|
return scale.slice(0, idx + 1);
|
|
2479
2387
|
}
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
}
|
|
2489
|
-
|
|
2388
|
+
var DEFERRAL_REASON_TEXT = {
|
|
2389
|
+
"unchanged-line": "unchanged line",
|
|
2390
|
+
"outside-surface": "outside the Surface"
|
|
2391
|
+
};
|
|
2392
|
+
var SECURITY_HIGH_AND_ABOVE = blockingSeverities(SECURITY_SEVERITY_ORDER, "HIGH");
|
|
2393
|
+
function classifyFinding(finding, scale, threshold, context = {}) {
|
|
2394
|
+
if (!scale.includes(finding.severity)) {
|
|
2395
|
+
throw new Error(`classifyFinding: severity "${finding.severity}" is not one of ${scale.join(" > ")}`);
|
|
2396
|
+
}
|
|
2397
|
+
const location = finding.location;
|
|
2398
|
+
const effectiveSeverity = location !== undefined && isProseLocation(location) ? PROSE_CAP_SEVERITY : finding.severity;
|
|
2399
|
+
const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
|
|
2400
|
+
if (!wouldBlock)
|
|
2401
|
+
return { outcome: "non_blocking", deferralReason: null };
|
|
2402
|
+
const hasLocation = location !== undefined && location.length > 0;
|
|
2403
|
+
if (hasLocation && context.inSurface && !context.inSurface(location)) {
|
|
2404
|
+
return { outcome: "deferred", deferralReason: "outside-surface" };
|
|
2405
|
+
}
|
|
2406
|
+
if (hasLocation && context.changedLine && !SECURITY_HIGH_AND_ABOVE.includes(effectiveSeverity)) {
|
|
2407
|
+
if (!context.changedLine(location)) {
|
|
2408
|
+
return { outcome: "deferred", deferralReason: "unchanged-line" };
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
return { outcome: "blocking", deferralReason: null };
|
|
2412
|
+
}
|
|
2413
|
+
function evaluateReviewFindings(findings, scale, threshold, context = {}) {
|
|
2414
|
+
const blockingFindings = [];
|
|
2415
|
+
const deferredFindings = [];
|
|
2416
|
+
for (const f of findings) {
|
|
2417
|
+
const c = classifyFinding(f, scale, threshold, context);
|
|
2418
|
+
if (c.outcome === "blocking")
|
|
2419
|
+
blockingFindings.push(f);
|
|
2420
|
+
else if (c.outcome === "deferred")
|
|
2421
|
+
deferredFindings.push({ finding: f, reason: c.deferralReason });
|
|
2422
|
+
}
|
|
2423
|
+
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings, deferredFindings };
|
|
2490
2424
|
}
|
|
2491
2425
|
function isConsequentialFinding(finding) {
|
|
2492
2426
|
return finding.state !== "resolved";
|
|
@@ -2494,11 +2428,11 @@ function isConsequentialFinding(finding) {
|
|
|
2494
2428
|
function consequentialFindings(findings) {
|
|
2495
2429
|
return findings.filter((f) => isConsequentialFinding(f));
|
|
2496
2430
|
}
|
|
2497
|
-
function evaluateCodeReview(findings, policy) {
|
|
2498
|
-
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2431
|
+
function evaluateCodeReview(findings, policy, context = {}) {
|
|
2432
|
+
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold, context);
|
|
2499
2433
|
}
|
|
2500
|
-
function evaluateSecurityReview(findings, policy) {
|
|
2501
|
-
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold);
|
|
2434
|
+
function evaluateSecurityReview(findings, policy, context = {}) {
|
|
2435
|
+
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold, context);
|
|
2502
2436
|
}
|
|
2503
2437
|
function isKnownSeverity(scale, value) {
|
|
2504
2438
|
return scale.includes(value);
|
|
@@ -2832,11 +2766,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2832
2766
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2833
2767
|
}
|
|
2834
2768
|
function checkWorktreeStep0(prBody) {
|
|
2835
|
-
if (/git worktree add/.test(prBody))
|
|
2769
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2836
2770
|
return { status: "pass", errors: [] };
|
|
2837
2771
|
return {
|
|
2838
2772
|
status: "fail",
|
|
2839
|
-
errors: [
|
|
2773
|
+
errors: [
|
|
2774
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2775
|
+
]
|
|
2840
2776
|
};
|
|
2841
2777
|
}
|
|
2842
2778
|
function checkStopConditions(prBody) {
|
|
@@ -3026,7 +2962,8 @@ function isCommandBlock(content) {
|
|
|
3026
2962
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3027
2963
|
}
|
|
3028
2964
|
function isStep0Block(content) {
|
|
3029
|
-
|
|
2965
|
+
const first = firstNonBlankLine(content);
|
|
2966
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3030
2967
|
}
|
|
3031
2968
|
function checkCommandsCarryOutput(prBody) {
|
|
3032
2969
|
const errors = [];
|
|
@@ -3412,357 +3349,809 @@ function checkPrReportDensity(prBody) {
|
|
|
3412
3349
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3413
3350
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3414
3351
|
}
|
|
3415
|
-
// ../../packages/aeg-core/src/
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
{ name: "Sizing", pattern: "Sizing" },
|
|
3423
|
-
{ name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
|
|
3424
|
-
{ name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
|
|
3425
|
-
{ name: "Traps to avoid", pattern: "Traps" },
|
|
3426
|
-
{ name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
|
|
3427
|
-
{ name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
|
|
3428
|
-
{ name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
|
|
3352
|
+
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3353
|
+
var PRODUCT_SLUG_SCOPE = [
|
|
3354
|
+
"apps/cli/src",
|
|
3355
|
+
".github/workflows",
|
|
3356
|
+
".vinaya",
|
|
3357
|
+
"apps/cli/README.md",
|
|
3358
|
+
"packages/sources/README.md"
|
|
3429
3359
|
];
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
const errors = [];
|
|
3433
|
-
for (const f of RATIONALE_FIELDS) {
|
|
3434
|
-
if (!hasRationaleField(body, f.pattern)) {
|
|
3435
|
-
errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
|
|
3436
|
-
continue;
|
|
3437
|
-
}
|
|
3438
|
-
if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
|
|
3439
|
-
errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
|
|
3440
|
-
}
|
|
3441
|
-
}
|
|
3442
|
-
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3443
|
-
}
|
|
3444
|
-
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3445
|
-
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3446
|
-
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3447
|
-
return { status: "pass", errors: [] };
|
|
3448
|
-
const result = objectivesOf(body);
|
|
3449
|
-
if (result.ok)
|
|
3450
|
-
return { status: "pass", errors: [] };
|
|
3451
|
-
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
3360
|
+
function isUnderOrEqual(path, prefix) {
|
|
3361
|
+
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3452
3362
|
}
|
|
3453
|
-
function
|
|
3454
|
-
|
|
3455
|
-
const heading = headingRe.exec(body);
|
|
3456
|
-
if (!heading)
|
|
3457
|
-
return null;
|
|
3458
|
-
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3459
|
-
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3460
|
-
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3363
|
+
function isProductScopeFile(path) {
|
|
3364
|
+
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
3461
3365
|
}
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
const start = text.indexOf("`", i);
|
|
3466
|
-
if (start === -1)
|
|
3467
|
-
return false;
|
|
3468
|
-
const end = text.indexOf("`", start + 1);
|
|
3469
|
-
if (end === -1)
|
|
3470
|
-
return false;
|
|
3471
|
-
if (text.slice(start + 1, end).includes("/"))
|
|
3472
|
-
return true;
|
|
3473
|
-
i = end + 1;
|
|
3474
|
-
}
|
|
3475
|
-
return false;
|
|
3366
|
+
var SHIPS_PREFIX = "aeg-root/";
|
|
3367
|
+
function shipsArchivePrefix(shipsPrefix) {
|
|
3368
|
+
return `${shipsPrefix}tranches/completed/`;
|
|
3476
3369
|
}
|
|
3477
|
-
var
|
|
3478
|
-
function
|
|
3479
|
-
|
|
3370
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3371
|
+
function normalizeSpecPath(entry) {
|
|
3372
|
+
let out = entry.replace(/\\/g, "/");
|
|
3373
|
+
while (out.startsWith("./"))
|
|
3374
|
+
out = out.slice(2);
|
|
3375
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3376
|
+
while (out.endsWith("/"))
|
|
3377
|
+
out = out.slice(0, -1);
|
|
3378
|
+
return out;
|
|
3480
3379
|
}
|
|
3481
|
-
function
|
|
3482
|
-
|
|
3380
|
+
function isSpecFile2(path, specPaths) {
|
|
3381
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
3382
|
+
return true;
|
|
3383
|
+
if (!path.endsWith(".md"))
|
|
3384
|
+
return false;
|
|
3385
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
3483
3386
|
}
|
|
3484
|
-
function
|
|
3485
|
-
|
|
3486
|
-
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3487
|
-
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3488
|
-
return extMatch !== null && extMatch.index > 0;
|
|
3387
|
+
function isClaudeMdFile(path) {
|
|
3388
|
+
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3489
3389
|
}
|
|
3490
|
-
function
|
|
3491
|
-
|
|
3390
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
3391
|
+
if (path.startsWith(shipsPrefix)) {
|
|
3392
|
+
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3393
|
+
}
|
|
3394
|
+
if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
|
|
3395
|
+
return "reader-facing";
|
|
3396
|
+
}
|
|
3397
|
+
if (isClaudeMdFile(path))
|
|
3398
|
+
return "internal";
|
|
3399
|
+
if (isSpecFile2(path, specPaths))
|
|
3400
|
+
return "spec";
|
|
3401
|
+
if (isProductScopeFile(path))
|
|
3402
|
+
return "product";
|
|
3403
|
+
return null;
|
|
3492
3404
|
}
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
if (
|
|
3496
|
-
return
|
|
3497
|
-
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3498
|
-
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3499
|
-
const errors = [];
|
|
3500
|
-
if (!inLine)
|
|
3501
|
-
errors.push("`## Surface` has no `in:` line.");
|
|
3502
|
-
if (!outLine)
|
|
3503
|
-
errors.push("`## Surface` has no `out:` line.");
|
|
3504
|
-
if (errors.length > 0)
|
|
3505
|
-
return { ok: false, errors };
|
|
3506
|
-
const inGlobs = splitGlobList(inLine[1]);
|
|
3507
|
-
const outGlobs = splitGlobList(outLine[1]);
|
|
3508
|
-
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3509
|
-
if (looksLikeFilePath(g)) {
|
|
3510
|
-
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3511
|
-
}
|
|
3405
|
+
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3406
|
+
function stripNonProse(path, content) {
|
|
3407
|
+
if (path.endsWith(".md")) {
|
|
3408
|
+
return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
|
|
3512
3409
|
}
|
|
3513
|
-
if (
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
3410
|
+
if (path.endsWith(".tsx") || path.endsWith(".ts")) {
|
|
3411
|
+
return content.replace(/\/\*.*?\*\//gs, (m) => m.replace(/[^\n]/g, "")).replace(/(^|[^:])\/\/[^\n]*/g, (m) => m.replace(/[^\n]/g, ""));
|
|
3412
|
+
}
|
|
3413
|
+
return content;
|
|
3518
3414
|
}
|
|
3519
|
-
function
|
|
3520
|
-
|
|
3521
|
-
const p = path.replace(/\/+$/, "");
|
|
3522
|
-
if (g === "*")
|
|
3523
|
-
return !p.includes("/");
|
|
3524
|
-
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3415
|
+
function stripNonProseForProduct(path, content) {
|
|
3416
|
+
return path.endsWith(".md") ? stripNonProse(path, content) : content;
|
|
3525
3417
|
}
|
|
3526
|
-
function
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
for (const glob of surface.value.in) {
|
|
3532
|
-
if (!resolvesToFile(glob)) {
|
|
3533
|
-
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3534
|
-
}
|
|
3418
|
+
function lineAt(content, index) {
|
|
3419
|
+
let line = 1;
|
|
3420
|
+
for (let i = 0;i < index; i++) {
|
|
3421
|
+
if (content.charCodeAt(i) === 10)
|
|
3422
|
+
line++;
|
|
3535
3423
|
}
|
|
3536
|
-
return
|
|
3424
|
+
return line;
|
|
3537
3425
|
}
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
}
|
|
3547
|
-
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3426
|
+
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
3427
|
+
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
3428
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
3429
|
+
function legacySlugPattern(legacySlugs) {
|
|
3430
|
+
if (legacySlugs.length === 0)
|
|
3431
|
+
return null;
|
|
3432
|
+
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3433
|
+
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3548
3434
|
}
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
const
|
|
3555
|
-
const
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3435
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3436
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3437
|
+
}
|
|
3438
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3439
|
+
const findings = [];
|
|
3440
|
+
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3441
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3442
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3443
|
+
const patterns = [
|
|
3444
|
+
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3445
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3446
|
+
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3447
|
+
];
|
|
3448
|
+
const productPatterns = [
|
|
3449
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3450
|
+
];
|
|
3451
|
+
const specPatterns = [
|
|
3452
|
+
...patterns,
|
|
3453
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3454
|
+
];
|
|
3455
|
+
for (const file of files) {
|
|
3456
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3457
|
+
if (!cls || cls === "internal")
|
|
3568
3458
|
continue;
|
|
3569
|
-
|
|
3570
|
-
if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
3571
|
-
errors.push(`Part ${n} is little more than a file path — a Part names an outcome and symbols, never a bare path.`);
|
|
3459
|
+
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3572
3460
|
continue;
|
|
3461
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3462
|
+
continue;
|
|
3463
|
+
const blocking = cls === "product" || cls === "spec";
|
|
3464
|
+
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3465
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3466
|
+
const fileFindings = [];
|
|
3467
|
+
for (const { pattern, what, group } of patternsToRun) {
|
|
3468
|
+
pattern.lastIndex = 0;
|
|
3469
|
+
let match = pattern.exec(scrubbed);
|
|
3470
|
+
while (match !== null) {
|
|
3471
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3472
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3473
|
+
fileFindings.push({
|
|
3474
|
+
file: file.path,
|
|
3475
|
+
line: lineAt(scrubbed, citedIndex),
|
|
3476
|
+
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3477
|
+
blocking
|
|
3478
|
+
});
|
|
3479
|
+
match = pattern.exec(scrubbed);
|
|
3480
|
+
}
|
|
3573
3481
|
}
|
|
3574
|
-
const
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
if (errors.length > 0)
|
|
3581
|
-
return { ok: false, errors };
|
|
3582
|
-
return { ok: true, value: parts };
|
|
3583
|
-
}
|
|
3584
|
-
function checkPartsCiteDefinedObjectives(body) {
|
|
3585
|
-
const parts = parseIssueParts(body);
|
|
3586
|
-
const objectives = objectivesOf(body);
|
|
3587
|
-
if (!parts.ok || !objectives.ok)
|
|
3588
|
-
return { status: "pass", errors: [] };
|
|
3589
|
-
const definedIds = new Set(objectives.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
3590
|
-
const errors = [];
|
|
3591
|
-
for (const part of parts.value) {
|
|
3592
|
-
for (const objectiveId of part.objectiveIds) {
|
|
3593
|
-
if (!definedIds.has(objectiveId)) {
|
|
3594
|
-
errors.push(`issue-validation Parts: Part ${part.n} cites O${objectiveId}, which the Issue's own \`## Objectives\` section does not define.`);
|
|
3482
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3483
|
+
if (limit !== undefined) {
|
|
3484
|
+
if (fileFindings.length <= limit)
|
|
3485
|
+
continue;
|
|
3486
|
+
for (const f of fileFindings) {
|
|
3487
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3595
3488
|
}
|
|
3596
3489
|
}
|
|
3490
|
+
findings.push(...fileFindings);
|
|
3597
3491
|
}
|
|
3598
|
-
return
|
|
3599
|
-
}
|
|
3600
|
-
function isTaskIssueLabelSet(labels) {
|
|
3601
|
-
return hasLabel("tranche", labels);
|
|
3602
|
-
}
|
|
3603
|
-
function checkTrancheLabelPresence(_body, _labels) {
|
|
3604
|
-
return { status: "pass", errors: [] };
|
|
3605
|
-
}
|
|
3606
|
-
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
3607
|
-
if (!isTaskIssueLabelSet(labels))
|
|
3608
|
-
return { status: "pass", errors: [] };
|
|
3609
|
-
if (resolvedMilestoneTitle === null)
|
|
3610
|
-
return { status: "pass", errors: [] };
|
|
3611
|
-
if (currentMilestoneTitle === resolvedMilestoneTitle)
|
|
3612
|
-
return { status: "pass", errors: [] };
|
|
3613
|
-
return {
|
|
3614
|
-
status: "fail",
|
|
3615
|
-
errors: [
|
|
3616
|
-
`issue-validation milestone attach: this task Issue's tranche label resolves to Milestone "${resolvedMilestoneTitle}", but its live Milestone is ${currentMilestoneTitle === null ? "unset" : `"${currentMilestoneTitle}"`} — attach it to "${resolvedMilestoneTitle}".`
|
|
3617
|
-
]
|
|
3618
|
-
};
|
|
3619
|
-
}
|
|
3620
|
-
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
3621
|
-
function isControlCodePoint(codePoint) {
|
|
3622
|
-
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
3623
|
-
}
|
|
3624
|
-
function isDisplayControlCodePoint(codePoint) {
|
|
3625
|
-
return codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
3492
|
+
return findings;
|
|
3626
3493
|
}
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
const shown = values.slice(0, MESSAGE_VALUE_COUNT_MAX).map((v) => `\`${forMessage(v)}\``);
|
|
3630
|
-
const rest = values.length - shown.length;
|
|
3631
|
-
return rest > 0 ? `${shown.join(", ")} and ${rest} more` : shown.join(", ");
|
|
3494
|
+
function escapeTerm(term) {
|
|
3495
|
+
return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3632
3496
|
}
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
const
|
|
3636
|
-
|
|
3637
|
-
const codePoint = ch.codePointAt(0) ?? 0;
|
|
3638
|
-
if (isControlCodePoint(codePoint) || isDisplayControlCodePoint(codePoint))
|
|
3639
|
-
continue;
|
|
3640
|
-
kept.push(ch);
|
|
3641
|
-
}
|
|
3642
|
-
const cleaned = kept.join("").trim();
|
|
3643
|
-
if (cleaned.length === 0)
|
|
3644
|
-
return "(unprintable)";
|
|
3645
|
-
const points = Array.from(cleaned);
|
|
3646
|
-
return points.length > MESSAGE_VALUE_MAX ? `${points.slice(0, MESSAGE_VALUE_MAX).join("")}…` : cleaned;
|
|
3497
|
+
function containsWholeWord(text, term) {
|
|
3498
|
+
const escaped = escapeTerm(term);
|
|
3499
|
+
const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
|
|
3500
|
+
return re.test(text);
|
|
3647
3501
|
}
|
|
3648
|
-
function
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
const errors = [];
|
|
3657
|
-
if (field.unreadable) {
|
|
3658
|
-
return {
|
|
3659
|
-
status: "fail",
|
|
3660
|
-
errors: [
|
|
3661
|
-
`issue-validation project registry: the body has an unterminated code fence, so its \`**Project:**\` field could not be read reliably — the fence runs to end of body (CommonMark, and how the forge renders it), swallowing everything after it including the foot field where the declaration lives by convention. Read from the raw body the field says ${residueForMessage(field.unparsed) || "(nothing)"}, but a line inside a swallowed region may be a quoted example rather than a real declaration, so this gate refuses rather than guessing which. Balance the fences — every opening run of backticks or tildes needs a closing run at least as long — and the field reads normally.`
|
|
3662
|
-
]
|
|
3663
|
-
};
|
|
3664
|
-
}
|
|
3665
|
-
const unregistered = field.names.filter((p) => !known.has(p));
|
|
3666
|
-
if (unregistered.length > 0) {
|
|
3667
|
-
const caseHints = unregistered.map((p) => {
|
|
3668
|
-
const row = [...known].find((k) => k.toLowerCase() === p.toLowerCase());
|
|
3669
|
-
return row ? `\`${forMessage(p)}\` differs from the registered \`${forMessage(row)}\` only in case` : null;
|
|
3670
|
-
}).filter((h) => h !== null);
|
|
3671
|
-
errors.push(`issue-validation project registry: the \`**Project:**\` field declares ${unregistered.map(forMessage).join(", ")} — no such row in \`.vinaya/projects.md\`, which is the authority for valid project names (registered: ${registeredList}). Fix the name, or register the project with \`vinaya init product <name> --path <folder>\` first; an unregistered project has no specs to read and no per-project state to update.${caseHints.length > 0 ? ` Note: ${caseHints.join("; ")} — project names are matched exactly, because every downstream consumer compares them literally.` : ""} This reads the same field \`projectsFromBody\` derives the task's project from, so a name here that is not a row is a task that resolves to a project that does not exist.`);
|
|
3672
|
-
}
|
|
3673
|
-
if (field.names.length === 0) {
|
|
3674
|
-
const residue = field.unparsed.length > 0 ? ` — ${residueForMessage(field.unparsed)}` : " — the field is empty";
|
|
3675
|
-
errors.push(`issue-validation project registry: the \`**Project:**\` field is present but resolves to no project name${residue} (registered: ${registeredList}). A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); prose, a parenthetical, or a sentence in this field resolves to no project at all, and this gate cannot check a name it never receives — which is how a declaration like this used to pass. Write the registered name on its own, or register the project with \`vinaya init product <name> --path <folder>\` first. If the task genuinely touches no registered project, omit the field rather than explaining its absence inside it — \`checkIssueRationale\` already requires the \`Project(s) + blast radius\` narrative field for that.`);
|
|
3676
|
-
} else if (field.unparsed.length > 0) {
|
|
3677
|
-
errors.push(`issue-validation project registry: the \`**Project:**\` field declares a value that is not a project name — ${residueForMessage(field.unparsed)} (registered: ${registeredList}). The rest of the field parsed, so this is a name the gate silently could not check rather than a field it could not read at all. A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); write it on its own, or drop it if it names no project.`);
|
|
3502
|
+
function findWholeWordLine(content, term) {
|
|
3503
|
+
const lines = content.split(`
|
|
3504
|
+
`);
|
|
3505
|
+
let lineNo = 0;
|
|
3506
|
+
for (const line of lines) {
|
|
3507
|
+
lineNo++;
|
|
3508
|
+
if (containsWholeWord(line, term))
|
|
3509
|
+
return lineNo;
|
|
3678
3510
|
}
|
|
3679
|
-
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
3680
|
-
}
|
|
3681
|
-
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
3682
|
-
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
3683
|
-
|
|
3684
|
-
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
3685
|
-
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
3686
|
-
var TRANCHE_BRANCH_PATTERN = /^task\/([^/]+)\/([^/]+)$/;
|
|
3687
|
-
function parseTaskBranchIdentity(branch) {
|
|
3688
|
-
const issueMatch = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
3689
|
-
if (issueMatch)
|
|
3690
|
-
return { kind: "issue", issueNumber: Number(issueMatch[1]) };
|
|
3691
|
-
const trancheMatch = TRANCHE_BRANCH_PATTERN.exec(branch);
|
|
3692
|
-
if (trancheMatch)
|
|
3693
|
-
return { kind: "tranche", tranche: trancheMatch[1], taskId: trancheMatch[2] };
|
|
3694
3511
|
return null;
|
|
3695
3512
|
}
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
3513
|
+
function definesOrLinksGlossary(content, term) {
|
|
3514
|
+
const escaped = escapeTerm(term);
|
|
3515
|
+
const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
|
|
3516
|
+
if (definesInline)
|
|
3517
|
+
return true;
|
|
3518
|
+
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3703
3519
|
}
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
const
|
|
3707
|
-
|
|
3708
|
-
if (!
|
|
3709
|
-
continue;
|
|
3710
|
-
if (e.facts.stateReason === "not_planned")
|
|
3520
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
3521
|
+
const findings = [];
|
|
3522
|
+
for (const file of files) {
|
|
3523
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3524
|
+
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
3711
3525
|
continue;
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3526
|
+
const scrubbed = stripNonProse(file.path, file.content);
|
|
3527
|
+
for (const term of glossaryTerms) {
|
|
3528
|
+
const line = findWholeWordLine(scrubbed, term);
|
|
3529
|
+
if (line === null)
|
|
3715
3530
|
continue;
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
});
|
|
3724
|
-
}
|
|
3725
|
-
}
|
|
3726
|
-
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
3727
|
-
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
3728
|
-
return {
|
|
3729
|
-
check: "A1",
|
|
3730
|
-
status,
|
|
3731
|
-
failures,
|
|
3732
|
-
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
3733
|
-
};
|
|
3734
|
-
}
|
|
3735
|
-
function checkA3(entries) {
|
|
3736
|
-
const failures = [];
|
|
3737
|
-
for (const e of entries) {
|
|
3738
|
-
if (!e.facts)
|
|
3739
|
-
continue;
|
|
3740
|
-
if (e.facts.prState === "merged" && e.facts.issueState !== "closed") {
|
|
3741
|
-
failures.push({
|
|
3742
|
-
code: "auto-close-misfire",
|
|
3743
|
-
issue: e.task.issue,
|
|
3744
|
-
tranche: e.trancheSlug,
|
|
3745
|
-
task: e.task.id,
|
|
3746
|
-
reason: "Closing PR is merged but Issue is still open (GitHub auto-close misfire)",
|
|
3747
|
-
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
3531
|
+
if (definesOrLinksGlossary(scrubbed, term))
|
|
3532
|
+
continue;
|
|
3533
|
+
findings.push({
|
|
3534
|
+
file: file.path,
|
|
3535
|
+
line,
|
|
3536
|
+
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3537
|
+
blocking: false
|
|
3748
3538
|
});
|
|
3749
3539
|
}
|
|
3750
3540
|
}
|
|
3751
|
-
|
|
3752
|
-
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
3753
|
-
return {
|
|
3754
|
-
check: "A3",
|
|
3755
|
-
status,
|
|
3756
|
-
failures,
|
|
3757
|
-
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
3758
|
-
};
|
|
3541
|
+
return findings;
|
|
3759
3542
|
}
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3543
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
|
|
3544
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
|
|
3545
|
+
function extractComments(path, content) {
|
|
3546
|
+
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3547
|
+
return content.replace(/[^\n]/g, "");
|
|
3548
|
+
let state = "code";
|
|
3549
|
+
let out = "";
|
|
3550
|
+
const n = content.length;
|
|
3551
|
+
let i = 0;
|
|
3552
|
+
const blank = (ch) => ch === `
|
|
3553
|
+
` ? `
|
|
3554
|
+
` : " ";
|
|
3555
|
+
while (i < n) {
|
|
3556
|
+
const c = content[i];
|
|
3557
|
+
const next = i + 1 < n ? content[i + 1] : "";
|
|
3558
|
+
if (state === "code") {
|
|
3559
|
+
if (c === "/" && next === "/") {
|
|
3560
|
+
state = "line-comment";
|
|
3561
|
+
out += c;
|
|
3562
|
+
i++;
|
|
3563
|
+
continue;
|
|
3564
|
+
}
|
|
3565
|
+
if (c === "/" && next === "*") {
|
|
3566
|
+
state = "block-comment";
|
|
3567
|
+
out += c;
|
|
3568
|
+
i++;
|
|
3569
|
+
continue;
|
|
3570
|
+
}
|
|
3571
|
+
if (c === "'") {
|
|
3572
|
+
state = "single-quote";
|
|
3573
|
+
out += blank(c);
|
|
3574
|
+
i++;
|
|
3575
|
+
continue;
|
|
3576
|
+
}
|
|
3577
|
+
if (c === '"') {
|
|
3578
|
+
state = "double-quote";
|
|
3579
|
+
out += blank(c);
|
|
3580
|
+
i++;
|
|
3581
|
+
continue;
|
|
3582
|
+
}
|
|
3583
|
+
if (c === "`") {
|
|
3584
|
+
state = "template";
|
|
3585
|
+
out += blank(c);
|
|
3586
|
+
i++;
|
|
3587
|
+
continue;
|
|
3588
|
+
}
|
|
3589
|
+
out += blank(c);
|
|
3590
|
+
i++;
|
|
3591
|
+
continue;
|
|
3592
|
+
}
|
|
3593
|
+
if (state === "line-comment") {
|
|
3594
|
+
if (c === `
|
|
3595
|
+
`) {
|
|
3596
|
+
state = "code";
|
|
3597
|
+
out += `
|
|
3598
|
+
`;
|
|
3599
|
+
i++;
|
|
3600
|
+
continue;
|
|
3601
|
+
}
|
|
3602
|
+
out += c;
|
|
3603
|
+
i++;
|
|
3604
|
+
continue;
|
|
3605
|
+
}
|
|
3606
|
+
if (state === "block-comment") {
|
|
3607
|
+
if (c === "*" && next === "/") {
|
|
3608
|
+
out += c;
|
|
3609
|
+
out += next;
|
|
3610
|
+
state = "code";
|
|
3611
|
+
i += 2;
|
|
3612
|
+
continue;
|
|
3613
|
+
}
|
|
3614
|
+
out += c === `
|
|
3615
|
+
` ? `
|
|
3616
|
+
` : c;
|
|
3617
|
+
i++;
|
|
3618
|
+
continue;
|
|
3619
|
+
}
|
|
3620
|
+
const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
|
|
3621
|
+
if (c === "\\") {
|
|
3622
|
+
out += blank(c);
|
|
3623
|
+
i++;
|
|
3624
|
+
if (i < n) {
|
|
3625
|
+
out += blank(content[i]);
|
|
3626
|
+
i++;
|
|
3627
|
+
}
|
|
3628
|
+
continue;
|
|
3629
|
+
}
|
|
3630
|
+
if (c === closer) {
|
|
3631
|
+
state = "code";
|
|
3632
|
+
out += blank(c);
|
|
3633
|
+
i++;
|
|
3634
|
+
continue;
|
|
3635
|
+
}
|
|
3636
|
+
out += blank(c);
|
|
3637
|
+
i++;
|
|
3638
|
+
}
|
|
3639
|
+
return out;
|
|
3640
|
+
}
|
|
3641
|
+
function checkSourceComments(files, allowlist = []) {
|
|
3642
|
+
const findings = [];
|
|
3643
|
+
const allowed = new Set(allowlist);
|
|
3644
|
+
const patterns = [
|
|
3645
|
+
{ pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
|
|
3646
|
+
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3647
|
+
];
|
|
3648
|
+
for (const file of files) {
|
|
3649
|
+
if (!file.path.endsWith(".ts"))
|
|
3650
|
+
continue;
|
|
3651
|
+
if (allowed.has(file.path))
|
|
3652
|
+
continue;
|
|
3653
|
+
const comments = extractComments(file.path, file.content);
|
|
3654
|
+
for (const { pattern, what } of patterns) {
|
|
3655
|
+
pattern.lastIndex = 0;
|
|
3656
|
+
let match = pattern.exec(comments);
|
|
3657
|
+
while (match !== null) {
|
|
3658
|
+
findings.push({
|
|
3659
|
+
file: file.path,
|
|
3660
|
+
line: lineAt(comments, match.index),
|
|
3661
|
+
message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
|
|
3662
|
+
blocking: false
|
|
3663
|
+
});
|
|
3664
|
+
match = pattern.exec(comments);
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
return findings;
|
|
3669
|
+
}
|
|
3670
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3671
|
+
return [
|
|
3672
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3673
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
3674
|
+
];
|
|
3675
|
+
}
|
|
3676
|
+
function parseGlossaryTerms(glossaryContent) {
|
|
3677
|
+
const terms = [];
|
|
3678
|
+
const re = /^\*\*(.+?)\*\* —/gm;
|
|
3679
|
+
let match = re.exec(glossaryContent);
|
|
3680
|
+
while (match !== null) {
|
|
3681
|
+
if (match[1] !== undefined)
|
|
3682
|
+
terms.push(match[1]);
|
|
3683
|
+
match = re.exec(glossaryContent);
|
|
3684
|
+
}
|
|
3685
|
+
return terms;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3689
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3690
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3691
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3692
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3693
|
+
function isValidCitedFilePath(path) {
|
|
3694
|
+
if (path.length === 0)
|
|
3695
|
+
return false;
|
|
3696
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3697
|
+
return false;
|
|
3698
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3699
|
+
return false;
|
|
3700
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3701
|
+
}
|
|
3702
|
+
function quotedCommandLineAt(content, index) {
|
|
3703
|
+
let line = 1;
|
|
3704
|
+
for (let i = 0;i < index; i++) {
|
|
3705
|
+
if (content.charCodeAt(i) === 10)
|
|
3706
|
+
line++;
|
|
3707
|
+
}
|
|
3708
|
+
return line;
|
|
3709
|
+
}
|
|
3710
|
+
function extractQuotedText(raw) {
|
|
3711
|
+
const trimmed = raw.trim();
|
|
3712
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3713
|
+
if (fenced)
|
|
3714
|
+
return (fenced[1] ?? "").trim();
|
|
3715
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3716
|
+
if (inline)
|
|
3717
|
+
return (inline[1] ?? "").trim();
|
|
3718
|
+
return trimmed;
|
|
3719
|
+
}
|
|
3720
|
+
function findQuotesInFile(path, content) {
|
|
3721
|
+
const masked = maskCode(content);
|
|
3722
|
+
const quotes = [];
|
|
3723
|
+
START_PATTERN.lastIndex = 0;
|
|
3724
|
+
let start = START_PATTERN.exec(masked);
|
|
3725
|
+
while (start !== null) {
|
|
3726
|
+
const citedFile = start[1];
|
|
3727
|
+
const innerStart = start.index + start[0].length;
|
|
3728
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3729
|
+
if (end === null) {
|
|
3730
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3731
|
+
start = START_PATTERN.exec(masked);
|
|
3732
|
+
continue;
|
|
3733
|
+
}
|
|
3734
|
+
const innerEnd = innerStart + end.index;
|
|
3735
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3736
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3737
|
+
if (quotedText.length > 0) {
|
|
3738
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3742
|
+
start = START_PATTERN.exec(masked);
|
|
3743
|
+
}
|
|
3744
|
+
return quotes;
|
|
3745
|
+
}
|
|
3746
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3747
|
+
const quotes = [];
|
|
3748
|
+
for (const file of files) {
|
|
3749
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3750
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3751
|
+
continue;
|
|
3752
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3753
|
+
}
|
|
3754
|
+
return quotes;
|
|
3755
|
+
}
|
|
3756
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3757
|
+
const findings = [];
|
|
3758
|
+
for (const quote of citedQuotes) {
|
|
3759
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3760
|
+
if (content === undefined) {
|
|
3761
|
+
findings.push({
|
|
3762
|
+
file: quote.file,
|
|
3763
|
+
line: quote.line,
|
|
3764
|
+
citedFile: quote.citedFile,
|
|
3765
|
+
quotedText: quote.quotedText,
|
|
3766
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3767
|
+
});
|
|
3768
|
+
continue;
|
|
3769
|
+
}
|
|
3770
|
+
if (!content.includes(quote.quotedText)) {
|
|
3771
|
+
findings.push({
|
|
3772
|
+
file: quote.file,
|
|
3773
|
+
line: quote.line,
|
|
3774
|
+
citedFile: quote.citedFile,
|
|
3775
|
+
quotedText: quote.quotedText,
|
|
3776
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3777
|
+
});
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
return findings;
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3784
|
+
function hasRationaleField(body, labelPattern) {
|
|
3785
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
3786
|
+
return re.test(body);
|
|
3787
|
+
}
|
|
3788
|
+
var RATIONALE_FIELDS = [
|
|
3789
|
+
{ name: "Boundary", pattern: "Boundary" },
|
|
3790
|
+
{ name: "Sizing", pattern: "Sizing" },
|
|
3791
|
+
{ name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
|
|
3792
|
+
{ name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
|
|
3793
|
+
{ name: "Traps to avoid", pattern: "Traps" },
|
|
3794
|
+
{ name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
|
|
3795
|
+
{ name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
|
|
3796
|
+
{ name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
|
|
3797
|
+
];
|
|
3798
|
+
var DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale";
|
|
3799
|
+
function checkIssueRationale(body) {
|
|
3800
|
+
const errors = [];
|
|
3801
|
+
for (const f of RATIONALE_FIELDS) {
|
|
3802
|
+
if (!hasRationaleField(body, f.pattern)) {
|
|
3803
|
+
errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
|
|
3804
|
+
continue;
|
|
3805
|
+
}
|
|
3806
|
+
if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
|
|
3807
|
+
errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3811
|
+
}
|
|
3812
|
+
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3813
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3814
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3815
|
+
return { status: "pass", errors: [] };
|
|
3816
|
+
const result = objectivesOf(body);
|
|
3817
|
+
if (result.ok)
|
|
3818
|
+
return { status: "pass", errors: [] };
|
|
3819
|
+
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
3820
|
+
}
|
|
3821
|
+
function topLevelSectionText(body, headingName) {
|
|
3822
|
+
const headingRe = new RegExp(`^##[ \\t]*${headingName}[ \\t]*$`, "im");
|
|
3823
|
+
const heading = headingRe.exec(body);
|
|
3824
|
+
if (!heading)
|
|
3825
|
+
return null;
|
|
3826
|
+
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3827
|
+
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3828
|
+
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3829
|
+
}
|
|
3830
|
+
function partHasBacktickedPath(text) {
|
|
3831
|
+
let i = 0;
|
|
3832
|
+
while (i < text.length) {
|
|
3833
|
+
const start = text.indexOf("`", i);
|
|
3834
|
+
if (start === -1)
|
|
3835
|
+
return false;
|
|
3836
|
+
const end = text.indexOf("`", start + 1);
|
|
3837
|
+
if (end === -1)
|
|
3838
|
+
return false;
|
|
3839
|
+
if (text.slice(start + 1, end).includes("/"))
|
|
3840
|
+
return true;
|
|
3841
|
+
i = end + 1;
|
|
3842
|
+
}
|
|
3843
|
+
return false;
|
|
3844
|
+
}
|
|
3845
|
+
var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
|
|
3846
|
+
function stripPartBackticks(text) {
|
|
3847
|
+
return text.replace(/`[^`\n]*`/g, " ");
|
|
3848
|
+
}
|
|
3849
|
+
function partWordCount(text) {
|
|
3850
|
+
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3851
|
+
}
|
|
3852
|
+
function looksLikeFilePath(entry) {
|
|
3853
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3854
|
+
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3855
|
+
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3856
|
+
return extMatch !== null && extMatch.index > 0;
|
|
3857
|
+
}
|
|
3858
|
+
function splitGlobList(raw) {
|
|
3859
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
3860
|
+
}
|
|
3861
|
+
function parseIssueSurface(body) {
|
|
3862
|
+
const section = topLevelSectionText(body, "Surface");
|
|
3863
|
+
if (section === null)
|
|
3864
|
+
return { ok: false, errors: ["no `## Surface` heading found in the body."] };
|
|
3865
|
+
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3866
|
+
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3867
|
+
const errors = [];
|
|
3868
|
+
if (!inLine)
|
|
3869
|
+
errors.push("`## Surface` has no `in:` line.");
|
|
3870
|
+
if (!outLine)
|
|
3871
|
+
errors.push("`## Surface` has no `out:` line.");
|
|
3872
|
+
if (errors.length > 0)
|
|
3873
|
+
return { ok: false, errors };
|
|
3874
|
+
const inGlobs = splitGlobList(inLine[1]);
|
|
3875
|
+
const outGlobs = splitGlobList(outLine[1]);
|
|
3876
|
+
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3877
|
+
if (looksLikeFilePath(g)) {
|
|
3878
|
+
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
if (inGlobs.length === 0)
|
|
3882
|
+
errors.push("`## Surface`'s `in:` line resolved to zero globs.");
|
|
3883
|
+
if (errors.length > 0)
|
|
3884
|
+
return { ok: false, errors };
|
|
3885
|
+
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
3886
|
+
}
|
|
3887
|
+
function globCoversPath(glob, path) {
|
|
3888
|
+
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3889
|
+
const p = path.replace(/\/+$/, "");
|
|
3890
|
+
if (g === "*")
|
|
3891
|
+
return !p.includes("/");
|
|
3892
|
+
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3893
|
+
}
|
|
3894
|
+
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
3895
|
+
const surface = parseIssueSurface(body);
|
|
3896
|
+
if (!surface.ok)
|
|
3897
|
+
return { status: "pass", errors: [] };
|
|
3898
|
+
const errors = [];
|
|
3899
|
+
for (const glob of surface.value.in) {
|
|
3900
|
+
if (!resolvesToFile(glob)) {
|
|
3901
|
+
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3904
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3905
|
+
}
|
|
3906
|
+
function checkSurfaceScope(changedFiles, outGlobs) {
|
|
3907
|
+
if (outGlobs.length === 0)
|
|
3908
|
+
return { ok: true };
|
|
3909
|
+
const violations = [];
|
|
3910
|
+
for (const file of changedFiles) {
|
|
3911
|
+
const glob = outGlobs.find((g) => globCoversPath(g, file));
|
|
3912
|
+
if (glob)
|
|
3913
|
+
violations.push({ file, glob });
|
|
3914
|
+
}
|
|
3915
|
+
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3916
|
+
}
|
|
3917
|
+
var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
|
|
3918
|
+
function parseIssueParts(body) {
|
|
3919
|
+
const section = topLevelSectionText(body, "Parts");
|
|
3920
|
+
if (section === null)
|
|
3921
|
+
return { ok: false, errors: ["no `## Parts` heading found in the body."] };
|
|
3922
|
+
const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
3923
|
+
const parts = [];
|
|
3924
|
+
const errors = [];
|
|
3925
|
+
for (const line of lines) {
|
|
3926
|
+
const m = ISSUE_PART_LINE_RE.exec(line);
|
|
3927
|
+
if (!m) {
|
|
3928
|
+
errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
|
|
3929
|
+
continue;
|
|
3930
|
+
}
|
|
3931
|
+
const n = Number.parseInt(m[1], 10);
|
|
3932
|
+
const refs = m[2];
|
|
3933
|
+
const text = m[3].trim();
|
|
3934
|
+
if (text.length === 0) {
|
|
3935
|
+
errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
|
|
3936
|
+
continue;
|
|
3937
|
+
}
|
|
3938
|
+
if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
3939
|
+
errors.push(`Part ${n} is little more than a file path — a Part names an outcome and symbols, never a bare path.`);
|
|
3940
|
+
continue;
|
|
3941
|
+
}
|
|
3942
|
+
const objectiveIds = [...refs.matchAll(/O(\d+)/g)].map((r) => Number.parseInt(r[1], 10));
|
|
3943
|
+
parts.push({ n, objectiveIds, text });
|
|
3944
|
+
}
|
|
3945
|
+
if (parts.length === 0) {
|
|
3946
|
+
errors.push("the `## Parts` section has no well-formed `Part <n> (<refs>) — <outcome>` lines.");
|
|
3947
|
+
}
|
|
3948
|
+
if (errors.length > 0)
|
|
3949
|
+
return { ok: false, errors };
|
|
3950
|
+
return { ok: true, value: parts };
|
|
3951
|
+
}
|
|
3952
|
+
function checkPartsCiteDefinedObjectives(body) {
|
|
3953
|
+
const parts = parseIssueParts(body);
|
|
3954
|
+
const objectives = objectivesOf(body);
|
|
3955
|
+
if (!parts.ok || !objectives.ok)
|
|
3956
|
+
return { status: "pass", errors: [] };
|
|
3957
|
+
const definedIds = new Set(objectives.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
3958
|
+
const errors = [];
|
|
3959
|
+
for (const part of parts.value) {
|
|
3960
|
+
for (const objectiveId of part.objectiveIds) {
|
|
3961
|
+
if (!definedIds.has(objectiveId)) {
|
|
3962
|
+
errors.push(`issue-validation Parts: Part ${part.n} cites O${objectiveId}, which the Issue's own \`## Objectives\` section does not define.`);
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3967
|
+
}
|
|
3968
|
+
function isTaskIssueLabelSet(labels) {
|
|
3969
|
+
return hasLabel("tranche", labels);
|
|
3970
|
+
}
|
|
3971
|
+
function checkTrancheLabelPresence(_body, _labels) {
|
|
3972
|
+
return { status: "pass", errors: [] };
|
|
3973
|
+
}
|
|
3974
|
+
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
3975
|
+
if (!isTaskIssueLabelSet(labels))
|
|
3976
|
+
return { status: "pass", errors: [] };
|
|
3977
|
+
if (resolvedMilestoneTitle === null)
|
|
3978
|
+
return { status: "pass", errors: [] };
|
|
3979
|
+
if (currentMilestoneTitle === resolvedMilestoneTitle)
|
|
3980
|
+
return { status: "pass", errors: [] };
|
|
3981
|
+
return {
|
|
3982
|
+
status: "fail",
|
|
3983
|
+
errors: [
|
|
3984
|
+
`issue-validation milestone attach: this task Issue's tranche label resolves to Milestone "${resolvedMilestoneTitle}", but its live Milestone is ${currentMilestoneTitle === null ? "unset" : `"${currentMilestoneTitle}"`} — attach it to "${resolvedMilestoneTitle}".`
|
|
3985
|
+
]
|
|
3986
|
+
};
|
|
3987
|
+
}
|
|
3988
|
+
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
3989
|
+
function isControlCodePoint(codePoint) {
|
|
3990
|
+
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
3991
|
+
}
|
|
3992
|
+
function isDisplayControlCodePoint(codePoint) {
|
|
3993
|
+
return codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
3994
|
+
}
|
|
3995
|
+
var MESSAGE_VALUE_COUNT_MAX = 5;
|
|
3996
|
+
function residueForMessage(values) {
|
|
3997
|
+
const shown = values.slice(0, MESSAGE_VALUE_COUNT_MAX).map((v) => `\`${forMessage(v)}\``);
|
|
3998
|
+
const rest = values.length - shown.length;
|
|
3999
|
+
return rest > 0 ? `${shown.join(", ")} and ${rest} more` : shown.join(", ");
|
|
4000
|
+
}
|
|
4001
|
+
var MESSAGE_VALUE_MAX = 64;
|
|
4002
|
+
function forMessage(value) {
|
|
4003
|
+
const kept = [];
|
|
4004
|
+
for (const ch of value.replace(/\s+/g, " ")) {
|
|
4005
|
+
const codePoint = ch.codePointAt(0) ?? 0;
|
|
4006
|
+
if (isControlCodePoint(codePoint) || isDisplayControlCodePoint(codePoint))
|
|
4007
|
+
continue;
|
|
4008
|
+
kept.push(ch);
|
|
4009
|
+
}
|
|
4010
|
+
const cleaned = kept.join("").trim();
|
|
4011
|
+
if (cleaned.length === 0)
|
|
4012
|
+
return "(unprintable)";
|
|
4013
|
+
const points = Array.from(cleaned);
|
|
4014
|
+
return points.length > MESSAGE_VALUE_MAX ? `${points.slice(0, MESSAGE_VALUE_MAX).join("")}…` : cleaned;
|
|
4015
|
+
}
|
|
4016
|
+
function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
4017
|
+
if (registeredNames.length === 0)
|
|
4018
|
+
return { status: "pass", errors: [] };
|
|
4019
|
+
const field = projectFieldFromBody(body);
|
|
4020
|
+
if (!field.declared)
|
|
4021
|
+
return { status: "pass", errors: [] };
|
|
4022
|
+
const known = new Set(registeredNames.map((n) => n.trim()));
|
|
4023
|
+
const registeredList = [...registeredNames].map(forMessage).join(", ");
|
|
4024
|
+
const errors = [];
|
|
4025
|
+
if (field.unreadable) {
|
|
4026
|
+
return {
|
|
4027
|
+
status: "fail",
|
|
4028
|
+
errors: [
|
|
4029
|
+
`issue-validation project registry: the body has an unterminated code fence, so its \`**Project:**\` field could not be read reliably — the fence runs to end of body (CommonMark, and how the forge renders it), swallowing everything after it including the foot field where the declaration lives by convention. Read from the raw body the field says ${residueForMessage(field.unparsed) || "(nothing)"}, but a line inside a swallowed region may be a quoted example rather than a real declaration, so this gate refuses rather than guessing which. Balance the fences — every opening run of backticks or tildes needs a closing run at least as long — and the field reads normally.`
|
|
4030
|
+
]
|
|
4031
|
+
};
|
|
4032
|
+
}
|
|
4033
|
+
const unregistered = field.names.filter((p) => !known.has(p));
|
|
4034
|
+
if (unregistered.length > 0) {
|
|
4035
|
+
const caseHints = unregistered.map((p) => {
|
|
4036
|
+
const row = [...known].find((k) => k.toLowerCase() === p.toLowerCase());
|
|
4037
|
+
return row ? `\`${forMessage(p)}\` differs from the registered \`${forMessage(row)}\` only in case` : null;
|
|
4038
|
+
}).filter((h) => h !== null);
|
|
4039
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field declares ${unregistered.map(forMessage).join(", ")} — no such row in \`.vinaya/projects.md\`, which is the authority for valid project names (registered: ${registeredList}). Fix the name, or register the project with \`vinaya init product <name> --path <folder>\` first; an unregistered project has no specs to read and no per-project state to update.${caseHints.length > 0 ? ` Note: ${caseHints.join("; ")} — project names are matched exactly, because every downstream consumer compares them literally.` : ""} This reads the same field \`projectsFromBody\` derives the task's project from, so a name here that is not a row is a task that resolves to a project that does not exist.`);
|
|
4040
|
+
}
|
|
4041
|
+
if (field.names.length === 0) {
|
|
4042
|
+
const residue = field.unparsed.length > 0 ? ` — ${residueForMessage(field.unparsed)}` : " — the field is empty";
|
|
4043
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field is present but resolves to no project name${residue} (registered: ${registeredList}). A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); prose, a parenthetical, or a sentence in this field resolves to no project at all, and this gate cannot check a name it never receives — which is how a declaration like this used to pass. Write the registered name on its own, or register the project with \`vinaya init product <name> --path <folder>\` first. If the task genuinely touches no registered project, omit the field rather than explaining its absence inside it — \`checkIssueRationale\` already requires the \`Project(s) + blast radius\` narrative field for that.`);
|
|
4044
|
+
} else if (field.unparsed.length > 0) {
|
|
4045
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field declares a value that is not a project name — ${residueForMessage(field.unparsed)} (registered: ${registeredList}). The rest of the field parsed, so this is a name the gate silently could not check rather than a field it could not read at all. A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); write it on its own, or drop it if it names no project.`);
|
|
4046
|
+
}
|
|
4047
|
+
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
4048
|
+
}
|
|
4049
|
+
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
4050
|
+
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
4051
|
+
var FILE_EXTENSIONS = new Set([
|
|
4052
|
+
"ts",
|
|
4053
|
+
"tsx",
|
|
4054
|
+
"js",
|
|
4055
|
+
"jsx",
|
|
4056
|
+
"mjs",
|
|
4057
|
+
"cjs",
|
|
4058
|
+
"json",
|
|
4059
|
+
"jsonc",
|
|
4060
|
+
"md",
|
|
4061
|
+
"mdx",
|
|
4062
|
+
"yml",
|
|
4063
|
+
"yaml",
|
|
4064
|
+
"txt",
|
|
4065
|
+
"sh",
|
|
4066
|
+
"lock",
|
|
4067
|
+
"toml",
|
|
4068
|
+
"ndjson",
|
|
4069
|
+
"html",
|
|
4070
|
+
"css"
|
|
4071
|
+
]);
|
|
4072
|
+
|
|
4073
|
+
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
4074
|
+
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
4075
|
+
var TRANCHE_BRANCH_PATTERN = /^task\/([^/]+)\/([^/]+)$/;
|
|
4076
|
+
function parseTaskBranchIdentity(branch) {
|
|
4077
|
+
const issueMatch = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
4078
|
+
if (issueMatch)
|
|
4079
|
+
return { kind: "issue", issueNumber: Number(issueMatch[1]) };
|
|
4080
|
+
const trancheMatch = TRANCHE_BRANCH_PATTERN.exec(branch);
|
|
4081
|
+
if (trancheMatch)
|
|
4082
|
+
return { kind: "tranche", tranche: trancheMatch[1], taskId: trancheMatch[2] };
|
|
4083
|
+
return null;
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
// ../../packages/aeg-core/src/coherence-checks.ts
|
|
4087
|
+
var COHERENCE_ENFORCED_FROM = "2026-07-01";
|
|
4088
|
+
function isGrandfathered(isoDate) {
|
|
4089
|
+
if (!isoDate)
|
|
4090
|
+
return false;
|
|
4091
|
+
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
4092
|
+
}
|
|
4093
|
+
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4094
|
+
function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
4095
|
+
const failures = [];
|
|
4096
|
+
for (const e of entries) {
|
|
4097
|
+
if (!e.facts)
|
|
4098
|
+
continue;
|
|
4099
|
+
if (e.facts.stateReason === "not_planned")
|
|
4100
|
+
continue;
|
|
4101
|
+
if (e.facts.issueState === "closed" && e.facts.prState !== "merged") {
|
|
4102
|
+
const handClosed = e.facts.stateReason === "completed" && isPrincipal(e.facts.closedByActor, principalAllowlist);
|
|
4103
|
+
if (handClosed)
|
|
4104
|
+
continue;
|
|
4105
|
+
failures.push({
|
|
4106
|
+
code: "closed-without-merge",
|
|
4107
|
+
issue: e.task.issue,
|
|
4108
|
+
tranche: e.trancheSlug,
|
|
4109
|
+
task: e.task.id,
|
|
4110
|
+
reason: `Issue closed but closing PR is not merged (prState: ${e.facts.prState})`,
|
|
4111
|
+
grandfathered: isGrandfathered(e.facts.closedAt)
|
|
4112
|
+
});
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
4116
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
4117
|
+
return {
|
|
4118
|
+
check: "A1",
|
|
4119
|
+
status,
|
|
4120
|
+
failures,
|
|
4121
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4122
|
+
};
|
|
4123
|
+
}
|
|
4124
|
+
function checkA3(entries) {
|
|
4125
|
+
const failures = [];
|
|
4126
|
+
for (const e of entries) {
|
|
4127
|
+
if (!e.facts)
|
|
4128
|
+
continue;
|
|
4129
|
+
if (e.facts.prState === "merged" && e.facts.issueState !== "closed") {
|
|
4130
|
+
failures.push({
|
|
4131
|
+
code: "auto-close-misfire",
|
|
4132
|
+
issue: e.task.issue,
|
|
4133
|
+
tranche: e.trancheSlug,
|
|
4134
|
+
task: e.task.id,
|
|
4135
|
+
reason: "Closing PR is merged but Issue is still open (GitHub auto-close misfire)",
|
|
4136
|
+
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
4137
|
+
});
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
4141
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
4142
|
+
return {
|
|
4143
|
+
check: "A3",
|
|
4144
|
+
status,
|
|
4145
|
+
failures,
|
|
4146
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4147
|
+
};
|
|
4148
|
+
}
|
|
4149
|
+
function checkT1(entries) {
|
|
4150
|
+
const failures = [];
|
|
4151
|
+
for (const e of entries) {
|
|
4152
|
+
if (e.task.issue === null)
|
|
4153
|
+
continue;
|
|
4154
|
+
if (e.facts === undefined) {
|
|
3766
4155
|
failures.push({
|
|
3767
4156
|
code: "phantom-issue-ref",
|
|
3768
4157
|
issue: e.task.issue,
|
|
@@ -4058,8 +4447,7 @@ function briefHash(brief) {
|
|
|
4058
4447
|
function policyDigest(policy) {
|
|
4059
4448
|
return createHash4("sha256").update(JSON.stringify({
|
|
4060
4449
|
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4061
|
-
securityThreshold: policy.securityThreshold
|
|
4062
|
-
maxRounds: policy.maxRounds
|
|
4450
|
+
securityThreshold: policy.securityThreshold
|
|
4063
4451
|
})).digest("hex");
|
|
4064
4452
|
}
|
|
4065
4453
|
function isBoundToHead(echoed, headSha) {
|
|
@@ -4125,6 +4513,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4125
4513
|
}
|
|
4126
4514
|
|
|
4127
4515
|
// ../../packages/aeg-core/src/review-gate.ts
|
|
4516
|
+
function renderGateDeferred(deferred) {
|
|
4517
|
+
if (deferred.length === 0)
|
|
4518
|
+
return "";
|
|
4519
|
+
const items = deferred.map((d) => {
|
|
4520
|
+
const where = d.finding.location && d.finding.location.length > 0 ? d.finding.location : "(no location)";
|
|
4521
|
+
return `${d.finding.severity} ${where} (${DEFERRAL_REASON_TEXT[d.reason]})`;
|
|
4522
|
+
}).join("; ");
|
|
4523
|
+
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4524
|
+
}
|
|
4128
4525
|
function checkReviewGate(input) {
|
|
4129
4526
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
4130
4527
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -4149,8 +4546,8 @@ function checkReviewGate(input) {
|
|
|
4149
4546
|
let codeReviewPolicyEvaluation;
|
|
4150
4547
|
let securityPolicyEvaluation;
|
|
4151
4548
|
try {
|
|
4152
|
-
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
|
|
4153
|
-
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4549
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy, input.deferralContext);
|
|
4550
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy, input.deferralContext);
|
|
4154
4551
|
} catch (err) {
|
|
4155
4552
|
return {
|
|
4156
4553
|
verdict: "fail",
|
|
@@ -4196,10 +4593,14 @@ function checkReviewGate(input) {
|
|
|
4196
4593
|
const securityObjectivesBound = securityBinding.objectivesVersion;
|
|
4197
4594
|
const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
|
|
4198
4595
|
const securityRulingsBound = securityBinding.rulingOrdinal;
|
|
4596
|
+
const deferredNote = renderGateDeferred([
|
|
4597
|
+
...codeReviewPolicyEvaluation.deferredFindings,
|
|
4598
|
+
...securityPolicyEvaluation.deferredFindings
|
|
4599
|
+
]);
|
|
4199
4600
|
if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
|
|
4200
4601
|
return {
|
|
4201
4602
|
verdict: "pass",
|
|
4202
|
-
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}
|
|
4603
|
+
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.${deferredNote}`,
|
|
4203
4604
|
waived: false
|
|
4204
4605
|
};
|
|
4205
4606
|
}
|
|
@@ -4241,7 +4642,7 @@ function checkReviewGate(input) {
|
|
|
4241
4642
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4242
4643
|
return {
|
|
4243
4644
|
verdict: "fail",
|
|
4244
|
-
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}`,
|
|
4645
|
+
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}${deferredNote}`,
|
|
4245
4646
|
waived: false
|
|
4246
4647
|
};
|
|
4247
4648
|
}
|
|
@@ -4296,629 +4697,254 @@ function findTable(lines, fromLine, stopAtHeading = true) {
|
|
|
4296
4697
|
j++;
|
|
4297
4698
|
}
|
|
4298
4699
|
return { headers, rows };
|
|
4299
|
-
}
|
|
4300
|
-
i++;
|
|
4301
|
-
}
|
|
4302
|
-
return null;
|
|
4303
|
-
}
|
|
4304
|
-
function findHeadingLine(lines, pattern) {
|
|
4305
|
-
for (let i = 0;i < lines.length; i++) {
|
|
4306
|
-
if (pattern.test(lines[i] ?? ""))
|
|
4307
|
-
return i + 1;
|
|
4308
|
-
}
|
|
4309
|
-
return null;
|
|
4310
|
-
}
|
|
4311
|
-
// ../../packages/aeg-core/src/diagram-model.ts
|
|
4312
|
-
import matter from "gray-matter";
|
|
4313
|
-
|
|
4314
|
-
// ../../packages/aeg-core/src/registry-parse.ts
|
|
4315
|
-
var RING_HEADINGS = [
|
|
4316
|
-
{ ring: "ring0", pattern: /^##\s+Ring 0\b/ },
|
|
4317
|
-
{ ring: "ring1", pattern: /^##\s+Ring 1\b/ },
|
|
4318
|
-
{ ring: "ring2", pattern: /^##\s+Ring 2\b/ }
|
|
4319
|
-
];
|
|
4320
|
-
function stripBackticks2(cell) {
|
|
4321
|
-
const trimmed = cell.trim();
|
|
4322
|
-
if (trimmed.length >= 2 && trimmed.startsWith("`") && trimmed.endsWith("`")) {
|
|
4323
|
-
return trimmed.slice(1, -1);
|
|
4324
|
-
}
|
|
4325
|
-
return trimmed;
|
|
4326
|
-
}
|
|
4327
|
-
function stripBold(cell) {
|
|
4328
|
-
return cell.trim().replace(/\*\*/g, "");
|
|
4329
|
-
}
|
|
4330
|
-
function parseEnforcementRegistry(content) {
|
|
4331
|
-
const lines = content.split(`
|
|
4332
|
-
`);
|
|
4333
|
-
const result = [];
|
|
4334
|
-
for (const { ring, pattern } of RING_HEADINGS) {
|
|
4335
|
-
const headingLine = findHeadingLine(lines, pattern);
|
|
4336
|
-
if (headingLine === null)
|
|
4337
|
-
continue;
|
|
4338
|
-
const table = findTable(lines, headingLine + 1);
|
|
4339
|
-
if (!table)
|
|
4340
|
-
continue;
|
|
4341
|
-
const descriptionIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "description");
|
|
4342
|
-
const implementationIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "implementation");
|
|
4343
|
-
const audienceIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "audience");
|
|
4344
|
-
for (const row of table.rows) {
|
|
4345
|
-
const cells = row.cells;
|
|
4346
|
-
if (cells.length < 3)
|
|
4347
|
-
continue;
|
|
4348
|
-
const action = stripBold(cells[0] ?? "");
|
|
4349
|
-
const summary = stripBackticks2(cells[1] ?? "");
|
|
4350
|
-
const category = stripBackticks2(cells[2] ?? "");
|
|
4351
|
-
const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
|
|
4352
|
-
const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
|
|
4353
|
-
const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
|
|
4354
|
-
const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
|
|
4355
|
-
const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
|
|
4356
|
-
result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
|
|
4357
|
-
}
|
|
4358
|
-
}
|
|
4359
|
-
return result;
|
|
4360
|
-
}
|
|
4361
|
-
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4362
|
-
function checkG1(rows, existsFn) {
|
|
4363
|
-
const findings = [];
|
|
4364
|
-
for (const row of rows) {
|
|
4365
|
-
if (row.implementation === "")
|
|
4366
|
-
continue;
|
|
4367
|
-
if (!existsFn(row.implementation)) {
|
|
4368
|
-
findings.push({
|
|
4369
|
-
row: row.action,
|
|
4370
|
-
path: row.implementation,
|
|
4371
|
-
reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
|
|
4372
|
-
});
|
|
4373
|
-
}
|
|
4374
|
-
}
|
|
4375
|
-
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4376
|
-
}
|
|
4377
|
-
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
4378
|
-
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
4379
|
-
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
4380
|
-
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
4381
|
-
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
4382
|
-
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
4383
|
-
};
|
|
4384
|
-
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
4385
|
-
function checkG2(rows, candidateFiles) {
|
|
4386
|
-
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
4387
|
-
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
4388
|
-
const findings = [];
|
|
4389
|
-
for (const path of candidateFiles) {
|
|
4390
|
-
if (implementations.has(path))
|
|
4391
|
-
continue;
|
|
4392
|
-
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
4393
|
-
continue;
|
|
4394
|
-
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
4395
|
-
continue;
|
|
4396
|
-
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
4397
|
-
continue;
|
|
4398
|
-
const candidateNames = claimedCheckNames(path);
|
|
4399
|
-
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
4400
|
-
continue;
|
|
4401
|
-
findings.push({
|
|
4402
|
-
path,
|
|
4403
|
-
reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
|
|
4404
|
-
});
|
|
4405
|
-
}
|
|
4406
|
-
for (const row of rows) {
|
|
4407
|
-
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
4408
|
-
if (carriesPlaceholder) {
|
|
4409
|
-
findings.push({
|
|
4410
|
-
row: row.action,
|
|
4411
|
-
path: row.implementation,
|
|
4412
|
-
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
4413
|
-
});
|
|
4414
|
-
}
|
|
4415
|
-
}
|
|
4416
|
-
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4417
|
-
}
|
|
4418
|
-
function checkG3(ring0Rows, crossingFiles) {
|
|
4419
|
-
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
4420
|
-
const findings = [];
|
|
4421
|
-
for (const path of crossingFiles) {
|
|
4422
|
-
if (!ring0Implementations.has(path)) {
|
|
4423
|
-
findings.push({
|
|
4424
|
-
path,
|
|
4425
|
-
reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
|
|
4426
|
-
});
|
|
4427
|
-
}
|
|
4428
|
-
}
|
|
4429
|
-
return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4430
|
-
}
|
|
4431
|
-
function checkG4(content, resolveFn) {
|
|
4432
|
-
const cited = new Set;
|
|
4433
|
-
for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
|
|
4434
|
-
cited.add(Number(hit[1]));
|
|
4435
|
-
}
|
|
4436
|
-
const findings = [];
|
|
4437
|
-
for (const n of cited) {
|
|
4438
|
-
if (!resolveFn(n)) {
|
|
4439
|
-
findings.push({
|
|
4440
|
-
reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
|
|
4441
|
-
});
|
|
4442
|
-
}
|
|
4443
|
-
}
|
|
4444
|
-
return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4445
|
-
}
|
|
4446
|
-
function checkG5(roles, contracts) {
|
|
4447
|
-
const roleIds = new Set(roles.map((r) => r.role_id));
|
|
4448
|
-
const findings = [];
|
|
4449
|
-
for (const contract of contracts) {
|
|
4450
|
-
if (!roleIds.has(contract.producer)) {
|
|
4451
|
-
findings.push({
|
|
4452
|
-
path: contract.file,
|
|
4453
|
-
reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
|
|
4454
|
-
});
|
|
4455
|
-
}
|
|
4456
|
-
if (!roleIds.has(contract.consumer)) {
|
|
4457
|
-
findings.push({
|
|
4458
|
-
path: contract.file,
|
|
4459
|
-
reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
|
|
4460
|
-
});
|
|
4461
|
-
}
|
|
4462
|
-
}
|
|
4463
|
-
for (const role of roles) {
|
|
4464
|
-
if (role.performs.length === 0) {
|
|
4465
|
-
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
|
|
4466
|
-
}
|
|
4467
|
-
if (role.refuses_when.trim() === "") {
|
|
4468
|
-
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
|
|
4469
|
-
}
|
|
4470
|
-
}
|
|
4471
|
-
return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4472
|
-
}
|
|
4473
|
-
var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
|
|
4474
|
-
var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
|
|
4475
|
-
function basenameNoExt(path) {
|
|
4476
|
-
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
4477
|
-
return base.replace(/\.ts$/, "");
|
|
4478
|
-
}
|
|
4479
|
-
function claimedCheckNames(implementation) {
|
|
4480
|
-
if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
|
|
4481
|
-
return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
|
|
4482
|
-
}
|
|
4483
|
-
if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
|
|
4484
|
-
const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
|
|
4485
|
-
if (audience && isShipped(audience)) {
|
|
4486
|
-
return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
|
|
4487
|
-
}
|
|
4488
|
-
}
|
|
4489
|
-
return [];
|
|
4490
|
-
}
|
|
4491
|
-
function checkG6(rows, registeredCheckNames) {
|
|
4492
|
-
const findings = [];
|
|
4493
|
-
for (const row of rows) {
|
|
4494
|
-
if (row.audience !== "product")
|
|
4495
|
-
continue;
|
|
4496
|
-
const candidates = claimedCheckNames(row.implementation);
|
|
4497
|
-
if (!candidates.some((name) => registeredCheckNames.has(name))) {
|
|
4498
|
-
findings.push({
|
|
4499
|
-
row: row.action,
|
|
4500
|
-
path: row.implementation,
|
|
4501
|
-
reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
|
|
4502
|
-
});
|
|
4503
|
-
}
|
|
4504
|
-
}
|
|
4505
|
-
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4506
|
-
}
|
|
4507
|
-
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
4508
|
-
var PRODUCT_SLUG_SCOPE = [
|
|
4509
|
-
"apps/cli/src",
|
|
4510
|
-
".github/workflows",
|
|
4511
|
-
".vinaya",
|
|
4512
|
-
"apps/cli/README.md",
|
|
4513
|
-
"packages/sources/README.md"
|
|
4514
|
-
];
|
|
4515
|
-
function isUnderOrEqual(path, prefix) {
|
|
4516
|
-
return path === prefix || path.startsWith(`${prefix}/`);
|
|
4517
|
-
}
|
|
4518
|
-
function isProductScopeFile(path) {
|
|
4519
|
-
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
4520
|
-
}
|
|
4521
|
-
var SHIPS_PREFIX = "aeg-root/";
|
|
4522
|
-
function shipsArchivePrefix(shipsPrefix) {
|
|
4523
|
-
return `${shipsPrefix}tranches/completed/`;
|
|
4524
|
-
}
|
|
4525
|
-
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4526
|
-
function normalizeSpecPath(entry) {
|
|
4527
|
-
let out = entry.replace(/\\/g, "/");
|
|
4528
|
-
while (out.startsWith("./"))
|
|
4529
|
-
out = out.slice(2);
|
|
4530
|
-
out = out.replace(/\/{2,}/g, "/");
|
|
4531
|
-
while (out.endsWith("/"))
|
|
4532
|
-
out = out.slice(0, -1);
|
|
4533
|
-
return out;
|
|
4534
|
-
}
|
|
4535
|
-
function isSpecFile2(path, specPaths) {
|
|
4536
|
-
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4537
|
-
return true;
|
|
4538
|
-
if (!path.endsWith(".md"))
|
|
4539
|
-
return false;
|
|
4540
|
-
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4541
|
-
}
|
|
4542
|
-
function isClaudeMdFile(path) {
|
|
4543
|
-
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4544
|
-
}
|
|
4545
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4546
|
-
if (path.startsWith(shipsPrefix)) {
|
|
4547
|
-
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4548
|
-
}
|
|
4549
|
-
if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
|
|
4550
|
-
return "reader-facing";
|
|
4700
|
+
}
|
|
4701
|
+
i++;
|
|
4551
4702
|
}
|
|
4552
|
-
if (isClaudeMdFile(path))
|
|
4553
|
-
return "internal";
|
|
4554
|
-
if (isSpecFile2(path, specPaths))
|
|
4555
|
-
return "spec";
|
|
4556
|
-
if (isProductScopeFile(path))
|
|
4557
|
-
return "product";
|
|
4558
4703
|
return null;
|
|
4559
4704
|
}
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
}
|
|
4565
|
-
if (path.endsWith(".tsx") || path.endsWith(".ts")) {
|
|
4566
|
-
return content.replace(/\/\*.*?\*\//gs, (m) => m.replace(/[^\n]/g, "")).replace(/(^|[^:])\/\/[^\n]*/g, (m) => m.replace(/[^\n]/g, ""));
|
|
4705
|
+
function findHeadingLine(lines, pattern) {
|
|
4706
|
+
for (let i = 0;i < lines.length; i++) {
|
|
4707
|
+
if (pattern.test(lines[i] ?? ""))
|
|
4708
|
+
return i + 1;
|
|
4567
4709
|
}
|
|
4568
|
-
return
|
|
4569
|
-
}
|
|
4570
|
-
function stripNonProseForProduct(path, content) {
|
|
4571
|
-
return path.endsWith(".md") ? stripNonProse(path, content) : content;
|
|
4710
|
+
return null;
|
|
4572
4711
|
}
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4712
|
+
// ../../packages/aeg-core/src/diagram-model.ts
|
|
4713
|
+
import matter from "gray-matter";
|
|
4714
|
+
|
|
4715
|
+
// ../../packages/aeg-core/src/registry-parse.ts
|
|
4716
|
+
var RING_HEADINGS = [
|
|
4717
|
+
{ ring: "ring0", pattern: /^##\s+Ring 0\b/ },
|
|
4718
|
+
{ ring: "ring1", pattern: /^##\s+Ring 1\b/ },
|
|
4719
|
+
{ ring: "ring2", pattern: /^##\s+Ring 2\b/ }
|
|
4720
|
+
];
|
|
4721
|
+
function stripBackticks2(cell) {
|
|
4722
|
+
const trimmed = cell.trim();
|
|
4723
|
+
if (trimmed.length >= 2 && trimmed.startsWith("`") && trimmed.endsWith("`")) {
|
|
4724
|
+
return trimmed.slice(1, -1);
|
|
4578
4725
|
}
|
|
4579
|
-
return
|
|
4726
|
+
return trimmed;
|
|
4580
4727
|
}
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4584
|
-
function legacySlugPattern(legacySlugs) {
|
|
4585
|
-
if (legacySlugs.length === 0)
|
|
4586
|
-
return null;
|
|
4587
|
-
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4588
|
-
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4728
|
+
function stripBold(cell) {
|
|
4729
|
+
return cell.trim().replace(/\*\*/g, "");
|
|
4589
4730
|
}
|
|
4590
|
-
function
|
|
4591
|
-
const
|
|
4592
|
-
|
|
4593
|
-
const
|
|
4594
|
-
const
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
4598
|
-
];
|
|
4599
|
-
const productPatterns = [
|
|
4600
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4601
|
-
];
|
|
4602
|
-
const specPatterns = [
|
|
4603
|
-
...patterns,
|
|
4604
|
-
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4605
|
-
];
|
|
4606
|
-
for (const file of files) {
|
|
4607
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4608
|
-
if (!cls || cls === "internal")
|
|
4609
|
-
continue;
|
|
4610
|
-
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
4731
|
+
function parseEnforcementRegistry(content) {
|
|
4732
|
+
const lines = content.split(`
|
|
4733
|
+
`);
|
|
4734
|
+
const result = [];
|
|
4735
|
+
for (const { ring, pattern } of RING_HEADINGS) {
|
|
4736
|
+
const headingLine = findHeadingLine(lines, pattern);
|
|
4737
|
+
if (headingLine === null)
|
|
4611
4738
|
continue;
|
|
4612
|
-
|
|
4739
|
+
const table = findTable(lines, headingLine + 1);
|
|
4740
|
+
if (!table)
|
|
4613
4741
|
continue;
|
|
4614
|
-
const
|
|
4615
|
-
const
|
|
4616
|
-
const
|
|
4617
|
-
for (const
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
}
|
|
4742
|
+
const descriptionIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "description");
|
|
4743
|
+
const implementationIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "implementation");
|
|
4744
|
+
const audienceIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "audience");
|
|
4745
|
+
for (const row of table.rows) {
|
|
4746
|
+
const cells = row.cells;
|
|
4747
|
+
if (cells.length < 3)
|
|
4748
|
+
continue;
|
|
4749
|
+
const action = stripBold(cells[0] ?? "");
|
|
4750
|
+
const summary = stripBackticks2(cells[1] ?? "");
|
|
4751
|
+
const category = stripBackticks2(cells[2] ?? "");
|
|
4752
|
+
const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
|
|
4753
|
+
const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
|
|
4754
|
+
const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
|
|
4755
|
+
const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
|
|
4756
|
+
const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
|
|
4757
|
+
result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
|
|
4631
4758
|
}
|
|
4632
4759
|
}
|
|
4633
|
-
return
|
|
4634
|
-
}
|
|
4635
|
-
function escapeTerm(term) {
|
|
4636
|
-
return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4637
|
-
}
|
|
4638
|
-
function containsWholeWord(text, term) {
|
|
4639
|
-
const escaped = escapeTerm(term);
|
|
4640
|
-
const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
|
|
4641
|
-
return re.test(text);
|
|
4760
|
+
return result;
|
|
4642
4761
|
}
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
lineNo++;
|
|
4649
|
-
if (containsWholeWord(line, term))
|
|
4650
|
-
return lineNo;
|
|
4651
|
-
}
|
|
4652
|
-
return null;
|
|
4762
|
+
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4763
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4764
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4765
|
+
function basename(path) {
|
|
4766
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4653
4767
|
}
|
|
4654
|
-
function
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
return
|
|
4768
|
+
function lineOf(content, index) {
|
|
4769
|
+
let line = 1;
|
|
4770
|
+
for (let i = 0;i < index; i++)
|
|
4771
|
+
if (content.charCodeAt(i) === 10)
|
|
4772
|
+
line++;
|
|
4773
|
+
return line;
|
|
4660
4774
|
}
|
|
4661
|
-
function
|
|
4775
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4776
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4662
4777
|
const findings = [];
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
if (definesOrLinksGlossary(scrubbed, term))
|
|
4673
|
-
continue;
|
|
4674
|
-
findings.push({
|
|
4675
|
-
file: file.path,
|
|
4676
|
-
line,
|
|
4677
|
-
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
4678
|
-
blocking: false
|
|
4679
|
-
});
|
|
4680
|
-
}
|
|
4681
|
-
}
|
|
4682
|
-
return findings;
|
|
4683
|
-
}
|
|
4684
|
-
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
|
|
4685
|
-
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
|
|
4686
|
-
function extractComments(path, content) {
|
|
4687
|
-
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
4688
|
-
return content.replace(/[^\n]/g, "");
|
|
4689
|
-
let state = "code";
|
|
4690
|
-
let out = "";
|
|
4691
|
-
const n = content.length;
|
|
4692
|
-
let i = 0;
|
|
4693
|
-
const blank = (ch) => ch === `
|
|
4694
|
-
` ? `
|
|
4695
|
-
` : " ";
|
|
4696
|
-
while (i < n) {
|
|
4697
|
-
const c = content[i];
|
|
4698
|
-
const next = i + 1 < n ? content[i + 1] : "";
|
|
4699
|
-
if (state === "code") {
|
|
4700
|
-
if (c === "/" && next === "/") {
|
|
4701
|
-
state = "line-comment";
|
|
4702
|
-
out += c;
|
|
4703
|
-
i++;
|
|
4704
|
-
continue;
|
|
4705
|
-
}
|
|
4706
|
-
if (c === "/" && next === "*") {
|
|
4707
|
-
state = "block-comment";
|
|
4708
|
-
out += c;
|
|
4709
|
-
i++;
|
|
4710
|
-
continue;
|
|
4711
|
-
}
|
|
4712
|
-
if (c === "'") {
|
|
4713
|
-
state = "single-quote";
|
|
4714
|
-
out += blank(c);
|
|
4715
|
-
i++;
|
|
4716
|
-
continue;
|
|
4717
|
-
}
|
|
4718
|
-
if (c === '"') {
|
|
4719
|
-
state = "double-quote";
|
|
4720
|
-
out += blank(c);
|
|
4721
|
-
i++;
|
|
4722
|
-
continue;
|
|
4723
|
-
}
|
|
4724
|
-
if (c === "`") {
|
|
4725
|
-
state = "template";
|
|
4726
|
-
out += blank(c);
|
|
4727
|
-
i++;
|
|
4728
|
-
continue;
|
|
4729
|
-
}
|
|
4730
|
-
out += blank(c);
|
|
4731
|
-
i++;
|
|
4732
|
-
continue;
|
|
4733
|
-
}
|
|
4734
|
-
if (state === "line-comment") {
|
|
4735
|
-
if (c === `
|
|
4736
|
-
`) {
|
|
4737
|
-
state = "code";
|
|
4738
|
-
out += `
|
|
4739
|
-
`;
|
|
4740
|
-
i++;
|
|
4741
|
-
continue;
|
|
4742
|
-
}
|
|
4743
|
-
out += c;
|
|
4744
|
-
i++;
|
|
4745
|
-
continue;
|
|
4746
|
-
}
|
|
4747
|
-
if (state === "block-comment") {
|
|
4748
|
-
if (c === "*" && next === "/") {
|
|
4749
|
-
out += c;
|
|
4750
|
-
out += next;
|
|
4751
|
-
state = "code";
|
|
4752
|
-
i += 2;
|
|
4778
|
+
const flag = (doc, token, index) => {
|
|
4779
|
+
findings.push({
|
|
4780
|
+
path: doc.path,
|
|
4781
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4782
|
+
});
|
|
4783
|
+
};
|
|
4784
|
+
for (const doc of docs) {
|
|
4785
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4786
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4753
4787
|
continue;
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
` ? `
|
|
4757
|
-
` : c;
|
|
4758
|
-
i++;
|
|
4759
|
-
continue;
|
|
4788
|
+
if (!shipped.has(cited))
|
|
4789
|
+
flag(doc, cited, index);
|
|
4760
4790
|
}
|
|
4761
|
-
const
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
if (
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
}
|
|
4769
|
-
continue;
|
|
4791
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4792
|
+
let match = spanPattern.exec(doc.content);
|
|
4793
|
+
while (match !== null) {
|
|
4794
|
+
const token = match[1] ?? "";
|
|
4795
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4796
|
+
flag(doc, token, match.index);
|
|
4797
|
+
match = spanPattern.exec(doc.content);
|
|
4770
4798
|
}
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4799
|
+
}
|
|
4800
|
+
return findings;
|
|
4801
|
+
}
|
|
4802
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4803
|
+
const findings = [];
|
|
4804
|
+
for (const row of rows) {
|
|
4805
|
+
if (row.implementation === "")
|
|
4775
4806
|
continue;
|
|
4807
|
+
if (!existsFn(row.implementation)) {
|
|
4808
|
+
findings.push({
|
|
4809
|
+
row: row.action,
|
|
4810
|
+
path: row.implementation,
|
|
4811
|
+
reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
|
|
4812
|
+
});
|
|
4776
4813
|
}
|
|
4777
|
-
out += blank(c);
|
|
4778
|
-
i++;
|
|
4779
4814
|
}
|
|
4780
|
-
|
|
4815
|
+
if (hookRefs)
|
|
4816
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4817
|
+
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4781
4818
|
}
|
|
4782
|
-
|
|
4819
|
+
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
4820
|
+
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
4821
|
+
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
4822
|
+
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
4823
|
+
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
4824
|
+
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
4825
|
+
};
|
|
4826
|
+
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
4827
|
+
function checkG2(rows, candidateFiles) {
|
|
4828
|
+
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
4829
|
+
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
4783
4830
|
const findings = [];
|
|
4784
|
-
const
|
|
4785
|
-
|
|
4786
|
-
{ pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
|
|
4787
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
4788
|
-
];
|
|
4789
|
-
for (const file of files) {
|
|
4790
|
-
if (!file.path.endsWith(".ts"))
|
|
4831
|
+
for (const path of candidateFiles) {
|
|
4832
|
+
if (implementations.has(path))
|
|
4791
4833
|
continue;
|
|
4792
|
-
if (
|
|
4834
|
+
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
4793
4835
|
continue;
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4836
|
+
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
4837
|
+
continue;
|
|
4838
|
+
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
4839
|
+
continue;
|
|
4840
|
+
const candidateNames = claimedCheckNames(path);
|
|
4841
|
+
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
4842
|
+
continue;
|
|
4843
|
+
findings.push({
|
|
4844
|
+
path,
|
|
4845
|
+
reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
|
|
4846
|
+
});
|
|
4847
|
+
}
|
|
4848
|
+
for (const row of rows) {
|
|
4849
|
+
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
4850
|
+
if (carriesPlaceholder) {
|
|
4851
|
+
findings.push({
|
|
4852
|
+
row: row.action,
|
|
4853
|
+
path: row.implementation,
|
|
4854
|
+
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
4855
|
+
});
|
|
4807
4856
|
}
|
|
4808
4857
|
}
|
|
4809
|
-
return findings;
|
|
4810
|
-
}
|
|
4811
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4812
|
-
return [
|
|
4813
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4814
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4815
|
-
];
|
|
4858
|
+
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4816
4859
|
}
|
|
4817
|
-
function
|
|
4818
|
-
const
|
|
4819
|
-
const
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4860
|
+
function checkG3(ring0Rows, crossingFiles) {
|
|
4861
|
+
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
4862
|
+
const findings = [];
|
|
4863
|
+
for (const path of crossingFiles) {
|
|
4864
|
+
if (!ring0Implementations.has(path)) {
|
|
4865
|
+
findings.push({
|
|
4866
|
+
path,
|
|
4867
|
+
reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
|
|
4868
|
+
});
|
|
4869
|
+
}
|
|
4825
4870
|
}
|
|
4826
|
-
return
|
|
4827
|
-
}
|
|
4828
|
-
|
|
4829
|
-
// ../../packages/aeg-core/src/quoted-command.ts
|
|
4830
|
-
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
4831
|
-
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
4832
|
-
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
4833
|
-
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
4834
|
-
function isValidCitedFilePath(path) {
|
|
4835
|
-
if (path.length === 0)
|
|
4836
|
-
return false;
|
|
4837
|
-
if (path.startsWith("/") || path.startsWith("\\"))
|
|
4838
|
-
return false;
|
|
4839
|
-
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
4840
|
-
return false;
|
|
4841
|
-
return !path.split(/[\\/]+/).includes("..");
|
|
4871
|
+
return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4842
4872
|
}
|
|
4843
|
-
function
|
|
4844
|
-
|
|
4845
|
-
for (
|
|
4846
|
-
|
|
4847
|
-
line++;
|
|
4873
|
+
function checkG4(content, resolveFn) {
|
|
4874
|
+
const cited = new Set;
|
|
4875
|
+
for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
|
|
4876
|
+
cited.add(Number(hit[1]));
|
|
4848
4877
|
}
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
return (inline[1] ?? "").trim();
|
|
4859
|
-
return trimmed;
|
|
4878
|
+
const findings = [];
|
|
4879
|
+
for (const n of cited) {
|
|
4880
|
+
if (!resolveFn(n)) {
|
|
4881
|
+
findings.push({
|
|
4882
|
+
reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
|
|
4883
|
+
});
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4860
4887
|
}
|
|
4861
|
-
function
|
|
4862
|
-
const
|
|
4863
|
-
const
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
if (end === null) {
|
|
4871
|
-
START_PATTERN.lastIndex = innerStart;
|
|
4872
|
-
start = START_PATTERN.exec(masked);
|
|
4873
|
-
continue;
|
|
4888
|
+
function checkG5(roles, contracts) {
|
|
4889
|
+
const roleIds = new Set(roles.map((r) => r.role_id));
|
|
4890
|
+
const findings = [];
|
|
4891
|
+
for (const contract of contracts) {
|
|
4892
|
+
if (!roleIds.has(contract.producer)) {
|
|
4893
|
+
findings.push({
|
|
4894
|
+
path: contract.file,
|
|
4895
|
+
reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
|
|
4896
|
+
});
|
|
4874
4897
|
}
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
}
|
|
4898
|
+
if (!roleIds.has(contract.consumer)) {
|
|
4899
|
+
findings.push({
|
|
4900
|
+
path: contract.file,
|
|
4901
|
+
reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
|
|
4902
|
+
});
|
|
4881
4903
|
}
|
|
4882
|
-
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
4883
|
-
start = START_PATTERN.exec(masked);
|
|
4884
4904
|
}
|
|
4885
|
-
|
|
4905
|
+
for (const role of roles) {
|
|
4906
|
+
if (role.performs.length === 0) {
|
|
4907
|
+
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
|
|
4908
|
+
}
|
|
4909
|
+
if (role.refuses_when.trim() === "") {
|
|
4910
|
+
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4886
4914
|
}
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4915
|
+
var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
|
|
4916
|
+
var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
|
|
4917
|
+
function basenameNoExt(path) {
|
|
4918
|
+
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
4919
|
+
return base.replace(/\.ts$/, "");
|
|
4920
|
+
}
|
|
4921
|
+
function claimedCheckNames(implementation) {
|
|
4922
|
+
if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
|
|
4923
|
+
return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
|
|
4894
4924
|
}
|
|
4895
|
-
|
|
4925
|
+
if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
|
|
4926
|
+
const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
|
|
4927
|
+
if (audience && isShipped(audience)) {
|
|
4928
|
+
return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
return [];
|
|
4896
4932
|
}
|
|
4897
|
-
function
|
|
4933
|
+
function checkG6(rows, registeredCheckNames) {
|
|
4898
4934
|
const findings = [];
|
|
4899
|
-
for (const
|
|
4900
|
-
|
|
4901
|
-
if (content === undefined) {
|
|
4902
|
-
findings.push({
|
|
4903
|
-
file: quote.file,
|
|
4904
|
-
line: quote.line,
|
|
4905
|
-
citedFile: quote.citedFile,
|
|
4906
|
-
quotedText: quote.quotedText,
|
|
4907
|
-
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
4908
|
-
});
|
|
4935
|
+
for (const row of rows) {
|
|
4936
|
+
if (row.audience !== "product")
|
|
4909
4937
|
continue;
|
|
4910
|
-
|
|
4911
|
-
if (!
|
|
4938
|
+
const candidates = claimedCheckNames(row.implementation);
|
|
4939
|
+
if (!candidates.some((name) => registeredCheckNames.has(name))) {
|
|
4912
4940
|
findings.push({
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
quotedText: quote.quotedText,
|
|
4917
|
-
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
4941
|
+
row: row.action,
|
|
4942
|
+
path: row.implementation,
|
|
4943
|
+
reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
|
|
4918
4944
|
});
|
|
4919
4945
|
}
|
|
4920
4946
|
}
|
|
4921
|
-
return findings;
|
|
4947
|
+
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4922
4948
|
}
|
|
4923
4949
|
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4924
4950
|
function checkDeadBranchPush(input) {
|
|
@@ -5341,7 +5367,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5341
5367
|
var TaskPrReviewRecordSchema = z.object({
|
|
5342
5368
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5343
5369
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5344
|
-
summaryTable: z.string().nullable(),
|
|
5345
5370
|
pause: TaskPrPauseSchema.nullable()
|
|
5346
5371
|
});
|
|
5347
5372
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5388,16 +5413,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5388
5413
|
authenticatedFrom: z.string().min(1),
|
|
5389
5414
|
fencedEffectKeys: z.array(z.string())
|
|
5390
5415
|
});
|
|
5391
|
-
var TASK_TOOL_NAMES = [
|
|
5392
|
-
"task_start",
|
|
5393
|
-
"task_status",
|
|
5394
|
-
"task_escalation_read",
|
|
5395
|
-
"task_pr_read",
|
|
5396
|
-
"task_resume",
|
|
5397
|
-
"task_cancel"
|
|
5398
|
-
];
|
|
5399
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5400
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
5401
5416
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5402
5417
|
function parseTaskBranch(branch) {
|
|
5403
5418
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5628,15 +5643,69 @@ var NO_GATE_CUTOVERS = {
|
|
|
5628
5643
|
briefRulesSincePr: null,
|
|
5629
5644
|
agentBoxesRefusedSincePr: null
|
|
5630
5645
|
};
|
|
5631
|
-
// ../../packages/aeg-core/src/
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5646
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5647
|
+
import { z as z3 } from "zod";
|
|
5648
|
+
|
|
5649
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5650
|
+
import { z as z2 } from "zod";
|
|
5651
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5652
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5653
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5654
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5655
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5656
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5657
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5658
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5659
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5660
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5661
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5662
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5663
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5664
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5665
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5666
|
+
const refuse = (message, path = []) => {
|
|
5667
|
+
ctx.addIssue({
|
|
5668
|
+
code: z2.ZodIssueCode.custom,
|
|
5669
|
+
path: [name, ...path],
|
|
5670
|
+
message: `logs.events "${name}": ${message}`
|
|
5671
|
+
});
|
|
5672
|
+
};
|
|
5673
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5674
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5675
|
+
}
|
|
5676
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5677
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5678
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5679
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5680
|
+
}
|
|
5681
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5682
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5683
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5684
|
+
}
|
|
5685
|
+
for (const [field, type] of fieldEntries) {
|
|
5686
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5687
|
+
refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
|
|
5688
|
+
}
|
|
5689
|
+
if (typeof type === "string")
|
|
5690
|
+
continue;
|
|
5691
|
+
if (type.length === 0) {
|
|
5692
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5693
|
+
}
|
|
5694
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5695
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5696
|
+
}
|
|
5697
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5698
|
+
if (bad.length > 0) {
|
|
5699
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5700
|
+
}
|
|
5701
|
+
if (new Set(type).size !== type.length) {
|
|
5702
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
}
|
|
5706
|
+
});
|
|
5637
5707
|
|
|
5638
5708
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5639
|
-
import { z as z2 } from "zod";
|
|
5640
5709
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5641
5710
|
var ROLE_VALUES = [
|
|
5642
5711
|
"planner",
|
|
@@ -5647,244 +5716,297 @@ var ROLE_VALUES = [
|
|
|
5647
5716
|
"archivist",
|
|
5648
5717
|
"architect"
|
|
5649
5718
|
];
|
|
5650
|
-
var RoleSchema =
|
|
5719
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5651
5720
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5652
|
-
var HostSchema =
|
|
5721
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5653
5722
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5654
5723
|
var headerMetaCore = {
|
|
5655
|
-
ts:
|
|
5656
|
-
run_id:
|
|
5657
|
-
seq:
|
|
5658
|
-
repo:
|
|
5659
|
-
vinaya:
|
|
5660
|
-
doctrine:
|
|
5724
|
+
ts: z3.string(),
|
|
5725
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5726
|
+
seq: z3.number().int().nonnegative(),
|
|
5727
|
+
repo: z3.string().nullable(),
|
|
5728
|
+
vinaya: z3.string(),
|
|
5729
|
+
doctrine: z3.string(),
|
|
5661
5730
|
host: HostSchema,
|
|
5662
|
-
machine:
|
|
5731
|
+
machine: z3.string()
|
|
5663
5732
|
};
|
|
5664
|
-
var HeaderMetaV1Schema =
|
|
5665
|
-
schema:
|
|
5733
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5734
|
+
schema: z3.literal(1),
|
|
5666
5735
|
...headerMetaCore
|
|
5667
5736
|
}).strict();
|
|
5668
|
-
var LineageSchema =
|
|
5669
|
-
run:
|
|
5670
|
-
attempt:
|
|
5671
|
-
parent:
|
|
5737
|
+
var LineageSchema = z3.object({
|
|
5738
|
+
run: z3.string().nullable(),
|
|
5739
|
+
attempt: z3.number().int().nullable(),
|
|
5740
|
+
parent: z3.string().nullable()
|
|
5672
5741
|
}).strict();
|
|
5673
|
-
var InputVersionsSchema =
|
|
5674
|
-
objectives_version:
|
|
5675
|
-
brief_hash:
|
|
5676
|
-
ruling_ordinal:
|
|
5677
|
-
policy_digest:
|
|
5742
|
+
var InputVersionsSchema = z3.object({
|
|
5743
|
+
objectives_version: z3.string().nullable(),
|
|
5744
|
+
brief_hash: z3.string().nullable(),
|
|
5745
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5746
|
+
policy_digest: z3.string().nullable()
|
|
5678
5747
|
}).strict();
|
|
5679
|
-
var ProvenanceSchema =
|
|
5680
|
-
var HeaderMetaV2Schema =
|
|
5681
|
-
schema:
|
|
5748
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5749
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5750
|
+
schema: z3.literal(2),
|
|
5682
5751
|
...headerMetaCore,
|
|
5683
|
-
event_id:
|
|
5684
|
-
process_id:
|
|
5685
|
-
actor_id:
|
|
5752
|
+
event_id: z3.string().min(1),
|
|
5753
|
+
process_id: z3.string().min(1),
|
|
5754
|
+
actor_id: z3.string().nullable(),
|
|
5686
5755
|
lineage: LineageSchema,
|
|
5687
5756
|
input_versions: InputVersionsSchema,
|
|
5688
5757
|
provenance: ProvenanceSchema
|
|
5689
5758
|
}).strict();
|
|
5690
|
-
var
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5759
|
+
var WorkSchema = z3.object({
|
|
5760
|
+
ref: z3.string().nullable(),
|
|
5761
|
+
repo: z3.string().nullable(),
|
|
5762
|
+
change: z3.string().nullable(),
|
|
5763
|
+
revision: z3.string().nullable()
|
|
5764
|
+
}).strict();
|
|
5765
|
+
var FlowSchema = z3.object({
|
|
5766
|
+
id: z3.string().nullable(),
|
|
5767
|
+
version: z3.string().nullable()
|
|
5768
|
+
}).strict();
|
|
5769
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5770
|
+
schema: z3.literal(3),
|
|
5771
|
+
...headerMetaCore,
|
|
5772
|
+
event_id: z3.string().min(1),
|
|
5773
|
+
process_id: z3.string().min(1),
|
|
5774
|
+
actor_id: z3.string().nullable(),
|
|
5775
|
+
lineage: LineageSchema,
|
|
5776
|
+
input_versions: InputVersionsSchema,
|
|
5777
|
+
provenance: ProvenanceSchema,
|
|
5778
|
+
work: WorkSchema,
|
|
5779
|
+
flow: FlowSchema,
|
|
5780
|
+
runtime: z3.string().nullable(),
|
|
5781
|
+
source: z3.string().nullable()
|
|
5782
|
+
}).strict();
|
|
5783
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5784
|
+
var SubjectSchema = z3.object({
|
|
5785
|
+
issue: z3.number().int().nullable(),
|
|
5786
|
+
pr: z3.number().int().optional(),
|
|
5787
|
+
sha: z3.string().optional(),
|
|
5788
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5789
|
+
round: z3.number().int().optional(),
|
|
5790
|
+
objectives_version: z3.string().optional()
|
|
5698
5791
|
}).strict();
|
|
5699
|
-
var HeaderSchema =
|
|
5792
|
+
var HeaderSchema = z3.object({
|
|
5700
5793
|
meta: HeaderMetaSchema,
|
|
5701
5794
|
subject: SubjectSchema
|
|
5702
5795
|
}).strict();
|
|
5703
5796
|
var envelopeTail = {
|
|
5704
|
-
duration_ms:
|
|
5705
|
-
payload:
|
|
5797
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5798
|
+
payload: z3.object({}).strict()
|
|
5706
5799
|
};
|
|
5707
|
-
var ReviewFindingSchema =
|
|
5708
|
-
id:
|
|
5709
|
-
severity:
|
|
5710
|
-
state:
|
|
5711
|
-
severity_scale:
|
|
5712
|
-
policy_treatment:
|
|
5713
|
-
confidence:
|
|
5714
|
-
confidence_scale:
|
|
5715
|
-
confidence_source:
|
|
5800
|
+
var ReviewFindingSchema = z3.object({
|
|
5801
|
+
id: z3.string(),
|
|
5802
|
+
severity: z3.string(),
|
|
5803
|
+
state: z3.string().optional(),
|
|
5804
|
+
severity_scale: z3.string().optional(),
|
|
5805
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5806
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5807
|
+
confidence_scale: z3.string().optional(),
|
|
5808
|
+
confidence_source: z3.string().optional()
|
|
5716
5809
|
}).strict();
|
|
5717
|
-
var DispatchOutcomeSchema =
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
type:
|
|
5721
|
-
pr:
|
|
5722
|
-
head:
|
|
5723
|
-
comment_id:
|
|
5810
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5811
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5812
|
+
z3.object({
|
|
5813
|
+
type: z3.literal("round_pushed"),
|
|
5814
|
+
pr: z3.number().int(),
|
|
5815
|
+
head: z3.string(),
|
|
5816
|
+
comment_id: z3.number().int()
|
|
5724
5817
|
}).strict(),
|
|
5725
|
-
|
|
5726
|
-
type:
|
|
5727
|
-
verdict:
|
|
5728
|
-
head:
|
|
5729
|
-
comment_id:
|
|
5730
|
-
objectives:
|
|
5731
|
-
findings:
|
|
5818
|
+
z3.object({
|
|
5819
|
+
type: z3.literal("verdict"),
|
|
5820
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5821
|
+
head: z3.string(),
|
|
5822
|
+
comment_id: z3.number().int(),
|
|
5823
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5824
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5732
5825
|
}).strict(),
|
|
5733
|
-
|
|
5734
|
-
type:
|
|
5735
|
-
class:
|
|
5736
|
-
comment_id:
|
|
5826
|
+
z3.object({
|
|
5827
|
+
type: z3.literal("escalation"),
|
|
5828
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5829
|
+
comment_id: z3.number().int()
|
|
5737
5830
|
}).strict(),
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5831
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5832
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5833
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5834
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5742
5835
|
]);
|
|
5743
5836
|
var dispatchShared = {
|
|
5744
5837
|
meta: HeaderMetaSchema,
|
|
5745
5838
|
subject: SubjectSchema,
|
|
5746
|
-
kind:
|
|
5839
|
+
kind: z3.literal("dispatch"),
|
|
5747
5840
|
...envelopeTail,
|
|
5748
5841
|
target_role: RoleSchema,
|
|
5749
|
-
model:
|
|
5750
|
-
round:
|
|
5751
|
-
effect_id:
|
|
5842
|
+
model: z3.string(),
|
|
5843
|
+
round: z3.number().int().optional(),
|
|
5844
|
+
effect_id: z3.string()
|
|
5752
5845
|
};
|
|
5753
|
-
var dispatchUsageField =
|
|
5754
|
-
var DispatchEventSchema =
|
|
5755
|
-
|
|
5756
|
-
|
|
5846
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5847
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5848
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5849
|
+
z3.object({
|
|
5757
5850
|
...dispatchShared,
|
|
5758
|
-
event:
|
|
5851
|
+
event: z3.literal("outcome_received"),
|
|
5759
5852
|
outcome: DispatchOutcomeSchema,
|
|
5760
5853
|
usage: dispatchUsageField
|
|
5761
5854
|
}).strict(),
|
|
5762
|
-
|
|
5855
|
+
z3.object({
|
|
5763
5856
|
...dispatchShared,
|
|
5764
|
-
event:
|
|
5765
|
-
reason:
|
|
5857
|
+
event: z3.literal("dispatch_failed"),
|
|
5858
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
5766
5859
|
usage: dispatchUsageField
|
|
5767
5860
|
}).strict()
|
|
5768
5861
|
]);
|
|
5862
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5863
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5864
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5865
|
+
role: RoleSchema,
|
|
5866
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5867
|
+
blockers: z3.number().int().nonnegative()
|
|
5868
|
+
}).strict();
|
|
5769
5869
|
var loopShared = {
|
|
5770
5870
|
meta: HeaderMetaSchema,
|
|
5771
5871
|
subject: SubjectSchema,
|
|
5772
|
-
kind:
|
|
5872
|
+
kind: z3.literal("dev_review_loop"),
|
|
5773
5873
|
...envelopeTail,
|
|
5774
|
-
loop_id:
|
|
5874
|
+
loop_id: z3.string()
|
|
5775
5875
|
};
|
|
5776
|
-
var DevReviewLoopEventSchema =
|
|
5777
|
-
|
|
5876
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5877
|
+
z3.object({
|
|
5778
5878
|
...loopShared,
|
|
5779
|
-
event:
|
|
5780
|
-
task:
|
|
5781
|
-
policy:
|
|
5782
|
-
max_rounds:
|
|
5783
|
-
reviewers:
|
|
5784
|
-
models:
|
|
5879
|
+
event: z3.literal("loop_started"),
|
|
5880
|
+
task: z3.number().int(),
|
|
5881
|
+
policy: z3.object({
|
|
5882
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
5883
|
+
reviewers: z3.array(RoleSchema),
|
|
5884
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5785
5885
|
}).strict()
|
|
5786
5886
|
}).strict(),
|
|
5787
|
-
|
|
5788
|
-
|
|
5887
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
5888
|
+
z3.object({
|
|
5789
5889
|
...loopShared,
|
|
5790
|
-
event:
|
|
5791
|
-
round:
|
|
5792
|
-
head:
|
|
5793
|
-
green:
|
|
5794
|
-
confidence_value:
|
|
5795
|
-
confidence_reason:
|
|
5796
|
-
confidence_unavailable:
|
|
5797
|
-
extra_turn_spent:
|
|
5890
|
+
event: z3.literal("gate_result_read"),
|
|
5891
|
+
round: z3.number().int(),
|
|
5892
|
+
head: z3.string(),
|
|
5893
|
+
green: z3.boolean(),
|
|
5894
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
5895
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
5896
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
5897
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5798
5898
|
}).strict(),
|
|
5799
|
-
|
|
5899
|
+
z3.object({
|
|
5800
5900
|
...loopShared,
|
|
5801
|
-
event:
|
|
5802
|
-
round:
|
|
5803
|
-
head:
|
|
5804
|
-
all_approve:
|
|
5805
|
-
blockers:
|
|
5806
|
-
findings:
|
|
5901
|
+
event: z3.literal("verdicts_read"),
|
|
5902
|
+
round: z3.number().int(),
|
|
5903
|
+
head: z3.string(),
|
|
5904
|
+
all_approve: z3.boolean(),
|
|
5905
|
+
blockers: z3.number().int().nonnegative(),
|
|
5906
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
5907
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5807
5908
|
}).strict(),
|
|
5808
|
-
|
|
5909
|
+
z3.object({
|
|
5809
5910
|
...loopShared,
|
|
5810
|
-
event:
|
|
5811
|
-
round:
|
|
5812
|
-
open:
|
|
5813
|
-
resolved:
|
|
5814
|
-
new:
|
|
5815
|
-
recurring:
|
|
5911
|
+
event: z3.literal("findings_compared"),
|
|
5912
|
+
round: z3.number().int(),
|
|
5913
|
+
open: z3.array(z3.string()),
|
|
5914
|
+
resolved: z3.array(z3.string()),
|
|
5915
|
+
new: z3.array(z3.string()),
|
|
5916
|
+
recurring: z3.array(z3.string())
|
|
5816
5917
|
}).strict(),
|
|
5817
|
-
|
|
5918
|
+
z3.object({
|
|
5818
5919
|
...loopShared,
|
|
5819
|
-
event:
|
|
5820
|
-
round:
|
|
5821
|
-
condition:
|
|
5920
|
+
event: z3.literal("stop_condition_met"),
|
|
5921
|
+
round: z3.number().int(),
|
|
5922
|
+
condition: z3.enum([
|
|
5822
5923
|
"green",
|
|
5823
5924
|
"max_rounds",
|
|
5824
5925
|
"no_progress",
|
|
5825
5926
|
"escalated",
|
|
5826
5927
|
"principal_stop",
|
|
5827
5928
|
"confidence",
|
|
5828
|
-
"reappearance"
|
|
5929
|
+
"reappearance",
|
|
5930
|
+
"repeat_finding",
|
|
5931
|
+
"repeat_failure",
|
|
5932
|
+
"time_budget"
|
|
5829
5933
|
])
|
|
5830
5934
|
}).strict(),
|
|
5831
|
-
|
|
5935
|
+
z3.object({
|
|
5936
|
+
...loopShared,
|
|
5937
|
+
event: z3.literal("paused"),
|
|
5938
|
+
round: z3.number().int(),
|
|
5939
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
5940
|
+
reason_code: CodeTokenSchema.optional()
|
|
5941
|
+
}).strict(),
|
|
5942
|
+
z3.object({
|
|
5943
|
+
...loopShared,
|
|
5944
|
+
event: z3.literal("resumed"),
|
|
5945
|
+
round: z3.number().int(),
|
|
5946
|
+
by: z3.enum(["principal", "driver"])
|
|
5947
|
+
}).strict(),
|
|
5948
|
+
z3.object({
|
|
5832
5949
|
...loopShared,
|
|
5833
|
-
event:
|
|
5834
|
-
round:
|
|
5835
|
-
|
|
5950
|
+
event: z3.literal("cancelled"),
|
|
5951
|
+
round: z3.number().int(),
|
|
5952
|
+
by: z3.literal("principal")
|
|
5836
5953
|
}).strict(),
|
|
5837
|
-
|
|
5954
|
+
z3.object({
|
|
5838
5955
|
...loopShared,
|
|
5839
|
-
event:
|
|
5840
|
-
round:
|
|
5841
|
-
|
|
5956
|
+
event: z3.literal("unpushed_work_resume"),
|
|
5957
|
+
round: z3.number().int(),
|
|
5958
|
+
branch: z3.string(),
|
|
5959
|
+
detail: z3.string()
|
|
5842
5960
|
}).strict(),
|
|
5843
|
-
|
|
5961
|
+
z3.object({
|
|
5844
5962
|
...loopShared,
|
|
5845
|
-
event:
|
|
5846
|
-
round:
|
|
5847
|
-
|
|
5963
|
+
event: z3.literal("round_ended"),
|
|
5964
|
+
round: z3.number().int(),
|
|
5965
|
+
base_head: z3.string(),
|
|
5966
|
+
head: z3.string(),
|
|
5967
|
+
files_changed: z3.number().int().nonnegative(),
|
|
5968
|
+
insertions: z3.number().int().nonnegative(),
|
|
5969
|
+
deletions: z3.number().int().nonnegative(),
|
|
5970
|
+
wall_ms: z3.number().nonnegative(),
|
|
5971
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5848
5972
|
}).strict(),
|
|
5849
|
-
|
|
5973
|
+
z3.object({
|
|
5850
5974
|
...loopShared,
|
|
5851
|
-
event:
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5975
|
+
event: z3.literal("journal_finalized"),
|
|
5976
|
+
rounds: z3.number().int().nonnegative(),
|
|
5977
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
5978
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
5979
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
5980
|
+
final_head: z3.string(),
|
|
5981
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5855
5982
|
}).strict(),
|
|
5856
|
-
|
|
5983
|
+
z3.object({
|
|
5857
5984
|
...loopShared,
|
|
5858
|
-
event:
|
|
5859
|
-
round:
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
insertions: z2.number().int().nonnegative(),
|
|
5864
|
-
deletions: z2.number().int().nonnegative(),
|
|
5865
|
-
wall_ms: z2.number().nonnegative(),
|
|
5866
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
5985
|
+
event: z3.literal("infrastructure_retry"),
|
|
5986
|
+
round: z3.number().int(),
|
|
5987
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
5988
|
+
attempts: z3.number().int().positive(),
|
|
5989
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5867
5990
|
}).strict(),
|
|
5868
|
-
|
|
5991
|
+
z3.object({
|
|
5869
5992
|
...loopShared,
|
|
5870
|
-
event:
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
final_head: z2.string(),
|
|
5876
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
5993
|
+
event: z3.literal("driver_heartbeat"),
|
|
5994
|
+
task: z3.number().int(),
|
|
5995
|
+
pr: z3.number().int().positive().optional(),
|
|
5996
|
+
round: z3.number().int(),
|
|
5997
|
+
phase: z3.string()
|
|
5877
5998
|
}).strict(),
|
|
5878
|
-
|
|
5999
|
+
z3.object({
|
|
5879
6000
|
...loopShared,
|
|
5880
|
-
event:
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
6001
|
+
event: z3.literal("driver_exited"),
|
|
6002
|
+
task: z3.number().int(),
|
|
6003
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
6004
|
+
last_decision: z3.string(),
|
|
6005
|
+
exit_code: z3.number().int().optional(),
|
|
6006
|
+
error_class: CodeTokenSchema.optional()
|
|
5885
6007
|
}).strict()
|
|
5886
6008
|
]);
|
|
5887
|
-
var ForgeOpSchema =
|
|
6009
|
+
var ForgeOpSchema = z3.enum([
|
|
5888
6010
|
"pr.create",
|
|
5889
6011
|
"pr.comment",
|
|
5890
6012
|
"pr.body.replace",
|
|
@@ -5898,24 +6020,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5898
6020
|
"label.add",
|
|
5899
6021
|
"label.remove"
|
|
5900
6022
|
]);
|
|
5901
|
-
var ForgeWriteTargetSchema =
|
|
5902
|
-
issue:
|
|
5903
|
-
pr:
|
|
6023
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6024
|
+
issue: z3.number().int().optional(),
|
|
6025
|
+
pr: z3.number().int().optional()
|
|
5904
6026
|
}).strict();
|
|
5905
6027
|
var forgeWriteShared = {
|
|
5906
6028
|
meta: HeaderMetaSchema,
|
|
5907
6029
|
subject: SubjectSchema,
|
|
5908
|
-
kind:
|
|
6030
|
+
kind: z3.literal("forge_write"),
|
|
5909
6031
|
...envelopeTail,
|
|
5910
6032
|
op: ForgeOpSchema,
|
|
5911
6033
|
target: ForgeWriteTargetSchema
|
|
5912
6034
|
};
|
|
5913
|
-
var ForgeWriteEventSchema =
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
6035
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6036
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6037
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6038
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5917
6039
|
]);
|
|
5918
|
-
var GateOutcomeSchema =
|
|
6040
|
+
var GateOutcomeSchema = z3.enum([
|
|
5919
6041
|
"pass",
|
|
5920
6042
|
"fail",
|
|
5921
6043
|
"wait",
|
|
@@ -5928,61 +6050,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5928
6050
|
var gateShared = {
|
|
5929
6051
|
meta: HeaderMetaSchema,
|
|
5930
6052
|
subject: SubjectSchema,
|
|
5931
|
-
kind:
|
|
6053
|
+
kind: z3.literal("gate"),
|
|
5932
6054
|
...envelopeTail,
|
|
5933
|
-
check:
|
|
5934
|
-
check_version:
|
|
5935
|
-
policy_version:
|
|
5936
|
-
input_fingerprint:
|
|
6055
|
+
check: z3.string(),
|
|
6056
|
+
check_version: z3.string().nullable(),
|
|
6057
|
+
policy_version: z3.string().nullable(),
|
|
6058
|
+
input_fingerprint: z3.string().nullable()
|
|
5937
6059
|
};
|
|
5938
|
-
var GateEventSchema =
|
|
5939
|
-
|
|
6060
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6061
|
+
z3.object({
|
|
5940
6062
|
...gateShared,
|
|
5941
|
-
event:
|
|
6063
|
+
event: z3.literal("checked"),
|
|
5942
6064
|
outcome: GateOutcomeSchema,
|
|
5943
|
-
reason:
|
|
6065
|
+
reason: z3.string().optional()
|
|
6066
|
+
}).strict(),
|
|
6067
|
+
z3.object({
|
|
6068
|
+
meta: HeaderMetaSchema,
|
|
6069
|
+
subject: SubjectSchema,
|
|
6070
|
+
kind: z3.literal("gate"),
|
|
6071
|
+
...envelopeTail,
|
|
6072
|
+
event: z3.literal("summary"),
|
|
6073
|
+
ran: z3.number().int().nonnegative(),
|
|
6074
|
+
passed: z3.number().int().nonnegative(),
|
|
6075
|
+
failed: z3.number().int().nonnegative(),
|
|
6076
|
+
skipped: z3.number().int().nonnegative(),
|
|
6077
|
+
failed_checks: z3.array(z3.string())
|
|
5944
6078
|
}).strict()
|
|
5945
6079
|
]);
|
|
5946
|
-
var OperationResultSchema =
|
|
6080
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
5947
6081
|
var operationShared = {
|
|
5948
6082
|
meta: HeaderMetaSchema,
|
|
5949
6083
|
subject: SubjectSchema,
|
|
5950
|
-
kind:
|
|
6084
|
+
kind: z3.literal("operation"),
|
|
5951
6085
|
...envelopeTail,
|
|
5952
|
-
operation:
|
|
5953
|
-
target:
|
|
6086
|
+
operation: z3.string(),
|
|
6087
|
+
target: z3.string().nullable()
|
|
5954
6088
|
};
|
|
5955
|
-
var OperationEventSchema =
|
|
5956
|
-
|
|
6089
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6090
|
+
z3.object({
|
|
5957
6091
|
...operationShared,
|
|
5958
|
-
event:
|
|
6092
|
+
event: z3.literal("completed"),
|
|
5959
6093
|
result: OperationResultSchema,
|
|
5960
|
-
error_class:
|
|
6094
|
+
error_class: z3.string().nullable(),
|
|
6095
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
5961
6096
|
}).strict()
|
|
5962
6097
|
]);
|
|
5963
|
-
var UsageUnitsSchema =
|
|
5964
|
-
input:
|
|
5965
|
-
output:
|
|
5966
|
-
cache:
|
|
6098
|
+
var UsageUnitsSchema = z3.object({
|
|
6099
|
+
input: z3.number().nonnegative().nullable(),
|
|
6100
|
+
output: z3.number().nonnegative().nullable(),
|
|
6101
|
+
cache: z3.number().nonnegative().nullable()
|
|
5967
6102
|
}).strict();
|
|
5968
6103
|
var usageShared = {
|
|
5969
6104
|
meta: HeaderMetaSchema,
|
|
5970
6105
|
subject: SubjectSchema,
|
|
5971
|
-
kind:
|
|
6106
|
+
kind: z3.literal("usage"),
|
|
5972
6107
|
...envelopeTail,
|
|
5973
|
-
model:
|
|
5974
|
-
source:
|
|
5975
|
-
semantics:
|
|
6108
|
+
model: z3.string().nullable(),
|
|
6109
|
+
source: z3.string(),
|
|
6110
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
5976
6111
|
};
|
|
5977
|
-
var UsageEventSchema =
|
|
5978
|
-
|
|
6112
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6113
|
+
z3.object({
|
|
5979
6114
|
...usageShared,
|
|
5980
|
-
event:
|
|
6115
|
+
event: z3.literal("observed"),
|
|
5981
6116
|
units: UsageUnitsSchema,
|
|
5982
|
-
unknown_reason:
|
|
6117
|
+
unknown_reason: z3.string().nullable()
|
|
5983
6118
|
}).strict()
|
|
5984
6119
|
]);
|
|
5985
|
-
var RoleAttemptOutcomeSchema =
|
|
6120
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
5986
6121
|
"completed",
|
|
5987
6122
|
"incomplete",
|
|
5988
6123
|
"infrastructure_failed",
|
|
@@ -5993,17 +6128,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
5993
6128
|
var roleAttemptShared = {
|
|
5994
6129
|
meta: HeaderMetaSchema,
|
|
5995
6130
|
subject: SubjectSchema,
|
|
5996
|
-
kind:
|
|
6131
|
+
kind: z3.literal("role_attempt"),
|
|
5997
6132
|
...envelopeTail,
|
|
5998
|
-
actor:
|
|
5999
|
-
attempt:
|
|
6000
|
-
effect_id:
|
|
6001
|
-
model:
|
|
6133
|
+
actor: z3.string().nullable(),
|
|
6134
|
+
attempt: z3.number().int().nullable(),
|
|
6135
|
+
effect_id: z3.string(),
|
|
6136
|
+
model: z3.string().nullable()
|
|
6002
6137
|
};
|
|
6003
|
-
var RoleAttemptEventSchema =
|
|
6004
|
-
|
|
6138
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6139
|
+
z3.object({
|
|
6005
6140
|
...roleAttemptShared,
|
|
6006
|
-
event:
|
|
6141
|
+
event: z3.literal("attempted"),
|
|
6007
6142
|
outcome: RoleAttemptOutcomeSchema,
|
|
6008
6143
|
usage: dispatchUsageField
|
|
6009
6144
|
}).strict()
|
|
@@ -6011,42 +6146,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
6011
6146
|
var handoffShared = {
|
|
6012
6147
|
meta: HeaderMetaSchema,
|
|
6013
6148
|
subject: SubjectSchema,
|
|
6014
|
-
kind:
|
|
6149
|
+
kind: z3.literal("handoff"),
|
|
6015
6150
|
...envelopeTail,
|
|
6016
|
-
class:
|
|
6017
|
-
reason:
|
|
6151
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6152
|
+
reason: z3.string()
|
|
6018
6153
|
};
|
|
6019
|
-
var HandoffEventSchema =
|
|
6020
|
-
|
|
6154
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6155
|
+
z3.object({
|
|
6021
6156
|
...handoffShared,
|
|
6022
|
-
event:
|
|
6023
|
-
requested_decision:
|
|
6157
|
+
event: z3.literal("raised"),
|
|
6158
|
+
requested_decision: z3.string().nullable()
|
|
6024
6159
|
}).strict(),
|
|
6025
|
-
|
|
6160
|
+
z3.object({
|
|
6026
6161
|
...handoffShared,
|
|
6027
|
-
event:
|
|
6028
|
-
resolution:
|
|
6029
|
-
resolved_by:
|
|
6162
|
+
event: z3.literal("resolved"),
|
|
6163
|
+
resolution: z3.string().nullable(),
|
|
6164
|
+
resolved_by: z3.string().nullable()
|
|
6030
6165
|
}).strict()
|
|
6031
6166
|
]);
|
|
6032
|
-
var EffectTargetSchema =
|
|
6033
|
-
kind:
|
|
6034
|
-
ref:
|
|
6167
|
+
var EffectTargetSchema = z3.object({
|
|
6168
|
+
kind: z3.string(),
|
|
6169
|
+
ref: z3.string()
|
|
6035
6170
|
}).strict();
|
|
6036
6171
|
var effectShared = {
|
|
6037
6172
|
meta: HeaderMetaSchema,
|
|
6038
6173
|
subject: SubjectSchema,
|
|
6039
|
-
kind:
|
|
6174
|
+
kind: z3.literal("effect"),
|
|
6040
6175
|
...envelopeTail,
|
|
6041
|
-
effect_id:
|
|
6176
|
+
effect_id: z3.string(),
|
|
6042
6177
|
target: EffectTargetSchema
|
|
6043
6178
|
};
|
|
6044
|
-
var EffectEventSchema =
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6179
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6180
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6181
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6182
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6183
|
+
]);
|
|
6184
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6185
|
+
var customShared = {
|
|
6186
|
+
meta: HeaderMetaV3Schema,
|
|
6187
|
+
subject: SubjectSchema,
|
|
6188
|
+
kind: z3.literal("custom"),
|
|
6189
|
+
...envelopeTail
|
|
6190
|
+
};
|
|
6191
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6192
|
+
z3.object({
|
|
6193
|
+
...customShared,
|
|
6194
|
+
event: z3.literal("recorded"),
|
|
6195
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6196
|
+
fields: z3.record(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH).regex(CUSTOM_FIELD_NAME_PATTERN), CustomFieldValueSchema).refine((f) => Object.keys(f).length <= CUSTOM_EVENT_MAX_FIELDS, {
|
|
6197
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6198
|
+
})
|
|
6199
|
+
}).strict()
|
|
6048
6200
|
]);
|
|
6049
|
-
var LogEventSchema =
|
|
6201
|
+
var LogEventSchema = z3.union([
|
|
6050
6202
|
DispatchEventSchema,
|
|
6051
6203
|
DevReviewLoopEventSchema,
|
|
6052
6204
|
ForgeWriteEventSchema,
|
|
@@ -6055,10 +6207,11 @@ var LogEventSchema = z2.union([
|
|
|
6055
6207
|
UsageEventSchema,
|
|
6056
6208
|
RoleAttemptEventSchema,
|
|
6057
6209
|
HandoffEventSchema,
|
|
6058
|
-
EffectEventSchema
|
|
6210
|
+
EffectEventSchema,
|
|
6211
|
+
CustomEventSchema
|
|
6059
6212
|
]);
|
|
6060
|
-
|
|
6061
6213
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6214
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6062
6215
|
function isRole(value) {
|
|
6063
6216
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6064
6217
|
}
|
|
@@ -6095,18 +6248,27 @@ function roundFromEnv(round) {
|
|
|
6095
6248
|
const n = Number(round);
|
|
6096
6249
|
return Number.isInteger(n) ? n : undefined;
|
|
6097
6250
|
}
|
|
6251
|
+
function prFromEnv(pr) {
|
|
6252
|
+
if (pr === undefined || pr === "")
|
|
6253
|
+
return;
|
|
6254
|
+
const n = Number(pr);
|
|
6255
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6256
|
+
}
|
|
6098
6257
|
function buildHeader(input) {
|
|
6099
6258
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6100
6259
|
const round = roundFromEnv(input.env.round);
|
|
6260
|
+
const pr = prFromEnv(input.env.pr);
|
|
6101
6261
|
const subject = {
|
|
6102
6262
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6103
6263
|
role,
|
|
6104
6264
|
...round !== undefined ? { round } : {},
|
|
6265
|
+
...pr !== undefined ? { pr } : {},
|
|
6105
6266
|
...input.subject ?? {}
|
|
6106
6267
|
};
|
|
6268
|
+
const issue = subject.issue;
|
|
6107
6269
|
return {
|
|
6108
6270
|
meta: {
|
|
6109
|
-
schema:
|
|
6271
|
+
schema: 3,
|
|
6110
6272
|
ts: input.now.toISOString(),
|
|
6111
6273
|
run_id: input.runId,
|
|
6112
6274
|
seq: input.seq,
|
|
@@ -6129,7 +6291,19 @@ function buildHeader(input) {
|
|
|
6129
6291
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6130
6292
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6131
6293
|
},
|
|
6132
|
-
provenance: provenanceFor(input)
|
|
6294
|
+
provenance: provenanceFor(input),
|
|
6295
|
+
work: {
|
|
6296
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6297
|
+
repo: input.repo,
|
|
6298
|
+
change: null,
|
|
6299
|
+
revision: null
|
|
6300
|
+
},
|
|
6301
|
+
flow: {
|
|
6302
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6303
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6304
|
+
},
|
|
6305
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6306
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6133
6307
|
},
|
|
6134
6308
|
subject
|
|
6135
6309
|
};
|
|
@@ -6172,7 +6346,7 @@ function redact(value, home) {
|
|
|
6172
6346
|
return value;
|
|
6173
6347
|
}
|
|
6174
6348
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6175
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6349
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6176
6350
|
function metaOf(obj) {
|
|
6177
6351
|
if (obj === null || typeof obj !== "object")
|
|
6178
6352
|
return null;
|
|
@@ -6238,7 +6412,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6238
6412
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6239
6413
|
}
|
|
6240
6414
|
const redacted = redact(event, home);
|
|
6241
|
-
const provenance = version
|
|
6415
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6242
6416
|
return {
|
|
6243
6417
|
status: "ok",
|
|
6244
6418
|
identity,
|
|
@@ -6251,163 +6425,172 @@ function classifyStoredLine(raw, home) {
|
|
|
6251
6425
|
};
|
|
6252
6426
|
}
|
|
6253
6427
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6254
|
-
import { z as
|
|
6255
|
-
var isoTimestamp =
|
|
6256
|
-
var taskId =
|
|
6257
|
-
var epochNumber =
|
|
6258
|
-
var RunRecordSchema =
|
|
6259
|
-
version:
|
|
6260
|
-
kind:
|
|
6428
|
+
import { z as z4 } from "zod";
|
|
6429
|
+
var isoTimestamp = z4.string().min(1);
|
|
6430
|
+
var taskId = z4.number().int().positive();
|
|
6431
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6432
|
+
var RunRecordSchema = z4.object({
|
|
6433
|
+
version: z4.literal(1),
|
|
6434
|
+
kind: z4.literal("run"),
|
|
6261
6435
|
task: taskId,
|
|
6262
|
-
runId:
|
|
6263
|
-
pid:
|
|
6264
|
-
host:
|
|
6436
|
+
runId: z4.string().min(1),
|
|
6437
|
+
pid: z4.number().int().positive(),
|
|
6438
|
+
host: z4.string().min(1),
|
|
6265
6439
|
startedAt: isoTimestamp,
|
|
6266
|
-
childStartedAt:
|
|
6267
|
-
childCommand:
|
|
6440
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6441
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6268
6442
|
}).strict();
|
|
6269
|
-
var InputRecordSchema =
|
|
6270
|
-
version:
|
|
6271
|
-
kind:
|
|
6443
|
+
var InputRecordSchema = z4.object({
|
|
6444
|
+
version: z4.literal(1),
|
|
6445
|
+
kind: z4.literal("input"),
|
|
6272
6446
|
task: taskId,
|
|
6273
|
-
runId:
|
|
6274
|
-
source:
|
|
6275
|
-
pr:
|
|
6276
|
-
round:
|
|
6447
|
+
runId: z4.string().min(1),
|
|
6448
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6449
|
+
pr: z4.number().int().positive().nullable(),
|
|
6450
|
+
round: z4.number().int().nonnegative(),
|
|
6277
6451
|
recordedAt: isoTimestamp
|
|
6278
6452
|
}).strict();
|
|
6279
|
-
var OwnershipRecordSchema =
|
|
6280
|
-
version:
|
|
6281
|
-
kind:
|
|
6453
|
+
var OwnershipRecordSchema = z4.object({
|
|
6454
|
+
version: z4.literal(1),
|
|
6455
|
+
kind: z4.literal("ownership"),
|
|
6282
6456
|
task: taskId,
|
|
6283
6457
|
epoch: epochNumber,
|
|
6284
|
-
ownerId:
|
|
6285
|
-
pid:
|
|
6286
|
-
host:
|
|
6458
|
+
ownerId: z4.string().min(1),
|
|
6459
|
+
pid: z4.number().int().positive(),
|
|
6460
|
+
host: z4.string().min(1),
|
|
6287
6461
|
acquiredAt: isoTimestamp
|
|
6288
6462
|
}).strict();
|
|
6289
|
-
var TransitionRecordSchema =
|
|
6290
|
-
version:
|
|
6291
|
-
kind:
|
|
6463
|
+
var TransitionRecordSchema = z4.object({
|
|
6464
|
+
version: z4.literal(1),
|
|
6465
|
+
kind: z4.literal("transition"),
|
|
6292
6466
|
task: taskId,
|
|
6293
6467
|
epoch: epochNumber,
|
|
6294
|
-
seq:
|
|
6295
|
-
from:
|
|
6296
|
-
to:
|
|
6297
|
-
detail:
|
|
6468
|
+
seq: z4.number().int().nonnegative(),
|
|
6469
|
+
from: z4.string().min(1),
|
|
6470
|
+
to: z4.string().min(1),
|
|
6471
|
+
detail: z4.string().optional(),
|
|
6298
6472
|
at: isoTimestamp
|
|
6299
6473
|
}).strict();
|
|
6300
|
-
var ManifestRecordSchema =
|
|
6301
|
-
version:
|
|
6302
|
-
kind:
|
|
6474
|
+
var ManifestRecordSchema = z4.object({
|
|
6475
|
+
version: z4.literal(1),
|
|
6476
|
+
kind: z4.literal("manifest"),
|
|
6303
6477
|
task: taskId,
|
|
6304
6478
|
round: epochNumber,
|
|
6305
|
-
repository:
|
|
6306
|
-
pr:
|
|
6307
|
-
branch:
|
|
6308
|
-
baseSha:
|
|
6309
|
-
headSha:
|
|
6310
|
-
briefHash:
|
|
6311
|
-
objectivesVersion:
|
|
6479
|
+
repository: z4.string().min(1),
|
|
6480
|
+
pr: z4.number().int().positive(),
|
|
6481
|
+
branch: z4.string().min(1),
|
|
6482
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6483
|
+
headSha: z4.string().min(1),
|
|
6484
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6485
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6312
6486
|
rulingOrdinal: epochNumber,
|
|
6313
|
-
policyDigest:
|
|
6487
|
+
policyDigest: z4.string().min(1),
|
|
6314
6488
|
recordedAt: isoTimestamp
|
|
6315
6489
|
}).strict();
|
|
6316
|
-
var roundHeadIdentity =
|
|
6317
|
-
var LoopBudgetsSchema =
|
|
6318
|
-
mechanicalRetries:
|
|
6319
|
-
reviewRounds:
|
|
6320
|
-
infrastructureRetries:
|
|
6490
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6491
|
+
var LoopBudgetsSchema = z4.object({
|
|
6492
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6493
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6494
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6321
6495
|
}).strict();
|
|
6322
|
-
var LoopStateRecordSchema =
|
|
6323
|
-
version:
|
|
6324
|
-
kind:
|
|
6496
|
+
var LoopStateRecordSchema = z4.object({
|
|
6497
|
+
version: z4.literal(1),
|
|
6498
|
+
kind: z4.literal("loop_state"),
|
|
6325
6499
|
task: taskId,
|
|
6326
|
-
round:
|
|
6327
|
-
phase:
|
|
6328
|
-
pauseReason:
|
|
6500
|
+
round: z4.number().int().positive(),
|
|
6501
|
+
phase: z4.string().min(1),
|
|
6502
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6329
6503
|
budgets: LoopBudgetsSchema,
|
|
6330
6504
|
heldResult: roundHeadIdentity.nullable(),
|
|
6331
6505
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6506
|
+
repeatMemory: z4.object({
|
|
6507
|
+
blockingFindings: z4.array(z4.string()),
|
|
6508
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6509
|
+
}).strict().optional(),
|
|
6510
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6511
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6512
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6332
6513
|
recordedAt: isoTimestamp
|
|
6333
6514
|
}).strict();
|
|
6334
|
-
var EffectRecordSchema =
|
|
6335
|
-
version:
|
|
6336
|
-
kind:
|
|
6515
|
+
var EffectRecordSchema = z4.object({
|
|
6516
|
+
version: z4.literal(1),
|
|
6517
|
+
kind: z4.literal("effect"),
|
|
6337
6518
|
task: taskId,
|
|
6338
|
-
key:
|
|
6339
|
-
operation:
|
|
6340
|
-
target:
|
|
6341
|
-
inputVersion:
|
|
6342
|
-
payloadDigest:
|
|
6343
|
-
status:
|
|
6344
|
-
url:
|
|
6519
|
+
key: z4.string().min(1),
|
|
6520
|
+
operation: z4.string().min(1),
|
|
6521
|
+
target: z4.string().min(1),
|
|
6522
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6523
|
+
payloadDigest: z4.string().min(1),
|
|
6524
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6525
|
+
url: z4.string().optional(),
|
|
6345
6526
|
recordedAt: isoTimestamp
|
|
6346
6527
|
}).strict();
|
|
6347
|
-
var EscalationRecordSchema =
|
|
6348
|
-
version:
|
|
6349
|
-
kind:
|
|
6528
|
+
var EscalationRecordSchema = z4.object({
|
|
6529
|
+
version: z4.literal(1),
|
|
6530
|
+
kind: z4.literal("escalation"),
|
|
6350
6531
|
task: taskId,
|
|
6351
|
-
escalationId:
|
|
6532
|
+
escalationId: z4.string().min(1),
|
|
6352
6533
|
round: epochNumber,
|
|
6353
|
-
head:
|
|
6354
|
-
branch:
|
|
6355
|
-
pr:
|
|
6356
|
-
runId:
|
|
6357
|
-
pid:
|
|
6358
|
-
host:
|
|
6359
|
-
agent:
|
|
6360
|
-
reason:
|
|
6361
|
-
detail:
|
|
6362
|
-
evidence:
|
|
6363
|
-
attemptedRecovery:
|
|
6364
|
-
requestedDecision:
|
|
6365
|
-
recipient:
|
|
6366
|
-
briefHash:
|
|
6367
|
-
objectivesVersion:
|
|
6534
|
+
head: z4.string().min(1),
|
|
6535
|
+
branch: z4.string().min(1),
|
|
6536
|
+
pr: z4.number().int().positive().nullable(),
|
|
6537
|
+
runId: z4.string().min(1),
|
|
6538
|
+
pid: z4.number().int().positive(),
|
|
6539
|
+
host: z4.string().min(1),
|
|
6540
|
+
agent: z4.string().min(1).optional(),
|
|
6541
|
+
reason: z4.string().min(1),
|
|
6542
|
+
detail: z4.string().optional(),
|
|
6543
|
+
evidence: z4.string().optional(),
|
|
6544
|
+
attemptedRecovery: z4.string().min(1),
|
|
6545
|
+
requestedDecision: z4.string().min(1),
|
|
6546
|
+
recipient: z4.string().min(1),
|
|
6547
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6548
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6368
6549
|
rulingOrdinal: epochNumber,
|
|
6369
|
-
policyDigest:
|
|
6550
|
+
policyDigest: z4.string().min(1),
|
|
6370
6551
|
recordedAt: isoTimestamp
|
|
6371
6552
|
}).strict();
|
|
6372
|
-
var ResolutionRecordSchema =
|
|
6373
|
-
version:
|
|
6374
|
-
kind:
|
|
6553
|
+
var ResolutionRecordSchema = z4.object({
|
|
6554
|
+
version: z4.literal(1),
|
|
6555
|
+
kind: z4.literal("resolution"),
|
|
6375
6556
|
task: taskId,
|
|
6376
|
-
escalationId:
|
|
6377
|
-
decision:
|
|
6378
|
-
authenticatedBy:
|
|
6379
|
-
authenticatedFrom:
|
|
6557
|
+
escalationId: z4.string().min(1),
|
|
6558
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6559
|
+
authenticatedBy: z4.string().min(1),
|
|
6560
|
+
authenticatedFrom: z4.string().min(1),
|
|
6380
6561
|
consumedAt: isoTimestamp
|
|
6381
6562
|
}).strict();
|
|
6563
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6564
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6382
6565
|
// src/lib/config.ts
|
|
6383
6566
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6384
6567
|
import { promisify as promisify4 } from "node:util";
|
|
6385
6568
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6386
6569
|
import { homedir } from "node:os";
|
|
6387
6570
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6388
|
-
import { z as
|
|
6571
|
+
import { z as z5 } from "zod";
|
|
6389
6572
|
|
|
6390
6573
|
// src/lib/agent-vendors.ts
|
|
6391
6574
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
6392
6575
|
|
|
6393
6576
|
// src/lib/config.ts
|
|
6394
|
-
var EnvEntrySchema =
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6577
|
+
var EnvEntrySchema = z5.union([
|
|
6578
|
+
z5.literal(true),
|
|
6579
|
+
z5.object({ optional: z5.literal(true) }),
|
|
6580
|
+
z5.object({ anyOf: z5.array(z5.string()).min(2) }),
|
|
6581
|
+
z5.string()
|
|
6399
6582
|
]);
|
|
6400
|
-
var CheckEntrySchema =
|
|
6401
|
-
run:
|
|
6402
|
-
scope:
|
|
6403
|
-
include:
|
|
6404
|
-
args:
|
|
6405
|
-
timeoutMs:
|
|
6406
|
-
env:
|
|
6407
|
-
requiresOpenPr:
|
|
6408
|
-
ownWorkflow:
|
|
6409
|
-
principalOwed:
|
|
6410
|
-
validates:
|
|
6583
|
+
var CheckEntrySchema = z5.object({
|
|
6584
|
+
run: z5.string(),
|
|
6585
|
+
scope: z5.enum(["diff", "full"]),
|
|
6586
|
+
include: z5.array(z5.string()).optional(),
|
|
6587
|
+
args: z5.array(z5.string()).optional(),
|
|
6588
|
+
timeoutMs: z5.number().optional(),
|
|
6589
|
+
env: z5.record(z5.string(), EnvEntrySchema).optional(),
|
|
6590
|
+
requiresOpenPr: z5.boolean().optional(),
|
|
6591
|
+
ownWorkflow: z5.boolean().optional(),
|
|
6592
|
+
principalOwed: z5.literal(true).optional(),
|
|
6593
|
+
validates: z5.enum(["body", "issue"]).optional()
|
|
6411
6594
|
}).superRefine((entry, ctx) => {
|
|
6412
6595
|
if (!entry.env)
|
|
6413
6596
|
return;
|
|
@@ -6417,22 +6600,22 @@ var CheckEntrySchema = z4.object({
|
|
|
6417
6600
|
const members = value.anyOf;
|
|
6418
6601
|
if (new Set(members).size !== members.length) {
|
|
6419
6602
|
ctx.addIssue({
|
|
6420
|
-
code:
|
|
6603
|
+
code: z5.ZodIssueCode.custom,
|
|
6421
6604
|
message: `env.${key}.anyOf has duplicate members`,
|
|
6422
6605
|
path: ["env", key, "anyOf"]
|
|
6423
6606
|
});
|
|
6424
6607
|
}
|
|
6425
6608
|
if (!members.includes(key)) {
|
|
6426
6609
|
ctx.addIssue({
|
|
6427
|
-
code:
|
|
6610
|
+
code: z5.ZodIssueCode.custom,
|
|
6428
6611
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
6429
6612
|
path: ["env", key, "anyOf"]
|
|
6430
6613
|
});
|
|
6431
6614
|
}
|
|
6432
6615
|
}
|
|
6433
6616
|
});
|
|
6434
|
-
var RoleEntrySchema =
|
|
6435
|
-
contract:
|
|
6617
|
+
var RoleEntrySchema = z5.object({
|
|
6618
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
6436
6619
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
6437
6620
|
})
|
|
6438
6621
|
});
|
|
@@ -6456,17 +6639,17 @@ var BRIEF_BUILTINS = [
|
|
|
6456
6639
|
"briefSections",
|
|
6457
6640
|
"milestoneShape"
|
|
6458
6641
|
];
|
|
6459
|
-
var BriefSectionSchema =
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6642
|
+
var BriefSectionSchema = z5.union([
|
|
6643
|
+
z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
|
|
6644
|
+
z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
|
|
6645
|
+
z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
|
|
6646
|
+
z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
|
|
6464
6647
|
]);
|
|
6465
|
-
var BriefSchemaSchema =
|
|
6466
|
-
pr:
|
|
6467
|
-
issue:
|
|
6468
|
-
milestone:
|
|
6469
|
-
ack:
|
|
6648
|
+
var BriefSchemaSchema = z5.object({
|
|
6649
|
+
pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6650
|
+
issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6651
|
+
milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6652
|
+
ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
|
|
6470
6653
|
});
|
|
6471
6654
|
function isSafeRepoRelPath(p) {
|
|
6472
6655
|
if (p.length === 0)
|
|
@@ -6475,7 +6658,7 @@ function isSafeRepoRelPath(p) {
|
|
|
6475
6658
|
return false;
|
|
6476
6659
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
6477
6660
|
}
|
|
6478
|
-
var SafeRepoRelPath =
|
|
6661
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
6479
6662
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
6480
6663
|
});
|
|
6481
6664
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -6485,22 +6668,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
6485
6668
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
6486
6669
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
6487
6670
|
});
|
|
6488
|
-
var ManagedBlockRecordSchema =
|
|
6671
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
6489
6672
|
path: ManagedHookBlockPath,
|
|
6490
|
-
marker:
|
|
6491
|
-
comment:
|
|
6673
|
+
marker: z5.string(),
|
|
6674
|
+
comment: z5.enum(["hash", "html"])
|
|
6492
6675
|
});
|
|
6493
|
-
var ManagedManifestSchema =
|
|
6494
|
-
version:
|
|
6495
|
-
files:
|
|
6496
|
-
blocks:
|
|
6497
|
-
labels:
|
|
6498
|
-
agents:
|
|
6676
|
+
var ManagedManifestSchema = z5.object({
|
|
6677
|
+
version: z5.number().int().positive(),
|
|
6678
|
+
files: z5.array(SafeRepoRelPath),
|
|
6679
|
+
blocks: z5.array(ManagedBlockRecordSchema),
|
|
6680
|
+
labels: z5.array(z5.string()),
|
|
6681
|
+
agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
|
|
6499
6682
|
});
|
|
6500
|
-
var ProjectEntrySchema =
|
|
6501
|
-
name:
|
|
6502
|
-
description:
|
|
6503
|
-
path:
|
|
6683
|
+
var ProjectEntrySchema = z5.object({
|
|
6684
|
+
name: z5.string().min(1),
|
|
6685
|
+
description: z5.string().min(1).optional(),
|
|
6686
|
+
path: z5.string().min(1).optional()
|
|
6504
6687
|
});
|
|
6505
6688
|
function parseTokensCollectDeclaration(value) {
|
|
6506
6689
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -6511,87 +6694,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
6511
6694
|
return null;
|
|
6512
6695
|
return { interpreter, script };
|
|
6513
6696
|
}
|
|
6514
|
-
var VinayaConfigSchema =
|
|
6515
|
-
rings:
|
|
6516
|
-
ring1_forgeWriteInterception:
|
|
6517
|
-
ring2_asyncAudits:
|
|
6697
|
+
var VinayaConfigSchema = z5.object({
|
|
6698
|
+
rings: z5.object({
|
|
6699
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
6700
|
+
ring2_asyncAudits: z5.boolean()
|
|
6518
6701
|
}).optional(),
|
|
6519
|
-
checks:
|
|
6520
|
-
roles:
|
|
6702
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
6703
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
6521
6704
|
briefSchema: BriefSchemaSchema.optional(),
|
|
6522
6705
|
managed: ManagedManifestSchema.optional(),
|
|
6523
|
-
principals:
|
|
6524
|
-
releaseActor:
|
|
6525
|
-
ci:
|
|
6526
|
-
tokens:
|
|
6527
|
-
collect:
|
|
6706
|
+
principals: z5.array(z5.string()).min(1).optional(),
|
|
6707
|
+
releaseActor: z5.string().min(1).optional(),
|
|
6708
|
+
ci: z5.object({ setup: z5.string().min(1) }).optional(),
|
|
6709
|
+
tokens: z5.object({
|
|
6710
|
+
collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
6528
6711
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
6529
6712
|
})
|
|
6530
6713
|
}).optional(),
|
|
6531
|
-
blastRadius:
|
|
6532
|
-
proseGates:
|
|
6533
|
-
doctrineRoot:
|
|
6534
|
-
readerFacingPrefix:
|
|
6535
|
-
readerFacingSuffix:
|
|
6536
|
-
legacySlugDir:
|
|
6537
|
-
sourceComments:
|
|
6538
|
-
globs:
|
|
6539
|
-
allowlist:
|
|
6540
|
-
severity:
|
|
6714
|
+
blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
|
|
6715
|
+
proseGates: z5.object({
|
|
6716
|
+
doctrineRoot: z5.string().min(1).optional(),
|
|
6717
|
+
readerFacingPrefix: z5.string().min(1).optional(),
|
|
6718
|
+
readerFacingSuffix: z5.string().min(1).optional(),
|
|
6719
|
+
legacySlugDir: z5.string().min(1).optional(),
|
|
6720
|
+
sourceComments: z5.object({
|
|
6721
|
+
globs: z5.array(z5.string().min(1)).optional(),
|
|
6722
|
+
allowlist: z5.array(z5.string().min(1)).optional(),
|
|
6723
|
+
severity: z5.enum(["warning", "error"]).optional()
|
|
6541
6724
|
}).optional(),
|
|
6542
|
-
specGrandfather:
|
|
6543
|
-
specPaths:
|
|
6725
|
+
specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
|
|
6726
|
+
specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6544
6727
|
message: "must be a repository-relative path, not an absolute one"
|
|
6545
6728
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6546
6729
|
message: "must stay inside the repository — no `..` segment"
|
|
6547
6730
|
})).optional()
|
|
6548
6731
|
}).optional(),
|
|
6549
|
-
projects:
|
|
6550
|
-
dispatch:
|
|
6551
|
-
timeoutMs:
|
|
6552
|
-
killGraceMs:
|
|
6553
|
-
agent:
|
|
6554
|
-
|
|
6732
|
+
projects: z5.array(ProjectEntrySchema).optional(),
|
|
6733
|
+
dispatch: z5.object({
|
|
6734
|
+
timeoutMs: z5.number().int().positive().optional(),
|
|
6735
|
+
killGraceMs: z5.number().int().positive().optional(),
|
|
6736
|
+
agent: z5.enum(["claude", "codex", "gemini"]).optional()
|
|
6737
|
+
}).optional(),
|
|
6738
|
+
reviewPolicy: z5.object({
|
|
6739
|
+
codeReviewThreshold: z5.string().min(1).optional(),
|
|
6740
|
+
securityThreshold: z5.string().min(1).optional(),
|
|
6741
|
+
maxRounds: z5.number().optional(),
|
|
6742
|
+
maxTaskMinutes: z5.number().optional()
|
|
6555
6743
|
}).optional(),
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
securityThreshold: z4.string().min(1).optional(),
|
|
6559
|
-
maxRounds: z4.number().optional()
|
|
6744
|
+
securityScan: z5.object({
|
|
6745
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
6560
6746
|
}).optional(),
|
|
6561
|
-
gateCutovers:
|
|
6562
|
-
objectivesSinceIssue:
|
|
6563
|
-
briefSectionsSinceIssue:
|
|
6564
|
-
documentationSinceIssue:
|
|
6565
|
-
briefRulesSincePr:
|
|
6566
|
-
agentBoxesRefusedSincePr:
|
|
6747
|
+
gateCutovers: z5.object({
|
|
6748
|
+
objectivesSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6749
|
+
briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6750
|
+
documentationSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6751
|
+
briefRulesSincePr: z5.number().int().nonnegative().optional(),
|
|
6752
|
+
agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
|
|
6567
6753
|
}).optional(),
|
|
6568
|
-
|
|
6569
|
-
|
|
6754
|
+
planning: z5.object({
|
|
6755
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
6570
6756
|
}).optional(),
|
|
6571
|
-
|
|
6572
|
-
|
|
6757
|
+
prePush: z5.object({
|
|
6758
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
6759
|
+
}).optional(),
|
|
6760
|
+
report: z5.object({
|
|
6761
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
6573
6762
|
}).superRefine((report, ctx) => {
|
|
6574
6763
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6575
6764
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6576
6765
|
ctx.addIssue({
|
|
6577
|
-
code:
|
|
6766
|
+
code: z5.ZodIssueCode.custom,
|
|
6578
6767
|
path: ["commandTimeoutMs"],
|
|
6579
6768
|
message: "must be at most 3600000 (1 hour)"
|
|
6580
6769
|
});
|
|
6581
6770
|
}
|
|
6582
6771
|
}).optional(),
|
|
6583
|
-
logPublish:
|
|
6772
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
6584
6773
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6585
6774
|
}),
|
|
6586
|
-
runtimeDir:
|
|
6587
|
-
logs:
|
|
6588
|
-
folder:
|
|
6589
|
-
url:
|
|
6590
|
-
headers:
|
|
6775
|
+
runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6776
|
+
logs: z5.object({
|
|
6777
|
+
folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6778
|
+
url: z5.string().url().optional(),
|
|
6779
|
+
headers: z5.record(z5.string()).optional(),
|
|
6780
|
+
readHeaders: z5.record(z5.string()).optional(),
|
|
6781
|
+
events: CustomEventDeclarationsSchema.optional()
|
|
6591
6782
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6592
6783
|
message: "logs: set at most one of folder/url"
|
|
6593
6784
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6594
6785
|
message: "logs: headers requires url"
|
|
6786
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
6787
|
+
message: "logs: readHeaders requires url"
|
|
6595
6788
|
}).optional()
|
|
6596
6789
|
});
|
|
6597
6790
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
@@ -6696,10 +6889,15 @@ function resolveReviewPolicy(config) {
|
|
|
6696
6889
|
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6697
6890
|
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6698
6891
|
}
|
|
6892
|
+
const maxTaskMinutes = raw.maxTaskMinutes ?? DEFAULT_REVIEW_POLICY.maxTaskMinutes;
|
|
6893
|
+
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
6894
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
6895
|
+
}
|
|
6699
6896
|
return {
|
|
6700
6897
|
codeReviewThreshold,
|
|
6701
6898
|
securityThreshold,
|
|
6702
|
-
maxRounds
|
|
6899
|
+
maxRounds,
|
|
6900
|
+
maxTaskMinutes
|
|
6703
6901
|
};
|
|
6704
6902
|
}
|
|
6705
6903
|
function resolveGateCutovers(config) {
|
|
@@ -7063,7 +7261,7 @@ var COMMANDS = [
|
|
|
7063
7261
|
"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.",
|
|
7064
7262
|
"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.",
|
|
7065
7263
|
"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.",
|
|
7066
|
-
"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
|
|
7264
|
+
"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 working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
7067
7265
|
],
|
|
7068
7266
|
status: "shipped"
|
|
7069
7267
|
},
|
|
@@ -7148,13 +7346,14 @@ var COMMANDS = [
|
|
|
7148
7346
|
},
|
|
7149
7347
|
{
|
|
7150
7348
|
flag: "--push",
|
|
7151
|
-
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE
|
|
7349
|
+
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE region changed. Mutually exclusive with --write."
|
|
7152
7350
|
}
|
|
7153
7351
|
],
|
|
7154
7352
|
details: [
|
|
7155
7353
|
"Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
|
|
7156
7354
|
"With no `--write`/`--push`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write`/`--push` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` (or `--push`) from carrying a failing suite onto the forge.",
|
|
7157
|
-
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number.
|
|
7355
|
+
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside that one anchored region changed.",
|
|
7356
|
+
"A pull-request body carries no token table, and this command writes none: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event instead. A body that still carries an older run's table keeps it byte for byte — it is prose this command does not own, and a change inside it reads as real drift."
|
|
7158
7357
|
],
|
|
7159
7358
|
status: "shipped"
|
|
7160
7359
|
},
|
|
@@ -7179,7 +7378,7 @@ var COMMANDS = [
|
|
|
7179
7378
|
"Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
|
|
7180
7379
|
"Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
|
|
7181
7380
|
"Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
|
|
7182
|
-
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read
|
|
7381
|
+
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read: every other section of the body is prose no regeneration reproduces. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
|
|
7183
7382
|
],
|
|
7184
7383
|
status: "shipped"
|
|
7185
7384
|
},
|
|
@@ -7350,7 +7549,7 @@ var COMMANDS = [
|
|
|
7350
7549
|
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
7351
7550
|
{
|
|
7352
7551
|
flag: "--secrets-evidence-file",
|
|
7353
|
-
description: 'security only: required whenever `--secrets` claims "none found" — the
|
|
7552
|
+
description: 'security only: required whenever `--secrets` claims "none found" — the passing `atta-labs/secret-scan` check result on the judged head that backs it; never run or paste the scanner'
|
|
7354
7553
|
},
|
|
7355
7554
|
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
7356
7555
|
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
@@ -7458,7 +7657,20 @@ var COMMANDS = [
|
|
|
7458
7657
|
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7459
7658
|
details: [
|
|
7460
7659
|
"Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
|
|
7461
|
-
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes
|
|
7660
|
+
"Once every task Issue is closed, prompts for confirmation (unless `--yes`), records the tranche's retrospective in the Milestone its task Issues are attached to, and closes that Milestone once nothing else in it is still open.",
|
|
7661
|
+
"A tranche none of whose task Issues carry a Milestone gets one: a Milestone titled with the tranche's slug is created, the tranche's closed task Issues are attached to it, the retrospective is recorded, and it is closed — so the tranche reads as archived. An Issue already on a Milestone is never moved.",
|
|
7662
|
+
"Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
|
|
7663
|
+
"The generated `vinaya-archivist.yml` workflow runs it after a task pull request merges, and again when an Issue labeled with the tranche closes without a merge (dropped, replaced or closed by hand) — the tranche's slug read from that Issue's own label."
|
|
7664
|
+
],
|
|
7665
|
+
status: "shipped"
|
|
7666
|
+
},
|
|
7667
|
+
{
|
|
7668
|
+
name: "archive tranches",
|
|
7669
|
+
description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
|
|
7670
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7671
|
+
details: [
|
|
7672
|
+
"Walks every `vinaya/tranche:<slug>` label, skips each tranche that still has an open task Issue, and runs `archive tranche` for each finished one whose Milestone is not already closed with its retrospective. One tranche failing does not stop the others; the exit code reports it.",
|
|
7673
|
+
"The generated `vinaya-archivist.yml` workflow calls it on its daily scheduled run, so a tranche that finished before the workflow could see it is archived within a day. Running it again when every finished tranche is archived changes nothing and says so."
|
|
7462
7674
|
],
|
|
7463
7675
|
status: "shipped"
|
|
7464
7676
|
},
|
|
@@ -7602,6 +7814,29 @@ var COMMANDS = [
|
|
|
7602
7814
|
],
|
|
7603
7815
|
status: "shipped"
|
|
7604
7816
|
},
|
|
7817
|
+
{
|
|
7818
|
+
name: "log selftest",
|
|
7819
|
+
description: "Prove log delivery works end to end: send one marked test event and read it back — PASS (exit 0) or FAIL with the one reason (exit 1)",
|
|
7820
|
+
details: [
|
|
7821
|
+
"Resolves the destination exactly as an UNATTENDED review-loop run does in this repository — the same trust-anchor read and credential lookup, forced unattended so running it by hand proves the launch path's own resolution, not a human's. It sends one test event to the configured `logs.url` server, then reads it back from the server by the event's own id through the server's cursor read.",
|
|
7822
|
+
"PASS (exit 0) only when the event round-trips. Otherwise FAIL (exit 1) with the ONE reason that stopped it: no server is configured, the default branch's config could not be read to confirm the url (and why), this host holds no ingest or read credential, the server refused with its status, or the event could not be read back. It never prints a credential value.",
|
|
7823
|
+
"The read-back needs a READ credential distinct from the write-only ingest one the server refuses on a read route: set `logs.readHeaders` in vinaya.config.json to the server's read token (referenced by variable name, resolved from the environment exactly as `logs.headers` is). The test event is marked `operation: 'log.selftest'` so a reader can exclude it from real telemetry."
|
|
7824
|
+
],
|
|
7825
|
+
status: "shipped"
|
|
7826
|
+
},
|
|
7827
|
+
{
|
|
7828
|
+
name: "log emit",
|
|
7829
|
+
description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
|
|
7830
|
+
flags: [
|
|
7831
|
+
{ flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
|
|
7832
|
+
],
|
|
7833
|
+
details: [
|
|
7834
|
+
"Reads the field values as ONE JSON object — `--json '<json>'` or piped on standard input, never positional arguments — and records them through `emitCustomEvent`, the same chokepoint every custom event goes through, so the refusal event and the redaction stay in one place.",
|
|
7835
|
+
"A declared event with every field present and of its declared type exits 0 and prints the event name and the kind of destination it was recorded toward (`folder`, `server`, or `none`) — never a field value. A refused event (an undeclared name, or a missing, extra, wrong-typed or too-long field) exits 1 and prints the reason class and the field names — never a value, since a rejected value may be the secret. A missing event name, unreadable JSON, or JSON that is not a flat object is a usage error: exit 2, before anything is recorded.",
|
|
7836
|
+
"A process with only `VINAYA_WORK_REF` and `VINAYA_FLOW` set, and no Vinaya role or task, still gets a header carrying that work reference and way-of-working id — the same environment read every event already honours (`apps/cli/specs/log.md` § Attribution)."
|
|
7837
|
+
],
|
|
7838
|
+
status: "shipped"
|
|
7839
|
+
},
|
|
7605
7840
|
{
|
|
7606
7841
|
name: "log send",
|
|
7607
7842
|
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
@@ -7612,6 +7847,23 @@ var COMMANDS = [
|
|
|
7612
7847
|
"Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
|
|
7613
7848
|
],
|
|
7614
7849
|
status: "shipped"
|
|
7850
|
+
},
|
|
7851
|
+
{
|
|
7852
|
+
name: "sync",
|
|
7853
|
+
description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
|
|
7854
|
+
flags: [
|
|
7855
|
+
{
|
|
7856
|
+
flag: "--rebuild",
|
|
7857
|
+
description: "Delete the cache file and sync from the beginning of what the destination still retains"
|
|
7858
|
+
},
|
|
7859
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7860
|
+
],
|
|
7861
|
+
details: [
|
|
7862
|
+
"Resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — then reads a folder destination through the folder source or a server destination through the server source (with the configured `logs.readHeaders`, substituted from the environment), and runs the bounded sync engine against the durable cache this repository holds under its runtime directory. Prints pages read, rows stored, duplicates, edits, deletions, gaps, quarantined lines and, for a server destination, its lost-event diagnostic. Reads the destination and writes only its own cache directory — never the folder, the server, or the forge.",
|
|
7863
|
+
"Exits 0 when the run completed or stopped cleanly on its page bound (and says more is available), 1 when it failed part way (the progress made is kept — a second run resumes from the stored cursor), and 2 for a usage or configuration problem: no destination is configured, or a server destination is configured with no usable read credential. A missing credential names the environment variable to set and never prints its value.",
|
|
7864
|
+
"`--rebuild` deletes the cache file ALONE — never anything else under the cache directory — and syncs again from the beginning of what the destination still retains; an event already rotated out of a folder's single backup slot, or no longer retained by the destination, cannot be recovered and shows up as a gap, never silently."
|
|
7865
|
+
],
|
|
7866
|
+
status: "shipped"
|
|
7615
7867
|
}
|
|
7616
7868
|
];
|
|
7617
7869
|
// ../../packages/sources/src/forge-adapter.ts
|
|
@@ -7623,10 +7875,10 @@ function createForgeSource(config) {
|
|
|
7623
7875
|
};
|
|
7624
7876
|
}
|
|
7625
7877
|
// ../../packages/sources/src/select-source.ts
|
|
7626
|
-
import { z as
|
|
7627
|
-
var StateSourceConfigSchema =
|
|
7628
|
-
|
|
7629
|
-
|
|
7878
|
+
import { z as z6 } from "zod";
|
|
7879
|
+
var StateSourceConfigSchema = z6.discriminatedUnion("kind", [
|
|
7880
|
+
z6.object({ kind: z6.literal("forge"), owner: z6.string(), repo: z6.string() }),
|
|
7881
|
+
z6.object({ kind: z6.literal("file"), root: z6.string().optional() })
|
|
7630
7882
|
]);
|
|
7631
7883
|
// src/checks/edge-resolve.ts
|
|
7632
7884
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -7767,7 +8019,16 @@ function packageRoot(moduleUrl) {
|
|
|
7767
8019
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7768
8020
|
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7769
8021
|
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
8022
|
+
import matter4 from "gray-matter";
|
|
8023
|
+
|
|
8024
|
+
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
7770
8025
|
import matter2 from "gray-matter";
|
|
8026
|
+
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
8027
|
+
var NO_MODEL_BACKED_PATHS = new Set;
|
|
8028
|
+
// src/roles/contract.ts
|
|
8029
|
+
import matter3 from "gray-matter";
|
|
8030
|
+
|
|
8031
|
+
// src/commands/doctrine.ts
|
|
7771
8032
|
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7772
8033
|
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7773
8034
|
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
@@ -7816,12 +8077,16 @@ function expandGlob(glob) {
|
|
|
7816
8077
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7817
8078
|
|
|
7818
8079
|
// src/checks/registry.ts
|
|
7819
|
-
import {
|
|
7820
|
-
import {
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
8080
|
+
import { join as join5, relative, sep as sep2 } from "node:path";
|
|
8081
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8082
|
+
function resolveCheckBin(packageDir, moduleUrl) {
|
|
8083
|
+
const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
|
|
8084
|
+
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
|
|
8085
|
+
return bundled ? { dir: join5(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join5(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
8086
|
+
}
|
|
8087
|
+
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
8088
|
+
var BIN_DIR = CHECK_BIN.dir;
|
|
8089
|
+
var BIN_EXT = CHECK_BIN.ext;
|
|
7825
8090
|
function bin(name) {
|
|
7826
8091
|
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7827
8092
|
}
|
|
@@ -8019,23 +8284,6 @@ var REGISTRY = [
|
|
|
8019
8284
|
},
|
|
8020
8285
|
1
|
|
8021
8286
|
],
|
|
8022
|
-
[
|
|
8023
|
-
{
|
|
8024
|
-
name: "token-report",
|
|
8025
|
-
validates: "body",
|
|
8026
|
-
run: bin("check-token-report"),
|
|
8027
|
-
scope: "diff",
|
|
8028
|
-
timeoutMs: 15000,
|
|
8029
|
-
requiresOpenPr: true,
|
|
8030
|
-
env: {
|
|
8031
|
-
PR_BODY: { optional: true },
|
|
8032
|
-
BRANCH: { optional: true },
|
|
8033
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
8034
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
8035
|
-
}
|
|
8036
|
-
},
|
|
8037
|
-
1
|
|
8038
|
-
],
|
|
8039
8287
|
[
|
|
8040
8288
|
{
|
|
8041
8289
|
name: "no-disk-state",
|
|
@@ -8385,23 +8633,35 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
|
|
|
8385
8633
|
import { execFile as execFile5 } from "node:child_process";
|
|
8386
8634
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8387
8635
|
import {
|
|
8388
|
-
|
|
8389
|
-
|
|
8636
|
+
appendFileSync,
|
|
8637
|
+
closeSync as closeSync4,
|
|
8638
|
+
constants as fsConstants4,
|
|
8390
8639
|
existsSync as existsSync7,
|
|
8391
|
-
fstatSync as
|
|
8392
|
-
mkdirSync as
|
|
8393
|
-
|
|
8394
|
-
|
|
8640
|
+
fstatSync as fstatSync3,
|
|
8641
|
+
mkdirSync as mkdirSync4,
|
|
8642
|
+
lstatSync as lstatSync2,
|
|
8643
|
+
openSync as openSync4,
|
|
8644
|
+
readFileSync as readFileSync7,
|
|
8395
8645
|
renameSync as renameSync2,
|
|
8396
|
-
|
|
8646
|
+
writeFileSync as writeFileSync3,
|
|
8647
|
+
writeSync as writeSync3
|
|
8397
8648
|
} from "node:fs";
|
|
8398
8649
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8399
|
-
import { dirname as
|
|
8650
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
8400
8651
|
import { promisify as promisify5 } from "node:util";
|
|
8401
8652
|
|
|
8402
8653
|
// src/lib/run-paths.ts
|
|
8403
|
-
import {
|
|
8654
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
8655
|
+
import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
8404
8656
|
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8657
|
+
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
8658
|
+
var RUN_AREA_DIRNAMES = {
|
|
8659
|
+
control: CONTROL_AREA_DIRNAME,
|
|
8660
|
+
sessions: "sessions",
|
|
8661
|
+
hooks: "hooks",
|
|
8662
|
+
output: "output",
|
|
8663
|
+
rounds: "rounds"
|
|
8664
|
+
};
|
|
8405
8665
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8406
8666
|
function isSafeRepoSegment(segment) {
|
|
8407
8667
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8432,12 +8692,52 @@ function isInsideRepo(candidate, repoRoot) {
|
|
|
8432
8692
|
const target = resolvePath(candidate);
|
|
8433
8693
|
return target === root || target.startsWith(`${root}/`);
|
|
8434
8694
|
}
|
|
8695
|
+
function runPath(runtimeDir, scope, location) {
|
|
8696
|
+
const dir = join6(runtimeDir, TASKS_EXECUTION_DIRNAME, scopeSegment(scope));
|
|
8697
|
+
switch (location.area) {
|
|
8698
|
+
case "task":
|
|
8699
|
+
return location.file ? join6(dir, location.file) : dir;
|
|
8700
|
+
case "control": {
|
|
8701
|
+
const controlDir = join6(dir, RUN_AREA_DIRNAMES.control);
|
|
8702
|
+
return location.file ? join6(controlDir, location.file) : controlDir;
|
|
8703
|
+
}
|
|
8704
|
+
case "rounds":
|
|
8705
|
+
return join6(dir, RUN_AREA_DIRNAMES.rounds);
|
|
8706
|
+
case "round": {
|
|
8707
|
+
const roundDir = join6(dir, RUN_AREA_DIRNAMES.rounds, String(location.round));
|
|
8708
|
+
return location.file ? join6(roundDir, location.file) : roundDir;
|
|
8709
|
+
}
|
|
8710
|
+
case "developer": {
|
|
8711
|
+
const developerDir = join6(dir, RUN_AREA_DIRNAMES.rounds, String(location.round), "developer");
|
|
8712
|
+
return location.file ? join6(developerDir, location.file) : developerDir;
|
|
8713
|
+
}
|
|
8714
|
+
default: {
|
|
8715
|
+
const areaDir = join6(dir, RUN_AREA_DIRNAMES[location.area]);
|
|
8716
|
+
return location.file ? join6(areaDir, location.file) : areaDir;
|
|
8717
|
+
}
|
|
8718
|
+
}
|
|
8719
|
+
}
|
|
8720
|
+
function scopeSegment(scope) {
|
|
8721
|
+
if (scope === "unscoped")
|
|
8722
|
+
return "unscoped";
|
|
8723
|
+
if (typeof scope === "number")
|
|
8724
|
+
return String(scope);
|
|
8725
|
+
return `pr-${scope.pr}`;
|
|
8726
|
+
}
|
|
8435
8727
|
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
8436
8728
|
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
8437
8729
|
function isUnattendedProcess(env = process.env) {
|
|
8438
8730
|
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
8439
8731
|
}
|
|
8440
8732
|
var memoized = null;
|
|
8733
|
+
function runtimeDirForRepo(repo) {
|
|
8734
|
+
const key = repoSegment(repo);
|
|
8735
|
+
if (memoized?.key === key)
|
|
8736
|
+
return memoized.value;
|
|
8737
|
+
const value = resolveRuntimeDirUncached(repo);
|
|
8738
|
+
memoized = { key, value };
|
|
8739
|
+
return value;
|
|
8740
|
+
}
|
|
8441
8741
|
async function runtimeDirForRepoAsync(repo) {
|
|
8442
8742
|
const key = repoSegment(repo);
|
|
8443
8743
|
if (memoized?.key === key)
|
|
@@ -8453,6 +8753,16 @@ async function runtimeDirForRepoAsync(repo) {
|
|
|
8453
8753
|
memoized = { key, value };
|
|
8454
8754
|
return value;
|
|
8455
8755
|
}
|
|
8756
|
+
function resolveRuntimeDirUncached(repo) {
|
|
8757
|
+
const inputs = runtimeDirInputs();
|
|
8758
|
+
if (typeof inputs === "string")
|
|
8759
|
+
return inputs;
|
|
8760
|
+
return resolveRuntimeDir({
|
|
8761
|
+
repo,
|
|
8762
|
+
...inputs.base,
|
|
8763
|
+
trustAnchorConfig: inputs.needsAnchor ? loadTrustAnchorConfig() : null
|
|
8764
|
+
});
|
|
8765
|
+
}
|
|
8456
8766
|
function runtimeDirInputs() {
|
|
8457
8767
|
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
8458
8768
|
if (handedDown)
|
|
@@ -8472,7 +8782,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8472
8782
|
return null;
|
|
8473
8783
|
}
|
|
8474
8784
|
for (;; ) {
|
|
8475
|
-
if (
|
|
8785
|
+
if (existsSync5(join6(dir, ".git")))
|
|
8476
8786
|
return dir;
|
|
8477
8787
|
const parent = dirname4(dir);
|
|
8478
8788
|
if (parent === dir)
|
|
@@ -8480,26 +8790,94 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8480
8790
|
dir = parent;
|
|
8481
8791
|
}
|
|
8482
8792
|
}
|
|
8793
|
+
function resolveRepoSync() {
|
|
8794
|
+
const fromEnv = process.env.AEG_REPO;
|
|
8795
|
+
if (fromEnv) {
|
|
8796
|
+
const m = /^([^/]+)\/(.+)$/.exec(fromEnv);
|
|
8797
|
+
if (m?.[1] && m[2])
|
|
8798
|
+
return { owner: m[1], repo: m[2] };
|
|
8799
|
+
}
|
|
8800
|
+
let url;
|
|
8801
|
+
try {
|
|
8802
|
+
url = execFileSync6("git", ["remote", "get-url", "origin"], {
|
|
8803
|
+
encoding: "utf-8",
|
|
8804
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
8805
|
+
}).trim();
|
|
8806
|
+
} catch {
|
|
8807
|
+
return null;
|
|
8808
|
+
}
|
|
8809
|
+
const ssh = /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/.exec(url);
|
|
8810
|
+
if (ssh?.[1] && ssh[2])
|
|
8811
|
+
return { owner: ssh[1], repo: ssh[2] };
|
|
8812
|
+
const https = /^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(url);
|
|
8813
|
+
if (https?.[1] && https[2])
|
|
8814
|
+
return { owner: https[1], repo: https[2] };
|
|
8815
|
+
return null;
|
|
8816
|
+
}
|
|
8817
|
+
var memoizedThisRepo = null;
|
|
8818
|
+
function runtimeDirForThisRepo() {
|
|
8819
|
+
if (memoizedThisRepo !== null)
|
|
8820
|
+
return memoizedThisRepo;
|
|
8821
|
+
memoizedThisRepo = runtimeDirForRepo(resolveRepoSync());
|
|
8822
|
+
return memoizedThisRepo;
|
|
8823
|
+
}
|
|
8483
8824
|
|
|
8484
|
-
// src/lib/log
|
|
8825
|
+
// src/lib/loop-log.ts
|
|
8485
8826
|
import {
|
|
8486
8827
|
closeSync as closeSync2,
|
|
8487
8828
|
constants as fsConstants2,
|
|
8488
|
-
|
|
8829
|
+
existsSync as existsSync6,
|
|
8830
|
+
fstatSync as fstatSync2,
|
|
8489
8831
|
mkdirSync as mkdirSync2,
|
|
8490
8832
|
openSync as openSync2,
|
|
8491
|
-
linkSync,
|
|
8492
8833
|
readFileSync as readFileSync5,
|
|
8493
|
-
|
|
8834
|
+
readSync,
|
|
8494
8835
|
statSync,
|
|
8836
|
+
writeSync
|
|
8837
|
+
} from "node:fs";
|
|
8838
|
+
import { dirname as dirname5 } from "node:path";
|
|
8839
|
+
function loopsRoot() {
|
|
8840
|
+
return runtimeDirForThisRepo();
|
|
8841
|
+
}
|
|
8842
|
+
function loopLogPathFor(_repo, issue, root = loopsRoot()) {
|
|
8843
|
+
return runPath(root, issue, { area: "output", file: "driver.log" });
|
|
8844
|
+
}
|
|
8845
|
+
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
8846
|
+
function appendLoopLogLine(path, line) {
|
|
8847
|
+
try {
|
|
8848
|
+
mkdirSync2(dirname5(path), { recursive: true, mode: 448 });
|
|
8849
|
+
const fd = openSync2(path, fsConstants2.O_WRONLY | fsConstants2.O_APPEND | fsConstants2.O_CREAT | fsConstants2.O_NOFOLLOW, 384);
|
|
8850
|
+
try {
|
|
8851
|
+
const stat = fstatSync2(fd);
|
|
8852
|
+
if (stat.isFile() && stat.size < LOOP_LOG_MAX_BYTES) {
|
|
8853
|
+
writeSync(fd, `${line}
|
|
8854
|
+
`);
|
|
8855
|
+
}
|
|
8856
|
+
} finally {
|
|
8857
|
+
closeSync2(fd);
|
|
8858
|
+
}
|
|
8859
|
+
} catch {}
|
|
8860
|
+
}
|
|
8861
|
+
|
|
8862
|
+
// src/lib/log-webhook-drain.ts
|
|
8863
|
+
import {
|
|
8864
|
+
closeSync as closeSync3,
|
|
8865
|
+
constants as fsConstants3,
|
|
8866
|
+
lstatSync,
|
|
8867
|
+
mkdirSync as mkdirSync3,
|
|
8868
|
+
openSync as openSync3,
|
|
8869
|
+
linkSync,
|
|
8870
|
+
readFileSync as readFileSync6,
|
|
8871
|
+
renameSync,
|
|
8872
|
+
statSync as statSync2,
|
|
8495
8873
|
unlinkSync,
|
|
8496
8874
|
utimesSync,
|
|
8497
8875
|
writeFileSync as writeFileSync2,
|
|
8498
|
-
writeSync
|
|
8876
|
+
writeSync as writeSync2
|
|
8499
8877
|
} from "node:fs";
|
|
8500
8878
|
import { randomUUID } from "node:crypto";
|
|
8501
8879
|
import { homedir as homedir2 } from "node:os";
|
|
8502
|
-
import { dirname as
|
|
8880
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
8503
8881
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8504
8882
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8505
8883
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8515,13 +8893,13 @@ function isEnoent(err) {
|
|
|
8515
8893
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8516
8894
|
function tryCreateLock(lockPath, token) {
|
|
8517
8895
|
try {
|
|
8518
|
-
|
|
8519
|
-
const fd =
|
|
8896
|
+
mkdirSync3(dirname6(lockPath), { recursive: true, mode: 448 });
|
|
8897
|
+
const fd = openSync3(lockPath, fsConstants3.O_WRONLY | fsConstants3.O_CREAT | fsConstants3.O_EXCL, 384);
|
|
8520
8898
|
try {
|
|
8521
|
-
|
|
8899
|
+
writeSync2(fd, `${token}
|
|
8522
8900
|
`);
|
|
8523
8901
|
} finally {
|
|
8524
|
-
|
|
8902
|
+
closeSync3(fd);
|
|
8525
8903
|
}
|
|
8526
8904
|
return true;
|
|
8527
8905
|
} catch (err) {
|
|
@@ -8536,7 +8914,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8536
8914
|
return token;
|
|
8537
8915
|
let observedMtimeMs;
|
|
8538
8916
|
try {
|
|
8539
|
-
observedMtimeMs =
|
|
8917
|
+
observedMtimeMs = statSync2(lockPath).mtimeMs;
|
|
8540
8918
|
} catch (err) {
|
|
8541
8919
|
if (!isEnoent(err))
|
|
8542
8920
|
throw err;
|
|
@@ -8554,7 +8932,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8554
8932
|
}
|
|
8555
8933
|
let claimedMtimeMs = null;
|
|
8556
8934
|
try {
|
|
8557
|
-
claimedMtimeMs =
|
|
8935
|
+
claimedMtimeMs = statSync2(claimed).mtimeMs;
|
|
8558
8936
|
} catch (err) {
|
|
8559
8937
|
if (!isEnoent(err))
|
|
8560
8938
|
throw err;
|
|
@@ -8580,7 +8958,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8580
8958
|
function renewDrainLock(lockPath, token) {
|
|
8581
8959
|
let holder;
|
|
8582
8960
|
try {
|
|
8583
|
-
holder =
|
|
8961
|
+
holder = readFileSync6(lockPath, "utf8").trim();
|
|
8584
8962
|
} catch (err) {
|
|
8585
8963
|
if (!isEnoent(err))
|
|
8586
8964
|
throw err;
|
|
@@ -8600,7 +8978,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
8600
8978
|
}
|
|
8601
8979
|
function releaseDrainLock(lockPath, token) {
|
|
8602
8980
|
try {
|
|
8603
|
-
const holder =
|
|
8981
|
+
const holder = readFileSync6(lockPath, "utf8").trim();
|
|
8604
8982
|
if (holder !== token)
|
|
8605
8983
|
return;
|
|
8606
8984
|
unlinkSync(lockPath);
|
|
@@ -8650,7 +9028,7 @@ function queueLines(buf) {
|
|
|
8650
9028
|
return lines;
|
|
8651
9029
|
}
|
|
8652
9030
|
function removeQueueHead(path, cut) {
|
|
8653
|
-
const remaining =
|
|
9031
|
+
const remaining = readFileSync6(path);
|
|
8654
9032
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8655
9033
|
}
|
|
8656
9034
|
function queueBucketSize(path) {
|
|
@@ -8671,7 +9049,7 @@ function queueBucketSize(path) {
|
|
|
8671
9049
|
function readQueueFile(path) {
|
|
8672
9050
|
if (queueBucketSize(path) === null)
|
|
8673
9051
|
return null;
|
|
8674
|
-
return
|
|
9052
|
+
return readFileSync6(path);
|
|
8675
9053
|
}
|
|
8676
9054
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8677
9055
|
const record = JSON.stringify({
|
|
@@ -8853,13 +9231,19 @@ function logsCredentialMissing(headers, env) {
|
|
|
8853
9231
|
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8854
9232
|
for (const value of Object.values(headers)) {
|
|
8855
9233
|
for (const match of value.matchAll(varPattern)) {
|
|
8856
|
-
|
|
8857
|
-
|
|
9234
|
+
const name = match[1];
|
|
9235
|
+
if (env[name])
|
|
9236
|
+
continue;
|
|
9237
|
+
return true;
|
|
8858
9238
|
}
|
|
8859
9239
|
}
|
|
8860
9240
|
return false;
|
|
8861
9241
|
}
|
|
8862
9242
|
function resolveLogDestinationFrom(input) {
|
|
9243
|
+
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
9244
|
+
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
9245
|
+
return { kind: "folder", folder: spoolDir };
|
|
9246
|
+
}
|
|
8863
9247
|
const local = resolveLogsSetting(input.localConfig);
|
|
8864
9248
|
let effective = null;
|
|
8865
9249
|
let fallbackReason;
|
|
@@ -8899,23 +9283,72 @@ function resolveLogDestinationFrom(input) {
|
|
|
8899
9283
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8900
9284
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8901
9285
|
}
|
|
8902
|
-
var
|
|
8903
|
-
function processTrustAnchor() {
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
9286
|
+
var processTrustAnchorByRepo = new Map;
|
|
9287
|
+
function processTrustAnchor(repoRoot) {
|
|
9288
|
+
const cached = processTrustAnchorByRepo.get(repoRoot);
|
|
9289
|
+
if (cached !== undefined)
|
|
9290
|
+
return cached;
|
|
9291
|
+
const reading = safeLoadTrustAnchorConfig();
|
|
9292
|
+
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
9293
|
+
return reading;
|
|
8907
9294
|
}
|
|
8908
9295
|
async function defaultResolveLogDestination(repo, env) {
|
|
8909
9296
|
const localConfig = loadConfig();
|
|
8910
9297
|
const unattended = isUnattendedProcess(process.env);
|
|
9298
|
+
const repoRoot = repoRootSync();
|
|
8911
9299
|
return resolveLogDestinationFrom({
|
|
8912
9300
|
localConfig,
|
|
8913
|
-
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
9301
|
+
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
8914
9302
|
unattended,
|
|
8915
9303
|
env,
|
|
8916
9304
|
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8917
|
-
repoRoot
|
|
9305
|
+
repoRoot
|
|
9306
|
+
});
|
|
9307
|
+
}
|
|
9308
|
+
function unresolvedLogDestination(env) {
|
|
9309
|
+
if (hostFromEnv(env) === "ci") {
|
|
9310
|
+
return {
|
|
9311
|
+
kind: "none",
|
|
9312
|
+
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
9313
|
+
};
|
|
9314
|
+
}
|
|
9315
|
+
const loaded = loadConfig();
|
|
9316
|
+
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
9317
|
+
const unattended = isUnattendedProcess(process.env);
|
|
9318
|
+
const repoRoot = repoRootSync();
|
|
9319
|
+
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
9320
|
+
const defaultFolder = join8(runtimeDir, "logs");
|
|
9321
|
+
const resolved = resolveLogDestinationFrom({
|
|
9322
|
+
localConfig,
|
|
9323
|
+
trustAnchorConfig: null,
|
|
9324
|
+
unattended,
|
|
9325
|
+
env,
|
|
9326
|
+
defaultFolder,
|
|
9327
|
+
repoRoot
|
|
8918
9328
|
});
|
|
9329
|
+
return resolved.kind === "folder" ? resolved : { kind: "folder", folder: defaultFolder };
|
|
9330
|
+
}
|
|
9331
|
+
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9332
|
+
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9333
|
+
return join8(stateRoot, "fallback", `${dirName}.json`);
|
|
9334
|
+
}
|
|
9335
|
+
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9336
|
+
const message = describeFolderFallback(reason);
|
|
9337
|
+
if (issue !== null) {
|
|
9338
|
+
appendLoopLogLine(loopLogPathFor(repo, issue, runtimeDir), `[log] ${message}`);
|
|
9339
|
+
}
|
|
9340
|
+
try {
|
|
9341
|
+
const record = {
|
|
9342
|
+
at: now.toISOString(),
|
|
9343
|
+
reason: message,
|
|
9344
|
+
intendedUrl: reason.intendedUrl,
|
|
9345
|
+
kind: reason.kind
|
|
9346
|
+
};
|
|
9347
|
+
const path = folderFallbackStatePath(repo, stateRoot);
|
|
9348
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9349
|
+
writeFileSync3(path, `${JSON.stringify(record)}
|
|
9350
|
+
`, { mode: 384 });
|
|
9351
|
+
} catch {}
|
|
8919
9352
|
}
|
|
8920
9353
|
function isEnoent2(err) {
|
|
8921
9354
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
@@ -9029,7 +9462,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
9029
9462
|
}
|
|
9030
9463
|
function readVinayaVersion() {
|
|
9031
9464
|
try {
|
|
9032
|
-
const pkg = JSON.parse(
|
|
9465
|
+
const pkg = JSON.parse(readFileSync7(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
9033
9466
|
return pkg.version ?? "unknown";
|
|
9034
9467
|
} catch {
|
|
9035
9468
|
return "unknown";
|
|
@@ -9067,6 +9500,7 @@ function defaultStderr(message) {
|
|
|
9067
9500
|
}
|
|
9068
9501
|
var branchIssueFallbackEnabled = true;
|
|
9069
9502
|
var branchIssueByCwd = new Map;
|
|
9503
|
+
var branchIssueSettledByCwd = new Map;
|
|
9070
9504
|
function branchIssueRead(key, read, shared) {
|
|
9071
9505
|
if (!shared)
|
|
9072
9506
|
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
@@ -9075,8 +9509,30 @@ function branchIssueRead(key, read, shared) {
|
|
|
9075
9509
|
return cached;
|
|
9076
9510
|
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9077
9511
|
branchIssueByCwd.set(key, reading);
|
|
9512
|
+
reading.then((value) => branchIssueSettledByCwd.set(key, value));
|
|
9513
|
+
return reading;
|
|
9514
|
+
}
|
|
9515
|
+
var headShaByCwd = new Map;
|
|
9516
|
+
var headShaSettledByCwd = new Map;
|
|
9517
|
+
function headShaRead(key, read, shared) {
|
|
9518
|
+
if (!shared)
|
|
9519
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9520
|
+
const cached = headShaByCwd.get(key);
|
|
9521
|
+
if (cached !== undefined)
|
|
9522
|
+
return cached;
|
|
9523
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9524
|
+
headShaByCwd.set(key, reading);
|
|
9525
|
+
reading.then((value) => headShaSettledByCwd.set(key, value));
|
|
9078
9526
|
return reading;
|
|
9079
9527
|
}
|
|
9528
|
+
async function resolveHeadSha(cwd) {
|
|
9529
|
+
try {
|
|
9530
|
+
const out = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
9531
|
+
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
9532
|
+
} catch {
|
|
9533
|
+
return null;
|
|
9534
|
+
}
|
|
9535
|
+
}
|
|
9080
9536
|
function defaultDeps() {
|
|
9081
9537
|
return {
|
|
9082
9538
|
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -9091,29 +9547,30 @@ function defaultDeps() {
|
|
|
9091
9547
|
inputVersions: () => {
|
|
9092
9548
|
return;
|
|
9093
9549
|
},
|
|
9094
|
-
resolveLogDestination: defaultResolveLogDestination
|
|
9550
|
+
resolveLogDestination: defaultResolveLogDestination,
|
|
9551
|
+
unresolvedLogDestination
|
|
9095
9552
|
};
|
|
9096
9553
|
}
|
|
9097
|
-
var APPEND_OPEN_FLAGS =
|
|
9554
|
+
var APPEND_OPEN_FLAGS = fsConstants4.O_WRONLY | fsConstants4.O_APPEND | fsConstants4.O_CREAT | fsConstants4.O_NOFOLLOW | fsConstants4.O_NONBLOCK;
|
|
9098
9555
|
function guardedAppendOpen(path) {
|
|
9099
9556
|
try {
|
|
9100
|
-
return
|
|
9557
|
+
return openSync4(path, APPEND_OPEN_FLAGS, 384);
|
|
9101
9558
|
} catch {
|
|
9102
9559
|
return;
|
|
9103
9560
|
}
|
|
9104
9561
|
}
|
|
9105
9562
|
function appendHardenedLine(path, line) {
|
|
9106
9563
|
try {
|
|
9107
|
-
|
|
9564
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9108
9565
|
const fd = guardedAppendOpen(path);
|
|
9109
9566
|
if (fd === undefined)
|
|
9110
9567
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
9111
9568
|
try {
|
|
9112
|
-
if (!
|
|
9569
|
+
if (!fstatSync3(fd).isFile())
|
|
9113
9570
|
return `target is not a regular file: ${path}`;
|
|
9114
|
-
|
|
9571
|
+
writeSync3(fd, line);
|
|
9115
9572
|
} finally {
|
|
9116
|
-
|
|
9573
|
+
closeSync4(fd);
|
|
9117
9574
|
}
|
|
9118
9575
|
return null;
|
|
9119
9576
|
} catch (err) {
|
|
@@ -9123,7 +9580,7 @@ function appendHardenedLine(path, line) {
|
|
|
9123
9580
|
function reportRotationOverflow(backupPath, warn) {
|
|
9124
9581
|
let raw;
|
|
9125
9582
|
try {
|
|
9126
|
-
raw =
|
|
9583
|
+
raw = readFileSync7(backupPath, "utf8");
|
|
9127
9584
|
} catch {
|
|
9128
9585
|
return;
|
|
9129
9586
|
}
|
|
@@ -9146,7 +9603,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
9146
9603
|
}
|
|
9147
9604
|
function appendLine(path, line, warn) {
|
|
9148
9605
|
try {
|
|
9149
|
-
|
|
9606
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9150
9607
|
let fd = guardedAppendOpen(path);
|
|
9151
9608
|
if (fd === undefined) {
|
|
9152
9609
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -9155,14 +9612,14 @@ function appendLine(path, line, warn) {
|
|
|
9155
9612
|
}
|
|
9156
9613
|
let closed = false;
|
|
9157
9614
|
try {
|
|
9158
|
-
const stat =
|
|
9615
|
+
const stat = fstatSync3(fd);
|
|
9159
9616
|
if (!stat.isFile()) {
|
|
9160
9617
|
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
9161
9618
|
`);
|
|
9162
9619
|
return;
|
|
9163
9620
|
}
|
|
9164
9621
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
9165
|
-
|
|
9622
|
+
closeSync4(fd);
|
|
9166
9623
|
closed = true;
|
|
9167
9624
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
9168
9625
|
reportRotationOverflow(backupPath, warn);
|
|
@@ -9176,10 +9633,10 @@ function appendLine(path, line, warn) {
|
|
|
9176
9633
|
fd = rotated;
|
|
9177
9634
|
closed = false;
|
|
9178
9635
|
}
|
|
9179
|
-
|
|
9636
|
+
writeSync3(fd, line);
|
|
9180
9637
|
} finally {
|
|
9181
9638
|
if (!closed)
|
|
9182
|
-
|
|
9639
|
+
closeSync4(fd);
|
|
9183
9640
|
}
|
|
9184
9641
|
} catch (err) {
|
|
9185
9642
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -9190,12 +9647,14 @@ function createLogSink(overrides = {}) {
|
|
|
9190
9647
|
const deps = {
|
|
9191
9648
|
...defaultDeps(),
|
|
9192
9649
|
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9650
|
+
resolveHeadSha: () => resolveHeadSha(deps.cwd()),
|
|
9193
9651
|
...overrides
|
|
9194
9652
|
};
|
|
9195
9653
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
9196
9654
|
const processId = randomUUID2();
|
|
9197
9655
|
let seq = 0;
|
|
9198
9656
|
let warned = false;
|
|
9657
|
+
let folderFallbackRecorded = false;
|
|
9199
9658
|
const warnOnce = (message) => {
|
|
9200
9659
|
if (warned)
|
|
9201
9660
|
return;
|
|
@@ -9213,6 +9672,7 @@ function createLogSink(overrides = {}) {
|
|
|
9213
9672
|
};
|
|
9214
9673
|
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9215
9674
|
let ownBranchIssue;
|
|
9675
|
+
let ownBranchIssueSettled = null;
|
|
9216
9676
|
const branchIssueOnce = (repo) => {
|
|
9217
9677
|
if (!branchIssueFallbackEnabled)
|
|
9218
9678
|
return Promise.resolve(null);
|
|
@@ -9220,10 +9680,36 @@ function createLogSink(overrides = {}) {
|
|
|
9220
9680
|
const read = () => deps.resolveBranchIssue(slug);
|
|
9221
9681
|
if (readerIsReal)
|
|
9222
9682
|
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9223
|
-
if (ownBranchIssue === undefined)
|
|
9683
|
+
if (ownBranchIssue === undefined) {
|
|
9224
9684
|
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9685
|
+
ownBranchIssue.then((value) => {
|
|
9686
|
+
ownBranchIssueSettled = value;
|
|
9687
|
+
});
|
|
9688
|
+
}
|
|
9225
9689
|
return ownBranchIssue;
|
|
9226
9690
|
};
|
|
9691
|
+
const branchIssueIfSettled = (repo) => {
|
|
9692
|
+
if (!branchIssueFallbackEnabled)
|
|
9693
|
+
return null;
|
|
9694
|
+
if (!readerIsReal)
|
|
9695
|
+
return ownBranchIssueSettled;
|
|
9696
|
+
return branchIssueSettledByCwd.get(`${deps.cwd()}\x00${safeRepoSlug(repo) ?? ""}`) ?? null;
|
|
9697
|
+
};
|
|
9698
|
+
const headShaReaderIsReal = overrides.resolveHeadSha === undefined;
|
|
9699
|
+
let ownHeadSha;
|
|
9700
|
+
let ownHeadShaSettled = null;
|
|
9701
|
+
const headShaOnce = () => {
|
|
9702
|
+
if (headShaReaderIsReal)
|
|
9703
|
+
return headShaRead(deps.cwd(), deps.resolveHeadSha, true);
|
|
9704
|
+
if (ownHeadSha === undefined) {
|
|
9705
|
+
ownHeadSha = headShaRead(deps.cwd(), deps.resolveHeadSha, false);
|
|
9706
|
+
ownHeadSha.then((value) => {
|
|
9707
|
+
ownHeadShaSettled = value;
|
|
9708
|
+
});
|
|
9709
|
+
}
|
|
9710
|
+
return ownHeadSha;
|
|
9711
|
+
};
|
|
9712
|
+
const headShaIfSettled = () => headShaReaderIsReal ? headShaSettledByCwd.get(deps.cwd()) ?? null : ownHeadShaSettled;
|
|
9227
9713
|
let resolveRepoCache;
|
|
9228
9714
|
const resolveRepoOnce = () => {
|
|
9229
9715
|
if (resolveRepoCache === undefined)
|
|
@@ -9231,6 +9717,7 @@ function createLogSink(overrides = {}) {
|
|
|
9231
9717
|
return resolveRepoCache;
|
|
9232
9718
|
};
|
|
9233
9719
|
let contextCache;
|
|
9720
|
+
let settledContext;
|
|
9234
9721
|
const context = () => {
|
|
9235
9722
|
if (contextCache === undefined) {
|
|
9236
9723
|
const env = deps.env();
|
|
@@ -9239,11 +9726,16 @@ function createLogSink(overrides = {}) {
|
|
|
9239
9726
|
doctrine()
|
|
9240
9727
|
]).then(async ([resolved, doctrineValue]) => {
|
|
9241
9728
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
9242
|
-
|
|
9729
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
9730
|
+
return settledContext;
|
|
9243
9731
|
});
|
|
9244
9732
|
}
|
|
9245
9733
|
return contextCache;
|
|
9246
9734
|
};
|
|
9735
|
+
const resetContext = () => {
|
|
9736
|
+
contextCache = undefined;
|
|
9737
|
+
settledContext = undefined;
|
|
9738
|
+
};
|
|
9247
9739
|
let drainChain = Promise.resolve();
|
|
9248
9740
|
const pendingWrites = new Set;
|
|
9249
9741
|
let writeChain = Promise.resolve();
|
|
@@ -9255,63 +9747,88 @@ function createLogSink(overrides = {}) {
|
|
|
9255
9747
|
`);
|
|
9256
9748
|
});
|
|
9257
9749
|
};
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9750
|
+
const snapshot = () => {
|
|
9751
|
+
const env = deps.env();
|
|
9752
|
+
return {
|
|
9753
|
+
host: hostFromEnv(env),
|
|
9754
|
+
now: deps.now(),
|
|
9755
|
+
seq: seq++,
|
|
9756
|
+
envFields: {
|
|
9265
9757
|
role: env.VINAYA_ROLE,
|
|
9266
9758
|
task: env.VINAYA_TASK,
|
|
9267
9759
|
round: env.VINAYA_ROUND,
|
|
9760
|
+
pr: env.VINAYA_PR,
|
|
9268
9761
|
run: env.VINAYA_RUN || runId,
|
|
9269
9762
|
attempt: env.VINAYA_ATTEMPT,
|
|
9270
|
-
parent: env.VINAYA_PARENT_EVENT
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9763
|
+
parent: env.VINAYA_PARENT_EVENT,
|
|
9764
|
+
workRef: env.VINAYA_WORK_REF,
|
|
9765
|
+
flow: env.VINAYA_FLOW,
|
|
9766
|
+
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
9767
|
+
runtime: env.VINAYA_RUNTIME,
|
|
9768
|
+
source: env.VINAYA_SOURCE
|
|
9769
|
+
}
|
|
9770
|
+
};
|
|
9771
|
+
};
|
|
9772
|
+
const writeEvent = (e, call, ctx, branchIssue, headSha, deliver) => {
|
|
9773
|
+
const { repo, doctrine: doctrineValue, destination } = ctx;
|
|
9774
|
+
if (destination.kind === "none") {
|
|
9775
|
+
warnOnce(`vinaya: not recording — ${destination.reason}
|
|
9276
9776
|
`);
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9777
|
+
return;
|
|
9778
|
+
}
|
|
9779
|
+
if (destination.kind === "folder" && destination.fallbackReason) {
|
|
9780
|
+
warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
|
|
9281
9781
|
`);
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9782
|
+
}
|
|
9783
|
+
const built = buildHeader({
|
|
9784
|
+
now: call.now,
|
|
9785
|
+
runId,
|
|
9786
|
+
seq: call.seq,
|
|
9787
|
+
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
9788
|
+
vinaya: deps.vinayaVersion(),
|
|
9789
|
+
doctrine: doctrineValue,
|
|
9790
|
+
host: call.host,
|
|
9791
|
+
hostname: deps.hostname(),
|
|
9792
|
+
env: call.envFields,
|
|
9793
|
+
branchIssue,
|
|
9794
|
+
eventId: randomUUID2(),
|
|
9795
|
+
processId,
|
|
9796
|
+
inputVersions: deps.inputVersions()
|
|
9797
|
+
});
|
|
9798
|
+
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
9799
|
+
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
9800
|
+
folderFallbackRecorded = true;
|
|
9801
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join8(deps.home(), ".vinaya"));
|
|
9802
|
+
}
|
|
9803
|
+
const full = { ...e, ...header };
|
|
9804
|
+
const parsed = LogEventSchema.safeParse(full);
|
|
9805
|
+
if (!parsed.success) {
|
|
9806
|
+
warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
|
|
9303
9807
|
`);
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9808
|
+
return;
|
|
9809
|
+
}
|
|
9810
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
9307
9811
|
`;
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9812
|
+
if (destination.kind === "server") {
|
|
9813
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
9814
|
+
if (deliver)
|
|
9815
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
9816
|
+
} else {
|
|
9817
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9818
|
+
}
|
|
9819
|
+
};
|
|
9820
|
+
function log(e) {
|
|
9821
|
+
try {
|
|
9822
|
+
const call = snapshot();
|
|
9823
|
+
const write = async () => {
|
|
9824
|
+
const ctx = await context();
|
|
9825
|
+
if (ctx.destination.kind === "none") {
|
|
9826
|
+
writeEvent(e, call, ctx, null, null, true);
|
|
9827
|
+
return;
|
|
9314
9828
|
}
|
|
9829
|
+
const branchIssue = call.envFields.task ? null : await branchIssueOnce(ctx.repo);
|
|
9830
|
+
const headSha = e.kind === "gate" ? await headShaOnce() : null;
|
|
9831
|
+
writeEvent(e, call, ctx, branchIssue, headSha, true);
|
|
9315
9832
|
};
|
|
9316
9833
|
const written = writeChain.then(write).catch((err) => {
|
|
9317
9834
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -9322,6 +9839,26 @@ function createLogSink(overrides = {}) {
|
|
|
9322
9839
|
written.finally(() => pendingWrites.delete(written));
|
|
9323
9840
|
} catch (err) {
|
|
9324
9841
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9842
|
+
`);
|
|
9843
|
+
}
|
|
9844
|
+
}
|
|
9845
|
+
function logSync(e, opts = {}) {
|
|
9846
|
+
try {
|
|
9847
|
+
const call = snapshot();
|
|
9848
|
+
let ctx = settledContext;
|
|
9849
|
+
if (ctx === undefined) {
|
|
9850
|
+
const destination = deps.unresolvedLogDestination(deps.env());
|
|
9851
|
+
if (destination.kind === "folder" && !opts.quiet) {
|
|
9852
|
+
warnOnce(`vinaya: the process ended before its log destination was resolved — the event is written to ${destination.folder}; \`vinaya log send\` delivers it to a configured server later
|
|
9853
|
+
`);
|
|
9854
|
+
}
|
|
9855
|
+
ctx = { repo: null, doctrine: "unknown", destination };
|
|
9856
|
+
}
|
|
9857
|
+
const branchIssue = ctx.destination.kind === "none" || call.envFields.task ? null : branchIssueIfSettled(ctx.repo);
|
|
9858
|
+
const headSha = e.kind === "gate" && ctx.destination.kind !== "none" ? headShaIfSettled() : null;
|
|
9859
|
+
writeEvent(e, call, ctx, branchIssue, headSha, false);
|
|
9860
|
+
} catch (err) {
|
|
9861
|
+
warnOnce(`vinaya: logSync() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9325
9862
|
`);
|
|
9326
9863
|
}
|
|
9327
9864
|
}
|
|
@@ -9342,7 +9879,7 @@ function createLogSink(overrides = {}) {
|
|
|
9342
9879
|
return;
|
|
9343
9880
|
});
|
|
9344
9881
|
};
|
|
9345
|
-
return { log, runId, warmup, drain };
|
|
9882
|
+
return { log, logSync, runId, warmup, drain, resetContext };
|
|
9346
9883
|
}
|
|
9347
9884
|
var defaultSink = createLogSink();
|
|
9348
9885
|
|
|
@@ -9350,6 +9887,8 @@ var defaultSink = createLogSink();
|
|
|
9350
9887
|
var activeChecks = new Map;
|
|
9351
9888
|
|
|
9352
9889
|
// src/lib/forge-write.ts
|
|
9890
|
+
var IMPORTABLE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
9891
|
+
var IMPORT_SEARCH_PATHSPEC = IMPORTABLE_EXTENSIONS.map((e) => `*${e}`);
|
|
9353
9892
|
var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
|
|
9354
9893
|
"depends-on-not-merged",
|
|
9355
9894
|
"conflicts-with"
|
|
@@ -9386,7 +9925,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
9386
9925
|
function fileDiffAgainst(ref, path) {
|
|
9387
9926
|
let out;
|
|
9388
9927
|
try {
|
|
9389
|
-
out =
|
|
9928
|
+
out = execFileSync7("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
9390
9929
|
encoding: "utf8",
|
|
9391
9930
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9392
9931
|
}).trim();
|
|
@@ -9397,7 +9936,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
9397
9936
|
}
|
|
9398
9937
|
function revParse(ref) {
|
|
9399
9938
|
try {
|
|
9400
|
-
return
|
|
9939
|
+
return execFileSync7("git", ["rev-parse", "--verify", ref], {
|
|
9401
9940
|
encoding: "utf8",
|
|
9402
9941
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9403
9942
|
}).trim();
|
|
@@ -9407,7 +9946,7 @@ function revParse(ref) {
|
|
|
9407
9946
|
}
|
|
9408
9947
|
function repoRoot() {
|
|
9409
9948
|
try {
|
|
9410
|
-
return
|
|
9949
|
+
return execFileSync7("git", ["rev-parse", "--show-toplevel"], {
|
|
9411
9950
|
encoding: "utf8",
|
|
9412
9951
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9413
9952
|
}).trim();
|
|
@@ -9418,7 +9957,7 @@ function repoRoot() {
|
|
|
9418
9957
|
function changedFiles(base) {
|
|
9419
9958
|
let out;
|
|
9420
9959
|
try {
|
|
9421
|
-
out =
|
|
9960
|
+
out = execFileSync7("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
9422
9961
|
encoding: "utf8",
|
|
9423
9962
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9424
9963
|
}).trim();
|
|
@@ -9466,7 +10005,7 @@ function findingsInThisDiff(findings) {
|
|
|
9466
10005
|
const abs = resolve2(diff.root, f.file);
|
|
9467
10006
|
if (!changed.has(abs))
|
|
9468
10007
|
return false;
|
|
9469
|
-
const relPath =
|
|
10008
|
+
const relPath = relative2(diff.root, abs);
|
|
9470
10009
|
if (!ranges.has(relPath))
|
|
9471
10010
|
ranges.set(relPath, changedLineRanges(diff.base, relPath));
|
|
9472
10011
|
const fileRanges = ranges.get(relPath) ?? null;
|
|
@@ -9479,7 +10018,7 @@ var CHECK_NAME = "exec-bits";
|
|
|
9479
10018
|
var EXECUTABLE_MODE = "100755";
|
|
9480
10019
|
function git2(args) {
|
|
9481
10020
|
try {
|
|
9482
|
-
return
|
|
10021
|
+
return execFileSync8("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
9483
10022
|
} catch {
|
|
9484
10023
|
return null;
|
|
9485
10024
|
}
|
|
@@ -9493,7 +10032,7 @@ function indexMode(path) {
|
|
|
9493
10032
|
}
|
|
9494
10033
|
function hasShebang(path) {
|
|
9495
10034
|
try {
|
|
9496
|
-
return
|
|
10035
|
+
return readFileSync8(path, "utf8").startsWith("#!");
|
|
9497
10036
|
} catch {
|
|
9498
10037
|
return false;
|
|
9499
10038
|
}
|