@joshuafolkken/kit 1.1455.0 → 1.1514.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 +6 -6
- package/.claude/skills/dependency-update/SKILL.md +26 -55
- package/.claude/skills/epic-commands/SKILL.md +83 -156
- package/.claude/skills/epic-commands/epic-bundle.md +51 -79
- package/.claude/skills/epic-commands/execution-waves.md +43 -81
- package/.claude/skills/verify-ui/SKILL.md +24 -50
- package/.claude/skills/workflow-commands/SKILL.md +7 -9
- package/.claude/skills/workflow-commands/background-commands.md +31 -46
- package/.claude/skills/workflow-commands/backlogrun-child.md +65 -85
- package/.claude/skills/workflow-commands/backlogrun-lanes.md +86 -125
- package/.claude/skills/workflow-commands/backlogrun-park.md +68 -118
- package/.claude/skills/workflow-commands/backlogrun-progress.md +17 -28
- package/.claude/skills/workflow-commands/backlogrun-recovery.md +17 -26
- package/.claude/skills/workflow-commands/backlogrun-steps.md +35 -52
- package/.claude/skills/workflow-commands/backlogrun.md +31 -50
- package/.claude/skills/workflow-commands/chain-rule.md +31 -40
- package/.claude/skills/workflow-commands/delegation.md +12 -8
- package/.claude/skills/workflow-commands/entry-sequence.md +1 -3
- package/.claude/skills/workflow-commands/followup.md +55 -77
- package/.claude/skills/workflow-commands/fullrun-steps.md +3 -5
- package/.claude/skills/workflow-commands/fullrun.md +4 -6
- package/.claude/skills/workflow-commands/halfrun.md +3 -7
- package/.claude/skills/workflow-commands/into-target.md +1 -2
- package/.claude/skills/workflow-commands/issue-comments.md +43 -60
- package/.claude/skills/workflow-commands/issue-scout.md +3 -2
- package/.claude/skills/workflow-commands/kickoff.md +65 -74
- package/.claude/skills/workflow-commands/latest-gate.md +2 -6
- package/.claude/skills/workflow-commands/needs-human-review.md +2 -5
- package/.claude/skills/workflow-commands/observation-filing.md +59 -118
- package/.claude/skills/workflow-commands/observation-ledger.md +52 -112
- package/.claude/skills/workflow-commands/pre-gate-cut.md +88 -142
- package/.claude/skills/workflow-commands/prerequisite.md +11 -17
- package/.claude/skills/workflow-commands/progress-watcher.md +23 -33
- package/.claude/skills/workflow-commands/prrun.md +3 -5
- package/.claude/skills/workflow-commands/retrospective.md +35 -54
- package/.claude/skills/workflow-commands/split-assessment.md +32 -58
- package/.claude/skills/workflow-commands/target-repository.md +1 -2
- package/.claude/skills/workflow-commands/working-tree-hold.md +54 -73
- package/.codex/hooks.json +6 -6
- package/.github/actions/setup-node/action.yml +1 -1
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/publish.yml +2 -2
- package/CLAUDE.md +7 -6
- package/cspell/index.yaml +7 -0
- package/dist/CLAUDE.md +7 -6
- package/dist/commands/document-section-cli.js +67 -34
- package/dist/hooks/batch-guard.js +6 -6
- package/dist/hooks/chunk-4KKD2UTK.js +66 -0
- package/dist/hooks/{chunk-GPLGZ6IC.js → chunk-6TS2JD6D.js} +14 -3
- package/dist/hooks/chunk-7DSBJVFH.js +50 -0
- package/dist/hooks/{chunk-5H4SSDSD.js → chunk-A65Y4YOR.js} +3 -3
- package/dist/hooks/{chunk-3C4XRYG6.js → chunk-APUO6U4J.js} +102 -19
- package/dist/hooks/{chunk-IX6TTTI6.js → chunk-EFXE6C37.js} +8 -22
- package/dist/hooks/chunk-GP4IEC4O.js +20 -0
- package/dist/hooks/chunk-JP45SOCJ.js +56 -0
- package/dist/hooks/{chunk-OLMO72ON.js → chunk-LAOV7NLM.js} +1 -1
- package/dist/hooks/chunk-M4HGZV7U.js +83 -0
- package/dist/hooks/{chunk-TBJFTSUY.js → chunk-O6GDRNJB.js} +9 -7
- package/dist/hooks/{chunk-HFGWYGUV.js → chunk-PF2NZL2A.js} +5 -5
- package/dist/hooks/{chunk-WNLVGT7E.js → chunk-PTICX4OL.js} +4 -5
- package/dist/hooks/{chunk-HHI6FO3R.js → chunk-RT27QRJW.js} +763 -1515
- package/dist/hooks/{chunk-7WQBPLUN.js → chunk-SYOTDYCI.js} +1149 -1095
- package/dist/hooks/{chunk-LIAFCXL7.js → chunk-TNUMY6NL.js} +1519 -1332
- package/dist/hooks/chunk-UPUZF3AN.js +279 -0
- package/dist/hooks/{chunk-Z4XI7CZS.js → chunk-WK6SMBIC.js} +1932 -784
- package/dist/hooks/codex-hook-adapter.js +17 -14
- package/dist/hooks/duplicate-read-guard.js +7 -7
- package/dist/hooks/format-edited.js +5 -4
- package/dist/hooks/inputs.json +302 -247
- package/dist/hooks/investigation-guard.js +8 -11
- package/dist/hooks/pretool-guard.js +16 -13
- package/dist/hooks/session-lang.js +372 -26
- package/dist/hooks/stop-guard.js +2593 -189
- package/dist/josh.js +2128 -282
- package/dist/managed-marker/index.js +1 -2
- package/dist/version/index.js +15 -12
- package/eslint/base.js +2 -1
- package/eslint/rules/unicorn.js +16 -0
- package/lefthook/base.yml +5 -3
- package/package.json +14 -12
- package/prompts/coding-standards.md +12 -22
- package/prompts/collaboration-workflow/file-edits.md +25 -45
- package/prompts/collaboration-workflow/gh-rest.md +19 -36
- package/prompts/collaboration-workflow/glossary.md +5 -7
- package/prompts/collaboration-workflow/issue-citation.md +6 -14
- package/prompts/collaboration-workflow/issue-template.md +40 -32
- package/prompts/collaboration-workflow/lane-instructions.md +35 -0
- package/prompts/collaboration-workflow/operating-rules.md +33 -46
- package/prompts/collaboration-workflow/output-bounds.md +15 -15
- package/prompts/collaboration-workflow/overview.md +14 -19
- package/prompts/collaboration-workflow/plan-comment.md +13 -13
- package/prompts/collaboration-workflow/principles.md +57 -54
- package/prompts/collaboration-workflow/proposal-request.md +1 -9
- package/prompts/collaboration-workflow/report-format.md +41 -49
- package/prompts/collaboration-workflow/residency.md +15 -11
- package/prompts/collaboration-workflow/rule-delivery.md +7 -15
- package/prompts/collaboration-workflow/shell-body.md +10 -20
- package/prompts/collaboration-workflow/turn-batching.md +8 -14
- package/prompts/collaboration-workflow/upstream-interrupt.md +26 -34
- package/prompts/collaboration-workflow/wip-cap.md +26 -32
- package/prompts/collaboration-workflow.md +25 -25
- package/prompts/refactoring.md +33 -43
- package/prompts/review-rubric.md +84 -129
- package/prompts/review.md +110 -141
- package/prompts/sonar-hotspot-handling.md +22 -50
- package/prompts/testing-guide.md +48 -99
- package/scripts/adopt/adopt-toolkits.ts +2 -4
- package/scripts/agent/agent-argv.ts +20 -4
- package/scripts/agent/agent-exit-record.ts +23 -1
- package/scripts/agent/agent-role-profile.ts +101 -45
- package/scripts/agent/agent-safe-text.ts +60 -0
- package/scripts/agent/claude-agent-argv.ts +14 -0
- package/scripts/agent/codex-agent-argv.ts +9 -2
- package/scripts/agent/lane-instructions.ts +144 -0
- package/scripts/backlog/backlog-budget-cli.ts +1 -2
- package/scripts/backlog/backlog-budget.ts +4 -4
- package/scripts/backlog/backlog-drive-carried.ts +26 -0
- package/scripts/backlog/backlog-drive-cli.ts +10 -5
- package/scripts/backlog/backlog-drive-named.ts +3 -5
- package/scripts/backlog/backlog-drive-restore.ts +28 -2
- package/scripts/backlog/backlog-drive-seats.ts +27 -0
- package/scripts/backlog/backlog-drive.ts +11 -6
- package/scripts/backlog/backlog-occupied.ts +56 -0
- package/scripts/backlog/backlog-ready.ts +59 -15
- package/scripts/behavior/behavior-rules.ts +3 -2
- package/scripts/cost-runtime/codex-usage.ts +4 -2
- package/scripts/cost-runtime/cost-cli.ts +1 -2
- package/scripts/delegation/duplicate-read-guard.ts +2 -2
- package/scripts/delegation/investigation-guard.ts +15 -65
- package/scripts/delegation/investigation-reads.ts +1 -2
- package/scripts/discovery/repo-discovery.ts +4 -2
- package/scripts/discovery/repo-origin.ts +2 -4
- package/scripts/doctor/doctor-logic.ts +6 -3
- package/scripts/document/document-byte-budget.ts +28 -27
- package/scripts/document/document-byte-check.ts +1 -2
- package/scripts/document/document-section-cli.ts +17 -5
- package/scripts/document/entry-read-budget.ts +3 -3
- package/scripts/document/read-set-cli.ts +4 -1
- package/scripts/epic/epic-audit-orphans.ts +5 -8
- package/scripts/epic/epic-audit-rationale.ts +8 -2
- package/scripts/epic/epic-audit.ts +52 -1
- package/scripts/epic/epic-bundle-cli.ts +1 -2
- package/scripts/epic/epic-bundle-evidence.ts +49 -26
- package/scripts/epic/epic-bundle-referenced.ts +14 -3
- package/scripts/epic/epic-bundle.ts +17 -9
- package/scripts/epic/epic-chains.ts +6 -2
- package/scripts/epic/epic-close-comment.ts +1 -2
- package/scripts/followup/git-followup-workflow.ts +19 -1
- package/scripts/gate/check-inputs.ts +129 -0
- package/scripts/gate/check-reuse.ts +162 -0
- package/scripts/gate/core-budget.ts +93 -44
- package/scripts/gate/core-wait.ts +130 -0
- package/scripts/gate/free-cores.ts +49 -0
- package/scripts/gate/gate-ledger.ts +17 -3
- package/scripts/gate/gate-plan.ts +23 -1
- package/scripts/gate/gate-report.ts +15 -2
- package/scripts/gate/gate-run-steps.ts +150 -0
- package/scripts/gate/held-mark.ts +55 -0
- package/scripts/gate/machine-capacity.ts +70 -11
- package/scripts/gate/pre-commit-type-check.ts +14 -1
- package/scripts/gate/verification-gate.ts +65 -127
- package/scripts/gh/git-gh-issue-rest.ts +1 -0
- package/scripts/gh/git-gh-issue-write.ts +24 -2
- package/scripts/gh/git-pr.ts +19 -3
- package/scripts/git/git-common-directory.ts +3 -3
- package/scripts/git/git-diff-reads.ts +16 -9
- package/scripts/git/git-execa-error.ts +1 -2
- package/scripts/git/main-merge-regenerate.ts +78 -0
- package/scripts/git/main-merge.ts +14 -5
- package/scripts/hooks/batch-guard.ts +5 -8
- package/scripts/hooks/format-edited-file.ts +10 -4
- package/scripts/hooks/pre-commit-lint.ts +91 -0
- package/scripts/hooks/pre-push-unit.ts +15 -4
- package/scripts/hooks/pretool-guard.ts +48 -79
- package/scripts/hooks/reserved-run.ts +1 -0
- package/scripts/hooks/run-hook.sh +10 -12
- package/scripts/hooks/step-zero-notice.ts +3 -2
- package/scripts/hooks/stop-actions.ts +204 -0
- package/scripts/hooks/stop-guard.ts +62 -21
- package/scripts/init/hook-command-rewrite.ts +6 -2
- package/scripts/init/hook-launch.ts +12 -7
- package/scripts/init/init-logic-deploy-vps.ts +4 -2
- package/scripts/issue/behavior-change-lint.ts +12 -6
- package/scripts/issue/expected-effect-lint.ts +59 -0
- package/scripts/issue/issue-cite-cli.ts +35 -15
- package/scripts/issue/issue-classification.ts +1 -1
- package/scripts/issue/issue-lint-cli.ts +5 -3
- package/scripts/issue/issue-scout-cli.ts +22 -16
- package/scripts/issue/markdown-section.ts +19 -5
- package/scripts/josh/command-usage.ts +110 -0
- package/scripts/josh/file-map-stamp.ts +1 -3
- package/scripts/josh/hook-decision.ts +17 -2
- package/scripts/josh/josh-command-map.ts +2 -0
- package/scripts/josh/josh-command-types.ts +55 -9
- package/scripts/josh/josh-commands-ai.ts +13 -0
- package/scripts/josh/josh-commands-development.ts +1 -1
- package/scripts/josh/josh-commands-hooks.ts +6 -0
- package/scripts/josh/josh-commands-lane.ts +10 -1
- package/scripts/josh/josh-commands-workflow.ts +5 -0
- package/scripts/josh/josh-logic.ts +6 -15
- package/scripts/josh/josh-usage-automation.ts +121 -0
- package/scripts/josh/josh-usage-backlog.ts +180 -0
- package/scripts/josh/josh-usage-developer.ts +230 -0
- package/scripts/josh/josh-usage-hooks.ts +38 -0
- package/scripts/josh/josh-usage-issue.ts +205 -0
- package/scripts/josh/josh-usage-review.ts +101 -0
- package/scripts/josh/josh-usage-run.ts +252 -0
- package/scripts/josh/josh-usage-session.ts +238 -0
- package/scripts/josh/josh-usage-workflow.ts +212 -0
- package/scripts/josh/josh.ts +14 -5
- package/scripts/josh/package-directory.ts +20 -0
- package/scripts/lane/lane-await.ts +3 -2
- package/scripts/lane/lane-capacity.ts +8 -2
- package/scripts/lane/lane-check-stats.ts +56 -0
- package/scripts/lane/lane-child-invocation.ts +49 -5
- package/scripts/lane/lane-dispatch.ts +3 -3
- package/scripts/lane/lane-guard-policy.ts +5 -5
- package/scripts/lane/lane-handoff.ts +8 -1
- package/scripts/lane/lane-install.ts +12 -4
- package/scripts/lane/lane-ledger.ts +52 -1
- package/scripts/lane/lane-limit-cli.ts +8 -9
- package/scripts/lane/lane-load.ts +9 -2
- package/scripts/lane/lane-measure-cli.ts +4 -0
- package/scripts/lane/lane-parked.ts +18 -0
- package/scripts/lane/lane-preserve.ts +29 -1
- package/scripts/lane/lane-process-load.ts +125 -0
- package/scripts/lane/lane-process-stats.ts +93 -0
- package/scripts/lane/lane-registry.ts +17 -10
- package/scripts/lane/lane-restart.ts +5 -26
- package/scripts/lane/lane-session-action.ts +146 -0
- package/scripts/lane/lane-session-broker.ts +68 -125
- package/scripts/lane/lane-spent.ts +14 -3
- package/scripts/lane/lane-stats.ts +1 -0
- package/scripts/lane/lane-withdraw-cli.ts +71 -0
- package/scripts/lane/lane-withdraw.ts +182 -0
- package/scripts/lint/format.ts +4 -4
- package/scripts/lint/lint-parallel.ts +10 -3
- package/scripts/lint/lint-related-scope.ts +4 -1
- package/scripts/managed-marker/managed-marker-logic.ts +1 -2
- package/scripts/notify/telegram-test.ts +10 -5
- package/scripts/overrides/lockfile-overrides.ts +1 -3
- package/scripts/propagate/propagate.ts +1 -2
- package/scripts/release/release-progress.ts +3 -2
- package/scripts/report/report-format-reference.ts +2 -0
- package/scripts/report/report-lint.ts +7 -4
- package/scripts/review/acceptance-map-check.ts +61 -0
- package/scripts/review/acceptance-map.ts +205 -0
- package/scripts/review/review-brief-cli.ts +1 -1
- package/scripts/review/review-record-cli.ts +6 -2
- package/scripts/rules/agent-model.ts +59 -0
- package/scripts/rules/delivered-rules.ts +11 -2
- package/scripts/rules/destructive-command.ts +6 -9
- package/scripts/rules/direct-filing.ts +3 -7
- package/scripts/rules/early-heartbeat.ts +7 -18
- package/scripts/rules/file-body.ts +6 -13
- package/scripts/rules/filing-cap.ts +4 -6
- package/scripts/rules/firing-point.ts +6 -5
- package/scripts/rules/git-force.ts +5 -9
- package/scripts/rules/guard-remedy.ts +117 -0
- package/scripts/rules/implementation-cut.ts +37 -35
- package/scripts/rules/index-guard.ts +4 -7
- package/scripts/rules/issue-comments.ts +67 -16
- package/scripts/rules/josh-git-bare.ts +3 -6
- package/scripts/rules/lane-background.ts +10 -21
- package/scripts/rules/lane-carry-conflict.ts +7 -17
- package/scripts/rules/lane-interactive-ask.ts +6 -11
- package/scripts/rules/lane-park.ts +5 -13
- package/scripts/rules/lane-split-park.ts +2 -7
- package/scripts/rules/lane-switch-main.ts +9 -12
- package/scripts/rules/last-prompt.ts +50 -5
- package/scripts/rules/oracle-consulted.ts +4 -5
- package/scripts/rules/oracle-list-cli.ts +7 -0
- package/scripts/rules/piped-verification.ts +84 -32
- package/scripts/rules/poll-loop.ts +7 -17
- package/scripts/rules/pre-gate-cut.ts +7 -21
- package/scripts/rules/prior-comment-read.ts +7 -5
- package/scripts/rules/protected-files.ts +5 -9
- package/scripts/rules/raw-field-body.ts +3 -7
- package/scripts/rules/rule-body-guard.ts +4 -11
- package/scripts/rules/rule-list.ts +4 -1
- package/scripts/rules/rule-registry-rows.ts +10 -0
- package/scripts/rules/rule-registry.ts +7 -4
- package/scripts/rules/rule-rewrite.ts +114 -0
- package/scripts/rules/rule-value.ts +7 -1
- package/scripts/rules/run-tail-rule.ts +6 -22
- package/scripts/rules/shell-body-trigger.ts +4 -6
- package/scripts/rules/shell-segments.ts +22 -0
- package/scripts/rules/stop-decision.ts +77 -0
- package/scripts/rules/stop-rules.ts +164 -77
- package/scripts/rules/tail-commands.ts +15 -1
- package/scripts/rules/test-declared-commit.ts +4 -10
- package/scripts/rules/third-party-write.ts +5 -10
- package/scripts/rules/worktree-guard.ts +5 -12
- package/scripts/run/board/run-board-cli.ts +2 -0
- package/scripts/run/board/run-board-closed.ts +8 -2
- package/scripts/run/board/run-board-github.ts +19 -3
- package/scripts/run/board/run-board-header.ts +4 -1
- package/scripts/run/board/run-board-idle.ts +31 -0
- package/scripts/run/board/run-board-labels.ts +2 -0
- package/scripts/run/board/run-board-layout.ts +1 -1
- package/scripts/run/board/run-board-read.ts +25 -12
- package/scripts/run/board/run-board-reason.ts +17 -4
- package/scripts/run/board/run-board-render-legend.ts +1 -0
- package/scripts/run/board/run-board-render-slot.ts +1 -1
- package/scripts/run/board/run-board-render-waits.ts +41 -0
- package/scripts/run/board/run-board-render.ts +6 -1
- package/scripts/run/board/run-board-row-yield.ts +1 -0
- package/scripts/run/board/run-board-state.ts +9 -0
- package/scripts/run/board/run-board-status.ts +89 -23
- package/scripts/run/board/run-board-thanks.ts +7 -2
- package/scripts/run/board/run-board-tick.ts +37 -8
- package/scripts/run/carry/run-carry-args.ts +1 -3
- package/scripts/run/carry/run-carry-conversation.ts +7 -2
- package/scripts/run/cut/run-cut-cli.ts +18 -22
- package/scripts/run/cut/run-cut-decline.ts +72 -0
- package/scripts/run/cut/run-cut-ready.ts +74 -0
- package/scripts/run/cut/run-cut-report.ts +29 -0
- package/scripts/run/cut/run-cut.ts +10 -1
- package/scripts/run/detached-launch.ts +23 -4
- package/scripts/run/entry/run-entry-cli.ts +8 -1
- package/scripts/run/event/run-event-render.ts +1 -0
- package/scripts/run/event/run-event-scope.ts +19 -1
- package/scripts/run/event/run-event-stream-emit.ts +13 -6
- package/scripts/run/event/run-event-stream.ts +4 -0
- package/scripts/run/hold/run-hold-cli.ts +14 -3
- package/scripts/run/hold/run-hold-session.ts +46 -0
- package/scripts/run/hold/run-hold.ts +13 -4
- package/scripts/run/launch-priority.ts +32 -0
- package/scripts/run/merge/run-merge-cli.ts +16 -42
- package/scripts/run/merge/run-merge-ship.ts +59 -1
- package/scripts/run/merge/run-merge-signals.ts +99 -0
- package/scripts/run/merge/run-merge-steps.ts +11 -1
- package/scripts/run/merge/run-merge.ts +22 -9
- package/scripts/run/run-ending.ts +31 -3
- package/scripts/run/run-liveness.ts +1 -1
- package/scripts/run/run-parent-cut-hook.ts +5 -10
- package/scripts/run/run-poll-hook.ts +157 -0
- package/scripts/run/run-preflight.ts +1 -2
- package/scripts/run/run-step-cli.ts +22 -15
- package/scripts/run/run-step-section.ts +85 -0
- package/scripts/run/run-stop-notify.ts +1 -2
- package/scripts/run/run-watcher-guard.ts +6 -3
- package/scripts/run/ship/run-ship-cli.ts +5 -12
- package/scripts/run/ship/run-ship-detach.ts +9 -0
- package/scripts/run/ship/run-ship-next.ts +10 -2
- package/scripts/run/ship/run-ship-overlap.ts +195 -0
- package/scripts/run/ship/run-ship-pre-detach.ts +33 -15
- package/scripts/run/ship/run-ship-preflight.ts +28 -2
- package/scripts/run/ship/run-ship-return.ts +31 -7
- package/scripts/run/ship/run-ship-review-steps.ts +25 -14
- package/scripts/run/ship/run-ship-review.ts +15 -2
- package/scripts/run/ship/run-ship-steps.ts +1 -1
- package/scripts/run/ship/run-ship-stop-context.ts +206 -0
- package/scripts/run/ship/run-ship-sync.ts +14 -6
- package/scripts/run/tidy/run-tidy-cli.ts +3 -3
- package/scripts/run/tidy/run-tidy-lanes.ts +3 -2
- package/scripts/safe-chain/project-config.ts +7 -2
- package/scripts/sync/sync-hook-safety.ts +8 -2
- package/scripts/test/test-e2e-guard.ts +30 -5
- package/scripts/test/test-unit-guard.ts +16 -1
- package/scripts/test/unit-worker-share.ts +26 -3
- package/scripts/time-runtime/time-batch-guard.ts +3 -3
- package/scripts/time-runtime/time-hook-transcript.ts +3 -2
- package/scripts/time-runtime/time-shell.ts +39 -4
- package/scripts/time-runtime/time-spans.ts +1 -0
- package/scripts/time-runtime/time-tool-call.ts +7 -0
- package/scripts/version/effective-upstream.ts +3 -4
- package/scripts/version/kit-version-config.ts +8 -2
- package/scripts/version/latest-corepack.ts +1 -2
- package/scripts/version/release-hold.ts +11 -4
- package/scripts/version/version-commands.ts +12 -4
- package/templates/gitignore +6 -2
- package/dist/hooks/chunk-D5QBTOCZ.js +0 -68
- package/dist/hooks/chunk-UT7YC3N2.js +0 -56
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
import {
|
|
3
3
|
DISABLED_VALUES,
|
|
4
|
-
NOTICE,
|
|
5
4
|
SWITCH_ENV_KEY,
|
|
6
5
|
deny_envelope,
|
|
7
|
-
investigation_notice_path,
|
|
8
6
|
investigation_outcome,
|
|
9
7
|
investigation_refusal,
|
|
10
8
|
is_enabled,
|
|
11
9
|
load_environment_file,
|
|
12
10
|
refusal_path
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-7DSBJVFH.js";
|
|
12
|
+
import "./chunk-PTICX4OL.js";
|
|
13
|
+
import "./chunk-UPUZF3AN.js";
|
|
14
|
+
import "./chunk-JP45SOCJ.js";
|
|
15
|
+
import "./chunk-6TS2JD6D.js";
|
|
16
|
+
import "./chunk-TNUMY6NL.js";
|
|
17
|
+
import "./chunk-LAOV7NLM.js";
|
|
18
|
+
import "./chunk-APUO6U4J.js";
|
|
20
19
|
import "./chunk-DGT54IH5.js";
|
|
21
20
|
export {
|
|
22
21
|
DISABLED_VALUES,
|
|
23
|
-
NOTICE,
|
|
24
22
|
SWITCH_ENV_KEY,
|
|
25
23
|
deny_envelope,
|
|
26
|
-
investigation_notice_path,
|
|
27
24
|
investigation_outcome,
|
|
28
25
|
investigation_refusal,
|
|
29
26
|
is_enabled,
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
import {
|
|
3
3
|
pretool_guard
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-RT27QRJW.js";
|
|
5
|
+
import "./chunk-PF2NZL2A.js";
|
|
6
|
+
import "./chunk-SYOTDYCI.js";
|
|
7
|
+
import "./chunk-EFXE6C37.js";
|
|
8
|
+
import "./chunk-M4HGZV7U.js";
|
|
9
|
+
import "./chunk-WK6SMBIC.js";
|
|
10
|
+
import "./chunk-GP4IEC4O.js";
|
|
9
11
|
import "./chunk-CDY4NFQG.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-A65Y4YOR.js";
|
|
13
|
+
import "./chunk-7DSBJVFH.js";
|
|
14
|
+
import "./chunk-PTICX4OL.js";
|
|
15
|
+
import "./chunk-UPUZF3AN.js";
|
|
16
|
+
import "./chunk-JP45SOCJ.js";
|
|
14
17
|
import {
|
|
15
18
|
hook_decision
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-6TS2JD6D.js";
|
|
20
|
+
import "./chunk-TNUMY6NL.js";
|
|
21
|
+
import "./chunk-LAOV7NLM.js";
|
|
22
|
+
import "./chunk-APUO6U4J.js";
|
|
20
23
|
import "./chunk-DGT54IH5.js";
|
|
21
24
|
|
|
22
25
|
// scripts/hooks/pretool-guard-cli.ts
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
distributed_paths
|
|
4
|
+
} from "./chunk-M4HGZV7U.js";
|
|
5
|
+
import {
|
|
6
|
+
OBSERVATION_LEDGER_DIRECTORY
|
|
7
|
+
} from "./chunk-4KKD2UTK.js";
|
|
8
|
+
import {
|
|
4
9
|
detached_launch,
|
|
5
10
|
git_common_directory,
|
|
6
11
|
issue_cite,
|
|
@@ -8,25 +13,32 @@ import {
|
|
|
8
13
|
run_event_stream_emit,
|
|
9
14
|
run_headless,
|
|
10
15
|
session_language
|
|
11
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WK6SMBIC.js";
|
|
17
|
+
import {
|
|
18
|
+
ancestor_directories
|
|
19
|
+
} from "./chunk-GP4IEC4O.js";
|
|
12
20
|
import {
|
|
13
21
|
error_text
|
|
14
22
|
} from "./chunk-CDY4NFQG.js";
|
|
23
|
+
import {
|
|
24
|
+
agent_role_profile
|
|
25
|
+
} from "./chunk-UPUZF3AN.js";
|
|
15
26
|
import {
|
|
16
27
|
josh_environment_file
|
|
17
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-LAOV7NLM.js";
|
|
18
29
|
import {
|
|
19
30
|
agent_session_environment,
|
|
31
|
+
file_reader,
|
|
20
32
|
json_value,
|
|
21
33
|
process_identity,
|
|
22
34
|
run_carry
|
|
23
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-APUO6U4J.js";
|
|
24
36
|
import {
|
|
25
37
|
stamp_file
|
|
26
38
|
} from "./chunk-DGT54IH5.js";
|
|
27
39
|
|
|
28
40
|
// scripts/josh/session-language-cli.ts
|
|
29
|
-
import { fileURLToPath } from "node:url";
|
|
41
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
30
42
|
|
|
31
43
|
// scripts/backlog/backlogrun-launch.ts
|
|
32
44
|
import { randomUUID } from "node:crypto";
|
|
@@ -99,8 +111,333 @@ function check(profile, ports = default_ports) {
|
|
|
99
111
|
var agent_diagnostics = { check };
|
|
100
112
|
|
|
101
113
|
// scripts/agent/claude-agent-argv.ts
|
|
114
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
115
|
+
import path3 from "node:path";
|
|
116
|
+
|
|
117
|
+
// scripts/agent/lane-instructions.ts
|
|
118
|
+
import path2 from "node:path";
|
|
119
|
+
import { fileURLToPath } from "node:url";
|
|
120
|
+
|
|
121
|
+
// scripts/cost-runtime/cost-tokens.ts
|
|
122
|
+
var ASCII_CHARS_PER_TOKEN = 3;
|
|
123
|
+
var WIDE_TOKENS_PER_CHAR = 1;
|
|
124
|
+
var ASCII_LIMIT = 128;
|
|
125
|
+
function count_chars(text) {
|
|
126
|
+
let ascii_chars = 0;
|
|
127
|
+
let wide_chars = 0;
|
|
128
|
+
for (const char of text) {
|
|
129
|
+
if ((char.codePointAt(0) ?? 0) < ASCII_LIMIT) ascii_chars += 1;
|
|
130
|
+
else wide_chars += 1;
|
|
131
|
+
}
|
|
132
|
+
return { ascii_chars, wide_chars };
|
|
133
|
+
}
|
|
134
|
+
function estimate(text) {
|
|
135
|
+
const { ascii_chars, wide_chars } = count_chars(text);
|
|
136
|
+
return Math.round(ascii_chars / ASCII_CHARS_PER_TOKEN) + wide_chars * WIDE_TOKENS_PER_CHAR;
|
|
137
|
+
}
|
|
138
|
+
function ascii_bytes_to_tokens(bytes) {
|
|
139
|
+
return Math.round(bytes / ASCII_CHARS_PER_TOKEN);
|
|
140
|
+
}
|
|
141
|
+
var cost_tokens = {
|
|
142
|
+
ASCII_CHARS_PER_TOKEN,
|
|
143
|
+
count_chars,
|
|
144
|
+
estimate,
|
|
145
|
+
ascii_bytes_to_tokens
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// scripts/document/document-scan.ts
|
|
149
|
+
var COMMAND_PATTERN = /`(?:pnpm )?josh ([a-z][a-z0-9:-]+)/gu;
|
|
150
|
+
var LABEL_PATTERN = /(?:labels\[\]=|\/labels\/|labels -f name=)([a-z][a-z0-9:_-]*)/gu;
|
|
151
|
+
var SECTION_PATTERN = /(?<![\w./:`-])(?<tick>`?)(?<file>[\w./-]+\.md)\k<tick>\s*→\s*(?:§\w+,\s*)?["「](?<heading>[^"」]+)["」]/gu;
|
|
152
|
+
var ADJACENT_PATTERN = /["「](?<heading>[^"「」]+)["」]\s+(?:above|below)\b/gu;
|
|
153
|
+
var BARE_ARROW_PATTERN = /→\s*(?:§\w+,\s*)?["「](?<heading>[^"「」]+)["」]/gu;
|
|
154
|
+
var LINK_TARGET_PATTERN = /\]\([^)\s]*\)/gu;
|
|
155
|
+
var LINK_PATTERN = /\]\(([\w./-]+\.(?:md|png|jpe?g|gif|svg|webp))(?:#[\w-]+)?\)/gu;
|
|
156
|
+
var PLACEHOLDER_FILES = /* @__PURE__ */ new Set(["x.md", "foo.md", "file.md", "path.md"]);
|
|
157
|
+
function matches(text, pattern) {
|
|
158
|
+
return [...text.matchAll(pattern)];
|
|
159
|
+
}
|
|
160
|
+
function command_references(text) {
|
|
161
|
+
return matches(text, COMMAND_PATTERN).map((match) => match[1] ?? "").filter((name) => !name.endsWith(":"));
|
|
162
|
+
}
|
|
163
|
+
function is_real_label(token) {
|
|
164
|
+
return token.length > 0 && !token.endsWith(":") && !token.includes("<");
|
|
165
|
+
}
|
|
166
|
+
function label_references(text) {
|
|
167
|
+
return matches(text, LABEL_PATTERN).map((match) => match[1] ?? "").filter((token) => is_real_label(token));
|
|
168
|
+
}
|
|
169
|
+
function base_name(path5) {
|
|
170
|
+
return path5.split("/").at(-1) ?? path5;
|
|
171
|
+
}
|
|
172
|
+
function is_placeholder_file(name) {
|
|
173
|
+
return name.includes("<") || PLACEHOLDER_FILES.has(base_name(name).toLowerCase());
|
|
174
|
+
}
|
|
175
|
+
function section_references(text) {
|
|
176
|
+
return matches(text.replaceAll(LINK_TARGET_PATTERN, ""), SECTION_PATTERN).map(({ groups }) => ({ file: groups?.["file"] ?? "", heading: groups?.["heading"] ?? "" })).filter((reference) => !is_placeholder_file(reference.file));
|
|
177
|
+
}
|
|
178
|
+
function headings_matching(text, pattern) {
|
|
179
|
+
return matches(text, pattern).map(({ groups }) => groups?.["heading"] ?? "");
|
|
180
|
+
}
|
|
181
|
+
function adjacent_references(text) {
|
|
182
|
+
return headings_matching(text, ADJACENT_PATTERN);
|
|
183
|
+
}
|
|
184
|
+
function bare_arrow_references(text) {
|
|
185
|
+
const unfiled = text.replaceAll(LINK_TARGET_PATTERN, "").replaceAll(SECTION_PATTERN, "");
|
|
186
|
+
return headings_matching(unfiled, BARE_ARROW_PATTERN);
|
|
187
|
+
}
|
|
188
|
+
function link_targets(text) {
|
|
189
|
+
return matches(text, LINK_PATTERN).map((match) => match[1] ?? "").filter((file) => !is_placeholder_file(file));
|
|
190
|
+
}
|
|
191
|
+
function normalize_reference(heading) {
|
|
192
|
+
return heading.replaceAll("`", "").split(/\s+/u).filter((word) => word !== ">").join(" ");
|
|
193
|
+
}
|
|
194
|
+
function reference_forms(title) {
|
|
195
|
+
const normalized = normalize_reference(title);
|
|
196
|
+
return [normalized, normalized.replace(/^\d+[a-z]?\. /u, "")];
|
|
197
|
+
}
|
|
198
|
+
var document_scan = {
|
|
199
|
+
adjacent_references,
|
|
200
|
+
bare_arrow_references,
|
|
201
|
+
command_references,
|
|
202
|
+
label_references,
|
|
203
|
+
link_targets,
|
|
204
|
+
normalize_reference,
|
|
205
|
+
reference_forms,
|
|
206
|
+
section_references
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// scripts/document/document-section.ts
|
|
210
|
+
var HEADING_PATTERN = /^(?<hashes>#{1,6}) (?<title>.*)$/u;
|
|
211
|
+
var FENCE = "```";
|
|
212
|
+
var SINGLE_MATCH = 1;
|
|
213
|
+
var BOLD_LABEL_PATTERN = /\*\*([^*]+?)\*\*/gu;
|
|
214
|
+
var BOLD_DELIMITER = "**";
|
|
215
|
+
var CODE_SPAN_PATTERN = /``[^\n]*?``|`[^`\n]*`/gu;
|
|
216
|
+
var LABEL_LEVEL = 7;
|
|
217
|
+
var LIST_ITEM_PATTERN = /^(?<indent>\s*)(?:[-*]|\d+\.) /u;
|
|
218
|
+
function to_heading(line, index) {
|
|
219
|
+
const groups = HEADING_PATTERN.exec(line)?.groups;
|
|
220
|
+
if (groups === void 0) return void 0;
|
|
221
|
+
const { hashes = "", title = "" } = groups;
|
|
222
|
+
return { level: hashes.length, title: title.trim(), line: index };
|
|
223
|
+
}
|
|
224
|
+
function push_heading(found, line, index) {
|
|
225
|
+
const heading = to_heading(line, index);
|
|
226
|
+
if (heading !== void 0) found.push(heading);
|
|
227
|
+
}
|
|
228
|
+
function fenced_flags(lines) {
|
|
229
|
+
let is_inside_fence = false;
|
|
230
|
+
return lines.map(function is_fenced(line) {
|
|
231
|
+
if (!line.startsWith(FENCE)) return is_inside_fence;
|
|
232
|
+
is_inside_fence = !is_inside_fence;
|
|
233
|
+
return true;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function headings(markdown) {
|
|
237
|
+
const lines = markdown.split("\n");
|
|
238
|
+
const fenced = fenced_flags(lines);
|
|
239
|
+
const found = [];
|
|
240
|
+
for (const [index, line] of lines.entries()) {
|
|
241
|
+
if (fenced[index] !== true) push_heading(found, line, index);
|
|
242
|
+
}
|
|
243
|
+
return found;
|
|
244
|
+
}
|
|
245
|
+
function titles(markdown) {
|
|
246
|
+
return headings(markdown).map((heading) => heading.title);
|
|
247
|
+
}
|
|
248
|
+
function line_starts(markdown) {
|
|
249
|
+
return [...markdown.matchAll(/\n/gu)].map((match) => match.index + SINGLE_MATCH);
|
|
250
|
+
}
|
|
251
|
+
function line_of(starts, offset) {
|
|
252
|
+
return starts.filter((start2) => start2 <= offset).length;
|
|
253
|
+
}
|
|
254
|
+
function unfenced_text(markdown) {
|
|
255
|
+
const lines = markdown.split("\n");
|
|
256
|
+
const fenced = fenced_flags(lines);
|
|
257
|
+
return lines.map((line, index) => fenced[index] === true ? "" : line).join("\n");
|
|
258
|
+
}
|
|
259
|
+
function code_masked(text) {
|
|
260
|
+
return text.replaceAll(CODE_SPAN_PATTERN, (span) => span.replaceAll("*", " "));
|
|
261
|
+
}
|
|
262
|
+
function labels(markdown) {
|
|
263
|
+
const text = unfenced_text(markdown);
|
|
264
|
+
const starts = line_starts(text);
|
|
265
|
+
return [...code_masked(text).matchAll(BOLD_LABEL_PATTERN)].map((match) => ({
|
|
266
|
+
level: LABEL_LEVEL,
|
|
267
|
+
title: text.slice(
|
|
268
|
+
match.index + BOLD_DELIMITER.length,
|
|
269
|
+
match.index + match[0].length - BOLD_DELIMITER.length
|
|
270
|
+
),
|
|
271
|
+
line: line_of(starts, match.index)
|
|
272
|
+
}));
|
|
273
|
+
}
|
|
274
|
+
function is_match(heading, wanted) {
|
|
275
|
+
return document_scan.reference_forms(heading.title).some((form) => form.startsWith(wanted));
|
|
276
|
+
}
|
|
277
|
+
function prefixed(found, wanted) {
|
|
278
|
+
const normalized = document_scan.normalize_reference(wanted);
|
|
279
|
+
return found.filter((heading) => is_match(heading, normalized));
|
|
280
|
+
}
|
|
281
|
+
function is_exact(heading, wanted) {
|
|
282
|
+
return document_scan.reference_forms(heading.title).includes(wanted);
|
|
283
|
+
}
|
|
284
|
+
function select(found, wanted) {
|
|
285
|
+
const normalized = document_scan.normalize_reference(wanted);
|
|
286
|
+
const exact = found.find((heading) => is_exact(heading, normalized));
|
|
287
|
+
if (exact !== void 0) return exact;
|
|
288
|
+
const near = prefixed(found, wanted);
|
|
289
|
+
return near.length === SINGLE_MATCH ? near[0] : void 0;
|
|
290
|
+
}
|
|
291
|
+
function last_line_of(found, chosen, total_lines) {
|
|
292
|
+
const next = found.find((heading) => heading.line > chosen.line && heading.level <= chosen.level);
|
|
293
|
+
return (next === void 0 ? total_lines : next.line) - SINGLE_MATCH;
|
|
294
|
+
}
|
|
295
|
+
function indent_of(line) {
|
|
296
|
+
return line.length - line.trimStart().length;
|
|
297
|
+
}
|
|
298
|
+
function is_sibling_item(line, depth) {
|
|
299
|
+
const { indent } = LIST_ITEM_PATTERN.exec(line)?.groups ?? {};
|
|
300
|
+
return indent !== void 0 && indent.length <= depth;
|
|
301
|
+
}
|
|
302
|
+
function ends_block(line, depth) {
|
|
303
|
+
if (line.trim() === "" || HEADING_PATTERN.test(line)) return true;
|
|
304
|
+
return is_sibling_item(line, depth);
|
|
305
|
+
}
|
|
306
|
+
function label_last_line(lines, label) {
|
|
307
|
+
const depth = indent_of(lines[label.line] ?? "");
|
|
308
|
+
const end = lines.findIndex((line, index) => index > label.line && ends_block(line, depth));
|
|
309
|
+
return (end === -1 ? lines.length : end) - SINGLE_MATCH;
|
|
310
|
+
}
|
|
311
|
+
function choose(markdown, wanted) {
|
|
312
|
+
const found = headings(markdown);
|
|
313
|
+
if (prefixed(found, wanted).length > 0) return select(found, wanted);
|
|
314
|
+
return select(labels(markdown), wanted);
|
|
315
|
+
}
|
|
316
|
+
function extent_of(markdown, chosen) {
|
|
317
|
+
const lines = markdown.split("\n");
|
|
318
|
+
if (chosen.level === LABEL_LEVEL) return label_last_line(lines, chosen);
|
|
319
|
+
return last_line_of(headings(markdown), chosen, lines.length);
|
|
320
|
+
}
|
|
321
|
+
function section(markdown, wanted) {
|
|
322
|
+
const chosen = choose(markdown, wanted);
|
|
323
|
+
if (chosen === void 0) return void 0;
|
|
324
|
+
const last_line = extent_of(markdown, chosen);
|
|
325
|
+
const lines = markdown.split("\n").slice(chosen.line, last_line + SINGLE_MATCH);
|
|
326
|
+
return {
|
|
327
|
+
title: chosen.title,
|
|
328
|
+
level: chosen.level,
|
|
329
|
+
first_line: chosen.line,
|
|
330
|
+
last_line,
|
|
331
|
+
text: lines.join("\n")
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function candidates(markdown, wanted) {
|
|
335
|
+
const near = prefixed(headings(markdown), wanted);
|
|
336
|
+
const listed = near.length > 0 ? near : prefixed(labels(markdown), wanted);
|
|
337
|
+
return listed.map((heading) => heading.title);
|
|
338
|
+
}
|
|
339
|
+
function read_optional(file_path) {
|
|
340
|
+
return file_reader.read_if_readable(file_path);
|
|
341
|
+
}
|
|
342
|
+
var document_section = {
|
|
343
|
+
candidates,
|
|
344
|
+
headings,
|
|
345
|
+
read_optional,
|
|
346
|
+
section,
|
|
347
|
+
titles
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// scripts/josh/package-directory.ts
|
|
102
351
|
import { existsSync } from "node:fs";
|
|
103
352
|
import path from "node:path";
|
|
353
|
+
var PACKAGE_JSON = "package.json";
|
|
354
|
+
function find_package_directory(start_directory) {
|
|
355
|
+
return ancestor_directories.nearest(
|
|
356
|
+
start_directory,
|
|
357
|
+
(directory) => existsSync(path.join(directory, PACKAGE_JSON))
|
|
358
|
+
) ?? start_directory;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// scripts/agent/lane-instructions.ts
|
|
362
|
+
var LANE_DOCUMENT = "prompts/collaboration-workflow/lane-instructions.md";
|
|
363
|
+
var RULES_FILE = "CLAUDE.md";
|
|
364
|
+
var POINTER_FILE = "AGENTS.md";
|
|
365
|
+
var INCLUDE_PATTERN = /^<!-- include: CLAUDE\.md → "(?<wanted>.+)" -->$/u;
|
|
366
|
+
var PROMPT_FILE_FLAG = "--append-system-prompt-file";
|
|
367
|
+
var SETTINGS_FLAG = "--settings";
|
|
368
|
+
var PROMPT_FILE_PREFIX = "josh-lane-instructions-";
|
|
369
|
+
var PROMPT_FILE_SUFFIX = ".md";
|
|
370
|
+
var PACKAGE_DIRECTORY = find_package_directory(path2.dirname(fileURLToPath(import.meta.url)));
|
|
371
|
+
function expand_line(line, rules) {
|
|
372
|
+
const wanted = INCLUDE_PATTERN.exec(line)?.groups?.["wanted"];
|
|
373
|
+
if (wanted === void 0) return line;
|
|
374
|
+
return document_section.section(rules, wanted)?.text;
|
|
375
|
+
}
|
|
376
|
+
function compose(lane_markdown, rules) {
|
|
377
|
+
const expanded = lane_markdown.split("\n").map((line) => expand_line(line, rules));
|
|
378
|
+
if (expanded.includes(void 0)) return void 0;
|
|
379
|
+
return expanded.join("\n");
|
|
380
|
+
}
|
|
381
|
+
function rules_sources(cwd) {
|
|
382
|
+
const imported = distributed_paths.CLAUDE_MD_IMPORT_LINE.replace(/^@/u, "");
|
|
383
|
+
return [path2.join(cwd, RULES_FILE), path2.join(cwd, imported)];
|
|
384
|
+
}
|
|
385
|
+
function composed_from(lane_markdown, rules_path) {
|
|
386
|
+
const rules = document_section.read_optional(rules_path);
|
|
387
|
+
return rules === void 0 ? void 0 : compose(lane_markdown, rules);
|
|
388
|
+
}
|
|
389
|
+
function composed_set(cwd, package_directory) {
|
|
390
|
+
const lane_markdown = document_section.read_optional(path2.join(package_directory, LANE_DOCUMENT));
|
|
391
|
+
if (lane_markdown === void 0) return void 0;
|
|
392
|
+
for (const rules_path of rules_sources(cwd)) {
|
|
393
|
+
const text = composed_from(lane_markdown, rules_path);
|
|
394
|
+
if (text !== void 0) return { text, rules_path };
|
|
395
|
+
}
|
|
396
|
+
return void 0;
|
|
397
|
+
}
|
|
398
|
+
function composed_in(cwd, package_directory = PACKAGE_DIRECTORY) {
|
|
399
|
+
return composed_set(cwd, package_directory)?.text;
|
|
400
|
+
}
|
|
401
|
+
function written(text) {
|
|
402
|
+
const file_path = stamp_file.stamp_path(PROMPT_FILE_PREFIX, text, PROMPT_FILE_SUFFIX);
|
|
403
|
+
if (stamp_file.read_stamp_text(file_path) === text) return file_path;
|
|
404
|
+
try {
|
|
405
|
+
return stamp_file.replace_text_stamp(file_path, text);
|
|
406
|
+
} catch {
|
|
407
|
+
return void 0;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function excluded_settings(rules_path, cwd) {
|
|
411
|
+
return JSON.stringify({ claudeMdExcludes: [rules_path, path2.join(cwd, POINTER_FILE)] });
|
|
412
|
+
}
|
|
413
|
+
function flags(cwd = process.cwd()) {
|
|
414
|
+
const set = composed_set(cwd, PACKAGE_DIRECTORY);
|
|
415
|
+
const prompt_file = set === void 0 ? void 0 : written(set.text);
|
|
416
|
+
if (set === void 0 || prompt_file === void 0) return [];
|
|
417
|
+
return [PROMPT_FILE_FLAG, prompt_file, SETTINGS_FLAG, excluded_settings(set.rules_path, cwd)];
|
|
418
|
+
}
|
|
419
|
+
function tokens_of(text) {
|
|
420
|
+
return cost_tokens.estimate(text).toLocaleString("en-US");
|
|
421
|
+
}
|
|
422
|
+
function rules_tokens(rules_path) {
|
|
423
|
+
return tokens_of(document_section.read_optional(rules_path) ?? "");
|
|
424
|
+
}
|
|
425
|
+
function resident_line(cwd = process.cwd()) {
|
|
426
|
+
const set = composed_set(cwd, PACKAGE_DIRECTORY);
|
|
427
|
+
const rules = rules_tokens(set?.rules_path ?? path2.join(cwd, RULES_FILE));
|
|
428
|
+
const lane_tokens = set === void 0 ? "not composed" : `${tokens_of(set.text)} tok`;
|
|
429
|
+
return ` resident: lane instructions ${lane_tokens} in place of ${RULES_FILE} ${rules} tok`;
|
|
430
|
+
}
|
|
431
|
+
var lane_instructions = {
|
|
432
|
+
PROMPT_FILE_FLAG,
|
|
433
|
+
SETTINGS_FLAG,
|
|
434
|
+
compose,
|
|
435
|
+
composed_in,
|
|
436
|
+
flags,
|
|
437
|
+
resident_line
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// scripts/agent/claude-agent-argv.ts
|
|
104
441
|
var AGENT_COMMAND = "claude";
|
|
105
442
|
var PERMISSION_FLAGS = ["--permission-mode", "bypassPermissions"];
|
|
106
443
|
var AGENT_FLAGS = [
|
|
@@ -137,23 +474,29 @@ function session_id_flags(session_id) {
|
|
|
137
474
|
return session_id === void 0 ? [] : [SESSION_ID_FLAG, session_id];
|
|
138
475
|
}
|
|
139
476
|
function tool_flags(cwd = process.cwd()) {
|
|
140
|
-
const mcp_config =
|
|
141
|
-
const mcp_flags =
|
|
477
|
+
const mcp_config = path3.join(cwd, PROJECT_MCP_FILE);
|
|
478
|
+
const mcp_flags = existsSync2(mcp_config) ? [STRICT_MCP_FLAG, MCP_CONFIG_FLAG, mcp_config] : [STRICT_MCP_FLAG];
|
|
142
479
|
return [TOOLS_FLAG, LAUNCHED_TOOLS.join(","), ...mcp_flags];
|
|
143
480
|
}
|
|
481
|
+
function instruction_flags(profile, cwd) {
|
|
482
|
+
if (profile.role === agent_role_profile.SCHEDULER) return [];
|
|
483
|
+
return lane_instructions.flags(cwd);
|
|
484
|
+
}
|
|
144
485
|
function build(invocation, profile, session_id, cwd) {
|
|
145
486
|
return {
|
|
146
487
|
command: AGENT_COMMAND,
|
|
147
488
|
args: [
|
|
148
489
|
...AGENT_FLAGS,
|
|
149
490
|
...tool_flags(cwd),
|
|
491
|
+
...instruction_flags(profile, cwd),
|
|
150
492
|
...session_id_flags(session_id),
|
|
151
493
|
MODEL_FLAG,
|
|
152
494
|
profile.model,
|
|
153
495
|
EFFORT_FLAG,
|
|
154
496
|
profile.effort,
|
|
155
497
|
invocation
|
|
156
|
-
]
|
|
498
|
+
],
|
|
499
|
+
ends_with_prompt: true
|
|
157
500
|
};
|
|
158
501
|
}
|
|
159
502
|
function build_resume(invocation, profile, session_id, cwd) {
|
|
@@ -162,6 +505,7 @@ function build_resume(invocation, profile, session_id, cwd) {
|
|
|
162
505
|
args: [
|
|
163
506
|
...AGENT_FLAGS,
|
|
164
507
|
...tool_flags(cwd),
|
|
508
|
+
...instruction_flags(profile, cwd),
|
|
165
509
|
RESUME_FLAG,
|
|
166
510
|
session_id,
|
|
167
511
|
MODEL_FLAG,
|
|
@@ -169,7 +513,8 @@ function build_resume(invocation, profile, session_id, cwd) {
|
|
|
169
513
|
EFFORT_FLAG,
|
|
170
514
|
profile.effort,
|
|
171
515
|
invocation
|
|
172
|
-
]
|
|
516
|
+
],
|
|
517
|
+
ends_with_prompt: true
|
|
173
518
|
};
|
|
174
519
|
}
|
|
175
520
|
function with_profile(invocation, profile) {
|
|
@@ -191,14 +536,7 @@ var claude_agent_argv = {
|
|
|
191
536
|
|
|
192
537
|
// scripts/agent/codex-agent-argv.ts
|
|
193
538
|
import { lstatSync, mkdirSync } from "node:fs";
|
|
194
|
-
import
|
|
195
|
-
|
|
196
|
-
// scripts/observations/observation-ledger.ts
|
|
197
|
-
var OBSERVATION_LEDGER_DIRECTORY = ".josh/observations";
|
|
198
|
-
var LEDGER_FILE_EXTENSION = ".md";
|
|
199
|
-
var LEGACY_LEDGER_FILE = `legacy${LEDGER_FILE_EXTENSION}`;
|
|
200
|
-
|
|
201
|
-
// scripts/agent/codex-agent-argv.ts
|
|
539
|
+
import path4 from "node:path";
|
|
202
540
|
var AGENT_COMMAND2 = "codex";
|
|
203
541
|
var AGENT_FLAGS2 = ["exec", "--sandbox", "workspace-write"];
|
|
204
542
|
var MODEL_FLAG2 = "--model";
|
|
@@ -209,12 +547,12 @@ var SQLITE_CACHE_PATH = ["node_modules", ".cache", "josh", "openai"];
|
|
|
209
547
|
var EPHEMERAL_FLAG = "--ephemeral";
|
|
210
548
|
var ADD_DIRECTORY_FLAG = "--add-dir";
|
|
211
549
|
var GIT_DIRECTORY = ".git";
|
|
212
|
-
var LEDGER_DIRECTORY =
|
|
550
|
+
var LEDGER_DIRECTORY = path4.dirname(OBSERVATION_LEDGER_DIRECTORY);
|
|
213
551
|
function effort_config(profile) {
|
|
214
552
|
return `model_reasoning_effort="${profile.effort}"`;
|
|
215
553
|
}
|
|
216
554
|
function sqlite_config(cwd) {
|
|
217
|
-
return `sqlite_home=${JSON.stringify(
|
|
555
|
+
return `sqlite_home=${JSON.stringify(path4.resolve(cwd, ...SQLITE_CACHE_PATH))}`;
|
|
218
556
|
}
|
|
219
557
|
function persistence_arguments(profile) {
|
|
220
558
|
return profile.role === agent_role_profile.WORKER ? [] : [EPHEMERAL_FLAG];
|
|
@@ -227,9 +565,10 @@ function ensure_ledger_directory(directory) {
|
|
|
227
565
|
}
|
|
228
566
|
}
|
|
229
567
|
function ledger_arguments(common_directory, profile) {
|
|
230
|
-
if (common_directory === void 0 || profile.role !== agent_role_profile.WORKER)
|
|
231
|
-
|
|
232
|
-
|
|
568
|
+
if (common_directory === void 0 || profile.role !== agent_role_profile.WORKER || path4.basename(common_directory) !== GIT_DIRECTORY) {
|
|
569
|
+
return [];
|
|
570
|
+
}
|
|
571
|
+
const directory = path4.join(path4.dirname(common_directory), LEDGER_DIRECTORY);
|
|
233
572
|
ensure_ledger_directory(directory);
|
|
234
573
|
return [ADD_DIRECTORY_FLAG, directory];
|
|
235
574
|
}
|
|
@@ -258,7 +597,8 @@ function build2(invocation, profile, cwd) {
|
|
|
258
597
|
...cwd === void 0 ? [] : lane_arguments(cwd, profile),
|
|
259
598
|
JSON_FLAG,
|
|
260
599
|
invocation
|
|
261
|
-
]
|
|
600
|
+
],
|
|
601
|
+
ends_with_prompt: true
|
|
262
602
|
};
|
|
263
603
|
}
|
|
264
604
|
var codex_agent_argv = { build: build2 };
|
|
@@ -296,13 +636,19 @@ function resume_argv(invocation, profile, phase, cwd) {
|
|
|
296
636
|
const resolved = agent_role_profile.resolve(agent_role_profile.WORKER, process.env, phase);
|
|
297
637
|
return resolved.kind === "rejected" ? resolved : with_profile_in(invocation, resolved.profile, cwd);
|
|
298
638
|
}
|
|
299
|
-
function
|
|
300
|
-
const resolved = agent_role_profile.resolve(role, environment);
|
|
639
|
+
function profiled_in(invocation, resolved, cwd) {
|
|
301
640
|
return resolved.kind === "rejected" ? resolved : with_profile_in(invocation, resolved.profile, cwd);
|
|
302
641
|
}
|
|
642
|
+
function resolve_in(invocation, role, cwd, environment = process.env) {
|
|
643
|
+
return profiled_in(invocation, agent_role_profile.resolve(role, environment), cwd);
|
|
644
|
+
}
|
|
645
|
+
function review_in(invocation, round, cwd, environment = process.env) {
|
|
646
|
+
return profiled_in(invocation, agent_role_profile.resolve_review(round, environment), cwd);
|
|
647
|
+
}
|
|
303
648
|
var agent_argv = {
|
|
304
649
|
resolve: resolve2,
|
|
305
650
|
resolve_in,
|
|
651
|
+
review_in,
|
|
306
652
|
resume_argv,
|
|
307
653
|
with_profile: with_profile2,
|
|
308
654
|
with_profile_in,
|
|
@@ -532,7 +878,7 @@ var session_language_cli = {
|
|
|
532
878
|
prompt_lines,
|
|
533
879
|
resolve_session_lang
|
|
534
880
|
};
|
|
535
|
-
if (process.argv[1] ===
|
|
881
|
+
if (process.argv[1] === fileURLToPath2(import.meta.url)) await main();
|
|
536
882
|
export {
|
|
537
883
|
session_language_cli
|
|
538
884
|
};
|