aiwcli 0.15.7 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -1125
- package/bin/run.js +0 -4
- package/dist/capabilities/installation/control-plane/clear-command.d.ts +2 -0
- package/dist/capabilities/installation/control-plane/clear-command.js +32 -3
- package/dist/capabilities/installation/control-plane/init-command.js +2 -2
- package/dist/capabilities/launch/contracts.d.ts +39 -4
- package/dist/capabilities/launch/control-plane/execute-launch.js +158 -119
- package/dist/capabilities/launch/runtime-core/launch-decisions.d.ts +82 -0
- package/dist/capabilities/launch/runtime-core/launch-decisions.js +202 -0
- package/dist/commands/branch.d.ts +1 -1
- package/dist/commands/branch.js +1 -1
- package/dist/commands/launch.d.ts +0 -5
- package/dist/commands/launch.js +2 -37
- package/dist/lib/config.js +1 -2
- package/dist/lib/context/context-store.js +28 -2
- package/dist/lib/core-installer.d.ts +1 -1
- package/dist/lib/core-installer.js +6 -27
- package/dist/lib/debug.d.ts +0 -10
- package/dist/lib/debug.js +0 -10
- package/dist/lib/env-sanitizer.d.ts +25 -0
- package/dist/lib/env-sanitizer.js +46 -0
- package/dist/lib/errors.d.ts +0 -13
- package/dist/lib/errors.js +0 -15
- package/dist/lib/git-exclude-manager.js +1 -1
- package/dist/lib/hooks/context-monitor-logic.d.ts +6 -0
- package/dist/lib/hooks/context-monitor-logic.js +25 -0
- package/dist/lib/hooks/hook-utils.js +11 -0
- package/dist/lib/hooks/prompt-binding-logic.d.ts +7 -0
- package/dist/lib/hooks/prompt-binding-logic.js +50 -0
- package/dist/lib/hooks/session-end-logic.js +2 -14
- package/dist/lib/install-state.js +6 -13
- package/dist/lib/json-io.d.ts +12 -0
- package/dist/lib/json-io.js +30 -0
- package/dist/lib/multiplexer.d.ts +43 -35
- package/dist/lib/multiplexer.js +21 -2
- package/dist/lib/multiplexers/psmux.d.ts +14 -34
- package/dist/lib/multiplexers/psmux.js +70 -130
- package/dist/lib/multiplexers/tmux.d.ts +11 -19
- package/dist/lib/multiplexers/tmux.js +79 -120
- package/dist/lib/multiplexers/wezterm.d.ts +38 -0
- package/dist/lib/multiplexers/wezterm.js +225 -0
- package/dist/lib/mux-utils.d.ts +4 -3
- package/dist/lib/mux-utils.js +7 -13
- package/dist/lib/prompt-file-manager.d.ts +23 -0
- package/dist/lib/prompt-file-manager.js +41 -0
- package/dist/lib/runtime/agent-launcher.d.ts +67 -0
- package/dist/lib/runtime/agent-launcher.js +262 -0
- package/dist/lib/runtime/aiw-cli.d.ts +2 -0
- package/dist/lib/runtime/aiw-cli.js +3 -1
- package/dist/lib/runtime/cli-args.d.ts +5 -2
- package/dist/lib/runtime/cli-args.js +18 -3
- package/dist/lib/runtime/inference.js +3 -14
- package/dist/lib/runtime/models.d.ts +6 -0
- package/dist/lib/runtime/models.js +6 -0
- package/dist/lib/runtime/state-io.d.ts +2 -1
- package/dist/lib/runtime/state-io.js +9 -4
- package/dist/lib/runtime/utils.d.ts +8 -0
- package/dist/lib/runtime/utils.js +31 -1
- package/dist/lib/schemas.d.ts +250 -0
- package/dist/lib/schemas.js +216 -0
- package/dist/lib/sentinel-manager.d.ts +32 -0
- package/dist/lib/sentinel-manager.js +62 -0
- package/dist/lib/sentinel-wrapper.d.ts +1 -0
- package/dist/lib/sentinel-wrapper.js +12 -3
- package/dist/lib/settings-hierarchy.js +3 -20
- package/dist/lib/shell-adapters/bash-adapter.d.ts +18 -0
- package/dist/lib/shell-adapters/bash-adapter.js +69 -0
- package/dist/lib/shell-adapters/index.d.ts +5 -0
- package/dist/lib/shell-adapters/index.js +7 -0
- package/dist/lib/shell-adapters/powershell-adapter.d.ts +18 -0
- package/dist/lib/shell-adapters/powershell-adapter.js +62 -0
- package/dist/lib/shell-adapters/shell-adapter.d.ts +45 -0
- package/dist/lib/shell-adapters/shell-adapter.js +5 -0
- package/dist/lib/spawn-errors.d.ts +3 -0
- package/dist/lib/spawn-errors.js +15 -1
- package/dist/lib/spinner.d.ts +0 -5
- package/dist/lib/spinner.js +0 -16
- package/dist/lib/template-installer.d.ts +10 -0
- package/dist/lib/template-installer.js +4 -4
- package/dist/lib/terminal-strategy.d.ts +1 -0
- package/dist/lib/terminal-strategy.js +12 -6
- package/dist/lib/terminal.d.ts +7 -5
- package/dist/lib/terminal.js +42 -19
- package/dist/lib/tmux-primitives.d.ts +0 -2
- package/dist/lib/tmux-primitives.js +0 -4
- package/dist/lib/tmux-session.js +2 -1
- package/dist/lib/windsurf-hooks-hierarchy.js +6 -23
- package/dist/platform/launch.d.ts +2 -1
- package/dist/platform/launch.js +1 -0
- package/dist/templates/CLAUDE.md +0 -1
- package/dist/templates/cc-native/.claude/settings.json +0 -10
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +11 -4
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -7
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +26 -47
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +7 -9
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -3
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +0 -25
- package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/.mocharc.json +9 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/aggregate-agents.test.ts +118 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/artifacts.test.ts +234 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cc-native-state.test.ts +170 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cli-output-parser.test.ts +73 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/config.test.ts +64 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/constants.test.ts +40 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/debug.test.ts +42 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/exports.test.ts +58 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/helpers.ts +107 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/add-plan-context.hook.test.ts +97 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-questions.hook.test.ts +81 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-review.hook.test.ts +71 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/json-parser.test.ts +99 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator-agent.test.ts +288 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator.test.ts +48 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/reviewers.test.ts +32 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/state.test.ts +124 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/verdict.test.ts +93 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -14
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/format.ts +597 -599
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/index.ts +26 -26
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/tracker.ts +106 -107
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/write.ts +118 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +16 -15
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +132 -10
- package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +6 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/corroboration.ts +119 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -2
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/graduation.ts +132 -132
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +88 -86
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +5 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/orchestrator.ts +70 -70
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/output-builder.ts +130 -121
- package/dist/templates/cc-native/_cc-native/lib-ts/package-lock.json +1679 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/package.json +24 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +1 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/plan-questions.ts +101 -101
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/review-pipeline.ts +511 -543
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/__tests__/agent-providers.test.ts +262 -0
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/agent.ts +71 -85
- package/dist/templates/{core/lib-ts/agent-exec → cc-native/_cc-native/lib-ts/reviewers/base}/base-agent.ts +138 -152
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/index.ts +12 -12
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/claude-agent.ts +66 -57
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/codex-agent.ts +185 -200
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/gemini-agent.ts +39 -40
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/orchestrator-claude-agent.ts +196 -224
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/schemas.ts +201 -201
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/types.ts +21 -23
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/hyde.test.ts +365 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/ollama-client.test.ts +223 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +12 -16
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +3 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +31 -31
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +6 -7
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +7 -9
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +14 -17
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +37 -41
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +33 -43
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +20 -20
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +8 -9
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +3 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +50 -126
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +19 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +13 -88
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/verdict.ts +72 -72
- package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +35 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +1 -1
- package/dist/templates/cc-native/_cc-native/scripts/council_debate.ts +242 -0
- package/dist/templates/cc-native/_cc-native/scripts/council_debate_simple.ts +294 -0
- package/dist/templates/cc-native/_cc-native/{plan-review/workflows → workflows}/specdev.md +9 -9
- package/dist/templates/core/.claude/skills/codex/SKILL.md +25 -0
- package/dist/templates/core/.claude/skills/devin/SKILL.md +25 -0
- package/dist/templates/core/.claude/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.claude/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.claude/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.codex/skills/codex/SKILL.md +13 -0
- package/dist/templates/core/.codex/skills/devin/SKILL.md +19 -0
- package/dist/templates/core/.codex/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.codex/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.codex/{workflows/meta-plan.md → skills/meta-plan/SKILL.md} +6 -0
- package/dist/templates/core/{.cognition → .devin}/AGENTS.md +2 -2
- package/dist/templates/core/.devin/skills/codex/SKILL.md +19 -0
- package/dist/templates/core/.devin/skills/devin/SKILL.md +13 -0
- package/dist/templates/core/.devin/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.devin/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.devin/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.windsurf/workflows/handoff-resume.md +9 -0
- package/dist/templates/core/hooks-ts/archive_plan.ts +1 -21
- package/dist/templates/core/hooks-ts/file-suggestion.ts +1 -19
- package/dist/templates/core/hooks-ts/pre_compact.ts +5 -18
- package/dist/templates/core/lib-ts/context/context-store.ts +29 -2
- package/dist/templates/core/lib-ts/hooks/hook-utils.ts +11 -0
- package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +2 -13
- package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +74 -0
- package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +4 -2
- package/dist/templates/core/lib-ts/runtime/cli-args.ts +18 -4
- package/dist/templates/core/lib-ts/runtime/inference.ts +3 -15
- package/dist/templates/core/lib-ts/runtime/models.ts +7 -0
- package/dist/templates/core/lib-ts/runtime/state-io.ts +9 -4
- package/dist/templates/core/lib-ts/runtime/utils.ts +30 -1
- package/dist/templates/core/lib-ts/schemas.ts +233 -0
- package/dist/templates/core/scripts/resolve-run.ts +34 -2
- package/dist/templates/core/scripts/status_line.ts +1 -1
- package/dist/templates/core/skills/codex/CLAUDE.md +9 -4
- package/dist/templates/core/skills/codex/SKILL.md +6 -0
- package/dist/templates/core/skills/codex/lib/codex-watcher.ts +3 -10
- package/dist/templates/core/skills/codex/scripts/launch-codex.ts +26 -26
- package/dist/templates/core/skills/devin/CLAUDE.md +63 -6
- package/dist/templates/core/skills/devin/lib/devin-watcher.ts +116 -96
- package/dist/templates/core/skills/devin/scripts/launch-devin.ts +22 -21
- package/dist/templates/core/skills/handoff-system/CLAUDE.md +1 -1
- package/oclif.manifest.json +4 -4
- package/package.json +4 -4
- package/dist/lib/base-command.d.ts +0 -1
- package/dist/lib/base-command.js +0 -1
- package/dist/lib/env-compat.d.ts +0 -18
- package/dist/lib/env-compat.js +0 -23
- package/dist/lib/launch-options.d.ts +0 -1
- package/dist/lib/launch-options.js +0 -1
- package/dist/lib/stdin.d.ts +0 -48
- package/dist/lib/stdin.js +0 -60
- package/dist/templates/cc-native/_cc-native/CLAUDE.md +0 -73
- package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +0 -64
- package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +0 -75
- package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +0 -143
- package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +0 -213
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +0 -56
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +0 -53
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +0 -72
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +0 -64
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +0 -56
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +0 -86
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +0 -59
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +0 -58
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +0 -71
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +0 -74
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +0 -77
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +0 -68
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +0 -71
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +0 -67
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +0 -65
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +0 -74
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +0 -69
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +0 -7
- package/dist/templates/core/.codex/workflows/codex.md +0 -17
- package/dist/templates/core/.codex/workflows/handoff.md +0 -5
- package/dist/templates/core/lib-ts/agent-exec/backends/headless.ts +0 -34
- package/dist/templates/core/lib-ts/agent-exec/backends/index.ts +0 -6
- package/dist/templates/core/lib-ts/agent-exec/backends/tmux.ts +0 -148
- package/dist/templates/core/lib-ts/agent-exec/execution-backend.ts +0 -50
- package/dist/templates/core/lib-ts/agent-exec/index.ts +0 -6
- package/dist/templates/core/lib-ts/agent-exec/structured-output.ts +0 -165
- /package/dist/templates/core/{.cognition → .devin}/config.json +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision functions extracted from execute-launch.ts.
|
|
3
|
+
* No side effects — all functions are deterministic string/config transforms.
|
|
4
|
+
*/
|
|
5
|
+
import type { LaunchResult } from '../../../platform/launch.js';
|
|
6
|
+
import type { InlineFallbackContext, JsonLaunchResult, LaunchFlags, SessionRequestParams, SplitRequestParams, ToolConfig, ToolMode } from '../contracts.js';
|
|
7
|
+
export declare const QUICK_EXIT_THRESHOLD_MS = 10000;
|
|
8
|
+
/**
|
|
9
|
+
* Return the debug message for tool mode, or undefined if none (claude has no special message).
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveToolModeDebugMessage(toolMode: ToolMode): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Format version check results into debug lines and an optional warning.
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatVersionCheckMessages(versionCheck: {
|
|
16
|
+
compatible: boolean;
|
|
17
|
+
version?: null | string;
|
|
18
|
+
warning?: string;
|
|
19
|
+
}): {
|
|
20
|
+
debugLines: string[];
|
|
21
|
+
warning?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Format the success message after a split pane launch.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatSplitSuccessMessage(backend: string, handle?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format the info message when launching in a session.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatSessionLaunchMessage(backend: string, sessionName: string, reattach: boolean): string;
|
|
31
|
+
/**
|
|
32
|
+
* Determine which CLI tool to launch and its configuration.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveToolConfig(flags: Pick<LaunchFlags, 'codex' | 'devin'>, platform: NodeJS.Platform): ToolConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Decide the informational message to log when falling back to inline mode.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveInlineFallbackMessage(ctx: InlineFallbackContext): string;
|
|
39
|
+
/**
|
|
40
|
+
* Build the args array for an inline process spawn.
|
|
41
|
+
* Always returns a new array — never mutates input.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildInlineArgs(cliArgs: readonly string[], toolMode: ToolMode, promptText: string | undefined, promptPath: string | undefined): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Build split pane parameters.
|
|
46
|
+
* Returns a new toolArgs array — fixes the cliArgs mutation bug.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildSplitRequest(params: {
|
|
49
|
+
cliArgs: readonly string[];
|
|
50
|
+
cwd: string;
|
|
51
|
+
effectivePromptPath: string | undefined;
|
|
52
|
+
extraEnv: Record<string, string>;
|
|
53
|
+
retryOnQuickExit: boolean;
|
|
54
|
+
sentinelPath: string;
|
|
55
|
+
split: 'auto' | 'horizontal' | 'vertical';
|
|
56
|
+
toolMode: ToolMode;
|
|
57
|
+
}): SplitRequestParams;
|
|
58
|
+
/**
|
|
59
|
+
* Build session creation parameters.
|
|
60
|
+
*/
|
|
61
|
+
export declare function buildSessionRequest(params: {
|
|
62
|
+
cliArgs: readonly string[];
|
|
63
|
+
cwd: string;
|
|
64
|
+
now: number;
|
|
65
|
+
pid: number;
|
|
66
|
+
promptPath: string | undefined;
|
|
67
|
+
promptText: string | undefined;
|
|
68
|
+
tmuxSessionFlag: string | undefined;
|
|
69
|
+
toolMode: ToolMode;
|
|
70
|
+
}): SessionRequestParams;
|
|
71
|
+
/**
|
|
72
|
+
* Decide warning message when session creation fails and we fall back inline.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveSessionFallbackWarning(backend: string, reason: string | undefined): string;
|
|
75
|
+
/**
|
|
76
|
+
* Pure timing decision for retry logic.
|
|
77
|
+
*/
|
|
78
|
+
export declare function shouldRetry(elapsedMs: number, threshold?: number): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Convert a LaunchResult to JSON-serializable form.
|
|
81
|
+
*/
|
|
82
|
+
export declare function toJsonLaunchResult(result: LaunchResult, exitCode: null | number): JsonLaunchResult;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision functions extracted from execute-launch.ts.
|
|
3
|
+
* No side effects — all functions are deterministic string/config transforms.
|
|
4
|
+
*/
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { buildUniqueSessionName, sanitizeSessionName } from './launch-options.js';
|
|
7
|
+
export const QUICK_EXIT_THRESHOLD_MS = 10_000;
|
|
8
|
+
/**
|
|
9
|
+
* Return the debug message for tool mode, or undefined if none (claude has no special message).
|
|
10
|
+
*/
|
|
11
|
+
export function resolveToolModeDebugMessage(toolMode) {
|
|
12
|
+
if (toolMode === 'codex')
|
|
13
|
+
return 'Launching Codex with --yolo flag';
|
|
14
|
+
if (toolMode === 'devin')
|
|
15
|
+
return 'Launching Devin with --permission-mode dangerous';
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Format version check results into debug lines and an optional warning.
|
|
20
|
+
*/
|
|
21
|
+
export function formatVersionCheckMessages(versionCheck) {
|
|
22
|
+
return {
|
|
23
|
+
debugLines: [
|
|
24
|
+
`Claude Code version: ${versionCheck.version ?? 'unknown'}`,
|
|
25
|
+
`Compatibility status: ${versionCheck.compatible ? 'compatible' : 'incompatible'}`,
|
|
26
|
+
],
|
|
27
|
+
...(versionCheck.warning ? { warning: versionCheck.warning } : {}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Format the success message after a split pane launch.
|
|
32
|
+
*/
|
|
33
|
+
export function formatSplitSuccessMessage(backend, handle) {
|
|
34
|
+
if (handle) {
|
|
35
|
+
return `Launched in ${backend} pane: ${handle}`;
|
|
36
|
+
}
|
|
37
|
+
return `Launched in ${backend}`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Format the info message when launching in a session.
|
|
41
|
+
*/
|
|
42
|
+
export function formatSessionLaunchMessage(backend, sessionName, reattach) {
|
|
43
|
+
if (reattach) {
|
|
44
|
+
return `Launching in ${backend} session: ${sessionName} (reuse/attach)`;
|
|
45
|
+
}
|
|
46
|
+
return `Launching in new ${backend} session: ${sessionName}`;
|
|
47
|
+
}
|
|
48
|
+
function buildCodexArgs(platform) {
|
|
49
|
+
if (platform !== 'win32')
|
|
50
|
+
return ['--yolo'];
|
|
51
|
+
return ['-c', 'shell_type="bash"', '--yolo'];
|
|
52
|
+
}
|
|
53
|
+
function buildDevinArgs() {
|
|
54
|
+
return ['--permission-mode', 'dangerous'];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Determine which CLI tool to launch and its configuration.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveToolConfig(flags, platform) {
|
|
60
|
+
if (flags.devin) {
|
|
61
|
+
return {
|
|
62
|
+
cliCommand: 'devin',
|
|
63
|
+
cliArgs: buildDevinArgs(),
|
|
64
|
+
launchFlag: '--devin',
|
|
65
|
+
toolMode: 'devin',
|
|
66
|
+
retryOnQuickExit: true,
|
|
67
|
+
needsLspPatch: false,
|
|
68
|
+
skipVersionCheck: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (flags.codex) {
|
|
72
|
+
return {
|
|
73
|
+
cliCommand: 'codex',
|
|
74
|
+
cliArgs: buildCodexArgs(platform),
|
|
75
|
+
launchFlag: '--codex',
|
|
76
|
+
toolMode: 'codex',
|
|
77
|
+
retryOnQuickExit: false,
|
|
78
|
+
needsLspPatch: false,
|
|
79
|
+
skipVersionCheck: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
cliCommand: 'claude',
|
|
84
|
+
cliArgs: ['--dangerously-skip-permissions'],
|
|
85
|
+
launchFlag: '',
|
|
86
|
+
toolMode: 'claude',
|
|
87
|
+
retryOnQuickExit: false,
|
|
88
|
+
needsLspPatch: platform === 'win32',
|
|
89
|
+
skipVersionCheck: false,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Decide the informational message to log when falling back to inline mode.
|
|
94
|
+
*/
|
|
95
|
+
export function resolveInlineFallbackMessage(ctx) {
|
|
96
|
+
if (!ctx.hasMux) {
|
|
97
|
+
if (ctx.disableMux) {
|
|
98
|
+
return 'Multiplexer disabled via --no-tmux — launching inline';
|
|
99
|
+
}
|
|
100
|
+
if (!ctx.interactiveTty) {
|
|
101
|
+
return 'Non-interactive terminal — launching inline';
|
|
102
|
+
}
|
|
103
|
+
if (ctx.platform === 'win32') {
|
|
104
|
+
return 'No multiplexer found — launching inline. Run inside WezTerm or install psmux for session management.';
|
|
105
|
+
}
|
|
106
|
+
return 'No multiplexer found — launching inline. Install tmux for session management.';
|
|
107
|
+
}
|
|
108
|
+
return ctx.resolvedReason ?? 'Launching inline';
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build the args array for an inline process spawn.
|
|
112
|
+
* Always returns a new array — never mutates input.
|
|
113
|
+
*/
|
|
114
|
+
export function buildInlineArgs(cliArgs, toolMode, promptText, promptPath) {
|
|
115
|
+
if (toolMode === 'devin' && promptPath) {
|
|
116
|
+
return [...cliArgs, '--prompt-file', promptPath];
|
|
117
|
+
}
|
|
118
|
+
if (promptText) {
|
|
119
|
+
return [...cliArgs, promptText];
|
|
120
|
+
}
|
|
121
|
+
return [...cliArgs];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build split pane parameters.
|
|
125
|
+
* Returns a new toolArgs array — fixes the cliArgs mutation bug.
|
|
126
|
+
*/
|
|
127
|
+
export function buildSplitRequest(params) {
|
|
128
|
+
let toolArgs;
|
|
129
|
+
let splitPromptPath;
|
|
130
|
+
if (params.toolMode === 'devin' && params.effectivePromptPath) {
|
|
131
|
+
toolArgs = [...params.cliArgs, '--prompt-file', params.effectivePromptPath];
|
|
132
|
+
splitPromptPath = undefined;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
toolArgs = [...params.cliArgs];
|
|
136
|
+
splitPromptPath = params.effectivePromptPath;
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
toolArgs,
|
|
140
|
+
splitPromptPath,
|
|
141
|
+
env: params.extraEnv,
|
|
142
|
+
cwd: params.cwd,
|
|
143
|
+
mode: 'repl',
|
|
144
|
+
split: params.split,
|
|
145
|
+
sentinelPath: params.sentinelPath,
|
|
146
|
+
holdPane: false,
|
|
147
|
+
retryOnQuickExit: params.retryOnQuickExit,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Build session creation parameters.
|
|
152
|
+
*/
|
|
153
|
+
export function buildSessionRequest(params) {
|
|
154
|
+
const sessionFromFlag = params.tmuxSessionFlag?.trim();
|
|
155
|
+
const reattach = Boolean(sessionFromFlag && sessionFromFlag.length > 0);
|
|
156
|
+
const sessionName = reattach
|
|
157
|
+
? sanitizeSessionName(sessionFromFlag)
|
|
158
|
+
: buildUniqueSessionName(`aiw-${path.basename(params.cwd)}`, params.now, params.pid);
|
|
159
|
+
const toolArgs = params.toolMode === 'devin' && params.promptPath
|
|
160
|
+
? [...params.cliArgs, '--prompt-file', params.promptPath]
|
|
161
|
+
: [...params.cliArgs];
|
|
162
|
+
const promptText = params.toolMode === 'devin' ? undefined : params.promptText;
|
|
163
|
+
return { sessionName, reattach, toolArgs, promptText };
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Decide warning message when session creation fails and we fall back inline.
|
|
167
|
+
*/
|
|
168
|
+
export function resolveSessionFallbackWarning(backend, reason) {
|
|
169
|
+
if (!reason)
|
|
170
|
+
return 'Session creation failed — launching inline';
|
|
171
|
+
if (reason.includes('not found') || reason.includes('unavailable')) {
|
|
172
|
+
const hint = backend === 'psmux' ? ' Install with: winget install psmux' : '';
|
|
173
|
+
return `${backend} unavailable — launching inline.${hint}`;
|
|
174
|
+
}
|
|
175
|
+
if (reason.includes('too old')) {
|
|
176
|
+
const hint = backend === 'psmux' ? ' Update with: winget upgrade psmux' : '';
|
|
177
|
+
return `${reason} — launching inline.${hint}`;
|
|
178
|
+
}
|
|
179
|
+
if (backend === 'psmux' && reason.includes('attach failed')) {
|
|
180
|
+
return `${reason} — launching inline. Recovery: run "psmux kill-server" and relaunch if this persists.`;
|
|
181
|
+
}
|
|
182
|
+
return `${reason} — launching inline`;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Pure timing decision for retry logic.
|
|
186
|
+
*/
|
|
187
|
+
export function shouldRetry(elapsedMs, threshold = QUICK_EXIT_THRESHOLD_MS) {
|
|
188
|
+
return elapsedMs < threshold;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Convert a LaunchResult to JSON-serializable form.
|
|
192
|
+
*/
|
|
193
|
+
export function toJsonLaunchResult(result, exitCode) {
|
|
194
|
+
return {
|
|
195
|
+
launched: result.launched,
|
|
196
|
+
backend: result.backend,
|
|
197
|
+
handle: result.handle ?? null,
|
|
198
|
+
sentinelPath: result.sentinelPath ?? null,
|
|
199
|
+
exitCode,
|
|
200
|
+
reason: result.reason ?? null,
|
|
201
|
+
};
|
|
202
|
+
}
|
package/dist/commands/branch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { createBranchCommandDependencies } from '../capabilities/branch/adapters.js';
|
|
3
3
|
import { executeBranchCommand } from '../capabilities/branch/control-plane.js';
|
|
4
|
-
import BaseCommand from '../
|
|
4
|
+
import BaseCommand from '../cli/base-command.js';
|
|
5
5
|
/**
|
|
6
6
|
* Manage git branch operations: launch in main/master or delete branch and worktree.
|
|
7
7
|
*
|
|
@@ -47,9 +47,4 @@ export default class LaunchCommand extends BaseCommand {
|
|
|
47
47
|
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
48
48
|
};
|
|
49
49
|
run(): Promise<void>;
|
|
50
|
-
private buildUniqueSessionName;
|
|
51
|
-
private handleJsonOutput;
|
|
52
|
-
private sanitizeSessionName;
|
|
53
|
-
private shellQuote;
|
|
54
|
-
private waitForSentinel;
|
|
55
50
|
}
|
package/dist/commands/launch.js
CHANGED
|
@@ -2,9 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import * as os from 'node:os';
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import { executeLaunch } from '../capabilities/launch/control-plane/execute-launch.js';
|
|
5
|
-
import { buildUniqueSessionName, sanitizeSessionName } from '../capabilities/launch/runtime-core/launch-options.js';
|
|
6
5
|
import BaseCommand from '../cli/base-command.js';
|
|
7
|
-
import { quoteForSh, readSentinelExitCode, waitForSentinelFile } from '../platform/launch.js';
|
|
8
6
|
/**
|
|
9
7
|
* Launch Claude Code, Codex, or Devin with AIW configuration.
|
|
10
8
|
*
|
|
@@ -115,8 +113,8 @@ export default class LaunchCommand extends BaseCommand {
|
|
|
115
113
|
required: false,
|
|
116
114
|
}),
|
|
117
115
|
split: Flags.string({
|
|
118
|
-
description: 'Split direction when in
|
|
119
|
-
options: ['auto', '
|
|
116
|
+
description: 'Split direction when in multiplexer (auto|horizontal|vertical, default: auto)',
|
|
117
|
+
options: ['auto', 'horizontal', 'vertical'],
|
|
120
118
|
required: false,
|
|
121
119
|
}),
|
|
122
120
|
'tmux-session': Flags.string({
|
|
@@ -155,37 +153,4 @@ export default class LaunchCommand extends BaseCommand {
|
|
|
155
153
|
},
|
|
156
154
|
});
|
|
157
155
|
}
|
|
158
|
-
// Compatibility wrappers kept on the command prototype while launch
|
|
159
|
-
// orchestration now lives in the capability control-plane.
|
|
160
|
-
buildUniqueSessionName(base) {
|
|
161
|
-
return buildUniqueSessionName(base);
|
|
162
|
-
}
|
|
163
|
-
async handleJsonOutput(result, wait) {
|
|
164
|
-
let { exitCode } = result;
|
|
165
|
-
if (wait && result.launched && result.sentinelPath) {
|
|
166
|
-
const finished = await waitForSentinelFile(result.sentinelPath, 14_400_000);
|
|
167
|
-
exitCode = finished ? readSentinelExitCode(result.sentinelPath, 1) : -1;
|
|
168
|
-
}
|
|
169
|
-
this.log(JSON.stringify({
|
|
170
|
-
launched: result.launched,
|
|
171
|
-
backend: result.backend,
|
|
172
|
-
paneId: result.paneId ?? null,
|
|
173
|
-
sentinelPath: result.sentinelPath ?? null,
|
|
174
|
-
exitCode: exitCode ?? null,
|
|
175
|
-
reason: result.reason ?? null,
|
|
176
|
-
}));
|
|
177
|
-
this.exit(exitCode ?? 0);
|
|
178
|
-
}
|
|
179
|
-
sanitizeSessionName(input) {
|
|
180
|
-
return sanitizeSessionName(input);
|
|
181
|
-
}
|
|
182
|
-
shellQuote(input) {
|
|
183
|
-
return quoteForSh(input);
|
|
184
|
-
}
|
|
185
|
-
async waitForSentinel(result) {
|
|
186
|
-
if (!result.sentinelPath)
|
|
187
|
-
return;
|
|
188
|
-
const finished = await waitForSentinelFile(result.sentinelPath, 14_400_000);
|
|
189
|
-
this.exit(finished ? readSentinelExitCode(result.sentinelPath, 1) : 1);
|
|
190
|
-
}
|
|
191
156
|
}
|
package/dist/lib/config.js
CHANGED
|
@@ -2,7 +2,6 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { debug } from './debug.js';
|
|
5
|
-
import { getAiwDir as getAiwDirFromEnv } from './env-compat.js';
|
|
6
5
|
import { ConfigNotFoundError } from './errors.js';
|
|
7
6
|
/**
|
|
8
7
|
* Resolve AI Workflow CLI home directory.
|
|
@@ -10,7 +9,7 @@ import { ConfigNotFoundError } from './errors.js';
|
|
|
10
9
|
*/
|
|
11
10
|
export function getAiwDir() {
|
|
12
11
|
// Try env var first, then default
|
|
13
|
-
const envHome =
|
|
12
|
+
const envHome = process.env['AIW_DIR'];
|
|
14
13
|
if (envHome) {
|
|
15
14
|
return envHome;
|
|
16
15
|
}
|
|
@@ -13,6 +13,7 @@ import { getContextDir, getContextsDir, getIndexPath, getArchiveDir, getArchiveC
|
|
|
13
13
|
import { logInfo, logWarn, logError, setContextPath } from "../runtime/logger.js";
|
|
14
14
|
import { readStateJson, writeStateJson } from "../runtime/state-io.js";
|
|
15
15
|
import { nowIso, generateContextId } from "../runtime/utils.js";
|
|
16
|
+
import { IndexFileSchema } from "../schemas.js";
|
|
16
17
|
const INDEX_VERSION = "3.0";
|
|
17
18
|
// Module-level index cache — safe because each hook is a separate bun process
|
|
18
19
|
let _indexCache = null;
|
|
@@ -58,8 +59,15 @@ function loadIndex(projectRoot) {
|
|
|
58
59
|
if (fs.existsSync(indexPath)) {
|
|
59
60
|
try {
|
|
60
61
|
const raw = fs.readFileSync(indexPath, "utf8");
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const data = JSON.parse(raw);
|
|
63
|
+
const validated = IndexFileSchema.safeParse(data);
|
|
64
|
+
if (!validated.success) {
|
|
65
|
+
logWarn("context_store", `Index schema validation failed, recreating: ${validated.error.message}`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
_indexCache = data;
|
|
69
|
+
return _indexCache;
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
catch (error) {
|
|
65
73
|
logWarn("context_store", `Failed to read index, recreating: ${error}`);
|
|
@@ -263,11 +271,29 @@ export function getAllContexts(status, projectRoot) {
|
|
|
263
271
|
const index = loadIndex(projectRoot);
|
|
264
272
|
const ctxMap = index.contexts;
|
|
265
273
|
if (ctxMap && typeof ctxMap === "object" && Object.keys(ctxMap).length > 0) {
|
|
274
|
+
const orphanIds = [];
|
|
266
275
|
for (const cid of Object.keys(ctxMap)) {
|
|
267
276
|
const state = loadState(cid, projectRoot);
|
|
268
277
|
if (state && (!status || state.status === status)) {
|
|
269
278
|
results.push(state);
|
|
270
279
|
}
|
|
280
|
+
else if (!state) {
|
|
281
|
+
orphanIds.push(cid);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (orphanIds.length > 0) {
|
|
285
|
+
logWarn("context_store", `Index references ${orphanIds.length} missing context(s): ${orphanIds.join(", ")}. Auto-repairing index.`);
|
|
286
|
+
const idx = loadIndex(projectRoot);
|
|
287
|
+
for (const cid of orphanIds) {
|
|
288
|
+
delete idx.contexts[cid];
|
|
289
|
+
if (idx.sessions) {
|
|
290
|
+
for (const [sid, target] of Object.entries(idx.sessions)) {
|
|
291
|
+
if (target === cid)
|
|
292
|
+
delete idx.sessions[sid];
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
saveIndex(idx, projectRoot);
|
|
271
297
|
}
|
|
272
298
|
}
|
|
273
299
|
else {
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Install core runtime assets into .aiwcli/_core.
|
|
3
3
|
*/
|
|
4
4
|
export declare function installCoreAssets(targetDir: string, ides: string[]): Promise<string[]>;
|
|
5
|
-
export declare function getCoreResolverSourcePath(): string
|
|
5
|
+
export declare function getCoreResolverSourcePath(): Promise<string>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { join } from 'node:path';
|
|
4
3
|
import { IdePathResolver } from './ide-path-resolver.js';
|
|
5
4
|
import { pathExists } from './paths.js';
|
|
6
|
-
import { copyDir } from './template-installer.js';
|
|
5
|
+
import { copyDir, mergeDirectory } from './template-installer.js';
|
|
6
|
+
import { getTemplatePath } from './template-resolver.js';
|
|
7
7
|
/**
|
|
8
8
|
* Install core runtime assets into .aiwcli/_core.
|
|
9
9
|
*/
|
|
@@ -12,7 +12,7 @@ export async function installCoreAssets(targetDir, ides) {
|
|
|
12
12
|
const containerDir = resolver.getAiwcliContainer();
|
|
13
13
|
const coreDir = resolver.getCoreFolder();
|
|
14
14
|
await fs.mkdir(containerDir, { recursive: true });
|
|
15
|
-
const sourceRoot =
|
|
15
|
+
const sourceRoot = await getTemplatePath('core');
|
|
16
16
|
if (!(await pathExists(sourceRoot))) {
|
|
17
17
|
throw new Error(`Core assets not found at ${sourceRoot}. This indicates a corrupted installation.`);
|
|
18
18
|
}
|
|
@@ -28,27 +28,6 @@ export async function installCoreAssets(targetDir, ides) {
|
|
|
28
28
|
}
|
|
29
29
|
return ['_core'];
|
|
30
30
|
}
|
|
31
|
-
export function getCoreResolverSourcePath() {
|
|
32
|
-
return join(
|
|
33
|
-
}
|
|
34
|
-
function getCoreAssetSource() {
|
|
35
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
36
|
-
const currentDir = dirname(currentFilePath);
|
|
37
|
-
return join(currentDir, '..', 'templates', 'core');
|
|
38
|
-
}
|
|
39
|
-
async function mergeDirectory(src, dest) {
|
|
40
|
-
await fs.mkdir(dest, { recursive: true });
|
|
41
|
-
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
42
|
-
const operations = entries.map(async (entry) => {
|
|
43
|
-
const srcPath = join(src, entry.name);
|
|
44
|
-
const destPath = join(dest, entry.name);
|
|
45
|
-
if (entry.isDirectory()) {
|
|
46
|
-
await mergeDirectory(srcPath, destPath);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (!(await pathExists(destPath))) {
|
|
50
|
-
await fs.copyFile(srcPath, destPath);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
await Promise.all(operations);
|
|
31
|
+
export async function getCoreResolverSourcePath() {
|
|
32
|
+
return join(await getTemplatePath('core'), 'scripts', 'resolve-run.ts');
|
|
54
33
|
}
|
package/dist/lib/debug.d.ts
CHANGED
|
@@ -16,16 +16,6 @@ export declare function setDebugEnabled(enabled: boolean): void;
|
|
|
16
16
|
* @param message - The message to log
|
|
17
17
|
*/
|
|
18
18
|
export declare function debug(message: string): void;
|
|
19
|
-
/**
|
|
20
|
-
* Log configuration details in debug mode.
|
|
21
|
-
* Only logs AIW_DIR path to avoid accidentally logging sensitive data.
|
|
22
|
-
* @param config - Configuration object
|
|
23
|
-
* @param config.aiwDir - AIW_DIR path
|
|
24
|
-
*/
|
|
25
|
-
export declare function debugConfig(config: {
|
|
26
|
-
[key: string]: unknown;
|
|
27
|
-
aiwDir: string;
|
|
28
|
-
}): void;
|
|
29
19
|
/**
|
|
30
20
|
* Log process spawn details in debug mode.
|
|
31
21
|
* @param command - Command being spawned
|
package/dist/lib/debug.js
CHANGED
|
@@ -33,16 +33,6 @@ export function debug(message) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Log configuration details in debug mode.
|
|
38
|
-
* Only logs AIW_DIR path to avoid accidentally logging sensitive data.
|
|
39
|
-
* @param config - Configuration object
|
|
40
|
-
* @param config.aiwDir - AIW_DIR path
|
|
41
|
-
*/
|
|
42
|
-
export function debugConfig(config) {
|
|
43
|
-
debug(`AIW_DIR resolved to ${config.aiwDir}`);
|
|
44
|
-
// NOTE: Do NOT log full config - may contain API keys/tokens in future
|
|
45
|
-
}
|
|
46
36
|
/**
|
|
47
37
|
* Log process spawn details in debug mode.
|
|
48
38
|
* @param command - Command being spawned
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized env var management for REPL nesting detection.
|
|
3
|
+
* Replaces scattered cleanClaudeEnv(), UNSET_NESTING_SH, etc.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Env vars set by REPL tools (Claude Code, Codex, Devin) that trigger
|
|
7
|
+
* nesting detection. Must be cleared when spawning a new REPL pane so
|
|
8
|
+
* the child tool starts fresh instead of refusing to launch.
|
|
9
|
+
*/
|
|
10
|
+
export declare const REPL_NESTING_VARS: readonly ["CLAUDECODE", "CLAUDE_CODE_ENTRYPOINT", "CLAUDE_SESSION_ID", "CODEX_THREAD_ID", "AIWCLI_INTERNAL_CALL"];
|
|
11
|
+
/**
|
|
12
|
+
* Check whether the current process was invoked from a REPL tool.
|
|
13
|
+
* Must be called BEFORE clearProcessNestingVars().
|
|
14
|
+
*/
|
|
15
|
+
export declare function isCalledFromRepl(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Clear REPL nesting vars from the current process environment.
|
|
18
|
+
* Call once at orchestrator startup so inline launches don't see them.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clearProcessNestingVars(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Build a clean process env with nesting vars removed and optional extras merged.
|
|
23
|
+
* Used for createSession() spawn calls that inherit process.env.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sanitizedProcessEnv(extraEnv?: Record<string, string>): NodeJS.ProcessEnv;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized env var management for REPL nesting detection.
|
|
3
|
+
* Replaces scattered cleanClaudeEnv(), UNSET_NESTING_SH, etc.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Env vars set by REPL tools (Claude Code, Codex, Devin) that trigger
|
|
7
|
+
* nesting detection. Must be cleared when spawning a new REPL pane so
|
|
8
|
+
* the child tool starts fresh instead of refusing to launch.
|
|
9
|
+
*/
|
|
10
|
+
export const REPL_NESTING_VARS = [
|
|
11
|
+
'CLAUDECODE',
|
|
12
|
+
'CLAUDE_CODE_ENTRYPOINT',
|
|
13
|
+
'CLAUDE_SESSION_ID',
|
|
14
|
+
'CODEX_THREAD_ID',
|
|
15
|
+
'AIWCLI_INTERNAL_CALL',
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Check whether the current process was invoked from a REPL tool.
|
|
19
|
+
* Must be called BEFORE clearProcessNestingVars().
|
|
20
|
+
*/
|
|
21
|
+
export function isCalledFromRepl() {
|
|
22
|
+
return REPL_NESTING_VARS.some((v) => Boolean(process.env[v]));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Clear REPL nesting vars from the current process environment.
|
|
26
|
+
* Call once at orchestrator startup so inline launches don't see them.
|
|
27
|
+
*/
|
|
28
|
+
export function clearProcessNestingVars() {
|
|
29
|
+
for (const v of REPL_NESTING_VARS) {
|
|
30
|
+
delete process.env[v];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build a clean process env with nesting vars removed and optional extras merged.
|
|
35
|
+
* Used for createSession() spawn calls that inherit process.env.
|
|
36
|
+
*/
|
|
37
|
+
export function sanitizedProcessEnv(extraEnv) {
|
|
38
|
+
const env = {
|
|
39
|
+
...process.env,
|
|
40
|
+
...extraEnv,
|
|
41
|
+
};
|
|
42
|
+
for (const key of REPL_NESTING_VARS) {
|
|
43
|
+
delete env[key];
|
|
44
|
+
}
|
|
45
|
+
return env;
|
|
46
|
+
}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -111,16 +111,3 @@ export declare class ProcessSpawnError extends AiwError {
|
|
|
111
111
|
readonly code?: string | undefined;
|
|
112
112
|
constructor(message: string, code?: string | undefined);
|
|
113
113
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Format error message following AI Workflow CLI convention.
|
|
116
|
-
* @param what - Description of what went wrong
|
|
117
|
-
* @param howToFix - Actionable steps to fix the problem
|
|
118
|
-
* @returns Formatted error message in format: "{what}. {howToFix}."
|
|
119
|
-
* @example
|
|
120
|
-
* formatErrorMessage(
|
|
121
|
-
* 'AIW_DIR directory not found',
|
|
122
|
-
* 'Set AIW_DIR env var or run "aiw setup"'
|
|
123
|
-
* )
|
|
124
|
-
* // Returns: "AIW_DIR directory not found. Set AIW_DIR env var or run \"aiw setup\"."
|
|
125
|
-
*/
|
|
126
|
-
export declare function formatErrorMessage(what: string, howToFix: string): string;
|
package/dist/lib/errors.js
CHANGED
|
@@ -128,18 +128,3 @@ export class ProcessSpawnError extends AiwError {
|
|
|
128
128
|
this.name = 'ProcessSpawnError';
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Format error message following AI Workflow CLI convention.
|
|
133
|
-
* @param what - Description of what went wrong
|
|
134
|
-
* @param howToFix - Actionable steps to fix the problem
|
|
135
|
-
* @returns Formatted error message in format: "{what}. {howToFix}."
|
|
136
|
-
* @example
|
|
137
|
-
* formatErrorMessage(
|
|
138
|
-
* 'AIW_DIR directory not found',
|
|
139
|
-
* 'Set AIW_DIR env var or run "aiw setup"'
|
|
140
|
-
* )
|
|
141
|
-
* // Returns: "AIW_DIR directory not found. Set AIW_DIR env var or run \"aiw setup\"."
|
|
142
|
-
*/
|
|
143
|
-
export function formatErrorMessage(what, howToFix) {
|
|
144
|
-
return `${what}. ${howToFix}.`;
|
|
145
|
-
}
|
|
@@ -9,7 +9,7 @@ const execFileAsync = promisify(execFile);
|
|
|
9
9
|
*/
|
|
10
10
|
const AIW_EXCLUDE_HEADER = '# AIW Installation';
|
|
11
11
|
/** Standard exclude entries managed by AIW */
|
|
12
|
-
export const AIW_EXCLUDE_ENTRIES = ['.aiwcli', '_output', '.claude', '.codex', '.windsurf', '.
|
|
12
|
+
export const AIW_EXCLUDE_ENTRIES = ['.aiwcli', '_output', '.claude', '.codex', '.windsurf', '.devin'];
|
|
13
13
|
/** Entries that should NEVER be removed from exclude, even on clear */
|
|
14
14
|
const AIW_PERMANENT_ENTRIES = ['_output'];
|
|
15
15
|
/**
|