@joshuafolkken/kit 1.1166.0 → 1.1229.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/.claude/.claude-plugin/plugin.json +1 -1
- package/.claude/settings.json +2 -2
- package/.claude/skills/dependency-update/SKILL.md +4 -8
- package/.claude/skills/epic-commands/SKILL.md +2 -2
- package/.claude/skills/epic-commands/epic-bundle.md +1 -1
- package/.claude/skills/workflow-commands/SKILL.md +2 -4
- package/.claude/skills/workflow-commands/backlogrun-child.md +6 -4
- package/.claude/skills/workflow-commands/backlogrun-lanes.md +9 -5
- package/.claude/skills/workflow-commands/backlogrun-park.md +29 -9
- package/.claude/skills/workflow-commands/backlogrun-progress.md +7 -2
- package/.claude/skills/workflow-commands/backlogrun-recovery.md +4 -3
- package/.claude/skills/workflow-commands/backlogrun-steps.md +24 -15
- package/.claude/skills/workflow-commands/chain-rule.md +1 -1
- package/.claude/skills/workflow-commands/delegation.md +2 -2
- package/.claude/skills/workflow-commands/followup.md +5 -0
- package/.claude/skills/workflow-commands/fullrun-steps.md +1 -1
- package/.claude/skills/workflow-commands/halfrun.md +1 -1
- package/.claude/skills/workflow-commands/issue-scout.md +1 -1
- package/.claude/skills/workflow-commands/kickoff.md +1 -1
- package/.claude/skills/workflow-commands/observation-ledger.md +3 -3
- package/.claude/skills/workflow-commands/pre-gate-cut.md +10 -5
- package/.claude/skills/workflow-commands/prerequisite.md +2 -2
- package/.claude/skills/workflow-commands/progress-watcher.md +1 -1
- package/.claude/skills/workflow-commands/working-tree-hold.md +1 -1
- package/.codex/hooks.json +2 -2
- package/.cursorrules +6 -41
- package/.github/actions/setup-node/action.yml +1 -1
- package/.github/workflows/auto-tag.yml +3 -4
- package/.github/workflows/ci.yml +47 -33
- package/.github/workflows/dependabot-auto-merge.yml +13 -6
- package/.github/workflows/publish.yml +48 -4
- package/.github/workflows/sonar-qube.yml +3 -0
- package/.pnpmfile.mjs +4 -3
- package/.prettierignore +8 -2
- package/CLAUDE.md +18 -20
- package/README.md +26 -19
- package/SECURITY.md +15 -1
- package/dist/CLAUDE.md +18 -20
- package/dist/commands/document-section-cli.js +734 -0
- package/dist/hooks/audit-provision.js +346 -0
- package/dist/hooks/batch-guard.js +5 -4
- package/dist/hooks/{chunk-DYAVAM6S.js → chunk-55HHG5PX.js} +1405 -631
- package/dist/hooks/{chunk-A6P7PN7P.js → chunk-5VMKCCC4.js} +25 -10
- package/dist/hooks/chunk-5VNDSNG3.js +12 -0
- package/dist/hooks/{chunk-5KTCMCOT.js → chunk-6HJJXRBX.js} +4 -2
- package/dist/hooks/chunk-CDY4NFQG.js +15 -0
- package/dist/hooks/chunk-ELCN5LCH.js +135 -0
- package/dist/hooks/{chunk-ENA7P5FB.js → chunk-F56MFS4B.js} +3 -3
- package/dist/hooks/{chunk-ANJ2WGFD.js → chunk-FIVDHQGT.js} +7 -6
- package/dist/hooks/{chunk-3V37IID6.js → chunk-JBBMAPC4.js} +23 -14
- package/dist/hooks/{chunk-GU5MATVE.js → chunk-JUDKDCDP.js} +499 -389
- package/dist/hooks/{chunk-ZDZ555YH.js → chunk-NV2JRZZO.js} +743 -909
- package/dist/hooks/{chunk-V2BTOZHT.js → chunk-RNWHN5BP.js} +3 -3
- package/dist/hooks/{chunk-URJA6XY4.js → chunk-TQNPDZNH.js} +4 -4
- package/dist/hooks/{chunk-GYNGP7HI.js → chunk-VC3PZPZO.js} +1 -1
- package/dist/hooks/codex-hook-adapter.js +14 -12
- package/dist/hooks/duplicate-read-guard.js +6 -5
- package/dist/hooks/format-edited.js +4 -3
- package/dist/hooks/inputs.json +232 -210
- package/dist/hooks/investigation-guard.js +6 -5
- package/dist/hooks/pretool-guard.js +12 -10
- package/dist/hooks/session-lang.js +2 -4
- package/dist/hooks/stop-guard.js +81 -59
- package/dist/josh.js +872 -75
- package/dist/version/index.d.ts +7 -2
- package/dist/version/index.js +152 -75
- package/eslint/base.js +23 -1
- package/eslint/rules/code-quality.js +3 -0
- package/eslint/rules/early-return-one-liner.js +98 -0
- package/eslint/rules/unicorn.js +16 -1
- package/package.json +7 -6
- package/pnpm-workspace.yaml +9 -4
- package/prettier/basic.d.ts +3 -1
- package/prettier/index.d.ts +3 -1
- package/prettier/static.d.ts +3 -1
- package/prompts/coding-standards.md +1 -1
- package/prompts/collaboration-workflow/file-edits.md +4 -4
- package/prompts/collaboration-workflow/glossary.md +1 -1
- package/prompts/collaboration-workflow/operating-rules.md +17 -9
- package/prompts/collaboration-workflow/overview.md +2 -2
- package/prompts/collaboration-workflow/principles.md +14 -12
- package/prompts/collaboration-workflow/report-format.md +1 -1
- package/prompts/collaboration-workflow/residency.md +1 -1
- package/prompts/collaboration-workflow/rule-delivery.md +6 -6
- package/prompts/collaboration-workflow/shell-body.md +6 -6
- package/prompts/collaboration-workflow/turn-batching.md +1 -1
- package/prompts/collaboration-workflow/upstream-interrupt.md +12 -2
- package/prompts/collaboration-workflow/wip-cap.md +10 -10
- package/prompts/review-rubric.md +1 -2
- package/prompts/review.md +1 -1
- package/scripts/agent/agent-headless.ts +29 -0
- package/scripts/agent/agent-launch-environment.ts +6 -2
- package/scripts/agent/codex-agent-argv.ts +2 -1
- package/scripts/auto-ok/auto-ok-cli.ts +1 -1
- package/scripts/backlog/backlog-arrival.ts +3 -3
- package/scripts/backlog/backlog-budget.ts +1 -1
- package/scripts/backlog/backlog-drive-args.ts +135 -0
- package/scripts/backlog/backlog-drive-cli.ts +11 -137
- package/scripts/backlog/backlog-drive-launch.ts +39 -0
- package/scripts/backlog/backlog-drive-named-offer.ts +3 -5
- package/scripts/backlog/backlog-drive-named.ts +3 -3
- package/scripts/backlog/backlog-drive-offer-argv.ts +1 -1
- package/scripts/backlog/backlog-drive-owner.ts +1 -1
- package/scripts/backlog/backlog-drive-restore.ts +1 -1
- package/scripts/backlog/backlog-drive-retrospective.ts +1 -1
- package/scripts/backlog/backlog-drive.ts +1 -1
- package/scripts/backlog/backlog-next.ts +31 -9
- package/scripts/backlog/backlog-offer-cli.ts +6 -6
- package/scripts/backlog/backlog-offer.ts +1 -1
- package/scripts/backlog/backlog-plan-cli.ts +7 -6
- package/scripts/backlog/backlog-pool.ts +57 -11
- package/scripts/backlog/backlog-rank.ts +18 -9
- package/scripts/backlog/backlog-ready.ts +1 -1
- package/scripts/backlog/backlog-restructure.ts +152 -0
- package/scripts/backlog/backlog-scope.ts +1 -1
- package/scripts/backlog/backlog-stalled-detect.ts +2 -2
- package/scripts/backlog/backlog-stalled.ts +1 -1
- package/scripts/backlog/backlog-waves.ts +15 -17
- package/scripts/build/build-codex-hooks.ts +3 -1
- package/scripts/build/build-commands.ts +66 -0
- package/scripts/build/build-hooks.ts +2 -1
- package/scripts/build/build-library.ts +12 -3
- package/scripts/build/build.ts +70 -0
- package/scripts/build/local-bin.ts +3 -13
- package/scripts/cost-runtime/context-cut-threshold.ts +1 -9
- package/scripts/cost-runtime/cost-verdict.ts +15 -28
- package/scripts/delegation/investigation-reads.ts +3 -1
- package/scripts/discovery/repo-origin.ts +5 -5
- package/scripts/doctor/doctor-consumer.ts +2 -2
- package/scripts/doctor/doctor-io.ts +2 -3
- package/scripts/document/capped-print-part.ts +30 -0
- package/scripts/document/capped-print.ts +3 -4
- package/scripts/document/document-byte-budget.ts +11 -2
- package/scripts/document/document-scan.ts +117 -0
- package/scripts/document/document-section.ts +143 -16
- package/scripts/document/entry-read-budget.ts +5 -3
- package/scripts/document/entry-read-set.ts +10 -89
- package/scripts/document/read-set-cost.ts +98 -0
- package/scripts/epic/epic-add-body.ts +1 -0
- package/scripts/epic/epic-audit-checks.ts +1 -1
- package/scripts/epic/epic-audit-rationale.ts +4 -3
- package/scripts/epic/epic-bundle-cli.ts +14 -3
- package/scripts/epic/epic-bundle-poll.ts +41 -0
- package/scripts/epic/epic-busy.ts +1 -1
- package/scripts/epic/epic-candidate-confirm.ts +3 -2
- package/scripts/epic/epic-classify.ts +1 -1
- package/scripts/epic/epic-cli-argv.ts +78 -46
- package/scripts/epic/epic-cli-remove.ts +11 -19
- package/scripts/epic/epic-cli.ts +74 -73
- package/scripts/epic/epic-close-comment.ts +1 -1
- package/scripts/epic/epic-close.ts +1 -1
- package/scripts/epic/epic-cross-repo.ts +5 -5
- package/scripts/epic/epic-graph.ts +1 -1
- package/scripts/epic/epic-index.ts +1 -1
- package/scripts/epic/epic-issue.ts +2 -6
- package/scripts/epic/epic-lane-offer.ts +2 -2
- package/scripts/epic/epic-next.ts +29 -42
- package/scripts/epic/epic-solo-stale.ts +1 -1
- package/scripts/epic/epic-triage.ts +8 -4
- package/scripts/epic/epic-validate.ts +1 -1
- package/scripts/followup/git-followup-finish.ts +2 -2
- package/scripts/followup/git-followup-label.ts +2 -2
- package/scripts/followup/git-followup-merged.ts +2 -2
- package/scripts/followup/git-followup-stages.ts +9 -0
- package/scripts/followup/git-pr-followup-checks.ts +142 -0
- package/scripts/followup/git-pr-followup.ts +5 -130
- package/scripts/gate/core-budget.ts +69 -1
- package/scripts/gate/gate-plan.ts +47 -7
- package/scripts/gate/gate-skip.ts +38 -7
- package/scripts/gate/hook-gate-reuse.ts +12 -10
- package/scripts/gate/pre-commit-type-check.ts +4 -1
- package/scripts/gate/project-checks.ts +6 -9
- package/scripts/gate/type-check-step.ts +2 -3
- package/scripts/gate/verification-gate.ts +27 -8
- package/scripts/gh/git-gh-api-path.ts +2 -2
- package/scripts/gh/git-gh-issue-rest.ts +3 -3
- package/scripts/gh/git-gh-issue-write.ts +53 -7
- package/scripts/gh/git-gh-issue.ts +5 -3
- package/scripts/gh/git-gh-pr-read.ts +68 -19
- package/scripts/gh/git-gh-pr-rest.ts +1 -1
- package/scripts/gh/git-gh-pr.ts +5 -1
- package/scripts/gh/git-pr-ai-review.ts +1 -1
- package/scripts/gh/git-pr-checks-eval.ts +9 -3
- package/scripts/gh/git-pr-checks-parse.ts +1 -1
- package/scripts/gh/git-pr-checks-watch.ts +6 -5
- package/scripts/gh/git-pr-checks.ts +18 -6
- package/scripts/gh/git-pr-coderabbit.ts +1 -1
- package/scripts/gh/git-pr-error.ts +1 -3
- package/scripts/gh/git-pr.ts +9 -13
- package/scripts/gh/github-issue-url.ts +2 -2
- package/scripts/git/constants.ts +12 -6
- package/scripts/git/git-command.ts +20 -218
- package/scripts/git/git-diff-reads.ts +225 -0
- package/scripts/git/git-error.ts +4 -12
- package/scripts/git/git-pre-push-hook.ts +139 -0
- package/scripts/git/git-prompt.ts +2 -6
- package/scripts/git/{schemas.ts → git-schemas.ts} +2 -0
- package/scripts/git/git-spawn-sync.ts +3 -1
- package/scripts/git/git-spawn.ts +1 -1
- package/scripts/git/git-staging.ts +4 -6
- package/scripts/git/git-status.ts +3 -9
- package/scripts/git/main-merge.ts +57 -21
- package/scripts/hooks/codex-hook-adapter.ts +1 -1
- package/scripts/hooks/edited-cspell.ts +2 -4
- package/scripts/hooks/format-edited-file.ts +3 -12
- package/scripts/hooks/pre-push-unit.ts +31 -9
- package/scripts/hooks/reserved-run.ts +2 -2
- package/scripts/hooks/run-hook.sh +5 -4
- package/scripts/hooks/stop-guard.ts +5 -3
- package/scripts/init/init-actions.ts +0 -5
- package/scripts/init/init-ai-copy.ts +13 -2
- package/scripts/init/init-logic-json-merge.ts +19 -0
- package/scripts/init/init-logic-secretlint.ts +7 -7
- package/scripts/init/init-logic-workspace.ts +41 -2
- package/scripts/init/init-logic.ts +16 -26
- package/scripts/init/init.ts +5 -15
- package/scripts/init/initial-commit.ts +4 -4
- package/scripts/init/kit-development-versions.ts +40 -0
- package/scripts/init/kit-setup-state.ts +2 -2
- package/scripts/init/start-exec.ts +68 -19
- package/scripts/init/start-setup-pr.ts +9 -9
- package/scripts/init/start-steps.ts +6 -10
- package/scripts/issue/defect-rate-cli.ts +1 -1
- package/scripts/issue/git-next-issues.ts +1 -1
- package/scripts/issue/issue-auto-ok.ts +1 -1
- package/scripts/issue/issue-backlinks-cli.ts +2 -2
- package/scripts/issue/issue-backlinks.ts +9 -9
- package/scripts/issue/issue-comment-cli.ts +19 -13
- package/scripts/issue/issue-file-cli.ts +45 -18
- package/scripts/issue/issue-file.ts +24 -1
- package/scripts/issue/issue-scout-closed.ts +1 -1
- package/scripts/issue/issue-state-cli.ts +30 -74
- package/scripts/josh/josh-command-map.ts +2 -0
- package/scripts/josh/josh-command-types.ts +11 -0
- package/scripts/josh/josh-commands-ai.ts +4 -4
- package/scripts/josh/josh-commands-backlog.ts +4 -1
- package/scripts/josh/josh-commands-development.ts +11 -1
- package/scripts/josh/josh-commands-document.ts +1 -0
- package/scripts/josh/josh-commands-lane.ts +22 -0
- package/scripts/josh/josh-commands-maintenance.ts +4 -4
- package/scripts/josh/josh-commands-run.ts +12 -7
- package/scripts/josh/josh-in-process.ts +28 -9
- package/scripts/josh/josh-logic.ts +33 -15
- package/scripts/josh/process-identity.ts +1 -3
- package/scripts/josh/session-language-cli.ts +3 -4
- package/scripts/lane/lane-await.ts +5 -1
- package/scripts/lane/lane-child-invocation.ts +2 -2
- package/scripts/lane/lane-cli.ts +3 -3
- package/scripts/lane/lane-dispatch.ts +14 -10
- package/scripts/lane/lane-environment.ts +5 -1
- package/scripts/lane/lane-handoff.ts +1 -1
- package/scripts/lane/lane-install.ts +2 -13
- package/scripts/lane/lane-launch-cli.ts +35 -3
- package/scripts/lane/lane-ledger.ts +145 -0
- package/scripts/lane/lane-leftover.ts +1 -1
- package/scripts/lane/lane-load.ts +108 -0
- package/scripts/lane/lane-measure-cli.ts +149 -0
- package/scripts/lane/lane-occupancy.ts +3 -0
- package/scripts/lane/lane-reap.ts +1 -3
- package/scripts/lane/lane-relaunch.ts +1 -1
- package/scripts/lane/lane-stats.ts +224 -0
- package/scripts/lane/lane-vacant.ts +36 -0
- package/scripts/lane/openai-lane-ship.ts +2 -2
- package/scripts/lane/openai-lane-supervisor-owner.ts +180 -0
- package/scripts/lane/openai-lane-supervisor.ts +7 -165
- package/scripts/lane/openai-review-broker.ts +2 -4
- package/scripts/lib/ancestor-directories.ts +35 -0
- package/scripts/lib/animation-helpers.ts +2 -2
- package/scripts/lib/buffered-process.ts +3 -7
- package/scripts/lib/cli-flags.ts +71 -1
- package/scripts/lib/spawn-exit.ts +2 -2
- package/scripts/lib/timeouts.ts +35 -2
- package/scripts/lines/line-budget.ts +4 -6
- package/scripts/notify/telegram-notify.ts +26 -1
- package/scripts/notify/telegram-test.ts +6 -0
- package/scripts/observations/observation-ledger-line.ts +6 -6
- package/scripts/observations/observation-ledger-migrate.ts +55 -4
- package/scripts/observations/observation-ledger.ts +26 -7
- package/scripts/overrides/lockfile-overrides.ts +1 -1
- package/scripts/overrides/overrides-logic.ts +1 -1
- package/scripts/propagate/propagate-git.ts +1 -1
- package/scripts/propagate/propagate-publish.ts +2 -2
- package/scripts/propagate/propagate-steps.ts +20 -15
- package/scripts/propagate/propagate.ts +36 -27
- package/scripts/refactor/import-graph.ts +18 -1
- package/scripts/refactor/refactor-lint.ts +4 -4
- package/scripts/repo/repository-labels.ts +2 -2
- package/scripts/repo/required-checks-logic.ts +1 -3
- package/scripts/review/live-evidence.ts +2 -4
- package/scripts/review/review-brief-cli.ts +1 -1
- package/scripts/review/review-finding-ledger.ts +1 -1
- package/scripts/review/review-findings-cli.ts +1 -3
- package/scripts/rules/decision-oracle-batch.ts +128 -0
- package/scripts/rules/decision-oracle-tokens.ts +21 -0
- package/scripts/rules/decision-oracle.ts +8 -120
- package/scripts/rules/delivered-rules.ts +26 -182
- package/scripts/rules/direct-filing.ts +1 -1
- package/scripts/rules/early-heartbeat.ts +3 -3
- package/scripts/rules/git-argv.ts +1 -1
- package/scripts/rules/git-force.ts +1 -1
- package/scripts/rules/implementation-cut.ts +2 -2
- package/scripts/rules/index-guard.ts +1 -1
- package/scripts/rules/issue-comments.ts +118 -0
- package/scripts/rules/{issue-fold.ts → issue-fold-rule.ts} +2 -2
- package/scripts/rules/lane-background.ts +2 -2
- package/scripts/rules/lane-park.ts +18 -0
- package/scripts/rules/lane-split-park.ts +128 -0
- package/scripts/rules/oracle-firing.ts +1 -1
- package/scripts/rules/poll-loop.ts +1 -1
- package/scripts/rules/pre-gate-cut.ts +3 -3
- package/scripts/rules/protected-files.ts +59 -4
- package/scripts/rules/{run-tail.ts → run-tail-rule.ts} +2 -2
- package/scripts/rules/shell-body-trigger.ts +1 -1
- package/scripts/rules/stop-rules.ts +18 -7
- package/scripts/rules/test-declared-commit.ts +4 -4
- package/scripts/rules/wip-cap.ts +63 -0
- package/scripts/run/{run-carry-args.ts → carry/run-carry-args.ts} +37 -13
- package/scripts/run/{run-carry-change.ts → carry/run-carry-change.ts} +29 -7
- package/scripts/run/{run-carry-cli.ts → carry/run-carry-cli.ts} +4 -6
- package/scripts/run/{run-carry.ts → carry/run-carry.ts} +12 -6
- package/scripts/run/{run-cut-args.ts → cut/run-cut-args.ts} +1 -1
- package/scripts/run/{run-cut-cli.ts → cut/run-cut-cli.ts} +3 -3
- package/scripts/run/{run-cut-report.ts → cut/run-cut-report.ts} +2 -2
- package/scripts/run/{run-cut.ts → cut/run-cut.ts} +1 -1
- package/scripts/run/{run-entry-cli.ts → entry/run-entry-cli.ts} +11 -11
- package/scripts/run/{run-entry.ts → entry/run-entry.ts} +2 -2
- package/scripts/run/{run-event-scope.ts → event/run-event-scope.ts} +1 -1
- package/scripts/run/{run-event-stream-emit.ts → event/run-event-stream-emit.ts} +1 -1
- package/scripts/run/{run-event-stream.ts → event/run-event-stream.ts} +16 -2
- package/scripts/run/{run-hold-cli.ts → hold/run-hold-cli.ts} +5 -5
- package/scripts/run/{run-merge-cli.ts → merge/run-merge-cli.ts} +10 -5
- package/scripts/run/{run-merge-steps.ts → merge/run-merge-steps.ts} +53 -5
- package/scripts/run/{run-merge.ts → merge/run-merge.ts} +1 -1
- package/scripts/run/{run-progress-cli.ts → progress/run-progress-cli.ts} +1 -1
- package/scripts/run/{run-progress-config.ts → progress/run-progress-config.ts} +2 -17
- package/scripts/run/{run-progress-read.ts → progress/run-progress-read.ts} +5 -5
- package/scripts/run/{run-progress.ts → progress/run-progress.ts} +1 -1
- package/scripts/run/{run-review-steps.ts → review/run-review-steps.ts} +2 -3
- package/scripts/run/run-ending.ts +2 -2
- package/scripts/run/run-halfrun-resume.ts +6 -1
- package/scripts/run/run-headless.ts +1 -1
- package/scripts/run/run-invocation.ts +85 -84
- package/scripts/run/run-liveness.ts +1 -1
- package/scripts/run/run-parent-cut-hook.ts +1 -1
- package/scripts/run/run-preflight.ts +6 -6
- package/scripts/run/run-prep-cli.ts +1 -1
- package/scripts/run/run-prrun-resume.ts +1 -1
- package/scripts/run/run-report-cli.ts +4 -4
- package/scripts/run/run-report.ts +2 -2
- package/scripts/run/run-status-cli.ts +1 -1
- package/scripts/run/run-step-cli.ts +3 -3
- package/scripts/run/run-step.ts +2 -2
- package/scripts/run/run-stop-notify.ts +1 -1
- package/scripts/run/run-stranded-detect.ts +4 -4
- package/scripts/run/run-stranded.ts +2 -2
- package/scripts/run/run-watcher-guard-cli.ts +1 -1
- package/scripts/run/run-watcher-guard.ts +5 -3
- package/scripts/run/run-watcher-hook.ts +1 -1
- package/scripts/run/{run-ship-cli.ts → ship/run-ship-cli.ts} +29 -8
- package/scripts/run/{run-ship-detach.ts → ship/run-ship-detach.ts} +3 -3
- package/scripts/run/ship/run-ship-lock.ts +50 -0
- package/scripts/run/{run-ship-next.ts → ship/run-ship-next.ts} +13 -0
- package/scripts/run/ship/run-ship-pre-detach.ts +66 -0
- package/scripts/run/{run-ship-preflight.ts → ship/run-ship-preflight.ts} +6 -2
- package/scripts/run/{run-ship-probe.ts → ship/run-ship-probe.ts} +2 -2
- package/scripts/run/{run-ship-return.ts → ship/run-ship-return.ts} +10 -6
- package/scripts/run/{run-ship-review-steps.ts → ship/run-ship-review-steps.ts} +3 -3
- package/scripts/run/{run-ship-scoped.ts → ship/run-ship-scoped.ts} +10 -1
- package/scripts/run/{run-ship-stage.ts → ship/run-ship-stage.ts} +13 -0
- package/scripts/run/{run-ship-steps.ts → ship/run-ship-steps.ts} +15 -8
- package/scripts/run/ship/run-ship-stop-text.ts +13 -0
- package/scripts/run/ship/run-ship-sync.ts +128 -0
- package/scripts/run/{run-ship.ts → ship/run-ship.ts} +6 -0
- package/scripts/run/{run-tidy-lanes.ts → tidy/run-tidy-lanes.ts} +1 -1
- package/scripts/run/{run-wake-cli.ts → wake/run-wake-cli.ts} +31 -9
- package/scripts/run/{run-wake-describe.ts → wake/run-wake-describe.ts} +3 -3
- package/scripts/run/{run-wake-driver.ts → wake/run-wake-driver.ts} +99 -17
- package/scripts/run/{run-wake-handoff.ts → wake/run-wake-handoff.ts} +1 -1
- package/scripts/run/{run-wake-loop.ts → wake/run-wake-loop.ts} +8 -2
- package/scripts/run/wake/run-wake-restart.ts +58 -0
- package/scripts/run/{run-wake-session.ts → wake/run-wake-session.ts} +3 -3
- package/scripts/run/{run-wake.ts → wake/run-wake.ts} +1 -1
- package/scripts/safe-chain/preinstall-command.ts +20 -21
- package/scripts/safe-chain/project-config.ts +19 -15
- package/scripts/sync/sync-ai-files.ts +1 -1
- package/scripts/sync/sync-configs.ts +2 -1
- package/scripts/sync/sync.ts +15 -2
- package/scripts/test/test-red-logic.ts +17 -2
- package/scripts/test/test-red.ts +8 -7
- package/scripts/test/unit-worker-share.ts +1 -0
- package/scripts/time-runtime/time-background.ts +5 -1
- package/scripts/time-runtime/time-instant.ts +3 -1
- package/scripts/time-runtime/time-spans.ts +6 -139
- package/scripts/time-runtime/time-tool-call.ts +160 -0
- package/scripts/time-runtime/time-transcript-line.ts +27 -1
- package/scripts/version/effective-upstream.ts +2 -20
- package/scripts/version/latest-corepack.ts +17 -17
- package/scripts/version/latest-regression.ts +1 -1
- package/scripts/version/latest-update.ts +4 -4
- package/scripts/version/npm-registry.ts +20 -5
- package/scripts/version/publishable-range-check.ts +2 -2
- package/scripts/version/publishable-range.ts +1 -1
- package/scripts/version/release-age.ts +48 -38
- package/scripts/version/release-hold.ts +1 -1
- package/scripts/version/safe-chain-version-update.ts +40 -0
- package/scripts/version/upgrade-shell-command.ts +48 -8
- package/scripts/version/version-check-logic.ts +23 -14
- package/scripts/version/version-commands.ts +23 -11
- package/scripts/version/version-remote.ts +28 -13
- package/templates/pnpm-workspace.basic.yaml +4 -0
- package/templates/workflows/dependabot-auto-merge.yml +5 -5
- package/templates/workflows/github-release.yml +2 -0
- package/scripts/build/build-config-merge.ts +0 -27
- package/scripts/build/build-managed-marker.ts +0 -27
- package/scripts/build/build-self-sync-guard.ts +0 -27
- package/scripts/build/build-version.ts +0 -26
- package/scripts/version/preinstall-version-update.ts +0 -86
- /package/scripts/overrides/{schemas.ts → overrides-schemas.ts} +0 -0
- /package/scripts/run/{run-carry-conversation.ts → carry/run-carry-conversation.ts} +0 -0
- /package/scripts/run/{run-carry-reclaim.ts → carry/run-carry-reclaim.ts} +0 -0
- /package/scripts/run/{run-carry-stash.ts → carry/run-carry-stash.ts} +0 -0
- /package/scripts/run/{run-carry-streak.ts → carry/run-carry-streak.ts} +0 -0
- /package/scripts/run/{run-cut-handoff.ts → cut/run-cut-handoff.ts} +0 -0
- /package/scripts/run/{run-entry-stop.ts → entry/run-entry-stop.ts} +0 -0
- /package/scripts/run/{run-event-cli.ts → event/run-event-cli.ts} +0 -0
- /package/scripts/run/{run-event-follow.ts → event/run-event-follow.ts} +0 -0
- /package/scripts/run/{run-event-render.ts → event/run-event-render.ts} +0 -0
- /package/scripts/run/{run-event-watch.ts → event/run-event-watch.ts} +0 -0
- /package/scripts/run/{run-hold.ts → hold/run-hold.ts} +0 -0
- /package/scripts/run/{run-progress-args.ts → progress/run-progress-args.ts} +0 -0
- /package/scripts/run/{run-progress-clock.ts → progress/run-progress-clock.ts} +0 -0
- /package/scripts/run/{run-review-cli.ts → review/run-review-cli.ts} +0 -0
- /package/scripts/run/{run-review.ts → review/run-review.ts} +0 -0
- /package/scripts/run/{run-ship-review.ts → ship/run-ship-review.ts} +0 -0
- /package/scripts/run/{run-tidy-cli.ts → tidy/run-tidy-cli.ts} +0 -0
- /package/scripts/run/{run-tidy-stashes.ts → tidy/run-tidy-stashes.ts} +0 -0
- /package/scripts/run/{run-tidy.ts → tidy/run-tidy.ts} +0 -0
|
@@ -1,26 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
error_text
|
|
3
|
+
} from "./chunk-CDY4NFQG.js";
|
|
1
4
|
import {
|
|
2
5
|
lane_child_marker,
|
|
3
6
|
run_issue_number
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6HJJXRBX.js";
|
|
5
8
|
import {
|
|
6
|
-
|
|
9
|
+
CHECK_STATUS_FAIL,
|
|
10
|
+
CHECK_STATUS_PENDING,
|
|
11
|
+
PrConflictError,
|
|
12
|
+
blocking_issue_schema,
|
|
7
13
|
cost_blocks,
|
|
8
14
|
cost_transcript,
|
|
9
15
|
cost_usage,
|
|
16
|
+
describe_pr_failure,
|
|
17
|
+
evaluate_pr_state,
|
|
10
18
|
file_reader,
|
|
19
|
+
is_coderabbit_check,
|
|
20
|
+
is_merge_conflict,
|
|
21
|
+
is_required_check,
|
|
22
|
+
is_review_decision_decisive,
|
|
11
23
|
json_value,
|
|
12
24
|
lane_paths,
|
|
13
|
-
|
|
25
|
+
parse_pr_state_snapshot,
|
|
26
|
+
process_identity,
|
|
27
|
+
process_owner_schema,
|
|
28
|
+
read_string,
|
|
29
|
+
rest_comment_schema,
|
|
14
30
|
time_density_hook,
|
|
15
31
|
time_shell,
|
|
16
32
|
time_transcript_line
|
|
17
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-55HHG5PX.js";
|
|
18
34
|
import {
|
|
19
35
|
ENV_FILE_NAME,
|
|
20
36
|
LANE_SEAT_KEY,
|
|
21
37
|
PORT_SEED_KEY,
|
|
22
38
|
ports
|
|
23
39
|
} from "./chunk-RKUAD3I6.js";
|
|
40
|
+
import {
|
|
41
|
+
COMMAND_TIMEOUT_MS,
|
|
42
|
+
GIT_TIMEOUT_MS,
|
|
43
|
+
PLATFORM_TEMP_ROOT,
|
|
44
|
+
PROBE_TIMEOUT_MS,
|
|
45
|
+
stamp_file
|
|
46
|
+
} from "./chunk-ELCN5LCH.js";
|
|
24
47
|
|
|
25
48
|
// scripts/lib/bounded-pool.ts
|
|
26
49
|
function pool_width(limit, total) {
|
|
@@ -144,8 +167,8 @@ function current_turn(tail) {
|
|
|
144
167
|
function turn_filing_count(tail) {
|
|
145
168
|
return prior_filing_count(current_turn(tail));
|
|
146
169
|
}
|
|
147
|
-
function decide(_call,
|
|
148
|
-
return prior_filing_count(time_density_hook.read_tail(
|
|
170
|
+
function decide(_call, run4) {
|
|
171
|
+
return prior_filing_count(time_density_hook.read_tail(run4.transcript)) >= CAP_REACHED;
|
|
149
172
|
}
|
|
150
173
|
var FILING_CAP_REASON = `\u26D4 filing cap: this run has already filed ${String(FILING_CAP)} Issues, the per-run ceiling \u2014 on reaching it, stop and report rather than filing more. Automatic filing is capped so a run cannot manufacture Issues faster than they can be closed (\`.claude/skills/workflow-commands/SKILL.md\` \u2192 \`prerequisite.md\`, \`observation-filing.md\`). A further Issue that genuinely must exist is a person's call, not this run's. **This rule fires on every filing past the cap, not once per run**, so reissuing the same filing will be refused again.`;
|
|
151
174
|
var ROW = {
|
|
@@ -168,16 +191,15 @@ import { platform } from "node:os";
|
|
|
168
191
|
var GIT_COMMAND_UNIX = "/usr/bin/git";
|
|
169
192
|
var PORCELAIN_FLAG = "--porcelain";
|
|
170
193
|
var UNTRACKED_FILES_FLAG = "--untracked-files=all";
|
|
194
|
+
var GIT_BINARY_KEY = "JOSH_GIT_BINARY";
|
|
171
195
|
function get_git_command() {
|
|
172
|
-
if (platform() === "win32")
|
|
173
|
-
return String.raw`"C:\Program Files\Git\cmd\git.exe"`;
|
|
174
|
-
}
|
|
196
|
+
if (platform() === "win32") return String.raw`"C:\Program Files\Git\cmd\git.exe"`;
|
|
175
197
|
return GIT_COMMAND_UNIX;
|
|
176
198
|
}
|
|
177
199
|
function get_git_command_for_spawn() {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
200
|
+
const binary = process.env[GIT_BINARY_KEY];
|
|
201
|
+
if (binary !== void 0 && binary !== "") return binary;
|
|
202
|
+
if (platform() === "win32") return String.raw`C:\Program Files\Git\cmd\git.exe`;
|
|
181
203
|
return GIT_COMMAND_UNIX;
|
|
182
204
|
}
|
|
183
205
|
var git_utilities = {
|
|
@@ -185,6 +207,9 @@ var git_utilities = {
|
|
|
185
207
|
get_git_command_for_spawn
|
|
186
208
|
};
|
|
187
209
|
|
|
210
|
+
// scripts/git/git-spawn.ts
|
|
211
|
+
import { execa as execa3 } from "execa";
|
|
212
|
+
|
|
188
213
|
// scripts/git/git-execa-error.ts
|
|
189
214
|
function get_exit_code(error) {
|
|
190
215
|
if (typeof error !== "object" || error === null) return void 0;
|
|
@@ -284,7 +309,6 @@ var git_push_transport = {
|
|
|
284
309
|
};
|
|
285
310
|
|
|
286
311
|
// scripts/git/git-spawn.ts
|
|
287
|
-
import { execa as execa3 } from "execa";
|
|
288
312
|
async function read(arguments_) {
|
|
289
313
|
const git_cmd = git_utilities.get_git_command_for_spawn();
|
|
290
314
|
const { stdout } = await execa3(git_cmd, arguments_);
|
|
@@ -336,73 +360,7 @@ var git_spawn = {
|
|
|
336
360
|
with_output_remote
|
|
337
361
|
};
|
|
338
362
|
|
|
339
|
-
// scripts/
|
|
340
|
-
function read_spawn_stdout(result) {
|
|
341
|
-
return result.stdout ?? "";
|
|
342
|
-
}
|
|
343
|
-
function read_spawn_stderr(result) {
|
|
344
|
-
return result.stderr ?? "";
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// scripts/git/git-spawn-sync.ts
|
|
348
|
-
import { execaSync } from "execa";
|
|
349
|
-
var GIT_TIMEOUT_MS = 1e4;
|
|
350
|
-
var SUCCESS_EXIT_CODE = 0;
|
|
351
|
-
var C_LOCALE = { LC_ALL: "C", LANGUAGE: "C" };
|
|
352
|
-
function run(args, options = {}) {
|
|
353
|
-
const result = execaSync(git_utilities.get_git_command_for_spawn(), args, {
|
|
354
|
-
...options,
|
|
355
|
-
extendEnv: true,
|
|
356
|
-
reject: false,
|
|
357
|
-
timeout: options.timeout ?? GIT_TIMEOUT_MS
|
|
358
|
-
});
|
|
359
|
-
return {
|
|
360
|
-
exit_code: result.exitCode,
|
|
361
|
-
stdout: read_spawn_stdout(result),
|
|
362
|
-
stderr: read_spawn_stderr(result)
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
function read2(args, options = {}) {
|
|
366
|
-
const result = run(args, options);
|
|
367
|
-
return result.exit_code === SUCCESS_EXIT_CODE ? result.stdout.trim() : void 0;
|
|
368
|
-
}
|
|
369
|
-
function origin_url(cwd) {
|
|
370
|
-
return read2(["config", "--get", "remote.origin.url"], { cwd });
|
|
371
|
-
}
|
|
372
|
-
function toplevel(timeout = GIT_TIMEOUT_MS) {
|
|
373
|
-
return run(["rev-parse", "--show-toplevel"], { env: C_LOCALE, timeout });
|
|
374
|
-
}
|
|
375
|
-
var git_spawn_sync = { GIT_TIMEOUT_MS, C_LOCALE, run, read: read2, origin_url, toplevel };
|
|
376
|
-
|
|
377
|
-
// scripts/git/git-command.ts
|
|
378
|
-
async function branch() {
|
|
379
|
-
return await git_spawn.read(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
380
|
-
}
|
|
381
|
-
async function status(directory) {
|
|
382
|
-
const location = directory === void 0 ? [] : ["-C", directory];
|
|
383
|
-
return await git_spawn.read([...location, "status", PORCELAIN_FLAG, UNTRACKED_FILES_FLAG]);
|
|
384
|
-
}
|
|
385
|
-
async function repository_root() {
|
|
386
|
-
const result = git_spawn_sync.toplevel();
|
|
387
|
-
if (result.exit_code !== 0) throw create_spawn_error("rev-parse", result.exit_code);
|
|
388
|
-
return result.stdout.trim();
|
|
389
|
-
}
|
|
390
|
-
async function head_commit() {
|
|
391
|
-
return await git_spawn.read(["rev-parse", "HEAD"]);
|
|
392
|
-
}
|
|
393
|
-
var GIT_DIRECTORY_ARGUMENTS = [
|
|
394
|
-
"rev-parse",
|
|
395
|
-
"--absolute-git-dir",
|
|
396
|
-
"--path-format=absolute",
|
|
397
|
-
"--git-common-dir"
|
|
398
|
-
];
|
|
399
|
-
async function git_directories() {
|
|
400
|
-
const output = await git_spawn.read([...GIT_DIRECTORY_ARGUMENTS]);
|
|
401
|
-
return output.split("\n").filter((line) => line !== "");
|
|
402
|
-
}
|
|
403
|
-
async function diff_cached(file_path) {
|
|
404
|
-
return await git_spawn.read(["diff", "--cached", file_path]);
|
|
405
|
-
}
|
|
363
|
+
// scripts/git/git-diff-reads.ts
|
|
406
364
|
var REFS_REMOTES_ORIGIN_PREFIX = "refs/remotes/origin/";
|
|
407
365
|
var NAME_ONLY_FLAG = "--name-only";
|
|
408
366
|
var DEFAULT_BRANCH_FALLBACK = "main";
|
|
@@ -491,6 +449,164 @@ async function untracked_names() {
|
|
|
491
449
|
WHOLE_TREE_PATHSPEC
|
|
492
450
|
]);
|
|
493
451
|
}
|
|
452
|
+
var git_diff_reads = {
|
|
453
|
+
change_base,
|
|
454
|
+
change_base_commit,
|
|
455
|
+
default_branch_reference,
|
|
456
|
+
diff_cached_names,
|
|
457
|
+
diff_main,
|
|
458
|
+
diff_main_names,
|
|
459
|
+
diff_main_numstat,
|
|
460
|
+
get_default_branch,
|
|
461
|
+
untracked_names
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
// scripts/git/git-pre-push-hook.ts
|
|
465
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
466
|
+
import { tmpdir } from "node:os";
|
|
467
|
+
import path from "node:path";
|
|
468
|
+
var REMOTE = "origin";
|
|
469
|
+
var HOOK_NAME = "pre-push";
|
|
470
|
+
var PROBE_HOOK_NAME = "kit-hook-run-probe";
|
|
471
|
+
var ALLOW_UNKNOWN_HOOK_NAME_FLAG = "--allow-unknown-hook-name";
|
|
472
|
+
var HOOK_RUN = "run";
|
|
473
|
+
var STDIN_FILE = "refs";
|
|
474
|
+
var TEMPORARY_PREFIX = "kit-pre-push-";
|
|
475
|
+
var ZERO_DIGIT = "0";
|
|
476
|
+
async function read_remote_oid(branch2) {
|
|
477
|
+
try {
|
|
478
|
+
return await git_spawn.read([
|
|
479
|
+
"rev-parse",
|
|
480
|
+
"--verify",
|
|
481
|
+
"--quiet",
|
|
482
|
+
`refs/remotes/${REMOTE}/${branch2}`
|
|
483
|
+
]);
|
|
484
|
+
} catch {
|
|
485
|
+
return void 0;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
async function read_push_references() {
|
|
489
|
+
const [branch2, local_oid] = await Promise.all([
|
|
490
|
+
git_spawn.read(["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
491
|
+
git_spawn.read(["rev-parse", "HEAD"])
|
|
492
|
+
]);
|
|
493
|
+
return { branch: branch2, local_oid, remote_oid: await read_remote_oid(branch2) };
|
|
494
|
+
}
|
|
495
|
+
function to_stdin_line(references) {
|
|
496
|
+
const reference2 = `refs/heads/${references.branch}`;
|
|
497
|
+
const remote_oid = references.remote_oid ?? ZERO_DIGIT.repeat(references.local_oid.length);
|
|
498
|
+
return `${reference2} ${references.local_oid} ${reference2} ${remote_oid}
|
|
499
|
+
`;
|
|
500
|
+
}
|
|
501
|
+
function to_hook_run_arguments(stdin_path, hook_name) {
|
|
502
|
+
return [HOOK_RUN, "--ignore-missing", `--to-stdin=${stdin_path}`, hook_name];
|
|
503
|
+
}
|
|
504
|
+
async function can_probe(probe_arguments) {
|
|
505
|
+
try {
|
|
506
|
+
await git_spawn.read(["hook", ...probe_arguments]);
|
|
507
|
+
return true;
|
|
508
|
+
} catch {
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
async function can_run_hooks(stdin_path) {
|
|
513
|
+
const [, ...options] = to_hook_run_arguments(stdin_path, PROBE_HOOK_NAME);
|
|
514
|
+
if (await can_probe([HOOK_RUN, ALLOW_UNKNOWN_HOOK_NAME_FLAG, ...options])) return true;
|
|
515
|
+
return await can_probe([HOOK_RUN, ...options]);
|
|
516
|
+
}
|
|
517
|
+
async function run_with_stdin(stdin_line) {
|
|
518
|
+
const directory = await mkdtemp(path.join(tmpdir(), TEMPORARY_PREFIX));
|
|
519
|
+
const stdin_path = path.join(directory, STDIN_FILE);
|
|
520
|
+
try {
|
|
521
|
+
await writeFile(stdin_path, stdin_line);
|
|
522
|
+
if (!await can_run_hooks(stdin_path)) return false;
|
|
523
|
+
const url = await git_spawn.read(["remote", "get-url", REMOTE]);
|
|
524
|
+
await git_spawn.with_output("hook", [
|
|
525
|
+
...to_hook_run_arguments(stdin_path, HOOK_NAME),
|
|
526
|
+
"--",
|
|
527
|
+
REMOTE,
|
|
528
|
+
url
|
|
529
|
+
]);
|
|
530
|
+
return true;
|
|
531
|
+
} finally {
|
|
532
|
+
await rm(directory, { force: true, recursive: true });
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
async function run() {
|
|
536
|
+
const references = await read_push_references();
|
|
537
|
+
if (references.local_oid === references.remote_oid) return true;
|
|
538
|
+
return await run_with_stdin(to_stdin_line(references));
|
|
539
|
+
}
|
|
540
|
+
var git_pre_push_hook = {
|
|
541
|
+
run
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
// scripts/lib/spawn-exit.ts
|
|
545
|
+
function read_spawn_stdout(result) {
|
|
546
|
+
return result.stdout ?? "";
|
|
547
|
+
}
|
|
548
|
+
function read_spawn_stderr(result) {
|
|
549
|
+
return result.stderr ?? "";
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// scripts/git/git-spawn-sync.ts
|
|
553
|
+
import { execaSync } from "execa";
|
|
554
|
+
var SUCCESS_EXIT_CODE = 0;
|
|
555
|
+
var C_LOCALE = { LC_ALL: "C", LANGUAGE: "C" };
|
|
556
|
+
function run2(args, options = {}) {
|
|
557
|
+
const result = execaSync(git_utilities.get_git_command_for_spawn(), args, {
|
|
558
|
+
...options,
|
|
559
|
+
extendEnv: true,
|
|
560
|
+
reject: false,
|
|
561
|
+
timeout: options.timeout ?? GIT_TIMEOUT_MS
|
|
562
|
+
});
|
|
563
|
+
return {
|
|
564
|
+
exit_code: result.exitCode,
|
|
565
|
+
stdout: read_spawn_stdout(result),
|
|
566
|
+
stderr: read_spawn_stderr(result)
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function read2(args, options = {}) {
|
|
570
|
+
const result = run2(args, options);
|
|
571
|
+
return result.exit_code === SUCCESS_EXIT_CODE ? result.stdout.trim() : void 0;
|
|
572
|
+
}
|
|
573
|
+
function origin_url(cwd) {
|
|
574
|
+
return read2(["config", "--get", "remote.origin.url"], { cwd });
|
|
575
|
+
}
|
|
576
|
+
function toplevel(timeout = GIT_TIMEOUT_MS) {
|
|
577
|
+
return run2(["rev-parse", "--show-toplevel"], { env: C_LOCALE, timeout });
|
|
578
|
+
}
|
|
579
|
+
var git_spawn_sync = { GIT_TIMEOUT_MS, C_LOCALE, run: run2, read: read2, origin_url, toplevel };
|
|
580
|
+
|
|
581
|
+
// scripts/git/git-command.ts
|
|
582
|
+
async function branch() {
|
|
583
|
+
return await git_spawn.read(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
584
|
+
}
|
|
585
|
+
async function status(directory) {
|
|
586
|
+
const location = directory === void 0 ? [] : ["-C", directory];
|
|
587
|
+
return await git_spawn.read([...location, "status", PORCELAIN_FLAG, UNTRACKED_FILES_FLAG]);
|
|
588
|
+
}
|
|
589
|
+
async function repository_root() {
|
|
590
|
+
const result = git_spawn_sync.toplevel();
|
|
591
|
+
if (result.exit_code !== 0) throw create_spawn_error("rev-parse", result.exit_code);
|
|
592
|
+
return result.stdout.trim();
|
|
593
|
+
}
|
|
594
|
+
async function head_commit() {
|
|
595
|
+
return await git_spawn.read(["rev-parse", "HEAD"]);
|
|
596
|
+
}
|
|
597
|
+
var GIT_DIRECTORY_ARGUMENTS = [
|
|
598
|
+
"rev-parse",
|
|
599
|
+
"--absolute-git-dir",
|
|
600
|
+
"--path-format=absolute",
|
|
601
|
+
"--git-common-dir"
|
|
602
|
+
];
|
|
603
|
+
async function git_directories() {
|
|
604
|
+
const output = await git_spawn.read([...GIT_DIRECTORY_ARGUMENTS]);
|
|
605
|
+
return output.split("\n").filter((line) => line !== "");
|
|
606
|
+
}
|
|
607
|
+
async function diff_cached(file_path) {
|
|
608
|
+
return await git_spawn.read(["diff", "--cached", file_path]);
|
|
609
|
+
}
|
|
494
610
|
async function fetch_branch(branch_name) {
|
|
495
611
|
const refspec = `+refs/heads/${branch_name}:refs/remotes/origin/${branch_name}`;
|
|
496
612
|
return await git_spawn.read(["fetch", "origin", refspec]);
|
|
@@ -532,16 +648,18 @@ function is_upstream_not_set_error(error) {
|
|
|
532
648
|
const { cause } = error;
|
|
533
649
|
return cause !== void 0 && is_exit_code_128(cause);
|
|
534
650
|
}
|
|
535
|
-
|
|
536
|
-
|
|
651
|
+
var NO_VERIFY_FLAG = "--no-verify";
|
|
652
|
+
async function push_with_upstream(branch_name, verify_flags) {
|
|
653
|
+
await git_push_transport.push([...verify_flags, "--set-upstream", "origin", branch_name]);
|
|
537
654
|
}
|
|
538
655
|
async function push2() {
|
|
656
|
+
const verify_flags = await git_pre_push_hook.run() ? [NO_VERIFY_FLAG] : [];
|
|
539
657
|
try {
|
|
540
|
-
await git_push_transport.push([]);
|
|
658
|
+
await git_push_transport.push([...verify_flags]);
|
|
541
659
|
} catch (error) {
|
|
542
660
|
if (is_upstream_not_set_error(error)) {
|
|
543
661
|
const current_branch = await branch();
|
|
544
|
-
await push_with_upstream(current_branch);
|
|
662
|
+
await push_with_upstream(current_branch, verify_flags);
|
|
545
663
|
return;
|
|
546
664
|
}
|
|
547
665
|
throw error;
|
|
@@ -626,15 +744,9 @@ var git_command = {
|
|
|
626
744
|
head_commit,
|
|
627
745
|
git_directories,
|
|
628
746
|
diff_cached,
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
change_base_commit,
|
|
633
|
-
diff_main_names,
|
|
634
|
-
diff_main_numstat,
|
|
635
|
-
untracked_names,
|
|
636
|
-
get_default_branch,
|
|
637
|
-
default_branch_reference,
|
|
747
|
+
// The default branch, the change base and every reading against it are `git-diff-reads.ts`'s
|
|
748
|
+
// (joshuafolkken/kit#3264), re-exported here so no call site, mock or spy moved with them.
|
|
749
|
+
...git_diff_reads,
|
|
638
750
|
fetch_branch,
|
|
639
751
|
merge_fast_forward,
|
|
640
752
|
fast_forward_local,
|
|
@@ -658,19 +770,7 @@ var git_command = {
|
|
|
658
770
|
is_upstream_not_set_error
|
|
659
771
|
};
|
|
660
772
|
|
|
661
|
-
// scripts/
|
|
662
|
-
function message_of(error) {
|
|
663
|
-
return error instanceof Error ? error.message : String(error);
|
|
664
|
-
}
|
|
665
|
-
var DEBUG_ENV_KEY = "JOSH_DEBUG";
|
|
666
|
-
function trace_swallowed(where, error) {
|
|
667
|
-
if ((process.env[DEBUG_ENV_KEY] ?? "").trim() === "") return;
|
|
668
|
-
process.stderr.write(`josh debug: ${where}: ${message_of(error)}
|
|
669
|
-
`);
|
|
670
|
-
}
|
|
671
|
-
var error_text = { message_of, trace_swallowed };
|
|
672
|
-
|
|
673
|
-
// scripts/run/run-hold.ts
|
|
773
|
+
// scripts/run/hold/run-hold.ts
|
|
674
774
|
import { z } from "zod";
|
|
675
775
|
var HOLD_PREFIX = "josh-run-hold-";
|
|
676
776
|
var UNNUMBERED_ISSUE = "new";
|
|
@@ -970,18 +1070,18 @@ function trimmed(value) {
|
|
|
970
1070
|
const result = value?.trim();
|
|
971
1071
|
return result === void 0 || result.length === EMPTY_LENGTH ? void 0 : result;
|
|
972
1072
|
}
|
|
973
|
-
function override_value(role, field,
|
|
1073
|
+
function override_value(role, field, environment3) {
|
|
974
1074
|
const key2 = ENV_KEYS[role][field];
|
|
975
|
-
const value = trimmed(
|
|
1075
|
+
const value = trimmed(environment3[key2]);
|
|
976
1076
|
if (value !== void 0) return { key: key2, value };
|
|
977
1077
|
if (role !== WORKER) return { key: key2, value: void 0 };
|
|
978
1078
|
const legacy = LEGACY_WORKER_KEYS[field];
|
|
979
|
-
const legacy_value = trimmed(
|
|
1079
|
+
const legacy_value = trimmed(environment3[legacy]);
|
|
980
1080
|
return legacy_value === void 0 ? { key: key2, value: void 0 } : { key: legacy, value: legacy_value };
|
|
981
1081
|
}
|
|
982
|
-
function model_override(role,
|
|
1082
|
+
function model_override(role, environment3, provider) {
|
|
983
1083
|
const key2 = ENV_KEYS[role].model;
|
|
984
|
-
return provider === OPENAI_PROVIDER ? { key: key2, value: void 0 } : override_value(role, "model",
|
|
1084
|
+
return provider === OPENAI_PROVIDER ? { key: key2, value: void 0 } : override_value(role, "model", environment3);
|
|
985
1085
|
}
|
|
986
1086
|
function rejection(key2, value, expected) {
|
|
987
1087
|
return { kind: "rejected", note: `${key2}=${value} ${expected}, so the agent was not started` };
|
|
@@ -990,35 +1090,35 @@ function resolved_effort(override, fallback) {
|
|
|
990
1090
|
const parsed = EFFORT_SCHEMA.safeParse(override.value ?? fallback);
|
|
991
1091
|
return parsed.success ? { kind: "effort", effort: parsed.data } : rejection(override.key, override.value ?? "", "is not an allowed effort");
|
|
992
1092
|
}
|
|
993
|
-
function has_session(
|
|
994
|
-
return keys.some((key2) => trimmed(
|
|
1093
|
+
function has_session(environment3, keys) {
|
|
1094
|
+
return keys.some((key2) => trimmed(environment3[key2]) !== void 0);
|
|
995
1095
|
}
|
|
996
1096
|
function session_rejection(is_conflicting) {
|
|
997
1097
|
const note = is_conflicting ? "both Codex and Claude Code sessions were detected" : "no Codex or Claude Code session was detected";
|
|
998
1098
|
return { kind: "rejected", note };
|
|
999
1099
|
}
|
|
1000
1100
|
var HANDED_PROVIDER_KEY = "JOSH_AGENT_PROVIDER";
|
|
1001
|
-
function handed_provider(
|
|
1002
|
-
const value = trimmed(
|
|
1101
|
+
function handed_provider(environment3) {
|
|
1102
|
+
const value = trimmed(environment3[HANDED_PROVIDER_KEY]);
|
|
1003
1103
|
if (value === void 0) return session_rejection(false);
|
|
1004
1104
|
const parsed = PROVIDER_SCHEMA.safeParse(value);
|
|
1005
1105
|
return parsed.success ? { kind: "provider", provider: parsed.data } : rejection(HANDED_PROVIDER_KEY, value, "is not an allowed provider");
|
|
1006
1106
|
}
|
|
1007
|
-
function detected_provider(
|
|
1008
|
-
const has_codex = has_session(
|
|
1009
|
-
const has_claude = has_session(
|
|
1107
|
+
function detected_provider(environment3) {
|
|
1108
|
+
const has_codex = has_session(environment3, [CODEX_SESSION_KEY]);
|
|
1109
|
+
const has_claude = has_session(environment3, agent_session_environment.PARENT_SESSION_KEYS);
|
|
1010
1110
|
if (has_codex === has_claude) return has_codex ? session_rejection(true) : void 0;
|
|
1011
1111
|
return { kind: "provider", provider: has_codex ? OPENAI_PROVIDER : ANTHROPIC_PROVIDER };
|
|
1012
1112
|
}
|
|
1013
|
-
function resolve_provider(
|
|
1014
|
-
return detected_provider(
|
|
1113
|
+
function resolve_provider(environment3 = process.env) {
|
|
1114
|
+
return detected_provider(environment3) ?? handed_provider(environment3);
|
|
1015
1115
|
}
|
|
1016
|
-
function has_completion_callback(
|
|
1017
|
-
const selected = resolve_provider(
|
|
1116
|
+
function has_completion_callback(environment3 = process.env) {
|
|
1117
|
+
const selected = resolve_provider(environment3);
|
|
1018
1118
|
return selected.kind !== "provider" || selected.provider !== OPENAI_PROVIDER;
|
|
1019
1119
|
}
|
|
1020
|
-
function handoff_environment(
|
|
1021
|
-
const selected = resolve_provider(
|
|
1120
|
+
function handoff_environment(environment3 = process.env) {
|
|
1121
|
+
const selected = resolve_provider(environment3);
|
|
1022
1122
|
return selected.kind === "provider" ? { [HANDED_PROVIDER_KEY]: selected.provider } : {};
|
|
1023
1123
|
}
|
|
1024
1124
|
function validate(profile, model_key) {
|
|
@@ -1032,19 +1132,19 @@ function phase_effort(role, phase, fallback) {
|
|
|
1032
1132
|
if (!parsed.success) return fallback;
|
|
1033
1133
|
return PHASE_EFFORT[role]?.[parsed.data] ?? fallback;
|
|
1034
1134
|
}
|
|
1035
|
-
function overridden_effort(profile, phase,
|
|
1036
|
-
const parsed = EFFORT_SCHEMA.safeParse(override_value(profile.role, "effort",
|
|
1135
|
+
function overridden_effort(profile, phase, environment3) {
|
|
1136
|
+
const parsed = EFFORT_SCHEMA.safeParse(override_value(profile.role, "effort", environment3).value);
|
|
1037
1137
|
return parsed.success ? parsed.data : phase_effort(profile.role, phase, profile.effort);
|
|
1038
1138
|
}
|
|
1039
|
-
function with_phase_effort(profile, phase,
|
|
1040
|
-
return { ...profile, effort: overridden_effort(profile, phase,
|
|
1139
|
+
function with_phase_effort(profile, phase, environment3 = process.env) {
|
|
1140
|
+
return { ...profile, effort: overridden_effort(profile, phase, environment3) };
|
|
1041
1141
|
}
|
|
1042
|
-
function resolve(role,
|
|
1043
|
-
const selected = resolve_provider(
|
|
1142
|
+
function resolve(role, environment3 = process.env, phase) {
|
|
1143
|
+
const selected = resolve_provider(environment3);
|
|
1044
1144
|
if (selected.kind === "rejected") return selected;
|
|
1045
1145
|
const defaults = PROVIDER_PROFILES[selected.provider][role];
|
|
1046
|
-
const model = model_override(role,
|
|
1047
|
-
const effort = override_value(role, "effort",
|
|
1146
|
+
const model = model_override(role, environment3, selected.provider);
|
|
1147
|
+
const effort = override_value(role, "effort", environment3);
|
|
1048
1148
|
const resolved = resolved_effort(effort, phase_effort(role, phase, defaults.effort));
|
|
1049
1149
|
if (resolved.kind === "rejected") return resolved;
|
|
1050
1150
|
const profile = {
|
|
@@ -1319,7 +1419,6 @@ var context_cut_payback = {
|
|
|
1319
1419
|
|
|
1320
1420
|
// scripts/cost-runtime/context-cut-threshold.ts
|
|
1321
1421
|
var CONTEXT_CUT_THRESHOLD = context_cut_payback.break_even_context();
|
|
1322
|
-
var RECENT_REQUEST_WINDOW = 10;
|
|
1323
1422
|
|
|
1324
1423
|
// scripts/git/git-common-directory.ts
|
|
1325
1424
|
import { execFileSync } from "node:child_process";
|
|
@@ -1356,7 +1455,7 @@ var git_location_environment = { clear_git_location_variables, location_free_env
|
|
|
1356
1455
|
// scripts/git/git-common-directory.ts
|
|
1357
1456
|
var OWN_GIT_DIRECTORY = 0;
|
|
1358
1457
|
var COMMON_GIT_DIRECTORY = 1;
|
|
1359
|
-
var
|
|
1458
|
+
var PROBE_TIMEOUT_MS2 = 5e3;
|
|
1360
1459
|
var answers = /* @__PURE__ */ new Map();
|
|
1361
1460
|
function probe_environment(cwd) {
|
|
1362
1461
|
if (cwd === void 0) return process.env;
|
|
@@ -1377,7 +1476,7 @@ function read_directories(cwd) {
|
|
|
1377
1476
|
env: probe_environment(cwd),
|
|
1378
1477
|
encoding: "utf8",
|
|
1379
1478
|
stdio: ["ignore", "pipe", "ignore"],
|
|
1380
|
-
timeout:
|
|
1479
|
+
timeout: PROBE_TIMEOUT_MS2
|
|
1381
1480
|
}
|
|
1382
1481
|
);
|
|
1383
1482
|
return output.split("\n").filter((line) => line !== "");
|
|
@@ -1409,12 +1508,13 @@ function resolve2(cwd) {
|
|
|
1409
1508
|
}
|
|
1410
1509
|
var git_common_directory = { directories, own, repository, resolve: resolve2, select_linked };
|
|
1411
1510
|
|
|
1412
|
-
// scripts/run/run-ship-stage.ts
|
|
1511
|
+
// scripts/run/ship/run-ship-stage.ts
|
|
1413
1512
|
import { z as z3 } from "zod";
|
|
1414
1513
|
var STAGE = {
|
|
1415
1514
|
PREFLIGHT: "preflight",
|
|
1416
1515
|
REVIEW: "review",
|
|
1417
1516
|
GATE: "gate",
|
|
1517
|
+
SYNC: "sync",
|
|
1418
1518
|
COMMIT: "commit",
|
|
1419
1519
|
ROUND_TWO: "round-2",
|
|
1420
1520
|
FOLLOWUP: "followup",
|
|
@@ -1464,6 +1564,9 @@ var DONE_BY = {
|
|
|
1464
1564
|
// the recorded round, and only a commit pins the tree that round read.
|
|
1465
1565
|
[STAGE.REVIEW]: (_done, state) => state.is_merged || state.is_committed,
|
|
1466
1566
|
[STAGE.GATE]: (_done, state) => state.is_merged || state.is_committed,
|
|
1567
|
+
// The merge of the default branch before the commit (joshuafolkken/kit#3221): once committed, a
|
|
1568
|
+
// conflicting pull request is the followup's to merge again.
|
|
1569
|
+
[STAGE.SYNC]: (_done, state) => state.is_merged || state.is_committed,
|
|
1467
1570
|
[STAGE.COMMIT]: (done, state) => state.is_merged || done.has(STAGE.COMMIT) && is_shipped(state),
|
|
1468
1571
|
// The round-2 pass (joshuafolkken/kit#2489) reads the pushed fix delta, so its record is honored only
|
|
1469
1572
|
// while that push still stands — new work pushed on top reruns it.
|
|
@@ -1484,6 +1587,10 @@ function commit_flags(state) {
|
|
|
1484
1587
|
function event_text(issue, stage, phase) {
|
|
1485
1588
|
return `#${issue} ${stage} ${phase}`;
|
|
1486
1589
|
}
|
|
1590
|
+
var CONFLICT = "conflict";
|
|
1591
|
+
function stop_reason2(stage, conflicts = []) {
|
|
1592
|
+
return conflicts.length > 0 ? CONFLICT : stage;
|
|
1593
|
+
}
|
|
1487
1594
|
var run_ship_stage = {
|
|
1488
1595
|
PHASE,
|
|
1489
1596
|
STAGE,
|
|
@@ -1493,10 +1600,11 @@ var run_ship_stage = {
|
|
|
1493
1600
|
is_done,
|
|
1494
1601
|
mark_done,
|
|
1495
1602
|
read_done,
|
|
1496
|
-
record_path
|
|
1603
|
+
record_path,
|
|
1604
|
+
stop_reason: stop_reason2
|
|
1497
1605
|
};
|
|
1498
1606
|
|
|
1499
|
-
// scripts/run/run-ship-next.ts
|
|
1607
|
+
// scripts/run/ship/run-ship-next.ts
|
|
1500
1608
|
var { STAGE: STAGE2 } = run_ship_stage;
|
|
1501
1609
|
var COMMAND = {
|
|
1502
1610
|
LOG: "pnpm josh ship --log",
|
|
@@ -1534,12 +1642,18 @@ var AFTER_FIX = {
|
|
|
1534
1642
|
[STAGE2.PREFLIGHT]: detach_as_started,
|
|
1535
1643
|
[STAGE2.REVIEW]: detach_as_started,
|
|
1536
1644
|
[STAGE2.GATE]: detach_as_started,
|
|
1645
|
+
[STAGE2.SYNC]: detach_as_started,
|
|
1537
1646
|
[STAGE2.COMMIT]: detach_as_started,
|
|
1538
1647
|
[STAGE2.ROUND_TWO]: detach_again,
|
|
1539
1648
|
[STAGE2.FOLLOWUP]: detach_again,
|
|
1540
1649
|
[STAGE2.REPORT]: detach_again
|
|
1541
1650
|
};
|
|
1651
|
+
function conflict_step(conflicts) {
|
|
1652
|
+
return `Resolve the conflict with origin/main in ${conflicts.join(", ")} (the merge is left in progress: remove the conflict markers in those files), then`;
|
|
1653
|
+
}
|
|
1542
1654
|
function next_step(issue, stage, resume) {
|
|
1655
|
+
const conflicts = resume.conflicts ?? [];
|
|
1656
|
+
if (conflicts.length > 0) return `${conflict_step(conflicts)} ${AFTER_FIX[stage](resume)}`;
|
|
1543
1657
|
return `Read the stopped report with \`${COMMAND.LOG} ${issue}\`, fix the ${stage} failure, then ${AFTER_FIX[stage](resume)}`;
|
|
1544
1658
|
}
|
|
1545
1659
|
var run_ship_next = { COMMAND, next_step, quoted, resume_of };
|
|
@@ -1577,10 +1691,10 @@ var lane_child_invocation = {
|
|
|
1577
1691
|
ship_stop_invocation
|
|
1578
1692
|
};
|
|
1579
1693
|
|
|
1580
|
-
// scripts/run/run-cut.ts
|
|
1694
|
+
// scripts/run/cut/run-cut.ts
|
|
1581
1695
|
import { z as z5 } from "zod";
|
|
1582
1696
|
|
|
1583
|
-
// scripts/run/run-cut-handoff.ts
|
|
1697
|
+
// scripts/run/cut/run-cut-handoff.ts
|
|
1584
1698
|
import { readFileSync } from "node:fs";
|
|
1585
1699
|
import { z as z4 } from "zod";
|
|
1586
1700
|
var handoff_schema = z4.object({
|
|
@@ -1659,7 +1773,7 @@ var run_cut_handoff = {
|
|
|
1659
1773
|
read_handoff_file
|
|
1660
1774
|
};
|
|
1661
1775
|
|
|
1662
|
-
// scripts/run/run-cut.ts
|
|
1776
|
+
// scripts/run/cut/run-cut.ts
|
|
1663
1777
|
var CUT_PREFIX = "josh-run-cut-";
|
|
1664
1778
|
var { PRE_GATE_PHASE: PRE_GATE_PHASE2, IMPLEMENTATION_PHASE: IMPLEMENTATION_PHASE2 } = agent_role_profile;
|
|
1665
1779
|
var IMPLEMENTATION_CONTEXT_THRESHOLD = CONTEXT_CUT_THRESHOLD;
|
|
@@ -1858,7 +1972,7 @@ var run_cut = {
|
|
|
1858
1972
|
worktree_git_directory_sync
|
|
1859
1973
|
};
|
|
1860
1974
|
|
|
1861
|
-
// scripts/rules/run-tail.ts
|
|
1975
|
+
// scripts/rules/run-tail-rule.ts
|
|
1862
1976
|
var SEGMENT_PREFIX = String.raw`(?:\(\s*)?(?:[A-Za-z_][A-Za-z0-9_]*=\S*\s+)*(?:npx\s+|pnpm\s+(?:exec\s+|run\s+)?)?`;
|
|
1863
1977
|
var WORD_END = String.raw`(?=\s|$|\))`;
|
|
1864
1978
|
var PUSH_STEP_SEGMENT = new RegExp(String.raw`^${SEGMENT_PREFIX}josh\s+(?:git|g)${WORD_END}`, "u");
|
|
@@ -1898,7 +2012,7 @@ function decide3() {
|
|
|
1898
2012
|
return true;
|
|
1899
2013
|
}
|
|
1900
2014
|
var RUN_TAIL_REASON = '\u26D4 run tail: this issues the commit-push-PR step in the foreground, where the harness decides when to stop waiting. Reissue it with `run_in_background` set. In `fullrun #1501` this call was given a 900-second timeout, the harness detached it at its own 600-second cap, and nothing read the output for a further 6m28s \u2014 45m03s of wall clock on about 17 minutes of work (joshuafolkken/kit#1510). **Never give a foreground call a timeout above the harness cap**: the cap decides, not the number. A backgrounded call re-invokes you when it exits, so the completion notification is what resumes the run. **When it arrives, the turn that reads it goes straight through any branch-2 filing and `pnpm josh epic:bundle` to `pnpm josh followup` \u2014 the turn never ends at the push.** CI went green 6m06s before the merge started in that run, and it started only because the person asked; joshuafolkken/kit#1333 had already settled that the merge is issued in the turn the review closes. While the push runs, do the work that writes nothing \u2014 drafting the completion body to a file, deciding the branch-2 disposition. `pnpm josh followup` itself stays in the **foreground** \u2014 nearly every step after it reads its result. But a tail does follow the merge, measured at 3.0 min and 5.9% of a run (joshuafolkken/kit#1462), so empty it beforehand: the steps that read the merge result stay after `followup`, and the rest are composed in the turn that issues it, bar the one exception background-commands.md names. The procedure is `.claude/skills/workflow-commands/background-commands.md`, "A command that can take minutes is issued in the background". **This rule fires on every foreground push, not once per run**, so reissuing the same call in the foreground will be refused again.';
|
|
1901
|
-
var
|
|
2015
|
+
var run_tail_rule = {
|
|
1902
2016
|
RUN_TAIL_REASON,
|
|
1903
2017
|
decide: decide3,
|
|
1904
2018
|
is_backgrounded_push_step,
|
|
@@ -1935,7 +2049,7 @@ function is_backgrounded_ship(call) {
|
|
|
1935
2049
|
return command !== void 0 && ships_alone(command);
|
|
1936
2050
|
}
|
|
1937
2051
|
function is_candidate(call) {
|
|
1938
|
-
if (
|
|
2052
|
+
if (run_tail_rule.is_push_step_call(call)) return true;
|
|
1939
2053
|
const command = backgrounded_bash_command(call);
|
|
1940
2054
|
if (command === void 0 || is_backgrounded_ship(call)) return false;
|
|
1941
2055
|
return long_commands_of(command).length > 0;
|
|
@@ -1981,319 +2095,16 @@ var lane_background = {
|
|
|
1981
2095
|
pending_background_ids
|
|
1982
2096
|
};
|
|
1983
2097
|
|
|
1984
|
-
// scripts/
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
var
|
|
1994
|
-
var PROBE_ENVIRONMENT = { TZ: "UTC", LC_ALL: "C" };
|
|
1995
|
-
var PROBE_TIMEOUT_MS2 = 2e3;
|
|
1996
|
-
var LIVENESS_SIGNAL = 0;
|
|
1997
|
-
var LOWEST_REAL_PID = 1;
|
|
1998
|
-
var PROC_START_FIELD_INDEX = 19;
|
|
1999
|
-
var BEACON_SCHEME = "socket:";
|
|
2000
|
-
var BEACON_SUFFIX = ".sock";
|
|
2001
|
-
var BEACON_PREFIX = `josh-process-identity-${String(process.getuid?.() ?? "")}-`;
|
|
2002
|
-
var BEACON_ID_LENGTH = 36;
|
|
2003
|
-
var BEACON_ID_PATTERN = /^[\da-f-]+$/u;
|
|
2004
|
-
var WINDOWS_PLATFORM = "win32";
|
|
2005
|
-
var SOCKET_PROBE_SOURCE = "const net=require('node:net');const socket=net.createConnection(process.argv[1]);socket.once('connect',()=>process.exit(0));socket.once('error',()=>process.exit(1));socket.setTimeout(1000,()=>process.exit(1));";
|
|
2006
|
-
var beacons = /* @__PURE__ */ new Map();
|
|
2007
|
-
var exit_cleanup = { is_registered: false };
|
|
2008
|
-
function is_live_pid(pid) {
|
|
2009
|
-
if (pid < LOWEST_REAL_PID) return false;
|
|
2010
|
-
try {
|
|
2011
|
-
process.kill(pid, LIVENESS_SIGNAL);
|
|
2012
|
-
return true;
|
|
2013
|
-
} catch {
|
|
2014
|
-
return false;
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
function read_proc_start(pid) {
|
|
2018
|
-
try {
|
|
2019
|
-
const stat = readFileSync2(`/proc/${String(pid)}/stat`, "utf8");
|
|
2020
|
-
const fields = stat.slice(stat.lastIndexOf(")") + 1).trim().split(/\s+/u);
|
|
2021
|
-
const start = fields[PROC_START_FIELD_INDEX];
|
|
2022
|
-
return start === void 0 ? void 0 : `proc:${start}`;
|
|
2023
|
-
} catch {
|
|
2024
|
-
return void 0;
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
function read_ps_start(pid) {
|
|
2028
|
-
try {
|
|
2029
|
-
const printed = execFileSync2(
|
|
2030
|
-
PS_COMMAND,
|
|
2031
|
-
[FORMAT_FLAG, START_TIME_FORMAT, PID_FLAG, String(pid)],
|
|
2032
|
-
{
|
|
2033
|
-
encoding: "utf8",
|
|
2034
|
-
timeout: PROBE_TIMEOUT_MS2,
|
|
2035
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
2036
|
-
env: PROBE_ENVIRONMENT
|
|
2037
|
-
}
|
|
2038
|
-
).trim();
|
|
2039
|
-
return printed.length > 0 ? printed : void 0;
|
|
2040
|
-
} catch {
|
|
2041
|
-
return void 0;
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
var START_PROBES = { read_proc_start, read_ps_start };
|
|
2045
|
-
function safe_probe(probe, pid) {
|
|
2046
|
-
try {
|
|
2047
|
-
return probe(pid);
|
|
2048
|
-
} catch {
|
|
2049
|
-
return void 0;
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
function read_start(pid, probes = START_PROBES) {
|
|
2053
|
-
return safe_probe(probes.read_proc_start, pid) ?? safe_probe(probes.read_ps_start, pid);
|
|
2054
|
-
}
|
|
2055
|
-
function close_beacon(token) {
|
|
2056
|
-
const server = beacons.get(token);
|
|
2057
|
-
if (server === void 0) return;
|
|
2058
|
-
beacons.delete(token);
|
|
2059
|
-
server.close();
|
|
2060
|
-
rmSync(token.slice(BEACON_SCHEME.length), { force: true });
|
|
2061
|
-
}
|
|
2062
|
-
function close_beacons() {
|
|
2063
|
-
for (const token of beacons.keys()) close_beacon(token);
|
|
2064
|
-
}
|
|
2065
|
-
function ensure_exit_cleanup() {
|
|
2066
|
-
if (exit_cleanup.is_registered) return;
|
|
2067
|
-
exit_cleanup.is_registered = true;
|
|
2068
|
-
process.once("exit", close_beacons);
|
|
2069
|
-
}
|
|
2070
|
-
function ignore_beacon_error() {
|
|
2071
|
-
}
|
|
2072
|
-
function bind_beacon(target) {
|
|
2073
|
-
return createServer().on("error", ignore_beacon_error).listen(target);
|
|
2074
|
-
}
|
|
2075
|
-
function try_bind_beacon(bind, target) {
|
|
2076
|
-
try {
|
|
2077
|
-
const server = bind(target);
|
|
2078
|
-
return server.listening ? server : void 0;
|
|
2079
|
-
} catch {
|
|
2080
|
-
return void 0;
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
function open_beacon(bind = bind_beacon) {
|
|
2084
|
-
const target = path.join(PLATFORM_TEMP_ROOT, `${BEACON_PREFIX}${randomUUID()}${BEACON_SUFFIX}`);
|
|
2085
|
-
const token = `${BEACON_SCHEME}${target}`;
|
|
2086
|
-
const server = try_bind_beacon(bind, target);
|
|
2087
|
-
if (server === void 0) return void 0;
|
|
2088
|
-
server.unref();
|
|
2089
|
-
beacons.set(token, server);
|
|
2090
|
-
ensure_exit_cleanup();
|
|
2091
|
-
return token;
|
|
2092
|
-
}
|
|
2093
|
-
function resolve_own_start(probes = START_PROBES, platform2 = process.platform) {
|
|
2094
|
-
const start = read_start(process.pid, probes);
|
|
2095
|
-
if (start !== void 0 || platform2 === WINDOWS_PLATFORM) return start;
|
|
2096
|
-
return open_beacon();
|
|
2097
|
-
}
|
|
2098
|
-
function is_valid_beacon_name(name) {
|
|
2099
|
-
if (!name.startsWith(BEACON_PREFIX) || !name.endsWith(BEACON_SUFFIX)) return false;
|
|
2100
|
-
const id = name.slice(BEACON_PREFIX.length, -BEACON_SUFFIX.length);
|
|
2101
|
-
return id.length === BEACON_ID_LENGTH && BEACON_ID_PATTERN.test(id);
|
|
2102
|
-
}
|
|
2103
|
-
function beacon_target(token) {
|
|
2104
|
-
if (!token.startsWith(BEACON_SCHEME)) return void 0;
|
|
2105
|
-
const target = token.slice(BEACON_SCHEME.length);
|
|
2106
|
-
if (path.dirname(target) !== PLATFORM_TEMP_ROOT) return void 0;
|
|
2107
|
-
return is_valid_beacon_name(path.basename(target)) ? target : void 0;
|
|
2108
|
-
}
|
|
2109
|
-
function is_live_beacon(target) {
|
|
2110
|
-
return spawnSync(process.execPath, ["-e", SOCKET_PROBE_SOURCE, target], {
|
|
2111
|
-
stdio: "ignore",
|
|
2112
|
-
timeout: PROBE_TIMEOUT_MS2
|
|
2113
|
-
}).status === 0;
|
|
2114
|
-
}
|
|
2115
|
-
function has_matching_start(pid, recorded_start, read3) {
|
|
2116
|
-
const observed = read3(pid);
|
|
2117
|
-
return observed === void 0 ? void 0 : observed === recorded_start;
|
|
2118
|
-
}
|
|
2119
|
-
function matches_recorded_start(pid, recorded_start, read3) {
|
|
2120
|
-
const target = beacon_target(recorded_start);
|
|
2121
|
-
return target === void 0 ? has_matching_start(pid, recorded_start, read3) : is_live_beacon(target);
|
|
2122
|
-
}
|
|
2123
|
-
var own_probe = /* @__PURE__ */ new Map();
|
|
2124
|
-
function own_start() {
|
|
2125
|
-
if (!own_probe.has(process.pid)) own_probe.set(process.pid, resolve_own_start());
|
|
2126
|
-
return own_probe.get(process.pid);
|
|
2127
|
-
}
|
|
2128
|
-
function own_fields() {
|
|
2129
|
-
const start = own_start();
|
|
2130
|
-
return { pid: process.pid, ...start !== void 0 && { process_start: start } };
|
|
2131
|
-
}
|
|
2132
|
-
function is_same_process(pid, recorded_start, read3 = read_start) {
|
|
2133
|
-
if (pid === void 0 || !is_live_pid(pid)) return false;
|
|
2134
|
-
if (recorded_start === void 0) return void 0;
|
|
2135
|
-
return matches_recorded_start(pid, recorded_start, read3);
|
|
2136
|
-
}
|
|
2137
|
-
function is_own_process(pid, recorded_start) {
|
|
2138
|
-
return pid === process.pid && recorded_start === own_start();
|
|
2139
|
-
}
|
|
2140
|
-
var process_identity = {
|
|
2141
|
-
close_beacon,
|
|
2142
|
-
is_live_pid,
|
|
2143
|
-
is_own_process,
|
|
2144
|
-
is_same_process,
|
|
2145
|
-
open_beacon,
|
|
2146
|
-
own_fields,
|
|
2147
|
-
own_start,
|
|
2148
|
-
read_start,
|
|
2149
|
-
resolve_own_start
|
|
2150
|
-
};
|
|
2151
|
-
|
|
2152
|
-
// scripts/run/run-carry.ts
|
|
2153
|
-
import { z as z6 } from "zod";
|
|
2154
|
-
|
|
2155
|
-
// scripts/run/run-carry-streak.ts
|
|
2156
|
-
var NO_INCREMENT = 0;
|
|
2157
|
-
var OUTAGE_FOLD_WINDOW_MS = 12e4;
|
|
2158
|
-
function has_increment(value) {
|
|
2159
|
-
return (value ?? NO_INCREMENT) > NO_INCREMENT;
|
|
2160
|
-
}
|
|
2161
|
-
function next_failures(carry, change) {
|
|
2162
|
-
if (has_increment(change.merged)) return NO_INCREMENT;
|
|
2163
|
-
return carry.failures + (change.failures ?? NO_INCREMENT);
|
|
2164
|
-
}
|
|
2165
|
-
function is_within_fold_window(last_outage_at, now) {
|
|
2166
|
-
if (last_outage_at === void 0) return false;
|
|
2167
|
-
const last = Date.parse(last_outage_at);
|
|
2168
|
-
if (Number.isNaN(last)) return false;
|
|
2169
|
-
return now.getTime() - last <= OUTAGE_FOLD_WINDOW_MS;
|
|
2170
|
-
}
|
|
2171
|
-
function folded_outage(carry) {
|
|
2172
|
-
return { outages: carry.outages, last_outage_at: carry.last_outage_at };
|
|
2173
|
-
}
|
|
2174
|
-
function counted_outage(carry, change, now) {
|
|
2175
|
-
const outages = carry.outages + (change.outages ?? NO_INCREMENT);
|
|
2176
|
-
return { outages, last_outage_at: now.toISOString() };
|
|
2177
|
-
}
|
|
2178
|
-
function next_outage(carry, change, now) {
|
|
2179
|
-
if (has_increment(change.outages)) {
|
|
2180
|
-
return is_within_fold_window(carry.last_outage_at, now) ? folded_outage(carry) : counted_outage(carry, change, now);
|
|
2181
|
-
}
|
|
2182
|
-
const is_reachable = has_increment(change.merged) || has_increment(change.failures);
|
|
2183
|
-
return is_reachable ? { outages: NO_INCREMENT, last_outage_at: void 0 } : folded_outage(carry);
|
|
2184
|
-
}
|
|
2185
|
-
function next_state(carry, change, now) {
|
|
2186
|
-
const outage = next_outage(carry, change, now);
|
|
2187
|
-
return {
|
|
2188
|
-
failures: next_failures(carry, change),
|
|
2189
|
-
outages: outage.outages,
|
|
2190
|
-
last_outage_at: outage.last_outage_at
|
|
2191
|
-
};
|
|
2192
|
-
}
|
|
2193
|
-
var run_carry_streak = { next_state };
|
|
2194
|
-
|
|
2195
|
-
// scripts/run/run-carry-change.ts
|
|
2196
|
-
var NO_INCREMENT2 = 0;
|
|
2197
|
-
function next_done(carry, done) {
|
|
2198
|
-
if (done === void 0) return carry.done;
|
|
2199
|
-
const current = carry.done ?? [];
|
|
2200
|
-
return current.includes(done) ? current : [...current, done];
|
|
2201
|
-
}
|
|
2202
|
-
function next_merged_issues(carry, issue) {
|
|
2203
|
-
if (issue === void 0) return carry.merged_issues;
|
|
2204
|
-
return [...carry.merged_issues ?? [], issue];
|
|
2205
|
-
}
|
|
2206
|
-
function is_duplicate_merge(carry, change) {
|
|
2207
|
-
const issue = change.merged_issue;
|
|
2208
|
-
return issue !== void 0 && carry.merged_issues?.includes(issue) === true;
|
|
2209
|
-
}
|
|
2210
|
-
function next_counts(carry, change) {
|
|
2211
|
-
const cuts = change.cuts ?? NO_INCREMENT2;
|
|
2212
|
-
return {
|
|
2213
|
-
merged: carry.merged + (change.merged ?? NO_INCREMENT2),
|
|
2214
|
-
filed: carry.filed + (change.filed ?? NO_INCREMENT2),
|
|
2215
|
-
cuts: carry.cuts + cuts,
|
|
2216
|
-
is_handed_off: cuts > NO_INCREMENT2
|
|
2217
|
-
};
|
|
2218
|
-
}
|
|
2219
|
-
function apply_change(target, carry, change, now = /* @__PURE__ */ new Date()) {
|
|
2220
|
-
if (is_duplicate_merge(carry, change)) return carry;
|
|
2221
|
-
const streak = run_carry_streak.next_state(carry, change, now);
|
|
2222
|
-
const next = {
|
|
2223
|
-
...carry,
|
|
2224
|
-
...next_counts(carry, change),
|
|
2225
|
-
merged_issues: next_merged_issues(carry, change.merged_issue),
|
|
2226
|
-
failures: streak.failures,
|
|
2227
|
-
outages: streak.outages,
|
|
2228
|
-
last_outage_at: streak.last_outage_at,
|
|
2229
|
-
done: next_done(carry, change.done),
|
|
2230
|
-
retrospective: change.retrospective === true || carry.retrospective
|
|
2231
|
-
};
|
|
2232
|
-
stamp_file.write_stamp(target, next);
|
|
2233
|
-
return next;
|
|
2234
|
-
}
|
|
2235
|
-
var run_carry_change = { apply_change };
|
|
2236
|
-
|
|
2237
|
-
// scripts/run/run-carry-conversation.ts
|
|
2238
|
-
import { existsSync, statSync } from "node:fs";
|
|
2239
|
-
import path2 from "node:path";
|
|
2240
|
-
|
|
2241
|
-
// scripts/cost-runtime/own-session.ts
|
|
2242
|
-
var NOT_FOUND = -1;
|
|
2243
|
-
function session_id_of(environment2) {
|
|
2244
|
-
const value = environment2[agent_session_environment.SESSION_ID_KEY];
|
|
2245
|
-
return value === void 0 || value === "" ? void 0 : value;
|
|
2246
|
-
}
|
|
2247
|
-
function select_own_session(files, environment2) {
|
|
2248
|
-
const session_id = session_id_of(environment2);
|
|
2249
|
-
if (session_id === void 0) {
|
|
2250
|
-
return { kind: "own", index: cost_transcript.latest_own_index(files) };
|
|
2251
|
-
}
|
|
2252
|
-
const index = files.findIndex((file) => file.session_id === session_id);
|
|
2253
|
-
return index === NOT_FOUND ? { kind: "absent", session_id } : { kind: "own", index };
|
|
2254
|
-
}
|
|
2255
|
-
var own_session = {
|
|
2256
|
-
session_id_of,
|
|
2257
|
-
select_own_session
|
|
2258
|
-
};
|
|
2259
|
-
|
|
2260
|
-
// scripts/run/run-carry-conversation.ts
|
|
2261
|
-
var CONVERSATION_QUIET_MS = 6e5;
|
|
2262
|
-
function own_transcript(environment2 = process.env, directories2 = cost_transcript.transcript_directories(process.cwd())) {
|
|
2263
|
-
const session_id = own_session.session_id_of(environment2);
|
|
2264
|
-
if (session_id === void 0) return void 0;
|
|
2265
|
-
const name = `${session_id}${cost_transcript.TRANSCRIPT_EXTENSION}`;
|
|
2266
|
-
return directories2.map((directory) => path2.join(directory, name)).find((file) => existsSync(file));
|
|
2267
|
-
}
|
|
2268
|
-
function modified_ms(transcript) {
|
|
2269
|
-
try {
|
|
2270
|
-
return statSync(transcript).mtimeMs;
|
|
2271
|
-
} catch {
|
|
2272
|
-
return void 0;
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
function is_recent(modified, now) {
|
|
2276
|
-
return modified !== void 0 && now.getTime() - modified <= CONVERSATION_QUIET_MS;
|
|
2277
|
-
}
|
|
2278
|
-
function is_conversation_live(carry, now = /* @__PURE__ */ new Date(), read_modified = modified_ms) {
|
|
2279
|
-
if (carry.is_handed_off === true || carry.owner_transcript === void 0) return false;
|
|
2280
|
-
return is_recent(read_modified(carry.owner_transcript), now);
|
|
2281
|
-
}
|
|
2282
|
-
function is_same_conversation(carry, owner) {
|
|
2283
|
-
return owner.transcript !== void 0 && owner.transcript === carry.owner_transcript;
|
|
2284
|
-
}
|
|
2285
|
-
function reclaim_owner(carry, owner) {
|
|
2286
|
-
if (carry.is_handed_off === true || !is_same_conversation(carry, owner)) return carry;
|
|
2287
|
-
if (owner.pid === carry.owner_pid) return carry;
|
|
2288
|
-
return { ...carry, owner_pid: owner.pid, owner_start: owner.start };
|
|
2289
|
-
}
|
|
2290
|
-
var run_carry_conversation = {
|
|
2291
|
-
CONVERSATION_QUIET_MS,
|
|
2292
|
-
own_transcript,
|
|
2293
|
-
is_conversation_live,
|
|
2294
|
-
is_same_conversation,
|
|
2295
|
-
reclaim_owner
|
|
2296
|
-
};
|
|
2098
|
+
// scripts/agent/agent-headless.ts
|
|
2099
|
+
var KEY = "JOSH_AGENT_HEADLESS";
|
|
2100
|
+
var VALUE = "1";
|
|
2101
|
+
function environment() {
|
|
2102
|
+
return { [KEY]: VALUE };
|
|
2103
|
+
}
|
|
2104
|
+
function is_headless(source = process.env) {
|
|
2105
|
+
return source[KEY] === VALUE;
|
|
2106
|
+
}
|
|
2107
|
+
var agent_headless = { KEY, environment, is_headless };
|
|
2297
2108
|
|
|
2298
2109
|
// scripts/backlog/backlog-budget-cli.ts
|
|
2299
2110
|
import { fileURLToPath } from "node:url";
|
|
@@ -2381,7 +2192,50 @@ function arguments_of(argv, options) {
|
|
|
2381
2192
|
function string_of(value) {
|
|
2382
2193
|
return typeof value === "string" ? value : void 0;
|
|
2383
2194
|
}
|
|
2384
|
-
var
|
|
2195
|
+
var LONG_FLAG_PREFIX = "--";
|
|
2196
|
+
var SHORT_FLAG_PREFIX = "-";
|
|
2197
|
+
function option_name(flag) {
|
|
2198
|
+
return flag.slice(LONG_FLAG_PREFIX.length);
|
|
2199
|
+
}
|
|
2200
|
+
function is_unusable_value(value) {
|
|
2201
|
+
if (typeof value === "boolean" || value.length === 0) return true;
|
|
2202
|
+
return value !== SHORT_FLAG_PREFIX && value.startsWith(SHORT_FLAG_PREFIX);
|
|
2203
|
+
}
|
|
2204
|
+
function given_values(argv, flag) {
|
|
2205
|
+
const name = option_name(flag);
|
|
2206
|
+
const given = parse_or_undefined({
|
|
2207
|
+
args: [...argv],
|
|
2208
|
+
options: { [name]: { type: "string", multiple: true } },
|
|
2209
|
+
strict: false,
|
|
2210
|
+
allowPositionals: true
|
|
2211
|
+
})?.values[name];
|
|
2212
|
+
return Array.isArray(given) ? given : [];
|
|
2213
|
+
}
|
|
2214
|
+
function is_value_unusable(argv, flag) {
|
|
2215
|
+
return given_values(argv, flag).some((value) => is_unusable_value(value));
|
|
2216
|
+
}
|
|
2217
|
+
function attach_one(attached, argument, flags) {
|
|
2218
|
+
const previous = attached.at(-1);
|
|
2219
|
+
if (previous !== void 0 && flags.includes(previous)) {
|
|
2220
|
+
attached[attached.length - 1] = `${previous}=${argument}`;
|
|
2221
|
+
} else attached.push(argument);
|
|
2222
|
+
}
|
|
2223
|
+
function attach_values(argv, flags) {
|
|
2224
|
+
const attached = [];
|
|
2225
|
+
for (const argument of argv) attach_one(attached, argument, flags);
|
|
2226
|
+
return attached;
|
|
2227
|
+
}
|
|
2228
|
+
var cli_flags = {
|
|
2229
|
+
attach_values,
|
|
2230
|
+
refuse_unknown_flags,
|
|
2231
|
+
parse_or_undefined,
|
|
2232
|
+
values_of,
|
|
2233
|
+
arguments_of,
|
|
2234
|
+
string_of,
|
|
2235
|
+
option_name,
|
|
2236
|
+
given_values,
|
|
2237
|
+
is_value_unusable
|
|
2238
|
+
};
|
|
2385
2239
|
|
|
2386
2240
|
// scripts/backlog/backlog-budget-cli.ts
|
|
2387
2241
|
var ARGV_OFFSET = 2;
|
|
@@ -2470,7 +2324,7 @@ function refuse() {
|
|
|
2470
2324
|
console.error(USAGE);
|
|
2471
2325
|
return FAILURE_EXIT_CODE2;
|
|
2472
2326
|
}
|
|
2473
|
-
function
|
|
2327
|
+
function run3(argv, now_ms = Date.now()) {
|
|
2474
2328
|
const values = read_arguments(argv);
|
|
2475
2329
|
if (values === void 0) return refuse();
|
|
2476
2330
|
const input = build_input(values, now_ms);
|
|
@@ -2486,7 +2340,7 @@ function run2(argv, now_ms = Date.now()) {
|
|
|
2486
2340
|
return SUCCESS_EXIT_CODE2;
|
|
2487
2341
|
}
|
|
2488
2342
|
function main(argv) {
|
|
2489
|
-
process.exitCode =
|
|
2343
|
+
process.exitCode = run3(argv);
|
|
2490
2344
|
}
|
|
2491
2345
|
var backlog_budget_cli = {
|
|
2492
2346
|
JSON_KEY,
|
|
@@ -2496,7 +2350,7 @@ var backlog_budget_cli = {
|
|
|
2496
2350
|
build_input,
|
|
2497
2351
|
main,
|
|
2498
2352
|
read_arguments,
|
|
2499
|
-
run:
|
|
2353
|
+
run: run3,
|
|
2500
2354
|
to_answer,
|
|
2501
2355
|
to_count,
|
|
2502
2356
|
to_time_ms
|
|
@@ -2507,38 +2361,34 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) main(process.argv.slice(
|
|
|
2507
2361
|
var BACKLOG_COMMAND = "backlogrun";
|
|
2508
2362
|
var KNOWN_FLAGS2 = ["--max", "--idle"];
|
|
2509
2363
|
var ONLY_FLAG = "--only";
|
|
2364
|
+
var OPTIONS2 = {
|
|
2365
|
+
max: { type: "string" },
|
|
2366
|
+
idle: { type: "string" },
|
|
2367
|
+
only: { type: "boolean" }
|
|
2368
|
+
};
|
|
2510
2369
|
var ISSUE_PREFIX = "#";
|
|
2370
|
+
var FLAG_PREFIX = "-";
|
|
2511
2371
|
var TOKEN_SEPARATOR = " ";
|
|
2512
2372
|
var FIRST_TOKEN = 0;
|
|
2513
2373
|
var FIRST_ARGUMENT_INDEX = 1;
|
|
2514
|
-
var VALUE_OFFSET = 1;
|
|
2515
|
-
var FLAG_PAIR_LENGTH = 2;
|
|
2516
|
-
var ONLY_STEP = 1;
|
|
2517
2374
|
var EMPTY_LENGTH2 = 0;
|
|
2518
|
-
var
|
|
2375
|
+
var NOT_FOUND = -1;
|
|
2519
2376
|
function tokens_of(invocation) {
|
|
2520
2377
|
return invocation.split(TOKEN_SEPARATOR).filter((token) => token.length > EMPTY_LENGTH2);
|
|
2521
2378
|
}
|
|
2522
|
-
function
|
|
2523
|
-
|
|
2524
|
-
const
|
|
2379
|
+
function render_option(token) {
|
|
2380
|
+
if (token.name === cli_flags.option_name(ONLY_FLAG)) return ONLY_FLAG;
|
|
2381
|
+
const flag = KNOWN_FLAGS2.find((known) => cli_flags.option_name(known) === token.name);
|
|
2382
|
+
const value = backlog_budget_cli.to_count(token.value);
|
|
2525
2383
|
if (flag === void 0 || value === void 0) return void 0;
|
|
2526
2384
|
return `${flag} ${String(value)}`;
|
|
2527
2385
|
}
|
|
2528
|
-
function
|
|
2529
|
-
const token = tokens[index] ?? "";
|
|
2530
|
-
if (token === ONLY_FLAG) return { part: ONLY_FLAG, advance: ONLY_STEP };
|
|
2531
|
-
const part = flag_token(token, tokens[index + VALUE_OFFSET]);
|
|
2532
|
-
return part === void 0 ? void 0 : { part, advance: FLAG_PAIR_LENGTH };
|
|
2533
|
-
}
|
|
2534
|
-
function flag_tokens(tokens, start) {
|
|
2386
|
+
function rendered_options(tokens) {
|
|
2535
2387
|
const rendered = [];
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
rendered.push(read3.part);
|
|
2541
|
-
index += read3.advance;
|
|
2388
|
+
for (const token of tokens) {
|
|
2389
|
+
const part = render_option(token);
|
|
2390
|
+
if (part === void 0) return void 0;
|
|
2391
|
+
rendered.push(part);
|
|
2542
2392
|
}
|
|
2543
2393
|
return rendered;
|
|
2544
2394
|
}
|
|
@@ -2549,49 +2399,59 @@ function issue_of(token) {
|
|
|
2549
2399
|
const issue = Number(digits);
|
|
2550
2400
|
return Number.isSafeInteger(issue) ? issue : void 0;
|
|
2551
2401
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const stop = args.findIndex((token) => !token.startsWith(ISSUE_PREFIX));
|
|
2554
|
-
return args.slice(FIRST_TOKEN, stop === NOT_FOUND2 ? args.length : stop);
|
|
2555
|
-
}
|
|
2556
|
-
function leading_issues(tokens) {
|
|
2402
|
+
function issues_of(tokens) {
|
|
2557
2403
|
const issues = [];
|
|
2558
|
-
const
|
|
2559
|
-
|
|
2560
|
-
const issue = issue_of(token);
|
|
2404
|
+
for (const token of tokens) {
|
|
2405
|
+
const issue = issue_of(token.value ?? "");
|
|
2561
2406
|
if (issue === void 0) return void 0;
|
|
2562
2407
|
issues.push(issue);
|
|
2563
2408
|
}
|
|
2564
2409
|
return issues;
|
|
2565
2410
|
}
|
|
2411
|
+
function argument_tokens(invocation) {
|
|
2412
|
+
const tokens = tokens_of(invocation);
|
|
2413
|
+
if (tokens[FIRST_TOKEN] !== BACKLOG_COMMAND) return void 0;
|
|
2414
|
+
return cli_flags.parse_or_undefined({
|
|
2415
|
+
args: tokens.slice(FIRST_ARGUMENT_INDEX),
|
|
2416
|
+
options: OPTIONS2,
|
|
2417
|
+
allowPositionals: true,
|
|
2418
|
+
tokens: true
|
|
2419
|
+
})?.tokens;
|
|
2420
|
+
}
|
|
2421
|
+
function parse2(invocation) {
|
|
2422
|
+
const tokens = argument_tokens(invocation);
|
|
2423
|
+
if (tokens === void 0) return void 0;
|
|
2424
|
+
const stop = tokens.findIndex((token) => token.kind !== "positional");
|
|
2425
|
+
const split_at = stop === NOT_FOUND ? tokens.length : stop;
|
|
2426
|
+
const issues = issues_of(tokens.slice(FIRST_TOKEN, split_at));
|
|
2427
|
+
const flags = rendered_options(tokens.slice(split_at));
|
|
2428
|
+
if (issues === void 0 || flags === void 0) return void 0;
|
|
2429
|
+
return { issues, flags };
|
|
2430
|
+
}
|
|
2566
2431
|
function issue_token(issue) {
|
|
2567
2432
|
return `${ISSUE_PREFIX}${String(issue)}`;
|
|
2568
2433
|
}
|
|
2569
2434
|
function joined(command, rendered) {
|
|
2570
2435
|
return [command, ...rendered].join(TOKEN_SEPARATOR);
|
|
2571
2436
|
}
|
|
2572
|
-
function rebuilt_backlog(tokens) {
|
|
2573
|
-
const issues = leading_issues(tokens);
|
|
2574
|
-
if (issues === void 0) return void 0;
|
|
2575
|
-
const flags = flag_tokens(tokens, FIRST_ARGUMENT_INDEX + issues.length);
|
|
2576
|
-
if (flags === void 0) return void 0;
|
|
2577
|
-
return joined(BACKLOG_COMMAND, [...issues.map((issue) => issue_token(issue)), ...flags]);
|
|
2578
|
-
}
|
|
2579
2437
|
function rebuild(invocation) {
|
|
2580
|
-
const
|
|
2581
|
-
if (
|
|
2582
|
-
return
|
|
2438
|
+
const parsed = parse2(invocation);
|
|
2439
|
+
if (parsed === void 0) return void 0;
|
|
2440
|
+
return joined(BACKLOG_COMMAND, [
|
|
2441
|
+
...parsed.issues.map((issue) => issue_token(issue)),
|
|
2442
|
+
...parsed.flags
|
|
2443
|
+
]);
|
|
2583
2444
|
}
|
|
2584
2445
|
function issue_numbers(invocation) {
|
|
2585
2446
|
const tokens = tokens_of(invocation);
|
|
2586
|
-
|
|
2587
|
-
const
|
|
2447
|
+
const stop = tokens.findIndex((token) => token.startsWith(FLAG_PREFIX));
|
|
2448
|
+
const leading = stop === NOT_FOUND ? tokens : tokens.slice(FIRST_TOKEN, stop);
|
|
2449
|
+
const issues = parse2(leading.join(TOKEN_SEPARATOR))?.issues;
|
|
2588
2450
|
if (issues === void 0 || issues.length === EMPTY_LENGTH2) return void 0;
|
|
2589
2451
|
return issues;
|
|
2590
2452
|
}
|
|
2591
2453
|
function has_only(invocation) {
|
|
2592
|
-
|
|
2593
|
-
if (tokens[FIRST_TOKEN] !== BACKLOG_COMMAND) return false;
|
|
2594
|
-
return tokens.slice(FIRST_ARGUMENT_INDEX).includes(ONLY_FLAG);
|
|
2454
|
+
return parse2(invocation)?.flags.includes(ONLY_FLAG) === true;
|
|
2595
2455
|
}
|
|
2596
2456
|
var run_invocation = {
|
|
2597
2457
|
has_only,
|
|
@@ -2599,7 +2459,164 @@ var run_invocation = {
|
|
|
2599
2459
|
rebuild
|
|
2600
2460
|
};
|
|
2601
2461
|
|
|
2602
|
-
// scripts/run/run-carry.ts
|
|
2462
|
+
// scripts/run/carry/run-carry.ts
|
|
2463
|
+
import { z as z6 } from "zod";
|
|
2464
|
+
|
|
2465
|
+
// scripts/run/carry/run-carry-streak.ts
|
|
2466
|
+
var NO_INCREMENT = 0;
|
|
2467
|
+
var OUTAGE_FOLD_WINDOW_MS = 12e4;
|
|
2468
|
+
function has_increment(value) {
|
|
2469
|
+
return (value ?? NO_INCREMENT) > NO_INCREMENT;
|
|
2470
|
+
}
|
|
2471
|
+
function next_failures(carry, change) {
|
|
2472
|
+
if (has_increment(change.merged)) return NO_INCREMENT;
|
|
2473
|
+
return carry.failures + (change.failures ?? NO_INCREMENT);
|
|
2474
|
+
}
|
|
2475
|
+
function is_within_fold_window(last_outage_at, now) {
|
|
2476
|
+
if (last_outage_at === void 0) return false;
|
|
2477
|
+
const last = Date.parse(last_outage_at);
|
|
2478
|
+
if (Number.isNaN(last)) return false;
|
|
2479
|
+
return now.getTime() - last <= OUTAGE_FOLD_WINDOW_MS;
|
|
2480
|
+
}
|
|
2481
|
+
function folded_outage(carry) {
|
|
2482
|
+
return { outages: carry.outages, last_outage_at: carry.last_outage_at };
|
|
2483
|
+
}
|
|
2484
|
+
function counted_outage(carry, change, now) {
|
|
2485
|
+
const outages = carry.outages + (change.outages ?? NO_INCREMENT);
|
|
2486
|
+
return { outages, last_outage_at: now.toISOString() };
|
|
2487
|
+
}
|
|
2488
|
+
function next_outage(carry, change, now) {
|
|
2489
|
+
if (has_increment(change.outages)) {
|
|
2490
|
+
return is_within_fold_window(carry.last_outage_at, now) ? folded_outage(carry) : counted_outage(carry, change, now);
|
|
2491
|
+
}
|
|
2492
|
+
const is_reachable = has_increment(change.merged) || has_increment(change.failures);
|
|
2493
|
+
return is_reachable ? { outages: NO_INCREMENT, last_outage_at: void 0 } : folded_outage(carry);
|
|
2494
|
+
}
|
|
2495
|
+
function next_state(carry, change, now) {
|
|
2496
|
+
const outage = next_outage(carry, change, now);
|
|
2497
|
+
return {
|
|
2498
|
+
failures: next_failures(carry, change),
|
|
2499
|
+
outages: outage.outages,
|
|
2500
|
+
last_outage_at: outage.last_outage_at
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
var run_carry_streak = { next_state };
|
|
2504
|
+
|
|
2505
|
+
// scripts/run/carry/run-carry-change.ts
|
|
2506
|
+
var NO_INCREMENT2 = 0;
|
|
2507
|
+
function next_done(carry, done) {
|
|
2508
|
+
if (done === void 0) return carry.done;
|
|
2509
|
+
const current = carry.done ?? [];
|
|
2510
|
+
return current.includes(done) ? current : [...current, done];
|
|
2511
|
+
}
|
|
2512
|
+
function next_merged_issues(carry, issue) {
|
|
2513
|
+
if (issue === void 0) return carry.merged_issues;
|
|
2514
|
+
const current = carry.merged_issues ?? [];
|
|
2515
|
+
return current.includes(issue) ? current : [...current, issue];
|
|
2516
|
+
}
|
|
2517
|
+
function is_duplicate_merge(carry, change) {
|
|
2518
|
+
const issue = change.merged_issue;
|
|
2519
|
+
return issue !== void 0 && carry.merged_issues?.includes(issue) === true;
|
|
2520
|
+
}
|
|
2521
|
+
function has_other_change(change) {
|
|
2522
|
+
const amounts = [change.filed, change.cuts, change.failures, change.outages];
|
|
2523
|
+
const has_amount = amounts.some((amount) => (amount ?? NO_INCREMENT2) > NO_INCREMENT2);
|
|
2524
|
+
return has_amount || change.done !== void 0 || change.retrospective === true;
|
|
2525
|
+
}
|
|
2526
|
+
function effective_change(carry, change) {
|
|
2527
|
+
if (!is_duplicate_merge(carry, change)) return change;
|
|
2528
|
+
return has_other_change(change) ? { ...change, merged: NO_INCREMENT2 } : void 0;
|
|
2529
|
+
}
|
|
2530
|
+
function next_counts(carry, change) {
|
|
2531
|
+
const cuts = change.cuts ?? NO_INCREMENT2;
|
|
2532
|
+
return {
|
|
2533
|
+
merged: carry.merged + (change.merged ?? NO_INCREMENT2),
|
|
2534
|
+
filed: carry.filed + (change.filed ?? NO_INCREMENT2),
|
|
2535
|
+
cuts: carry.cuts + cuts,
|
|
2536
|
+
is_handed_off: cuts > NO_INCREMENT2
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
function apply_change(target, carry, change, now = /* @__PURE__ */ new Date()) {
|
|
2540
|
+
const effective = effective_change(carry, change);
|
|
2541
|
+
if (effective === void 0) return carry;
|
|
2542
|
+
const streak = run_carry_streak.next_state(carry, effective, now);
|
|
2543
|
+
const next = {
|
|
2544
|
+
...carry,
|
|
2545
|
+
...next_counts(carry, effective),
|
|
2546
|
+
merged_issues: next_merged_issues(carry, effective.merged_issue),
|
|
2547
|
+
failures: streak.failures,
|
|
2548
|
+
outages: streak.outages,
|
|
2549
|
+
last_outage_at: streak.last_outage_at,
|
|
2550
|
+
done: next_done(carry, effective.done),
|
|
2551
|
+
retrospective: effective.retrospective === true || carry.retrospective
|
|
2552
|
+
};
|
|
2553
|
+
stamp_file.write_stamp(target, next);
|
|
2554
|
+
return next;
|
|
2555
|
+
}
|
|
2556
|
+
var run_carry_change = { apply_change };
|
|
2557
|
+
|
|
2558
|
+
// scripts/run/carry/run-carry-conversation.ts
|
|
2559
|
+
import { existsSync, statSync } from "node:fs";
|
|
2560
|
+
import path2 from "node:path";
|
|
2561
|
+
|
|
2562
|
+
// scripts/cost-runtime/own-session.ts
|
|
2563
|
+
var NOT_FOUND2 = -1;
|
|
2564
|
+
function session_id_of(environment3) {
|
|
2565
|
+
const value = environment3[agent_session_environment.SESSION_ID_KEY];
|
|
2566
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
2567
|
+
}
|
|
2568
|
+
function select_own_session(files, environment3) {
|
|
2569
|
+
const session_id = session_id_of(environment3);
|
|
2570
|
+
if (session_id === void 0) {
|
|
2571
|
+
return { kind: "own", index: cost_transcript.latest_own_index(files) };
|
|
2572
|
+
}
|
|
2573
|
+
const index = files.findIndex((file) => file.session_id === session_id);
|
|
2574
|
+
return index === NOT_FOUND2 ? { kind: "absent", session_id } : { kind: "own", index };
|
|
2575
|
+
}
|
|
2576
|
+
var own_session = {
|
|
2577
|
+
session_id_of,
|
|
2578
|
+
select_own_session
|
|
2579
|
+
};
|
|
2580
|
+
|
|
2581
|
+
// scripts/run/carry/run-carry-conversation.ts
|
|
2582
|
+
var CONVERSATION_QUIET_MS = 6e5;
|
|
2583
|
+
function own_transcript(environment3 = process.env, directories2 = cost_transcript.transcript_directories(process.cwd())) {
|
|
2584
|
+
const session_id = own_session.session_id_of(environment3);
|
|
2585
|
+
if (session_id === void 0) return void 0;
|
|
2586
|
+
const name = `${session_id}${cost_transcript.TRANSCRIPT_EXTENSION}`;
|
|
2587
|
+
return directories2.map((directory) => path2.join(directory, name)).find((file) => existsSync(file));
|
|
2588
|
+
}
|
|
2589
|
+
function modified_ms(transcript) {
|
|
2590
|
+
try {
|
|
2591
|
+
return statSync(transcript).mtimeMs;
|
|
2592
|
+
} catch {
|
|
2593
|
+
return void 0;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
function is_recent(modified, now) {
|
|
2597
|
+
return modified !== void 0 && now.getTime() - modified <= CONVERSATION_QUIET_MS;
|
|
2598
|
+
}
|
|
2599
|
+
function is_conversation_live(carry, now = /* @__PURE__ */ new Date(), read_modified = modified_ms) {
|
|
2600
|
+
if (carry.is_handed_off === true || carry.owner_transcript === void 0) return false;
|
|
2601
|
+
return is_recent(read_modified(carry.owner_transcript), now);
|
|
2602
|
+
}
|
|
2603
|
+
function is_same_conversation(carry, owner) {
|
|
2604
|
+
return owner.transcript !== void 0 && owner.transcript === carry.owner_transcript;
|
|
2605
|
+
}
|
|
2606
|
+
function reclaim_owner(carry, owner) {
|
|
2607
|
+
if (carry.is_handed_off === true || !is_same_conversation(carry, owner)) return carry;
|
|
2608
|
+
if (owner.pid === carry.owner_pid) return carry;
|
|
2609
|
+
return { ...carry, owner_pid: owner.pid, owner_start: owner.start };
|
|
2610
|
+
}
|
|
2611
|
+
var run_carry_conversation = {
|
|
2612
|
+
CONVERSATION_QUIET_MS,
|
|
2613
|
+
own_transcript,
|
|
2614
|
+
is_conversation_live,
|
|
2615
|
+
is_same_conversation,
|
|
2616
|
+
reclaim_owner
|
|
2617
|
+
};
|
|
2618
|
+
|
|
2619
|
+
// scripts/run/carry/run-carry.ts
|
|
2603
2620
|
var CARRY_PREFIX = "josh-run-carry-";
|
|
2604
2621
|
var REPOSITORY_DIRECTORY_INDEX = 1;
|
|
2605
2622
|
var CARRY_MAX_AGE_HOURS = backlog_budget.WHOLE_RUN_BUDGET_HOURS;
|
|
@@ -2758,8 +2775,11 @@ function mismatch_message(carry, invocation) {
|
|
|
2758
2775
|
function busy_message2(carry) {
|
|
2759
2776
|
return `A live run holds this budget \u2014 ${describe_carry(carry)}, owner pid ${String(carry.owner_pid)} still running. Nothing was established. Wait for that run, or end its record with \`${END_COMMAND2}\` once you know it is over.`;
|
|
2760
2777
|
}
|
|
2778
|
+
function claim_command(invocation) {
|
|
2779
|
+
return `${RESUME_COMMAND} "${invocation}" ${OWNER_ARGUMENT}`;
|
|
2780
|
+
}
|
|
2761
2781
|
function standing_message(carry) {
|
|
2762
|
-
return `A run record is standing here that no cut handed off \u2014 ${describe_carry(carry)}. Nothing was established. Carry that budget with \`${
|
|
2782
|
+
return `A run record is standing here that no cut handed off \u2014 ${describe_carry(carry)}. Nothing was established. Carry that budget with \`${claim_command(carry.invocation)}\`, or discard it with \`${END_COMMAND2}\` and begin again.`;
|
|
2763
2783
|
}
|
|
2764
2784
|
function count_refused_message(carry) {
|
|
2765
2785
|
if (carry.is_handed_off === true) {
|
|
@@ -2791,6 +2811,7 @@ var run_carry = {
|
|
|
2791
2811
|
begin_carry,
|
|
2792
2812
|
busy_message: busy_message2,
|
|
2793
2813
|
carry_path,
|
|
2814
|
+
claim_command,
|
|
2794
2815
|
classify: classify3,
|
|
2795
2816
|
classify_claim,
|
|
2796
2817
|
count_refused_message,
|
|
@@ -2818,10 +2839,9 @@ var run_carry = {
|
|
|
2818
2839
|
unreadable_message: unreadable_message3
|
|
2819
2840
|
};
|
|
2820
2841
|
|
|
2821
|
-
// scripts/run/run-ship-detach.ts
|
|
2822
|
-
import { randomUUID
|
|
2842
|
+
// scripts/run/ship/run-ship-detach.ts
|
|
2843
|
+
import { randomUUID } from "node:crypto";
|
|
2823
2844
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
2824
|
-
import { z as z8 } from "zod";
|
|
2825
2845
|
|
|
2826
2846
|
// scripts/run/detached-launch.ts
|
|
2827
2847
|
import { spawn } from "node:child_process";
|
|
@@ -2875,17 +2895,19 @@ function link_home_file(source_home, target_home, name) {
|
|
|
2875
2895
|
const target = path4.join(target_home, name);
|
|
2876
2896
|
if (!remove_old_home_link(source, target) && existsSync2(source)) symlinkSync(source, target);
|
|
2877
2897
|
}
|
|
2878
|
-
function reviewer_home(cwd,
|
|
2879
|
-
const source =
|
|
2898
|
+
function reviewer_home(cwd, environment3) {
|
|
2899
|
+
const source = environment3["CODEX_HOME"] ?? process.env["CODEX_HOME"] ?? codex_home_source.default_home();
|
|
2880
2900
|
const target = path4.resolve(cwd, ...REVIEWER_HOME);
|
|
2881
2901
|
mkdirSync(target, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });
|
|
2882
2902
|
for (const name of HOME_FILES) link_home_file(source, target, name);
|
|
2883
2903
|
return target;
|
|
2884
2904
|
}
|
|
2885
|
-
function build(cwd, profile,
|
|
2886
|
-
if (profile
|
|
2887
|
-
const
|
|
2888
|
-
|
|
2905
|
+
function build(cwd, profile, environment3 = {}) {
|
|
2906
|
+
if (profile === void 0) return environment3;
|
|
2907
|
+
const marked = { ...agent_headless.environment(), ...environment3 };
|
|
2908
|
+
if (profile.provider !== OPENAI_PROVIDER2) return marked;
|
|
2909
|
+
const base = { ...openai_environment(), ...marked };
|
|
2910
|
+
return profile.role === agent_role_profile.REVIEWER ? { ...base, CODEX_HOME: reviewer_home(cwd, environment3) } : base;
|
|
2889
2911
|
}
|
|
2890
2912
|
var agent_launch_environment = { build };
|
|
2891
2913
|
|
|
@@ -2943,12 +2965,12 @@ function ensure_log(log_path2, on_error) {
|
|
|
2943
2965
|
const descriptor = open_log(log_path2, on_error);
|
|
2944
2966
|
if (descriptor !== void 0) closeSync(descriptor);
|
|
2945
2967
|
}
|
|
2946
|
-
function spawn_options(cwd, log,
|
|
2968
|
+
function spawn_options(cwd, log, environment3 = {}, is_detached = true) {
|
|
2947
2969
|
return {
|
|
2948
2970
|
cwd,
|
|
2949
2971
|
detached: is_detached,
|
|
2950
2972
|
stdio: log === void 0 ? "ignore" : ["ignore", log, log],
|
|
2951
|
-
env: { ...process.env, ...agent_session_environment.removed_environment(), ...
|
|
2973
|
+
env: { ...process.env, ...agent_session_environment.removed_environment(), ...environment3 }
|
|
2952
2974
|
};
|
|
2953
2975
|
}
|
|
2954
2976
|
function notify_spawn(pid, on_spawn, on_error) {
|
|
@@ -2961,11 +2983,11 @@ function notify_spawn(pid, on_spawn, on_error) {
|
|
|
2961
2983
|
}
|
|
2962
2984
|
async function attached_spawn(request, log, on_error, on_spawn) {
|
|
2963
2985
|
return await new Promise((resolve3) => {
|
|
2964
|
-
const
|
|
2986
|
+
const environment3 = agent_launch_environment.build(request.cwd, request.profile, request.env);
|
|
2965
2987
|
const child = spawn(
|
|
2966
2988
|
request.argv.command,
|
|
2967
2989
|
[...request.argv.args],
|
|
2968
|
-
spawn_options(request.cwd, log,
|
|
2990
|
+
spawn_options(request.cwd, log, environment3, false)
|
|
2969
2991
|
);
|
|
2970
2992
|
child.once("error", (error) => {
|
|
2971
2993
|
on_error(note_of(error));
|
|
@@ -2981,8 +3003,8 @@ function ignore_spawn(_pid) {
|
|
|
2981
3003
|
}
|
|
2982
3004
|
function spawned(request, log, on_error) {
|
|
2983
3005
|
const { command, args } = request.argv;
|
|
2984
|
-
const
|
|
2985
|
-
const child = spawn(command, [...args], spawn_options(request.cwd, log,
|
|
3006
|
+
const environment3 = agent_launch_environment.build(request.cwd, request.profile, request.env);
|
|
3007
|
+
const child = spawn(command, [...args], spawn_options(request.cwd, log, environment3));
|
|
2986
3008
|
child.on("error", (error) => {
|
|
2987
3009
|
on_error(note_of(error));
|
|
2988
3010
|
});
|
|
@@ -3024,7 +3046,7 @@ var detached_launch = {
|
|
|
3024
3046
|
note_of
|
|
3025
3047
|
};
|
|
3026
3048
|
|
|
3027
|
-
// scripts/run/run-event-stream.ts
|
|
3049
|
+
// scripts/run/event/run-event-stream.ts
|
|
3028
3050
|
import { z as z7 } from "zod";
|
|
3029
3051
|
var EVENT_PREFIX = "josh-run-events-";
|
|
3030
3052
|
var EVENT_SUFFIX = ".jsonl";
|
|
@@ -3116,6 +3138,12 @@ function read_events(target) {
|
|
|
3116
3138
|
function last_position(events) {
|
|
3117
3139
|
return events[events.length - POSITION_INCREMENT]?.pos ?? FIRST_POSITION;
|
|
3118
3140
|
}
|
|
3141
|
+
function bounded(events) {
|
|
3142
|
+
const excess = events.length - EVENT_CAP;
|
|
3143
|
+
if (excess <= 0) return events;
|
|
3144
|
+
const dropped = new Set(events.filter((event) => TRACE_KINDS.has(event.kind)).slice(0, excess));
|
|
3145
|
+
return events.filter((event) => !dropped.has(event)).slice(-EVENT_CAP);
|
|
3146
|
+
}
|
|
3119
3147
|
function serialize(events) {
|
|
3120
3148
|
return `${events.map((event) => JSON.stringify(event)).join(LINE_SEPARATOR)}${LINE_SEPARATOR}`;
|
|
3121
3149
|
}
|
|
@@ -3123,8 +3151,8 @@ function append(target, kind, text, at) {
|
|
|
3123
3151
|
if (!is_event_kind(kind)) return { appended: false, position: FIRST_POSITION };
|
|
3124
3152
|
const existing = read_events(target);
|
|
3125
3153
|
const position = last_position(existing) + POSITION_INCREMENT;
|
|
3126
|
-
const
|
|
3127
|
-
stamp_file.write_text_stamp(target, serialize(
|
|
3154
|
+
const events = bounded([...existing, { pos: position, at, kind, text }]);
|
|
3155
|
+
stamp_file.write_text_stamp(target, serialize(events));
|
|
3128
3156
|
return { appended: true, position };
|
|
3129
3157
|
}
|
|
3130
3158
|
function read_from(target, position) {
|
|
@@ -3159,7 +3187,7 @@ var run_event_stream = {
|
|
|
3159
3187
|
target_of
|
|
3160
3188
|
};
|
|
3161
3189
|
|
|
3162
|
-
// scripts/run/run-event-scope.ts
|
|
3190
|
+
// scripts/run/event/run-event-scope.ts
|
|
3163
3191
|
var SINCE_SCOPE = "since";
|
|
3164
3192
|
var UNKNOWN_SCOPE = "unknown";
|
|
3165
3193
|
var UNKNOWN_EVENT_SCOPE = { kind: UNKNOWN_SCOPE };
|
|
@@ -3237,7 +3265,7 @@ var run_event_scope = {
|
|
|
3237
3265
|
scoped_events
|
|
3238
3266
|
};
|
|
3239
3267
|
|
|
3240
|
-
// scripts/run/run-event-stream-emit.ts
|
|
3268
|
+
// scripts/run/event/run-event-stream-emit.ts
|
|
3241
3269
|
function now_iso() {
|
|
3242
3270
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3243
3271
|
}
|
|
@@ -3306,7 +3334,8 @@ var run_event_stream_emit = {
|
|
|
3306
3334
|
stream_target
|
|
3307
3335
|
};
|
|
3308
3336
|
|
|
3309
|
-
// scripts/run/run-ship-detach.ts
|
|
3337
|
+
// scripts/run/ship/run-ship-detach.ts
|
|
3338
|
+
import { z as z8 } from "zod";
|
|
3310
3339
|
var LOG_PREFIX = "josh-ship-log-";
|
|
3311
3340
|
var PID_PREFIX = "josh-ship-pid-";
|
|
3312
3341
|
var BODY_PREFIX = "josh-ship-notify-";
|
|
@@ -3457,7 +3486,7 @@ function supervisor_argv(request) {
|
|
|
3457
3486
|
};
|
|
3458
3487
|
}
|
|
3459
3488
|
function prepare_launch(request) {
|
|
3460
|
-
const launch_id =
|
|
3489
|
+
const launch_id = randomUUID();
|
|
3461
3490
|
const launcher = process_identity.own_fields();
|
|
3462
3491
|
stamp_file.replace_stamp(result_path(request.repository, request.number), {
|
|
3463
3492
|
launch_id,
|
|
@@ -3694,9 +3723,16 @@ function records_the_park(command) {
|
|
|
3694
3723
|
return APPLIES_NEEDS_DECISION.test(command);
|
|
3695
3724
|
}
|
|
3696
3725
|
var LANE_PARK_REASON = '\u26D4 lane child park: this session is a dispatched lane child, and a stop that waits on a person must leave the question on the Issue before it sends this Telegram \u2014 otherwise the parent finds an OPEN Issue with `in-progress` and no question, and a person cannot tell what to answer (joshuafolkken/kit#2034 measured this twice in one run). The child is the only process that knows the question, the options and whether it stashed, so it records the park itself rather than leaving the parent to guess from a log. Before you notify and stop: apply `needs-decision` and post a comment carrying the question, the options, and whether work was stashed \u2014 `gh api repos/{owner}/{repo}/issues/<N>/labels -f \'labels[]=needs-decision\'` then `pnpm josh issue:comment <N> --body-file <path>`. If this stop is a `needs-human-review` or `already-done` one, that label is already on the Issue and there is nothing to add. Then reissue this notify \u2014 it fires once per run and cannot repeat on the call in hand. The procedure is `.claude/skills/workflow-commands/pre-gate-cut.md` \u2192 "A lane child records its park before it stops", and the park itself is `backlogrun-park.md` \u2192 "park and continue".';
|
|
3726
|
+
var ROW3 = {
|
|
3727
|
+
id: "lane-park",
|
|
3728
|
+
is_trigger: bash_triggers.on_bash_command(is_unparked_stop),
|
|
3729
|
+
reason: LANE_PARK_REASON,
|
|
3730
|
+
keeps: bash_triggers.on_bash_command(records_the_park)
|
|
3731
|
+
};
|
|
3697
3732
|
var lane_park = {
|
|
3698
3733
|
COMMAND_NOTIFY_MARKER,
|
|
3699
3734
|
LANE_PARK_REASON,
|
|
3735
|
+
ROW: ROW3,
|
|
3700
3736
|
is_confirmation_notify,
|
|
3701
3737
|
is_parking_child,
|
|
3702
3738
|
is_unparked_stop,
|
|
@@ -3705,7 +3741,7 @@ var lane_park = {
|
|
|
3705
3741
|
};
|
|
3706
3742
|
|
|
3707
3743
|
// scripts/discovery/repo-discovery.ts
|
|
3708
|
-
import { existsSync as existsSync3, readdirSync, readFileSync as
|
|
3744
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
|
|
3709
3745
|
import path5 from "node:path";
|
|
3710
3746
|
|
|
3711
3747
|
// scripts/discovery/repo-origin.ts
|
|
@@ -3771,15 +3807,15 @@ function origin_section_lines(lines) {
|
|
|
3771
3807
|
const end = rest.findIndex((line) => is_section_header(line));
|
|
3772
3808
|
return end === NOT_FOUND3 ? rest : rest.slice(0, end);
|
|
3773
3809
|
}
|
|
3774
|
-
function
|
|
3810
|
+
function url_value(line) {
|
|
3775
3811
|
const separator = line.indexOf("=");
|
|
3776
3812
|
if (separator === NOT_FOUND3) return void 0;
|
|
3777
|
-
if (line.slice(0, separator).trim() !==
|
|
3813
|
+
if (line.slice(0, separator).trim() !== URL_KEY) return void 0;
|
|
3778
3814
|
return line.slice(separator + 1).trim();
|
|
3779
3815
|
}
|
|
3780
3816
|
function parse_origin_from_config(content) {
|
|
3781
3817
|
const lines = content.split("\n").map((line) => line.trim());
|
|
3782
|
-
return origin_section_lines(lines).map((line) =>
|
|
3818
|
+
return origin_section_lines(lines).map((line) => url_value(line)).find((url) => url !== void 0);
|
|
3783
3819
|
}
|
|
3784
3820
|
function section_groups(lines) {
|
|
3785
3821
|
const groups = [];
|
|
@@ -3791,7 +3827,7 @@ function section_groups(lines) {
|
|
|
3791
3827
|
}
|
|
3792
3828
|
function parse_remote_urls_from_config(content) {
|
|
3793
3829
|
const lines = content.split("\n").map((line) => line.trim());
|
|
3794
|
-
return section_groups(lines).filter((group) => REMOTE_SECTION.test(group[0] ?? "")).flatMap((group) => group.map((line) =>
|
|
3830
|
+
return section_groups(lines).filter((group) => REMOTE_SECTION.test(group[0] ?? "")).flatMap((group) => group.map((line) => url_value(line))).filter((url) => url !== void 0);
|
|
3795
3831
|
}
|
|
3796
3832
|
function format_identity(identity) {
|
|
3797
3833
|
return `${identity.owner}${PATH_SEPARATOR2}${identity.repo}`.toLowerCase();
|
|
@@ -3856,13 +3892,13 @@ function resolve_common_directory(git_directory) {
|
|
|
3856
3892
|
const pointer = path5.join(git_directory, COMMON_DIRECTORY_FILE);
|
|
3857
3893
|
if (!existsSync3(pointer)) return git_directory;
|
|
3858
3894
|
try {
|
|
3859
|
-
return path5.resolve(git_directory,
|
|
3895
|
+
return path5.resolve(git_directory, readFileSync2(pointer, "utf8").trim());
|
|
3860
3896
|
} catch {
|
|
3861
3897
|
return git_directory;
|
|
3862
3898
|
}
|
|
3863
3899
|
}
|
|
3864
3900
|
function follow_git_file(repository_path, git_file) {
|
|
3865
|
-
const pointer =
|
|
3901
|
+
const pointer = readFileSync2(git_file, "utf8").trim();
|
|
3866
3902
|
if (!pointer.startsWith(GITDIR_PREFIX)) return void 0;
|
|
3867
3903
|
return path5.resolve(repository_path, pointer.slice(GITDIR_PREFIX.length).trim());
|
|
3868
3904
|
}
|
|
@@ -3881,7 +3917,7 @@ function read_config(repository_path) {
|
|
|
3881
3917
|
const git_directory = resolve_git_directory(repository_path);
|
|
3882
3918
|
if (git_directory === void 0) return void 0;
|
|
3883
3919
|
try {
|
|
3884
|
-
return
|
|
3920
|
+
return readFileSync2(path5.join(git_directory, GIT_CONFIG), "utf8");
|
|
3885
3921
|
} catch {
|
|
3886
3922
|
return void 0;
|
|
3887
3923
|
}
|
|
@@ -3918,14 +3954,14 @@ function main_worktree(repository_path) {
|
|
|
3918
3954
|
if (path5.basename(git_directory) !== GIT_DIRECTORY) return repository_path;
|
|
3919
3955
|
return path5.dirname(git_directory);
|
|
3920
3956
|
}
|
|
3921
|
-
function discover_repositories(repository_path,
|
|
3957
|
+
function discover_repositories(repository_path, environment3 = process.env) {
|
|
3922
3958
|
const main2 = main_worktree(repository_path);
|
|
3923
3959
|
const current_owner2 = resolve_current_owner(main2);
|
|
3924
3960
|
if (current_owner2 === void 0) return /* @__PURE__ */ new Map();
|
|
3925
3961
|
return repo_map_logic.build_repository_map(
|
|
3926
3962
|
scan_siblings(path5.dirname(main2)),
|
|
3927
3963
|
current_owner2,
|
|
3928
|
-
|
|
3964
|
+
environment3[OVERRIDE_ENV_KEY]
|
|
3929
3965
|
);
|
|
3930
3966
|
}
|
|
3931
3967
|
var repo_discovery = {
|
|
@@ -3960,8 +3996,8 @@ function gh_repo_owners(gh_repo) {
|
|
|
3960
3996
|
function remote_owners(repository_path) {
|
|
3961
3997
|
return repo_discovery.read_remote_urls(repository_path).map((url) => repo_origin.parse_origin_url(url)?.owner);
|
|
3962
3998
|
}
|
|
3963
|
-
function placeholder_owners(repository_path = process.cwd(),
|
|
3964
|
-
const gh_repo =
|
|
3999
|
+
function placeholder_owners(repository_path = process.cwd(), environment3 = process.env) {
|
|
4000
|
+
const gh_repo = environment3[GH_REPO_ENV_KEY];
|
|
3965
4001
|
return gh_repo === void 0 || gh_repo === "" ? remote_owners(repository_path) : gh_repo_owners(gh_repo);
|
|
3966
4002
|
}
|
|
3967
4003
|
var repo_party = {
|
|
@@ -3975,23 +4011,22 @@ var repo_party = {
|
|
|
3975
4011
|
};
|
|
3976
4012
|
|
|
3977
4013
|
// scripts/lane/lane-reap.ts
|
|
3978
|
-
import { execFileSync as
|
|
4014
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3979
4015
|
var PGREP_COMMAND = "pgrep";
|
|
3980
4016
|
var MATCH_FULL_COMMAND_LINE = "-f";
|
|
3981
4017
|
var CHILDREN_OF_FLAG = "-P";
|
|
3982
|
-
var
|
|
4018
|
+
var PS_COMMAND = "/bin/ps";
|
|
3983
4019
|
var PARENT_FORMAT = ["-o", "ppid=", "-p"];
|
|
3984
4020
|
var TERMINATE_SIGNAL = "SIGTERM";
|
|
3985
|
-
var PROBE_TIMEOUT_MS3 = 2e3;
|
|
3986
4021
|
var LOWEST_CHILD_PID = 2;
|
|
3987
4022
|
function parse_pids(printed) {
|
|
3988
4023
|
return printed.split("\n").map((line) => Number(line.trim())).filter((pid) => Number.isSafeInteger(pid) && pid >= LOWEST_CHILD_PID);
|
|
3989
4024
|
}
|
|
3990
4025
|
function run_probe(command, args) {
|
|
3991
4026
|
try {
|
|
3992
|
-
return
|
|
4027
|
+
return execFileSync2(command, [...args], {
|
|
3993
4028
|
encoding: "utf8",
|
|
3994
|
-
timeout:
|
|
4029
|
+
timeout: PROBE_TIMEOUT_MS,
|
|
3995
4030
|
stdio: ["ignore", "pipe", "ignore"]
|
|
3996
4031
|
});
|
|
3997
4032
|
} catch {
|
|
@@ -3999,7 +4034,7 @@ function run_probe(command, args) {
|
|
|
3999
4034
|
}
|
|
4000
4035
|
}
|
|
4001
4036
|
function parent_of(pid) {
|
|
4002
|
-
return parse_pids(run_probe(
|
|
4037
|
+
return parse_pids(run_probe(PS_COMMAND, [...PARENT_FORMAT, String(pid)]))[0];
|
|
4003
4038
|
}
|
|
4004
4039
|
function terminate(pid) {
|
|
4005
4040
|
try {
|
|
@@ -4067,15 +4102,9 @@ function ls_remote_branch_arguments(branch_name) {
|
|
|
4067
4102
|
}
|
|
4068
4103
|
|
|
4069
4104
|
// scripts/git/repository-lock.ts
|
|
4070
|
-
import { randomUUID as
|
|
4071
|
-
import { linkSync, renameSync, rmSync
|
|
4105
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
4106
|
+
import { linkSync, renameSync, rmSync } from "node:fs";
|
|
4072
4107
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
4073
|
-
|
|
4074
|
-
// scripts/josh/process-owner.ts
|
|
4075
|
-
import { z as z9 } from "zod";
|
|
4076
|
-
var process_owner_schema = z9.object({ pid: z9.number(), process_start: z9.string().optional() });
|
|
4077
|
-
|
|
4078
|
-
// scripts/git/repository-lock.ts
|
|
4079
4108
|
var POLL_INTERVAL_MS = 200;
|
|
4080
4109
|
function lock_path(prefix, cwd) {
|
|
4081
4110
|
return stamp_file.stamp_path(prefix, git_common_directory.repository(cwd) ?? cwd ?? process.cwd());
|
|
@@ -4103,7 +4132,7 @@ function stale_record(target, is_gone2) {
|
|
|
4103
4132
|
return owner !== void 0 && is_gone2(owner) ? raw : void 0;
|
|
4104
4133
|
}
|
|
4105
4134
|
function move_aside(target) {
|
|
4106
|
-
const aside = `${target}.${String(process.pid)}.${
|
|
4135
|
+
const aside = `${target}.${String(process.pid)}.${randomUUID2()}`;
|
|
4107
4136
|
try {
|
|
4108
4137
|
renameSync(target, aside);
|
|
4109
4138
|
return aside;
|
|
@@ -4117,7 +4146,7 @@ function clear_stale(target, is_gone2 = is_owner_gone) {
|
|
|
4117
4146
|
const aside = move_aside(target);
|
|
4118
4147
|
if (aside === void 0) return;
|
|
4119
4148
|
if (stamp_file.read_stamp_text(aside) !== raw) restore(aside, target);
|
|
4120
|
-
|
|
4149
|
+
rmSync(aside, { force: true });
|
|
4121
4150
|
}
|
|
4122
4151
|
function claim(target) {
|
|
4123
4152
|
clear_stale(target);
|
|
@@ -4251,13 +4280,13 @@ function read_lane_seat(content) {
|
|
|
4251
4280
|
return raw === void 0 ? void 0 : ports.resolve_lane({ [LANE_SEAT_KEY]: raw });
|
|
4252
4281
|
}
|
|
4253
4282
|
function read_lane_ports(content) {
|
|
4254
|
-
const
|
|
4283
|
+
const environment3 = {
|
|
4255
4284
|
[PORT_SEED_KEY]: read_assignment(content, PORT_SEED_KEY),
|
|
4256
4285
|
[LANE_SEAT_KEY]: read_assignment(content, LANE_SEAT_KEY)
|
|
4257
4286
|
};
|
|
4258
4287
|
return {
|
|
4259
|
-
development: ports.resolve_development_port(
|
|
4260
|
-
preview: ports.resolve_preview_port(
|
|
4288
|
+
development: ports.resolve_development_port(environment3),
|
|
4289
|
+
preview: ports.resolve_preview_port(environment3)
|
|
4261
4290
|
};
|
|
4262
4291
|
}
|
|
4263
4292
|
function read_lane_output(content) {
|
|
@@ -4276,7 +4305,8 @@ function read_lane_profile(content) {
|
|
|
4276
4305
|
function replace_assignment(lines, keep, assignment, key2) {
|
|
4277
4306
|
return lines.flatMap((entry, index) => {
|
|
4278
4307
|
if (index === keep) return [assignment];
|
|
4279
|
-
|
|
4308
|
+
if (is_key_line(entry, key2)) return [];
|
|
4309
|
+
return [entry];
|
|
4280
4310
|
});
|
|
4281
4311
|
}
|
|
4282
4312
|
function upsert_assignment(content, key2, value) {
|
|
@@ -4419,10 +4449,10 @@ var lane_registry = {
|
|
|
4419
4449
|
// scripts/run/run-headless.ts
|
|
4420
4450
|
var HEADLESS_ENV_KEY = "JOSH_RUN_HEADLESS";
|
|
4421
4451
|
var HEADLESS_VALUE = "1";
|
|
4422
|
-
function
|
|
4452
|
+
function environment2() {
|
|
4423
4453
|
return { [HEADLESS_ENV_KEY]: HEADLESS_VALUE };
|
|
4424
4454
|
}
|
|
4425
|
-
function
|
|
4455
|
+
function is_headless2(source = process.env) {
|
|
4426
4456
|
return source[HEADLESS_ENV_KEY] === HEADLESS_VALUE;
|
|
4427
4457
|
}
|
|
4428
4458
|
function is_driving(read3) {
|
|
@@ -4433,7 +4463,7 @@ async function read_carry_here() {
|
|
|
4433
4463
|
return repository2 === void 0 ? void 0 : run_carry.read_carry(run_carry.carry_path(repository2));
|
|
4434
4464
|
}
|
|
4435
4465
|
async function must_keep_waiting(source = process.env) {
|
|
4436
|
-
const is_candidate2 =
|
|
4466
|
+
const is_candidate2 = is_headless2(source) && lane_child_marker.marked_issue(source) === void 0;
|
|
4437
4467
|
if (!is_candidate2 || !await lane_registry.has_lanes_in_flight()) return false;
|
|
4438
4468
|
return is_driving(await read_carry_here());
|
|
4439
4469
|
}
|
|
@@ -4459,9 +4489,9 @@ var run_headless = {
|
|
|
4459
4489
|
HEADLESS_ENV_KEY,
|
|
4460
4490
|
current_carry,
|
|
4461
4491
|
driving_carry,
|
|
4462
|
-
environment,
|
|
4492
|
+
environment: environment2,
|
|
4463
4493
|
is_backlog_parent,
|
|
4464
|
-
is_headless,
|
|
4494
|
+
is_headless: is_headless2,
|
|
4465
4495
|
is_owned_here,
|
|
4466
4496
|
must_keep_waiting
|
|
4467
4497
|
};
|
|
@@ -4527,8 +4557,8 @@ var issue_cite = {
|
|
|
4527
4557
|
|
|
4528
4558
|
// scripts/gh/git-gh-api-path.ts
|
|
4529
4559
|
var FULL_PAGE_QUERY = "?per_page=100";
|
|
4530
|
-
function repo_api_path(repo) {
|
|
4531
|
-
return `repos/${repo
|
|
4560
|
+
function repo_api_path(repo = "{owner}/{repo}") {
|
|
4561
|
+
return `repos/${repo}`;
|
|
4532
4562
|
}
|
|
4533
4563
|
function issues_api_path(repo) {
|
|
4534
4564
|
return `${repo_api_path(repo)}/issues`;
|
|
@@ -4594,10 +4624,6 @@ var git_gh_api_path = {
|
|
|
4594
4624
|
// scripts/gh/git-gh-exec.ts
|
|
4595
4625
|
import { execa as execa5, execaSync as execaSync3 } from "execa";
|
|
4596
4626
|
|
|
4597
|
-
// scripts/lib/timeouts.ts
|
|
4598
|
-
var FETCH_TIMEOUT_MS = 1e4;
|
|
4599
|
-
var COMMAND_TIMEOUT_MS = 3e4;
|
|
4600
|
-
|
|
4601
4627
|
// scripts/gh/git-gh-check.ts
|
|
4602
4628
|
import { execa as execa4 } from "execa";
|
|
4603
4629
|
var GH_NOT_INSTALLED_MSG = "gh CLI is not installed. Install it from https://cli.github.com/";
|
|
@@ -4648,8 +4674,8 @@ var parse_json = {
|
|
|
4648
4674
|
};
|
|
4649
4675
|
|
|
4650
4676
|
// scripts/gh/git-gh-failure.ts
|
|
4651
|
-
import { z as
|
|
4652
|
-
var error_document_schema =
|
|
4677
|
+
import { z as z9 } from "zod";
|
|
4678
|
+
var error_document_schema = z9.object({ status: z9.union([z9.string(), z9.number()]).optional() }).catch({});
|
|
4653
4679
|
var GH_FAILURE_FIELD = "gh_failure";
|
|
4654
4680
|
function has_gh_failure(error) {
|
|
4655
4681
|
return error instanceof Error && Object.hasOwn(error, GH_FAILURE_FIELD);
|
|
@@ -4851,77 +4877,8 @@ var git_gh_helpers = {
|
|
|
4851
4877
|
handle_pr_create_error
|
|
4852
4878
|
};
|
|
4853
4879
|
|
|
4854
|
-
// scripts/git/schemas.ts
|
|
4855
|
-
import { z as z11 } from "zod";
|
|
4856
|
-
var package_name_schema = z11.object({ name: z11.string().min(1) });
|
|
4857
|
-
var rollup_item_schema = z11.looseObject({
|
|
4858
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- GraphQL field name from GitHub API
|
|
4859
|
-
__typename: z11.string().optional(),
|
|
4860
|
-
state: z11.string().optional(),
|
|
4861
|
-
status: z11.string().optional(),
|
|
4862
|
-
conclusion: z11.string().optional(),
|
|
4863
|
-
name: z11.string().optional(),
|
|
4864
|
-
context: z11.string().optional()
|
|
4865
|
-
});
|
|
4866
|
-
var pr_raw_schema = z11.object({
|
|
4867
|
-
statusCheckRollup: z11.array(rollup_item_schema).optional(),
|
|
4868
|
-
mergeStateStatus: z11.string().optional(),
|
|
4869
|
-
reviewDecision: z11.string().optional()
|
|
4870
|
-
});
|
|
4871
|
-
var pull_comment_schema = z11.object({
|
|
4872
|
-
body: z11.string().optional(),
|
|
4873
|
-
html_url: z11.string().optional(),
|
|
4874
|
-
user: z11.object({ login: z11.string().optional() }).optional()
|
|
4875
|
-
});
|
|
4876
|
-
var ai_review_pull_comment_schema = z11.object({
|
|
4877
|
-
body: z11.string().optional(),
|
|
4878
|
-
url: z11.string().optional(),
|
|
4879
|
-
author: z11.object({ login: z11.string().optional() }).optional()
|
|
4880
|
-
});
|
|
4881
|
-
var pr_info_schema = z11.object({
|
|
4882
|
-
mergeable: z11.union([z11.boolean(), z11.string()]).nullable().optional(),
|
|
4883
|
-
mergeStateStatus: z11.string().nullable().optional(),
|
|
4884
|
-
state: z11.string().optional()
|
|
4885
|
-
});
|
|
4886
|
-
var epic_issue_schema = z11.object({
|
|
4887
|
-
number: z11.number(),
|
|
4888
|
-
body: z11.string().optional()
|
|
4889
|
-
});
|
|
4890
|
-
var blocking_issue_schema = z11.object({
|
|
4891
|
-
number: z11.number(),
|
|
4892
|
-
state: z11.string().optional(),
|
|
4893
|
-
repository_url: z11.string().optional()
|
|
4894
|
-
});
|
|
4895
|
-
var blocked_by_schema = z11.object({
|
|
4896
|
-
nodes: z11.array(blocking_issue_schema).default([]),
|
|
4897
|
-
totalCount: z11.number().optional()
|
|
4898
|
-
}).optional();
|
|
4899
|
-
var epic_child_schema = z11.object({
|
|
4900
|
-
state: z11.string().optional(),
|
|
4901
|
-
blockedBy: blocked_by_schema
|
|
4902
|
-
});
|
|
4903
|
-
var rest_comment_schema = z11.looseObject({
|
|
4904
|
-
body: z11.string().nullish(),
|
|
4905
|
-
html_url: z11.string().optional(),
|
|
4906
|
-
user: z11.looseObject({ login: z11.string().optional() }).nullish()
|
|
4907
|
-
});
|
|
4908
|
-
var issue_label_schema = z11.object({ name: z11.string() });
|
|
4909
|
-
var epic_subject_schema = z11.object({
|
|
4910
|
-
number: z11.number(),
|
|
4911
|
-
state: z11.string().optional(),
|
|
4912
|
-
labels: z11.array(issue_label_schema).optional(),
|
|
4913
|
-
body: z11.string().optional()
|
|
4914
|
-
});
|
|
4915
|
-
var open_issue_schema = z11.object({
|
|
4916
|
-
number: z11.number(),
|
|
4917
|
-
title: z11.string(),
|
|
4918
|
-
labels: z11.array(issue_label_schema).optional(),
|
|
4919
|
-
createdAt: z11.string(),
|
|
4920
|
-
blockedBy: blocked_by_schema
|
|
4921
|
-
});
|
|
4922
|
-
|
|
4923
4880
|
// scripts/gh/git-gh-issue-rest.ts
|
|
4924
|
-
import { z as
|
|
4881
|
+
import { z as z10 } from "zod";
|
|
4925
4882
|
|
|
4926
4883
|
// scripts/gh/git-gh-rest-state.ts
|
|
4927
4884
|
var MERGED_STATE = "MERGED";
|
|
@@ -4930,11 +4887,11 @@ function to_gh_state(state) {
|
|
|
4930
4887
|
}
|
|
4931
4888
|
|
|
4932
4889
|
// scripts/gh/git-gh-issue-rest.ts
|
|
4933
|
-
var rest_issue_schema =
|
|
4934
|
-
number:
|
|
4935
|
-
issue_dependencies_summary:
|
|
4890
|
+
var rest_issue_schema = z10.looseObject({
|
|
4891
|
+
number: z10.number(),
|
|
4892
|
+
issue_dependencies_summary: z10.looseObject({ total_blocked_by: z10.number().optional() }).nullish(),
|
|
4936
4893
|
// Present only on a pull request, which this endpoint serves as readily as an issue.
|
|
4937
|
-
pull_request:
|
|
4894
|
+
pull_request: z10.looseObject({ merged_at: z10.string().nullish() }).nullish()
|
|
4938
4895
|
});
|
|
4939
4896
|
var REPOSITORY_URL = /\/repos\/([\w.-]+\/[\w.-]+)$/u;
|
|
4940
4897
|
var REPOSITORY_URL_GROUP = 1;
|
|
@@ -4986,8 +4943,8 @@ function parse_rest_issues(rest_json) {
|
|
|
4986
4943
|
function empty_blocked_by() {
|
|
4987
4944
|
return { nodes: [], totalCount: 0 };
|
|
4988
4945
|
}
|
|
4989
|
-
function repo_of_url(repository_url) {
|
|
4990
|
-
const match = REPOSITORY_URL.exec(repository_url
|
|
4946
|
+
function repo_of_url(repository_url = "") {
|
|
4947
|
+
const match = REPOSITORY_URL.exec(repository_url);
|
|
4991
4948
|
return match?.[REPOSITORY_URL_GROUP];
|
|
4992
4949
|
}
|
|
4993
4950
|
function to_blocked_by(blockers_json, exact_total) {
|
|
@@ -5281,6 +5238,7 @@ var PATCH_METHOD = "PATCH";
|
|
|
5281
5238
|
var DELETE_METHOD = "DELETE";
|
|
5282
5239
|
var HTML_URL_FILTER = ".html_url";
|
|
5283
5240
|
var ID_FILTER = ".id";
|
|
5241
|
+
var LABEL_NAMES_FILTER = ".[].name";
|
|
5284
5242
|
var LABELS_SEGMENT = "/labels";
|
|
5285
5243
|
var COMMENTS_SEGMENT = "/comments";
|
|
5286
5244
|
var CLOSED_STATE = "closed";
|
|
@@ -5355,13 +5313,35 @@ async function issue_create_with_label(input) {
|
|
|
5355
5313
|
issue_create_request({ title: input.title, body: input.body, labels: [input.label] })
|
|
5356
5314
|
);
|
|
5357
5315
|
}
|
|
5358
|
-
async function
|
|
5359
|
-
|
|
5360
|
-
|
|
5316
|
+
async function read_label_names(issue_number) {
|
|
5317
|
+
try {
|
|
5318
|
+
const raw = await git_gh_exec.exec_gh_api({
|
|
5361
5319
|
path: `${git_gh_api_path.issue_api_path(issue_number)}${LABELS_SEGMENT}`,
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5320
|
+
should_paginate: true,
|
|
5321
|
+
jq_filter: LABEL_NAMES_FILTER
|
|
5322
|
+
});
|
|
5323
|
+
return raw.split("\n").map((name) => name.trim());
|
|
5324
|
+
} catch (error) {
|
|
5325
|
+
error_text.trace_swallowed("git_gh_issue_write.read_label_names", error);
|
|
5326
|
+
return void 0;
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
async function issue_apply_label(issue_number, label2) {
|
|
5330
|
+
const labels_path = `${git_gh_api_path.issue_api_path(issue_number)}${LABELS_SEGMENT}`;
|
|
5331
|
+
try {
|
|
5332
|
+
await git_gh_exec.exec_gh_api({ path: labels_path, body: JSON.stringify({ labels: [label2] }) });
|
|
5333
|
+
return { is_applied: true };
|
|
5334
|
+
} catch (error) {
|
|
5335
|
+
const names = await read_label_names(issue_number);
|
|
5336
|
+
if (names?.includes(label2) === true) return { is_applied: true };
|
|
5337
|
+
error_text.trace_swallowed("git_gh_issue_write.issue_apply_label", error);
|
|
5338
|
+
const [gist = ""] = error_text.message_of(error).split("\n", 1);
|
|
5339
|
+
return { is_applied: false, reason: gist };
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
async function issue_add_label(issue_number, label2) {
|
|
5343
|
+
const write = await issue_apply_label(issue_number, label2);
|
|
5344
|
+
return write.is_applied;
|
|
5365
5345
|
}
|
|
5366
5346
|
async function issue_remove_label(issue_number, label2) {
|
|
5367
5347
|
const labels_path = `${git_gh_api_path.issue_api_path(issue_number)}${LABELS_SEGMENT}`;
|
|
@@ -5408,6 +5388,7 @@ var git_gh_issue_write = {
|
|
|
5408
5388
|
label_ensure,
|
|
5409
5389
|
issue_create_request,
|
|
5410
5390
|
issue_create_with_label,
|
|
5391
|
+
issue_apply_label,
|
|
5411
5392
|
issue_add_label,
|
|
5412
5393
|
issue_remove_label,
|
|
5413
5394
|
issue_add_blocked_by,
|
|
@@ -5419,7 +5400,7 @@ var NUMBER_AND_BODY_FIELDS = "number,body";
|
|
|
5419
5400
|
var BACKLOG_SCAN_FIELDS = `number,title,body,${BLOCKED_BY_COUNT_FIELD}`;
|
|
5420
5401
|
var NUMBER_TITLE_AND_LABELS_FIELDS = "number,title,labels";
|
|
5421
5402
|
var SUMMARY_FIELDS = "number,title,labels,createdAt";
|
|
5422
|
-
var PICKUP_FIELDS = `${SUMMARY_FIELDS},blockedBy`;
|
|
5403
|
+
var PICKUP_FIELDS = `${SUMMARY_FIELDS},blockedBy,body`;
|
|
5423
5404
|
var { issue_list: issue_list2 } = git_gh_issue_list;
|
|
5424
5405
|
async function issue_list_recent(limit) {
|
|
5425
5406
|
return await issue_list2({ json_fields: SUMMARY_FIELDS, limit });
|
|
@@ -5468,20 +5449,20 @@ var git_gh_issue = {
|
|
|
5468
5449
|
};
|
|
5469
5450
|
|
|
5470
5451
|
// scripts/ci/pr-classification.ts
|
|
5471
|
-
import { readFileSync as
|
|
5452
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
5472
5453
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5473
|
-
import { z as
|
|
5454
|
+
import { z as z11 } from "zod";
|
|
5474
5455
|
var CLASSIFICATION_SET = new Set(RELEASE_CLASSIFICATION_NAMES);
|
|
5475
5456
|
var ISSUE_BUG_LABEL = "bug";
|
|
5476
5457
|
var DECLARATION_PREFIX = "- \u30EA\u30EA\u30FC\u30B9\u5206\u985E: ";
|
|
5477
5458
|
var DECLARATION = new RegExp(`^${DECLARATION_PREFIX}(.+)$`, "gmu");
|
|
5478
5459
|
var LEGACY_LABELS = /* @__PURE__ */ new Set(["semver-major", "semver-minor"]);
|
|
5479
|
-
var LABEL =
|
|
5480
|
-
var USER =
|
|
5481
|
-
var PULL_REQUEST =
|
|
5482
|
-
var EVENT =
|
|
5460
|
+
var LABEL = z11.object({ name: z11.string() });
|
|
5461
|
+
var USER = z11.object({ login: z11.string() });
|
|
5462
|
+
var PULL_REQUEST = z11.object({ number: z11.number(), user: USER });
|
|
5463
|
+
var EVENT = z11.object({
|
|
5483
5464
|
pull_request: PULL_REQUEST,
|
|
5484
|
-
repository:
|
|
5465
|
+
repository: z11.object({ full_name: z11.string() })
|
|
5485
5466
|
});
|
|
5486
5467
|
function classification_error(labels, author) {
|
|
5487
5468
|
const legacy = labels.filter((label2) => LEGACY_LABELS.has(label2.toLowerCase()));
|
|
@@ -5504,7 +5485,7 @@ function release_candidates(candidates) {
|
|
|
5504
5485
|
return candidates.filter((candidate) => candidate !== ENHANCEMENT_LABEL);
|
|
5505
5486
|
}
|
|
5506
5487
|
function issue_candidates(issue_json) {
|
|
5507
|
-
const issue =
|
|
5488
|
+
const issue = z11.object({ labels: z11.array(LABEL), body: z11.string().nullable() }).parse(JSON.parse(issue_json));
|
|
5508
5489
|
const names = issue.labels.map((label2) => label2.name.toLowerCase());
|
|
5509
5490
|
const declared = [...(issue.body ?? "").matchAll(DECLARATION)].map((match) => match[1] ?? "");
|
|
5510
5491
|
const candidates = [...release_candidates([...names, ...declared].filter(is_classification))];
|
|
@@ -5537,7 +5518,7 @@ function fetch_current_labels(repository2, pull_number) {
|
|
|
5537
5518
|
}
|
|
5538
5519
|
}
|
|
5539
5520
|
function check_event(event_path, read_labels = fetch_current_labels) {
|
|
5540
|
-
const event = EVENT.parse(JSON.parse(
|
|
5521
|
+
const event = EVENT.parse(JSON.parse(readFileSync3(event_path, "utf8")));
|
|
5541
5522
|
const labels = read_labels(event.repository.full_name, event.pull_request.number);
|
|
5542
5523
|
return classification_error(labels, event.pull_request.user.login);
|
|
5543
5524
|
}
|
|
@@ -5579,31 +5560,31 @@ async function poll_until(is_done2, options) {
|
|
|
5579
5560
|
var poll = { poll_until, sleep: sleep3 };
|
|
5580
5561
|
|
|
5581
5562
|
// scripts/gh/git-gh-pr.ts
|
|
5582
|
-
import { z as
|
|
5563
|
+
import { z as z15 } from "zod";
|
|
5583
5564
|
|
|
5584
5565
|
// scripts/gh/git-gh-pr-rest.ts
|
|
5585
|
-
import { z as
|
|
5586
|
-
var rest_repo_schema =
|
|
5587
|
-
var rest_pull_side_schema =
|
|
5588
|
-
var rest_pull_schema =
|
|
5589
|
-
number:
|
|
5590
|
-
html_url:
|
|
5591
|
-
body:
|
|
5592
|
-
state:
|
|
5593
|
-
merged:
|
|
5594
|
-
merged_at:
|
|
5595
|
-
mergeable:
|
|
5596
|
-
mergeable_state:
|
|
5566
|
+
import { z as z12 } from "zod";
|
|
5567
|
+
var rest_repo_schema = z12.looseObject({ full_name: z12.string().optional() }).nullish();
|
|
5568
|
+
var rest_pull_side_schema = z12.looseObject({ repo: rest_repo_schema });
|
|
5569
|
+
var rest_pull_schema = z12.looseObject({
|
|
5570
|
+
number: z12.number(),
|
|
5571
|
+
html_url: z12.string().optional(),
|
|
5572
|
+
body: z12.string().nullish(),
|
|
5573
|
+
state: z12.string().optional(),
|
|
5574
|
+
merged: z12.boolean().nullish(),
|
|
5575
|
+
merged_at: z12.string().nullish(),
|
|
5576
|
+
mergeable: z12.boolean().nullish(),
|
|
5577
|
+
mergeable_state: z12.string().optional(),
|
|
5597
5578
|
// `sha` is the head commit, which is what both halves of the merge-gate rollup are keyed by —
|
|
5598
5579
|
// REST hangs the check runs and the status contexts off the commit rather than off the pull
|
|
5599
5580
|
// request (joshuafolkken/kit#1028).
|
|
5600
|
-
head:
|
|
5581
|
+
head: z12.looseObject({ ref: z12.string().optional(), sha: z12.string().optional(), repo: rest_repo_schema }).nullish(),
|
|
5601
5582
|
base: rest_pull_side_schema.nullish(),
|
|
5602
5583
|
// `node_id` is what the GraphQL auto-merge mutation addresses a pull request by, and `auto_merge`
|
|
5603
5584
|
// is `null` until auto-merge is enabled — both read by `git-gh-pr-auto-merge.ts`
|
|
5604
5585
|
// (joshuafolkken/kit#2497).
|
|
5605
|
-
node_id:
|
|
5606
|
-
auto_merge:
|
|
5586
|
+
node_id: z12.string().optional(),
|
|
5587
|
+
auto_merge: z12.looseObject({}).nullish()
|
|
5607
5588
|
});
|
|
5608
5589
|
var NOT_A_PULL_MESSAGE = "gh api answered something other than a pull request object";
|
|
5609
5590
|
var NOT_A_PULL_LISTING_MESSAGE = "gh api answered something other than a pull request listing";
|
|
@@ -5679,6 +5660,7 @@ async function fetch_pr_number(branch_name) {
|
|
|
5679
5660
|
return git_gh_pr_rest.select_pull(git_gh_pr_rest.parse_rest_pulls(json))?.number;
|
|
5680
5661
|
}
|
|
5681
5662
|
var pending_pr_number_by_branch = /* @__PURE__ */ new Map();
|
|
5663
|
+
var pull_by_number = /* @__PURE__ */ new Map();
|
|
5682
5664
|
async function fetch_pr_number_read(branch_name) {
|
|
5683
5665
|
try {
|
|
5684
5666
|
const pr_number = await fetch_pr_number(branch_name);
|
|
@@ -5703,6 +5685,7 @@ async function start_pr_number_read(branch_name) {
|
|
|
5703
5685
|
function forget_pr_numbers() {
|
|
5704
5686
|
pr_number_by_branch.clear();
|
|
5705
5687
|
pending_pr_number_by_branch.clear();
|
|
5688
|
+
pull_by_number.clear();
|
|
5706
5689
|
}
|
|
5707
5690
|
async function read_pr_number(branch_name) {
|
|
5708
5691
|
const cached = pr_number_by_branch.get(branch_name);
|
|
@@ -5728,15 +5711,29 @@ async function read_pull(pr_number) {
|
|
|
5728
5711
|
});
|
|
5729
5712
|
return git_gh_pr_rest.parse_rest_pull(json);
|
|
5730
5713
|
}
|
|
5731
|
-
async function
|
|
5732
|
-
const
|
|
5733
|
-
|
|
5714
|
+
async function read_remembered_pull(pr_number) {
|
|
5715
|
+
const pending = pull_by_number.get(pr_number) ?? read_pull(pr_number);
|
|
5716
|
+
pull_by_number.set(pr_number, pending);
|
|
5734
5717
|
try {
|
|
5735
|
-
return await
|
|
5736
|
-
} catch {
|
|
5737
|
-
|
|
5718
|
+
return await pending;
|
|
5719
|
+
} catch (error) {
|
|
5720
|
+
if (pull_by_number.get(pr_number) === pending) pull_by_number.delete(pr_number);
|
|
5721
|
+
throw error;
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
async function read_pull_of_branch(branch_name, read3 = read_remembered_pull) {
|
|
5725
|
+
const number_read = await read_pr_number(branch_name);
|
|
5726
|
+
if (number_read.kind !== "read") return number_read;
|
|
5727
|
+
try {
|
|
5728
|
+
return { kind: "read", pull: await read3(number_read.pr_number) };
|
|
5729
|
+
} catch (error) {
|
|
5730
|
+
return { kind: "unreadable", cause: error };
|
|
5738
5731
|
}
|
|
5739
5732
|
}
|
|
5733
|
+
async function read_pull_or_undefined(branch_name) {
|
|
5734
|
+
const read3 = await read_pull_of_branch(branch_name);
|
|
5735
|
+
return read3.kind === "read" ? read3.pull : void 0;
|
|
5736
|
+
}
|
|
5740
5737
|
async function pr_exists(branch_name) {
|
|
5741
5738
|
const read3 = await read_pr_number(branch_name);
|
|
5742
5739
|
if (read3.kind === "unreadable") throw to_unreadable_error(branch_name, read3.cause);
|
|
@@ -5746,28 +5743,31 @@ async function pr_get_number(branch_name) {
|
|
|
5746
5743
|
return await resolve_pr_number(branch_name);
|
|
5747
5744
|
}
|
|
5748
5745
|
async function pr_get_url(branch_name) {
|
|
5749
|
-
const pull = await
|
|
5746
|
+
const pull = await read_pull_or_undefined(branch_name);
|
|
5750
5747
|
if (pull?.html_url === void 0) return void 0;
|
|
5751
5748
|
return git_gh_helpers.parse_pr_state_string(pull.html_url);
|
|
5752
5749
|
}
|
|
5753
5750
|
async function pr_get_merge_state(branch_name) {
|
|
5754
|
-
const
|
|
5755
|
-
if (
|
|
5751
|
+
const read3 = await read_pull_of_branch(branch_name, read_pull);
|
|
5752
|
+
if (read3.kind !== "read") return void 0;
|
|
5753
|
+
const { pull } = read3;
|
|
5756
5754
|
return {
|
|
5757
5755
|
is_merged: git_gh_pr_rest.is_merged(pull),
|
|
5758
5756
|
merged_at: pull.merged_at ?? void 0,
|
|
5759
|
-
head_sha: pull.head?.sha
|
|
5757
|
+
head_sha: pull.head?.sha,
|
|
5758
|
+
merge_state_status: to_gh_state(pull.mergeable_state)
|
|
5760
5759
|
};
|
|
5761
5760
|
}
|
|
5762
5761
|
async function pr_get_body(branch_name) {
|
|
5763
|
-
const pull = await
|
|
5762
|
+
const pull = await read_pull_or_undefined(branch_name);
|
|
5764
5763
|
const body = pull?.body;
|
|
5765
5764
|
return typeof body === "string" && body.length > 0 ? body : void 0;
|
|
5766
5765
|
}
|
|
5767
5766
|
async function pr_view(branch_name) {
|
|
5768
|
-
const
|
|
5769
|
-
if (
|
|
5770
|
-
|
|
5767
|
+
const read3 = await read_pull_of_branch(branch_name, read_pull);
|
|
5768
|
+
if (read3.kind === "unreadable") throw to_unreadable_error(branch_name, read3.cause);
|
|
5769
|
+
if (read3.kind === "missing") return "";
|
|
5770
|
+
return JSON.stringify(git_gh_pr_rest.to_pr_info(read3.pull));
|
|
5771
5771
|
}
|
|
5772
5772
|
async function read_comments(branch_name, to_path, to_json) {
|
|
5773
5773
|
const pr_number = await resolve_pr_number(branch_name);
|
|
@@ -5803,14 +5803,14 @@ var git_gh_pr_read = {
|
|
|
5803
5803
|
};
|
|
5804
5804
|
|
|
5805
5805
|
// scripts/gh/git-gh-pr-review.ts
|
|
5806
|
-
import { z as
|
|
5806
|
+
import { z as z13 } from "zod";
|
|
5807
5807
|
var REVIEW_APPROVED = "APPROVED";
|
|
5808
5808
|
var REVIEW_CHANGES_REQUESTED = "CHANGES_REQUESTED";
|
|
5809
5809
|
var REVIEW_NONE = "";
|
|
5810
5810
|
var STATE_CHANGING_REVIEWS = /* @__PURE__ */ new Set([REVIEW_APPROVED, REVIEW_CHANGES_REQUESTED]);
|
|
5811
|
-
var rest_review_schema =
|
|
5812
|
-
state:
|
|
5813
|
-
user:
|
|
5811
|
+
var rest_review_schema = z13.looseObject({
|
|
5812
|
+
state: z13.string().optional(),
|
|
5813
|
+
user: z13.looseObject({ login: z13.string().optional() }).nullish()
|
|
5814
5814
|
});
|
|
5815
5815
|
var NOT_A_REVIEW_LISTING = "gh api answered something other than a review listing";
|
|
5816
5816
|
function parse_rest_reviews(reviews_json) {
|
|
@@ -5843,18 +5843,18 @@ function to_review_decision(reviews_json) {
|
|
|
5843
5843
|
var git_gh_pr_review = { to_review_decision };
|
|
5844
5844
|
|
|
5845
5845
|
// scripts/gh/git-gh-pr-rollup.ts
|
|
5846
|
-
import { z as
|
|
5846
|
+
import { z as z14 } from "zod";
|
|
5847
5847
|
var STATUS_CONTEXT_TYPE_NAME = "StatusContext";
|
|
5848
5848
|
var TYPE_NAME_KEY = "__typename";
|
|
5849
|
-
var rollup_element_schema =
|
|
5850
|
-
var check_runs_page_schema =
|
|
5849
|
+
var rollup_element_schema = z14.looseObject({});
|
|
5850
|
+
var check_runs_page_schema = z14.looseObject({
|
|
5851
5851
|
// Required, not optional: GitHub always names the key, and accepting a page without one would
|
|
5852
5852
|
// answer an empty rollup — which `git-pr-followup.ts` reports as "this branch has no checks".
|
|
5853
|
-
check_runs:
|
|
5853
|
+
check_runs: z14.array(rollup_element_schema)
|
|
5854
5854
|
});
|
|
5855
|
-
var id_holder_schema =
|
|
5856
|
-
var status_page_schema =
|
|
5857
|
-
statuses:
|
|
5855
|
+
var id_holder_schema = z14.object({ id: z14.number() });
|
|
5856
|
+
var status_page_schema = z14.looseObject({
|
|
5857
|
+
statuses: z14.array(rollup_element_schema)
|
|
5858
5858
|
});
|
|
5859
5859
|
var NOT_A_CHECK_RUNS_LISTING = "gh api answered something other than a check run listing";
|
|
5860
5860
|
var NOT_A_STATUS_LISTING = "gh api answered something other than a commit status listing";
|
|
@@ -5868,15 +5868,15 @@ function read_id(value) {
|
|
|
5868
5868
|
const parsed = id_holder_schema.safeParse(value);
|
|
5869
5869
|
return parsed.success ? parsed.data.id : void 0;
|
|
5870
5870
|
}
|
|
5871
|
-
function check_run_group_key(
|
|
5872
|
-
const { name, app } =
|
|
5871
|
+
function check_run_group_key(run4) {
|
|
5872
|
+
const { name, app } = run4;
|
|
5873
5873
|
if (typeof name !== "string") return void 0;
|
|
5874
5874
|
return JSON.stringify([name, read_id(app)]);
|
|
5875
5875
|
}
|
|
5876
|
-
function read_rank(
|
|
5877
|
-
const id = read_id(
|
|
5876
|
+
function read_rank(run4) {
|
|
5877
|
+
const id = read_id(run4);
|
|
5878
5878
|
if (id === void 0) return void 0;
|
|
5879
|
-
return { suite: read_id(
|
|
5879
|
+
return { suite: read_id(run4["check_suite"]) ?? NO_SUITE, run: id };
|
|
5880
5880
|
}
|
|
5881
5881
|
function is_ranked_above(candidate, current) {
|
|
5882
5882
|
if (candidate.suite !== current.suite) return candidate.suite > current.suite;
|
|
@@ -5886,23 +5886,23 @@ function should_replace(previous, rank) {
|
|
|
5886
5886
|
const previous_rank = previous === void 0 ? void 0 : read_rank(previous);
|
|
5887
5887
|
return previous_rank === void 0 || is_ranked_above(rank, previous_rank);
|
|
5888
5888
|
}
|
|
5889
|
-
function remember_newest_run(
|
|
5890
|
-
const key2 = check_run_group_key(
|
|
5891
|
-
const rank = read_rank(
|
|
5889
|
+
function remember_newest_run(run4, newest) {
|
|
5890
|
+
const key2 = check_run_group_key(run4);
|
|
5891
|
+
const rank = read_rank(run4);
|
|
5892
5892
|
if (key2 === void 0 || rank === void 0) return;
|
|
5893
|
-
if (should_replace(newest.get(key2), rank)) newest.set(key2,
|
|
5893
|
+
if (should_replace(newest.get(key2), rank)) newest.set(key2, run4);
|
|
5894
5894
|
}
|
|
5895
|
-
function is_newest_run(
|
|
5896
|
-
const key2 = check_run_group_key(
|
|
5897
|
-
if (key2 === void 0 || read_rank(
|
|
5898
|
-
return newest.get(key2) ===
|
|
5895
|
+
function is_newest_run(run4, newest) {
|
|
5896
|
+
const key2 = check_run_group_key(run4);
|
|
5897
|
+
if (key2 === void 0 || read_rank(run4) === void 0) return true;
|
|
5898
|
+
return newest.get(key2) === run4;
|
|
5899
5899
|
}
|
|
5900
5900
|
function to_check_run_items(check_runs_json) {
|
|
5901
5901
|
const pages = read_pages(check_runs_json, check_runs_page_schema, NOT_A_CHECK_RUNS_LISTING);
|
|
5902
5902
|
const runs = pages.flatMap((page) => page.check_runs);
|
|
5903
5903
|
const newest = /* @__PURE__ */ new Map();
|
|
5904
|
-
for (const
|
|
5905
|
-
return runs.filter((
|
|
5904
|
+
for (const run4 of runs) remember_newest_run(run4, newest);
|
|
5905
|
+
return runs.filter((run4) => is_newest_run(run4, newest));
|
|
5906
5906
|
}
|
|
5907
5907
|
function to_status_context_items(status_json) {
|
|
5908
5908
|
const pages = read_pages(status_json, status_page_schema, NOT_A_STATUS_LISTING);
|
|
@@ -5988,7 +5988,7 @@ var MERGE_READ_BACK_ATTEMPTS = 3;
|
|
|
5988
5988
|
var MERGE_READ_BACK_INTERVAL_MS = 1e3;
|
|
5989
5989
|
var PR_NUMBER_PATTERN = /\/pull\/([1-9]\d*)$/u;
|
|
5990
5990
|
var LABELS_SEGMENT2 = "/labels";
|
|
5991
|
-
var PR_LABELS =
|
|
5991
|
+
var PR_LABELS = z15.array(z15.object({ name: z15.string() }));
|
|
5992
5992
|
async function add_pr_classification(number, label2) {
|
|
5993
5993
|
await git_gh_exec.exec_gh_api({
|
|
5994
5994
|
path: `${git_gh_api_path.issue_api_path(number)}${LABELS_SEGMENT2}`,
|
|
@@ -6041,6 +6041,7 @@ async function pr_comment(branch_name, body) {
|
|
|
6041
6041
|
}
|
|
6042
6042
|
async function pr_update_body(branch_name, body) {
|
|
6043
6043
|
const pr_number = await require_pr_number(branch_name);
|
|
6044
|
+
forget_pr_numbers();
|
|
6044
6045
|
await git_gh_exec.exec_gh_api({
|
|
6045
6046
|
path: git_gh_api_path.pull_api_path(String(pr_number)),
|
|
6046
6047
|
method: PATCH_METHOD2,
|
|
@@ -6048,6 +6049,7 @@ async function pr_update_body(branch_name, body) {
|
|
|
6048
6049
|
});
|
|
6049
6050
|
}
|
|
6050
6051
|
async function put_merge(pr_number) {
|
|
6052
|
+
forget_pr_numbers();
|
|
6051
6053
|
await git_gh_exec.exec_gh_api({
|
|
6052
6054
|
path: git_gh_api_path.pull_merge_api_path(String(pr_number)),
|
|
6053
6055
|
method: PUT_METHOD,
|
|
@@ -6156,178 +6158,6 @@ var git_gh_repo = {
|
|
|
6156
6158
|
repo_get_name_with_owner
|
|
6157
6159
|
};
|
|
6158
6160
|
|
|
6159
|
-
// scripts/gh/git-pr-checks-parse.ts
|
|
6160
|
-
var CHECK_STATUS_PASS = "pass";
|
|
6161
|
-
var CHECK_STATUS_PENDING = "pending";
|
|
6162
|
-
var CHECK_STATUS_FAIL = "fail";
|
|
6163
|
-
var CHECK_STATUS_MISSING = "missing";
|
|
6164
|
-
var PASSING_CONCLUSIONS = /* @__PURE__ */ new Set(["success", "skipped", "neutral"]);
|
|
6165
|
-
var KEY_TYPE_NAME = "__typename";
|
|
6166
|
-
var KEY_STATE = "state";
|
|
6167
|
-
var KEY_STATUS = "status";
|
|
6168
|
-
var KEY_CONCLUSION = "conclusion";
|
|
6169
|
-
var KEY_NAME = "name";
|
|
6170
|
-
var KEY_CONTEXT = "context";
|
|
6171
|
-
function read_string(value) {
|
|
6172
|
-
if (typeof value !== "string") return void 0;
|
|
6173
|
-
const trimmed2 = value.trim();
|
|
6174
|
-
if (trimmed2.length === 0) return void 0;
|
|
6175
|
-
return trimmed2;
|
|
6176
|
-
}
|
|
6177
|
-
var PENDING_STATUS_STATES = /* @__PURE__ */ new Set(["pending", "expected"]);
|
|
6178
|
-
function parse_status_context(item) {
|
|
6179
|
-
const state = read_string(item[KEY_STATE])?.toLowerCase();
|
|
6180
|
-
if (state === "success") return CHECK_STATUS_PASS;
|
|
6181
|
-
if (state !== void 0 && PENDING_STATUS_STATES.has(state)) return CHECK_STATUS_PENDING;
|
|
6182
|
-
return CHECK_STATUS_FAIL;
|
|
6183
|
-
}
|
|
6184
|
-
function is_passing_conclusion(item) {
|
|
6185
|
-
const conclusion = read_string(item[KEY_CONCLUSION])?.toLowerCase();
|
|
6186
|
-
return conclusion !== void 0 && PASSING_CONCLUSIONS.has(conclusion);
|
|
6187
|
-
}
|
|
6188
|
-
function parse_check_run(item) {
|
|
6189
|
-
const status2 = read_string(item[KEY_STATUS])?.toLowerCase();
|
|
6190
|
-
if (status2 !== "completed") return CHECK_STATUS_PENDING;
|
|
6191
|
-
return is_passing_conclusion(item) ? CHECK_STATUS_PASS : CHECK_STATUS_FAIL;
|
|
6192
|
-
}
|
|
6193
|
-
function parse_rollup_status(item) {
|
|
6194
|
-
const type_name = read_string(item[KEY_TYPE_NAME]);
|
|
6195
|
-
if (type_name === "StatusContext") return parse_status_context(item);
|
|
6196
|
-
return parse_check_run(item);
|
|
6197
|
-
}
|
|
6198
|
-
function read_rollup_array(parsed) {
|
|
6199
|
-
const result = pr_raw_schema.safeParse(parsed);
|
|
6200
|
-
if (!result.success) return [];
|
|
6201
|
-
return result.data.statusCheckRollup ?? [];
|
|
6202
|
-
}
|
|
6203
|
-
function parse_rollup_item(item) {
|
|
6204
|
-
const name = read_string(item[KEY_NAME]) ?? read_string(item[KEY_CONTEXT]);
|
|
6205
|
-
if (name === void 0) return void 0;
|
|
6206
|
-
return { name, status: parse_rollup_status(item) };
|
|
6207
|
-
}
|
|
6208
|
-
function parse_rollup_checks(raw_json) {
|
|
6209
|
-
const parsed = json_value.parse_or_undefined(raw_json);
|
|
6210
|
-
const rollup = read_rollup_array(parsed);
|
|
6211
|
-
const checks = [];
|
|
6212
|
-
for (const item of rollup) {
|
|
6213
|
-
const parsed_item = parse_rollup_item(item);
|
|
6214
|
-
if (parsed_item !== void 0) checks.push(parsed_item);
|
|
6215
|
-
}
|
|
6216
|
-
return checks;
|
|
6217
|
-
}
|
|
6218
|
-
function parse_pr_state_snapshot(raw_json) {
|
|
6219
|
-
const parsed = json_value.parse_or_undefined(raw_json);
|
|
6220
|
-
const result = pr_raw_schema.safeParse(parsed);
|
|
6221
|
-
const data = result.success ? result.data : void 0;
|
|
6222
|
-
return {
|
|
6223
|
-
rollup: parse_rollup_checks(raw_json),
|
|
6224
|
-
merge_state_status: read_string(data?.mergeStateStatus),
|
|
6225
|
-
review_decision: read_string(data?.reviewDecision)
|
|
6226
|
-
};
|
|
6227
|
-
}
|
|
6228
|
-
|
|
6229
|
-
// scripts/gh/git-pr-checks-eval.ts
|
|
6230
|
-
var DEFAULT_REQUIRED_CHECKS = ["SonarQube"];
|
|
6231
|
-
var CODERABBIT_CHECK_NAME = "CodeRabbit";
|
|
6232
|
-
var REQUIRED_CHECKS_ENV_VAR = "JOSH_REQUIRED_CHECKS";
|
|
6233
|
-
function parse_required_checks() {
|
|
6234
|
-
const raw = process.env[REQUIRED_CHECKS_ENV_VAR];
|
|
6235
|
-
if (!raw) return DEFAULT_REQUIRED_CHECKS;
|
|
6236
|
-
return raw.split(",").map((check) => check.trim()).filter((check) => check.length > 0);
|
|
6237
|
-
}
|
|
6238
|
-
var REQUIRED_CHECKS = parse_required_checks();
|
|
6239
|
-
var MERGE_STATE_CLEAN = "CLEAN";
|
|
6240
|
-
var MERGE_STATE_UNSTABLE = "UNSTABLE";
|
|
6241
|
-
var MERGE_STATE_DIRTY = "DIRTY";
|
|
6242
|
-
var REVIEW_CHANGES_REQUESTED2 = "CHANGES_REQUESTED";
|
|
6243
|
-
var CHECK_SUITE_SEPARATOR = " / ";
|
|
6244
|
-
var FAILURE_MESSAGE_PREFIX = "PR checks failed";
|
|
6245
|
-
var FAILURE_REASON_REVIEW = "review requested changes";
|
|
6246
|
-
var FAILURE_REASON_CHECKS = "failed checks";
|
|
6247
|
-
var FAILURE_REASON_CONFLICT = "merge conflict";
|
|
6248
|
-
function is_required_match(check_name, required_name) {
|
|
6249
|
-
if (check_name === required_name) return true;
|
|
6250
|
-
return check_name.startsWith(`${required_name}${CHECK_SUITE_SEPARATOR}`);
|
|
6251
|
-
}
|
|
6252
|
-
function find_required_check(checks, required_name) {
|
|
6253
|
-
return checks.find((check) => is_required_match(check.name, required_name));
|
|
6254
|
-
}
|
|
6255
|
-
function read_required_statuses(checks) {
|
|
6256
|
-
return REQUIRED_CHECKS.map(
|
|
6257
|
-
(name) => find_required_check(checks, name)?.status ?? CHECK_STATUS_MISSING
|
|
6258
|
-
);
|
|
6259
|
-
}
|
|
6260
|
-
function is_review_blocked(review_decision) {
|
|
6261
|
-
return review_decision === REVIEW_CHANGES_REQUESTED2;
|
|
6262
|
-
}
|
|
6263
|
-
function is_merge_conflict(merge_state_status) {
|
|
6264
|
-
return merge_state_status === MERGE_STATE_DIRTY;
|
|
6265
|
-
}
|
|
6266
|
-
function evaluate_failure_state(input) {
|
|
6267
|
-
if (is_merge_conflict(input.merge_state_status) || is_review_blocked(input.review_decision) || input.failed_checks.length > 0) {
|
|
6268
|
-
return "failure";
|
|
6269
|
-
}
|
|
6270
|
-
return void 0;
|
|
6271
|
-
}
|
|
6272
|
-
function is_merge_state_clean(merge_state_status) {
|
|
6273
|
-
return merge_state_status === MERGE_STATE_CLEAN;
|
|
6274
|
-
}
|
|
6275
|
-
function is_every_required_passing(statuses) {
|
|
6276
|
-
return statuses.every((status2) => status2 === CHECK_STATUS_PASS);
|
|
6277
|
-
}
|
|
6278
|
-
function is_coderabbit_check(check_name) {
|
|
6279
|
-
return is_required_match(check_name, CODERABBIT_CHECK_NAME);
|
|
6280
|
-
}
|
|
6281
|
-
function is_unstable_only_from_coderabbit(snapshot) {
|
|
6282
|
-
if (snapshot.merge_state_status !== MERGE_STATE_UNSTABLE) return false;
|
|
6283
|
-
const non_passing = snapshot.rollup.filter((check) => check.status !== CHECK_STATUS_PASS);
|
|
6284
|
-
if (non_passing.length === 0) return false;
|
|
6285
|
-
return non_passing.every((check) => is_coderabbit_check(check.name));
|
|
6286
|
-
}
|
|
6287
|
-
function is_required_check(check_name) {
|
|
6288
|
-
return REQUIRED_CHECKS.some((required) => is_required_match(check_name, required));
|
|
6289
|
-
}
|
|
6290
|
-
function is_blocking_failure(check) {
|
|
6291
|
-
if (check.status !== CHECK_STATUS_FAIL) return false;
|
|
6292
|
-
return !is_coderabbit_check(check.name) || is_required_check(check.name);
|
|
6293
|
-
}
|
|
6294
|
-
function collect_blocking_failures(snapshot) {
|
|
6295
|
-
return snapshot.rollup.filter((check) => is_blocking_failure(check)).map((check) => check.name);
|
|
6296
|
-
}
|
|
6297
|
-
function is_mergeable_state(snapshot) {
|
|
6298
|
-
if (is_merge_state_clean(snapshot.merge_state_status)) return true;
|
|
6299
|
-
return is_unstable_only_from_coderabbit(snapshot);
|
|
6300
|
-
}
|
|
6301
|
-
function collect_failure_reasons(snapshot) {
|
|
6302
|
-
const reasons = [];
|
|
6303
|
-
if (is_merge_conflict(snapshot.merge_state_status)) reasons.push(FAILURE_REASON_CONFLICT);
|
|
6304
|
-
if (is_review_blocked(snapshot.review_decision)) reasons.push(FAILURE_REASON_REVIEW);
|
|
6305
|
-
const failed = collect_blocking_failures(snapshot);
|
|
6306
|
-
if (failed.length > 0) reasons.push(`${FAILURE_REASON_CHECKS}: ${failed.join(", ")}`);
|
|
6307
|
-
return reasons;
|
|
6308
|
-
}
|
|
6309
|
-
function describe_pr_failure(snapshot) {
|
|
6310
|
-
const reasons = collect_failure_reasons(snapshot);
|
|
6311
|
-
if (reasons.length === 0) return `${FAILURE_MESSAGE_PREFIX}.`;
|
|
6312
|
-
return `${FAILURE_MESSAGE_PREFIX} (${reasons.join("; ")}).`;
|
|
6313
|
-
}
|
|
6314
|
-
function evaluate_pr_state(snapshot) {
|
|
6315
|
-
const statuses = read_required_statuses(snapshot.rollup);
|
|
6316
|
-
const failure = evaluate_failure_state({
|
|
6317
|
-
review_decision: snapshot.review_decision,
|
|
6318
|
-
failed_checks: collect_blocking_failures(snapshot),
|
|
6319
|
-
merge_state_status: snapshot.merge_state_status
|
|
6320
|
-
});
|
|
6321
|
-
if (failure !== void 0) return failure;
|
|
6322
|
-
if (is_mergeable_state(snapshot) && is_every_required_passing(statuses)) {
|
|
6323
|
-
return "success";
|
|
6324
|
-
}
|
|
6325
|
-
return "pending";
|
|
6326
|
-
}
|
|
6327
|
-
function is_review_decision_decisive(snapshot) {
|
|
6328
|
-
return evaluate_pr_state(snapshot) !== "pending";
|
|
6329
|
-
}
|
|
6330
|
-
|
|
6331
6161
|
// scripts/gh/git-pr-checks.ts
|
|
6332
6162
|
var SECONDS_TO_MS = 1e3;
|
|
6333
6163
|
var CHECK_WAIT_INTERVAL_MS = 1e4;
|
|
@@ -6347,7 +6177,9 @@ var PR_CHECKS_TIMEOUT_MESSAGE = "Timed out while waiting for PR checks to comple
|
|
|
6347
6177
|
function is_pr_checks_timeout(error) {
|
|
6348
6178
|
return error instanceof Error && error.message === PR_CHECKS_TIMEOUT_MESSAGE;
|
|
6349
6179
|
}
|
|
6350
|
-
|
|
6180
|
+
function should_always_read_review_decision() {
|
|
6181
|
+
return true;
|
|
6182
|
+
}
|
|
6351
6183
|
var MERGE_GATE_EVALUATOR = {
|
|
6352
6184
|
evaluate: evaluate_pr_state,
|
|
6353
6185
|
describe: describe_pr_failure,
|
|
@@ -6356,9 +6188,14 @@ var MERGE_GATE_EVALUATOR = {
|
|
|
6356
6188
|
function advance_stable_count(previous, state) {
|
|
6357
6189
|
return state === "success" ? previous + 1 : 0;
|
|
6358
6190
|
}
|
|
6191
|
+
function failure_error(message, snapshot) {
|
|
6192
|
+
return is_merge_conflict(snapshot.merge_state_status) ? new PrConflictError(message) : new Error(message);
|
|
6193
|
+
}
|
|
6359
6194
|
function classify_poll_result(input) {
|
|
6360
6195
|
const state = input.evaluator.evaluate(input.snapshot);
|
|
6361
|
-
if (state === "failure")
|
|
6196
|
+
if (state === "failure") {
|
|
6197
|
+
throw failure_error(input.evaluator.describe(input.snapshot), input.snapshot);
|
|
6198
|
+
}
|
|
6362
6199
|
const next_stable_count = advance_stable_count(input.stable_count, state);
|
|
6363
6200
|
return {
|
|
6364
6201
|
is_done: next_stable_count >= input.required_stable_reads,
|
|
@@ -6369,7 +6206,7 @@ async function read_pr_state(input, evaluator) {
|
|
|
6369
6206
|
try {
|
|
6370
6207
|
const snapshot = await input.options.fetcher(
|
|
6371
6208
|
input.options.branch_name,
|
|
6372
|
-
evaluator.should_read_review_decision ??
|
|
6209
|
+
evaluator.should_read_review_decision ?? should_always_read_review_decision
|
|
6373
6210
|
);
|
|
6374
6211
|
return { kind: "read", snapshot };
|
|
6375
6212
|
} catch (error) {
|
|
@@ -6423,7 +6260,7 @@ async function wait_for_pr_success(options) {
|
|
|
6423
6260
|
}
|
|
6424
6261
|
throw to_exhaustion_error(carried.read_failure);
|
|
6425
6262
|
}
|
|
6426
|
-
async function default_fetch_pr_state(branch_name, should_read_review_decision =
|
|
6263
|
+
async function default_fetch_pr_state(branch_name, should_read_review_decision = should_always_read_review_decision) {
|
|
6427
6264
|
const checks = await git_gh_pr_snapshot.pr_get_checks_snapshot(branch_name);
|
|
6428
6265
|
const snapshot = parse_pr_state_snapshot(checks.snapshot_json);
|
|
6429
6266
|
if (!should_read_review_decision(snapshot)) return snapshot;
|
|
@@ -6451,11 +6288,13 @@ function describe_checks_failure(snapshot) {
|
|
|
6451
6288
|
const failed = snapshot.rollup.filter((check) => check.status === CHECK_STATUS_FAIL);
|
|
6452
6289
|
return `${CHECKS_FAILED_MESSAGE}: ${failed.map((check) => check.name).join(", ")}`;
|
|
6453
6290
|
}
|
|
6454
|
-
|
|
6291
|
+
function should_never_read_review_decision() {
|
|
6292
|
+
return false;
|
|
6293
|
+
}
|
|
6455
6294
|
var CHECKS_SETTLED_EVALUATOR = {
|
|
6456
6295
|
evaluate: evaluate_checks_settled,
|
|
6457
6296
|
describe: describe_checks_failure,
|
|
6458
|
-
should_read_review_decision:
|
|
6297
|
+
should_read_review_decision: should_never_read_review_decision
|
|
6459
6298
|
};
|
|
6460
6299
|
async function watch_until_settled(branch_name) {
|
|
6461
6300
|
await wait_for_pr_success({
|
|
@@ -6471,7 +6310,7 @@ async function watch_until_settled(branch_name) {
|
|
|
6471
6310
|
});
|
|
6472
6311
|
}
|
|
6473
6312
|
async function fail_when_no_checks(branch_name) {
|
|
6474
|
-
const snapshot = await default_fetch_pr_state(branch_name,
|
|
6313
|
+
const snapshot = await default_fetch_pr_state(branch_name, should_never_read_review_decision);
|
|
6475
6314
|
if (snapshot.rollup.length === 0) throw new Error(NO_CHECKS_MESSAGE);
|
|
6476
6315
|
}
|
|
6477
6316
|
async function pr_checks_watch(branch_name) {
|
|
@@ -6505,19 +6344,17 @@ export {
|
|
|
6505
6344
|
git_spawn_sync,
|
|
6506
6345
|
git_command,
|
|
6507
6346
|
git_common_directory,
|
|
6508
|
-
error_text,
|
|
6509
6347
|
tail_commands,
|
|
6510
6348
|
filing_cap,
|
|
6511
6349
|
CONTEXT_CUT_THRESHOLD,
|
|
6512
|
-
RECENT_REQUEST_WINDOW,
|
|
6513
6350
|
agent_role_profile,
|
|
6514
6351
|
cli_flags,
|
|
6515
6352
|
own_session,
|
|
6516
6353
|
backlog_budget,
|
|
6517
|
-
run_cut_handoff,
|
|
6518
6354
|
run_hold,
|
|
6355
|
+
run_cut_handoff,
|
|
6519
6356
|
run_cut,
|
|
6520
|
-
|
|
6357
|
+
run_tail_rule,
|
|
6521
6358
|
lane_background,
|
|
6522
6359
|
IN_PROGRESS_LABEL,
|
|
6523
6360
|
NEEDS_DECISION_LABEL,
|
|
@@ -6527,7 +6364,7 @@ export {
|
|
|
6527
6364
|
ALREADY_DONE_LABEL,
|
|
6528
6365
|
has_any_label,
|
|
6529
6366
|
has_label_name,
|
|
6530
|
-
|
|
6367
|
+
agent_headless,
|
|
6531
6368
|
run_event_stream,
|
|
6532
6369
|
run_invocation,
|
|
6533
6370
|
run_carry,
|
|
@@ -6536,15 +6373,12 @@ export {
|
|
|
6536
6373
|
lane_park,
|
|
6537
6374
|
repo_origin,
|
|
6538
6375
|
repo_party,
|
|
6539
|
-
process_owner_schema,
|
|
6540
6376
|
lane_registry,
|
|
6541
6377
|
run_headless,
|
|
6542
6378
|
git_gh_api_path,
|
|
6543
|
-
FETCH_TIMEOUT_MS,
|
|
6544
6379
|
read_json_listing,
|
|
6545
6380
|
parse_json_object_safe,
|
|
6546
6381
|
git_gh_exec,
|
|
6547
|
-
open_issue_schema,
|
|
6548
6382
|
git_gh_issue_read,
|
|
6549
6383
|
git_gh_pr_read,
|
|
6550
6384
|
git_gh_command
|