@joshuafolkken/kit 1.1050.0 → 1.1128.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/settings.json +9 -8
- package/.claude/skills/epic-commands/SKILL.md +5 -7
- package/.claude/skills/workflow-commands/SKILL.md +20 -12
- package/.claude/skills/workflow-commands/background-commands.md +36 -84
- package/.claude/skills/workflow-commands/backlogrun-child.md +1 -1
- package/.claude/skills/workflow-commands/backlogrun-lanes.md +8 -6
- package/.claude/skills/workflow-commands/backlogrun-progress.md +30 -33
- package/.claude/skills/workflow-commands/backlogrun-steps.md +12 -12
- package/.claude/skills/workflow-commands/backlogrun.md +2 -2
- package/.claude/skills/workflow-commands/chain-rule.md +4 -2
- package/.claude/skills/workflow-commands/delegation.md +3 -3
- package/.claude/skills/workflow-commands/followup-reference.md +1 -1
- package/.claude/skills/workflow-commands/followup.md +7 -3
- package/.claude/skills/workflow-commands/fullrun-steps.md +3 -2
- package/.claude/skills/workflow-commands/fullrun.md +8 -6
- package/.claude/skills/workflow-commands/halfrun.md +19 -21
- package/.claude/skills/workflow-commands/issue-comments.md +1 -1
- package/.claude/skills/workflow-commands/issue-fold-existing.md +10 -10
- package/.claude/skills/workflow-commands/issue-scout.md +1 -1
- package/.claude/skills/workflow-commands/kickoff.md +9 -4
- package/.claude/skills/workflow-commands/latest-gate.md +8 -16
- package/.claude/skills/workflow-commands/needs-human-review.md +1 -1
- package/.claude/skills/workflow-commands/observation-filing.md +3 -3
- package/.claude/skills/workflow-commands/pre-gate-cut.md +4 -8
- package/.claude/skills/workflow-commands/prerequisite.md +1 -1
- package/.claude/skills/workflow-commands/prrun.md +36 -0
- package/.claude/skills/workflow-commands/retrospective.md +1 -1
- package/.claude/skills/workflow-commands/split-assessment.md +4 -18
- package/.claude/skills/workflow-commands/working-tree-hold.md +22 -2
- package/.codex/hooks.json +16 -20
- package/.github/actions/setup-node/action.yml +33 -0
- package/.github/actions/setup-pnpm/action.yml +93 -0
- package/.github/dependabot.yml +5 -1
- package/.github/workflows/auto-tag.yml +2 -3
- package/.github/workflows/ci.yml +31 -134
- package/.github/workflows/dependabot-auto-merge.yml +1 -0
- package/.github/workflows/pr-classification.yml +6 -44
- package/.github/workflows/production.yml +1 -0
- package/.github/workflows/publish.yml +43 -47
- package/.github/workflows/sonar-qube.yml +41 -4
- package/.pnpmfile.mjs +29 -0
- package/AGENTS.md +5 -2
- package/CLAUDE.md +33 -27
- package/GEMINI.md +5 -2
- package/README.md +66 -20
- package/SECURITY.md +37 -6
- package/cspell/index.yaml +6 -1
- package/dist/CLAUDE.basic.md +6 -6
- package/dist/CLAUDE.md +33 -27
- package/dist/CLAUDE.static.md +6 -6
- package/dist/config-merge/index.js +48 -12
- package/dist/hooks/batch-guard.js +4 -4
- package/dist/hooks/{chunk-7VPDUBRN.js → chunk-4JZDP5X5.js} +152 -155
- package/dist/hooks/{chunk-HJIISEAC.js → chunk-5SD2YM7Z.js} +5 -13
- package/dist/hooks/{chunk-NAS4C7GP.js → chunk-77J7IEQM.js} +2 -2
- package/dist/hooks/{chunk-DMQN45FN.js → chunk-7HVB7SZG.js} +3 -3
- package/dist/hooks/{chunk-RLDX5SOC.js → chunk-AIOIOMPX.js} +4413 -1970
- package/dist/hooks/{chunk-5BK3K7V4.js → chunk-M7QKEKWO.js} +873 -2049
- package/dist/hooks/{chunk-WQ4OSBSS.js → chunk-MKVGBQPA.js} +2 -2
- package/dist/hooks/{chunk-EJDX2TOB.js → chunk-NXYMNPUQ.js} +7 -88
- package/dist/hooks/{chunk-NJQOBE6L.js → chunk-QVLT52OV.js} +2 -7
- package/dist/hooks/{chunk-GQ7KP45M.js → chunk-XYUIQOW3.js} +2 -2
- package/dist/hooks/codex-hook-adapter.js +12 -48
- package/dist/hooks/duplicate-read-guard.js +5 -5
- package/dist/hooks/format-edited.js +2 -2
- package/dist/hooks/inputs.json +280 -0
- package/dist/hooks/investigation-guard.js +5 -5
- package/dist/hooks/pretool-guard.js +9 -9
- package/dist/hooks/session-lang.js +0 -1
- package/dist/hooks/stop-guard.js +192 -333
- package/dist/josh.js +240 -148
- package/dist/managed-marker/index.js +2 -1
- package/dist/version/index.js +70 -78
- package/eslint/rules/promise.js +5 -0
- package/eslint/rules/unicorn.js +3 -2
- package/package.json +26 -5
- package/pnpm-workspace.yaml +5 -7
- package/prompts/collaboration-workflow/glossary.md +17 -0
- package/prompts/collaboration-workflow/issue-citation.md +5 -5
- package/prompts/collaboration-workflow/issue-template.md +1 -1
- package/prompts/collaboration-workflow/operating-rules.md +5 -5
- package/prompts/collaboration-workflow/overview.md +13 -1
- package/prompts/collaboration-workflow/principles.md +9 -0
- package/prompts/collaboration-workflow/report-format.md +1 -1
- package/prompts/collaboration-workflow/residency.md +3 -3
- package/prompts/collaboration-workflow/rule-delivery.md +1 -1
- package/prompts/collaboration-workflow/turn-batching.md +3 -3
- package/prompts/collaboration-workflow/upstream-interrupt.md +1 -1
- package/prompts/collaboration-workflow/wip-cap.md +25 -22
- package/prompts/collaboration-workflow.md +6 -8
- package/prompts/review-rubric.md +1 -1
- package/prompts/review.md +3 -3
- package/prompts/sonar-hotspot-handling.md +11 -3
- package/prompts/testing-guide.md +3 -3
- package/scripts/adopt/adopt-toolkits.ts +0 -2
- package/scripts/adopt/adopt.ts +0 -2
- package/scripts/agent/agent-argv.ts +0 -2
- package/scripts/agent/agent-diagnostics.ts +1 -1
- package/scripts/agent/agent-role-profile.ts +0 -7
- package/scripts/agent/claude-agent-argv.ts +0 -2
- package/scripts/agent/codex-agent-argv.ts +1 -1
- package/scripts/agent/codex-hooks.ts +92 -0
- package/scripts/agent/interactive-ask.ts +1 -1
- package/scripts/auto-ok/auto-ok-cli.ts +6 -16
- package/scripts/backlog/backlog-arrival.ts +30 -10
- package/scripts/backlog/backlog-budget-cli.ts +15 -16
- package/scripts/backlog/backlog-budget.ts +0 -2
- package/scripts/backlog/backlog-defect-priority.ts +2 -2
- package/scripts/backlog/backlog-drive-cli.ts +10 -8
- package/scripts/backlog/backlog-drive-named-offer.ts +16 -3
- package/scripts/backlog/backlog-drive-named.ts +2 -1
- package/scripts/backlog/backlog-drive.ts +76 -16
- package/scripts/backlog/backlog-named.ts +0 -3
- package/scripts/backlog/backlog-next.ts +9 -15
- package/scripts/backlog/backlog-offer-cli.ts +6 -19
- package/scripts/backlog/backlog-plan-cli.ts +1 -7
- package/scripts/backlog/backlog-plan.ts +30 -19
- package/scripts/backlog/backlog-pool.ts +3 -6
- package/scripts/backlog/backlog-rank.ts +2 -2
- package/scripts/backlog/backlog-ready.ts +39 -10
- package/scripts/backlog/backlog-scope.ts +1 -3
- package/scripts/backlog/backlog-stalled-detect.ts +2 -2
- package/scripts/backlog/backlog-stalled.ts +0 -1
- package/scripts/backlog/backlog-waves.ts +5 -2
- package/scripts/behavior/behavior-cli.ts +1 -1
- package/scripts/build/build-codex-hooks.ts +26 -0
- package/scripts/build/build-hooks.ts +85 -9
- package/scripts/build/hook-bundle-stamp.ts +111 -0
- package/scripts/cases/cases-cli.ts +1 -1
- package/scripts/cases/cases-logic.ts +1 -1
- package/scripts/ci/composite-actions.ts +30 -0
- package/scripts/ci/pr-classification.ts +3 -3
- package/scripts/claude/workflow-destination.ts +10 -1
- package/scripts/clone/clone-fingerprint.ts +0 -1
- package/scripts/clone/clone-scan-cli.ts +1 -1
- package/scripts/clone/clone-scan.ts +1 -1
- package/scripts/config-merge/json-format.ts +0 -1
- package/scripts/config-merge/parse-jsonc.ts +33 -3
- package/scripts/config-merge/patch-json-key.ts +13 -6
- package/scripts/config-merge/patch-yaml-list.ts +1 -1
- package/scripts/cost-runtime/codex-usage.ts +2 -9
- package/scripts/cost-runtime/cost-attribute.ts +0 -1
- package/scripts/cost-runtime/cost-cli.ts +3 -10
- package/scripts/cost-runtime/cost-corpus.ts +0 -2
- package/scripts/cost-runtime/cost-format.ts +0 -3
- package/scripts/cost-runtime/cost-pricing.ts +0 -1
- package/scripts/cost-runtime/cost-tokens.ts +0 -1
- package/scripts/delegation/delegation-cli.ts +1 -1
- package/scripts/delegation/delegation-policy.ts +0 -1
- package/scripts/delegation/duplicate-read-guard.ts +0 -8
- package/scripts/delegation/fanout-cli.ts +1 -1
- package/scripts/delegation/fanout.ts +0 -2
- package/scripts/delegation/investigation-reads.ts +1 -164
- package/scripts/discovery/repo-map-logic.ts +0 -1
- package/scripts/discovery/repo-party-cli.ts +1 -1
- package/scripts/doctor/doctor-consumer.ts +6 -10
- package/scripts/doctor/doctor-io.ts +9 -13
- package/scripts/doctor/doctor-logic.ts +0 -4
- package/scripts/doctor/doctor.ts +14 -9
- package/scripts/document/backlogrun-parent-read-set.ts +12 -1
- package/scripts/document/document-byte-budget.ts +5 -5
- package/scripts/document/document-byte-check.ts +0 -1
- package/scripts/document/document-read-cli.ts +0 -2
- package/scripts/document/document-section-cli.ts +1 -1
- package/scripts/document/document-section.ts +0 -3
- package/scripts/document/edit-files-cli.ts +0 -1
- package/scripts/document/entry-read-budget.ts +21 -7
- package/scripts/document/entry-read-set.ts +32 -8
- package/scripts/document/lane-child-read-set.ts +8 -6
- package/scripts/document/read-files-cli.ts +0 -4
- package/scripts/document/read-set-cli.ts +0 -2
- package/scripts/document/read-set-point-of-use.ts +9 -3
- package/scripts/document/read-set-pricing.ts +0 -1
- package/scripts/document/read-set-trim.ts +4 -2
- package/scripts/epic/epic-add.ts +1 -1
- package/scripts/epic/epic-audit-cli.ts +1 -4
- package/scripts/epic/epic-audit-orphans.ts +1 -3
- package/scripts/epic/epic-audit-rationale.ts +0 -1
- package/scripts/epic/epic-audit-report.ts +0 -2
- package/scripts/epic/epic-audit.ts +8 -22
- package/scripts/epic/epic-bundle-cli.ts +1 -1
- package/scripts/epic/epic-bundle-evidence.ts +0 -1
- package/scripts/epic/epic-bundle-referenced.ts +1 -5
- package/scripts/epic/epic-bundle.ts +0 -4
- package/scripts/epic/epic-busy.ts +4 -5
- package/scripts/epic/epic-candidate-confirm.ts +0 -5
- package/scripts/epic/epic-classify.ts +2 -2
- package/scripts/epic/epic-cli-argv.ts +0 -1
- package/scripts/epic/epic-close-comment.ts +1 -1
- package/scripts/epic/epic-close.ts +5 -2
- package/scripts/epic/epic-cross-repo.ts +2 -4
- package/scripts/epic/epic-decision.ts +0 -1
- package/scripts/epic/epic-fetch.ts +2 -2
- package/scripts/epic/epic-index.ts +2 -3
- package/scripts/epic/epic-issue.ts +1 -15
- package/scripts/epic/epic-lane-offer.ts +9 -8
- package/scripts/epic/epic-nested.ts +1 -1
- package/scripts/epic/epic-next-read.ts +1 -3
- package/scripts/epic/epic-next-views.ts +0 -1
- package/scripts/epic/epic-next.ts +1 -10
- package/scripts/epic/epic-parse.ts +0 -1
- package/scripts/epic/epic-promote.ts +0 -9
- package/scripts/epic/epic-rank.ts +2 -2
- package/scripts/epic/epic-read.ts +1 -2
- package/scripts/epic/epic-reconcile.ts +1 -1
- package/scripts/epic/epic-reference.ts +1 -13
- package/scripts/epic/epic-relation-recheck.ts +1 -1
- package/scripts/epic/epic-relations.ts +1 -1
- package/scripts/epic/epic-remove.ts +1 -1
- package/scripts/epic/epic-report.ts +0 -1
- package/scripts/epic/epic-run.ts +2 -3
- package/scripts/epic/epic-shape.ts +1 -1
- package/scripts/epic/epic-solo-stale.ts +107 -0
- package/scripts/epic/epic-solo.ts +3 -2
- package/scripts/epic/epic-triage.ts +1 -1
- package/scripts/epic/epic-validate.ts +1 -1
- package/scripts/epic/epic.ts +1 -1
- package/scripts/exports/unused-members-cli.ts +53 -0
- package/scripts/{git → followup}/followup-issue-number.ts +1 -6
- package/scripts/{git → followup}/git-followup-cleanup.ts +2 -1
- package/scripts/{git → followup}/git-followup-finish.ts +1 -3
- package/scripts/{git → followup}/git-followup-flush.ts +2 -2
- package/scripts/{git → followup}/git-followup-issue-close.ts +2 -2
- package/scripts/{git → followup}/git-followup-label.ts +4 -4
- package/scripts/followup/git-followup-merged.ts +112 -0
- package/scripts/{git → followup}/git-followup-pending.ts +1 -1
- package/scripts/{git → followup}/git-followup-workflow.ts +19 -11
- package/scripts/{git → followup}/git-pr-followup-wrapup.ts +9 -3
- package/scripts/{git → followup}/git-pr-followup.ts +53 -16
- package/scripts/gate/core-budget.ts +3 -9
- package/scripts/gate/gate-plan.ts +7 -4
- package/scripts/gate/gate-report.ts +0 -6
- package/scripts/gate/gate-tree.ts +1 -1
- package/scripts/gate/pre-commit-type-check.ts +0 -6
- package/scripts/gate/project-checks.ts +7 -8
- package/scripts/gate/scoped-green.ts +0 -1
- package/scripts/gate/type-check-step.ts +1 -1
- package/scripts/gate/verification-gate.ts +0 -2
- package/scripts/gh/fix-gh-packages.ts +15 -12
- package/scripts/gh/gh-spawn.ts +2 -2
- package/scripts/{git → gh}/git-ai-review-scan.ts +1 -5
- package/scripts/{git → gh}/git-gh-check.ts +2 -1
- package/scripts/{git → gh}/git-gh-exec.ts +1 -1
- package/scripts/{git → gh}/git-gh-failure.ts +1 -1
- package/scripts/{git → gh}/git-gh-helpers.ts +0 -1
- package/scripts/{git → gh}/git-gh-issue-list.ts +13 -10
- package/scripts/{git → gh}/git-gh-issue-read.ts +1 -1
- package/scripts/{git → gh}/git-gh-issue-rest.ts +6 -3
- package/scripts/{git → gh}/git-gh-issue-write.ts +4 -1
- package/scripts/{git → gh}/git-gh-pr-auto-merge.ts +4 -1
- package/scripts/{git → gh}/git-gh-pr-read.ts +24 -0
- package/scripts/{git → gh}/git-gh-pr-rest.ts +5 -2
- package/scripts/{git → gh}/git-gh-pr-review.ts +2 -2
- package/scripts/{git → gh}/git-gh-pr-rollup.ts +1 -3
- package/scripts/{git → gh}/git-gh-pr.ts +3 -1
- package/scripts/{git → gh}/git-pr-ai-review.ts +2 -5
- package/scripts/{git → gh}/git-pr-checks-eval.ts +0 -10
- package/scripts/{git → gh}/git-pr-checks-parse.ts +4 -20
- package/scripts/{git → gh}/git-pr-checks.ts +2 -1
- package/scripts/{git → gh}/git-pr-coderabbit.ts +2 -5
- package/scripts/{git → gh}/git-pr-confirmation.ts +1 -3
- package/scripts/{git → gh}/git-pr-managed-config.ts +2 -3
- package/scripts/{git → gh}/git-pr.ts +3 -3
- package/scripts/git/changed-file-scope.ts +0 -1
- package/scripts/git/git-branch.ts +3 -6
- package/scripts/git/git-command.ts +6 -1
- package/scripts/git/git-commit.ts +1 -1
- package/scripts/git/git-common-directory.ts +80 -24
- package/scripts/git/git-error.ts +66 -9
- package/scripts/git/git-issue.ts +1 -1
- package/scripts/git/git-preflight.ts +2 -2
- package/scripts/git/git-prompt.ts +6 -31
- package/scripts/git/git-push.ts +1 -1
- package/scripts/git/git-spawn-sync.ts +65 -0
- package/scripts/git/git-spawn.ts +5 -4
- package/scripts/git/git-staging.ts +1 -0
- package/scripts/git/git-status.ts +1 -1
- package/scripts/git/git-workflow.ts +1 -1
- package/scripts/git/gone-branch.ts +1 -0
- package/scripts/git/listing-cutoff.ts +1 -1
- package/scripts/git/main-merge.ts +1 -1
- package/scripts/git/main-sync.ts +19 -1
- package/scripts/git/parse-json-array.ts +0 -3
- package/scripts/git/repository-lock.ts +16 -16
- package/scripts/git/{git-stash.ts → stash/git-stash.ts} +1 -1
- package/scripts/git/{stash-pop-args.ts → stash/stash-pop-args.ts} +2 -7
- package/scripts/git/{stash-pop-cli.ts → stash/stash-pop-cli.ts} +0 -1
- package/scripts/git/{stash-sweep-lock.ts → stash/stash-sweep-lock.ts} +3 -3
- package/scripts/hooks/codex-hook-adapter.ts +0 -1
- package/scripts/hooks/edited-cspell.ts +1 -1
- package/scripts/hooks/format-edited-file.ts +2 -0
- package/scripts/hooks/pre-push-unit.ts +0 -4
- package/scripts/hooks/pretool-guard.ts +22 -4
- package/scripts/hooks/reserved-run.ts +1 -1
- package/scripts/hooks/step-zero-notice.ts +76 -0
- package/scripts/hooks/stop-guard.ts +47 -21
- package/scripts/init/claude-plugin-config.ts +4 -5
- package/scripts/init/hook-command-rewrite.ts +16 -8
- package/scripts/init/hook-launch.ts +41 -15
- package/scripts/init/init-basic.ts +2 -5
- package/scripts/init/init-file-action.ts +54 -0
- package/scripts/init/init-logic-migrate.ts +35 -17
- package/scripts/init/init-logic-secretlint.ts +1 -1
- package/scripts/init/init-logic.ts +10 -19
- package/scripts/init/init.ts +11 -71
- package/scripts/init/kit-written-paths.ts +2 -0
- package/scripts/init/project-profile.ts +9 -17
- package/scripts/init/start-exec.ts +1 -1
- package/scripts/init/start-setup-pr.ts +6 -6
- package/scripts/init/start-steps.ts +3 -1
- package/scripts/issue/behavior-change-lint.ts +0 -1
- package/scripts/issue/defect-rate-cli.ts +64 -23
- package/scripts/issue/defect-rate.ts +1 -2
- package/scripts/{git → issue}/git-next-issues.ts +3 -3
- package/scripts/issue/issue-backlinks-cli.ts +1 -5
- package/scripts/issue/issue-backlinks.ts +7 -14
- package/scripts/issue/issue-cite-cli.ts +2 -6
- package/scripts/issue/issue-cite.ts +12 -8
- package/scripts/issue/issue-classification.ts +1 -9
- package/scripts/issue/issue-closing-pr.ts +4 -4
- package/scripts/issue/issue-comment-cli.ts +2 -2
- package/scripts/issue/issue-file-cli.ts +5 -5
- package/scripts/issue/issue-file.ts +7 -14
- package/scripts/issue/issue-fold-cli.ts +1 -1
- package/scripts/issue/issue-fold-existing-cli.ts +1 -1
- package/scripts/{git → issue}/issue-labels.ts +8 -0
- package/scripts/issue/issue-lint-cli.ts +1 -1
- package/scripts/issue/issue-merged.ts +2 -2
- package/scripts/{git → issue}/issue-rank.ts +1 -1
- package/scripts/issue/issue-read-cli.ts +8 -47
- package/scripts/issue/issue-read.ts +0 -2
- package/scripts/issue/issue-report-failures.ts +80 -0
- package/scripts/issue/issue-scout-cli.ts +1 -7
- package/scripts/issue/issue-scout-closed.ts +2 -2
- package/scripts/issue/issue-scout.ts +0 -2
- package/scripts/issue/issue-state-cli.ts +5 -46
- package/scripts/issue/issue-state.ts +1 -5
- package/scripts/issue/markdown-section.ts +21 -6
- package/scripts/issue/measure-rerun-cli.ts +74 -15
- package/scripts/issue/reproduction-measure.ts +1 -1
- package/scripts/josh/cli-body.ts +1 -1
- package/scripts/josh/file-map-stamp.ts +0 -3
- package/scripts/josh/josh-command-map.ts +2 -0
- package/scripts/josh/josh-commands-ai.ts +9 -102
- package/scripts/josh/josh-commands-backlog.ts +5 -1
- package/scripts/josh/josh-commands-development.ts +8 -1
- package/scripts/josh/josh-commands-issue.ts +2 -2
- package/scripts/josh/josh-commands-maintenance.ts +7 -0
- package/scripts/josh/josh-commands-project.ts +7 -1
- package/scripts/josh/josh-commands-run.ts +114 -0
- package/scripts/josh/josh-commands-versioning.ts +8 -0
- package/scripts/josh/josh-commands-workflow.ts +3 -3
- package/scripts/josh/path-decision.ts +0 -3
- package/scripts/josh/process-owner.ts +16 -0
- package/scripts/josh/run-github-prerequisite.ts +3 -6
- package/scripts/josh/session-language-cli.ts +0 -1
- package/scripts/lane/lane-await.ts +46 -19
- package/scripts/lane/lane-capacity.ts +6 -3
- package/scripts/lane/lane-child-invocation.ts +20 -7
- package/scripts/lane/lane-cli.ts +1 -4
- package/scripts/lane/lane-close.ts +5 -4
- package/scripts/lane/lane-dispatch.ts +3 -4
- package/scripts/lane/lane-environment.ts +0 -9
- package/scripts/lane/lane-handoff.ts +38 -0
- package/scripts/lane/lane-launch-cli.ts +31 -27
- package/scripts/lane/lane-open.ts +0 -3
- package/scripts/lane/lane-output.ts +0 -1
- package/scripts/lane/lane-registry.ts +9 -0
- package/scripts/lane/openai-lane-ship.ts +2 -0
- package/scripts/lane/openai-lane-supervisor-decision.ts +2 -1
- package/scripts/lane/openai-lane-supervisor.ts +6 -4
- package/scripts/lane/openai-review-broker.ts +7 -1
- package/scripts/lib/bounded-pool.ts +1 -0
- package/scripts/lib/cli-flags.ts +31 -2
- package/scripts/lib/error-message.ts +12 -1
- package/scripts/lib/json-value.ts +5 -4
- package/scripts/lib/poll.ts +3 -1
- package/scripts/lib/timed-fetch.ts +15 -0
- package/scripts/lib/timeouts.ts +13 -0
- package/scripts/{yaml → lib}/yaml-document.ts +3 -1
- package/scripts/{bytes → lines}/bytes-command.ts +0 -2
- package/scripts/lines/line-targets.ts +0 -11
- package/scripts/lines/lines-command.ts +5 -4
- package/scripts/lint/lint-related-scope.ts +0 -1
- package/scripts/lint/lint-related.ts +1 -1
- package/scripts/{git → notify}/telegram-notify.ts +2 -2
- package/scripts/{git → notify}/telegram-test.ts +4 -4
- package/scripts/observations/observation-ledger-home.ts +0 -1
- package/scripts/observations/observation-ledger-line.ts +0 -1
- package/scripts/observations/observation-ledger-migrate.ts +1 -1
- package/scripts/observations/observations-flush-landing.ts +3 -3
- package/scripts/observations/observations-flush.ts +2 -2
- package/scripts/overrides/lockfile-overrides.ts +1 -1
- package/scripts/overrides/overrides-logic.ts +1 -1
- package/scripts/package/package-scout-cli.ts +2 -7
- package/scripts/package/package-scout.ts +0 -2
- package/scripts/propagate/propagate-git-failure.ts +0 -1
- package/scripts/propagate/propagate-git.ts +3 -10
- package/scripts/propagate/propagate-publish.ts +2 -3
- package/scripts/propagate/propagate-run.ts +0 -2
- package/scripts/propagate/propagate-steps.ts +3 -5
- package/scripts/propagate/propagate-targets.ts +0 -4
- package/scripts/propagate/propagate.ts +0 -4
- package/scripts/refactor/import-graph.ts +0 -1
- package/scripts/refactor/refactor-lint.ts +0 -2
- package/scripts/refactor/refactor-scan.ts +2 -2
- package/scripts/refactor/refactor-targets.ts +0 -1
- package/scripts/registry-migration/migrate-logic.ts +28 -21
- package/scripts/registry-migration/migrate.ts +25 -14
- package/scripts/release/github-release-cli.ts +19 -6
- package/scripts/release/github-release-environment.ts +46 -0
- package/scripts/release/github-release.ts +151 -94
- package/scripts/release/release-history.ts +0 -1
- package/scripts/release/release-plan.ts +0 -1
- package/scripts/release/release-publish.ts +38 -5
- package/scripts/release/release-scope-cli.ts +1 -2
- package/scripts/release/release-tag.ts +2 -4
- package/scripts/release/release-worktree.ts +97 -2
- package/scripts/repo/auto-merge-setting-logic.ts +1 -4
- package/scripts/repo/repo-setting.ts +1 -1
- package/scripts/repo/repository-labels.ts +3 -3
- package/scripts/repo/required-checks-logic.ts +206 -0
- package/scripts/repo/required-checks-report.ts +71 -0
- package/scripts/repo/ruleset-check-cli.ts +53 -0
- package/scripts/repo/ruleset-check.ts +147 -0
- package/scripts/report/report-lint-cli.ts +0 -4
- package/scripts/review/disposition-cli.ts +1 -1
- package/scripts/review/live-evidence.ts +1 -1
- package/scripts/review/review-attest-cli.ts +0 -6
- package/scripts/review/review-attest.ts +4 -16
- package/scripts/review/review-brief-cli.ts +23 -6
- package/scripts/review/review-brief.ts +21 -8
- package/scripts/review/review-checkout.ts +3 -2
- package/scripts/review/review-diff-parts.ts +89 -0
- package/scripts/review/review-diff-write.ts +97 -0
- package/scripts/review/review-finding-ledger.ts +0 -1
- package/scripts/review/review-record-cli.ts +10 -17
- package/scripts/review/review-record.ts +0 -1
- package/scripts/review/review-round2-cli.ts +1 -1
- package/scripts/review/review-stamps.ts +0 -3
- package/scripts/review/review-tree.ts +14 -2
- package/scripts/rules/decision-oracle-stage.ts +18 -0
- package/scripts/rules/decision-oracle.ts +10 -7
- package/scripts/rules/delivered-rules.ts +9 -1
- package/scripts/rules/destructive-command.ts +119 -0
- package/scripts/rules/direct-filing.ts +1 -1
- package/scripts/rules/early-heartbeat.ts +4 -3
- package/scripts/rules/file-body.ts +0 -3
- package/scripts/rules/filing-cap.ts +0 -2
- package/scripts/rules/gh-api.ts +7 -2
- package/scripts/rules/git-argv.ts +18 -7
- package/scripts/rules/git-force.ts +0 -2
- package/scripts/rules/implementation-cut.ts +0 -1
- package/scripts/rules/index-guard.ts +71 -0
- package/scripts/rules/issue-citation.ts +50 -25
- package/scripts/rules/lane-background.ts +15 -7
- package/scripts/rules/lane-park.ts +22 -6
- package/scripts/rules/last-prompt.ts +1 -0
- package/scripts/rules/oracle-consulted.ts +1 -1
- package/scripts/rules/oracle-firing.ts +1 -0
- package/scripts/rules/oracle-list-cli.ts +0 -3
- package/scripts/rules/permission-guards.ts +14 -0
- package/scripts/rules/protected-files.ts +74 -0
- package/scripts/rules/reply-language.ts +1 -1
- package/scripts/rules/rule-body-guard.ts +0 -3
- package/scripts/rules/rule-value-cli.ts +0 -1
- package/scripts/rules/shell-body-trigger.ts +0 -1
- package/scripts/rules/shell-segments.ts +0 -1
- package/scripts/rules/stop-rules.ts +20 -9
- package/scripts/rules/tail-commands.ts +1 -1
- package/scripts/rules/test-declared-commit.ts +1 -1
- package/scripts/rules/third-party-write.ts +0 -1
- package/scripts/rules/worktree-guard.ts +26 -9
- package/scripts/run/run-carry-args.ts +8 -12
- package/scripts/run/run-carry-cli.ts +0 -2
- package/scripts/run/run-carry-stash.ts +2 -2
- package/scripts/run/run-carry-streak.ts +1 -1
- package/scripts/run/run-cut-args.ts +1 -6
- package/scripts/run/run-cut-cli.ts +0 -7
- package/scripts/run/run-cut.ts +8 -54
- package/scripts/run/run-ending-cli.ts +2 -6
- package/scripts/run/run-ending.ts +1 -4
- package/scripts/run/run-entry-cli.ts +133 -25
- package/scripts/run/run-entry-stop.ts +104 -0
- package/scripts/run/run-entry.ts +0 -1
- package/scripts/run/run-event-cli.ts +0 -2
- package/scripts/run/run-event-follow.ts +1 -0
- package/scripts/run/run-event-render.ts +1 -1
- package/scripts/run/run-event-scope.ts +53 -4
- package/scripts/run/run-event-stream-emit.ts +7 -2
- package/scripts/run/run-event-stream.ts +0 -3
- package/scripts/run/run-event-watch.ts +1 -0
- package/scripts/run/run-halfrun-resume.ts +20 -7
- package/scripts/run/run-headless.ts +2 -2
- package/scripts/run/run-hold-cli.ts +33 -10
- package/scripts/run/run-hold.ts +29 -6
- package/scripts/run/run-issue-number.ts +1 -1
- package/scripts/run/run-liveness-cli.ts +2 -6
- package/scripts/run/run-liveness.ts +2 -3
- package/scripts/run/run-merge-cli.ts +7 -23
- package/scripts/run/run-merge-steps.ts +5 -5
- package/scripts/run/run-merge.ts +1 -1
- package/scripts/run/run-next-cli.ts +1 -1
- package/scripts/run/run-parent-cut-hook.ts +4 -2
- package/scripts/run/run-preflight.ts +2 -9
- package/scripts/run/run-prep-cli.ts +6 -3
- package/scripts/run/run-prep-locate.ts +1 -1
- package/scripts/run/run-progress-args.ts +20 -4
- package/scripts/run/run-progress-cli.ts +35 -36
- package/scripts/run/run-progress-clock.ts +10 -35
- package/scripts/run/run-progress-config.ts +0 -4
- package/scripts/run/run-progress-read.ts +1 -2
- package/scripts/run/run-progress.ts +1 -2
- package/scripts/run/run-prrun-resume.ts +117 -0
- package/scripts/run/run-report-cli.ts +1 -2
- package/scripts/run/run-report.ts +0 -1
- package/scripts/run/run-retrospective.ts +1 -1
- package/scripts/run/run-review-cli.ts +0 -3
- package/scripts/run/run-review-steps.ts +2 -0
- package/scripts/run/run-review.ts +0 -2
- package/scripts/run/run-ship-cli.ts +29 -19
- package/scripts/run/run-ship-detach.ts +1 -0
- package/scripts/run/run-ship-next.ts +106 -0
- package/scripts/run/run-ship-preflight.ts +1 -1
- package/scripts/run/run-ship-probe.ts +4 -1
- package/scripts/run/run-ship-return.ts +8 -3
- package/scripts/run/run-ship-review-steps.ts +18 -4
- package/scripts/run/run-ship-review.ts +11 -0
- package/scripts/run/run-ship-scoped.ts +1 -0
- package/scripts/run/run-ship-steps.ts +1 -1
- package/scripts/run/run-ship.ts +0 -1
- package/scripts/run/run-stage-read.ts +62 -0
- package/scripts/run/run-stage.ts +160 -0
- package/scripts/run/run-status-cli.ts +3 -16
- package/scripts/run/run-step-cli.ts +21 -14
- package/scripts/run/run-step.ts +1 -1
- package/scripts/run/run-stop-notify.ts +1 -3
- package/scripts/run/run-stranded-cli.ts +0 -4
- package/scripts/run/run-stranded-detect.ts +2 -2
- package/scripts/run/run-tail-cli.ts +17 -11
- package/scripts/run/run-tail.ts +2 -0
- package/scripts/run/run-tidy-lanes.ts +6 -2
- package/scripts/run/run-tidy-stashes.ts +12 -12
- package/scripts/run/run-wake-cli.ts +4 -13
- package/scripts/run/run-wake-loop.ts +2 -2
- package/scripts/run/run-wake.ts +2 -4
- package/scripts/run/run-watcher-guard-cli.ts +0 -4
- package/scripts/run/run-watcher-guard.ts +18 -12
- package/scripts/run/run-watcher-hook.ts +1 -1
- package/scripts/safe-chain/ci-installer-pin.ts +11 -5
- package/scripts/safe-chain/pack-hook.ts +92 -0
- package/scripts/safe-chain/project-config.ts +1 -1
- package/scripts/security/security-audit-provision-logic.ts +0 -1
- package/scripts/security/security-audit-provision.ts +3 -2
- package/scripts/security/security-audit.ts +0 -1
- package/scripts/security/security-updates-logic.ts +0 -1
- package/scripts/sonar/sonar-hotspots-cli.ts +10 -52
- package/scripts/sonar/sonar-hotspots.ts +0 -1
- package/scripts/sonar/sonar-new-code-cli.ts +150 -0
- package/scripts/sonar/sonar-new-code.ts +79 -0
- package/scripts/sonar/sonar-project.ts +97 -0
- package/scripts/split/split-assess-cli.ts +1 -1
- package/scripts/split/split-assess.ts +2 -5
- package/scripts/sync/managed-config-scope-cli.ts +1 -1
- package/scripts/sync/skill-migration.ts +0 -1
- package/scripts/sync/sync-ai-files.ts +4 -0
- package/scripts/sync/sync-hook-safety.ts +2 -3
- package/scripts/sync/sync.ts +1 -8
- package/scripts/sync/template-source-logic.ts +0 -1
- package/scripts/sync/workflow-pin-logic.ts +16 -28
- package/scripts/test/test-declared-changed.ts +13 -16
- package/scripts/test/test-declared-logic.ts +0 -1
- package/scripts/test/test-declared.ts +3 -9
- package/scripts/test/test-red-commit.ts +2 -2
- package/scripts/test/test-red.ts +14 -7
- package/scripts/test/test-type-logic.ts +1 -1
- package/scripts/test/unit-worker-share.ts +7 -16
- package/scripts/time-runtime/time-batch-guard.ts +1 -2
- package/scripts/time-runtime/time-bundle-call.ts +0 -1
- package/scripts/time-runtime/time-bundles.ts +0 -4
- package/scripts/time-runtime/time-density-hook.ts +0 -2
- package/scripts/time-runtime/time-followup-stage.ts +1 -1
- package/scripts/time-runtime/time-format.ts +0 -73
- package/scripts/time-runtime/time-round-trips.ts +0 -4
- package/scripts/time-runtime/time-single-check.ts +1 -1
- package/scripts/time-runtime/time-spans.ts +1 -1
- package/scripts/time-runtime/time-transcript-line.ts +1 -2
- package/scripts/ui/ui-routes-cli.ts +0 -5
- package/scripts/ui/ui-routes.ts +0 -5
- package/scripts/version/effective-upstream.ts +2 -2
- package/scripts/version/latest-corepack.ts +7 -9
- package/scripts/version/latest-scope-cli.ts +0 -2
- package/scripts/version/latest-update.ts +0 -2
- package/scripts/version/npm-registry.ts +2 -2
- package/scripts/version/publishable-range-check.ts +1 -1
- package/scripts/version/release-hold.ts +0 -4
- package/scripts/version/running-binary.ts +2 -2
- package/scripts/version/version-check-logic.ts +0 -2
- package/scripts/version/version-commands.ts +11 -1
- package/scripts/version/version-remote.ts +3 -3
- package/scripts/version/version-targets.ts +4 -4
- package/templates/CLAUDE.basic.md +6 -6
- package/templates/sonar-project.properties +28 -1
- package/templates/workflows/ci.yml +16 -82
- package/templates/workflows/dependabot-auto-merge.yml +6 -3
- package/templates/workflows/github-release.yml +79 -0
- package/tsconfig.sonar.json +4 -22
- package/prompts/collaboration-workflow/cross-repo-epic.md +0 -5
- package/prompts/collaboration-workflow/epic-audit.md +0 -5
- package/prompts/collaboration-workflow/epic-bundle.md +0 -5
- package/scripts/init/plugin-install-hint.ts +0 -47
- package/scripts/version/parse-json.ts +0 -13
- /package/scripts/{git → followup}/git-followup-stages.ts +0 -0
- /package/scripts/{git → gh}/git-gh-api-path.ts +0 -0
- /package/scripts/{git → gh}/git-gh-command.ts +0 -0
- /package/scripts/{git → gh}/git-gh-issue.ts +0 -0
- /package/scripts/{git → gh}/git-gh-pr-snapshot.ts +0 -0
- /package/scripts/{git → gh}/git-gh-reachability.ts +0 -0
- /package/scripts/{git → gh}/git-gh-repo.ts +0 -0
- /package/scripts/{git → gh}/git-gh-rest-state.ts +0 -0
- /package/scripts/{git → gh}/git-pr-checks-watch.ts +0 -0
- /package/scripts/{git → gh}/git-pr-error.ts +0 -0
- /package/scripts/{git → gh}/git-pr-messages.ts +0 -0
- /package/scripts/{git → gh}/github-issue-url.ts +0 -0
- /package/scripts/git/{stash-orphans.ts → stash/stash-orphans.ts} +0 -0
- /package/scripts/{git → issue}/issue-reference.ts +0 -0
- /package/scripts/{git → lib}/animation-helpers.ts +0 -0
- /package/scripts/{git → lib}/git-animation.ts +0 -0
- /package/scripts/{git → notify}/git-notify.ts +0 -0
- /package/scripts/{git → notify}/telegram-test-logic.ts +0 -0
package/dist/hooks/stop-guard.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
import {
|
|
3
|
+
FETCH_TIMEOUT_MS,
|
|
3
4
|
RUN_LANE_LABEL,
|
|
4
5
|
RUN_SOLO_LABEL,
|
|
5
6
|
agent_role_profile,
|
|
6
7
|
backlog_budget,
|
|
7
8
|
filing_cap,
|
|
8
9
|
git_gh_api_path,
|
|
10
|
+
git_gh_command,
|
|
9
11
|
git_gh_exec,
|
|
10
12
|
has_label_name,
|
|
11
13
|
issue_cite,
|
|
12
14
|
lane_background,
|
|
15
|
+
lane_handoff,
|
|
13
16
|
lane_park,
|
|
14
17
|
lane_registry,
|
|
15
18
|
process_identity,
|
|
19
|
+
process_owner_schema,
|
|
16
20
|
repo_party,
|
|
17
21
|
run_carry,
|
|
18
22
|
run_cut,
|
|
23
|
+
run_event_stream,
|
|
24
|
+
run_event_stream_emit,
|
|
19
25
|
run_headless,
|
|
20
26
|
run_hold,
|
|
21
27
|
run_invocation
|
|
22
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-AIOIOMPX.js";
|
|
23
29
|
import {
|
|
24
30
|
session_language
|
|
25
31
|
} from "./chunk-6V5OPIUU.js";
|
|
26
32
|
import {
|
|
27
33
|
hook_decision,
|
|
28
34
|
lane_child_marker
|
|
29
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-MKVGBQPA.js";
|
|
30
36
|
import {
|
|
31
37
|
PROJECT_ROOT,
|
|
32
38
|
json_value,
|
|
@@ -34,7 +40,7 @@ import {
|
|
|
34
40
|
time_density_hook,
|
|
35
41
|
time_hook_transcript,
|
|
36
42
|
time_reported_failure
|
|
37
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-4JZDP5X5.js";
|
|
38
44
|
import "./chunk-WPALEIRX.js";
|
|
39
45
|
import "./chunk-RKUAD3I6.js";
|
|
40
46
|
|
|
@@ -62,6 +68,23 @@ async function josh_run(args, should_forward_stderr = false, timeout_ms) {
|
|
|
62
68
|
}
|
|
63
69
|
var josh_command = { josh_run };
|
|
64
70
|
|
|
71
|
+
// scripts/lane/lane-seed.ts
|
|
72
|
+
var FIRST_LANE_SEAT = 1;
|
|
73
|
+
var LAST_LANE_SEAT = 9;
|
|
74
|
+
function free_seats(used) {
|
|
75
|
+
const taken = new Set(used);
|
|
76
|
+
const free = [];
|
|
77
|
+
for (let seat = FIRST_LANE_SEAT; seat <= LAST_LANE_SEAT; seat += 1) {
|
|
78
|
+
if (!taken.has(seat)) free.push(seat);
|
|
79
|
+
}
|
|
80
|
+
return free;
|
|
81
|
+
}
|
|
82
|
+
var lane_seed_policy = {
|
|
83
|
+
FIRST_LANE_SEAT,
|
|
84
|
+
LAST_LANE_SEAT,
|
|
85
|
+
free_seats
|
|
86
|
+
};
|
|
87
|
+
|
|
65
88
|
// scripts/lane/lane-capacity.ts
|
|
66
89
|
var DEFAULT_LANE_LIMIT = 6;
|
|
67
90
|
var LANE_LIMIT_KEY = "JOSH_LANE_LIMIT";
|
|
@@ -82,12 +105,10 @@ function lane_limit(environment = process.env) {
|
|
|
82
105
|
return read_limit(environment[LANE_LIMIT_KEY]);
|
|
83
106
|
}
|
|
84
107
|
function free_lanes(limit, occupied) {
|
|
85
|
-
return Math.max(NO_LANES, limit - occupied);
|
|
108
|
+
return Math.max(NO_LANES, Math.min(limit, lane_seed_policy.LAST_LANE_SEAT) - occupied);
|
|
86
109
|
}
|
|
87
110
|
var lane_capacity = {
|
|
88
|
-
DEFAULT_LANE_LIMIT,
|
|
89
111
|
LANE_LIMIT_KEY,
|
|
90
|
-
read_limit,
|
|
91
112
|
lane_limit,
|
|
92
113
|
free_lanes
|
|
93
114
|
};
|
|
@@ -96,26 +117,31 @@ var lane_capacity = {
|
|
|
96
117
|
var ISSUE_NUMBER = /#\d+/gu;
|
|
97
118
|
var REFERENCE_BOUNDARY = /[\s#()[\]<>|]/u;
|
|
98
119
|
var OWNER_REPO = /^[^\s/#]+\/[^\s/#]+$/u;
|
|
99
|
-
var MARKDOWN_LINK = /\[
|
|
120
|
+
var MARKDOWN_LINK = /\[[^[\]]*\]\([^()]*\)/gu;
|
|
121
|
+
var NUMBER_CONTINUATION = /^(?:\w|-[a-z])/iu;
|
|
122
|
+
var CONTINUATION_WIDTH = 2;
|
|
123
|
+
var GLUED_LEAD = /[&./]/u;
|
|
100
124
|
var FENCE_MARKER = /^\s*(?:`{3,}|~{3,})/u;
|
|
101
125
|
var QUOTE_LINE = /^\s*>/u;
|
|
102
126
|
var PR_PREFIX = /\b(?:pr|pull request)\s*$/iu;
|
|
103
127
|
var BACKTICK_PAIR = 2;
|
|
104
|
-
function
|
|
105
|
-
const start =
|
|
106
|
-
|
|
107
|
-
return index >= start && index < end;
|
|
128
|
+
function link_covers(link, index) {
|
|
129
|
+
const start = link.index ?? 0;
|
|
130
|
+
return index >= start && index < start + link[0].length;
|
|
108
131
|
}
|
|
109
132
|
function is_linked_at(line, index) {
|
|
110
133
|
for (const link of line.matchAll(MARKDOWN_LINK)) {
|
|
111
|
-
if (
|
|
134
|
+
if (link_covers(link, index)) return true;
|
|
112
135
|
}
|
|
113
136
|
return false;
|
|
114
137
|
}
|
|
115
|
-
function
|
|
138
|
+
function lead_token(message2, hash_index) {
|
|
116
139
|
let start = hash_index;
|
|
117
140
|
while (start > 0 && !REFERENCE_BOUNDARY.test(message2.charAt(start - 1))) start -= 1;
|
|
118
|
-
|
|
141
|
+
return message2.slice(start, hash_index);
|
|
142
|
+
}
|
|
143
|
+
function repo_prefix(message2, hash_index) {
|
|
144
|
+
const token = lead_token(message2, hash_index);
|
|
119
145
|
return OWNER_REPO.test(token) ? token : "";
|
|
120
146
|
}
|
|
121
147
|
function is_inline_code_at(line, index) {
|
|
@@ -126,13 +152,16 @@ function is_bare_at(line, index) {
|
|
|
126
152
|
if (is_linked_at(line, index) || is_inline_code_at(line, index)) return false;
|
|
127
153
|
return !PR_PREFIX.test(line.slice(0, index));
|
|
128
154
|
}
|
|
155
|
+
function is_glued(line, reference) {
|
|
156
|
+
const end = reference.index + reference.text.length;
|
|
157
|
+
if (NUMBER_CONTINUATION.test(line.slice(end, end + CONTINUATION_WIDTH))) return true;
|
|
158
|
+
return reference.prefix === "" && GLUED_LEAD.test(lead_token(line, reference.index));
|
|
159
|
+
}
|
|
129
160
|
function line_references(line) {
|
|
130
161
|
const references = [];
|
|
131
162
|
for (const match of line.matchAll(ISSUE_NUMBER)) {
|
|
132
|
-
const { index
|
|
133
|
-
if (is_bare_at(line, index))
|
|
134
|
-
references.push({ index, prefix: repo_prefix(line, index), text: match[0] });
|
|
135
|
-
}
|
|
163
|
+
const reference = { index: match.index, prefix: repo_prefix(line, match.index), text: match[0] };
|
|
164
|
+
if (!is_glued(line, reference) && is_bare_at(line, match.index)) references.push(reference);
|
|
136
165
|
}
|
|
137
166
|
return references;
|
|
138
167
|
}
|
|
@@ -231,144 +260,6 @@ function message(children, repo) {
|
|
|
231
260
|
}
|
|
232
261
|
var epic_triage = { TRIAGE_VERDICT, is_triaged, message, untriaged };
|
|
233
262
|
|
|
234
|
-
// scripts/run/run-event-stream.ts
|
|
235
|
-
import { z } from "zod";
|
|
236
|
-
var EVENT_PREFIX = "josh-run-events-";
|
|
237
|
-
var EVENT_SUFFIX = ".jsonl";
|
|
238
|
-
var EVENT_CAP = 500;
|
|
239
|
-
var FIRST_POSITION = 0;
|
|
240
|
-
var POSITION_INCREMENT = 1;
|
|
241
|
-
var LINE_SEPARATOR = "\n";
|
|
242
|
-
var EVENT_KIND = {
|
|
243
|
-
PLAN: "plan",
|
|
244
|
-
CHILD_LAUNCH: "child-launch",
|
|
245
|
-
MERGE: "merge",
|
|
246
|
-
PARK: "park",
|
|
247
|
-
SPLIT: "split",
|
|
248
|
-
OUTAGE: "outage",
|
|
249
|
-
CUT: "cut",
|
|
250
|
-
// The backlog emptied while nothing of the run's own was in flight — the drain
|
|
251
|
-
// (joshuafolkken/kit#2335). It marks the position at which the end-of-run retrospective is owed,
|
|
252
|
-
// *before* the idle watch opens, so `run:step` fires the retrospective at the drain rather than after
|
|
253
|
-
// the watch runs its course. It is not itself a stop: the run watches on once the retrospective has
|
|
254
|
-
// run, and the real `STOP` follows when the watch expires.
|
|
255
|
-
DRAIN: "drain",
|
|
256
|
-
STOP: "stop",
|
|
257
|
-
PR_OPENED: "pr-opened",
|
|
258
|
-
REVIEW_ROUND: "review-round",
|
|
259
|
-
// The end-of-run retrospective's result, recorded when the run marks the retrospective done
|
|
260
|
-
// (joshuafolkken/kit#2342). A retrospective that files zero improvements and one that never ran look
|
|
261
|
-
// the same from outside — no new Issue either way — so the result is put on the stream the report is
|
|
262
|
-
// generated from: the issues filed (or that none were), and the candidates dropped with why. It is
|
|
263
|
-
// emitted from the `run:carry --retrospective` close, so marking the retrospective done and recording
|
|
264
|
-
// what it found are one action rather than two the run could do only one of.
|
|
265
|
-
RETROSPECTIVE: "retrospective",
|
|
266
|
-
// Ready backlog work is sitting undispatched while a lane is free and nothing has dispatched for a
|
|
267
|
-
// while (joshuafolkken/kit#2359). Emitted once per stall episode by the stop-time detector, it is
|
|
268
|
-
// both the dedup marker — `emit_once_since` refuses a second until a `CHILD_LAUNCH` intervenes
|
|
269
|
-
// (joshuafolkken/kit#2464) — and the line a
|
|
270
|
-
// terminal reader following the stream sees. `run:step` reads it as `backlog:next`, so a run that
|
|
271
|
-
// stalled is pointed straight at dispatching the work rather than left waiting.
|
|
272
|
-
STALL: "stall",
|
|
273
|
-
// The run's own driver is gone: the cut handed the budget off, the owner has died, and no supervisor
|
|
274
|
-
// is watching (joshuafolkken/kit#2375). Emitted once per strand episode by the stop-time detector,
|
|
275
|
-
// exactly as `STALL` is — the newest-event dedup keeps a run polled every stop from notifying more
|
|
276
|
-
// than once, and a terminal reader following the stream sees the line. The strand is the step before
|
|
277
|
-
// the stall: a stalled run still has a driver that could dispatch, a stranded one has none.
|
|
278
|
-
STRANDED: "stranded",
|
|
279
|
-
// One `josh ship` stage starting, succeeding or failing (joshuafolkken/kit#2426). It is a trace of the
|
|
280
|
-
// composite's progress rather than a position the run is at — the positions a ship leaves behind are
|
|
281
|
-
// the closed issue its `followup` merges, or a detached supervisor's `SHIP_LAUNCH` / `SHIP_STOP` below
|
|
282
|
-
// — so it is one of the `TRACE_KINDS` the last-event read skips.
|
|
283
|
-
SHIP_STAGE: "ship-stage",
|
|
284
|
-
// One progress watcher line — the `at … / next …` heartbeat `run:progress` prints
|
|
285
|
-
// (joshuafolkken/kit#2437). Printed only to the watcher's own output, a headless successor's heartbeat
|
|
286
|
-
// was buried in its log after a cut; on the stream it reaches the attached session's relay. It says
|
|
287
|
-
// the run is alive rather than where it is, so it is a trace kind like `SHIP_STAGE`.
|
|
288
|
-
HEARTBEAT: "heartbeat",
|
|
289
|
-
// The post-implementation region handed to a detached `josh ship --detach` supervisor
|
|
290
|
-
// (joshuafolkken/kit#2428). Unlike a stage trace it is a position: the agent has ended and the
|
|
291
|
-
// supervisor carries the run, so `run:step` answers `wait` until it stops or the issue closes.
|
|
292
|
-
SHIP_LAUNCH: "ship-launch",
|
|
293
|
-
// The supervisor stopped at a failed stage — a red gate, a High/Medium review, a failed push, red CI
|
|
294
|
-
// (joshuafolkken/kit#2428). The position that hands control back: `run:step` prints the command that
|
|
295
|
-
// shows the stopped report, so the agent fixes it and relaunches rather than rebuilding the context.
|
|
296
|
-
SHIP_STOP: "ship-stop"
|
|
297
|
-
};
|
|
298
|
-
var EVENT_KINDS = Object.values(EVENT_KIND);
|
|
299
|
-
var TRACE_KINDS = /* @__PURE__ */ new Set([EVENT_KIND.SHIP_STAGE, EVENT_KIND.HEARTBEAT]);
|
|
300
|
-
var event_schema = z.object({
|
|
301
|
-
pos: z.number(),
|
|
302
|
-
at: z.string(),
|
|
303
|
-
kind: z.string(),
|
|
304
|
-
text: z.string()
|
|
305
|
-
});
|
|
306
|
-
function is_event_kind(value) {
|
|
307
|
-
return EVENT_KINDS.includes(value);
|
|
308
|
-
}
|
|
309
|
-
function target_of(repository) {
|
|
310
|
-
return stamp_file.stamp_path(EVENT_PREFIX, repository, EVENT_SUFFIX);
|
|
311
|
-
}
|
|
312
|
-
function is_present(event) {
|
|
313
|
-
return event !== void 0;
|
|
314
|
-
}
|
|
315
|
-
function parse_line(line) {
|
|
316
|
-
return event_schema.safeParse(json_value.parse_or_undefined(line)).data;
|
|
317
|
-
}
|
|
318
|
-
function read_events(target) {
|
|
319
|
-
const raw = stamp_file.read_stamp_text(target);
|
|
320
|
-
if (raw === void 0) return [];
|
|
321
|
-
return raw.split(LINE_SEPARATOR).map((line) => line.trim()).filter((line) => line.length > 0).map((line) => parse_line(line)).filter(is_present);
|
|
322
|
-
}
|
|
323
|
-
function last_position(events) {
|
|
324
|
-
return events[events.length - POSITION_INCREMENT]?.pos ?? FIRST_POSITION;
|
|
325
|
-
}
|
|
326
|
-
function serialize(events) {
|
|
327
|
-
return `${events.map((event) => JSON.stringify(event)).join(LINE_SEPARATOR)}${LINE_SEPARATOR}`;
|
|
328
|
-
}
|
|
329
|
-
function append(target, kind, text2, at) {
|
|
330
|
-
if (!is_event_kind(kind)) return { appended: false, position: FIRST_POSITION };
|
|
331
|
-
const existing = read_events(target);
|
|
332
|
-
const position = last_position(existing) + POSITION_INCREMENT;
|
|
333
|
-
const bounded = [...existing, { pos: position, at, kind, text: text2 }].slice(-EVENT_CAP);
|
|
334
|
-
stamp_file.write_text_stamp(target, serialize(bounded));
|
|
335
|
-
return { appended: true, position };
|
|
336
|
-
}
|
|
337
|
-
function read_from(target, position) {
|
|
338
|
-
const events = read_events(target);
|
|
339
|
-
return {
|
|
340
|
-
events: events.filter((event) => event.pos > position),
|
|
341
|
-
next_position: last_position(events)
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
function read_last(target) {
|
|
345
|
-
return read_events(target).findLast((event) => !TRACE_KINDS.has(event.kind));
|
|
346
|
-
}
|
|
347
|
-
function has_since(events, kind, reset_kind) {
|
|
348
|
-
const reset_at = events.findLastIndex((event) => event.kind === reset_kind);
|
|
349
|
-
return events.slice(reset_at + POSITION_INCREMENT).some((event) => event.kind === kind);
|
|
350
|
-
}
|
|
351
|
-
var FIELD_SEPARATOR = " \xB7 ";
|
|
352
|
-
function format_event(event) {
|
|
353
|
-
return [event.at, event.kind, event.text].join(FIELD_SEPARATOR);
|
|
354
|
-
}
|
|
355
|
-
var run_event_stream = {
|
|
356
|
-
EVENT_CAP,
|
|
357
|
-
EVENT_KIND,
|
|
358
|
-
EVENT_KINDS,
|
|
359
|
-
EVENT_PREFIX,
|
|
360
|
-
EVENT_SUFFIX,
|
|
361
|
-
TRACE_KINDS,
|
|
362
|
-
append,
|
|
363
|
-
format_event,
|
|
364
|
-
has_since,
|
|
365
|
-
is_event_kind,
|
|
366
|
-
read_events,
|
|
367
|
-
read_from,
|
|
368
|
-
read_last,
|
|
369
|
-
target_of
|
|
370
|
-
};
|
|
371
|
-
|
|
372
263
|
// scripts/backlog/backlog-stalled.ts
|
|
373
264
|
var STALL_THRESHOLD_MINUTES = 10;
|
|
374
265
|
var MS_PER_MINUTE = 6e4;
|
|
@@ -420,7 +311,6 @@ var backlog_stalled = {
|
|
|
420
311
|
count_ready_tokens,
|
|
421
312
|
describe,
|
|
422
313
|
dispatch_age_ms,
|
|
423
|
-
is_stalled,
|
|
424
314
|
needs_triage,
|
|
425
315
|
ready_tokens
|
|
426
316
|
};
|
|
@@ -428,12 +318,20 @@ var backlog_stalled = {
|
|
|
428
318
|
// scripts/backlog/backlog-ready.ts
|
|
429
319
|
var NO_FREE = 0;
|
|
430
320
|
var NONE2 = 0;
|
|
321
|
+
async function free_under(limit) {
|
|
322
|
+
const lanes = await lane_registry.list_lanes();
|
|
323
|
+
const live = lanes.filter((lane) => !lane.is_stranded).length;
|
|
324
|
+
return lane_capacity.free_lanes(limit, live);
|
|
325
|
+
}
|
|
431
326
|
async function free_lane_count() {
|
|
432
327
|
const limit = lane_capacity.lane_limit();
|
|
433
328
|
if (limit.kind !== "limit") return NO_FREE;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
329
|
+
return await free_under(limit.limit);
|
|
330
|
+
}
|
|
331
|
+
async function drive_free_lane_count() {
|
|
332
|
+
const limit = lane_capacity.lane_limit();
|
|
333
|
+
if (limit.kind !== "limit") throw new Error(limit.problem);
|
|
334
|
+
return await free_under(limit.limit);
|
|
437
335
|
}
|
|
438
336
|
function drains_pool(carry) {
|
|
439
337
|
return carry === void 0 || !run_invocation.has_only(carry.invocation);
|
|
@@ -452,19 +350,23 @@ async function read_ready(ports = DEFAULT_PORTS) {
|
|
|
452
350
|
if (free_lanes2 <= NO_FREE) return { issues: [], free_lanes: free_lanes2 };
|
|
453
351
|
return { issues: await ports.ready_issues(), free_lanes: free_lanes2 };
|
|
454
352
|
}
|
|
455
|
-
function ready_line(reading) {
|
|
353
|
+
function ready_line(reading, slug) {
|
|
456
354
|
if (reading.issues.length === NONE2 || reading.free_lanes <= NO_FREE) return void 0;
|
|
457
|
-
const
|
|
355
|
+
const cite = issue_cite.citer(slug, /* @__PURE__ */ new Map());
|
|
356
|
+
const issues = reading.issues.map((issue) => cite(issue)).join(" ");
|
|
458
357
|
return `ready ${issues} \xB7 free lanes ${String(reading.free_lanes)}`;
|
|
459
358
|
}
|
|
460
|
-
async function parent_ready_line(ports, is_parent) {
|
|
359
|
+
async function parent_ready_line(ports, is_parent, read_repo) {
|
|
461
360
|
if (!await is_parent()) return void 0;
|
|
462
|
-
|
|
361
|
+
const reading = await read_ready(ports);
|
|
362
|
+
return reading.issues.length === NONE2 ? void 0 : ready_line(reading, await read_repo());
|
|
463
363
|
}
|
|
464
|
-
|
|
364
|
+
function print_line(line) {
|
|
365
|
+
if (line !== void 0) console.info(line);
|
|
366
|
+
}
|
|
367
|
+
async function print_ready_line(ports = DEFAULT_PORTS, is_parent = run_headless.is_backlog_parent, read_repo = git_gh_command.repo_get_name_with_owner) {
|
|
465
368
|
try {
|
|
466
|
-
|
|
467
|
-
if (line !== void 0) console.info(line);
|
|
369
|
+
print_line(await parent_ready_line(ports, is_parent, read_repo));
|
|
468
370
|
} catch {
|
|
469
371
|
}
|
|
470
372
|
}
|
|
@@ -481,6 +383,7 @@ var backlog_ready = {
|
|
|
481
383
|
read_backlog_next,
|
|
482
384
|
print_offer_hint,
|
|
483
385
|
free_lane_count,
|
|
386
|
+
drive_free_lane_count,
|
|
484
387
|
drains_pool,
|
|
485
388
|
print_ready_line,
|
|
486
389
|
read_ready,
|
|
@@ -508,12 +411,17 @@ function get_repo_name_with_owner_within(timeout_ms) {
|
|
|
508
411
|
}
|
|
509
412
|
var gh_spawn = { get_repo_name_with_owner, get_repo_name_with_owner_within };
|
|
510
413
|
|
|
511
|
-
// scripts/
|
|
512
|
-
|
|
414
|
+
// scripts/lib/timed-fetch.ts
|
|
415
|
+
async function timed_fetch(url, init = {}, timeout_ms = FETCH_TIMEOUT_MS) {
|
|
416
|
+
return await fetch(url, { ...init, signal: AbortSignal.timeout(timeout_ms) });
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// scripts/notify/telegram-notify.ts
|
|
420
|
+
import { z } from "zod";
|
|
513
421
|
var TELEGRAM_API_BASE = "https://api.telegram.org";
|
|
514
|
-
var telegram_environment_schema =
|
|
515
|
-
telegram_bot_token:
|
|
516
|
-
telegram_chat_id:
|
|
422
|
+
var telegram_environment_schema = z.object({
|
|
423
|
+
telegram_bot_token: z.string().min(1, { message: "TELEGRAM_BOT_TOKEN is required" }),
|
|
424
|
+
telegram_chat_id: z.string().min(1, { message: "TELEGRAM_CHAT_ID is required" })
|
|
517
425
|
});
|
|
518
426
|
var TASK_DEFINITIONS = {
|
|
519
427
|
planning: { icon: "\u{1F4CB}", label: "Planning" },
|
|
@@ -599,7 +507,7 @@ function build_text(input) {
|
|
|
599
507
|
}
|
|
600
508
|
async function post_message(config, text2) {
|
|
601
509
|
const url = `${TELEGRAM_API_BASE}/bot${config.bot_token}/sendMessage`;
|
|
602
|
-
const response = await
|
|
510
|
+
const response = await timed_fetch(url, {
|
|
603
511
|
method: "POST",
|
|
604
512
|
headers: { "Content-Type": "application/json" },
|
|
605
513
|
body: JSON.stringify({ chat_id: config.chat_id, text: text2 })
|
|
@@ -698,7 +606,6 @@ async function stranded(input) {
|
|
|
698
606
|
);
|
|
699
607
|
}
|
|
700
608
|
var telegram_notify = {
|
|
701
|
-
REPO_LOOKUP_TIMEOUT_MS,
|
|
702
609
|
confirm,
|
|
703
610
|
send,
|
|
704
611
|
send_or_report,
|
|
@@ -707,125 +614,6 @@ var telegram_notify = {
|
|
|
707
614
|
warn
|
|
708
615
|
};
|
|
709
616
|
|
|
710
|
-
// scripts/run/run-event-scope.ts
|
|
711
|
-
var SINCE_SCOPE = "since";
|
|
712
|
-
var UNKNOWN_SCOPE = "unknown";
|
|
713
|
-
var UNKNOWN_EVENT_SCOPE = { kind: UNKNOWN_SCOPE };
|
|
714
|
-
function moment_of(at) {
|
|
715
|
-
const parsed = Date.parse(at);
|
|
716
|
-
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
717
|
-
}
|
|
718
|
-
function is_within(event, floor) {
|
|
719
|
-
const at = moment_of(event.at);
|
|
720
|
-
return at !== void 0 && at >= floor;
|
|
721
|
-
}
|
|
722
|
-
function scoped_events(events, scope) {
|
|
723
|
-
if (scope.kind === UNKNOWN_SCOPE) return void 0;
|
|
724
|
-
const floor = moment_of(scope.started_at);
|
|
725
|
-
if (floor === void 0) return void 0;
|
|
726
|
-
return events.filter((event) => is_within(event, floor));
|
|
727
|
-
}
|
|
728
|
-
function scope_of(read) {
|
|
729
|
-
if (read.kind === "carried" || read.kind === "expired") {
|
|
730
|
-
return { kind: SINCE_SCOPE, started_at: read.carry.started_at };
|
|
731
|
-
}
|
|
732
|
-
return UNKNOWN_EVENT_SCOPE;
|
|
733
|
-
}
|
|
734
|
-
function last_scoped_event(events, scope) {
|
|
735
|
-
return scoped_events(events, scope)?.findLast(
|
|
736
|
-
(event) => !run_event_stream.TRACE_KINDS.has(event.kind)
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
var SHIP_POSITION_KINDS = /* @__PURE__ */ new Set([
|
|
740
|
-
run_event_stream.EVENT_KIND.SHIP_LAUNCH,
|
|
741
|
-
run_event_stream.EVENT_KIND.SHIP_STOP
|
|
742
|
-
]);
|
|
743
|
-
function is_foreign_ship_event(event, issue) {
|
|
744
|
-
return SHIP_POSITION_KINDS.has(event.kind) && !event.text.startsWith(`#${issue} `);
|
|
745
|
-
}
|
|
746
|
-
function is_own_ship_event(event, issue) {
|
|
747
|
-
return SHIP_POSITION_KINDS.has(event.kind) && !is_foreign_ship_event(event, issue);
|
|
748
|
-
}
|
|
749
|
-
function last_issue_event(events, scope, issue) {
|
|
750
|
-
const own = events.filter((event) => !is_foreign_ship_event(event, issue));
|
|
751
|
-
if (scope.kind === SINCE_SCOPE) return last_scoped_event(own, scope);
|
|
752
|
-
return own.findLast((event) => is_own_ship_event(event, issue));
|
|
753
|
-
}
|
|
754
|
-
var run_event_scope = {
|
|
755
|
-
UNKNOWN_EVENT_SCOPE,
|
|
756
|
-
last_issue_event,
|
|
757
|
-
last_scoped_event,
|
|
758
|
-
scope_of,
|
|
759
|
-
scoped_events
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
// scripts/run/run-event-stream-emit.ts
|
|
763
|
-
function now_iso() {
|
|
764
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
765
|
-
}
|
|
766
|
-
async function stream_target() {
|
|
767
|
-
const repository = await run_carry.repository_directory();
|
|
768
|
-
return repository === void 0 ? void 0 : run_event_stream.target_of(repository);
|
|
769
|
-
}
|
|
770
|
-
async function emit(kind, text2) {
|
|
771
|
-
try {
|
|
772
|
-
const target = await stream_target();
|
|
773
|
-
if (target === void 0) return;
|
|
774
|
-
run_event_stream.append(target, kind, text2, now_iso());
|
|
775
|
-
} catch {
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
async function emit_once(kind, text2) {
|
|
779
|
-
try {
|
|
780
|
-
const target = await stream_target();
|
|
781
|
-
if (target === void 0 || run_event_stream.read_last(target)?.kind === kind) return false;
|
|
782
|
-
return run_event_stream.append(target, kind, text2, now_iso()).appended;
|
|
783
|
-
} catch {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function invocation_events(repository, target) {
|
|
788
|
-
const events = run_event_stream.read_events(target);
|
|
789
|
-
const scope = run_event_scope.scope_of(run_carry.read_carry(run_carry.carry_path(repository)));
|
|
790
|
-
return run_event_scope.scoped_events(events, scope) ?? events;
|
|
791
|
-
}
|
|
792
|
-
async function emit_once_since(kind, text2, reset_kind) {
|
|
793
|
-
try {
|
|
794
|
-
const repository = await run_carry.repository_directory();
|
|
795
|
-
if (repository === void 0) return false;
|
|
796
|
-
const target = run_event_stream.target_of(repository);
|
|
797
|
-
if (run_event_stream.has_since(invocation_events(repository, target), kind, reset_kind)) {
|
|
798
|
-
return false;
|
|
799
|
-
}
|
|
800
|
-
return run_event_stream.append(target, kind, text2, now_iso()).appended;
|
|
801
|
-
} catch {
|
|
802
|
-
return false;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
async function emit_heartbeat(line) {
|
|
806
|
-
await emit(run_event_stream.EVENT_KIND.HEARTBEAT, line);
|
|
807
|
-
}
|
|
808
|
-
async function current_events() {
|
|
809
|
-
try {
|
|
810
|
-
const repository = await run_carry.repository_directory();
|
|
811
|
-
if (repository === void 0) return [];
|
|
812
|
-
const read = run_carry.read_carry(run_carry.carry_path(repository));
|
|
813
|
-
const scope = run_event_scope.scope_of(read);
|
|
814
|
-
const events = run_event_stream.read_events(run_event_stream.target_of(repository));
|
|
815
|
-
return run_event_scope.scoped_events(events, scope) ?? [];
|
|
816
|
-
} catch {
|
|
817
|
-
return [];
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
var run_event_stream_emit = {
|
|
821
|
-
current_events,
|
|
822
|
-
emit,
|
|
823
|
-
emit_heartbeat,
|
|
824
|
-
emit_once,
|
|
825
|
-
emit_once_since,
|
|
826
|
-
stream_target
|
|
827
|
-
};
|
|
828
|
-
|
|
829
617
|
// scripts/backlog/backlog-stalled-detect.ts
|
|
830
618
|
var NO_FREE2 = 0;
|
|
831
619
|
var NO_READY = 0;
|
|
@@ -888,23 +676,24 @@ async function run_stall_check(ready = backlog_ready.DEFAULT_PORTS) {
|
|
|
888
676
|
} catch {
|
|
889
677
|
}
|
|
890
678
|
}
|
|
891
|
-
var backlog_stalled_detect = {
|
|
679
|
+
var backlog_stalled_detect = { detect_and_report, run_stall_check };
|
|
892
680
|
|
|
893
681
|
// scripts/rules/last-prompt.ts
|
|
894
|
-
import { z as
|
|
682
|
+
import { z as z2 } from "zod";
|
|
895
683
|
var WORKFLOW_KEYWORDS = /* @__PURE__ */ new Set([
|
|
896
684
|
"kickoff",
|
|
897
685
|
"fullrun",
|
|
898
686
|
"halfrun",
|
|
687
|
+
"prrun",
|
|
899
688
|
"backlogrun"
|
|
900
689
|
]);
|
|
901
690
|
var NO_PROMPT = "";
|
|
902
691
|
var HUMAN_ORIGIN = "human";
|
|
903
692
|
var KEYWORD_BEFORE_ARGUMENT = -2;
|
|
904
|
-
var PROMPT_LINE_SCHEMA =
|
|
905
|
-
isMeta:
|
|
906
|
-
origin:
|
|
907
|
-
message:
|
|
693
|
+
var PROMPT_LINE_SCHEMA = z2.object({
|
|
694
|
+
isMeta: z2.boolean().nullish(),
|
|
695
|
+
origin: z2.object({ kind: z2.string().nullish() }).nullish(),
|
|
696
|
+
message: z2.object({ content: z2.unknown() })
|
|
908
697
|
});
|
|
909
698
|
function is_person(line) {
|
|
910
699
|
if (line.isMeta === true) return false;
|
|
@@ -931,7 +720,7 @@ function prompt_text(tail) {
|
|
|
931
720
|
var last_prompt = { prompt_text };
|
|
932
721
|
|
|
933
722
|
// scripts/rules/stop-rules.ts
|
|
934
|
-
import { z as
|
|
723
|
+
import { z as z3 } from "zod";
|
|
935
724
|
|
|
936
725
|
// scripts/rules/filing-offer.ts
|
|
937
726
|
var OFFER_PATTERNS = [
|
|
@@ -1034,19 +823,19 @@ function is_mismatch(message2, lang) {
|
|
|
1034
823
|
if (letter_count(prose) < MIN_PROSE_LETTERS) return false;
|
|
1035
824
|
return matches_share(prose, script, pattern) < MATCH_SHARE_FLOOR;
|
|
1036
825
|
}
|
|
1037
|
-
var reply_language = {
|
|
826
|
+
var reply_language = { is_mismatch, script_of };
|
|
1038
827
|
|
|
1039
828
|
// scripts/rules/stop-rules.ts
|
|
1040
829
|
var SWITCH_ENV_KEY = "JOSH_STOP_GUARD";
|
|
1041
830
|
var BLOCK_DECISION = "block";
|
|
1042
|
-
var stop_payload_schema =
|
|
1043
|
-
transcript_path:
|
|
1044
|
-
stop_hook_active:
|
|
1045
|
-
last_assistant_message:
|
|
831
|
+
var stop_payload_schema = z3.object({
|
|
832
|
+
transcript_path: z3.string().min(1),
|
|
833
|
+
stop_hook_active: z3.boolean().nullish(),
|
|
834
|
+
last_assistant_message: z3.string().nullish()
|
|
1046
835
|
});
|
|
1047
836
|
var NO_OUTCOME = { reason: void 0 };
|
|
1048
837
|
var STOP_NOTIFY_REASON = '\u26D4 mid-workflow stop notification: this working tree is still held by a run and no `confirmation` Telegram was sent this turn, so a person is being left to wait off-screen without knowing the run paused. `CLAUDE.md` \u2192 "Mid-workflow stop notification" requires `pnpm josh notify --task-type confirmation --issue-url "<url>" --body=$\'<reason>\'` before any mid-workflow pause. Send it, then end with a one-line confirmation that it was sent \u2014 do not repeat your previous reply. This fires only while the hold is held and no notify is on the transcript, and `stop_hook_active` lets a second stop through so a run is never wedged.';
|
|
1049
|
-
var HOLD_RELEASE_REASON = "\u26D4 working-tree hold not released: this working tree is clean but its `run:hold` record is still in place, so the next run here runs `git switch main && git pull` believing the tree is free while you hold it. `.claude/skills/workflow-commands/SKILL.md` \u2192 \xA72f: a stop that leaves the tree clean releases the hold with `pnpm josh run:release <N>` (bare for a `new` entry). A `halfrun` pre-commit stop and a `needs-human-review` stop keep the hold because their tree is dirty \u2014 this row is silent there. Release it, then end with a one-line confirmation that it was released \u2014 do not repeat your previous reply.";
|
|
838
|
+
var HOLD_RELEASE_REASON = "\u26D4 working-tree hold not released: this working tree is clean but its `run:hold` record is still in place, so the next run here runs `git switch main && git pull` believing the tree is free while you hold it. `.claude/skills/workflow-commands/SKILL.md` \u2192 \xA72f: a stop that leaves the tree clean releases the hold with `pnpm josh run:release <N>` (bare for a `new` entry). A `halfrun` pre-commit stop and a `needs-human-review` stop keep the hold because their tree is dirty, and a `prrun` stop keeps it by its stop mark \u2014 this row is silent there. Release it, then end with a one-line confirmation that it was released \u2014 do not repeat your previous reply.";
|
|
1050
839
|
var ISSUE_CITATION_REASON = "Session-facing output cites an Issue as a number-link so the reader can click through and see which repository it is (`CLAUDE.md`, `prompts/collaboration-workflow/issue-citation.md`).";
|
|
1051
840
|
function build_citation_reason(references) {
|
|
1052
841
|
const numbers = references.join(", ");
|
|
@@ -1056,8 +845,8 @@ function build_citation_reason(references) {
|
|
|
1056
845
|
var FILING_OFFER_REASON = '\u26D4 filing offer: your reply offers to file an Issue instead of filing it. Filing into a first-party repository is Tier A \u2014 the trigger is the judgement that it is worth filing, not the run\'s progress (`.claude/skills/workflow-commands/SKILL.md` \u2192 \xA72i, `observation-filing.md`). Run `pnpm josh issue:file "<title>" --body-file <path> --depth <0|1|2>` \u2014 it scouts, lints, labels and runs `epic:bundle` itself \u2014 then end with the one-line citation of what was filed; do not repeat your previous reply. If it is not worth filing after all, say so in one line instead.';
|
|
1057
846
|
var HEADLESS_WAIT_MARKER = "\u26D4 headless parent:";
|
|
1058
847
|
var HEADLESS_REFUSAL_CAP = 3;
|
|
1059
|
-
var HEADLESS_WAIT_CALLS = ['"command":"pnpm josh lane:await'
|
|
1060
|
-
var HEADLESS_WAIT_BODY = ' this is a `claude -p` `backlogrun` parent (`JOSH_RUN_HEADLESS`) with lanes still in flight, and ending this turn ends the process \u2014 its background waits are killed with it and the lanes are left without a parent. Wait in the foreground instead: run `pnpm josh lane:await <N...>` for the in-flight lanes (
|
|
848
|
+
var HEADLESS_WAIT_CALLS = ['"command":"pnpm josh lane:await'];
|
|
849
|
+
var HEADLESS_WAIT_BODY = ' this is a `claude -p` `backlogrun` parent (`JOSH_RUN_HEADLESS`) with lanes still in flight, and ending this turn ends the process \u2014 its background waits are killed with it and the lanes are left without a parent. Wait in the foreground instead: run `pnpm josh lane:await <N...>` for the in-flight lanes as a foreground command within the tool timeout (with `pnpm josh run:progress --wait` in the background for the heartbeat, which streams its reports itself and lives while this turn does), act on what it reports, and continue the loop. End the turn only after `pnpm josh run:carry --cut` or `--end` (`backlogrun-progress.md` \u2192 "The parent keeps no clock of its own").';
|
|
1061
850
|
var HEADLESS_WAIT_REASON = `${HEADLESS_WAIT_MARKER}${HEADLESS_WAIT_BODY}`;
|
|
1062
851
|
var INDEX_COMMAND_PATTERN = /git (?:add|stage|rm --cached|restore --staged|restore -S)\b/u;
|
|
1063
852
|
var PERMISSION_PATTERN = /許可|承認|permission|approve|approval|authorization/iu;
|
|
@@ -1083,13 +872,13 @@ function needs_filing(context) {
|
|
|
1083
872
|
return filing_offer.is_first_party_target(context.message, context.session_owner);
|
|
1084
873
|
}
|
|
1085
874
|
function is_held_idle(context) {
|
|
1086
|
-
return context.hold_present && !context.agent_pending;
|
|
875
|
+
return context.hold_present && !context.agent_pending && !context.handed_off;
|
|
1087
876
|
}
|
|
1088
877
|
function needs_notify(context) {
|
|
1089
878
|
return is_held_idle(context) && !context.notified;
|
|
1090
879
|
}
|
|
1091
880
|
function needs_release(context) {
|
|
1092
|
-
return is_held_idle(context) && context.tree_clean;
|
|
881
|
+
return is_held_idle(context) && context.tree_clean && !context.prrun_stopped;
|
|
1093
882
|
}
|
|
1094
883
|
function citation_reason(context) {
|
|
1095
884
|
const references = issue_citation.unquoted_references(context.message, context.prompt);
|
|
@@ -1147,7 +936,6 @@ var stop_rules = {
|
|
|
1147
936
|
STOP_NOTIFY_REASON,
|
|
1148
937
|
SWITCH_ENV_KEY,
|
|
1149
938
|
block_envelope,
|
|
1150
|
-
block_reason,
|
|
1151
939
|
build_language_reason,
|
|
1152
940
|
count_headless_refusals,
|
|
1153
941
|
is_enabled,
|
|
@@ -1155,6 +943,67 @@ var stop_rules = {
|
|
|
1155
943
|
stop_outcome
|
|
1156
944
|
};
|
|
1157
945
|
|
|
946
|
+
// scripts/run/run-halfrun-resume.ts
|
|
947
|
+
var MARKED = "marked";
|
|
948
|
+
var FOREIGN = "foreign";
|
|
949
|
+
var UNREADABLE2 = "unreadable";
|
|
950
|
+
function hold_of(read) {
|
|
951
|
+
return read.kind === "held" || read.kind === "stale" ? read.hold : void 0;
|
|
952
|
+
}
|
|
953
|
+
function is_halfrun_stop(read, issue, is_dirty) {
|
|
954
|
+
const hold = hold_of(read);
|
|
955
|
+
return is_dirty && hold?.issue === issue && hold.is_halfrun_stop === true;
|
|
956
|
+
}
|
|
957
|
+
function is_own_record(read, issue) {
|
|
958
|
+
const hold = hold_of(read);
|
|
959
|
+
return hold === void 0 || hold.issue === issue || hold.issue === run_hold.UNNUMBERED_ISSUE;
|
|
960
|
+
}
|
|
961
|
+
function mark_stop_at(target, issue, mark = run_hold.HALFRUN_STOP_FIELDS) {
|
|
962
|
+
const read = run_hold.read_hold(target);
|
|
963
|
+
if (read.kind === "unreadable") return UNREADABLE2;
|
|
964
|
+
if (!is_own_record(read, issue)) return FOREIGN;
|
|
965
|
+
run_hold.release_hold(target);
|
|
966
|
+
return run_hold.create_stop_hold(target, issue, mark) ? MARKED : FOREIGN;
|
|
967
|
+
}
|
|
968
|
+
function take_over(target, issue) {
|
|
969
|
+
run_hold.release_hold(target);
|
|
970
|
+
return run_hold.create_hold(target, issue, /* @__PURE__ */ new Date(), true);
|
|
971
|
+
}
|
|
972
|
+
function adopt_at(target, issue, is_dirty) {
|
|
973
|
+
if (!is_halfrun_stop(run_hold.read_hold(target), issue, is_dirty)) return false;
|
|
974
|
+
return take_over(target, issue);
|
|
975
|
+
}
|
|
976
|
+
async function hold_target() {
|
|
977
|
+
try {
|
|
978
|
+
const directory = await run_hold.worktree_directory();
|
|
979
|
+
return directory === void 0 ? void 0 : run_hold.hold_path(directory);
|
|
980
|
+
} catch {
|
|
981
|
+
return void 0;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
async function is_pending(issue) {
|
|
985
|
+
const target = await hold_target();
|
|
986
|
+
if (target === void 0) return false;
|
|
987
|
+
return is_halfrun_stop(run_hold.read_hold(target), issue, await run_hold.is_tree_dirty());
|
|
988
|
+
}
|
|
989
|
+
async function adopt(issue) {
|
|
990
|
+
const target = await hold_target();
|
|
991
|
+
if (target === void 0) return false;
|
|
992
|
+
return adopt_at(target, issue, await run_hold.is_tree_dirty());
|
|
993
|
+
}
|
|
994
|
+
var run_halfrun_resume = {
|
|
995
|
+
FOREIGN,
|
|
996
|
+
MARKED,
|
|
997
|
+
UNREADABLE: UNREADABLE2,
|
|
998
|
+
adopt,
|
|
999
|
+
adopt_at,
|
|
1000
|
+
hold_of,
|
|
1001
|
+
hold_target,
|
|
1002
|
+
is_pending,
|
|
1003
|
+
mark_stop_at,
|
|
1004
|
+
take_over
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1158
1007
|
// scripts/run/run-stranded.ts
|
|
1159
1008
|
var RECOVERY_COMMAND = "pnpm josh run:wake --start";
|
|
1160
1009
|
var LIVE = "live";
|
|
@@ -1194,7 +1043,7 @@ var run_stranded = {
|
|
|
1194
1043
|
};
|
|
1195
1044
|
|
|
1196
1045
|
// scripts/run/run-wake.ts
|
|
1197
|
-
import { z as
|
|
1046
|
+
import { z as z4 } from "zod";
|
|
1198
1047
|
var WAKE_PREFIX = "josh-run-wake-";
|
|
1199
1048
|
var WAKE_LOG_PREFIX = "josh-run-wake-log-";
|
|
1200
1049
|
var WAKE_LOG_SUFFIX = ".log";
|
|
@@ -1214,21 +1063,19 @@ var STOP_REASONS = {
|
|
|
1214
1063
|
expired: "expired",
|
|
1215
1064
|
unreadable: "unreadable"
|
|
1216
1065
|
};
|
|
1217
|
-
var run_wake_schema =
|
|
1218
|
-
invocation:
|
|
1219
|
-
started_at:
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
woke: z5.number(),
|
|
1223
|
-
woke_at: z5.string().optional(),
|
|
1066
|
+
var run_wake_schema = process_owner_schema.extend({
|
|
1067
|
+
invocation: z4.string(),
|
|
1068
|
+
started_at: z4.string(),
|
|
1069
|
+
woke: z4.number(),
|
|
1070
|
+
woke_at: z4.string().optional(),
|
|
1224
1071
|
// **Every optional field of `RunWake` has to be listed here.** `z.object` strips what it does not
|
|
1225
1072
|
// declare, so a field added to the interface alone round-trips through disk as `undefined` — which
|
|
1226
1073
|
// reads as "no attempt has been made yet" and would restart the retry count on every pass.
|
|
1227
|
-
attempts:
|
|
1228
|
-
woke_pid:
|
|
1229
|
-
held_at:
|
|
1230
|
-
spawned:
|
|
1231
|
-
idle_since:
|
|
1074
|
+
attempts: z4.number().optional(),
|
|
1075
|
+
woke_pid: z4.number().optional(),
|
|
1076
|
+
held_at: z4.string().optional(),
|
|
1077
|
+
spawned: z4.array(z4.string()).optional(),
|
|
1078
|
+
idle_since: z4.string().optional(),
|
|
1232
1079
|
profile: agent_role_profile.PROFILE_SCHEMA.optional()
|
|
1233
1080
|
});
|
|
1234
1081
|
function is_overdue(marked_at, now, limit_ms = WAKE_GRACE_MS) {
|
|
@@ -1380,7 +1227,6 @@ var run_wake = {
|
|
|
1380
1227
|
IDLE_CEILING_MS,
|
|
1381
1228
|
MAX_WAKE_ATTEMPTS,
|
|
1382
1229
|
WAKE_GRACE_MS,
|
|
1383
|
-
WAKE_PREFIX,
|
|
1384
1230
|
claim,
|
|
1385
1231
|
count_claim,
|
|
1386
1232
|
count_wake,
|
|
@@ -1451,14 +1297,13 @@ async function run_stranded_check() {
|
|
|
1451
1297
|
} catch {
|
|
1452
1298
|
}
|
|
1453
1299
|
}
|
|
1454
|
-
var run_stranded_detect = {
|
|
1300
|
+
var run_stranded_detect = { detect_and_report: detect_and_report2, run_stranded_check };
|
|
1455
1301
|
|
|
1456
1302
|
// scripts/hooks/stop-guard.ts
|
|
1457
|
-
async function
|
|
1303
|
+
async function hold_facts() {
|
|
1458
1304
|
const directory = await run_hold.worktree_directory();
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
return read.kind === "held" || read.kind === "stale";
|
|
1305
|
+
const hold = directory === void 0 ? void 0 : run_halfrun_resume.hold_of(run_hold.read_hold(run_hold.hold_path(directory)));
|
|
1306
|
+
return { hold_present: hold !== void 0, prrun_stopped: hold?.prrun_stop_head !== void 0 };
|
|
1462
1307
|
}
|
|
1463
1308
|
function transcript_tail(transcript_path) {
|
|
1464
1309
|
const transcript = time_hook_transcript.transcript_of(transcript_path, void 0);
|
|
@@ -1473,7 +1318,7 @@ function session_lang() {
|
|
|
1473
1318
|
async function build_context(transcript_path, payload_tail) {
|
|
1474
1319
|
const tail = transcript_tail(transcript_path);
|
|
1475
1320
|
return {
|
|
1476
|
-
|
|
1321
|
+
...await hold_facts(),
|
|
1477
1322
|
tree_clean: !await run_hold.is_tree_dirty(),
|
|
1478
1323
|
notified: lane_park.mentions_confirmation_notify(tail),
|
|
1479
1324
|
message: payload_tail.message,
|
|
@@ -1487,6 +1332,7 @@ async function build_context(transcript_path, payload_tail) {
|
|
|
1487
1332
|
lane_child: lane_child_marker.is_child_of(process.cwd()),
|
|
1488
1333
|
background_pending: lane_background.pending_background_ids(tail).length > 0,
|
|
1489
1334
|
agent_pending: lane_background.pending_agent_ids(tail).length > 0,
|
|
1335
|
+
handed_off: lane_handoff.is_handed_off(process.cwd()),
|
|
1490
1336
|
session_lang: session_lang()
|
|
1491
1337
|
};
|
|
1492
1338
|
}
|
|
@@ -1506,10 +1352,23 @@ async function outcome_of(raw_payload) {
|
|
|
1506
1352
|
return stop_rules.NO_OUTCOME;
|
|
1507
1353
|
}
|
|
1508
1354
|
}
|
|
1509
|
-
async function
|
|
1510
|
-
|
|
1355
|
+
async function has_run_record() {
|
|
1356
|
+
try {
|
|
1357
|
+
const directory = await run_carry.repository_directory();
|
|
1358
|
+
if (directory === void 0) return false;
|
|
1359
|
+
return run_carry.read_carry(run_carry.carry_path(directory)).kind === "carried";
|
|
1360
|
+
} catch {
|
|
1361
|
+
return false;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
async function run_report_checks() {
|
|
1365
|
+
if (!await has_run_record()) return;
|
|
1511
1366
|
await backlog_stalled_detect.run_stall_check(backlog_ready.DEFAULT_PORTS);
|
|
1512
1367
|
await run_stranded_detect.run_stranded_check();
|
|
1368
|
+
}
|
|
1369
|
+
async function write_stop_decision(raw_payload) {
|
|
1370
|
+
hook_decision.load_environment_file();
|
|
1371
|
+
await run_report_checks();
|
|
1513
1372
|
const { reason } = await outcome_of(raw_payload);
|
|
1514
1373
|
if (reason === void 0) return;
|
|
1515
1374
|
process.stdout.write(`${stop_rules.block_envelope(reason, session_lang())}
|