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
|
@@ -1,98 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Initialize AIW tools and integrations with specified template method.
|
|
4
|
-
*/
|
|
5
|
-
export default class Init extends BaseCommand {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
interactive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
method: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
ide: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
help: import("@oclif/core/interfaces").BooleanFlag<void>;
|
|
14
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
};
|
|
16
|
-
run(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Copy directory recursively, excluding test files and cache
|
|
19
|
-
*
|
|
20
|
-
* @param src - Source directory path
|
|
21
|
-
* @param dest - Destination directory path
|
|
22
|
-
* @param excludeIdeFolders - If true, exclude IDE config folders (.claude, .windsurf, etc.)
|
|
23
|
-
*/
|
|
24
|
-
private copyDirectory;
|
|
25
|
-
/**
|
|
26
|
-
* Get description for a template
|
|
27
|
-
*
|
|
28
|
-
* @param template - Template name
|
|
29
|
-
* @returns Template description
|
|
30
|
-
*/
|
|
31
|
-
private getTemplateDescription;
|
|
32
|
-
/**
|
|
33
|
-
* Install the global resolve-run.ts script to ~/.aiwcli/bin/.
|
|
34
|
-
*
|
|
35
|
-
* This resolver allows hook and status line commands to find the project root
|
|
36
|
-
* regardless of cwd drift (e.g., after `cd` in a Bash tool call).
|
|
37
|
-
* Always overwrites to ensure the latest version is installed.
|
|
38
|
-
*/
|
|
39
|
-
private installGlobalResolver;
|
|
40
|
-
/**
|
|
41
|
-
* Perform minimal installation (_shared folder only, no template method).
|
|
42
|
-
*
|
|
43
|
-
* @param targetDir - Target directory for installation
|
|
44
|
-
* @param gitDir - Resolved git directory path, or null if not a git repo
|
|
45
|
-
*/
|
|
46
|
-
private performMinimalInstall;
|
|
47
|
-
/**
|
|
48
|
-
* Perform post-installation actions.
|
|
49
|
-
*
|
|
50
|
-
* Handles:
|
|
51
|
-
* - Method tracking in settings.json
|
|
52
|
-
* - Settings reconstruction from all active templates
|
|
53
|
-
* - .gitignore updates
|
|
54
|
-
*
|
|
55
|
-
* @param config - Post-install configuration
|
|
56
|
-
* @param config.targetDir - Project directory
|
|
57
|
-
* @param config.method - Method name that was installed
|
|
58
|
-
* @param config.ides - IDEs that were configured
|
|
59
|
-
* @param config.gitDir - Resolved git directory path, or null if not a git repo
|
|
60
|
-
* @param config.foldersForExclude - Folders to add to git exclude
|
|
61
|
-
*/
|
|
62
|
-
private performPostInstallActions;
|
|
63
|
-
/**
|
|
64
|
-
* Resolve installation configuration from flags or interactive wizard.
|
|
65
|
-
*
|
|
66
|
-
* Determines what to install based on:
|
|
67
|
-
* - Interactive wizard input
|
|
68
|
-
* - Command-line flags
|
|
69
|
-
* - Minimal install mode (no method specified)
|
|
70
|
-
*
|
|
71
|
-
* @param flags - Parsed command flags
|
|
72
|
-
* @param flags.interactive - Run interactive wizard
|
|
73
|
-
* @param flags.method - Template method to install
|
|
74
|
-
* @param flags.ide - IDEs to configure
|
|
75
|
-
* @param targetDir - Target directory for installation
|
|
76
|
-
* @param availableTemplates - List of available template names
|
|
77
|
-
* @returns Installation configuration or null for minimal install
|
|
78
|
-
*/
|
|
79
|
-
private resolveInstallationConfig;
|
|
80
|
-
/**
|
|
81
|
-
* Run interactive setup wizard
|
|
82
|
-
*
|
|
83
|
-
* @param targetDir - Target directory for installation
|
|
84
|
-
* @param availableTemplates - List of available template names
|
|
85
|
-
* @returns Wizard configuration result
|
|
86
|
-
*/
|
|
87
|
-
private runInteractiveWizard;
|
|
88
|
-
/**
|
|
89
|
-
* Track method installation in settings.json
|
|
90
|
-
*
|
|
91
|
-
* Adds method entry to the methods object with installation metadata.
|
|
92
|
-
*
|
|
93
|
-
* @param targetDir - Project directory
|
|
94
|
-
* @param method - Method name being installed
|
|
95
|
-
* @param ides - IDEs configured for this method
|
|
96
|
-
*/
|
|
97
|
-
private trackMethodInstallation;
|
|
98
|
-
}
|
|
1
|
+
export { default } from '../../capabilities/installation/control-plane/init-command.js';
|
|
@@ -1,478 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import checkbox from '@inquirer/checkbox';
|
|
6
|
-
import confirm from '@inquirer/confirm';
|
|
7
|
-
import input from '@inquirer/input';
|
|
8
|
-
import select from '@inquirer/select';
|
|
9
|
-
import { Flags } from '@oclif/core';
|
|
10
|
-
import BaseCommand from '../../lib/base-command.js';
|
|
11
|
-
import { AIW_EXCLUDE_ENTRIES, resolveGitDir, updateGitExclude } from '../../lib/git-exclude-manager.js';
|
|
12
|
-
import { IdePathResolver } from '../../lib/ide-path-resolver.js';
|
|
13
|
-
import { pathExists } from '../../lib/paths.js';
|
|
14
|
-
import { getTargetSettingsFile, readClaudeSettings, writeClaudeSettings } from '../../lib/settings-hierarchy.js';
|
|
15
|
-
import { checkTemplateStatus, installTemplate, shouldExclude } from '../../lib/template-installer.js';
|
|
16
|
-
import { getAvailableTemplates, getTemplatePath } from '../../lib/template-resolver.js';
|
|
17
|
-
import { reconstructIdeSettings } from '../../lib/template-settings-reconstructor.js';
|
|
18
|
-
import { detectUsername } from '../../lib/user-utils.js';
|
|
19
|
-
import { EXIT_CODES } from '../../types/exit-codes.js';
|
|
20
|
-
/**
|
|
21
|
-
* Available IDEs for configuration
|
|
22
|
-
*/
|
|
23
|
-
const AVAILABLE_IDES = [
|
|
24
|
-
{ value: 'claude', name: 'Claude Code', description: 'Anthropic Claude Code CLI' },
|
|
25
|
-
{ value: 'windsurf', name: 'Windsurf', description: 'Codeium Windsurf IDE' },
|
|
26
|
-
];
|
|
27
|
-
// detectGitRepository replaced by resolveGitDir from git-exclude-manager
|
|
28
|
-
/**
|
|
29
|
-
* Extract project name from directory path.
|
|
30
|
-
* Returns the basename of the given directory.
|
|
31
|
-
*/
|
|
32
|
-
function detectProjectName(targetDir) {
|
|
33
|
-
return basename(targetDir);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Initialize AIW tools and integrations with specified template method.
|
|
37
|
-
*/
|
|
38
|
-
export default class Init extends BaseCommand {
|
|
39
|
-
static description = 'Initialize AIW tools and integrations with specified template method';
|
|
40
|
-
static examples = [
|
|
41
|
-
'<%= config.bin %> <%= command.id %> --interactive',
|
|
42
|
-
'<%= config.bin %> <%= command.id %> --method cc-native',
|
|
43
|
-
'<%= config.bin %> <%= command.id %> --method cc-native --ide windsurf',
|
|
44
|
-
'<%= config.bin %> <%= command.id %> --method cc-native --ide claude --ide windsurf',
|
|
45
|
-
];
|
|
46
|
-
static flags = {
|
|
47
|
-
...BaseCommand.baseFlags,
|
|
48
|
-
interactive: Flags.boolean({
|
|
49
|
-
char: 'I',
|
|
50
|
-
description: 'Run interactive setup wizard',
|
|
51
|
-
default: false,
|
|
52
|
-
}),
|
|
53
|
-
method: Flags.string({
|
|
54
|
-
char: 'm',
|
|
55
|
-
description: 'Template method to initialize',
|
|
56
|
-
required: false,
|
|
57
|
-
}),
|
|
58
|
-
ide: Flags.string({
|
|
59
|
-
char: 'i',
|
|
60
|
-
default: ['claude'],
|
|
61
|
-
description: 'IDEs to configure (specify multiple: --ide claude --ide windsurf)',
|
|
62
|
-
multiple: true,
|
|
63
|
-
}),
|
|
64
|
-
};
|
|
65
|
-
async run() {
|
|
66
|
-
const { flags } = await this.parse(Init);
|
|
67
|
-
const targetDir = process.cwd();
|
|
68
|
-
try {
|
|
69
|
-
// Get available templates for validation
|
|
70
|
-
const availableTemplates = await getAvailableTemplates();
|
|
71
|
-
// Check git repository early (needed by both install paths)
|
|
72
|
-
const gitDir = await resolveGitDir(targetDir);
|
|
73
|
-
// Resolve installation configuration from flags or interactive wizard
|
|
74
|
-
const config = await this.resolveInstallationConfig(flags, targetDir, availableTemplates);
|
|
75
|
-
// If config is null, perform minimal install (shared folder only)
|
|
76
|
-
if (!config) {
|
|
77
|
-
await this.performMinimalInstall(targetDir, gitDir);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const { method, ides, username, projectName } = config;
|
|
81
|
-
// Validate write permissions
|
|
82
|
-
try {
|
|
83
|
-
const testFile = join(targetDir, '.aiwcli-write-test');
|
|
84
|
-
await fs.writeFile(testFile, '', 'utf8');
|
|
85
|
-
await fs.unlink(testFile);
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
this.error('Permission denied. Cannot write to current directory.', {
|
|
89
|
-
exit: EXIT_CODES.ENVIRONMENT_ERROR,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
// Get template path
|
|
93
|
-
const templatePath = await getTemplatePath(method);
|
|
94
|
-
// Check what already exists vs what's missing
|
|
95
|
-
const status = await checkTemplateStatus(templatePath, targetDir, ides, method);
|
|
96
|
-
this.logInfo(`Installing ${method} template for project: ${projectName}`);
|
|
97
|
-
this.logInfo(`Detected user: ${username}`);
|
|
98
|
-
this.logInfo(`Target IDEs: ${ides.join(', ')}`);
|
|
99
|
-
// Report existing items
|
|
100
|
-
if (status.existing.length > 0) {
|
|
101
|
-
this.log('');
|
|
102
|
-
this.logInfo('Already present (will be skipped):');
|
|
103
|
-
for (const item of status.existing) {
|
|
104
|
-
const suffix = item.isDirectory ? '/' : '';
|
|
105
|
-
this.log(` - ${item.name}${suffix}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// Report missing items that will be installed
|
|
109
|
-
if (status.missing.length > 0) {
|
|
110
|
-
this.log('');
|
|
111
|
-
this.logInfo('Will be installed:');
|
|
112
|
-
for (const item of status.missing) {
|
|
113
|
-
const suffix = item.isDirectory ? '/' : '';
|
|
114
|
-
this.log(` - ${item.name}${suffix}`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// If everything already exists, report and continue (don't block)
|
|
118
|
-
if (status.missing.length === 0) {
|
|
119
|
-
this.log('');
|
|
120
|
-
this.logInfo('All template items already exist. Nothing new to install.');
|
|
121
|
-
this.log('');
|
|
122
|
-
// Still update gitignore and merge hooks if needed
|
|
123
|
-
}
|
|
124
|
-
this.log('');
|
|
125
|
-
// Install template (always overwrites method-owned content)
|
|
126
|
-
const result = await installTemplate({
|
|
127
|
-
templateName: method,
|
|
128
|
-
targetDir,
|
|
129
|
-
ides,
|
|
130
|
-
username,
|
|
131
|
-
projectName,
|
|
132
|
-
templatePath,
|
|
133
|
-
});
|
|
134
|
-
// Collect all folders that need exclude entries
|
|
135
|
-
// The .aiwcli/ container holds all template infrastructure and runtime data
|
|
136
|
-
const foldersForExclude = [...AIW_EXCLUDE_ENTRIES];
|
|
137
|
-
// Report installation results
|
|
138
|
-
if (result.installedFolders.length > 0) {
|
|
139
|
-
this.logSuccess(`✓ Installed: ${result.installedFolders.join(', ')}`);
|
|
140
|
-
}
|
|
141
|
-
// Install global resolver for cwd-drift-proof hook/status line commands
|
|
142
|
-
await this.installGlobalResolver();
|
|
143
|
-
// Perform post-installation actions (settings tracking, hook merging, git exclude updates)
|
|
144
|
-
await this.performPostInstallActions({
|
|
145
|
-
targetDir,
|
|
146
|
-
method,
|
|
147
|
-
ides,
|
|
148
|
-
gitDir,
|
|
149
|
-
foldersForExclude,
|
|
150
|
-
});
|
|
151
|
-
this.log('');
|
|
152
|
-
this.logSuccess(`✓ ${method} initialized successfully`);
|
|
153
|
-
this.log('');
|
|
154
|
-
this.logInfo('Next steps:');
|
|
155
|
-
this.logInfo(' aiw launch Start Claude Code with agents');
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
const err = error;
|
|
159
|
-
// Categorize errors for better user feedback
|
|
160
|
-
// Check error codes first, then fall back to message matching
|
|
161
|
-
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
162
|
-
this.error(`Permission denied. Cannot write to current directory. ${err.message}`, {
|
|
163
|
-
exit: EXIT_CODES.ENVIRONMENT_ERROR,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
if (err.code === 'ENOENT' || err.message?.includes('not found') || err.message?.includes('not available')) {
|
|
167
|
-
this.error(err.message || 'Resource not found', { exit: EXIT_CODES.INVALID_USAGE });
|
|
168
|
-
}
|
|
169
|
-
// Generic error fallback
|
|
170
|
-
this.error(`Installation failed: ${err.message}`, {
|
|
171
|
-
exit: EXIT_CODES.GENERAL_ERROR,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Copy directory recursively, excluding test files and cache
|
|
177
|
-
*
|
|
178
|
-
* @param src - Source directory path
|
|
179
|
-
* @param dest - Destination directory path
|
|
180
|
-
* @param excludeIdeFolders - If true, exclude IDE config folders (.claude, .windsurf, etc.)
|
|
181
|
-
*/
|
|
182
|
-
async copyDirectory(src, dest, excludeIdeFolders = false) {
|
|
183
|
-
await fs.mkdir(dest, { recursive: true });
|
|
184
|
-
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
185
|
-
const operations = entries
|
|
186
|
-
.filter((entry) => {
|
|
187
|
-
// Standard exclusions (test files, cache, etc.)
|
|
188
|
-
if (shouldExclude(entry.name)) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
// Exclude IDE config folders if requested (used for _shared folder)
|
|
192
|
-
// These folders are used for settings merging, not direct installation
|
|
193
|
-
if (excludeIdeFolders && entry.isDirectory() && entry.name.startsWith('.')) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
})
|
|
198
|
-
.map(async (entry) => {
|
|
199
|
-
const srcPath = join(src, entry.name);
|
|
200
|
-
const destPath = join(dest, entry.name);
|
|
201
|
-
try {
|
|
202
|
-
return entry.isDirectory() ? await this.copyDirectory(srcPath, destPath, excludeIdeFolders) : await fs.copyFile(srcPath, destPath);
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
const err = error;
|
|
206
|
-
throw new Error(`Failed to copy ${srcPath} to ${destPath}: ${err.message}`);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
await Promise.all(operations);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Get description for a template
|
|
213
|
-
*
|
|
214
|
-
* @param template - Template name
|
|
215
|
-
* @returns Template description
|
|
216
|
-
*/
|
|
217
|
-
getTemplateDescription(template) {
|
|
218
|
-
const descriptions = {
|
|
219
|
-
'cc-native': 'CC-Native - Event-sourced context management with plan review',
|
|
220
|
-
};
|
|
221
|
-
return descriptions[template] || 'Custom template';
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Install the global resolve-run.ts script to ~/.aiwcli/bin/.
|
|
225
|
-
*
|
|
226
|
-
* This resolver allows hook and status line commands to find the project root
|
|
227
|
-
* regardless of cwd drift (e.g., after `cd` in a Bash tool call).
|
|
228
|
-
* Always overwrites to ensure the latest version is installed.
|
|
229
|
-
*/
|
|
230
|
-
async installGlobalResolver() {
|
|
231
|
-
try {
|
|
232
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
233
|
-
const currentDir = dirname(currentFilePath);
|
|
234
|
-
const templatesRoot = join(dirname(dirname(currentDir)), 'templates');
|
|
235
|
-
const resolverSrc = join(templatesRoot, '_shared', 'scripts', 'resolve-run.ts');
|
|
236
|
-
const globalBinDir = join(homedir(), '.aiwcli', 'bin');
|
|
237
|
-
const resolverDest = join(globalBinDir, 'resolve-run.ts');
|
|
238
|
-
await fs.mkdir(globalBinDir, { recursive: true });
|
|
239
|
-
await fs.copyFile(resolverSrc, resolverDest);
|
|
240
|
-
this.logSuccess('✓ Global resolver installed (~/.aiwcli/bin/resolve-run.ts)');
|
|
241
|
-
}
|
|
242
|
-
catch (error) {
|
|
243
|
-
const err = error;
|
|
244
|
-
this.warn(`Failed to install global resolver: ${err.message}`);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Perform minimal installation (_shared folder only, no template method).
|
|
249
|
-
*
|
|
250
|
-
* @param targetDir - Target directory for installation
|
|
251
|
-
* @param gitDir - Resolved git directory path, or null if not a git repo
|
|
252
|
-
*/
|
|
253
|
-
async performMinimalInstall(targetDir, gitDir) {
|
|
254
|
-
this.logInfo('Performing minimal installation (_shared folder only)...');
|
|
255
|
-
this.log('');
|
|
256
|
-
// Create .aiwcli container and install _shared
|
|
257
|
-
const resolver = new IdePathResolver(targetDir);
|
|
258
|
-
const containerDir = resolver.getAiwcliContainer();
|
|
259
|
-
await fs.mkdir(containerDir, { recursive: true });
|
|
260
|
-
const sharedDestPath = resolver.getSharedFolder();
|
|
261
|
-
const sharedExists = await pathExists(sharedDestPath);
|
|
262
|
-
if (sharedExists) {
|
|
263
|
-
this.logInfo('✓ _shared folder already exists - skipping');
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
267
|
-
const currentDir = dirname(currentFilePath);
|
|
268
|
-
const templatesRoot = join(dirname(dirname(currentDir)), 'templates');
|
|
269
|
-
const sharedSrcPath = join(templatesRoot, '_shared');
|
|
270
|
-
if (!(await pathExists(sharedSrcPath))) {
|
|
271
|
-
this.error(`Shared folder not found at ${sharedSrcPath}. This indicates a corrupted installation.`, {
|
|
272
|
-
exit: EXIT_CODES.ENVIRONMENT_ERROR,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
await this.copyDirectory(sharedSrcPath, sharedDestPath, true);
|
|
276
|
-
this.logSuccess('✓ Installed _shared folder');
|
|
277
|
-
}
|
|
278
|
-
// Install global resolver for cwd-drift-proof hook/status line commands
|
|
279
|
-
await this.installGlobalResolver();
|
|
280
|
-
// Reconstruct settings from _shared template
|
|
281
|
-
await reconstructIdeSettings(targetDir, [], ['claude']);
|
|
282
|
-
// Update git exclude if git repository exists
|
|
283
|
-
if (gitDir) {
|
|
284
|
-
await updateGitExclude(gitDir, [...AIW_EXCLUDE_ENTRIES]);
|
|
285
|
-
this.logSuccess('✓ git exclude updated');
|
|
286
|
-
}
|
|
287
|
-
this.log('');
|
|
288
|
-
this.logSuccess('✓ Minimal installation completed successfully');
|
|
289
|
-
this.log('');
|
|
290
|
-
this.logInfo('Next steps:');
|
|
291
|
-
this.logInfo(' aiw init --method <template> Install a full template method (cc-native)');
|
|
292
|
-
this.logInfo(' aiw init --interactive Run interactive setup wizard');
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Perform post-installation actions.
|
|
296
|
-
*
|
|
297
|
-
* Handles:
|
|
298
|
-
* - Method tracking in settings.json
|
|
299
|
-
* - Settings reconstruction from all active templates
|
|
300
|
-
* - .gitignore updates
|
|
301
|
-
*
|
|
302
|
-
* @param config - Post-install configuration
|
|
303
|
-
* @param config.targetDir - Project directory
|
|
304
|
-
* @param config.method - Method name that was installed
|
|
305
|
-
* @param config.ides - IDEs that were configured
|
|
306
|
-
* @param config.gitDir - Resolved git directory path, or null if not a git repo
|
|
307
|
-
* @param config.foldersForExclude - Folders to add to git exclude
|
|
308
|
-
*/
|
|
309
|
-
async performPostInstallActions(config) {
|
|
310
|
-
const { targetDir, method, ides, gitDir, foldersForExclude } = config;
|
|
311
|
-
// Track method installation in settings.json first (so reconstructor can read methods list)
|
|
312
|
-
await this.trackMethodInstallation(targetDir, method, ides);
|
|
313
|
-
// Read installed methods to build active templates list
|
|
314
|
-
const settingsPath = getTargetSettingsFile(targetDir);
|
|
315
|
-
const settings = await readClaudeSettings(settingsPath);
|
|
316
|
-
const activeTemplates = settings?.methods ? Object.keys(settings.methods) : [method];
|
|
317
|
-
// Reconstruct IDE settings from all active templates
|
|
318
|
-
await reconstructIdeSettings(targetDir, activeTemplates, ides);
|
|
319
|
-
this.logSuccess('✓ Reconstructed IDE settings from active templates');
|
|
320
|
-
// Update git exclude if git repository exists
|
|
321
|
-
if (gitDir) {
|
|
322
|
-
await updateGitExclude(gitDir, foldersForExclude);
|
|
323
|
-
this.logSuccess('✓ git exclude updated');
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Resolve installation configuration from flags or interactive wizard.
|
|
328
|
-
*
|
|
329
|
-
* Determines what to install based on:
|
|
330
|
-
* - Interactive wizard input
|
|
331
|
-
* - Command-line flags
|
|
332
|
-
* - Minimal install mode (no method specified)
|
|
333
|
-
*
|
|
334
|
-
* @param flags - Parsed command flags
|
|
335
|
-
* @param flags.interactive - Run interactive wizard
|
|
336
|
-
* @param flags.method - Template method to install
|
|
337
|
-
* @param flags.ide - IDEs to configure
|
|
338
|
-
* @param targetDir - Target directory for installation
|
|
339
|
-
* @param availableTemplates - List of available template names
|
|
340
|
-
* @returns Installation configuration or null for minimal install
|
|
341
|
-
*/
|
|
342
|
-
async resolveInstallationConfig(flags, targetDir, availableTemplates) {
|
|
343
|
-
if (flags.interactive) {
|
|
344
|
-
// Run interactive wizard
|
|
345
|
-
const wizardResult = await this.runInteractiveWizard(targetDir, availableTemplates);
|
|
346
|
-
if (!wizardResult.confirmed) {
|
|
347
|
-
this.log('Installation cancelled.');
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
return {
|
|
351
|
-
method: wizardResult.method,
|
|
352
|
-
ides: wizardResult.ides,
|
|
353
|
-
username: wizardResult.username,
|
|
354
|
-
projectName: wizardResult.projectName,
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
if (flags.method) {
|
|
358
|
-
// Use flags (method specified)
|
|
359
|
-
// Validate template exists
|
|
360
|
-
if (!availableTemplates.includes(flags.method)) {
|
|
361
|
-
this.error(`Template '${flags.method}' not found. Available templates: ${availableTemplates.join(', ')}`, {
|
|
362
|
-
exit: EXIT_CODES.INVALID_USAGE,
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
return {
|
|
366
|
-
method: flags.method,
|
|
367
|
-
ides: flags.ide,
|
|
368
|
-
username: await detectUsername(),
|
|
369
|
-
projectName: detectProjectName(targetDir),
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
// Minimal install mode - install only _shared folder
|
|
373
|
-
return null;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Run interactive setup wizard
|
|
377
|
-
*
|
|
378
|
-
* @param targetDir - Target directory for installation
|
|
379
|
-
* @param availableTemplates - List of available template names
|
|
380
|
-
* @returns Wizard configuration result
|
|
381
|
-
*/
|
|
382
|
-
async runInteractiveWizard(targetDir, availableTemplates) {
|
|
383
|
-
this.log('');
|
|
384
|
-
this.log('┌─────────────────────────────────────────┐');
|
|
385
|
-
this.log('│ AIW Interactive Setup Wizard │');
|
|
386
|
-
this.log('└─────────────────────────────────────────┘');
|
|
387
|
-
this.log('');
|
|
388
|
-
// Detect defaults
|
|
389
|
-
const detectedUsername = await detectUsername();
|
|
390
|
-
const detectedProjectName = detectProjectName(targetDir);
|
|
391
|
-
// Step 1: Select template method
|
|
392
|
-
const method = await select({
|
|
393
|
-
message: 'Select a template method:',
|
|
394
|
-
choices: availableTemplates.map((template) => ({
|
|
395
|
-
value: template,
|
|
396
|
-
name: template.toUpperCase(),
|
|
397
|
-
description: this.getTemplateDescription(template),
|
|
398
|
-
})),
|
|
399
|
-
});
|
|
400
|
-
this.log('');
|
|
401
|
-
// Step 2: Select IDEs
|
|
402
|
-
const ides = await checkbox({
|
|
403
|
-
message: 'Select IDEs to configure:',
|
|
404
|
-
choices: AVAILABLE_IDES.map((ide) => ({
|
|
405
|
-
value: ide.value,
|
|
406
|
-
name: ide.name,
|
|
407
|
-
checked: ide.value === 'claude', // Default to Claude selected
|
|
408
|
-
})),
|
|
409
|
-
required: true,
|
|
410
|
-
});
|
|
411
|
-
this.log('');
|
|
412
|
-
// Step 3: Confirm/edit username
|
|
413
|
-
const username = await input({
|
|
414
|
-
message: 'Username:',
|
|
415
|
-
default: detectedUsername,
|
|
416
|
-
});
|
|
417
|
-
// Step 4: Confirm/edit project name
|
|
418
|
-
const projectName = await input({
|
|
419
|
-
message: 'Project name:',
|
|
420
|
-
default: detectedProjectName,
|
|
421
|
-
});
|
|
422
|
-
this.log('');
|
|
423
|
-
// Step 5: Summary and confirmation
|
|
424
|
-
this.log('┌─────────────────────────────────────────┐');
|
|
425
|
-
this.log('│ Installation Summary │');
|
|
426
|
-
this.log('├─────────────────────────────────────────┤');
|
|
427
|
-
this.log(`│ Template: ${method.padEnd(24)}│`);
|
|
428
|
-
this.log(`│ IDEs: ${ides.join(', ').padEnd(24)}│`);
|
|
429
|
-
this.log(`│ Username: ${username.padEnd(24)}│`);
|
|
430
|
-
this.log(`│ Project: ${projectName.padEnd(24)}│`);
|
|
431
|
-
this.log(`│ Directory: ${basename(targetDir).padEnd(24)}│`);
|
|
432
|
-
this.log('└─────────────────────────────────────────┘');
|
|
433
|
-
this.log('');
|
|
434
|
-
const confirmed = await confirm({
|
|
435
|
-
message: 'Proceed with installation?',
|
|
436
|
-
default: true,
|
|
437
|
-
});
|
|
438
|
-
return {
|
|
439
|
-
method,
|
|
440
|
-
ides,
|
|
441
|
-
username,
|
|
442
|
-
projectName,
|
|
443
|
-
confirmed,
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Track method installation in settings.json
|
|
448
|
-
*
|
|
449
|
-
* Adds method entry to the methods object with installation metadata.
|
|
450
|
-
*
|
|
451
|
-
* @param targetDir - Project directory
|
|
452
|
-
* @param method - Method name being installed
|
|
453
|
-
* @param ides - IDEs configured for this method
|
|
454
|
-
*/
|
|
455
|
-
async trackMethodInstallation(targetDir, method, ides) {
|
|
456
|
-
try {
|
|
457
|
-
const settingsPath = getTargetSettingsFile(targetDir);
|
|
458
|
-
const existingSettings = (await readClaudeSettings(settingsPath)) || {};
|
|
459
|
-
// Add method tracking
|
|
460
|
-
const updatedSettings = {
|
|
461
|
-
...existingSettings,
|
|
462
|
-
methods: {
|
|
463
|
-
...existingSettings.methods,
|
|
464
|
-
[method]: {
|
|
465
|
-
ides,
|
|
466
|
-
installedAt: new Date().toISOString(),
|
|
467
|
-
},
|
|
468
|
-
},
|
|
469
|
-
};
|
|
470
|
-
await writeClaudeSettings(settingsPath, updatedSettings);
|
|
471
|
-
this.logSuccess(`✓ Method '${method}' tracked in settings.json`);
|
|
472
|
-
}
|
|
473
|
-
catch (error) {
|
|
474
|
-
const err = error;
|
|
475
|
-
this.warn(`Failed to track method installation: ${err.message}`);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
1
|
+
// The init command implementation now lives behind the installation capability.
|
|
2
|
+
// It still uses the same generic template flow built around `getAvailableTemplates`
|
|
3
|
+
// and `installTemplate`; this file is intentionally a thin command entrypoint.
|
|
4
|
+
export { default } from '../../capabilities/installation/control-plane/init-command.js';
|
|
@@ -1,30 +1,55 @@
|
|
|
1
|
-
import BaseCommand from '../
|
|
1
|
+
import BaseCommand from '../cli/base-command.js';
|
|
2
2
|
/**
|
|
3
|
-
* Launch Claude Code or
|
|
3
|
+
* Launch Claude Code, Codex, or Devin with AIW configuration.
|
|
4
4
|
*
|
|
5
5
|
* Spawns Claude Code CLI with --dangerously-skip-permissions flag,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Codex CLI with --yolo flag, or Devin CLI with --permission-mode dangerous,
|
|
7
|
+
* enabling unattended execution. Supports multiple parallel sessions.
|
|
8
|
+
*
|
|
9
|
+
* ## Multiplexer-first launch (preferred)
|
|
10
|
+
*
|
|
11
|
+
* When a terminal multiplexer is available (psmux on Windows, tmux on Unix),
|
|
12
|
+
* the launch flow is:
|
|
13
|
+
* - **Inside an existing session** → split a new pane in the current session
|
|
14
|
+
* - **Outside any session** → create a new multiplexer session with the REPL
|
|
15
|
+
*
|
|
16
|
+
* This gives persistent sessions, pane splitting, and scrollback.
|
|
17
|
+
* Use `--no-tmux` to bypass the multiplexer and launch inline.
|
|
18
|
+
*
|
|
19
|
+
* ## Inline fallback
|
|
20
|
+
*
|
|
21
|
+
* When no multiplexer is available (or `--no-tmux` is set), the REPL launches
|
|
22
|
+
* directly in the current terminal.
|
|
23
|
+
*
|
|
24
|
+
* ## Install multiplexer
|
|
25
|
+
* - Windows: `winget install psmux` (native ConPTY multiplexer)
|
|
26
|
+
* - Unix: `apt install tmux` / `brew install tmux`
|
|
9
27
|
*/
|
|
10
28
|
export default class LaunchCommand extends BaseCommand {
|
|
11
29
|
static description: string;
|
|
12
30
|
static examples: string[];
|
|
13
31
|
static flags: {
|
|
14
32
|
codex: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
devin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
env: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
36
|
new: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
37
|
'no-tmux': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
prompt: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
'prompt-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
40
|
+
'spawned-window': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
41
|
+
'prompt-path': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
split: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
43
|
'tmux-session': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
44
|
+
wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
45
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
46
|
help: import("@oclif/core/interfaces").BooleanFlag<void>;
|
|
20
47
|
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
48
|
};
|
|
22
49
|
run(): Promise<void>;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private sanitizeTmuxSessionName;
|
|
27
|
-
private buildUniqueTmuxSessionName;
|
|
28
|
-
private enableTmuxMouseIfPossible;
|
|
50
|
+
private buildUniqueSessionName;
|
|
51
|
+
private handleJsonOutput;
|
|
52
|
+
private sanitizeSessionName;
|
|
29
53
|
private shellQuote;
|
|
54
|
+
private waitForSentinel;
|
|
30
55
|
}
|