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.
Files changed (272) hide show
  1. package/README.md +106 -1125
  2. package/bin/run.js +0 -4
  3. package/dist/capabilities/installation/control-plane/clear-command.d.ts +2 -0
  4. package/dist/capabilities/installation/control-plane/clear-command.js +32 -3
  5. package/dist/capabilities/installation/control-plane/init-command.js +2 -2
  6. package/dist/capabilities/launch/contracts.d.ts +39 -4
  7. package/dist/capabilities/launch/control-plane/execute-launch.js +158 -119
  8. package/dist/capabilities/launch/runtime-core/launch-decisions.d.ts +82 -0
  9. package/dist/capabilities/launch/runtime-core/launch-decisions.js +202 -0
  10. package/dist/commands/branch.d.ts +1 -1
  11. package/dist/commands/branch.js +1 -1
  12. package/dist/commands/launch.d.ts +0 -5
  13. package/dist/commands/launch.js +2 -37
  14. package/dist/lib/config.js +1 -2
  15. package/dist/lib/context/context-store.js +28 -2
  16. package/dist/lib/core-installer.d.ts +1 -1
  17. package/dist/lib/core-installer.js +6 -27
  18. package/dist/lib/debug.d.ts +0 -10
  19. package/dist/lib/debug.js +0 -10
  20. package/dist/lib/env-sanitizer.d.ts +25 -0
  21. package/dist/lib/env-sanitizer.js +46 -0
  22. package/dist/lib/errors.d.ts +0 -13
  23. package/dist/lib/errors.js +0 -15
  24. package/dist/lib/git-exclude-manager.js +1 -1
  25. package/dist/lib/hooks/context-monitor-logic.d.ts +6 -0
  26. package/dist/lib/hooks/context-monitor-logic.js +25 -0
  27. package/dist/lib/hooks/hook-utils.js +11 -0
  28. package/dist/lib/hooks/prompt-binding-logic.d.ts +7 -0
  29. package/dist/lib/hooks/prompt-binding-logic.js +50 -0
  30. package/dist/lib/hooks/session-end-logic.js +2 -14
  31. package/dist/lib/install-state.js +6 -13
  32. package/dist/lib/json-io.d.ts +12 -0
  33. package/dist/lib/json-io.js +30 -0
  34. package/dist/lib/multiplexer.d.ts +43 -35
  35. package/dist/lib/multiplexer.js +21 -2
  36. package/dist/lib/multiplexers/psmux.d.ts +14 -34
  37. package/dist/lib/multiplexers/psmux.js +70 -130
  38. package/dist/lib/multiplexers/tmux.d.ts +11 -19
  39. package/dist/lib/multiplexers/tmux.js +79 -120
  40. package/dist/lib/multiplexers/wezterm.d.ts +38 -0
  41. package/dist/lib/multiplexers/wezterm.js +225 -0
  42. package/dist/lib/mux-utils.d.ts +4 -3
  43. package/dist/lib/mux-utils.js +7 -13
  44. package/dist/lib/prompt-file-manager.d.ts +23 -0
  45. package/dist/lib/prompt-file-manager.js +41 -0
  46. package/dist/lib/runtime/agent-launcher.d.ts +67 -0
  47. package/dist/lib/runtime/agent-launcher.js +262 -0
  48. package/dist/lib/runtime/aiw-cli.d.ts +2 -0
  49. package/dist/lib/runtime/aiw-cli.js +3 -1
  50. package/dist/lib/runtime/cli-args.d.ts +5 -2
  51. package/dist/lib/runtime/cli-args.js +18 -3
  52. package/dist/lib/runtime/inference.js +3 -14
  53. package/dist/lib/runtime/models.d.ts +6 -0
  54. package/dist/lib/runtime/models.js +6 -0
  55. package/dist/lib/runtime/state-io.d.ts +2 -1
  56. package/dist/lib/runtime/state-io.js +9 -4
  57. package/dist/lib/runtime/utils.d.ts +8 -0
  58. package/dist/lib/runtime/utils.js +31 -1
  59. package/dist/lib/schemas.d.ts +250 -0
  60. package/dist/lib/schemas.js +216 -0
  61. package/dist/lib/sentinel-manager.d.ts +32 -0
  62. package/dist/lib/sentinel-manager.js +62 -0
  63. package/dist/lib/sentinel-wrapper.d.ts +1 -0
  64. package/dist/lib/sentinel-wrapper.js +12 -3
  65. package/dist/lib/settings-hierarchy.js +3 -20
  66. package/dist/lib/shell-adapters/bash-adapter.d.ts +18 -0
  67. package/dist/lib/shell-adapters/bash-adapter.js +69 -0
  68. package/dist/lib/shell-adapters/index.d.ts +5 -0
  69. package/dist/lib/shell-adapters/index.js +7 -0
  70. package/dist/lib/shell-adapters/powershell-adapter.d.ts +18 -0
  71. package/dist/lib/shell-adapters/powershell-adapter.js +62 -0
  72. package/dist/lib/shell-adapters/shell-adapter.d.ts +45 -0
  73. package/dist/lib/shell-adapters/shell-adapter.js +5 -0
  74. package/dist/lib/spawn-errors.d.ts +3 -0
  75. package/dist/lib/spawn-errors.js +15 -1
  76. package/dist/lib/spinner.d.ts +0 -5
  77. package/dist/lib/spinner.js +0 -16
  78. package/dist/lib/template-installer.d.ts +10 -0
  79. package/dist/lib/template-installer.js +4 -4
  80. package/dist/lib/terminal-strategy.d.ts +1 -0
  81. package/dist/lib/terminal-strategy.js +12 -6
  82. package/dist/lib/terminal.d.ts +7 -5
  83. package/dist/lib/terminal.js +42 -19
  84. package/dist/lib/tmux-primitives.d.ts +0 -2
  85. package/dist/lib/tmux-primitives.js +0 -4
  86. package/dist/lib/tmux-session.js +2 -1
  87. package/dist/lib/windsurf-hooks-hierarchy.js +6 -23
  88. package/dist/platform/launch.d.ts +2 -1
  89. package/dist/platform/launch.js +1 -0
  90. package/dist/templates/CLAUDE.md +0 -1
  91. package/dist/templates/cc-native/.claude/settings.json +0 -10
  92. package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +11 -4
  93. package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -7
  94. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +26 -47
  95. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +7 -9
  96. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -3
  97. package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +2 -2
  98. package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +0 -25
  99. package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +4 -4
  100. package/dist/templates/cc-native/_cc-native/lib-ts/.mocharc.json +9 -0
  101. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/aggregate-agents.test.ts +118 -0
  102. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/artifacts.test.ts +234 -0
  103. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cc-native-state.test.ts +170 -0
  104. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cli-output-parser.test.ts +73 -0
  105. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/config.test.ts +64 -0
  106. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/constants.test.ts +40 -0
  107. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/debug.test.ts +42 -0
  108. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/exports.test.ts +58 -0
  109. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/helpers.ts +107 -0
  110. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/add-plan-context.hook.test.ts +97 -0
  111. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-questions.hook.test.ts +81 -0
  112. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-review.hook.test.ts +71 -0
  113. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/json-parser.test.ts +99 -0
  114. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator-agent.test.ts +288 -0
  115. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator.test.ts +48 -0
  116. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/reviewers.test.ts +32 -0
  117. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/state.test.ts +124 -0
  118. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/verdict.test.ts +93 -0
  119. package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -0
  120. package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -14
  121. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/format.ts +597 -599
  122. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/index.ts +26 -26
  123. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/tracker.ts +106 -107
  124. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/write.ts +118 -119
  125. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -0
  126. package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +16 -15
  127. package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +132 -10
  128. package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +6 -6
  129. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/corroboration.ts +119 -119
  130. package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -2
  131. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/graduation.ts +132 -132
  132. package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +88 -86
  133. package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +5 -6
  134. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/orchestrator.ts +70 -70
  135. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/output-builder.ts +130 -121
  136. package/dist/templates/cc-native/_cc-native/lib-ts/package-lock.json +1679 -0
  137. package/dist/templates/cc-native/_cc-native/lib-ts/package.json +24 -0
  138. package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +4 -4
  139. package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +1 -6
  140. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/plan-questions.ts +101 -101
  141. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/review-pipeline.ts +511 -543
  142. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/__tests__/agent-providers.test.ts +262 -0
  143. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/agent.ts +71 -85
  144. package/dist/templates/{core/lib-ts/agent-exec → cc-native/_cc-native/lib-ts/reviewers/base}/base-agent.ts +138 -152
  145. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/index.ts +12 -12
  146. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/claude-agent.ts +66 -57
  147. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/codex-agent.ts +185 -200
  148. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/gemini-agent.ts +39 -40
  149. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/orchestrator-claude-agent.ts +196 -224
  150. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/schemas.ts +201 -201
  151. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/types.ts +21 -23
  152. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/hyde.test.ts +365 -0
  153. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/ollama-client.test.ts +223 -0
  154. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +12 -16
  155. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +3 -2
  156. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +31 -31
  157. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +6 -7
  158. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +7 -9
  159. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +14 -17
  160. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +37 -41
  161. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +33 -43
  162. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +20 -20
  163. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +8 -9
  164. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +3 -4
  165. package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +50 -126
  166. package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +19 -21
  167. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +13 -88
  168. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/verdict.ts +72 -72
  169. package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +35 -0
  170. package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +1 -1
  171. package/dist/templates/cc-native/_cc-native/scripts/council_debate.ts +242 -0
  172. package/dist/templates/cc-native/_cc-native/scripts/council_debate_simple.ts +294 -0
  173. package/dist/templates/cc-native/_cc-native/{plan-review/workflows → workflows}/specdev.md +9 -9
  174. package/dist/templates/core/.claude/skills/codex/SKILL.md +25 -0
  175. package/dist/templates/core/.claude/skills/devin/SKILL.md +25 -0
  176. package/dist/templates/core/.claude/skills/handoff/SKILL.md +11 -0
  177. package/dist/templates/core/.claude/skills/handoff-resume/SKILL.md +11 -0
  178. package/dist/templates/core/.claude/skills/meta-plan/SKILL.md +13 -0
  179. package/dist/templates/core/.codex/skills/codex/SKILL.md +13 -0
  180. package/dist/templates/core/.codex/skills/devin/SKILL.md +19 -0
  181. package/dist/templates/core/.codex/skills/handoff/SKILL.md +11 -0
  182. package/dist/templates/core/.codex/skills/handoff-resume/SKILL.md +11 -0
  183. package/dist/templates/core/.codex/{workflows/meta-plan.md → skills/meta-plan/SKILL.md} +6 -0
  184. package/dist/templates/core/{.cognition → .devin}/AGENTS.md +2 -2
  185. package/dist/templates/core/.devin/skills/codex/SKILL.md +19 -0
  186. package/dist/templates/core/.devin/skills/devin/SKILL.md +13 -0
  187. package/dist/templates/core/.devin/skills/handoff/SKILL.md +11 -0
  188. package/dist/templates/core/.devin/skills/handoff-resume/SKILL.md +11 -0
  189. package/dist/templates/core/.devin/skills/meta-plan/SKILL.md +13 -0
  190. package/dist/templates/core/.windsurf/workflows/handoff-resume.md +9 -0
  191. package/dist/templates/core/hooks-ts/archive_plan.ts +1 -21
  192. package/dist/templates/core/hooks-ts/file-suggestion.ts +1 -19
  193. package/dist/templates/core/hooks-ts/pre_compact.ts +5 -18
  194. package/dist/templates/core/lib-ts/context/context-store.ts +29 -2
  195. package/dist/templates/core/lib-ts/hooks/hook-utils.ts +11 -0
  196. package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +2 -13
  197. package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +74 -0
  198. package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +4 -2
  199. package/dist/templates/core/lib-ts/runtime/cli-args.ts +18 -4
  200. package/dist/templates/core/lib-ts/runtime/inference.ts +3 -15
  201. package/dist/templates/core/lib-ts/runtime/models.ts +7 -0
  202. package/dist/templates/core/lib-ts/runtime/state-io.ts +9 -4
  203. package/dist/templates/core/lib-ts/runtime/utils.ts +30 -1
  204. package/dist/templates/core/lib-ts/schemas.ts +233 -0
  205. package/dist/templates/core/scripts/resolve-run.ts +34 -2
  206. package/dist/templates/core/scripts/status_line.ts +1 -1
  207. package/dist/templates/core/skills/codex/CLAUDE.md +9 -4
  208. package/dist/templates/core/skills/codex/SKILL.md +6 -0
  209. package/dist/templates/core/skills/codex/lib/codex-watcher.ts +3 -10
  210. package/dist/templates/core/skills/codex/scripts/launch-codex.ts +26 -26
  211. package/dist/templates/core/skills/devin/CLAUDE.md +63 -6
  212. package/dist/templates/core/skills/devin/lib/devin-watcher.ts +116 -96
  213. package/dist/templates/core/skills/devin/scripts/launch-devin.ts +22 -21
  214. package/dist/templates/core/skills/handoff-system/CLAUDE.md +1 -1
  215. package/oclif.manifest.json +4 -4
  216. package/package.json +4 -4
  217. package/dist/lib/base-command.d.ts +0 -1
  218. package/dist/lib/base-command.js +0 -1
  219. package/dist/lib/env-compat.d.ts +0 -18
  220. package/dist/lib/env-compat.js +0 -23
  221. package/dist/lib/launch-options.d.ts +0 -1
  222. package/dist/lib/launch-options.js +0 -1
  223. package/dist/lib/stdin.d.ts +0 -48
  224. package/dist/lib/stdin.js +0 -60
  225. package/dist/templates/cc-native/_cc-native/CLAUDE.md +0 -73
  226. package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +0 -64
  227. package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +0 -70
  228. package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +0 -75
  229. package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +0 -143
  230. package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +0 -213
  231. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +0 -70
  232. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +0 -62
  233. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +0 -61
  234. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +0 -62
  235. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +0 -56
  236. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +0 -53
  237. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +0 -66
  238. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +0 -70
  239. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +0 -62
  240. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +0 -72
  241. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +0 -61
  242. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +0 -64
  243. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +0 -56
  244. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +0 -86
  245. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +0 -59
  246. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +0 -58
  247. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +0 -66
  248. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +0 -62
  249. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +0 -66
  250. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +0 -71
  251. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +0 -74
  252. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +0 -77
  253. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +0 -62
  254. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +0 -68
  255. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +0 -61
  256. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +0 -71
  257. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +0 -61
  258. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +0 -61
  259. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +0 -67
  260. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +0 -65
  261. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +0 -74
  262. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +0 -69
  263. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +0 -7
  264. package/dist/templates/core/.codex/workflows/codex.md +0 -17
  265. package/dist/templates/core/.codex/workflows/handoff.md +0 -5
  266. package/dist/templates/core/lib-ts/agent-exec/backends/headless.ts +0 -34
  267. package/dist/templates/core/lib-ts/agent-exec/backends/index.ts +0 -6
  268. package/dist/templates/core/lib-ts/agent-exec/backends/tmux.ts +0 -148
  269. package/dist/templates/core/lib-ts/agent-exec/execution-backend.ts +0 -50
  270. package/dist/templates/core/lib-ts/agent-exec/index.ts +0 -6
  271. package/dist/templates/core/lib-ts/agent-exec/structured-output.ts +0 -165
  272. /package/dist/templates/core/{.cognition → .devin}/config.json +0 -0
