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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import BaseCommand from '../../../cli/base-command.js';
|
|
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[] | undefined, 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
|
+
* Get description for a template
|
|
19
|
+
*
|
|
20
|
+
* @param template - Template name
|
|
21
|
+
* @returns Template description
|
|
22
|
+
*/
|
|
23
|
+
private getTemplateDescription;
|
|
24
|
+
private handleRunError;
|
|
25
|
+
/**
|
|
26
|
+
* Install the global resolve-run.ts script to ~/.aiwcli/bin/.
|
|
27
|
+
*
|
|
28
|
+
* This resolver allows hook and status line commands to find the project root
|
|
29
|
+
* regardless of cwd drift (e.g., after `cd` in a Bash tool call).
|
|
30
|
+
* Always overwrites to ensure the latest version is installed.
|
|
31
|
+
*/
|
|
32
|
+
private installGlobalResolver;
|
|
33
|
+
/**
|
|
34
|
+
* Perform minimal installation (core runtime only, no template method).
|
|
35
|
+
*
|
|
36
|
+
* @param targetDir - Target directory for installation
|
|
37
|
+
* @param gitDir - Resolved git directory path, or null if not a git repo
|
|
38
|
+
*/
|
|
39
|
+
private performMinimalInstall;
|
|
40
|
+
/**
|
|
41
|
+
* Perform post-installation actions.
|
|
42
|
+
*
|
|
43
|
+
* Handles:
|
|
44
|
+
* - Method tracking in install-state.json
|
|
45
|
+
* - Settings reconstruction from all active templates
|
|
46
|
+
* - .gitignore updates
|
|
47
|
+
*
|
|
48
|
+
* @param config - Post-install configuration
|
|
49
|
+
* @param config.targetDir - Project directory
|
|
50
|
+
* @param config.method - Method name that was installed
|
|
51
|
+
* @param config.ides - IDEs that were configured
|
|
52
|
+
* @param config.gitDir - Resolved git directory path, or null if not a git repo
|
|
53
|
+
* @param config.foldersForExclude - Folders to add to git exclude
|
|
54
|
+
*/
|
|
55
|
+
private performPostInstallActions;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve installation configuration from flags or interactive wizard.
|
|
58
|
+
*
|
|
59
|
+
* Determines what to install based on:
|
|
60
|
+
* - Interactive wizard input
|
|
61
|
+
* - Command-line flags
|
|
62
|
+
* - Minimal install mode (no method specified)
|
|
63
|
+
*
|
|
64
|
+
* @param flags - Parsed command flags
|
|
65
|
+
* @param flags.interactive - Run interactive wizard
|
|
66
|
+
* @param flags.method - Template method to install
|
|
67
|
+
* @param flags.ide - IDEs to configure
|
|
68
|
+
* @param targetDir - Target directory for installation
|
|
69
|
+
* @param availableTemplates - List of available template names
|
|
70
|
+
* @returns Installation configuration, undefined for minimal install, or null if interactive setup was cancelled
|
|
71
|
+
*/
|
|
72
|
+
private resolveInstallationConfig;
|
|
73
|
+
/**
|
|
74
|
+
* Run interactive setup wizard
|
|
75
|
+
*
|
|
76
|
+
* @param targetDir - Target directory for installation
|
|
77
|
+
* @param availableTemplates - List of available template names
|
|
78
|
+
* @returns Wizard configuration result
|
|
79
|
+
*/
|
|
80
|
+
private runInteractiveWizard;
|
|
81
|
+
}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { basename, join } from 'node:path';
|
|
4
|
+
import checkbox from '@inquirer/checkbox';
|
|
5
|
+
import confirm from '@inquirer/confirm';
|
|
6
|
+
import input from '@inquirer/input';
|
|
7
|
+
import select from '@inquirer/select';
|
|
8
|
+
import { Flags } from '@oclif/core';
|
|
9
|
+
import BaseCommand from '../../../cli/base-command.js';
|
|
10
|
+
import { getCoreResolverSourcePath, installCoreAssets } from '../../../lib/core-installer.js';
|
|
11
|
+
import { AIW_EXCLUDE_ENTRIES, resolveGitDir, updateGitExclude } from '../../../lib/git-exclude-manager.js';
|
|
12
|
+
import { getInstalledMethods, markCoreInstalled, markMethodInstalled } from '../../../lib/install-state.js';
|
|
13
|
+
import { checkTemplateStatus, installTemplate } from '../../../lib/template-installer.js';
|
|
14
|
+
import { getAvailableTemplates, getTemplateIdeNamesByPath, getTemplatePath } from '../../../lib/template-resolver.js';
|
|
15
|
+
import { reconstructIdeSettings } from '../../../lib/template-settings-reconstructor.js';
|
|
16
|
+
import { detectUsername } from '../../../lib/user-utils.js';
|
|
17
|
+
import { EXIT_CODES } from '../../../types/exit-codes.js';
|
|
18
|
+
/**
|
|
19
|
+
* Available IDEs for configuration
|
|
20
|
+
*/
|
|
21
|
+
const KNOWN_IDES = [
|
|
22
|
+
{ value: 'claude', name: 'Claude Code', description: 'Anthropic Claude Code CLI' },
|
|
23
|
+
{ value: 'codex', name: 'Codex CLI', description: 'OpenAI Codex CLI skills' },
|
|
24
|
+
{ value: 'cognition', name: 'Cognition', description: 'Cognition (Devin) IDE' },
|
|
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
|
+
function normalizeIdeList(ides) {
|
|
36
|
+
const normalized = ides
|
|
37
|
+
.map((ide) => ide.trim().toLowerCase())
|
|
38
|
+
.filter((ide) => ide.length > 0);
|
|
39
|
+
return [...new Set(normalized)];
|
|
40
|
+
}
|
|
41
|
+
function intersectIdes(requested, available) {
|
|
42
|
+
const availableSet = new Set(available);
|
|
43
|
+
return requested.filter((ide) => availableSet.has(ide));
|
|
44
|
+
}
|
|
45
|
+
function differenceIdes(left, right) {
|
|
46
|
+
const rightSet = new Set(right);
|
|
47
|
+
return left.filter((ide) => !rightSet.has(ide));
|
|
48
|
+
}
|
|
49
|
+
function toIdeExcludeEntries(ides) {
|
|
50
|
+
return [...new Set(ides.map((ide) => `.${ide}`))];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Initialize AIW tools and integrations with specified template method.
|
|
54
|
+
*/
|
|
55
|
+
export default class Init extends BaseCommand {
|
|
56
|
+
static description = 'Initialize AIW tools and integrations with specified template method';
|
|
57
|
+
static examples = [
|
|
58
|
+
'<%= config.bin %> <%= command.id %> --interactive',
|
|
59
|
+
'<%= config.bin %> <%= command.id %> --method cc-native',
|
|
60
|
+
'<%= config.bin %> <%= command.id %> --method cc-native --ide windsurf',
|
|
61
|
+
'<%= config.bin %> <%= command.id %> --method cc-native --ide claude --ide windsurf',
|
|
62
|
+
];
|
|
63
|
+
static flags = {
|
|
64
|
+
...BaseCommand.baseFlags,
|
|
65
|
+
interactive: Flags.boolean({
|
|
66
|
+
char: 'I',
|
|
67
|
+
description: 'Run interactive setup wizard',
|
|
68
|
+
default: false,
|
|
69
|
+
}),
|
|
70
|
+
method: Flags.string({
|
|
71
|
+
char: 'm',
|
|
72
|
+
description: 'Template method to initialize',
|
|
73
|
+
required: false,
|
|
74
|
+
}),
|
|
75
|
+
ide: Flags.string({
|
|
76
|
+
char: 'i',
|
|
77
|
+
description: 'IDEs to configure. When omitted, uses all IDEs discovered in core + selected template',
|
|
78
|
+
multiple: true,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
81
|
+
async run() {
|
|
82
|
+
const { flags } = await this.parse(Init);
|
|
83
|
+
const targetDir = process.cwd();
|
|
84
|
+
try {
|
|
85
|
+
// Get available templates for validation
|
|
86
|
+
const availableTemplates = await getAvailableTemplates();
|
|
87
|
+
// Check git repository early (needed by both install paths)
|
|
88
|
+
const gitDir = await resolveGitDir(targetDir);
|
|
89
|
+
// Resolve installation configuration from flags or interactive wizard
|
|
90
|
+
const config = await this.resolveInstallationConfig(flags, targetDir, availableTemplates);
|
|
91
|
+
// Interactive cancellation returns null; undefined means minimal install.
|
|
92
|
+
if (config === null)
|
|
93
|
+
return;
|
|
94
|
+
if (config === undefined) {
|
|
95
|
+
await this.performMinimalInstall(targetDir, gitDir);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const { method, ides, username, projectName } = config;
|
|
99
|
+
// Validate write permissions
|
|
100
|
+
try {
|
|
101
|
+
const testFile = join(targetDir, '.aiwcli-write-test');
|
|
102
|
+
await fs.writeFile(testFile, '', 'utf8');
|
|
103
|
+
await fs.unlink(testFile);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
this.error('Permission denied. Cannot write to current directory.', {
|
|
107
|
+
exit: EXIT_CODES.ENVIRONMENT_ERROR,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// Resolve template + available IDE sets
|
|
111
|
+
const templatePath = await getTemplatePath(method);
|
|
112
|
+
const coreTemplatePath = await getTemplatePath('core');
|
|
113
|
+
const coreAvailableIdes = await getTemplateIdeNamesByPath(coreTemplatePath);
|
|
114
|
+
const methodAvailableIdes = await getTemplateIdeNamesByPath(templatePath);
|
|
115
|
+
const discoveredIdes = [...new Set([...coreAvailableIdes, ...methodAvailableIdes])].sort((a, b) => a.localeCompare(b));
|
|
116
|
+
const requestedIdes = ides.length > 0 ? normalizeIdeList(ides) : discoveredIdes;
|
|
117
|
+
const coreIdesToInstall = intersectIdes(requestedIdes, coreAvailableIdes);
|
|
118
|
+
const methodIdesToInstall = intersectIdes(requestedIdes, methodAvailableIdes);
|
|
119
|
+
const coreSkipped = differenceIdes(requestedIdes, coreAvailableIdes);
|
|
120
|
+
if (coreSkipped.length > 0) {
|
|
121
|
+
this.warn(`Skipping core IDEs not available in core: ${coreSkipped.join(', ')}`);
|
|
122
|
+
}
|
|
123
|
+
const methodSkipped = differenceIdes(requestedIdes, methodAvailableIdes);
|
|
124
|
+
if (methodSkipped.length > 0) {
|
|
125
|
+
this.warn(`Skipping method IDEs not available for '${method}': ${methodSkipped.join(', ')}`);
|
|
126
|
+
}
|
|
127
|
+
// Install core runtime first (shared across all methods)
|
|
128
|
+
const coreInstalledFolders = await installCoreAssets(targetDir, coreIdesToInstall);
|
|
129
|
+
await markCoreInstalled(targetDir, coreIdesToInstall);
|
|
130
|
+
// Check what already exists vs what's missing
|
|
131
|
+
const status = await checkTemplateStatus(templatePath, targetDir, methodIdesToInstall, method);
|
|
132
|
+
this.logInfo(`Installing ${method} template for project: ${projectName}`);
|
|
133
|
+
this.logInfo(`Detected user: ${username}`);
|
|
134
|
+
this.logInfo(`Target IDEs (requested): ${requestedIdes.join(', ')}`);
|
|
135
|
+
this.logInfo(`Target IDEs (core): ${coreIdesToInstall.join(', ') || '(none)'}`);
|
|
136
|
+
this.logInfo(`Target IDEs (${method}): ${methodIdesToInstall.join(', ') || '(none)'}`);
|
|
137
|
+
// Report existing items
|
|
138
|
+
if (status.existing.length > 0) {
|
|
139
|
+
this.log('');
|
|
140
|
+
this.logInfo('Already present (will be skipped):');
|
|
141
|
+
for (const item of status.existing) {
|
|
142
|
+
const suffix = item.isDirectory ? '/' : '';
|
|
143
|
+
this.log(` - ${item.name}${suffix}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Report missing items that will be installed
|
|
147
|
+
if (status.missing.length > 0) {
|
|
148
|
+
this.log('');
|
|
149
|
+
this.logInfo('Will be installed:');
|
|
150
|
+
for (const item of status.missing) {
|
|
151
|
+
const suffix = item.isDirectory ? '/' : '';
|
|
152
|
+
this.log(` - ${item.name}${suffix}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// If everything already exists, report and continue (don't block)
|
|
156
|
+
if (status.missing.length === 0) {
|
|
157
|
+
this.log('');
|
|
158
|
+
this.logInfo('All template items already exist. Nothing new to install.');
|
|
159
|
+
this.log('');
|
|
160
|
+
// Still update gitignore and merge hooks if needed
|
|
161
|
+
}
|
|
162
|
+
this.log('');
|
|
163
|
+
// Install template (always overwrites method-owned content)
|
|
164
|
+
const result = await installTemplate({
|
|
165
|
+
templateName: method,
|
|
166
|
+
targetDir,
|
|
167
|
+
ides: methodIdesToInstall,
|
|
168
|
+
username,
|
|
169
|
+
projectName,
|
|
170
|
+
templatePath,
|
|
171
|
+
});
|
|
172
|
+
// Collect all folders that need exclude entries.
|
|
173
|
+
// Include defaults plus all IDE directories actually installed this run.
|
|
174
|
+
const installedIdeExcludes = toIdeExcludeEntries([...coreIdesToInstall, ...methodIdesToInstall]);
|
|
175
|
+
const foldersForExclude = [...new Set([...AIW_EXCLUDE_ENTRIES, ...installedIdeExcludes])];
|
|
176
|
+
if (coreInstalledFolders.length > 0) {
|
|
177
|
+
this.logSuccess(`✓ Installed core: ${coreInstalledFolders.join(', ')}`);
|
|
178
|
+
}
|
|
179
|
+
// Report installation results
|
|
180
|
+
if (result.installedFolders.length > 0) {
|
|
181
|
+
this.logSuccess(`✓ Installed: ${result.installedFolders.join(', ')}`);
|
|
182
|
+
}
|
|
183
|
+
// Install global resolver for cwd-drift-proof hook/status line commands
|
|
184
|
+
await this.installGlobalResolver();
|
|
185
|
+
// Perform post-installation actions (settings tracking, hook merging, git exclude updates)
|
|
186
|
+
await this.performPostInstallActions({
|
|
187
|
+
targetDir,
|
|
188
|
+
method,
|
|
189
|
+
ides: [...new Set([...coreIdesToInstall, ...methodIdesToInstall])],
|
|
190
|
+
gitDir,
|
|
191
|
+
foldersForExclude,
|
|
192
|
+
});
|
|
193
|
+
this.log('');
|
|
194
|
+
this.logSuccess(`✓ ${method} initialized successfully`);
|
|
195
|
+
this.log('');
|
|
196
|
+
this.logInfo('Next steps:');
|
|
197
|
+
this.logInfo(' aiw launch Start Claude Code with agents');
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
this.handleRunError(error);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get description for a template
|
|
205
|
+
*
|
|
206
|
+
* @param template - Template name
|
|
207
|
+
* @returns Template description
|
|
208
|
+
*/
|
|
209
|
+
getTemplateDescription(template) {
|
|
210
|
+
const descriptions = {
|
|
211
|
+
'cc-native': 'CC-Native - Event-sourced context management with plan review',
|
|
212
|
+
};
|
|
213
|
+
return descriptions[template] || 'Custom template';
|
|
214
|
+
}
|
|
215
|
+
handleRunError(error) {
|
|
216
|
+
const err = error;
|
|
217
|
+
// Categorize errors for better user feedback
|
|
218
|
+
// Check error codes first, then fall back to message matching
|
|
219
|
+
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
220
|
+
this.error(`Permission denied. Cannot write to current directory. ${err.message}`, {
|
|
221
|
+
exit: EXIT_CODES.ENVIRONMENT_ERROR,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (err.code === 'ENOENT' || err.message?.includes('not found') || err.message?.includes('not available')) {
|
|
225
|
+
this.error(err.message || 'Resource not found', { exit: EXIT_CODES.INVALID_USAGE });
|
|
226
|
+
}
|
|
227
|
+
this.error(`Installation failed: ${err.message}`, {
|
|
228
|
+
exit: EXIT_CODES.GENERAL_ERROR,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Install the global resolve-run.ts script to ~/.aiwcli/bin/.
|
|
233
|
+
*
|
|
234
|
+
* This resolver allows hook and status line commands to find the project root
|
|
235
|
+
* regardless of cwd drift (e.g., after `cd` in a Bash tool call).
|
|
236
|
+
* Always overwrites to ensure the latest version is installed.
|
|
237
|
+
*/
|
|
238
|
+
async installGlobalResolver() {
|
|
239
|
+
try {
|
|
240
|
+
const resolverSrc = getCoreResolverSourcePath();
|
|
241
|
+
const globalBinDir = join(homedir(), '.aiwcli', 'bin');
|
|
242
|
+
const resolverDest = join(globalBinDir, 'resolve-run.ts');
|
|
243
|
+
await fs.mkdir(globalBinDir, { recursive: true });
|
|
244
|
+
await fs.copyFile(resolverSrc, resolverDest);
|
|
245
|
+
this.logSuccess('✓ Global resolver installed (~/.aiwcli/bin/resolve-run.ts)');
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
const err = error;
|
|
249
|
+
this.warn(`Failed to install global resolver: ${err.message}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Perform minimal installation (core runtime only, no template method).
|
|
254
|
+
*
|
|
255
|
+
* @param targetDir - Target directory for installation
|
|
256
|
+
* @param gitDir - Resolved git directory path, or null if not a git repo
|
|
257
|
+
*/
|
|
258
|
+
async performMinimalInstall(targetDir, gitDir) {
|
|
259
|
+
this.logInfo('Performing minimal installation (_core runtime only)...');
|
|
260
|
+
this.log('');
|
|
261
|
+
const coreTemplatePath = await getTemplatePath('core');
|
|
262
|
+
const discoveredCoreIdes = await getTemplateIdeNamesByPath(coreTemplatePath);
|
|
263
|
+
// Install core runtime payload and base IDE shared artifacts
|
|
264
|
+
const installedFolders = await installCoreAssets(targetDir, discoveredCoreIdes);
|
|
265
|
+
await markCoreInstalled(targetDir, discoveredCoreIdes);
|
|
266
|
+
this.logSuccess(`✓ Installed: ${installedFolders.join(', ')}`);
|
|
267
|
+
// Install global resolver for cwd-drift-proof hook/status line commands
|
|
268
|
+
await this.installGlobalResolver();
|
|
269
|
+
// Reconstruct settings from core base plus any existing method templates.
|
|
270
|
+
await reconstructIdeSettings(targetDir, await getInstalledMethods(targetDir), discoveredCoreIdes);
|
|
271
|
+
// Update git exclude if git repository exists
|
|
272
|
+
if (gitDir) {
|
|
273
|
+
const ideExcludeEntries = toIdeExcludeEntries(discoveredCoreIdes);
|
|
274
|
+
await updateGitExclude(gitDir, [...new Set([...AIW_EXCLUDE_ENTRIES, ...ideExcludeEntries])]);
|
|
275
|
+
this.logSuccess('✓ git exclude updated');
|
|
276
|
+
}
|
|
277
|
+
this.log('');
|
|
278
|
+
this.logSuccess('✓ Minimal installation completed successfully');
|
|
279
|
+
this.log('');
|
|
280
|
+
this.logInfo('Next steps:');
|
|
281
|
+
this.logInfo(' aiw init --method <template> Install a full template method (cc-native)');
|
|
282
|
+
this.logInfo(' aiw init --interactive Run interactive setup wizard');
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Perform post-installation actions.
|
|
286
|
+
*
|
|
287
|
+
* Handles:
|
|
288
|
+
* - Method tracking in install-state.json
|
|
289
|
+
* - Settings reconstruction from all active templates
|
|
290
|
+
* - .gitignore updates
|
|
291
|
+
*
|
|
292
|
+
* @param config - Post-install configuration
|
|
293
|
+
* @param config.targetDir - Project directory
|
|
294
|
+
* @param config.method - Method name that was installed
|
|
295
|
+
* @param config.ides - IDEs that were configured
|
|
296
|
+
* @param config.gitDir - Resolved git directory path, or null if not a git repo
|
|
297
|
+
* @param config.foldersForExclude - Folders to add to git exclude
|
|
298
|
+
*/
|
|
299
|
+
async performPostInstallActions(config) {
|
|
300
|
+
const { targetDir, method, ides, gitDir, foldersForExclude } = config;
|
|
301
|
+
// Record installation before reconstruction so install-state can drive active templates.
|
|
302
|
+
await markMethodInstalled(targetDir, method, ides);
|
|
303
|
+
// Read installed methods to build the active templates list.
|
|
304
|
+
const activeTemplates = await getInstalledMethods(targetDir);
|
|
305
|
+
// Reconstruct IDE settings from all active templates.
|
|
306
|
+
await reconstructIdeSettings(targetDir, activeTemplates.length > 0 ? activeTemplates : [method], ides);
|
|
307
|
+
this.logSuccess('✓ Reconstructed IDE settings from active templates');
|
|
308
|
+
// Update git exclude if git repository exists
|
|
309
|
+
if (gitDir) {
|
|
310
|
+
await updateGitExclude(gitDir, foldersForExclude);
|
|
311
|
+
this.logSuccess('✓ git exclude updated');
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Resolve installation configuration from flags or interactive wizard.
|
|
316
|
+
*
|
|
317
|
+
* Determines what to install based on:
|
|
318
|
+
* - Interactive wizard input
|
|
319
|
+
* - Command-line flags
|
|
320
|
+
* - Minimal install mode (no method specified)
|
|
321
|
+
*
|
|
322
|
+
* @param flags - Parsed command flags
|
|
323
|
+
* @param flags.interactive - Run interactive wizard
|
|
324
|
+
* @param flags.method - Template method to install
|
|
325
|
+
* @param flags.ide - IDEs to configure
|
|
326
|
+
* @param targetDir - Target directory for installation
|
|
327
|
+
* @param availableTemplates - List of available template names
|
|
328
|
+
* @returns Installation configuration, undefined for minimal install, or null if interactive setup was cancelled
|
|
329
|
+
*/
|
|
330
|
+
async resolveInstallationConfig(flags, targetDir, availableTemplates) {
|
|
331
|
+
if (flags.interactive) {
|
|
332
|
+
// Run interactive wizard
|
|
333
|
+
const wizardResult = await this.runInteractiveWizard(targetDir, availableTemplates);
|
|
334
|
+
if (!wizardResult.confirmed) {
|
|
335
|
+
this.log('Installation cancelled.');
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
method: wizardResult.method,
|
|
340
|
+
ides: wizardResult.ides,
|
|
341
|
+
username: wizardResult.username,
|
|
342
|
+
projectName: wizardResult.projectName,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
if (flags.method) {
|
|
346
|
+
// Use flags (method specified)
|
|
347
|
+
// Validate template exists
|
|
348
|
+
if (!availableTemplates.includes(flags.method)) {
|
|
349
|
+
this.error(`Template '${flags.method}' not found. Available templates: ${availableTemplates.join(', ')}`, {
|
|
350
|
+
exit: EXIT_CODES.INVALID_USAGE,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
method: flags.method,
|
|
355
|
+
ides: normalizeIdeList(flags.ide ?? []),
|
|
356
|
+
username: await detectUsername(),
|
|
357
|
+
projectName: detectProjectName(targetDir),
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
// Minimal install mode - install only the core template.
|
|
361
|
+
return undefined;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Run interactive setup wizard
|
|
365
|
+
*
|
|
366
|
+
* @param targetDir - Target directory for installation
|
|
367
|
+
* @param availableTemplates - List of available template names
|
|
368
|
+
* @returns Wizard configuration result
|
|
369
|
+
*/
|
|
370
|
+
async runInteractiveWizard(targetDir, availableTemplates) {
|
|
371
|
+
this.log('');
|
|
372
|
+
this.log('┌─────────────────────────────────────────┐');
|
|
373
|
+
this.log('│ AIW Interactive Setup Wizard │');
|
|
374
|
+
this.log('└─────────────────────────────────────────┘');
|
|
375
|
+
this.log('');
|
|
376
|
+
// Detect defaults
|
|
377
|
+
const detectedUsername = await detectUsername();
|
|
378
|
+
const detectedProjectName = detectProjectName(targetDir);
|
|
379
|
+
// Step 1: Select template method
|
|
380
|
+
const method = await select({
|
|
381
|
+
message: 'Select a template method:',
|
|
382
|
+
choices: availableTemplates.map((template) => ({
|
|
383
|
+
value: template,
|
|
384
|
+
name: template.toUpperCase(),
|
|
385
|
+
description: this.getTemplateDescription(template),
|
|
386
|
+
})),
|
|
387
|
+
});
|
|
388
|
+
this.log('');
|
|
389
|
+
const coreTemplatePath = await getTemplatePath('core');
|
|
390
|
+
const selectedTemplatePath = await getTemplatePath(method);
|
|
391
|
+
const coreAvailableIdes = await getTemplateIdeNamesByPath(coreTemplatePath);
|
|
392
|
+
const methodAvailableIdes = await getTemplateIdeNamesByPath(selectedTemplatePath);
|
|
393
|
+
const discoveredIdes = [...new Set([...coreAvailableIdes, ...methodAvailableIdes])].sort((a, b) => a.localeCompare(b));
|
|
394
|
+
const knownByValue = new Map(KNOWN_IDES.map((ide) => [ide.value, ide]));
|
|
395
|
+
if (discoveredIdes.length === 0) {
|
|
396
|
+
this.error('No IDE integrations were discovered in core or selected template.', {
|
|
397
|
+
exit: EXIT_CODES.ENVIRONMENT_ERROR,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
// Step 2: Select IDEs
|
|
401
|
+
const ides = await checkbox({
|
|
402
|
+
message: 'Select IDEs to configure:',
|
|
403
|
+
choices: discoveredIdes.map((ideName) => {
|
|
404
|
+
const known = knownByValue.get(ideName);
|
|
405
|
+
return {
|
|
406
|
+
value: ideName,
|
|
407
|
+
name: known?.name ?? ideName,
|
|
408
|
+
description: known?.description ?? `Discovered IDE integration (.${ideName}/)`,
|
|
409
|
+
checked: true,
|
|
410
|
+
};
|
|
411
|
+
}),
|
|
412
|
+
required: true,
|
|
413
|
+
});
|
|
414
|
+
this.log('');
|
|
415
|
+
// Step 3: Confirm/edit username
|
|
416
|
+
const username = await input({
|
|
417
|
+
message: 'Username:',
|
|
418
|
+
default: detectedUsername,
|
|
419
|
+
});
|
|
420
|
+
// Step 4: Confirm/edit project name
|
|
421
|
+
const projectName = await input({
|
|
422
|
+
message: 'Project name:',
|
|
423
|
+
default: detectedProjectName,
|
|
424
|
+
});
|
|
425
|
+
this.log('');
|
|
426
|
+
// Step 5: Summary and confirmation
|
|
427
|
+
this.log('┌─────────────────────────────────────────┐');
|
|
428
|
+
this.log('│ Installation Summary │');
|
|
429
|
+
this.log('├─────────────────────────────────────────┤');
|
|
430
|
+
this.log(`│ Template: ${method.padEnd(24)}│`);
|
|
431
|
+
this.log(`│ IDEs: ${ides.join(', ').padEnd(24)}│`);
|
|
432
|
+
this.log(`│ Username: ${username.padEnd(24)}│`);
|
|
433
|
+
this.log(`│ Project: ${projectName.padEnd(24)}│`);
|
|
434
|
+
this.log(`│ Directory: ${basename(targetDir).padEnd(24)}│`);
|
|
435
|
+
this.log('└─────────────────────────────────────────┘');
|
|
436
|
+
this.log('');
|
|
437
|
+
const confirmed = await confirm({
|
|
438
|
+
message: 'Proceed with installation?',
|
|
439
|
+
default: true,
|
|
440
|
+
});
|
|
441
|
+
return {
|
|
442
|
+
method,
|
|
443
|
+
ides,
|
|
444
|
+
username,
|
|
445
|
+
projectName,
|
|
446
|
+
confirmed,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SplitPaneResult } from '../../platform/launch.js';
|
|
2
|
+
export interface LaunchFlags {
|
|
3
|
+
codex: boolean;
|
|
4
|
+
devin: boolean;
|
|
5
|
+
env?: string | undefined;
|
|
6
|
+
json: boolean;
|
|
7
|
+
new: boolean;
|
|
8
|
+
'no-tmux': boolean;
|
|
9
|
+
prompt?: string | undefined;
|
|
10
|
+
'prompt-file'?: string | undefined;
|
|
11
|
+
'prompt-path'?: string | undefined;
|
|
12
|
+
'spawned-window': boolean;
|
|
13
|
+
split?: 'auto' | 'h' | 'v' | undefined;
|
|
14
|
+
'tmux-session'?: string | undefined;
|
|
15
|
+
wait: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface LaunchCommandHost {
|
|
18
|
+
debug(message: string, ...args: unknown[]): void;
|
|
19
|
+
error(input: Error | string, options?: {
|
|
20
|
+
exit?: number;
|
|
21
|
+
}): never;
|
|
22
|
+
exit(code?: number): never;
|
|
23
|
+
log(message?: string): void;
|
|
24
|
+
logInfo(message: string): void;
|
|
25
|
+
logWarning(message: string): void;
|
|
26
|
+
warn(input: Error | string, options?: {
|
|
27
|
+
code?: string;
|
|
28
|
+
}): Error | string;
|
|
29
|
+
}
|
|
30
|
+
export interface LaunchRequest {
|
|
31
|
+
cwd: string;
|
|
32
|
+
flags: LaunchFlags;
|
|
33
|
+
interactiveTty: boolean;
|
|
34
|
+
platform: NodeJS.Platform;
|
|
35
|
+
readPromptFile(filePath: string): string | undefined;
|
|
36
|
+
}
|
|
37
|
+
export interface LaunchDependencies {
|
|
38
|
+
host: LaunchCommandHost;
|
|
39
|
+
now: () => number;
|
|
40
|
+
pid: number;
|
|
41
|
+
tempDir: string;
|
|
42
|
+
writePromptFile(filePath: string, content: string): void;
|
|
43
|
+
}
|
|
44
|
+
export interface JsonLaunchResult {
|
|
45
|
+
backend: SplitPaneResult['backend'];
|
|
46
|
+
exitCode: null | number;
|
|
47
|
+
launched: boolean;
|
|
48
|
+
paneId: null | string;
|
|
49
|
+
reason: null | string;
|
|
50
|
+
sentinelPath: null | string;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|