aiwcli 0.15.5 → 0.15.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/capabilities/branch/adapters.d.ts +2 -0
- package/dist/capabilities/branch/adapters.js +21 -0
- package/dist/capabilities/branch/contracts.d.ts +57 -0
- package/dist/capabilities/branch/contracts.js +1 -0
- package/dist/capabilities/branch/control-plane.d.ts +2 -0
- package/dist/capabilities/branch/control-plane.js +343 -0
- package/dist/capabilities/branch/runtime-core.d.ts +5 -0
- package/dist/capabilities/branch/runtime-core.js +36 -0
- package/dist/capabilities/installation/control-plane/clean-command.d.ts +41 -0
- package/dist/capabilities/installation/control-plane/clean-command.js +196 -0
- package/dist/capabilities/installation/control-plane/clear-command.d.ts +160 -0
- package/dist/capabilities/installation/control-plane/clear-command.js +1220 -0
- package/dist/capabilities/installation/control-plane/init-command.d.ts +81 -0
- package/dist/capabilities/installation/control-plane/init-command.js +449 -0
- package/dist/capabilities/launch/contracts.d.ts +51 -0
- package/dist/capabilities/launch/contracts.js +1 -0
- package/dist/capabilities/launch/control-plane/execute-launch.d.ts +2 -0
- package/dist/capabilities/launch/control-plane/execute-launch.js +222 -0
- package/dist/capabilities/launch/runtime-core/launch-options.d.ts +14 -0
- package/dist/capabilities/launch/runtime-core/launch-options.js +69 -0
- package/dist/cli/base-command.d.ts +18 -0
- package/dist/cli/base-command.js +55 -0
- package/dist/commands/branch.d.ts +0 -20
- package/dist/commands/branch.js +24 -416
- package/dist/commands/clean.d.ts +1 -41
- package/dist/commands/clean.js +1 -196
- package/dist/commands/clear.d.ts +1 -161
- package/dist/commands/clear.js +1 -1121
- package/dist/commands/init/index.d.ts +1 -98
- package/dist/commands/init/index.js +4 -478
- package/dist/commands/launch.d.ts +36 -11
- package/dist/commands/launch.js +135 -159
- package/dist/lib/base-command.d.ts +1 -114
- package/dist/lib/base-command.js +1 -153
- package/dist/lib/claude-settings-types.d.ts +31 -19
- package/dist/lib/context/context-formatter.d.ts +74 -0
- package/dist/lib/context/context-formatter.js +493 -0
- package/dist/lib/context/context-selector.d.ts +42 -0
- package/dist/lib/context/context-selector.js +451 -0
- package/dist/lib/context/context-store.d.ts +100 -0
- package/dist/lib/context/context-store.js +618 -0
- package/dist/lib/context/plan-manager.d.ts +54 -0
- package/dist/lib/context/plan-manager.js +282 -0
- package/dist/lib/context/task-tracker.d.ts +44 -0
- package/dist/lib/context/task-tracker.js +146 -0
- package/dist/lib/core-ide-base.d.ts +4 -0
- package/dist/lib/core-ide-base.js +77 -0
- package/dist/lib/core-installer.d.ts +5 -0
- package/dist/lib/core-installer.js +54 -0
- package/dist/lib/git-exclude-manager.d.ts +2 -2
- package/dist/lib/git-exclude-manager.js +3 -3
- package/dist/lib/hooks/hook-utils.d.ts +143 -0
- package/dist/lib/hooks/hook-utils.js +609 -0
- package/dist/lib/hooks/session-end-logic.d.ts +5 -0
- package/dist/lib/hooks/session-end-logic.js +63 -0
- package/dist/lib/hooks-merger.js +25 -19
- package/dist/lib/ide-path-resolver.d.ts +19 -7
- package/dist/lib/ide-path-resolver.js +25 -9
- package/dist/lib/install-state.d.ts +34 -0
- package/dist/lib/install-state.js +161 -0
- package/dist/lib/launch-options.d.ts +1 -0
- package/dist/lib/launch-options.js +1 -0
- package/dist/lib/lsp-patch.d.ts +12 -0
- package/dist/lib/lsp-patch.js +156 -0
- package/dist/lib/multiplexer.d.ts +57 -0
- package/dist/lib/multiplexer.js +19 -0
- package/dist/lib/multiplexers/psmux.d.ts +75 -0
- package/dist/lib/multiplexers/psmux.js +384 -0
- package/dist/lib/multiplexers/tmux.d.ts +44 -0
- package/dist/lib/multiplexers/tmux.js +262 -0
- package/dist/lib/mux-utils.d.ts +5 -0
- package/dist/lib/mux-utils.js +42 -0
- package/dist/lib/paths.d.ts +2 -2
- package/dist/lib/paths.js +2 -2
- package/dist/lib/platform-commands.d.ts +27 -0
- package/dist/lib/platform-commands.js +49 -0
- package/dist/lib/runtime/aiw-cli.d.ts +37 -0
- package/dist/lib/runtime/aiw-cli.js +74 -0
- package/dist/lib/runtime/atomic-write.d.ts +19 -0
- package/dist/lib/runtime/atomic-write.js +121 -0
- package/dist/lib/runtime/cli-args.d.ts +55 -0
- package/dist/lib/runtime/cli-args.js +185 -0
- package/dist/lib/runtime/constants.d.ts +56 -0
- package/dist/lib/runtime/constants.js +230 -0
- package/dist/lib/runtime/executable-policy.d.ts +16 -0
- package/dist/lib/runtime/executable-policy.js +57 -0
- package/dist/lib/runtime/git-state.d.ts +9 -0
- package/dist/lib/runtime/git-state.js +59 -0
- package/dist/lib/runtime/inference.d.ts +37 -0
- package/dist/lib/runtime/inference.js +262 -0
- package/dist/lib/runtime/lint-dispatch.d.ts +40 -0
- package/dist/lib/runtime/lint-dispatch.js +285 -0
- package/dist/lib/runtime/logger.d.ts +66 -0
- package/dist/lib/runtime/logger.js +201 -0
- package/dist/lib/runtime/models.d.ts +14 -0
- package/dist/lib/runtime/models.js +14 -0
- package/dist/lib/runtime/platform-adapter.d.ts +7 -0
- package/dist/lib/runtime/platform-adapter.js +21 -0
- package/dist/lib/runtime/preflight.d.ts +24 -0
- package/dist/lib/runtime/preflight.js +65 -0
- package/dist/lib/runtime/sentinel-ipc.d.ts +14 -0
- package/dist/lib/runtime/sentinel-ipc.js +67 -0
- package/dist/lib/runtime/state-io.d.ts +30 -0
- package/dist/lib/runtime/state-io.js +174 -0
- package/dist/lib/runtime/stop-words.d.ts +20 -0
- package/dist/lib/runtime/stop-words.js +150 -0
- package/dist/lib/runtime/subprocess-utils.d.ts +29 -0
- package/dist/lib/runtime/subprocess-utils.js +96 -0
- package/dist/lib/runtime/tmux-preflight.d.ts +13 -0
- package/dist/lib/runtime/tmux-preflight.js +78 -0
- package/dist/lib/runtime/utils.d.ts +54 -0
- package/dist/lib/runtime/utils.js +162 -0
- package/dist/lib/sentinel-wrapper.d.ts +9 -0
- package/dist/lib/sentinel-wrapper.js +20 -0
- package/dist/lib/shell-quoting.d.ts +5 -0
- package/dist/lib/shell-quoting.js +17 -0
- package/dist/lib/spawn-errors.d.ts +6 -0
- package/dist/lib/spawn-errors.js +15 -0
- package/dist/lib/spawn.js +5 -11
- package/dist/lib/template-installer.d.ts +4 -5
- package/dist/lib/template-installer.js +36 -34
- package/dist/lib/template-resolver.d.ts +6 -7
- package/dist/lib/template-resolver.js +26 -21
- package/dist/lib/template-settings-reconstructor.d.ts +7 -2
- package/dist/lib/template-settings-reconstructor.js +76 -45
- package/dist/lib/terminal-strategy.d.ts +11 -0
- package/dist/lib/terminal-strategy.js +49 -0
- package/dist/lib/terminal.d.ts +28 -0
- package/dist/lib/terminal.js +162 -112
- package/dist/lib/tmux-pane-placement.d.ts +17 -0
- package/dist/lib/tmux-pane-placement.js +58 -0
- package/dist/lib/tmux-primitives.d.ts +5 -0
- package/dist/lib/tmux-primitives.js +15 -0
- package/dist/lib/tmux-session.d.ts +32 -0
- package/dist/lib/tmux-session.js +86 -0
- package/dist/lib/tty-detection.js +1 -1
- package/dist/lib/types.d.ts +168 -0
- package/dist/lib/types.js +6 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/platform/launch.d.ts +10 -0
- package/dist/platform/launch.js +10 -0
- package/dist/templates/CLAUDE.md +31 -40
- package/dist/templates/cc-native/.claude/settings.json +27 -27
- package/dist/templates/cc-native/CC-NATIVE-README.md +1 -1
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +10 -9
- package/dist/templates/cc-native/_cc-native/CLAUDE.md +18 -18
- package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +3 -3
- package/dist/templates/cc-native/_cc-native/artifacts/lib/format.ts +14 -14
- package/dist/templates/cc-native/_cc-native/artifacts/lib/tracker.ts +1 -1
- package/dist/templates/cc-native/_cc-native/artifacts/lib/write.ts +3 -3
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -3
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +16 -15
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +3 -3
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +3 -3
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +3 -3
- package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +8 -8
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +8 -8
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +3 -3
- package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +3 -3
- package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +3 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/agent-selection.test.ts +345 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/preflight.test.ts +344 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +37 -15
- package/dist/templates/cc-native/_cc-native/plan-review/lib/corroboration.ts +16 -69
- package/dist/templates/cc-native/_cc-native/plan-review/lib/orchestrator.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/output-builder.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/plan-questions.ts +2 -2
- package/dist/templates/cc-native/_cc-native/plan-review/lib/preflight.ts +56 -26
- package/dist/templates/cc-native/_cc-native/plan-review/lib/review-pipeline.ts +7 -7
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +3 -3
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/index.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/claude-agent.ts +2 -2
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/codex-agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/gemini-agent.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/orchestrator-claude-agent.ts +5 -6
- package/dist/templates/core/.codex/workflows/codex.md +17 -0
- package/dist/templates/core/.codex/workflows/handoff.md +5 -0
- package/dist/templates/core/.codex/workflows/meta-plan.md +7 -0
- package/dist/templates/core/.cognition/AGENTS.md +5 -0
- package/dist/templates/core/.cognition/config.json +12 -0
- package/dist/templates/{_shared → core}/.windsurf/workflows/handoff.md +1 -1
- package/dist/templates/{_shared → core}/.windsurf/workflows/meta-plan.md +1 -1
- package/dist/templates/core/hooks-ts/_utils/git-state.ts +2 -0
- package/dist/templates/{_shared → core}/hooks-ts/archive_plan.ts +14 -23
- package/dist/templates/core/hooks-ts/codex_explorer.ts +160 -0
- package/dist/templates/{_shared → core}/hooks-ts/context_monitor.ts +23 -55
- package/dist/templates/{_shared → core}/hooks-ts/file-suggestion.ts +4 -3
- package/dist/templates/{_shared → core}/hooks-ts/lint_after_edit.ts +7 -9
- package/dist/templates/{_shared → core}/hooks-ts/pre_compact.ts +5 -5
- package/dist/templates/{_shared → core}/hooks-ts/session_end.ts +38 -78
- package/dist/templates/{_shared → core}/hooks-ts/session_start.ts +5 -5
- package/dist/templates/core/hooks-ts/task_create_capture.ts +32 -0
- package/dist/templates/{_shared → core}/hooks-ts/task_update_capture.ts +9 -24
- package/dist/templates/core/hooks-ts/user_prompt_submit.ts +46 -0
- package/dist/templates/{_shared → core}/lib-ts/CLAUDE.md +27 -16
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/headless.ts +3 -2
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/tmux.ts +44 -15
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/base-agent.ts +6 -4
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/execution-backend.ts +1 -1
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/index.ts +2 -2
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/structured-output.ts +4 -5
- package/dist/templates/{_shared → core}/lib-ts/context/CLAUDE.md +9 -6
- package/dist/templates/{_shared → core}/lib-ts/context/context-formatter.ts +16 -21
- package/dist/templates/{_shared → core}/lib-ts/context/context-selector.ts +8 -6
- package/dist/templates/{_shared → core}/lib-ts/context/context-store.ts +32 -20
- package/dist/templates/{_shared → core}/lib-ts/context/plan-manager.ts +19 -15
- package/dist/templates/{_shared → core}/lib-ts/context/task-tracker.ts +3 -3
- package/dist/templates/core/lib-ts/hooks/context-monitor-logic.ts +32 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/hooks}/hook-utils.ts +168 -41
- package/dist/templates/core/lib-ts/hooks/prompt-binding-logic.ts +80 -0
- package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +93 -0
- package/dist/templates/core/lib-ts/package.json +19 -0
- package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +295 -0
- package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +106 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/atomic-write.ts +12 -7
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/cli-args.ts +8 -6
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/constants.ts +326 -324
- package/dist/templates/core/lib-ts/runtime/executable-policy.ts +89 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/git-state.ts +6 -4
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/inference.ts +59 -10
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/lint-dispatch.ts +25 -23
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/logger.ts +32 -29
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/models.ts +2 -2
- package/dist/templates/core/lib-ts/runtime/platform-adapter.ts +33 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/preflight.ts +4 -3
- package/dist/templates/core/lib-ts/runtime/sentinel-ipc.ts +91 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/state-io.ts +11 -7
- package/dist/templates/core/lib-ts/runtime/stop-words.ts +185 -0
- package/dist/templates/core/lib-ts/runtime/subprocess-utils.ts +147 -0
- package/dist/templates/core/lib-ts/runtime/tmux-preflight.ts +93 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/utils.ts +4 -3
- package/dist/templates/{_shared → core}/lib-ts/templates/formatters.ts +7 -5
- package/dist/templates/{_shared → core}/lib-ts/templates/plan-context.ts +2 -1
- package/dist/templates/{_shared → core}/lib-ts/tsconfig.json +3 -1
- package/dist/templates/{_shared → core}/lib-ts/types.ts +78 -77
- package/dist/templates/core/scripts/resolve-run.ts +61 -0
- package/dist/templates/{_shared → core}/scripts/resolve_context.ts +3 -3
- package/dist/templates/{_shared → core}/scripts/status_line.ts +25 -20
- package/dist/templates/core/skills/codex/CLAUDE.md +78 -0
- package/dist/templates/{_shared → core}/skills/codex/SKILL.md +21 -18
- package/dist/templates/{_shared → core}/skills/codex/lib/codex-watcher.ts +76 -103
- package/dist/templates/{_shared → core}/skills/codex/scripts/launch-codex.ts +119 -133
- package/dist/templates/{_shared → core}/skills/codex/scripts/watch-codex.ts +6 -4
- package/dist/templates/core/skills/devin/CLAUDE.md +65 -0
- package/dist/templates/core/skills/devin/SKILL.md +73 -0
- package/dist/templates/core/skills/devin/lib/devin-watcher.ts +280 -0
- package/dist/templates/core/skills/devin/scripts/launch-devin.ts +257 -0
- package/dist/templates/{_shared → core}/skills/handoff-system/CLAUDE.md +436 -433
- package/dist/templates/{_shared → core}/skills/handoff-system/lib/document-generator.ts +9 -7
- package/dist/templates/{_shared → core}/skills/handoff-system/lib/handoff-reader.ts +6 -4
- package/dist/templates/{_shared → core}/skills/handoff-system/scripts/resume_handoff.ts +10 -8
- package/dist/templates/{_shared → core}/skills/handoff-system/scripts/save_handoff.ts +12 -10
- package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff-resume.md +2 -2
- package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff.md +6 -5
- package/dist/templates/{_shared → core}/skills/meta-plan/CLAUDE.md +2 -1
- package/dist/templates/{_shared → core}/skills/meta-plan/workflows/meta-plan.md +8 -7
- package/oclif.manifest.json +89 -13
- package/package.json +13 -12
- package/dist/templates/_shared/.claude/settings.json +0 -120
- package/dist/templates/_shared/.claude/skills/codex/SKILL.md +0 -35
- package/dist/templates/_shared/.claude/skills/handoff/SKILL.md +0 -13
- package/dist/templates/_shared/.claude/skills/handoff-resume/SKILL.md +0 -13
- package/dist/templates/_shared/.claude/skills/meta-plan/SKILL.md +0 -43
- package/dist/templates/_shared/.codex/workflows/codex.md +0 -11
- package/dist/templates/_shared/.codex/workflows/handoff.md +0 -226
- package/dist/templates/_shared/.codex/workflows/meta-plan.md +0 -347
- package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +0 -2
- package/dist/templates/_shared/hooks-ts/task_create_capture.ts +0 -48
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +0 -93
- package/dist/templates/_shared/lib-ts/base/launchers/tmux-launcher.ts +0 -173
- package/dist/templates/_shared/lib-ts/base/launchers/window-launcher.ts +0 -93
- package/dist/templates/_shared/lib-ts/base/launchers/wt-launcher.ts +0 -64
- package/dist/templates/_shared/lib-ts/base/pane-launcher.ts +0 -55
- package/dist/templates/_shared/lib-ts/base/sentinel-ipc.ts +0 -87
- package/dist/templates/_shared/lib-ts/base/stop-words.ts +0 -184
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +0 -249
- package/dist/templates/_shared/lib-ts/base/tmux-driver.ts +0 -341
- package/dist/templates/_shared/lib-ts/base/tmux-pane-placement.ts +0 -78
- package/dist/templates/_shared/lib-ts/package.json +0 -20
- package/dist/templates/_shared/scripts/resolve-run.ts +0 -62
- package/dist/templates/_shared/skills/codex/CLAUDE.md +0 -70
- /package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/index.ts +0 -0
|
@@ -5,128 +5,128 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// §1.1
|
|
8
|
-
export type Mode = "
|
|
8
|
+
export type Mode = "active" | "has_staged_work" | "idle";
|
|
9
9
|
|
|
10
10
|
export interface ContextState {
|
|
11
|
-
id: string;
|
|
12
|
-
status: "active" | "completed";
|
|
13
|
-
summary: string;
|
|
14
|
-
method: string;
|
|
15
|
-
tags: string[];
|
|
16
11
|
created_at: string;
|
|
12
|
+
/** @deprecated Use work_consumed instead */
|
|
13
|
+
handoff_consumed?: boolean;
|
|
14
|
+
handoff_path: null | string;
|
|
15
|
+
id: string;
|
|
17
16
|
last_active: string;
|
|
17
|
+
last_session: LastSession | null;
|
|
18
|
+
method: string;
|
|
18
19
|
mode: Mode;
|
|
19
|
-
|
|
20
|
-
plan_hash: string | null;
|
|
21
|
-
plan_signature: string | null;
|
|
22
|
-
plan_id: string | null;
|
|
20
|
+
next_artifact_type: "handoff" | "plan" | null; // Explicit artifact type for has_staged_work mode
|
|
23
21
|
plan_anchors: string[];
|
|
24
|
-
plan_hash_consumed: string | null;
|
|
25
|
-
handoff_path: string | null;
|
|
26
|
-
// Unified lifecycle fields (v0.13.0+)
|
|
27
|
-
work_consumed: boolean; // Replaces plan_consumed + handoff_consumed
|
|
28
|
-
next_artifact_type: "plan" | "handoff" | null; // Explicit artifact type for has_staged_work mode
|
|
29
22
|
// Deprecated fields (kept for migration)
|
|
30
23
|
/** @deprecated Use work_consumed instead */
|
|
31
24
|
plan_consumed?: boolean;
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
plan_hash: null | string;
|
|
26
|
+
plan_hash_consumed: null | string;
|
|
27
|
+
plan_id: null | string;
|
|
28
|
+
plan_path: null | string;
|
|
29
|
+
plan_signature: null | string;
|
|
34
30
|
session_ids: string[];
|
|
35
|
-
|
|
31
|
+
status: "active" | "completed";
|
|
32
|
+
summary: string;
|
|
33
|
+
tags: string[];
|
|
36
34
|
tasks: Task[];
|
|
35
|
+
// Unified lifecycle fields (v0.13.0+)
|
|
36
|
+
work_consumed: boolean; // Replaces plan_consumed + handoff_consumed
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// §1.2
|
|
40
40
|
export interface GitState {
|
|
41
41
|
branch?: string;
|
|
42
|
-
uncommitted_files?: string[];
|
|
43
42
|
last_commit_short?: string;
|
|
43
|
+
uncommitted_files?: string[];
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export interface LastSession {
|
|
47
|
-
session_id?: string;
|
|
48
|
-
saved_at?: string;
|
|
49
|
-
save_reason?: string;
|
|
50
|
-
transcript_path?: string;
|
|
51
47
|
context_remaining_pct?: number;
|
|
52
48
|
context_warnings_fired?: number[];
|
|
53
49
|
git_state?: GitState;
|
|
50
|
+
save_reason?: string;
|
|
51
|
+
saved_at?: string;
|
|
52
|
+
session_id?: string;
|
|
53
|
+
transcript_path?: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// §1.3
|
|
57
57
|
export interface Task {
|
|
58
|
-
id: string;
|
|
59
|
-
subject: string;
|
|
60
|
-
description: string;
|
|
61
58
|
active_form: string;
|
|
62
|
-
|
|
59
|
+
completed_at: null | string;
|
|
63
60
|
created_at: string;
|
|
64
|
-
|
|
61
|
+
description: string;
|
|
65
62
|
evidence: string;
|
|
66
|
-
work_summary: string;
|
|
67
63
|
files_changed: string[];
|
|
64
|
+
id: string;
|
|
68
65
|
session_id?: string;
|
|
66
|
+
status: "blocked" | "completed" | "in_progress" | "pending";
|
|
67
|
+
subject: string;
|
|
68
|
+
work_summary: string;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// §1.4
|
|
72
72
|
export interface IndexEntry {
|
|
73
|
-
summary: string;
|
|
74
|
-
mode: string;
|
|
75
73
|
last_active: string;
|
|
74
|
+
mode: string;
|
|
75
|
+
summary: string;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export interface IndexFile {
|
|
79
|
-
version: "3.0";
|
|
80
|
-
updated_at: string;
|
|
81
|
-
sessions: Record<string, string>;
|
|
82
79
|
contexts: Record<string, IndexEntry>;
|
|
80
|
+
sessions: Record<string, string>;
|
|
81
|
+
updated_at: string;
|
|
82
|
+
version: "3.0";
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// §1.5
|
|
86
86
|
export interface LogEntry {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
component?: string;
|
|
88
|
+
data?: unknown;
|
|
89
89
|
hook: string;
|
|
90
|
+
level: "debug" | "error" | "info" | "warn";
|
|
90
91
|
msg: string;
|
|
91
|
-
component?: string;
|
|
92
|
-
data?: any;
|
|
93
92
|
tb?: string;
|
|
93
|
+
ts: string;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// §1.6
|
|
97
97
|
export interface HookInput {
|
|
98
|
-
hook_event_name: string;
|
|
99
|
-
tool_name?: string;
|
|
100
|
-
tool_input?: Record<string, any>;
|
|
101
|
-
tool_result?: string;
|
|
102
|
-
session_id?: string;
|
|
103
|
-
cwd?: string;
|
|
104
|
-
transcript_path?: string;
|
|
105
98
|
context_window?: {
|
|
99
|
+
context_window_size?: number;
|
|
106
100
|
current_usage?: {
|
|
101
|
+
cache_creation_input_tokens?: number;
|
|
107
102
|
cache_read_input_tokens?: number;
|
|
108
103
|
input_tokens?: number;
|
|
109
|
-
cache_creation_input_tokens?: number;
|
|
110
104
|
output_tokens?: number;
|
|
111
105
|
};
|
|
112
|
-
context_window_size?: number;
|
|
113
106
|
};
|
|
107
|
+
cwd?: string;
|
|
108
|
+
hook_event_name: string;
|
|
114
109
|
permission_mode?: string;
|
|
110
|
+
session_id?: string;
|
|
115
111
|
source?: string;
|
|
112
|
+
tool_input?: Record<string, unknown>;
|
|
113
|
+
tool_name?: string;
|
|
114
|
+
tool_result?: string;
|
|
115
|
+
transcript_path?: string;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// §1.7 — Three hook output patterns (see hook-utils.ts for emit functions)
|
|
119
119
|
export interface HookOutput {
|
|
120
|
+
// Pattern 2: Top-level decision (UserPromptSubmit, Stop, SubagentStop)
|
|
121
|
+
decision?: "block";
|
|
120
122
|
// Pattern 1: hookSpecificOutput (PreToolUse, PostToolUse, UserPromptSubmit, etc.)
|
|
121
123
|
hookSpecificOutput?: {
|
|
122
|
-
hookEventName?: string;
|
|
123
124
|
additionalContext?: string;
|
|
124
|
-
|
|
125
|
+
hookEventName?: string;
|
|
126
|
+
permissionDecision?: "allow" | "ask" | "deny";
|
|
125
127
|
permissionDecisionReason?: string;
|
|
126
128
|
updatedInput?: Record<string, unknown>;
|
|
127
129
|
};
|
|
128
|
-
// Pattern 2: Top-level decision (UserPromptSubmit, Stop, SubagentStop)
|
|
129
|
-
decision?: "block";
|
|
130
130
|
reason?: string;
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -142,62 +142,63 @@ export interface PermissionRequestOutput {
|
|
|
142
142
|
|
|
143
143
|
// §1.8
|
|
144
144
|
export interface InferenceResult {
|
|
145
|
-
success: boolean;
|
|
146
|
-
output: string;
|
|
147
145
|
error?: string;
|
|
148
146
|
latency_ms: number;
|
|
147
|
+
output: string;
|
|
148
|
+
success: boolean;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// §1.9
|
|
152
152
|
export interface HandoffDocument {
|
|
153
|
+
active_tasks: Task[];
|
|
154
|
+
completed_tasks_this_session: Array<{ subject: string }>;
|
|
155
|
+
context_folder: string;
|
|
153
156
|
context_id: string;
|
|
154
157
|
context_summary: string;
|
|
155
|
-
session_id: string;
|
|
156
|
-
reason: string;
|
|
157
158
|
created_at: string;
|
|
158
|
-
plan_path: string | null;
|
|
159
|
-
context_folder: string;
|
|
160
159
|
events_log_path: string;
|
|
161
|
-
|
|
162
|
-
completed_tasks_this_session: Array<{ subject: string }>;
|
|
163
|
-
work_summary: string;
|
|
164
|
-
next_steps: string[];
|
|
160
|
+
file_path: null | string;
|
|
165
161
|
important_notes: string[];
|
|
166
|
-
|
|
162
|
+
next_steps: string[];
|
|
163
|
+
plan_path: null | string;
|
|
164
|
+
reason: string;
|
|
165
|
+
session_id: string;
|
|
166
|
+
work_summary: string;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// §1.10
|
|
170
170
|
export interface HandoffSections {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
completedWork: null | string;
|
|
172
|
+
context: null | string;
|
|
173
|
+
deadEnds: null | string;
|
|
174
|
+
decisions: null | string;
|
|
175
|
+
index: null | string;
|
|
176
|
+
pending: null | string;
|
|
177
|
+
plan: null | string;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
// §1.11
|
|
181
181
|
export interface CaretCommand {
|
|
182
182
|
ends: string[];
|
|
183
|
-
|
|
184
|
-
new_context_desc: string | null;
|
|
183
|
+
new_context_desc: null | string;
|
|
185
184
|
remaining_prompt: string;
|
|
185
|
+
select: null | string;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// §1.12 — Preflight types (shared across hooks)
|
|
189
|
-
// Re-exported from
|
|
190
|
-
export type {
|
|
189
|
+
// Re-exported from runtime/preflight.ts for convenience
|
|
190
|
+
export type { PreflightCheckResult, PreflightCommandConfig } from "./runtime/preflight.js";
|
|
191
191
|
|
|
192
192
|
// §1.13 — Agent configuration (shared across templates)
|
|
193
193
|
|
|
194
194
|
/** Configuration for a CLI review agent */
|
|
195
195
|
export interface AgentConfig {
|
|
196
|
-
name: string;
|
|
197
|
-
model: string;
|
|
198
|
-
provider: string; // e.g. "claude" | "codex" — assigned at runtime by assignModelsToAgents()
|
|
199
|
-
focus: string;
|
|
200
196
|
categories: string[];
|
|
201
197
|
description: string;
|
|
198
|
+
focus: string;
|
|
199
|
+
model: string;
|
|
200
|
+
name: string;
|
|
201
|
+
provider: string; // e.g. "claude" | "codex" — assigned at runtime by assignModelsToAgents()
|
|
202
202
|
system_prompt: string; // Markdown body content for --system-prompt
|
|
203
203
|
}
|
|
204
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform project root resolver for hook and status line commands.
|
|
4
|
+
*
|
|
5
|
+
* Finds the project root, sets cwd, then dynamically imports the target script
|
|
6
|
+
* in-process (no second bun spawn). stdin/stdout/stderr pass through naturally.
|
|
7
|
+
*
|
|
8
|
+
* Root detection strategy (fastest first):
|
|
9
|
+
* 1. Derive from this script's own location (O(1) — no I/O)
|
|
10
|
+
* 2. Walk up from cwd to find .aiwcli/ anchor (O(depth) — a few stat calls)
|
|
11
|
+
*
|
|
12
|
+
* Usage: bun .aiwcli/_core/scripts/resolve-run.ts .aiwcli/_core/hooks-ts/hook.ts
|
|
13
|
+
*/
|
|
14
|
+
import * as fs from "node:fs";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
|
|
17
|
+
function findProjectRoot(): string {
|
|
18
|
+
// 1. Derive from script location: .aiwcli/_core/scripts/resolve-run.ts → 3 levels up
|
|
19
|
+
const derived = path.resolve(import.meta.dir, "..", "..", "..");
|
|
20
|
+
if (fs.existsSync(path.join(derived, ".aiwcli"))) return derived;
|
|
21
|
+
|
|
22
|
+
// 2. Walk up from cwd to find .aiwcli/ anchor
|
|
23
|
+
let dir = process.cwd();
|
|
24
|
+
while (true) {
|
|
25
|
+
if (fs.existsSync(path.join(dir, ".aiwcli"))) return dir;
|
|
26
|
+
const parent = path.dirname(dir);
|
|
27
|
+
if (parent === dir) break;
|
|
28
|
+
dir = parent;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return process.cwd(); // last resort
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const target = process.argv[2];
|
|
35
|
+
if (!target) {
|
|
36
|
+
process.stderr.write("resolve-run: missing script path argument\n");
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const root = findProjectRoot();
|
|
41
|
+
const fullPath = path.resolve(root, target);
|
|
42
|
+
|
|
43
|
+
if (!fs.existsSync(fullPath)) {
|
|
44
|
+
process.stderr.write(`resolve-run: script not found: ${fullPath}\n`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Set up environment before importing the hook
|
|
49
|
+
process.env.AIW_CALLER_CWD = process.cwd();
|
|
50
|
+
|
|
51
|
+
// Scope FORCE_COLOR to status line only — other hooks may emit structured
|
|
52
|
+
// output that should not contain ANSI escape codes.
|
|
53
|
+
if (fullPath.endsWith("status_line.ts")) {
|
|
54
|
+
process.env.FORCE_COLOR ??= "2";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
process.chdir(root);
|
|
58
|
+
await import(fullPath);
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Resolve and print the active context ID.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* bun .aiwcli/
|
|
6
|
+
* bun .aiwcli/_core/scripts/resolve_context.ts
|
|
7
7
|
*
|
|
8
8
|
* Prints the context ID to stdout. Exits 1 if no active context found.
|
|
9
9
|
* Used by command templates (/handoff, /handoff-resume) to programmatically
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Requires CLAUDE_SESSION_ID environment variable (set by Claude Code).
|
|
13
13
|
*/
|
|
14
|
-
import { getProjectRoot } from "../lib-ts/base/constants.js";
|
|
15
|
-
import { eprint } from "../lib-ts/base/utils.js";
|
|
16
14
|
import { getContextBySessionId } from "../lib-ts/context/context-store.js";
|
|
15
|
+
import { getProjectRoot } from "../lib-ts/runtime/constants.js";
|
|
16
|
+
import { eprint } from "../lib-ts/runtime/utils.js";
|
|
17
17
|
|
|
18
18
|
const projectRoot = getProjectRoot(process.cwd());
|
|
19
19
|
const sessionId = process.env.CLAUDE_SESSION_ID;
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
import { execFileSync } from "node:child_process";
|
|
13
13
|
import * as fs from "node:fs";
|
|
14
14
|
import { homedir } from "node:os";
|
|
15
|
-
import
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
|
|
16
17
|
import type { ContextState } from "../lib-ts/types.js";
|
|
17
18
|
|
|
18
19
|
// PAI infrastructure imports — graceful fallback when libs aren't available
|
|
@@ -25,7 +26,7 @@ let saveState: (id: string, state: ContextState) => void = () => {};
|
|
|
25
26
|
let findLatestPlan: (contextId: string) => string | null = () => null;
|
|
26
27
|
|
|
27
28
|
try {
|
|
28
|
-
const hookUtils = await import("../lib-ts/
|
|
29
|
+
const hookUtils = await import("../lib-ts/hooks/hook-utils.js");
|
|
29
30
|
CONTEXT_BASELINE_TOKENS = hookUtils.CONTEXT_BASELINE_TOKENS;
|
|
30
31
|
} catch {
|
|
31
32
|
/* PAI hook-utils not available */
|
|
@@ -52,7 +53,7 @@ try {
|
|
|
52
53
|
// Path setup
|
|
53
54
|
// ---------------------------------------------------------------------------
|
|
54
55
|
const SCRIPT_DIR = path.dirname(new URL(import.meta.url).pathname);
|
|
55
|
-
// Resolve project root from script location (.aiwcli/
|
|
56
|
+
// Resolve project root from script location (.aiwcli/_core/scripts/) so paths
|
|
56
57
|
// work even when cwd has drifted via `cd` in a Bash tool call.
|
|
57
58
|
const PROJECT_ROOT = path.resolve(SCRIPT_DIR, "..", "..", "..");
|
|
58
59
|
const OUTPUT_DIR = path.join(PROJECT_ROOT, "_output");
|
|
@@ -213,19 +214,18 @@ function renderContextBar(width: number, pct: number): [string, string] {
|
|
|
213
214
|
// Display width helper — accounts for wide Unicode and ANSI escapes
|
|
214
215
|
// ---------------------------------------------------------------------------
|
|
215
216
|
|
|
216
|
-
|
|
217
|
-
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
217
|
+
const ANSI_RE = new RegExp(`${String.raw`\u001B`}\\[[0-9;]*m`, "g");
|
|
218
218
|
|
|
219
219
|
function isWideChar(cp: number): boolean {
|
|
220
220
|
return (
|
|
221
|
-
cp ===
|
|
222
|
-
cp ===
|
|
223
|
-
(cp >=
|
|
224
|
-
(cp >=
|
|
225
|
-
(cp >=
|
|
226
|
-
(cp >=
|
|
227
|
-
(cp >=
|
|
228
|
-
(cp >=
|
|
221
|
+
cp === 0x26_c1 || // ⛁ draughts man
|
|
222
|
+
cp === 0x23_f1 || // ⏱ stopwatch
|
|
223
|
+
(cp >= 0x26_00 && cp <= 0x26_ff) || // misc symbols
|
|
224
|
+
(cp >= 0x27_00 && cp <= 0x27_bf) || // dingbats
|
|
225
|
+
(cp >= 0x1_f3_00 && cp <= 0x1_fa_ff) || // emoji
|
|
226
|
+
(cp >= 0xfe_00 && cp <= 0xfe_0f) || // variation selectors
|
|
227
|
+
(cp >= 0x4e_00 && cp <= 0x9f_ff) || // CJK
|
|
228
|
+
(cp >= 0x30_00 && cp <= 0x30_3f) // CJK symbols
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
|
|
@@ -404,7 +404,7 @@ function runGit(args: string[], cwd: string, timeout = 2000): string | null {
|
|
|
404
404
|
const result = execFileSync("git", args, {
|
|
405
405
|
cwd,
|
|
406
406
|
timeout,
|
|
407
|
-
encoding: "
|
|
407
|
+
encoding: "utf8",
|
|
408
408
|
stdio: ["pipe", "pipe", "pipe"],
|
|
409
409
|
windowsHide: true,
|
|
410
410
|
});
|
|
@@ -687,12 +687,15 @@ function renderContextManager(
|
|
|
687
687
|
// Note: termWidth not available here — caller truncates via main()
|
|
688
688
|
switch (mode) {
|
|
689
689
|
case "micro":
|
|
690
|
-
case "nano":
|
|
690
|
+
case "nano": {
|
|
691
691
|
return `${CTX_ACCENT}\u25C6${RESET} ${SLATE_400}${truncatedId}${RESET}${modeBadge}`;
|
|
692
|
-
|
|
692
|
+
}
|
|
693
|
+
case "mini": {
|
|
693
694
|
return `${CTX_ACCENT}\u25C6${RESET} ${SLATE_400}${truncatedId}${RESET}${modeBadge}${planPart}`;
|
|
694
|
-
|
|
695
|
+
}
|
|
696
|
+
default: {
|
|
695
697
|
return `${CTX_ACCENT}\u25C6${RESET} ${CTX_SECONDARY}Context:${RESET} ${SLATE_300}${truncatedId}${RESET}${modeBadge}${planPart}`;
|
|
698
|
+
}
|
|
696
699
|
}
|
|
697
700
|
}
|
|
698
701
|
|
|
@@ -715,7 +718,7 @@ interface StatuslineCache {
|
|
|
715
718
|
function loadCache(): StatuslineCache {
|
|
716
719
|
try {
|
|
717
720
|
if (fs.existsSync(STATUSLINE_CACHE)) {
|
|
718
|
-
return JSON.parse(fs.readFileSync(STATUSLINE_CACHE, "
|
|
721
|
+
return JSON.parse(fs.readFileSync(STATUSLINE_CACHE, "utf8"));
|
|
719
722
|
}
|
|
720
723
|
} catch {
|
|
721
724
|
/* ignore */
|
|
@@ -726,7 +729,7 @@ function loadCache(): StatuslineCache {
|
|
|
726
729
|
function saveCache(cache: StatuslineCache): void {
|
|
727
730
|
try {
|
|
728
731
|
fs.mkdirSync(path.dirname(STATUSLINE_CACHE), { recursive: true });
|
|
729
|
-
fs.writeFileSync(STATUSLINE_CACHE, JSON.stringify(cache, null, 2), "
|
|
732
|
+
fs.writeFileSync(STATUSLINE_CACHE, JSON.stringify(cache, null, 2), "utf8");
|
|
730
733
|
} catch {
|
|
731
734
|
/* ignore */
|
|
732
735
|
}
|
|
@@ -810,7 +813,7 @@ function main(): void {
|
|
|
810
813
|
// Read JSON from stdin
|
|
811
814
|
let inputData: StatusLineInput;
|
|
812
815
|
try {
|
|
813
|
-
inputData = JSON.parse(fs.readFileSync(0, "
|
|
816
|
+
inputData = JSON.parse(fs.readFileSync(0, "utf8")) as StatusLineInput;
|
|
814
817
|
} catch {
|
|
815
818
|
inputData = {};
|
|
816
819
|
}
|
|
@@ -898,3 +901,5 @@ function main(): void {
|
|
|
898
901
|
}
|
|
899
902
|
|
|
900
903
|
main();
|
|
904
|
+
|
|
905
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Codex Skill
|
|
2
|
+
|
|
3
|
+
Launch Codex CLI in a visible pane (tmux on Unix, Windows Terminal/window fallback on native Windows) and pass the prompt at process start.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
codex/
|
|
9
|
+
├── CLAUDE.md ← This file
|
|
10
|
+
├── SKILL.md ← Skill metadata (user-invocable)
|
|
11
|
+
├── lib/
|
|
12
|
+
│ └── codex-watcher.ts ← Reusable watch/summarize library
|
|
13
|
+
└── scripts/
|
|
14
|
+
├── launch-codex.ts ← Single entry point (launch + optional watch)
|
|
15
|
+
└── watch-codex.ts ← Standalone watch mode
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Script: launch-codex.ts
|
|
19
|
+
|
|
20
|
+
> Note: This file documents template source paths (`.aiwcli/_core/...`). During installation, settings command paths are normalized to runtime `.aiwcli/_core/...`.
|
|
21
|
+
|
|
22
|
+
**Usage:**
|
|
23
|
+
```bash
|
|
24
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--prompt <text>] [--no-yolo] [--no-watch] [--context <id>] plan
|
|
25
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--prompt <text>] [--no-yolo] [--no-watch] [--context <id>] --file <path>
|
|
26
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--prompt <text>] [--no-yolo] [--no-watch] [--context <id>] <inline text...>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Args:**
|
|
30
|
+
- `plan` — discover active plan via context system, build a bootstrap startup prompt that includes the plan filepath (Codex reads that file directly)
|
|
31
|
+
- `--file <path>` — build a bootstrap startup prompt that includes the file path (Codex reads that file directly)
|
|
32
|
+
- `<text...>` — join remaining args as inline prompt
|
|
33
|
+
- `--model <alias|tier|id>` — Aliases: `spark` → `gpt-5.3-codex-spark`, `codex` → `gpt-5.4`, `gpt` → `gpt-5.4`. Tiers: `fast`/`standard`/`smart` (resolved via `resolveModelForProvider()`). Or a full model ID.
|
|
34
|
+
- `--sandbox <mode>` — `read-only`, `workspace-write`, or `danger-full-access`. Default is `danger-full-access`.
|
|
35
|
+
- `--prompt <text>` — append extra instructions. In `plan` and `--file` modes, these are embedded into a bootstrap temp file alongside the target path.
|
|
36
|
+
- `--no-yolo` — Disable YOLO mode (`--dangerously-bypass-approvals-and-sandbox`).
|
|
37
|
+
- `--no-watch` — Disable watch/summarize mode.
|
|
38
|
+
|
|
39
|
+
**Plan discovery order:**
|
|
40
|
+
1. `CLAUDE_SESSION_ID` env → `getContextBySessionId()` → `findLatestPlan(contextId)`
|
|
41
|
+
2. Fallback: scan `_output/contexts/*/plans/*.md` by mtime
|
|
42
|
+
|
|
43
|
+
**Dependencies:**
|
|
44
|
+
- `runtime/aiw-cli.ts` — shells out to `aiw launch` for pane management (no direct tmux imports)
|
|
45
|
+
- `runtime/cli-args.ts` — model/sandbox/yolo CLI arg generation
|
|
46
|
+
- `context/*` — context lookup, formatting, plan discovery
|
|
47
|
+
|
|
48
|
+
**Watch behavior (single entry point):**
|
|
49
|
+
- Watch is enabled by default.
|
|
50
|
+
- `launch-codex.ts` launches Codex, waits for completion (pane close or sentinel), and prints a summary.
|
|
51
|
+
- Summary cascade:
|
|
52
|
+
1. Session-file summary (`summarizeViaSessionFile`): Codex CLI Spark primary, `fast` tier (Haiku) fallback
|
|
53
|
+
2. `codex exec resume <session_id>` summary (output file, then stdout/stderr parse fallback)
|
|
54
|
+
3. Transcript-line fallback
|
|
55
|
+
4. Static `Summary unavailable` message
|
|
56
|
+
- Summary persistence:
|
|
57
|
+
- `persistSummary()` in `codex-watcher.ts` writes to `os.tmpdir()/codex-summary-<ts>-<id>.md`
|
|
58
|
+
- Called before stdout output — temp file survives even if background task capture fails
|
|
59
|
+
- Best-effort: logs warning on failure, returns null, stdout output still proceeds
|
|
60
|
+
- File path printed as `[summary_file:<path>]` marker for automated retrieval
|
|
61
|
+
|
|
62
|
+
**Design decisions:**
|
|
63
|
+
- Prompt is delivered at launch time (no tmux buffer paste/capture workflow)
|
|
64
|
+
- Pane backend detection delegated to `aiw launch` (tmux in-session only → inline exec fallback)
|
|
65
|
+
- `core` source only — runtime execution resolves to `.aiwcli/_core`
|
|
66
|
+
- Watch path is best-effort and does not change launch success semantics
|
|
67
|
+
|
|
68
|
+
## Library: lib/codex-watcher.ts
|
|
69
|
+
|
|
70
|
+
Reusable side-effect-free watch/summarize functions used by launch flow:
|
|
71
|
+
- `waitForPaneClose(target, timeoutMs?)` where `target` can be tmux pane id or `{ backend, paneId, sentinelPath }`
|
|
72
|
+
- `summarizeViaSessionFile(sessionFile)`
|
|
73
|
+
- `summarizeViaResume(sessionId)`
|
|
74
|
+
- `summarizeFromSessionFileFallback(sessionFile)`
|
|
75
|
+
- `collectTranscriptLines(sessionFile)`
|
|
76
|
+
|
|
77
|
+
Constants and helper utilities are exported for reuse and testing (`POLL_INTERVAL_MS`, `SUMMARY_UNAVAILABLE_MESSAGE`, `normalizeText`, `looksLikeBadSummary`, etc.).
|
|
78
|
+
|
|
@@ -9,19 +9,31 @@ The script blocks until Codex exits and prints a session summary. Run with Bash
|
|
|
9
9
|
## Command
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/
|
|
12
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [flags] <mode>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
**Modes:** `plan` | `--file <path>` | `<inline text...>`
|
|
16
16
|
|
|
17
|
+
`plan` and `--file` modes pass a filepath-first bootstrap prompt so Codex reads the file from disk instead of relying on a pasted full document.
|
|
18
|
+
|
|
17
19
|
**Flags:**
|
|
18
20
|
- `--context <id>` — Project orientation for the sub-agent. Pass when implementing a plan so Codex understands the project structure.
|
|
19
|
-
- `--prompt <text>` —
|
|
20
|
-
- `--model <name>` — Aliases: `spark`, `codex`, `gpt`. Tiers: `fast`, `standard`, `smart`. Or
|
|
21
|
+
- `--prompt <text>` — Add extra instructions. In `plan`/`--file` mode, this is embedded into the bootstrap temp file with the target path.
|
|
22
|
+
- `--model <name>` — Aliases: `spark`, `codex`, `gpt`. Tiers: `fast`, `standard`, `smart`. Or unknown full model ID.
|
|
21
23
|
- `--sandbox <mode>` — `read-only`, `workspace-write`, `danger-full-access`.
|
|
22
24
|
- `--no-yolo` — Disable YOLO mode (on by default).
|
|
23
25
|
- `--no-watch` — Fire-and-forget: exit immediately after launch, skip waiting for summary.
|
|
24
26
|
|
|
27
|
+
## Retrieving Results
|
|
28
|
+
|
|
29
|
+
The script prints a summary to stdout and writes it to a temp file.
|
|
30
|
+
|
|
31
|
+
**Primary:** Check TaskOutput for the background task — the summary and file path are inline.
|
|
32
|
+
|
|
33
|
+
**Fallback (if TaskOutput is empty):** Look for the `[summary_file:<path>]` line in the output. If found, read that file path directly. The temp file persists independently of Claude Code's background task capture.
|
|
34
|
+
|
|
35
|
+
If neither is available, check `_output/hook-log.jsonl` for `codex-capture` or `codex-skill` entries for diagnostics.
|
|
36
|
+
|
|
25
37
|
## Delegation Patterns
|
|
26
38
|
|
|
27
39
|
### One-shot
|
|
@@ -29,24 +41,14 @@ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-cod
|
|
|
29
41
|
For small or tightly coupled plans. One sub-agent implements the whole plan.
|
|
30
42
|
|
|
31
43
|
```bash
|
|
32
|
-
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/
|
|
44
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts --context <ctx-id> plan
|
|
33
45
|
```
|
|
34
46
|
|
|
35
47
|
Run with `run_in_background: true`. Wait for the summary. Review the changes.
|
|
36
48
|
|
|
37
49
|
### Parallel
|
|
38
50
|
|
|
39
|
-
For plans with independent sections
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# Sub-agent A — section 1
|
|
43
|
-
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts \
|
|
44
|
-
--context <ctx-id> --prompt "Implement section 1: Extract watch logic into lib/codex-watcher.ts" plan
|
|
45
|
-
|
|
46
|
-
# Sub-agent B — section 3
|
|
47
|
-
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts \
|
|
48
|
-
--context <ctx-id> --prompt "Implement section 3: Update launch-codex.ts arg parsing" plan
|
|
49
|
-
```
|
|
51
|
+
For plans with independent sections, create small section-brief files and launch one sub-agent per brief with `--file`.
|
|
50
52
|
|
|
51
53
|
Run each with `run_in_background: true`. Summaries arrive as separate background task notifications. When all complete, review for conflicts between agents, then verify with tests or import checks.
|
|
52
54
|
|
|
@@ -55,10 +57,10 @@ Run each with `run_in_background: true`. Summaries arrive as separate background
|
|
|
55
57
|
For tasks outside a plan. Pass inline text or a file path.
|
|
56
58
|
|
|
57
59
|
```bash
|
|
58
|
-
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/
|
|
60
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts \
|
|
59
61
|
"Fix the failing test in auth.ts"
|
|
60
62
|
|
|
61
|
-
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/
|
|
63
|
+
bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts \
|
|
62
64
|
--file path/to/task-description.md
|
|
63
65
|
```
|
|
64
66
|
|
|
@@ -67,5 +69,6 @@ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-cod
|
|
|
67
69
|
- **Delegate implementation.** If the work involves writing code and Codex can handle it, send it to Codex.
|
|
68
70
|
- **Split independent sections** into parallel sub-agents for faster execution.
|
|
69
71
|
- **Pass `--context`** when implementing a plan — Codex needs project orientation to make good decisions.
|
|
70
|
-
- **Scope
|
|
72
|
+
- **Scope parallel agents with separate `--file` briefs** so each sub-agent has an explicit task boundary.
|
|
71
73
|
- **Review results** when summaries arrive. Check for merge conflicts between parallel agents, then verify with `tsc --noEmit`, tests, or manual inspection.
|
|
74
|
+
|