package/README.md CHANGED
@@ -1,58 +1,24 @@
1
- AIW CLI - AI Workflow CLI
2
- =========================================
1
+ # AIW CLI
3
2
 
4
- Command-line interface for launching and managing Claude Code with AI Workflow (AIW) configuration. Provides seamless integration with AIW hooks, automatic sandbox permissions, and scriptable automation support.
5
-
6
-
7
- [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
8
- [![Version](https://img.shields.io/npm/v/aiwcli.svg)](https://npmjs.org/package/aiwcli)
9
- [![Downloads/week](https://img.shields.io/npm/dw/aiwcli.svg)](https://npmjs.org/package/aiwcli)
10
-
11
- ## Installation
12
-
13
- ### Install from npm (Recommended)
14
-
15
- ```bash
16
- # Install globally from npm
17
- npm install -g aiwcli
18
-
19
- # Verify installation
20
- aiw --version
21
- aiw --help
22
- ```
23
-
24
- ### What's Included
25
-
26
- aiwcli v0.9.0 includes:
27
-
28
- - **CLI Commands**: `launch`, `init`, `branch`, `clean`, `clear`
29
- - **Templates**:
30
- - **cc-native** - Event-sourced context management with plan review, 25+ specialized agents
31
- - **core** - Common utilities (context manager, event logging, task sync)
32
- - **IDE Support**: Claude Code, Windsurf, Codex
33
-
34
- After installation, run `aiw init --method cc-native` to set up the template in your project.
3
+ CLI package for launching and managing Claude Code with AIW hooks and configuration.
35
4
 
36
5
  ## Commands
37
6
 
38
- AIW CLI provides the following commands:
39
-
40
7
  ### `aiw launch`
8
+
41
9
  Launch Claude Code with AIW configuration (sandbox disabled, tmux-first when outside tmux).
42
10
 
43
11
  ```bash
44
12
  aiw launch
45
- aiw launch --debug # Enable verbose logging
46
- aiw launch --quiet # Suppress informational output
47
- aiw launch --no-tmux # Bypass tmux auto-launch and run directly
48
- aiw launch --tmux-session aiw-main # Reuse/attach a specific tmux session name
13
+ aiw launch --debug # Enable verbose logging
14
+ aiw launch --quiet # Suppress informational output
15
+ aiw launch --no-tmux # Bypass tmux auto-launch
16
+ aiw launch --tmux-session aiw-main # Reuse a named tmux session
49
17
  ```
50
18
 
51
- `aiw launch` now creates a fresh tmux session by default when auto-launching tmux.
52
- On Windows (outside tmux), `aiw launch` opens a new mintty window first, then runs tmux there.
53
- If window launch fails, it falls back to inline non-tmux launch.
19
+ Creates a fresh tmux session by default when auto-launching. On Windows (outside tmux), opens a new mintty window first.
54
20
 
55
- If you prefer typing `codex` or `devin`, route them through AIW launch behavior with aliases:
21
+ Aliases:
56
22
 
57
23
  ```bash
58
24
  alias codex='aiw launch --codex'
@@ -60,1186 +26,201 @@ alias devin='aiw launch --devin'
60
26
  ```
61
27
 
62
28
  ### `aiw init`
63
- Initialize AIW tools and integrations with specified template method.
29
+
30
+ Initialize AIW templates in a project.
64
31
 
65
32
  ```bash
66
- aiw init --interactive # Run interactive setup wizard
33
+ aiw init --interactive # Interactive setup wizard
67
34
  aiw init --method cc-native # Initialize CC-Native template
68
35
  aiw init --method cc-native --ide windsurf # Install for Windsurf
69
- aiw init --method cc-native --ide claude --ide windsurf # Install for both IDEs
36
+ aiw init --method cc-native --ide claude --ide windsurf # Multiple IDEs
70
37
  ```
71
38
 
72
39
  ### `aiw branch <branchName>`
73
- Create git worktree in sibling folder and auto-launch Claude Code.
74
40
 
75
- Reduces friction in branch-based development workflows by:
76
- 1. Creating a new git worktree with the specified branch name
77
- 2. Creating a sibling folder with suffix pattern (e.g., `aiwcli` → `aiwcli-feature-name`)
78
- 3. Opening a new terminal window at the worktree path
79
- 4. Automatically running `aiw launch` in that terminal
41
+ Create git worktree in sibling folder and auto-launch Claude Code.
80
42
 
81
43
  ```bash
82
44
  aiw branch feature-name # Creates ../aiwcli-feature-name worktree
83
45
  aiw branch fix-bug-123 # Creates ../aiwcli-fix-bug-123 worktree
84
- aiw branch experiment # Creates ../aiwcli-experiment worktree
85
46
  ```
86
47
 
87
- **Requirements:**
88
- - Must be run from a git repository root
89
- - Target folder must not already exist
90
- - Branch name must not already exist
91
-
92
- **Exit codes:**
93
- - `0` - Success: Worktree created and terminal launched
94
- - `1` - General error: Unexpected failure
95
- - `2` - Invalid usage: Invalid branch name, folder exists, or not in git repo
96
- - `3` - Environment error: Git not available
97
-
98
- ## Requirements
99
-
100
- **Minimum Claude Code Version:** 0.1.0 or later
101
-
102
- AIW CLI automatically detects your Claude Code version and warns if incompatibilities are detected. The CLI will continue to launch even with version warnings (graceful degradation).
103
-
104
- ### Known Incompatible Versions
105
-
106
- - **0.0.9** - Has known issues with AIW CLI integration
48
+ Requirements: must be in a git repo root, target folder/branch must not exist.
107
49
 
108
- If you encounter version compatibility warnings, upgrade Claude Code to the latest version:
50
+ ### `aiw clean` / `aiw clear`
109
51
 
110
52
  ```bash
111
- # Upgrade Claude Code to latest version
112
- npm install -g @anthropic-ai/claude-code@latest
53
+ aiw clean # Remove _output/
54
+ aiw clean --method cc-native # One method
55
+ aiw clean --all # Everything
56
+ aiw clear # Full uninstall (workflow folders, output, IDE config)
113
57
  ```
114
58
 
115
- ## Troubleshooting
116
-
117
- ### Windows Setup: Symlink Permission Denied
118
-
119
- **Symptom:** `aiw init` fails with "Permission denied creating symlink" or "EPERM: operation not permitted"
59
+ ---
120
60
 
121
- **Solution (choose one):**
122
-
123
- **Option 1: Enable Developer Mode (Recommended)**
124
- 1. Open Windows Settings
125
- 2. Go to "Privacy & Security" → "For developers"
126
- 3. Enable "Developer Mode"
127
- 4. Run `aiw init` again
61
+ ## Requirements
128
62
 
129
- **Option 2: Run as Administrator**
130
- 1. Open PowerShell or Command Prompt as Administrator
131
- 2. Run `aiw init`
63
+ - Claude Code 0.1.0+
64
+ - Node.js 18+
65
+ - Bun (for TypeScript hooks)
66
+ - Git
132
67
 
133
- Developer Mode is recommended as it allows symlink creation without elevated privileges for all future operations.
68
+ ---
134
69
 
135
- ### Version Compatibility Issues
70
+ ## Troubleshooting
136
71
 
137
- **Symptom:** Warning message about Claude Code version incompatibility
72
+ ### Windows: Symlink Permission Denied
138
73
 
139
- **Solution:**
140
- 1. Check your current Claude Code version: `claude --version`
141
- 2. Upgrade to version 0.1.0 or later (see above)
142
- 3. If version cannot be detected, ensure Claude Code is installed and in your PATH
74
+ `aiw init` fails with EPERM:
143
75
 
144
- **Debug Mode:**
76
+ 1. **Developer Mode** (recommended): Settings > Privacy & Security > For developers > Enable
77
+ 2. **Or** run as Administrator
145
78
 
146
- Use `--debug` flag to see detailed version information:
79
+ ### Version Compatibility
147
80
 
148
81
  ```bash
149
- aiw launch --debug
82
+ aiw launch --debug # See version info
83
+ claude --version # Check Claude Code version
150
84
  ```
151
85
 
152
- Debug output includes:
153
- - Resolved AIW_DIR path
154
- - Claude Code version detection
155
- - Compatibility check results
156
- - Spawn arguments and configuration
86
+ Known incompatible: v0.0.9. Upgrade with `npm install -g @anthropic-ai/claude-code@latest`.
157
87
 
158
- ### Version Check Failed
159
-
160
- If `claude --version` fails or hangs:
161
- - Verify Claude Code is installed: `which claude` (Unix) or `where claude` (Windows)
162
- - Check PATH includes Claude Code installation directory
163
- - Reinstall Claude Code if necessary
164
-
165
- AIW CLI assumes compatibility if version cannot be determined and will proceed with launch.
88
+ ---
166
89
 
167
90
  ## Environment Variables
168
91
 
169
- AIW CLI respects standard environment variables for controlling output behavior:
170
-
171
- ### NO_COLOR
92
+ | Variable | Purpose |
93
+ |----------|---------|
94
+ | `AIW_DIR` | Custom AIW config directory (default: `~/.aiw`) |
95
+ | `NO_COLOR` | Disable colored output |
96
+ | `FORCE_COLOR` | Force colors even outside TTY (`1`=basic, `2`=256, `3`=truecolor) |
172
97
 
173
- Disables colored output. Useful for scripts or when colors interfere with output processing.
174
-
175
- ```bash
176
- # Disable all colors
177
- NO_COLOR=1 aiw launch
178
- ```
179
-
180
- ### FORCE_COLOR
181
-
182
- Forces colored output even when not in a TTY (terminal). Useful for CI environments that support colors.
183
-
184
- ```bash
185
- # Force colors (level 1 = basic 16 colors)
186
- FORCE_COLOR=1 aiw launch | less -R
187
-
188
- # Force 256 colors
189
- FORCE_COLOR=2 aiw launch
190
-
191
- # Force truecolor (16 million colors)
192
- FORCE_COLOR=3 aiw launch
193
- ```
194
-
195
- ### AIW_DIR
196
-
197
- Customize the AIW configuration directory (default: `~/.aiw`):
198
-
199
- ```bash
200
- AIW_DIR=/custom/path aiw launch
201
- ```
202
-
203
- ## Output Behavior
204
-
205
- AIW CLI automatically adapts its output based on the execution context:
206
-
207
- ### Interactive Terminal (TTY)
208
- - Colors enabled
209
- - Progress spinners shown
210
- - Rich formatting
211
-
212
- ### Piped or Redirected Output
213
- - Colors automatically disabled
214
- - Spinners suppressed
215
- - Clean, parseable text output
216
-
217
- ```bash
218
- # Example: Piping to other commands
219
- aiw launch --help | grep "OPTIONS"
220
-
221
- # Example: Redirecting to file
222
- aiw launch --help > help.txt
223
-
224
- # Example: Processing with tools
225
- aiw launch 2>&1 | tee output.log
226
- ```
227
-
228
- This automatic behavior ensures AIW CLI works seamlessly in both interactive use and automation scripts without requiring manual configuration.
229
-
230
- ### Quiet Mode
231
-
232
- For scripting and automation where you want minimal output, use the `--quiet` (or `-q`) flag to suppress informational messages while preserving errors:
233
-
234
- ```bash
235
- # Suppress informational output
236
- aiw launch --quiet
237
-
238
- # Short form
239
- aiw launch -q
240
- ```
241
-
242
- **What Gets Suppressed:**
243
- - Informational messages (`logInfo`)
244
- - Success messages (`logSuccess`)
245
- - Warning messages (`logWarning`)
246
- - Progress spinners
247
-
248
- **What's Always Shown:**
249
- - Error messages (stderr) - critical for debugging failures
250
- - Essential data output (stdout) - for parsing in scripts
251
-
252
- **Example Usage:**
253
-
254
- ```bash
255
- # Silent execution in scripts
256
- aiw launch --quiet
257
- EXIT_CODE=$?
258
- if [ $EXIT_CODE -ne 0 ]; then
259
- echo "Launch failed with code $EXIT_CODE"
260
- fi
261
-
262
- # Combine with piping
263
- aiw launch --quiet 2>&1 | tee log.txt
264
-
265
- # CI/CD pipelines
266
- aiw launch --quiet || exit 1
267
- ```
268
-
269
- **Quiet Mode vs. Piping:**
270
- - **Piping**: Automatically disables colors and spinners
271
- - **Quiet Mode**: Explicitly suppresses informational text
272
- - **Combined**: Minimal clean output for scripting
273
-
274
- ## Command Chaining
275
-
276
- AIW CLI is designed for seamless integration into command chains and pipelines, enabling complex automation workflows.
277
-
278
- ### Chaining with && (Success Chains)
279
-
280
- Commands can be chained using `&&` to execute multiple operations sequentially, stopping at the first failure:
281
-
282
- ```bash
283
- # Execute multiple commands - stops if any fails
284
- aiw launch --help && aiw init --help
285
-
286
- # Chain with other tools
287
- aiw launch --help && echo "Launch command is available"
288
-
289
- # Complex chains
290
- aiw init && aiw launch --quiet && echo "Setup and launch complete"
291
- ```
292
-
293
- **How It Works:**
294
- - Exit code `0` (success) → chain continues to next command
295
- - Exit code `1/2/3` (error) → chain stops, subsequent commands don't run
296
- - Errors always output to stderr for visibility
297
-
298
- ### Piping Output
299
-
300
- AIW CLI produces clean stdout that works seamlessly with standard Unix tools:
301
-
302
- ```bash
303
- # Pipe to grep, awk, jq, etc.
304
- aiw launch --help | grep "Launch"
305
-
306
- # Combine quiet mode for cleanest output
307
- aiw launch --help --quiet | wc -l
308
-
309
- # Multi-stage pipelines
310
- aiw launch --help | grep "flags" | sort
311
- ```
312
-
313
- **Output Separation:**
314
- - **stdout**: Data only (help text, command output)
315
- - **stderr**: Errors and warnings only
316
- - **Status messages**: Automatically suppressed when piped
317
-
318
- ### Cross-Platform Compatibility
319
-
320
- **Windows PowerShell:**
321
- ```powershell
322
- # && chains work in PowerShell 7+
323
- aiw launch --help && echo "Success"
324
-
325
- # Pipes work universally
326
- aiw launch --help | Select-String "Launch"
327
-
328
- # Legacy CMD/PowerShell 5.1 uses semicolon for sequential execution
329
- aiw launch --help; echo "Runs regardless of success"
330
- ```
331
-
332
- **Unix/macOS (Bash/Zsh):**
333
- ```bash
334
- # Standard && chaining
335
- aiw launch --help && echo "Success"
336
-
337
- # Standard piping
338
- aiw launch --help | grep "Launch"
339
-
340
- # Complex pipelines
341
- aiw launch --help | grep "flags" | awk '{print $1}'
342
- ```
343
-
344
- ### Practical Examples
345
-
346
- **CI/CD Pipelines:**
347
- ```bash
348
- # Stop pipeline on first failure
349
- aiw init && aiw launch --quiet && other-command || exit 1
350
- ```
351
-
352
- **Scripting with Error Handling:**
353
- ```bash
354
- #!/bin/bash
355
- if aiw launch --quiet; then
356
- echo "Launch succeeded"
357
- else
358
- echo "Launch failed with code $?" >&2
359
- exit 1
360
- fi
361
- ```
362
-
363
- **Data Processing:**
364
- ```bash
365
- # Extract and process help text
366
- aiw launch --help --quiet | grep -E "^ -" | sort
367
- ```
98
+ ---
368
99
 
369
100
  ## Exit Codes
370
101
 
371
- AIW CLI uses standardized exit codes to enable reliable error handling in scripts and automation pipelines.
372
-
373
- ### Exit Code Reference
374
-
375
- | Code | Meaning | When It Occurs |
376
- |------|---------|----------------|
377
- | `0` | Success | Command completed successfully without errors |
378
- | `1` | General Error | Unexpected runtime failures, system errors, unhandled exceptions |
379
- | `2` | Invalid Usage | Invalid arguments, unknown flags, missing required parameters |
380
- | `3` | Environment Error | Missing prerequisites (Claude Code not installed, AIW_DIR not found, permission denied) |
381
-
382
- ### Checking Exit Codes
383
-
384
- **Bash / Zsh (Unix, macOS, Linux, Git Bash, WSL):**
385
-
386
- ```bash
387
- # Check last command's exit code
388
- aiw launch
389
- echo $? # 0 = success, non-zero = error
390
-
391
- # Conditional execution with &&
392
- aiw launch && echo "Success!"
393
-
394
- # Fallback with ||
395
- aiw launch || echo "Failed with code $?"
396
-
397
- # Store and check exit code
398
- aiw launch
399
- EXIT_CODE=$?
400
- if [ $EXIT_CODE -eq 0 ]; then
401
- echo "Launch succeeded"
402
- elif [ $EXIT_CODE -eq 3 ]; then
403
- echo "Environment error - run 'aiw init' or install Claude Code"
404
- else
405
- echo "Command failed with exit code $EXIT_CODE"
406
- fi
407
-
408
- # Chain commands (stops on first failure)
409
- aiw init && aiw launch && echo "All commands succeeded"
410
- ```
411
-
412
- **PowerShell (Windows):**
413
-
414
- ```powershell
415
- # Check last command's exit code
416
- aiw launch
417
- echo $LASTEXITCODE # 0 = success, non-zero = error
418
-
419
- # Conditional execution
420
- aiw launch
421
- if ($LASTEXITCODE -eq 0) {
422
- Write-Host "Success!"
423
- } elseif ($LASTEXITCODE -eq 3) {
424
- Write-Host "Environment error - run 'aiw init' or install Claude Code"
425
- } else {
426
- Write-Host "Failed with exit code $LASTEXITCODE"
427
- }
428
-
429
- # Throw on error
430
- $ErrorActionPreference = "Stop"
431
- aiw launch # Will throw exception if exit code is non-zero
432
-
433
- # Continue on error but check result
434
- $ErrorActionPreference = "Continue"
435
- aiw launch
436
- if ($LASTEXITCODE -ne 0) {
437
- Write-Error "Launch failed"
438
- exit $LASTEXITCODE
439
- }
440
- ```
441
-
442
- **CMD (Windows):**
443
-
444
- ```cmd
445
- REM Check exit code with %ERRORLEVEL%
446
- aiw launch
447
- echo %ERRORLEVEL%
448
-
449
- REM Conditional execution with &&
450
- aiw init && aiw launch && echo Success!
451
-
452
- REM Check exit code in batch script
453
- aiw launch
454
- if %ERRORLEVEL% EQU 0 (
455
- echo Success
456
- ) else if %ERRORLEVEL% EQU 3 (
457
- echo Environment error
458
- ) else (
459
- echo Failed with code %ERRORLEVEL%
460
- )
461
- ```
462
-
463
- ### Common Exit Code Scenarios
464
-
465
- **Success (0):**
466
- - Help displayed: `aiwlaunch --help`
467
- - Setup completed successfully: `aiw init`
468
- - Claude Code launched and exited normally: `aiwlaunch`
469
-
470
- **General Error (1):**
471
- - Unexpected runtime failures
472
- - Network errors during operation
473
- - File system errors (other than missing prerequisites)
474
- - Unknown/unhandled exceptions
475
-
476
- **Invalid Usage (2):**
477
- - Unknown flag: `aiwlaunch --invalid-flag`
478
- - Unknown command: `aiwinvalid-command`
479
- - Missing required argument: `aiw init` (without --method arg)
480
- - Conflicting options
481
-
482
- **Environment Error (3):**
483
- - Claude Code not installed: `aiwlaunch` (when `claude` not in PATH)
484
- - AIW_DIR not found: `aiw init` (when ~/.aiw doesn't exist and AIW_DIR not set)
485
- - Permission denied: `aiw init` (on Windows without Developer Mode or admin rights)
486
- - Version incompatibility blocking operation
487
-
488
- ### Exit Codes in CI/CD
489
-
490
- Exit codes enable reliable automation in continuous integration and deployment pipelines:
491
-
492
- ```yaml
493
- # GitHub Actions example
494
- - name: Launch AIW
495
- run: aiw launch
496
- # Automatically fails workflow on non-zero exit
497
-
498
- # With custom error handling
499
- - name: Launch AIW with fallback
500
- run: |
501
- aiw launch || {
502
- EXIT_CODE=$?
503
- if [ $EXIT_CODE -eq 3 ]; then
504
- echo "Environment setup needed"
505
- exit 1
506
- fi
507
- exit $EXIT_CODE
508
- }
509
- ```
510
-
511
- ### Getting Help on Exit Codes
512
-
513
- Every command documents its exit codes in help text:
102
+ | Code | Meaning |
103
+ |------|---------|
104
+ | `0` | Success |
105
+ | `1` | General error (runtime failures) |
106
+ | `2` | Invalid usage (bad args/flags) |
107
+ | `3` | Environment error (missing prerequisites, permissions) |
514
108
 
515
- ```bash
516
- aiw launch --help # See EXIT CODES section
517
- aiw init --help # See EXIT CODES section
518
- ```
109
+ ---
519
110
 
520
111
  ## Shell Completion
521
112
 
522
- AIW CLI supports tab completion for commands, subcommands, and flags in Bash, Zsh, and PowerShell.
523
-
524
- ### Installation
525
-
526
- **Bash**
527
-
528
- Add to your `~/.bashrc`:
529
-
530
113
  ```bash
114
+ # Bash -- add to ~/.bashrc
531
115
  eval "$(aiw autocomplete:script bash)"
532
- ```
533
116
 
534
- Or run this one-liner:
535
-
536
- ```bash
537
- printf "eval \"\$(aiw autocomplete:script bash)\"" >> ~/.bashrc && source ~/.bashrc
538
- ```
539
-
540
- **Note:** If your terminal starts as a login shell, modify `~/.bash_profile` or `~/.profile` instead:
541
-
542
- ```bash
543
- printf "eval \"\$(aiw autocomplete:script bash)\"" >> ~/.bash_profile && source ~/.bash_profile
544
- ```
545
-
546
- **Zsh**
547
-
548
- Add to your `~/.zshrc`:
549
-
550
- ```bash
117
+ # Zsh -- add to ~/.zshrc
551
118
  eval "$(aiw autocomplete:script zsh)"
552
- ```
553
-
554
- Or run this one-liner:
555
-
556
- ```bash
557
- printf "eval \"\$(aiw autocomplete:script zsh)\"" >> ~/.zshrc && source ~/.zshrc
558
- ```
559
-
560
- **PowerShell**
561
119
 
562
- Run the autocomplete command and follow the instructions:
563
-
564
- ```powershell
120
+ # PowerShell
565
121
  aiw autocomplete powershell
566
- ```
567
-
568
- The command will provide platform-specific setup instructions. Typically:
569
-
570
- ```powershell
571
- # Create profile directory if it doesn't exist
572
- New-Item -Type Directory -Path (Split-Path -Parent $PROFILE) -ErrorAction SilentlyContinue
573
-
574
- # Add autocomplete to profile and reload
575
- Add-Content -Path $PROFILE -Value (Invoke-Expression -Command "aiw autocomplete script powershell"); .$PROFILE
576
- ```
577
-
578
- **Optional**: Enable menu-style completion in PowerShell:
579
-
580
- ```powershell
581
- Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
582
- ```
583
-
584
- ### Usage
585
-
586
- After installation, you can use tab completion:
587
-
588
- ```bash
589
- # Command completion
590
- aiw la<TAB> # Completes to "aiw launch"
591
-
592
- # Subcommand completion (when available)
593
- aiw init <TAB> # Shows available subcommands
594
-
595
- # Flag completion
596
- aiw launch --<TAB> # Shows available flags
597
-
598
- # Command listing
599
- aiw <TAB> # Shows all available commands
600
- ```
601
122
 
602
- ### Troubleshooting
603
-
604
- **Bash**
605
-
606
- If completion doesn't work:
607
- - Check if `~/.bashrc` is sourced (may need `~/.bash_profile` for login shells)
608
- - Verify completion script loaded: `type _aiw_completion`
609
- - Restart your shell: `exec bash`
610
-
611
- **Zsh**
612
-
613
- If completion doesn't work:
614
- - Check permissions: `compaudit -D`
615
- - Rebuild completion cache: `rm ~/.zcompdump* && compinit`
616
- - Restart your shell: `exec zsh`
617
-
618
- **PowerShell**
619
-
620
- If completion doesn't work:
621
- - Check execution policy: `Get-ExecutionPolicy`
622
- - May need: `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`
623
- - Restart PowerShell
624
-
625
- **Refresh Completion Cache**
626
-
627
- If commands or flags change after updates:
628
-
629
- ```bash
123
+ # Refresh cache after updates
630
124
  aiw autocomplete --refresh-cache
631
125
  ```
632
126
 
633
- Or use the short form:
634
-
635
- ```bash
636
- aiw autocomplete -r
637
- ```
638
-
639
- ## Scripting Examples
640
-
641
- AIW CLI is designed for seamless integration into automation scripts, shell pipelines, and CI/CD workflows. All examples work on Windows (PowerShell/CMD/Git Bash), macOS, and Linux.
642
-
643
- ### Basic Piping
644
-
645
- Pipe AIW CLI output to standard Unix tools for filtering and processing:
646
-
647
- ```bash
648
- # Search help for specific command
649
- aiw --help | grep "launch"
650
-
651
- # Find all available flags
652
- aiw launch --help | grep -E "^ -"
653
-
654
- # Extract version number
655
- aiw --version | cut -d' ' -f2
656
-
657
- # Count lines of output
658
- aiw --help | wc -l
659
- ```
660
-
661
- **PowerShell equivalent:**
662
- ```powershell
663
- # Search help
664
- aiw --help | Select-String "launch"
665
-
666
- # Find flags
667
- aiw launch --help | Select-String "^ -"
668
- ```
669
-
670
- ### Command Chaining
671
-
672
- Chain multiple commands together with proper error handling:
673
-
674
- **Bash/Zsh (Unix, macOS, Linux, Git Bash):**
675
- ```bash
676
- # Sequential execution - stops on first failure
677
- aiw init && aiw launch
678
-
679
- # Multiple commands
680
- aiw --version && aiw init && aiw launch
681
-
682
- # Continue on error
683
- aiw init || echo "Setup failed"
684
-
685
- # Error handling with exit codes
686
- if aiw launch; then
687
- echo "Launch succeeded"
688
- else
689
- EXIT_CODE=$?
690
- echo "Launch failed with exit code $EXIT_CODE"
691
- fi
692
- ```
693
-
694
- **PowerShell (Windows):**
695
- ```powershell
696
- # Sequential execution (PowerShell 7+)
697
- aiw init && aiw launch
698
-
699
- # Error handling
700
- aiw launch
701
- if ($LASTEXITCODE -eq 0) {
702
- Write-Host "Success"
703
- } else {
704
- Write-Host "Failed with exit code $LASTEXITCODE"
705
- }
706
- ```
707
-
708
- **CMD (Windows):**
709
- ```cmd
710
- REM Sequential execution
711
- aiw init && aiw launch && echo Success
712
-
713
- REM Error handling
714
- aiw launch
715
- if %ERRORLEVEL% EQU 0 (
716
- echo Success
717
- ) else (
718
- echo Failed with code %ERRORLEVEL%
719
- )
720
- ```
721
-
722
- ### Quiet Mode for Scripts
723
-
724
- Suppress informational output while preserving errors:
725
-
726
- ```bash
727
- # Silent execution in automation
728
- aiw launch --quiet
729
-
730
- # Short form
731
- aiw launch -q
732
-
733
- # Capture exit code
734
- aiw launch --quiet
735
- EXIT_CODE=$?
736
-
737
- # Only errors shown (goes to stderr)
738
- aiw launch --quiet 2>errors.log
739
-
740
- # Combine with piping for cleanest output
741
- aiw launch --help --quiet | wc -l
742
- ```
743
-
744
- **Use cases for `--quiet`:**
745
- - CI/CD pipelines where minimal output is desired
746
- - Automated scripts that parse command output
747
- - Reducing noise in log files
748
- - Background processes
749
-
750
- ### Exit Code Handling
751
-
752
- AIW CLI uses standardized exit codes for reliable automation:
753
-
754
- | Code | Meaning | Example Scenarios |
755
- |------|---------|-------------------|
756
- | `0` | Success | Command completed, help displayed, setup successful |
757
- | `1` | General Error | Runtime failures, unexpected errors |
758
- | `2` | Invalid Usage | Unknown flags, invalid arguments |
759
- | `3` | Environment Error | Claude Code not installed, permissions denied |
760
-
761
- **Bash/Zsh examples:**
762
- ```bash
763
- # Basic exit code check
764
- aiw launch
765
- if [ $? -eq 0 ]; then
766
- echo "Success"
767
- fi
768
-
769
- # Handle specific exit codes
770
- aiw launch
771
- EXIT_CODE=$?
772
- case $EXIT_CODE in
773
- 0)
774
- echo "Launch successful"
775
- ;;
776
- 2)
777
- echo "Invalid usage - check arguments"
778
- ;;
779
- 3)
780
- echo "Environment issue - is Claude Code installed?"
781
- aiw init # Try setup
782
- ;;
783
- *)
784
- echo "Unexpected error: $EXIT_CODE"
785
- ;;
786
- esac
787
-
788
- # Use exit codes in pipelines
789
- aiw init && aiw launch || {
790
- echo "Failed at exit code $?"
791
- exit 1
792
- }
793
- ```
794
-
795
- **PowerShell examples:**
796
- ```powershell
797
- # Check last exit code
798
- aiw launch
799
- if ($LASTEXITCODE -eq 0) {
800
- Write-Host "Success"
801
- }
802
-
803
- # Handle specific codes
804
- aiw launch
805
- switch ($LASTEXITCODE) {
806
- 0 { Write-Host "Success" }
807
- 2 { Write-Host "Invalid usage" }
808
- 3 { Write-Host "Environment issue"; aiw init }
809
- default { Write-Host "Error: $LASTEXITCODE" }
810
- }
811
-
812
- # Fail on error
813
- $ErrorActionPreference = "Stop"
814
- aiw launch # Will throw if non-zero exit code
815
- ```
816
-
817
- ### Shell Completion Usage
818
-
819
- After installing shell completion (see [Shell Completion](#shell-completion) section):
820
-
821
- ```bash
822
- # Command completion
823
- aiw la<TAB> # Completes to "aiw launch"
824
-
825
- # Show all commands
826
- aiw <TAB> # Lists: autocomplete, help, init, launch
827
-
828
- # Flag completion
829
- aiw launch --<TAB> # Shows: --debug, --help, --quiet
830
-
831
- # Short flag completion
832
- aiw launch -<TAB> # Shows: -d, -h, -q
833
- ```
834
-
835
- **Benefits:**
836
- - Faster command entry
837
- - Discover available commands without `--help`
838
- - Reduce typos
839
- - Learn flag names interactively
840
-
841
- ### CI/CD Pipeline Examples
842
-
843
- **GitHub Actions:**
844
- ```yaml
845
- name: Deploy with AIW
846
-
847
- on: [push]
848
-
849
- jobs:
850
- deploy:
851
- runs-on: ubuntu-latest
852
- steps:
853
- - uses: actions/checkout@v2
854
-
855
- - name: Setup AIW
856
- run: |
857
- npm install -g aiwcli
858
- aiw init
859
-
860
- - name: Launch Claude Code
861
- run: aiw launch --quiet || exit $?
862
-
863
- - name: Check exit code
864
- if: failure()
865
- run: |
866
- echo "AIW launch failed"
867
- echo "Exit code: $?"
868
- ```
869
-
870
- **GitLab CI:**
871
- ```yaml
872
- deploy:
873
- script:
874
- - aiw init
875
- - aiw launch --quiet
876
- only:
877
- - main
878
- ```
879
-
880
- **Jenkins:**
881
- ```groovy
882
- pipeline {
883
- agent any
884
- stages {
885
- stage('Setup') {
886
- steps {
887
- sh 'aiw init'
888
- }
889
- }
890
- stage('Launch') {
891
- steps {
892
- sh 'aiw launch --quiet || exit $?'
893
- }
894
- }
895
- }
896
- }
897
- ```
898
-
899
- ### Automation Script Examples
127
+ ---
900
128
 
901
- **Deployment script (Bash):**
902
- ```bash
903
- #!/bin/bash
904
- set -e # Exit on error
905
-
906
- echo "Starting deployment..."
129
+ ## Command Development Guide
907
130
 
908
- # Setup AIW if not configured
909
- if ! aiw --version > /dev/null 2>&1; then
910
- echo "AIW CLI not found"
911
- exit 3
912
- fi
131
+ ### Architecture
913
132
 
914
- # Run setup
915
- aiw init || {
916
- echo "Setup failed with code $?"
917
- exit 1
918
- }
133
+ Uses [Oclif](https://oclif.io). File path = command name: `src/commands/launch.ts` -> `aiw launch`.
919
134
 
920
- # Launch with quiet mode
921
- aiw launch --quiet
135
+ ### Adding a Command
922
136
 
923
- echo "Deployment complete"
924
- ```
137
+ 1. Create file in `src/commands/`:
925
138
 
926
- **Monitoring script (Bash):**
927
- ```bash
928
- #!/bin/bash
929
-
930
- # Check AIW status every 5 minutes
931
- while true; do
932
- if aiw --version --quiet; then
933
- echo "[$(date)] AIW CLI operational"
934
- else
935
- echo "[$(date)] AIW CLI check failed: exit code $?"
936
- fi
937
- sleep 300
938
- done
939
- ```
139
+ ```typescript
140
+ import {Flags} from '@oclif/core'
141
+ import BaseCommand from '../lib/base-command.js'
940
142
 
941
- **Batch processing (PowerShell):**
942
- ```powershell
943
- # Process multiple operations with AIW
944
- $operations = @("setup", "launch")
143
+ export default class Status extends BaseCommand {
144
+ static override description = 'Show AIW status'
945
145
 
946
- foreach ($op in $operations) {
947
- Write-Host "Running: aiw $op"
146
+ static override examples = [
147
+ '<%= config.bin %> <%= command.id %>',
148
+ ]
948
149
 
949
- & aiw $op --quiet
150
+ static override flags = {
151
+ ...BaseCommand.baseFlags,
152
+ }
950
153
 
951
- if ($LASTEXITCODE -ne 0) {
952
- Write-Error "Operation $op failed with code $LASTEXITCODE"
953
- exit $LASTEXITCODE
954
- }
154
+ async run(): Promise<void> {
155
+ const {flags} = await this.parse(Status)
156
+ this.log('Status output')
157
+ }
955
158
  }
956
-
957
- Write-Host "All operations completed successfully"
958
- ```
959
-
960
- ### Tips for Scripting
961
-
962
- **1. Always use `--quiet` in scripts:**
963
- ```bash
964
- # Good: Clean output
965
- aiw launch --quiet
966
-
967
- # Avoid: Verbose output pollutes logs
968
- aiw launch
969
- ```
970
-
971
- **2. Check exit codes explicitly:**
972
- ```bash
973
- # Good: Explicit error handling
974
- aiw launch
975
- if [ $? -ne 0 ]; then
976
- handle_error
977
- fi
978
-
979
- # Risky: Assumes success
980
- aiw launch
981
- continue_anyway
982
159
  ```
983
160
 
984
- **3. Pipe stderr to log files:**
985
- ```bash
986
- # Capture errors for debugging
987
- aiw launch 2>errors.log
988
-
989
- # Capture both stdout and stderr
990
- aiw launch >output.log 2>&1
991
- ```
992
-
993
- **4. Use timeout for long operations:**
994
- ```bash
995
- # Bash: timeout after 60 seconds
996
- timeout 60 aiw launch || echo "Timeout or error"
997
-
998
- # PowerShell: timeout after 60 seconds
999
- Start-Process -Wait -Timeout 60 -NoNewWindow aiw -ArgumentList "launch"
1000
- ```
1001
-
1002
- **5. Combine with other CLI tools:**
1003
- ```bash
1004
- # Log with timestamp
1005
- aiw launch --quiet 2>&1 | while read line; do
1006
- echo "$(date -Is) $line"
1007
- done
1008
-
1009
- # Notify on completion (Linux/macOS)
1010
- aiw launch --quiet && notify-send "AIW launch complete"
1011
-
1012
- # Email on failure (with sendmail)
1013
- aiw launch --quiet || echo "AIW launch failed" | mail -s "Alert" admin@example.com
1014
- ```
1015
-
1016
- ## Command Development Guide
1017
-
1018
- This section explains how to add new commands to AIW CLI following Oclif best practices and our established patterns.
1019
-
1020
- ### Command Architecture
1021
-
1022
- AIW CLI uses [Oclif](https://oclif.io) which provides automatic command registration based on file structure:
1023
-
1024
- - **File path = Command name**: `src/commands/launch.ts` → `aiw launch`
1025
- - **Subdirectories = Topics**: `src/commands/init/index.ts` → `aiw init`
1026
- - **Class names**: PascalCase version of command name (`Launch`, `Init`)
1027
-
1028
- ### Adding a New Top-Level Command
1029
-
1030
- 1. **Create the command file** in `src/commands/`:
1031
- ```bash
1032
- # Example: Adding a "status" command
1033
- touch src/commands/status.ts
1034
- ```
1035
-
1036
- 2. **Implement the command**:
1037
- ```typescript
1038
- import {Flags} from '@oclif/core'
1039
-
1040
- import BaseCommand from '../lib/base-command.js'
1041
-
1042
- export default class Status extends BaseCommand {
1043
- static override description = 'Show AIW status'
161
+ 2. Add tests in `test/commands/`.
1044
162
 
1045
- static override examples = [
1046
- '<%= config.bin %> <%= command.id %>',
1047
- '<%= config.bin %> <%= command.id %> --debug',
1048
- ]
163
+ ### Standard Flags
1049
164
 
1050
- static override flags = {
1051
- ...BaseCommand.baseFlags, // Inherit global flags
1052
- // Add command-specific flags here
1053
- }
165
+ All commands inherit from `BaseCommand`: `--debug` (`-d`), `--help` (`-h`), `--quiet` (`-q`).
1054
166
 
1055
- async run(): Promise<void> {
1056
- const {flags} = await this.parse(Status)
1057
- // Implementation here
1058
- this.log('Status output')
1059
- }
1060
- }
1061
- ```
1062
-
1063
- 3. **Add tests** in `test/commands/`:
1064
- ```typescript
1065
- // test/commands/status.test.ts
1066
- import {expect, test} from '@oclif/test'
1067
-
1068
- describe('status', () => {
1069
- test
1070
- .stdout()
1071
- .command(['status'])
1072
- .it('shows status', ctx => {
1073
- expect(ctx.stdout).to.contain('Status output')
1074
- })
1075
- })
1076
- ```
1077
-
1078
- ### Adding a Topic (Command Group)
1079
-
1080
- Topics organize related commands under a common namespace:
1081
-
1082
- 1. **Create directory** in `src/commands/`:
1083
- ```bash
1084
- mkdir src/commands/config
1085
- ```
1086
-
1087
- 2. **Add topic commands**:
1088
- ```typescript
1089
- // src/commands/config/show.ts → aiw config show
1090
- // src/commands/config/edit.ts → aiw config edit
1091
- ```
1092
-
1093
- ### Standard Flag Patterns
1094
-
1095
- All commands should inherit base flags from `BaseCommand`:
1096
-
1097
- | Flag | Long Form | Short Form | Purpose |
1098
- |------|-----------|------------|---------|
1099
- | Debug | `--debug` | `-d` | Enable verbose logging |
1100
- | Help | `--help` | `-h` | Show command help |
1101
- | Quiet | `--quiet` | `-q` | Suppress informational output (errors still shown) |
1102
-
1103
- **Pattern:**
1104
- ```typescript
1105
- static override flags = {
1106
- ...BaseCommand.baseFlags, // Always inherit base flags
1107
- myFlag: Flags.string({
1108
- char: 'm', // Short form
1109
- description: 'My flag description',
1110
- required: false,
1111
- }),
1112
- }
1113
- ```
1114
-
1115
- ### Naming Conventions
167
+ ### Conventions
1116
168
 
1117
169
  | Element | Convention | Example |
1118
170
  |---------|------------|---------|
1119
- | Command files | kebab-case | `launch.ts`, `init/index.ts` |
1120
- | Command classes | PascalCase | `Launch`, `Init` |
1121
- | Flags | camelCase | `debug`, `aiwDir`, `quiet` |
171
+ | Command files | kebab-case | `launch.ts` |
172
+ | Command classes | PascalCase | `Launch` |
173
+ | Flags | camelCase | `debug`, `aiwDir` |
1122
174
  | Constants | UPPER_SNAKE_CASE | `EXIT_CODES.SUCCESS` |
1123
175
 
1124
- ### Import Organization
1125
-
1126
- Follow strict import order (enforced by ESLint):
1127
-
1128
- ```typescript
1129
- // 1. Node builtins (with node: prefix)
1130
- import {spawn} from 'node:child_process'
1131
-
1132
- // 2. External packages
1133
- import {Flags} from '@oclif/core'
1134
-
1135
- // 3. Internal imports
1136
- import BaseCommand from '../lib/base-command.js'
1137
- import {getAiwDir} from '../lib/config.js'
1138
-
1139
- // 4. Type imports
1140
- import type {LaunchOptions} from '../types/index.js'
1141
- ```
176
+ Import order: Node builtins (with `node:` prefix) > external packages > internal imports > type imports.
1142
177
 
1143
178
  ### Error Handling
1144
179
 
1145
- Use categorized exit codes and actionable error messages:
1146
-
1147
180
  ```typescript
1148
181
  import {EXIT_CODES} from '../types/index.js'
1149
182
 
1150
- // Actionable error format: {what_wrong}. {how_to_fix}
1151
183
  this.error(
1152
184
  'Configuration file not found. Run `aiw init` to initialize.',
1153
185
  {exit: EXIT_CODES.ENVIRONMENT_ERROR}
1154
186
  )
1155
187
  ```
1156
188
 
1157
- **Exit codes:**
1158
- - `EXIT_CODES.SUCCESS` (0) - Successful execution
1159
- - `EXIT_CODES.GENERAL_ERROR` (1) - General error
1160
- - `EXIT_CODES.INVALID_USAGE` (2) - Invalid arguments
1161
- - `EXIT_CODES.ENVIRONMENT_ERROR` (3) - Environment/prerequisite error
1162
-
1163
- ### Help System
1164
-
1165
- Oclif provides built-in help:
1166
-
1167
- - `aiw <command> --help` - Show command help
1168
- - `aiw help <command>` - Alternative help format (same output)
1169
- - `aiw help` - List all commands
1170
-
1171
- Help is automatically generated from command metadata (description, examples, flags).
1172
-
1173
- ### Testing Commands
189
+ ### Rules
1174
190
 
1175
- 1. **Unit tests** (`test/commands/<command>.test.ts`):
1176
- - Test command logic in isolation
1177
- - Mock external dependencies
1178
-
1179
- 2. **Integration tests** (`test/integration/<feature>.test.ts`):
1180
- - Test actual CLI invocation
1181
- - Use `execSync()` to run commands
1182
- - Cross-platform compatibility
1183
-
1184
- **Example:**
1185
- ```typescript
1186
- import {execSync} from 'node:child_process'
1187
- import {platform} from 'node:os'
1188
-
1189
- const bin = platform() === 'win32' ? String.raw`.\bin\dev.cmd` : './bin/dev.js'
191
+ **Must:**
192
+ - Extend `BaseCommand`, inherit `BaseCommand.baseFlags`
193
+ - Use `.js` extension in all imports (ESM)
194
+ - Add `node:` prefix for Node builtins
195
+ - Use `this.error()` not `process.exit()`
196
+ - Provide both short and long flag forms
1190
197
 
1191
- it('executes command', () => {
1192
- const result = execSync(`${bin} status`, {encoding: 'utf8'})
1193
- expect(result).to.include('expected output')
1194
- })
1195
- ```
198
+ **Must not:**
199
+ - Call `process.exit()` directly
200
+ - Create utils in `src/utils/` or `src/helpers/` (use `src/lib/`)
201
+ - Use `I` prefix on interfaces
202
+ - Skip `.js` extension in imports
203
+ - Use Promise chains (use async/await)
1196
204
 
1197
205
  ### Project Structure
1198
206
 
1199
207
  ```
1200
- aiwcli/
208
+ packages/cli/
1201
209
  ├── src/
1202
210
  │ ├── commands/
1203
- │ │ ├── branch.ts # aiw branch <branchName>
1204
- │ │ ├── launch.ts # aiw launch
1205
- │ │ └── init/ # Topic: aiw init
1206
- │ └── index.ts # aiw init --method <template>
1207
- │ ├── lib/ # Internal libraries
1208
- │ │ ├── base-command.ts # BaseCommand (extend this)
211
+ │ │ ├── branch.ts
212
+ │ │ ├── launch.ts
213
+ │ │ └── init/index.ts
214
+ ├── lib/
215
+ ├── base-command.ts
1209
216
  │ │ ├── config.ts
1210
217
  │ │ ├── debug.ts
1211
218
  │ │ ├── errors.ts
1212
219
  │ │ └── spawn.ts
1213
- │ └── types/ # Type definitions
1214
- │ └── index.ts
220
+ │ └── types/index.ts
1215
221
  ├── test/
1216
- │ ├── commands/ # Unit tests
1217
- │ ├── lib/ # Library tests
1218
- │ └── integration/ # Integration tests
222
+ │ ├── commands/
223
+ │ ├── lib/
224
+ │ └── integration/
1219
225
  └── README.md
1220
226
  ```
1221
-
1222
- ### Critical Rules
1223
-
1224
- **MUST:**
1225
- - Extend `BaseCommand` for all commands
1226
- - Inherit `BaseCommand.baseFlags` in flag definitions
1227
- - Use `.js` extension in all imports (ESM requirement)
1228
- - Add `node:` prefix for Node builtins
1229
- - Use `this.error()` instead of `process.exit()`
1230
- - Provide both short (`-f`) and long (`--flag`) flag forms
1231
- - Follow kebab-case for command file names
1232
-
1233
- **MUST NOT:**
1234
- - Call `process.exit()` directly
1235
- - Create utilities in `src/utils/` or `src/helpers/` (use `src/lib/`)
1236
- - Use `I` prefix on interfaces (`Config` not `IConfig`)
1237
- - Skip the `.js` extension in imports
1238
- - Use Promise chains (use async/await)
1239
-
1240
- ### Resources
1241
-
1242
- - [Oclif Documentation](https://oclif.io/docs)
1243
- - [Oclif Commands](https://oclif.io/docs/commands)
1244
- - [Oclif Flags](https://oclif.io/docs/flags)
1245
- - [Oclif Topics](https://oclif.io/docs/topics)