moai-adk 0.35.1__py3-none-any.whl

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.

Potentially problematic release.


This version of moai-adk might be problematic. Click here for more details.

Files changed (502) hide show
  1. moai_adk/__init__.py +10 -0
  2. moai_adk/__main__.py +199 -0
  3. moai_adk/cli/__init__.py +6 -0
  4. moai_adk/cli/commands/__init__.py +17 -0
  5. moai_adk/cli/commands/analyze.py +116 -0
  6. moai_adk/cli/commands/doctor.py +272 -0
  7. moai_adk/cli/commands/init.py +372 -0
  8. moai_adk/cli/commands/language.py +248 -0
  9. moai_adk/cli/commands/status.py +104 -0
  10. moai_adk/cli/commands/update.py +2686 -0
  11. moai_adk/cli/main.py +13 -0
  12. moai_adk/cli/prompts/__init__.py +5 -0
  13. moai_adk/cli/prompts/init_prompts.py +219 -0
  14. moai_adk/cli/spec_status.py +263 -0
  15. moai_adk/cli/ui/__init__.py +44 -0
  16. moai_adk/cli/ui/progress.py +422 -0
  17. moai_adk/cli/ui/prompts.py +389 -0
  18. moai_adk/cli/ui/theme.py +129 -0
  19. moai_adk/cli/worktree/__init__.py +27 -0
  20. moai_adk/cli/worktree/__main__.py +31 -0
  21. moai_adk/cli/worktree/cli.py +683 -0
  22. moai_adk/cli/worktree/exceptions.py +89 -0
  23. moai_adk/cli/worktree/manager.py +493 -0
  24. moai_adk/cli/worktree/models.py +65 -0
  25. moai_adk/cli/worktree/registry.py +422 -0
  26. moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
  27. moai_adk/core/__init__.py +1 -0
  28. moai_adk/core/analysis/__init__.py +9 -0
  29. moai_adk/core/analysis/session_analyzer.py +400 -0
  30. moai_adk/core/claude_integration.py +393 -0
  31. moai_adk/core/command_helpers.py +270 -0
  32. moai_adk/core/comprehensive_monitoring_system.py +1183 -0
  33. moai_adk/core/config/__init__.py +19 -0
  34. moai_adk/core/config/auto_spec_config.py +340 -0
  35. moai_adk/core/config/migration.py +244 -0
  36. moai_adk/core/config/unified.py +436 -0
  37. moai_adk/core/context_manager.py +273 -0
  38. moai_adk/core/diagnostics/__init__.py +19 -0
  39. moai_adk/core/diagnostics/slash_commands.py +159 -0
  40. moai_adk/core/enterprise_features.py +1404 -0
  41. moai_adk/core/error_recovery_system.py +1902 -0
  42. moai_adk/core/event_driven_hook_system.py +1371 -0
  43. moai_adk/core/git/__init__.py +31 -0
  44. moai_adk/core/git/branch.py +25 -0
  45. moai_adk/core/git/branch_manager.py +129 -0
  46. moai_adk/core/git/checkpoint.py +134 -0
  47. moai_adk/core/git/commit.py +67 -0
  48. moai_adk/core/git/conflict_detector.py +413 -0
  49. moai_adk/core/git/event_detector.py +79 -0
  50. moai_adk/core/git/manager.py +216 -0
  51. moai_adk/core/hooks/post_tool_auto_spec_completion.py +901 -0
  52. moai_adk/core/input_validation_middleware.py +1006 -0
  53. moai_adk/core/integration/__init__.py +22 -0
  54. moai_adk/core/integration/engine.py +157 -0
  55. moai_adk/core/integration/integration_tester.py +226 -0
  56. moai_adk/core/integration/models.py +88 -0
  57. moai_adk/core/integration/utils.py +211 -0
  58. moai_adk/core/issue_creator.py +305 -0
  59. moai_adk/core/jit_context_loader.py +956 -0
  60. moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
  61. moai_adk/core/language_config.py +202 -0
  62. moai_adk/core/language_config_resolver.py +572 -0
  63. moai_adk/core/language_validator.py +543 -0
  64. moai_adk/core/mcp/setup.py +116 -0
  65. moai_adk/core/merge/__init__.py +9 -0
  66. moai_adk/core/merge/analyzer.py +605 -0
  67. moai_adk/core/migration/__init__.py +18 -0
  68. moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
  69. moai_adk/core/migration/backup_manager.py +277 -0
  70. moai_adk/core/migration/custom_element_scanner.py +358 -0
  71. moai_adk/core/migration/file_migrator.py +209 -0
  72. moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
  73. moai_adk/core/migration/selective_restorer.py +470 -0
  74. moai_adk/core/migration/template_utils.py +74 -0
  75. moai_adk/core/migration/user_selection_ui.py +338 -0
  76. moai_adk/core/migration/version_detector.py +139 -0
  77. moai_adk/core/migration/version_migrator.py +228 -0
  78. moai_adk/core/performance/__init__.py +6 -0
  79. moai_adk/core/performance/cache_system.py +316 -0
  80. moai_adk/core/performance/parallel_processor.py +116 -0
  81. moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
  82. moai_adk/core/project/__init__.py +1 -0
  83. moai_adk/core/project/backup_utils.py +70 -0
  84. moai_adk/core/project/checker.py +300 -0
  85. moai_adk/core/project/detector.py +293 -0
  86. moai_adk/core/project/initializer.py +387 -0
  87. moai_adk/core/project/phase_executor.py +716 -0
  88. moai_adk/core/project/validator.py +139 -0
  89. moai_adk/core/quality/__init__.py +6 -0
  90. moai_adk/core/quality/trust_checker.py +377 -0
  91. moai_adk/core/quality/validators/__init__.py +6 -0
  92. moai_adk/core/quality/validators/base_validator.py +19 -0
  93. moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
  94. moai_adk/core/robust_json_parser.py +611 -0
  95. moai_adk/core/rollback_manager.py +918 -0
  96. moai_adk/core/session_manager.py +651 -0
  97. moai_adk/core/skill_loading_system.py +579 -0
  98. moai_adk/core/spec/confidence_scoring.py +680 -0
  99. moai_adk/core/spec/ears_template_engine.py +1247 -0
  100. moai_adk/core/spec/quality_validator.py +687 -0
  101. moai_adk/core/spec_status_manager.py +478 -0
  102. moai_adk/core/template/__init__.py +7 -0
  103. moai_adk/core/template/backup.py +174 -0
  104. moai_adk/core/template/config.py +191 -0
  105. moai_adk/core/template/languages.py +43 -0
  106. moai_adk/core/template/merger.py +233 -0
  107. moai_adk/core/template/processor.py +1200 -0
  108. moai_adk/core/template_engine.py +310 -0
  109. moai_adk/core/template_variable_synchronizer.py +417 -0
  110. moai_adk/core/unified_permission_manager.py +745 -0
  111. moai_adk/core/user_behavior_analytics.py +851 -0
  112. moai_adk/core/version_sync.py +429 -0
  113. moai_adk/foundation/__init__.py +56 -0
  114. moai_adk/foundation/backend.py +1027 -0
  115. moai_adk/foundation/database.py +1115 -0
  116. moai_adk/foundation/devops.py +1585 -0
  117. moai_adk/foundation/ears.py +431 -0
  118. moai_adk/foundation/frontend.py +870 -0
  119. moai_adk/foundation/git/commit_templates.py +557 -0
  120. moai_adk/foundation/git.py +376 -0
  121. moai_adk/foundation/langs.py +484 -0
  122. moai_adk/foundation/ml_ops.py +1162 -0
  123. moai_adk/foundation/testing.py +1524 -0
  124. moai_adk/foundation/trust/trust_principles.py +676 -0
  125. moai_adk/foundation/trust/validation_checklist.py +1573 -0
  126. moai_adk/project/__init__.py +0 -0
  127. moai_adk/project/configuration.py +1084 -0
  128. moai_adk/project/documentation.py +566 -0
  129. moai_adk/project/schema.py +447 -0
  130. moai_adk/statusline/__init__.py +38 -0
  131. moai_adk/statusline/alfred_detector.py +105 -0
  132. moai_adk/statusline/config.py +376 -0
  133. moai_adk/statusline/enhanced_output_style_detector.py +372 -0
  134. moai_adk/statusline/git_collector.py +190 -0
  135. moai_adk/statusline/main.py +322 -0
  136. moai_adk/statusline/metrics_tracker.py +78 -0
  137. moai_adk/statusline/renderer.py +343 -0
  138. moai_adk/statusline/update_checker.py +129 -0
  139. moai_adk/statusline/version_reader.py +741 -0
  140. moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +714 -0
  141. moai_adk/templates/.claude/agents/moai/builder-agent.md +474 -0
  142. moai_adk/templates/.claude/agents/moai/builder-command.md +1172 -0
  143. moai_adk/templates/.claude/agents/moai/builder-plugin.md +637 -0
  144. moai_adk/templates/.claude/agents/moai/builder-skill.md +666 -0
  145. moai_adk/templates/.claude/agents/moai/expert-backend.md +899 -0
  146. moai_adk/templates/.claude/agents/moai/expert-database.md +777 -0
  147. moai_adk/templates/.claude/agents/moai/expert-debug.md +401 -0
  148. moai_adk/templates/.claude/agents/moai/expert-devops.md +720 -0
  149. moai_adk/templates/.claude/agents/moai/expert-frontend.md +734 -0
  150. moai_adk/templates/.claude/agents/moai/expert-performance.md +657 -0
  151. moai_adk/templates/.claude/agents/moai/expert-security.md +513 -0
  152. moai_adk/templates/.claude/agents/moai/expert-testing.md +733 -0
  153. moai_adk/templates/.claude/agents/moai/expert-uiux.md +1041 -0
  154. moai_adk/templates/.claude/agents/moai/manager-claude-code.md +432 -0
  155. moai_adk/templates/.claude/agents/moai/manager-docs.md +573 -0
  156. moai_adk/templates/.claude/agents/moai/manager-git.md +1060 -0
  157. moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
  158. moai_adk/templates/.claude/agents/moai/manager-quality.md +624 -0
  159. moai_adk/templates/.claude/agents/moai/manager-spec.md +809 -0
  160. moai_adk/templates/.claude/agents/moai/manager-strategy.md +780 -0
  161. moai_adk/templates/.claude/agents/moai/manager-tdd.md +784 -0
  162. moai_adk/templates/.claude/agents/moai/mcp-context7.md +458 -0
  163. moai_adk/templates/.claude/agents/moai/mcp-figma.md +1607 -0
  164. moai_adk/templates/.claude/agents/moai/mcp-notion.md +789 -0
  165. moai_adk/templates/.claude/agents/moai/mcp-playwright.md +469 -0
  166. moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +1032 -0
  167. moai_adk/templates/.claude/commands/moai/0-project.md +1386 -0
  168. moai_adk/templates/.claude/commands/moai/1-plan.md +1427 -0
  169. moai_adk/templates/.claude/commands/moai/2-run.md +943 -0
  170. moai_adk/templates/.claude/commands/moai/3-sync.md +1324 -0
  171. moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
  172. moai_adk/templates/.claude/hooks/__init__.py +8 -0
  173. moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
  174. moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
  175. moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
  176. moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
  177. moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
  178. moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
  179. moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
  180. moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
  181. moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
  182. moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
  183. moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
  184. moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
  185. moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
  186. moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
  187. moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
  188. moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
  189. moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +1083 -0
  190. moai_adk/templates/.claude/output-styles/moai/r2d2.md +560 -0
  191. moai_adk/templates/.claude/output-styles/moai/yoda.md +359 -0
  192. moai_adk/templates/.claude/settings.json +172 -0
  193. moai_adk/templates/.claude/skills/moai-ai-nano-banana/SKILL.md +307 -0
  194. moai_adk/templates/.claude/skills/moai-ai-nano-banana/examples.md +431 -0
  195. moai_adk/templates/.claude/skills/moai-ai-nano-banana/scripts/batch_generate.py +560 -0
  196. moai_adk/templates/.claude/skills/moai-ai-nano-banana/scripts/generate_image.py +362 -0
  197. moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +249 -0
  198. moai_adk/templates/.claude/skills/moai-docs-generation/examples.md +406 -0
  199. moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
  200. moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
  201. moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
  202. moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
  203. moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
  204. moai_adk/templates/.claude/skills/moai-docs-generation/reference.md +328 -0
  205. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +320 -0
  206. moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +718 -0
  207. moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +464 -0
  208. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +323 -0
  209. moai_adk/templates/.claude/skills/moai-domain-database/examples.md +830 -0
  210. moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
  211. moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
  212. moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
  213. moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
  214. moai_adk/templates/.claude/skills/moai-domain-database/reference.md +545 -0
  215. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +497 -0
  216. moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +968 -0
  217. moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +664 -0
  218. moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +455 -0
  219. moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
  220. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
  221. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
  222. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
  223. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
  224. moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
  225. moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +492 -0
  226. moai_adk/templates/.claude/skills/moai-formats-data/examples.md +804 -0
  227. moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
  228. moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
  229. moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
  230. moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
  231. moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
  232. moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
  233. moai_adk/templates/.claude/skills/moai-formats-data/reference.md +585 -0
  234. moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +202 -0
  235. moai_adk/templates/.claude/skills/moai-foundation-claude/examples.md +732 -0
  236. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
  237. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
  238. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
  239. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
  240. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
  241. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
  242. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
  243. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
  244. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
  245. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
  246. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
  247. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
  248. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
  249. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
  250. moai_adk/templates/.claude/skills/moai-foundation-claude/reference.md +209 -0
  251. moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +441 -0
  252. moai_adk/templates/.claude/skills/moai-foundation-context/examples.md +1048 -0
  253. moai_adk/templates/.claude/skills/moai-foundation-context/reference.md +246 -0
  254. moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +420 -0
  255. moai_adk/templates/.claude/skills/moai-foundation-core/examples.md +358 -0
  256. moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
  257. moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +359 -0
  258. moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
  259. moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
  260. moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
  261. moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
  262. moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
  263. moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
  264. moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
  265. moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
  266. moai_adk/templates/.claude/skills/moai-foundation-core/reference.md +478 -0
  267. moai_adk/templates/.claude/skills/moai-foundation-philosopher/SKILL.md +315 -0
  268. moai_adk/templates/.claude/skills/moai-foundation-philosopher/examples.md +228 -0
  269. moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/assumption-matrix.md +80 -0
  270. moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/cognitive-bias.md +199 -0
  271. moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/first-principles.md +140 -0
  272. moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/trade-off-analysis.md +154 -0
  273. moai_adk/templates/.claude/skills/moai-foundation-philosopher/reference.md +157 -0
  274. moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +364 -0
  275. moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
  276. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
  277. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
  278. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
  279. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
  280. moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
  281. moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
  282. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
  283. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
  284. moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +649 -0
  285. moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +478 -0
  286. moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +612 -0
  287. moai_adk/templates/.claude/skills/moai-lang-flutter/SKILL.md +477 -0
  288. moai_adk/templates/.claude/skills/moai-lang-flutter/examples.md +1090 -0
  289. moai_adk/templates/.claude/skills/moai-lang-flutter/reference.md +686 -0
  290. moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +376 -0
  291. moai_adk/templates/.claude/skills/moai-lang-go/examples.md +919 -0
  292. moai_adk/templates/.claude/skills/moai-lang-go/reference.md +737 -0
  293. moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +385 -0
  294. moai_adk/templates/.claude/skills/moai-lang-java/examples.md +864 -0
  295. moai_adk/templates/.claude/skills/moai-lang-java/reference.md +291 -0
  296. moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +382 -0
  297. moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +1006 -0
  298. moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +562 -0
  299. moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +644 -0
  300. moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +481 -0
  301. moai_adk/templates/.claude/skills/moai-lang-python/examples.md +977 -0
  302. moai_adk/templates/.claude/skills/moai-lang-python/reference.md +804 -0
  303. moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +579 -0
  304. moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +687 -0
  305. moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +372 -0
  306. moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +659 -0
  307. moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +504 -0
  308. moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +497 -0
  309. moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +633 -0
  310. moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +423 -0
  311. moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +497 -0
  312. moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +918 -0
  313. moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +672 -0
  314. moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +368 -0
  315. moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +1089 -0
  316. moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +731 -0
  317. moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +300 -0
  318. moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
  319. moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
  320. moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
  321. moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
  322. moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +319 -0
  323. moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
  324. moai_adk/templates/.claude/skills/moai-library-nextra/examples.md +592 -0
  325. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
  326. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
  327. moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
  328. moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
  329. moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
  330. moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
  331. moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
  332. moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
  333. moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
  334. moai_adk/templates/.claude/skills/moai-library-nextra/reference.md +379 -0
  335. moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +372 -0
  336. moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
  337. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
  338. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
  339. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
  340. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
  341. moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
  342. moai_adk/templates/.claude/skills/moai-mcp-figma/SKILL.md +402 -0
  343. moai_adk/templates/.claude/skills/moai-mcp-figma/advanced-patterns.md +607 -0
  344. moai_adk/templates/.claude/skills/moai-mcp-notion/SKILL.md +300 -0
  345. moai_adk/templates/.claude/skills/moai-mcp-notion/advanced-patterns.md +537 -0
  346. moai_adk/templates/.claude/skills/moai-platform-auth0/SKILL.md +291 -0
  347. moai_adk/templates/.claude/skills/moai-platform-clerk/SKILL.md +390 -0
  348. moai_adk/templates/.claude/skills/moai-platform-convex/SKILL.md +398 -0
  349. moai_adk/templates/.claude/skills/moai-platform-firebase-auth/SKILL.md +379 -0
  350. moai_adk/templates/.claude/skills/moai-platform-firestore/SKILL.md +358 -0
  351. moai_adk/templates/.claude/skills/moai-platform-neon/SKILL.md +467 -0
  352. moai_adk/templates/.claude/skills/moai-platform-railway/SKILL.md +377 -0
  353. moai_adk/templates/.claude/skills/moai-platform-supabase/SKILL.md +466 -0
  354. moai_adk/templates/.claude/skills/moai-platform-vercel/SKILL.md +482 -0
  355. moai_adk/templates/.claude/skills/moai-plugin-builder/SKILL.md +474 -0
  356. moai_adk/templates/.claude/skills/moai-plugin-builder/examples.md +621 -0
  357. moai_adk/templates/.claude/skills/moai-plugin-builder/migration.md +341 -0
  358. moai_adk/templates/.claude/skills/moai-plugin-builder/reference.md +463 -0
  359. moai_adk/templates/.claude/skills/moai-plugin-builder/validation.md +373 -0
  360. moai_adk/templates/.claude/skills/moai-security-auth0/SKILL.md +275 -0
  361. moai_adk/templates/.claude/skills/moai-security-auth0/modules/adaptive-mfa.md +233 -0
  362. moai_adk/templates/.claude/skills/moai-security-auth0/modules/akamai-integration.md +215 -0
  363. moai_adk/templates/.claude/skills/moai-security-auth0/modules/application-credentials.md +280 -0
  364. moai_adk/templates/.claude/skills/moai-security-auth0/modules/attack-protection-log-events.md +225 -0
  365. moai_adk/templates/.claude/skills/moai-security-auth0/modules/attack-protection-overview.md +140 -0
  366. moai_adk/templates/.claude/skills/moai-security-auth0/modules/bot-detection.md +144 -0
  367. moai_adk/templates/.claude/skills/moai-security-auth0/modules/breached-password-detection.md +187 -0
  368. moai_adk/templates/.claude/skills/moai-security-auth0/modules/brute-force-protection.md +189 -0
  369. moai_adk/templates/.claude/skills/moai-security-auth0/modules/certifications.md +282 -0
  370. moai_adk/templates/.claude/skills/moai-security-auth0/modules/compliance-overview.md +263 -0
  371. moai_adk/templates/.claude/skills/moai-security-auth0/modules/continuous-session-protection.md +307 -0
  372. moai_adk/templates/.claude/skills/moai-security-auth0/modules/customize-mfa.md +178 -0
  373. moai_adk/templates/.claude/skills/moai-security-auth0/modules/dpop-implementation.md +283 -0
  374. moai_adk/templates/.claude/skills/moai-security-auth0/modules/fapi-implementation.md +259 -0
  375. moai_adk/templates/.claude/skills/moai-security-auth0/modules/gdpr-compliance.md +313 -0
  376. moai_adk/templates/.claude/skills/moai-security-auth0/modules/guardian-configuration.md +269 -0
  377. moai_adk/templates/.claude/skills/moai-security-auth0/modules/highly-regulated-identity.md +272 -0
  378. moai_adk/templates/.claude/skills/moai-security-auth0/modules/jwt-fundamentals.md +248 -0
  379. moai_adk/templates/.claude/skills/moai-security-auth0/modules/mdl-verification.md +211 -0
  380. moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-api-management.md +278 -0
  381. moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-factors.md +226 -0
  382. moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-overview.md +174 -0
  383. moai_adk/templates/.claude/skills/moai-security-auth0/modules/mtls-sender-constraining.md +316 -0
  384. moai_adk/templates/.claude/skills/moai-security-auth0/modules/ropg-flow-mfa.md +217 -0
  385. moai_adk/templates/.claude/skills/moai-security-auth0/modules/security-center.md +325 -0
  386. moai_adk/templates/.claude/skills/moai-security-auth0/modules/security-guidance.md +277 -0
  387. moai_adk/templates/.claude/skills/moai-security-auth0/modules/state-parameters.md +178 -0
  388. moai_adk/templates/.claude/skills/moai-security-auth0/modules/step-up-authentication.md +251 -0
  389. moai_adk/templates/.claude/skills/moai-security-auth0/modules/suspicious-ip-throttling.md +240 -0
  390. moai_adk/templates/.claude/skills/moai-security-auth0/modules/tenant-access-control.md +180 -0
  391. moai_adk/templates/.claude/skills/moai-security-auth0/modules/webauthn-fido.md +235 -0
  392. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +449 -0
  393. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
  394. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/examples.md +544 -0
  395. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
  396. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/reference.md +307 -0
  397. moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
  398. moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +390 -0
  399. moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
  400. moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
  401. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
  402. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
  403. moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
  404. moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +175 -0
  405. moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
  406. moai_adk/templates/.claude/skills/moai-workflow-project/examples.md +547 -0
  407. moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
  408. moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
  409. moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
  410. moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
  411. moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
  412. moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
  413. moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
  414. moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
  415. moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
  416. moai_adk/templates/.claude/skills/moai-workflow-project/reference.md +275 -0
  417. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
  418. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1434 -0
  419. moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
  420. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
  421. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
  422. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +92 -0
  423. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
  424. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
  425. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
  426. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
  427. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
  428. moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
  429. moai_adk/templates/.claude/skills/moai-workflow-spec/SKILL.md +534 -0
  430. moai_adk/templates/.claude/skills/moai-workflow-spec/examples.md +900 -0
  431. moai_adk/templates/.claude/skills/moai-workflow-spec/reference.md +704 -0
  432. moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +377 -0
  433. moai_adk/templates/.claude/skills/moai-workflow-templates/examples.md +552 -0
  434. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
  435. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
  436. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
  437. moai_adk/templates/.claude/skills/moai-workflow-templates/reference.md +346 -0
  438. moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
  439. moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +456 -0
  440. moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
  441. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
  442. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
  443. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
  444. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
  445. moai_adk/templates/.claude/skills/moai-workflow-testing/examples.md +672 -0
  446. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
  447. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
  448. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
  449. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
  450. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
  451. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
  452. moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
  453. moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
  454. moai_adk/templates/.claude/skills/moai-workflow-testing/reference.md +440 -0
  455. moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
  456. moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
  457. moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
  458. moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +411 -0
  459. moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
  460. moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
  461. moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
  462. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
  463. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
  464. moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
  465. moai_adk/templates/.git-hooks/pre-commit +128 -0
  466. moai_adk/templates/.git-hooks/pre-push +365 -0
  467. moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
  468. moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
  469. moai_adk/templates/.github/workflows/spec-issue-sync.yml +337 -0
  470. moai_adk/templates/.gitignore +222 -0
  471. moai_adk/templates/.mcp.json +13 -0
  472. moai_adk/templates/.moai/config/config.yaml +58 -0
  473. moai_adk/templates/.moai/config/questions/_schema.yaml +174 -0
  474. moai_adk/templates/.moai/config/questions/tab0-init.yaml +251 -0
  475. moai_adk/templates/.moai/config/questions/tab1-user.yaml +107 -0
  476. moai_adk/templates/.moai/config/questions/tab2-project.yaml +79 -0
  477. moai_adk/templates/.moai/config/questions/tab3-git.yaml +632 -0
  478. moai_adk/templates/.moai/config/questions/tab4-quality.yaml +182 -0
  479. moai_adk/templates/.moai/config/questions/tab5-system.yaml +96 -0
  480. moai_adk/templates/.moai/config/sections/git-strategy.yaml +116 -0
  481. moai_adk/templates/.moai/config/sections/language.yaml +11 -0
  482. moai_adk/templates/.moai/config/sections/project.yaml +13 -0
  483. moai_adk/templates/.moai/config/sections/quality.yaml +17 -0
  484. moai_adk/templates/.moai/config/sections/system.yaml +24 -0
  485. moai_adk/templates/.moai/config/sections/user.yaml +5 -0
  486. moai_adk/templates/.moai/config/statusline-config.yaml +92 -0
  487. moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
  488. moai_adk/templates/CLAUDE.md +642 -0
  489. moai_adk/utils/__init__.py +30 -0
  490. moai_adk/utils/banner.py +38 -0
  491. moai_adk/utils/common.py +294 -0
  492. moai_adk/utils/link_validator.py +241 -0
  493. moai_adk/utils/logger.py +147 -0
  494. moai_adk/utils/safe_file_reader.py +206 -0
  495. moai_adk/utils/timeout.py +160 -0
  496. moai_adk/utils/toon_utils.py +256 -0
  497. moai_adk/version.py +22 -0
  498. moai_adk-0.35.1.dist-info/METADATA +3018 -0
  499. moai_adk-0.35.1.dist-info/RECORD +502 -0
  500. moai_adk-0.35.1.dist-info/WHEEL +4 -0
  501. moai_adk-0.35.1.dist-info/entry_points.txt +3 -0
  502. moai_adk-0.35.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1427 @@
1
+ ---
2
+ name: moai:1-plan
3
+ description: "Define specifications and create development branch or worktree"
4
+ argument-hint: Title 1 Title 2 ... | SPEC-ID modifications [--worktree | --branch]
5
+ allowed-tools: Task, AskUserQuestion, TodoWrite
6
+ model: inherit
7
+ ---
8
+
9
+ ## Pre-execution Context
10
+
11
+ !git status --porcelain
12
+ !git branch --show-current
13
+ !git log --oneline -10
14
+ !git diff --name-only HEAD
15
+ !find .moai/specs -name "\*.md" -type f 2>/dev/null
16
+
17
+ ## Essential Files
18
+
19
+ @.moai/config/config.yaml
20
+ @.moai/project/product.md
21
+ @.moai/project/structure.md
22
+ @.moai/project/tech.md
23
+ .moai/specs/
24
+
25
+ ---
26
+
27
+ # MoAI-ADK Step 1: Establish a plan (Plan) - Always make a plan first and then proceed
28
+
29
+ User Interaction Architecture: AskUserQuestion must be used at COMMAND level only. Subagents invoked via Task() operate in isolated, stateless contexts and cannot interact with users. Collect all user input BEFORE delegating to agents.
30
+
31
+ Batched Design: All AskUserQuestion calls follow batched design principles (1-4 questions per call, max 4 options per question) to minimize user interaction turns. See CLAUDE.md section "User Interaction Architecture" for details.
32
+
33
+ 4-Step Workflow Integration: This command implements Steps 1-2 of Alfred's workflow (Intent Understanding → Plan Creation). See CLAUDE.md for full workflow details.
34
+
35
+ ## Command Purpose
36
+
37
+ "Plan → Run → Sync" As the first step in the workflow, it supports the entire planning process from ideation to plan creation.
38
+
39
+ Plan for: $ARGUMENTS
40
+
41
+ ### Usage Scenarios (3 Execution Patterns)
42
+
43
+ Scenario 1: SPEC Only (Default)
44
+
45
+ ```bash
46
+ /moai:1-plan "User authentication system"
47
+ ```
48
+
49
+ - Creates SPEC documents only
50
+ - Follows existing branch creation logic
51
+
52
+ Scenario 2: SPEC + Branch (Legacy)
53
+
54
+ ```bash
55
+ /moai:1-plan "User authentication system" --branch
56
+ ```
57
+
58
+ - Creates SPEC documents + Git branch
59
+ - Traditional feature branch workflow
60
+
61
+ Scenario 3: SPEC + Worktree (NEW)
62
+
63
+ ```bash
64
+ /moai:1-plan "User authentication system" --worktree
65
+ ```
66
+
67
+ - Creates SPEC documents + Git worktree
68
+ - Isolated development environment for parallel SPEC work
69
+ - Displays guidance messages for worktree navigation
70
+
71
+ Flag Priority: `--worktree` > `--branch` > default (SPEC only)
72
+
73
+ ## CodeRabbit AI Integration (Local Only)
74
+
75
+ This local environment includes CodeRabbit AI review integration for SPEC documents:
76
+
77
+ Automatic workflows:
78
+
79
+ - SPEC review: CodeRabbit analyzes SPEC metadata and EARS structure
80
+ - GitHub Issue sync: SPEC files automatically create/update GitHub Issues
81
+ - Auto-approval: Draft PRs are approved when quality meets standards (80%+)
82
+ - SPEC quality validation: Checklist for metadata, structure, and content
83
+
84
+ Scope:
85
+
86
+ - Local environment: Full CodeRabbit integration with auto-approval
87
+ - Published packages: Users get GitHub Issue sync only (no CodeRabbit)
88
+
89
+ > See `.coderabbit.yaml` for detailed review rules and SPEC validation checklist
90
+
91
+ ---
92
+
93
+ ## Associated Agents & Skills
94
+
95
+ Associated Agents for SPEC Planning and Creation:
96
+
97
+ - Explore: Codebase exploration and file system analysis
98
+ WHY: Fast, focused discovery without blocking agent
99
+ IMPACT: Reduces manual project discovery time
100
+
101
+ - manager-spec: SPEC generation in EARS format and planning
102
+ WHY: Specialized domain knowledge for structured requirements
103
+ IMPACT: Ensures consistent SPEC document quality
104
+
105
+ - manager-git: Git workflow and branch management
106
+ WHY: Encapsulates git operations with proper error handling
107
+ IMPACT: Prevents manual git errors and ensures consistency
108
+
109
+ ### Agent Delegation Strategy
110
+
111
+ Phase 1A: Research & Analysis
112
+
113
+ - Use built-in Explore agent for fast codebase analysis (read-only)
114
+ - Use Plan agent (auto-invoked in plan mode) for SPEC research
115
+ - Use MoAI manager-spec agent for SPEC generation
116
+
117
+ Phase 1B: Specialized Analysis
118
+
119
+ - Use MoAI domain agents (expert-backend, expert-database, etc.) for specialized decisions
120
+ - Use mcp-context7 for API documentation research
121
+ - Use mcp-sequential-thinking for complex architectural decisions
122
+
123
+ ---
124
+
125
+ ## Agent Invocation Patterns (CLAUDE.md Compliance)
126
+
127
+ This command uses agent execution patterns defined in CLAUDE.md (lines 96-120).
128
+
129
+ ### Sequential Phase-Based Chaining PASS
130
+
131
+ Command implements sequential chaining through 4 distinct phases:
132
+
133
+ Phase Flow:
134
+ - Phase 1A (Optional): Project Exploration via Explore subagent
135
+ - Phase 1B (Required): SPEC Planning via manager-spec subagent
136
+ - Phase 2: SPEC Document Creation via manager-spec subagent
137
+ - Phase 3: Git Branch Setup via manager-git subagent (conditional)
138
+
139
+ Each phase receives context and outputs from previous phases.
140
+
141
+ WHY: Sequential execution ensures proper dependency management
142
+ - Phase 1B needs exploration results from 1A (if applicable)
143
+ - Phase 2 requires approved plan from Phase 1B
144
+ - Phase 3 depends on created SPEC files from Phase 2
145
+
146
+ IMPACT: Skipping phases or parallel execution would violate dependencies and create incomplete specifications
147
+
148
+ ### Parallel Execution FAIL
149
+
150
+ Not applicable - phases have explicit dependencies
151
+
152
+ WHY: Each phase depends on outputs from previous phase
153
+ - Cannot create SPEC documents before plan approval
154
+ - Cannot create git branch before SPEC files exist
155
+
156
+ IMPACT: Parallel execution would cause file system inconsistencies and incomplete workflows
157
+
158
+ ### Resumable Agent Support PASS
159
+
160
+ Command supports resume pattern for draft SPECs:
161
+
162
+ Resume Command:
163
+ - `/moai:1-plan resume SPEC-XXX`
164
+ - Continues from last saved draft state
165
+ - Preserves user input and planning context
166
+
167
+ WHY: Complex planning sessions may require multiple iterations
168
+ IMPACT: Resume capability prevents loss of planning work and enables iterative refinement
169
+
170
+ ---
171
+
172
+ Refer to CLAUDE.md "Agent Chaining Patterns" (lines 96-120) for complete pattern architecture.
173
+
174
+ ---
175
+
176
+ ## Execution Philosophy: "Always make a plan first and then proceed."
177
+
178
+ `/moai:1-plan` performs SPEC planning through complete agent delegation:
179
+
180
+ ```
181
+ User Command: /moai:1-plan "description"
182
+
183
+ /moai:1-plan Command
184
+ └─ Task(subagent_type="Explore" or "manager-spec")
185
+ ├─ Phase 1A (Optional): Project Exploration
186
+ ├─ Phase 1B (Required): SPEC Planning
187
+ ├─ Phase 2: SPEC Document Creation
188
+ └─ Phase 3: Git Branch & PR Setup
189
+
190
+ Output: SPEC documents + branch (conditional) + next steps
191
+ ```
192
+
193
+ ### Key Principle: Zero Direct Tool Usage
194
+
195
+ [HARD] Complete Delegation Model:
196
+
197
+ This command uses ONLY Task() and AskUserQuestion():
198
+ WHY: Specialized agents encapsulate domain logic and ensure quality control
199
+ IMPACT: Direct tool usage bypasses expert review and quality gates
200
+
201
+ [HARD] AskUserQuestion at Command Level Only:
202
+ WHY: Subagents via Task() are stateless and cannot interact with users
203
+ IMPACT: Expecting agents to use AskUserQuestion causes workflow failures
204
+ Correct Pattern: Command collects user input, passes choices to Task() as parameters
205
+
206
+ Requirement: All file operations delegated to agents
207
+ - No Read (file operations delegated)
208
+ WHY: Agents handle context-aware file discovery
209
+ IMPACT: Direct read loses architectural context
210
+
211
+ - No Write (file operations delegated)
212
+ WHY: Agents implement validation before file creation
213
+ IMPACT: Direct write skips quality checks
214
+
215
+ - No Edit (file operations delegated)
216
+ WHY: Agents coordinate multi-file updates atomically
217
+ IMPACT: Direct edit risks partial updates
218
+
219
+ - No Bash (all bash commands delegated)
220
+ WHY: Agents handle error recovery and state consistency
221
+ IMPACT: Direct bash loses error handling context
222
+
223
+ Required Tool Usage:
224
+ - Task() for agent orchestration
225
+ WHY: Task ensures structured agent coordination
226
+ IMPACT: Uncoordinated agent calls produce inconsistent results
227
+
228
+ - AskUserQuestion() for user interaction
229
+ WHY: Structured questions ensure consistent user experience
230
+ IMPACT: Informal interaction produces ambiguous responses
231
+
232
+ All complexity is handled by specialized agents, not by direct command execution.
233
+
234
+ ---
235
+
236
+ ## The 4-Step Agent-Based Workflow Command Logic (v5.0.0)
237
+
238
+ This command implements the first 2 steps of Alfred's 4-step workflow:
239
+
240
+ 1. STEP 1: Intent Understanding (Clarify user requirements)
241
+ 2. STEP 2: Plan Creation (Create execution strategy with agent delegation)
242
+ 3. STEP 3: Task Execution (Execute via manager-tdd - NOT in this command)
243
+ 4. STEP 4: Report & Commit (Documentation and git operations - NOT in this command)
244
+
245
+ Command Scope: Only executes Steps 1-2. Steps 3-4 are executed by `/moai:2-run` and `/moai:3-sync`.
246
+
247
+ ---
248
+
249
+ ## The Command Has THREE Execution Phases
250
+
251
+ 1. PHASE 1: Project Analysis & SPEC Planning (STEP 1)
252
+ 2. PHASE 2: SPEC Document Creation (STEP 2)
253
+ 3. PHASE 3: Git Branch & PR Setup (STEP 2 continuation)
254
+
255
+ Each phase contains explicit step-by-step instructions.
256
+
257
+ ---
258
+
259
+ ## PHASE 1: Project Analysis & SPEC Planning (STEP 1)
260
+
261
+ PHASE 1 consists of two independent sub-phases to provide flexible workflow based on user request clarity:
262
+
263
+ ### PHASE 1 Workflow Overview
264
+
265
+ ```
266
+ ┌─────────────────────────────────────────────────────────────┐
267
+ │ PHASE 1: Project Analysis & SPEC Planning │
268
+ ├─────────────────────────────────────────────────────────────┤
269
+ │ │
270
+ │ Phase A (OPTIONAL) │
271
+ │ ┌─────────────────────────────────────────┐ │
272
+ │ │ Explore Agent │ │
273
+ │ │ • Find relevant files by keywords │ │
274
+ │ │ • Locate existing SPEC documents │ │
275
+ │ │ • Identify implementation patterns │ │
276
+ │ └─────────────────────────────────────────┘ │
277
+ │ ↓ │
278
+ │ (exploration results) │
279
+ │ ↓ │
280
+ │ Phase B (REQUIRED) │
281
+ │ ┌─────────────────────────────────────────┐ │
282
+ │ │ ⚙ manager-spec Agent │ │
283
+ │ │ • Analyze project documents │ │
284
+ │ │ • Propose SPEC candidates │ │
285
+ │ │ • Design EARS structure │ │
286
+ │ │ • Request user approval │ │
287
+ │ └─────────────────────────────────────────┘ │
288
+ │ ↓ │
289
+ │ Progress Report & User Confirmation │
290
+ │ • Display analysis results and plan summary │
291
+ │ • Show next steps and deliverables │
292
+ │ • Request final user approval │
293
+ │ ↓ │
294
+ │ PROCEED TO PHASE 2 │
295
+ └─────────────────────────────────────────────────────────────┘
296
+ ```
297
+
298
+ Key Points:
299
+
300
+ - Phase A is optional - Skip if user provides clear SPEC title
301
+ - Phase B is required - Always runs to analyze project and create SPEC
302
+
303
+ ---
304
+
305
+ ### PHASE 1A: Project Exploration (Optional - if needed)
306
+
307
+ #### When to run Phase A
308
+
309
+ This phase executes conditionally based on request clarity:
310
+
311
+ - [SOFT] User provides only vague/unstructured request
312
+ WHY: Vague requests require exploration to identify relevant context
313
+ IMPACT: Skipping exploration for vague requests produces unfocused SPECs
314
+
315
+ - [SOFT] Need to find existing files and patterns
316
+ WHY: Discovery prevents duplicate work and informs architecture decisions
317
+ IMPACT: Missing patterns leads to inconsistent implementation approaches
318
+
319
+ - [SOFT] Unclear about current project state
320
+ WHY: Project context shapes technical constraints and dependencies
321
+ IMPACT: Uninformed SPECs fail to account for existing architecture
322
+
323
+ #### Step 1A.1: Invoke Explore Agent (Optional)
324
+
325
+ Conditional Execution: Run Phase A ONLY if user request lacks clarity
326
+
327
+ If user request is vague or needs exploration:
328
+
329
+ Use the Explore subagent to:
330
+
331
+ Analyze the current project directory structure and relevant files based on the user request: "$ARGUMENTS"
332
+
333
+ Tasks:
334
+
335
+ 1. Find relevant files by keywords from the user request
336
+ 2. Locate existing SPEC documents (.moai/specs/\*.md)
337
+ 3. Identify implementation patterns and dependencies
338
+ 4. Discover project configuration files
339
+ 5. Analyze existing codebase structure
340
+
341
+ Report back:
342
+
343
+ - List of relevant files found
344
+ - Existing SPEC candidates discovered
345
+ - Implementation patterns identified
346
+ - Technical constraints and dependencies
347
+ - Recommendations for user clarification
348
+
349
+ Return comprehensive results to guide manager-spec agent.
350
+
351
+ Phase 1A Completion:
352
+
353
+ - Log exploration completion status
354
+ - Proceed to Phase 1B with exploration context
355
+
356
+ Else (user provided clear SPEC title):
357
+
358
+ - Skip Phase A
359
+ - Log Phase 1A as skipped
360
+ - Proceed directly to Phase 1B
361
+
362
+ Decision Logic: If user provided clear SPEC title (like "Add authentication module"), skip Phase A entirely and proceed directly to Phase B.
363
+
364
+ ---
365
+
366
+ ### PHASE 1B: SPEC Planning (Required)
367
+
368
+ #### Step 1B.1: Invoke manager-spec for project analysis
369
+
370
+ Use the manager-spec subagent to:
371
+
372
+ Analyze project and create SPEC plan for: $ARGUMENTS
373
+
374
+ Context Handling:
375
+
376
+ - If Phase 1A was executed: Continue from project exploration results
377
+ - If Phase 1A was skipped: Start fresh analysis based on user request: "$ARGUMENTS"
378
+
379
+ Language Configuration:
380
+
381
+ - conversation_language: {{CONVERSATION_LANGUAGE}}
382
+ - language_name: {{CONVERSATION_LANGUAGE_NAME}}
383
+
384
+ Critical Language Rules:
385
+
386
+ - Receive instructions in agent_prompt_language from config (default: English)
387
+ - Respond in conversation_language from config (user's preferred language)
388
+ - All SPEC documents content must be written in {{CONVERSATION_LANGUAGE}}
389
+ - Code examples and technical keywords remain in English (global standard)
390
+
391
+ Task Instructions:
392
+
393
+ PHASE 1B.1: Project Analysis and SPEC Discovery
394
+
395
+ 1. Document Analysis: Scan for existing documentation and patterns
396
+
397
+ - Product document: Find relevant files
398
+ - Structure document: Identify architectural patterns
399
+ - Tech document: Discover technical constraints
400
+
401
+ 2. SPEC Candidate Generation: Create 1-3 SPEC candidates
402
+
403
+ - Analyze existing SPECs in `.moai/specs/` for duplicates
404
+ - Check related GitHub issues via appropriate tools
405
+ - Generate unique SPEC candidates with proper naming
406
+
407
+ 3. EARS Structure Design: For each SPEC candidate:
408
+ - Define clear requirements using EARS grammar
409
+ - Design acceptance criteria with Given/When/Then
410
+ - Identify technical dependencies and constraints
411
+
412
+ PHASE 1B.2: Implementation Plan Creation
413
+ For the selected SPEC candidate, create a comprehensive implementation plan:
414
+
415
+ Technical Constraints & Dependencies:
416
+
417
+ - Library versions: Find latest stable versions
418
+ - Specify exact versions (e.g., `fastapi>=0.118.3`)
419
+ - Exclude beta/alpha versions, select only production stable versions
420
+ - Note: Detailed versions finalized in `/moai:2-run` stage
421
+
422
+ Precautions:
423
+
424
+ - Technical constraints: [Restraints to consider]
425
+ - Dependency: [Relevance with other SPECs]
426
+ - Branch strategy: [Processing by Personal/Team mode]
427
+
428
+ Expected deliverables:
429
+
430
+ - spec.md: [Core specifications of the EARS structure]
431
+ - plan.md: [Implementation plan]
432
+ - acceptance.md: [Acceptance criteria]
433
+ - Branches/PR: [Git operations by mode]
434
+
435
+ Phase 1B Completion:
436
+
437
+ - Log planning completion status
438
+ - Store context for subsequent phases
439
+
440
+ #### Step 1B.2: Request user approval
441
+
442
+ After the manager-spec presents the implementation plan report, use AskUserQuestion tool for explicit approval:
443
+
444
+ Tool: AskUserQuestion
445
+ Parameters:
446
+ questions:
447
+
448
+ - question: "Planning is complete. Would you like to proceed with SPEC creation based on this plan?"
449
+ header: "SPEC Generation"
450
+ multiSelect: false
451
+ options:
452
+ - label: "Proceed with SPEC Creation"
453
+ description: "Create SPEC files in .moai/specs/SPEC-{ID}/ based on approved plan"
454
+ - label: "Request Plan Modification"
455
+ description: "Modify plan content before SPEC creation"
456
+ - label: "Save as Draft"
457
+ description: "Save plan as draft and continue later"
458
+ - label: "Cancel"
459
+ description: "Discard plan and return to planning stage"
460
+
461
+ After AskUserQuestion returns user selection, proceed to Step 3.5.
462
+
463
+ #### Step 3.5: Progress Report and User Confirmation
464
+
465
+ This step automatically executes after PHASE 1 completion.
466
+
467
+ Display detailed progress report to user and get final approval:
468
+
469
+ ```
470
+ Progress Report for PHASE 1 Completion
471
+
472
+ Completed Items:
473
+ - Project document analysis completed
474
+ - Existing SPEC scan completed
475
+ - SPEC candidate generation completed
476
+ - Technical constraint analysis completed
477
+
478
+ Plan Summary:
479
+ - Selected SPEC: {SPEC ID} - {SPEC Title}
480
+ - Priority: {Priority}
481
+ - Estimated time: {Time Estimation}
482
+ - Main technology stack: {Technology Stack}
483
+
484
+ Next Phase Plan (PHASE 2):
485
+ - spec.md creation: Core specifications with EARS structure
486
+ - plan.md creation: Detailed implementation plan
487
+ - acceptance.md creation: Acceptance criteria and scenarios
488
+ - Directory: .moai/specs/SPEC-{ID}/
489
+
490
+ Important Notes:
491
+ - Existing files may be overwritten
492
+ - Dependencies: {Dependencies}
493
+ - Resource requirements: {Resource Requirements}
494
+ ```
495
+
496
+ Tool: AskUserQuestion
497
+ Parameters:
498
+ questions:
499
+
500
+ - question: "Plan completion and progress report\n\nAnalysis results:\n- SPEC candidates found: [Number]\n- Priority: [Priority]\n- Estimated work time: [Time Estimation]\n\nNext steps:\n1. PHASE 2: SPEC file creation\n - .moai/specs/SPEC-{ID}/\n - spec.md, plan.md, acceptance.md creation\n\nProceed with the plan?"
501
+ header: "Plan Confirmation"
502
+ multiSelect: false
503
+ options:
504
+ - label: "Proceed"
505
+ description: "Start SPEC creation according to plan"
506
+ - label: "Detailed Revision"
507
+ description: "Revise plan content then proceed"
508
+ - label: "Save as Draft"
509
+ description: "Save plan and continue later"
510
+ - label: "Cancel"
511
+ description: "Cancel operation and discard plan"
512
+
513
+ Process user response from AskUserQuestion in Step 4.
514
+
515
+ #### Step 4: Process user's answer
516
+
517
+ Based on the user's choice:
518
+
519
+ IF user selected "Proceed":
520
+
521
+ 1. Store approval confirmation
522
+ 2. Print: " Plan approved. Proceeding to PHASE 2."
523
+ 3. Proceed to PHASE 2 (SPEC Document Creation)
524
+
525
+ IF user selected "Detailed Revision":
526
+
527
+ 1. Ask the user: "What changes would you like to make to the plan?"
528
+ 2. Collect user's feedback via AskUserQuestion
529
+ 3. Pass feedback to manager-spec agent
530
+ 4. manager-spec updates the plan
531
+ 5. Return to Step 3.5 (request approval again with updated plan)
532
+
533
+ IF user selected "Save as Draft":
534
+
535
+ 1. Create directory: `.moai/specs/SPEC-{ID}/`
536
+ 2. Save plan to `.moai/specs/SPEC-{ID}/plan.md` with status: draft
537
+ 3. Create commit: `draft(spec): WIP SPEC-{ID} - {title}`
538
+ 4. Print to user: "Draft saved. Resume with: `/moai:1-plan resume SPEC-{ID}`"
539
+ 5. End command execution (stop here)
540
+
541
+ IF user selected "Cancel":
542
+
543
+ 1. Print to user: "Plan discarded. No files created."
544
+ 2. End command execution (stop here)
545
+
546
+ ---
547
+
548
+ ## PHASE 2: SPEC Document Creation (STEP 2 - After Approval)
549
+
550
+ This phase ONLY executes IF the user selected "Proceed" in Step 3.5.
551
+
552
+ Your task is to create the SPEC document files in the correct directory structure.
553
+
554
+ ### Critical Rule: Directory Naming Convention
555
+
556
+ [HARD] SPEC Directory Structure Requirement:
557
+
558
+ Format requirement: `.moai/specs/SPEC-{ID}/`
559
+ WHY: Standardized directory structure enables automated discovery and tooling
560
+ IMPACT: Non-standard naming breaks automation and causes deployment failures
561
+
562
+ Correct Examples of Required Format:
563
+
564
+ - `SPEC-AUTH-001/` - Domain single, properly formatted
565
+ - `SPEC-REFACTOR-001/` - Domain single, properly formatted
566
+ - `SPEC-UPDATE-REFACTOR-001/` - Composite domains (2), properly formatted
567
+
568
+ Examples of Incorrect Formats to Avoid:
569
+
570
+ - `AUTH-001/` - Missing SPEC- prefix breaks automation
571
+ - `SPEC-001-auth/` - Additional text after ID violates convention
572
+ - `SPEC-AUTH-001-jwt/` - Additional text after ID violates convention
573
+
574
+ [HARD] ID Uniqueness Verification Requirement:
575
+
576
+ Verification scope: Search entire .moai/specs/ directory before creation
577
+ WHY: Duplicate IDs cause merge conflicts and implementation uncertainty
578
+ IMPACT: Duplicate IDs create version ambiguity and maintenance chaos
579
+
580
+ Verification output must include:
581
+
582
+ - exists: Boolean indicating whether ID already exists
583
+ - locations: Array of all conflicting file paths (empty if no conflicts)
584
+ - recommendation: Text assessment ("safe to create" or "duplicate found - use ID-XXX instead")
585
+
586
+ [SOFT] Composite Domain Naming Guidance:
587
+
588
+ - Allow: `UPDATE-REFACTOR-001` (2 domains maximum)
589
+ WHY: Two domains indicate coordinated work without excessive complexity
590
+ IMPACT: Two-domain SPECs maintain focus and scope
591
+
592
+ - Caution: `UPDATE-REFACTOR-FIX-001` (3+ domains not recommended)
593
+ WHY: Three or more domains indicate scope creep and mixed concerns
594
+ IMPACT: Complex domain names signal SPECs that should be split
595
+
596
+ ### Step 1: Invoke manager-spec for SPEC creation
597
+
598
+ Use the manager-spec subagent to:
599
+
600
+ Create SPEC document files for approved plan
601
+
602
+ Context Continuity:
603
+
604
+ - Continue from the SPEC planning phase in Phase 1B
605
+ - Use full planning context (project analysis, SPEC candidates, implementation plan) to generate comprehensive SPEC document files
606
+
607
+ Language Configuration:
608
+
609
+ - conversation_language: {{CONVERSATION_LANGUAGE}}
610
+ - language_name: {{CONVERSATION_LANGUAGE_NAME}}
611
+
612
+ Critical Language Rules:
613
+
614
+ - Receive instructions in agent_prompt_language from config (default: English)
615
+ - Respond in conversation_language from config (user's preferred language)
616
+ - All SPEC documents content must be written in {{CONVERSATION_LANGUAGE}}
617
+ - Technical terms and function names remain in English (global standard)
618
+
619
+ SPEC File Generation Rules (MANDATORY):
620
+
621
+ [HARD] Create Directory Structure, Not Single Files:
622
+
623
+ Requirement: Always create folder structure for SPEC documents
624
+ WHY: Directory structure enables multi-file organization and metadata storage
625
+ IMPACT: Single .md files prevent future tool integration and violate structure assumptions
626
+
627
+ Correct approach: Create `.moai/specs/SPEC-AUTH-001/` as directory
628
+ Incorrect approach: Create `.moai/specs/SPEC-AUTH-001.md` as single file
629
+
630
+ [HARD] Verify Before Creation:
631
+
632
+ Requirement: Check directory name format and ID duplicates before writing files
633
+ WHY: Pre-flight verification prevents invalid states and merge conflicts
634
+ IMPACT: Writing invalid files creates cleanup burden and workflow disruption
635
+
636
+ [HARD] Quality Gate Compliance:
637
+
638
+ Requirement: Follow these rules exactly for quality gate to pass
639
+ WHY: Quality gates ensure system reliability and consistency
640
+ IMPACT: Non-compliance causes pipeline failures and deployment blocks
641
+
642
+ SPEC Document Creation (Step-by-Step):
643
+
644
+ Step 1: Verify SPEC ID Format
645
+
646
+ - Format: SPEC-{DOMAIN}-{NUMBER}
647
+ - Examples: SPEC-AUTH-001, SPEC-REFACTOR-001, SPEC-UPDATE-REFACTOR-001
648
+ - Wrong: AUTH-001, SPEC-001-auth, SPEC-AUTH-001-jwt
649
+
650
+ Step 2: Verify ID Uniqueness
651
+
652
+ - Search .moai/specs/ for existing SPEC files
653
+ - If duplicate ID found → Change ID or update existing SPEC
654
+ - If ID is unique → Proceed to Step 3
655
+
656
+ Step 3: Create Directory Structure
657
+
658
+ - Create directory: .moai/specs/SPEC-{SPEC_ID}/
659
+ - Directory creation completes synchronously before Step 4
660
+
661
+ Step 4: Generate 3 SPEC Files (SIMULTANEOUS - Required)
662
+
663
+ - Create all 3 files at once:
664
+ - .moai/specs/SPEC-{SPEC_ID}/spec.md
665
+ - .moai/specs/SPEC-{SPEC_ID}/plan.md
666
+ - .moai/specs/SPEC-{SPEC_ID}/acceptance.md
667
+
668
+ File Requirements:
669
+
670
+ spec.md Requirements:
671
+
672
+ - YAML frontmatter with all 7 required fields:
673
+ - id: SPEC-{SPEC_ID}
674
+ - version: "1.0.0"
675
+ - status: "draft"
676
+ - created: "{{YYYY-MM-DD}}"
677
+ - updated: "{{YYYY-MM-DD}}"
678
+ - author: "{{AUTHOR_NAME}}"
679
+ - priority: "{{HIGH|MEDIUM|LOW}}"
680
+ - HISTORY section immediately after frontmatter
681
+ - Complete EARS structure with all 5 requirement types
682
+
683
+ plan.md Requirements:
684
+
685
+ - Implementation plan with detailed steps
686
+ - Task decomposition and dependencies
687
+ - Resource requirements and timeline
688
+ - Technology stack specifications
689
+ - Risk analysis and mitigation strategies
690
+
691
+ acceptance.md Requirements:
692
+
693
+ - Minimum 2 Given/When/Then test scenarios
694
+ - Edge case testing scenarios
695
+ - Success criteria and validation methods
696
+ - Performance/quality gate criteria
697
+
698
+ Quality Assurance:
699
+
700
+ - Information not in product/structure/tech document supplemented by asking new questions
701
+ - Acceptance Criteria written at least 2 times in Given/When/Then format
702
+ - Number of requirement modules ≤ 5 (if exceeded, include justification in SPEC)
703
+
704
+ Git Integration:
705
+
706
+ - Generate commit messages following conventional commits
707
+ - Create appropriate branch names based on git strategy
708
+ - Include SPEC identifiers in commit messages
709
+
710
+ ---
711
+
712
+ ## PHASE 3: Git Branch & PR Setup (STEP 2 continuation)
713
+
714
+ ### CRITICAL: PHASE 3 Execution is Conditional on Config AND Flags
715
+
716
+ PHASE 3 executes ONLY IF:
717
+
718
+ 1. PHASE 2 completed successfully
719
+ 2. One of these conditions is met:
720
+ - `--worktree` flag is provided (NEW: Worktree creation)
721
+ - `--branch` flag is provided OR user chose branch creation
722
+ - Configuration permits branch creation
723
+ - `github.spec_git_workflow` is explicitly configured
724
+
725
+ PHASE 3 Branch Logic:
726
+
727
+ - If `--worktree` flag: Skip traditional branch creation, create worktree instead
728
+ - If `--branch` flag: Follow traditional branch creation logic
729
+ - If no flags: Follow existing AskUserQuestion flow for branch choice
730
+
731
+ PHASE 3 is SKIPPED IF:
732
+
733
+ - `github.spec_git_workflow == "develop_direct"` (Direct commits, no branches)
734
+ - Configuration validation fails
735
+ - User permissions insufficient
736
+ - No branch/worktree creation flags provided AND user chooses "no branch"
737
+
738
+ ---
739
+
740
+ ### Step 1: Read and Validate Git Configuration
741
+
742
+ MANDATORY: Read configuration BEFORE any git operations
743
+
744
+ Execute the following config validation (this is pseudo-code representing the actual decision logic):
745
+
746
+ ```python
747
+ # Step 1A: Read configuration from .moai/config/config.yaml
748
+ config = read_json(".moai/config/config.yaml")
749
+ git_mode = config.get("git_strategy", {}).get("mode") # "personal" or "team"
750
+ spec_workflow = config.get("github", {}).get("spec_git_workflow") # Required
751
+
752
+ # Step 1B: Validate spec_git_workflow value
753
+ valid_workflows = ["develop_direct", "feature_branch", "per_spec"]
754
+ if spec_workflow not in valid_workflows:
755
+ ERROR: f"Invalid spec_git_workflow: {spec_workflow}"
756
+ ERROR: f"Must be one of: {valid_workflows}"
757
+ SKIP_PHASE_3 = True
758
+ ABORT_GIT_OPERATIONS()
759
+
760
+ # Step 1C: Validate consistency
761
+ if git_mode == "personal" and spec_workflow == "develop_direct":
762
+ CONSISTENCY_OK = True # Consistent
763
+ elif git_mode == "personal" and spec_workflow in ["feature_branch", "per_spec"]:
764
+ WARN: "Personal mode with branch creation is non-standard but allowed"
765
+ CONSISTENCY_OK = True
766
+ elif git_mode == "team" and spec_workflow in ["feature_branch", "per_spec"]:
767
+ CONSISTENCY_OK = True
768
+ else:
769
+ ERROR: "Inconsistent git configuration"
770
+ ABORT_GIT_OPERATIONS()
771
+
772
+ # Step 1D: Determine PHASE 3 routing
773
+ log(f"Git Config: mode={git_mode}, spec_workflow={spec_workflow}")
774
+ ```
775
+
776
+ Visual: Configuration validation checkpoint
777
+
778
+ ```
779
+ git_mode = "personal" ?
780
+ ├─ spec_workflow = "develop_direct" → PHASE 3 SKIPPED (ROUTE A)
781
+ ├─ spec_workflow = "feature_branch" → PHASE 3 EXECUTES (ROUTE B)
782
+ └─ spec_workflow = "per_spec" → PHASE 3 WITH USER ASK (ROUTE C)
783
+ git_mode = "team" ?
784
+ └─ (spec_workflow value ignored) → PHASE 3 EXECUTES (ROUTE D - Team Mode)
785
+ ```
786
+
787
+ ---
788
+
789
+ ### Step 2: Branch Creation Logic (All 3 Modes)
790
+
791
+ All modes use common `branch_creation.prompt_always` configuration
792
+
793
+ #### Step 2.1: Determine Branch Creation Behavior
794
+
795
+ Based on config `git_strategy.branch_creation.prompt_always`:
796
+
797
+ ```python
798
+ # Step 2.1: Read branch creation configuration
799
+ prompt_always = config.get("git_strategy", {})
800
+ .get("branch_creation", {})
801
+ .get("prompt_always", True) # Default: true
802
+
803
+ if prompt_always == True:
804
+ ACTION = "ASK_USER_FOR_BRANCH_CREATION"
805
+ elif prompt_always == False:
806
+ if git_mode == "manual":
807
+ ACTION = "SKIP_BRANCH_CREATION"
808
+ else: # personal or team
809
+ ACTION = "AUTO_CREATE_BRANCH"
810
+ ```
811
+
812
+ ---
813
+
814
+ #### Step 2.2: Route A - Ask User (When `prompt_always: true`)
815
+
816
+ CONDITION: `branch_creation.prompt_always == true`
817
+
818
+ ACTION: Ask user for branch/worktree creation preference
819
+
820
+ **Step 1: Check auto_branch configuration**
821
+
822
+ Read configuration value from config.yaml:
823
+ - Path: git_strategy.automation.auto_branch
824
+ - Default: true
825
+
826
+ **Step 2: Early exit if auto_branch is disabled**
827
+
828
+ If auto_branch equals false:
829
+ - Set ROUTE to USE_CURRENT_BRANCH
830
+ - Skip to Step 2.4 immediately
831
+ - Do NOT ask user any questions
832
+
833
+ **Step 3: Ask user if auto_branch is enabled**
834
+
835
+ Use AskUserQuestion tool with the following parameters:
836
+ - Question: "Create a development environment for this SPEC?"
837
+ - Header: "Development Environment"
838
+ - MultiSelect: false
839
+ - Options:
840
+ 1. "Create Worktree" - Create isolated worktree environment (recommended for parallel SPEC development)
841
+ 2. "Create Branch" - Create feature/SPEC-{SPEC_ID} branch (traditional workflow)
842
+ 3. "Use current branch" - Work directly on current branch
843
+
844
+ **Step 4: Determine route based on user choice**
845
+
846
+ Based on user selection:
847
+ - If "Create Worktree" selected: Set ROUTE to CREATE_WORKTREE
848
+ - If "Create Branch" selected: Set ROUTE to CREATE_BRANCH
849
+ - If "Use current branch" selected: Set ROUTE to USE_CURRENT_BRANCH
850
+
851
+ Next Step: Go to Step 2.5 (worktree), 2.3 (branch), or 2.4 (current) based on route
852
+
853
+ ---
854
+
855
+ #### Step 2.3: Create Feature Branch (After User Choice OR Auto-Creation)
856
+
857
+ CONDITION:
858
+ - User selected "Create Branch"
859
+ - OR (`prompt_always: false` AND git_mode in [personal, team])
860
+ - AND `git_strategy.automation.auto_branch == true`
861
+
862
+ If `auto_branch: false`: Skip to Step 2.4 (Use current branch)
863
+
864
+ ACTION: Invoke manager-git to create feature branch
865
+
866
+ Use the manager-git subagent to:
867
+
868
+ Create feature branch for SPEC implementation
869
+
870
+ Instructions:
871
+
872
+ - MODE: {git_mode} (manual/personal/team)
873
+ - BRANCH_CREATION: prompt_always = {prompt_always}
874
+
875
+ Tasks:
876
+
877
+ 1. Create branch: `feature/SPEC-{SPEC_ID}-{description}`
878
+ 2. Set tracking upstream if remote exists
879
+ 3. Switch to new branch
880
+ 4. Create initial commit (if appropriate for mode)
881
+
882
+ Validation:
883
+
884
+ - Verify branch was created and checked out
885
+ - Verify current branch is feature/SPEC-{SPEC_ID}
886
+ - Return branch creation status
887
+
888
+ Note: PR creation is handled separately in /moai:2-run or /moai:3-sync (Team mode only)
889
+
890
+ Expected Outcome:
891
+
892
+ ```
893
+ Feature branch created: feature/SPEC-{SPEC_ID}-description
894
+ Current branch switched to feature branch
895
+ Ready for implementation in /moai:2-run
896
+ ```
897
+
898
+ ---
899
+
900
+ #### Step 2.4: Skip Branch Creation (After User Choice OR Manual Mode)
901
+
902
+ CONDITION: User selected "Use current branch" OR (`prompt_always: false` AND git_mode == manual)
903
+
904
+ ACTION: Skip branch creation, continue with current branch
905
+
906
+ ```
907
+ Branch creation skipped
908
+
909
+ Behavior:
910
+ - SPEC files created on current branch
911
+ - NO manager-git agent invoked
912
+ - Ready for /moai:2-run implementation
913
+ - Commits will be made directly to current branch during TDD cycle
914
+ ```
915
+
916
+ ---
917
+
918
+ #### Step 2.5: Worktree Creation (NEW - When --worktree flag provided)
919
+
920
+ CONDITION: `--worktree` flag is provided in user command
921
+
922
+ ACTION: Create Git worktree using WorktreeManager
923
+
924
+ ```python
925
+ # Step 2.5: Create worktree (when --worktree flag provided)
926
+ # Parse command arguments to check for --worktree flag
927
+ import sys
928
+ import shlex
929
+ from pathlib import Path
930
+
931
+ # Parse command arguments to detect --worktree flag
932
+ command_args = shlex.split("$ARGUMENTS" if "$ARGUMENTS" else "")
933
+ has_worktree_flag = "--worktree" in command_args
934
+ has_branch_flag = "--branch" in command_args
935
+
936
+ if has_worktree_flag:
937
+ # Worktree creation logic
938
+ try:
939
+ # Import WorktreeManager from the implemented CLI module
940
+ from moai_adk.cli.worktree.manager import WorktreeManager
941
+
942
+ # Determine paths
943
+ project_root = Path.cwd() # Current working directory
944
+ worktree_root = Path.home() / "worktrees" / "MoAI-ADK" # Default worktree root
945
+
946
+ # Initialize worktree manager
947
+ worktree_manager = WorktreeManager(project_root, worktree_root)
948
+
949
+ # Create worktree for the SPEC
950
+ worktree_info = worktree_manager.create(
951
+ spec_id="SPEC-{SPEC_ID}",
952
+ branch_name=f"feature/SPEC-{SPEC_ID}",
953
+ base_branch="main"
954
+ )
955
+
956
+ # Display success messages
957
+ print(f"\n SPEC created: SPEC-{SPEC_ID}")
958
+ print(f" Worktree created: {worktree_info.path}")
959
+ print(f"\n Next steps:")
960
+ print(f" 1. Switch to worktree: moai-worktree switch SPEC-{SPEC_ID}")
961
+ print(f" 2. Or use shell eval: eval $(moai-worktree go SPEC-{SPEC_ID})")
962
+ print(f" 3. Then run: /moai:2-run SPEC-{SPEC_ID}")
963
+
964
+ except Exception as e:
965
+ # Handle worktree creation errors gracefully
966
+ print(f"\n Worktree creation failed: {e}")
967
+ print(f" SPEC created: SPEC-{SPEC_ID}")
968
+ print(f" You can manually create worktree later with:")
969
+ print(f" moai-worktree new SPEC-{SPEC_ID}")
970
+ ```
971
+
972
+ Expected Success Outcome:
973
+
974
+ ```
975
+ SPEC created: SPEC-AUTH-001
976
+ Worktree created: ~/worktrees/MoAI-ADK/SPEC-AUTH-001
977
+
978
+ Next steps:
979
+ 1. Switch to worktree: moai-worktree switch SPEC-AUTH-001
980
+ 2. Or use shell eval: eval $(moai-worktree go SPEC-AUTH-001)
981
+ 3. Then run: /moai:2-run SPEC-AUTH-001
982
+ ```
983
+
984
+ Error Handling:
985
+
986
+ - If worktree creation fails: SPEC is still created, show manual worktree creation instructions
987
+ - If worktree already exists: Show switch instructions
988
+ - If WorktreeManager not available: Show installation/dependency instructions
989
+
990
+ ---
991
+
992
+ #### Step 2.6: Team Mode - Create Draft PR (After Branch Creation)
993
+
994
+ CONDITION: `git_mode == "team"` AND branch was created (Step 2.3) AND NOT `--worktree` flag
995
+
996
+ ACTION: Create draft PR for team review
997
+
998
+ Use the manager-git subagent to:
999
+
1000
+ Create draft pull request for SPEC implementation (Team mode only)
1001
+
1002
+ Critical Config: git_strategy.mode == "team"
1003
+ → Team mode REQUIRES draft PRs for review coordination
1004
+
1005
+ Tasks:
1006
+
1007
+ 1. Create draft PR: feature/SPEC-{SPEC_ID} → main/develop branch
1008
+ 2. PR title: "feat(spec): Add SPEC-{SPEC_ID} [DRAFT]"
1009
+ 3. PR body: Include SPEC ID, description, and checklist
1010
+ 4. Add appropriate labels (spec, draft, etc.)
1011
+ 5. Assign reviewers from team config (if configured)
1012
+ 6. Set PR as DRAFT (do NOT auto-merge)
1013
+
1014
+ Validation:
1015
+
1016
+ - Verify PR was created in draft status
1017
+ - Return PR URL and status
1018
+
1019
+ Expected Outcome:
1020
+
1021
+ ```
1022
+ Feature branch: feature/SPEC-{SPEC_ID}
1023
+ Draft PR created for team review
1024
+ Ready for /moai:2-run implementation
1025
+ ```
1026
+
1027
+ ---
1028
+
1029
+ ### Step 3: Conditional Status Report
1030
+
1031
+ Display status based on configuration and execution result:
1032
+
1033
+ #### Case 1: Branch Creation Prompted (`prompt_always: true`) - User Selected "Auto create"
1034
+
1035
+ ```
1036
+ Phase 3 Status: Feature Branch Created (User Choice)
1037
+
1038
+ Configuration: git_strategy.mode = "{git_mode}"
1039
+ Branch Creation: prompt_always = true → User chose "Auto create"
1040
+
1041
+ Feature Branch Created:
1042
+ - Branch: `feature/SPEC-{SPEC_ID}`
1043
+ - Current branch switched to feature branch
1044
+ - Ready for implementation on isolated branch
1045
+
1046
+ {IF TEAM MODE:
1047
+ Draft PR Created (Team Mode):
1048
+ - PR Title: "feat(spec): Add SPEC-{SPEC_ID} [DRAFT]"
1049
+ - Target Branch: develop/main
1050
+ - Status: DRAFT (awaiting review)
1051
+ }
1052
+
1053
+ Next Steps:
1054
+ 1. Review SPEC in `.moai/specs/SPEC-{SPEC_ID}/`
1055
+ 2. Execute `/moai:2-run SPEC-{SPEC_ID}` to begin implementation
1056
+ 3. 🌿 All commits will be made to feature branch
1057
+ {IF TEAM MODE:
1058
+ 4. Share draft PR with team for early review (already created)
1059
+ 5. Team can comment during development
1060
+ 6. Finalize PR in `/moai:3-sync` when complete
1061
+ :ELSE:
1062
+ 4. Create PR in `/moai:3-sync` when implementation complete
1063
+ }
1064
+ ```
1065
+
1066
+ ---
1067
+
1068
+ #### Case 2: Branch Creation Prompted (`prompt_always: true`) - User Selected "Use current branch"
1069
+
1070
+ ```
1071
+ Phase 3 Status: Direct Commit Mode (User Choice)
1072
+
1073
+ Configuration: git_strategy.mode = "{git_mode}"
1074
+ Branch Creation: prompt_always = true → User chose "Use current branch"
1075
+
1076
+ No Branch Created:
1077
+ - SPEC files created on current branch
1078
+ - Ready for direct implementation
1079
+ - Commits will be made directly to current branch
1080
+
1081
+ Next Steps:
1082
+ 1. Review SPEC in `.moai/specs/SPEC-{SPEC_ID}/`
1083
+ 2. Execute `/moai:2-run SPEC-{SPEC_ID}` to begin implementation
1084
+ 3. All commits will be made directly to current branch
1085
+ 4. Follow TDD: RED → GREEN → REFACTOR cycles
1086
+ ```
1087
+
1088
+ ---
1089
+
1090
+ #### Case 3: Branch Creation Auto-Skipped (Manual Mode + `prompt_always: false`)
1091
+
1092
+ ```
1093
+ Phase 3 Status: Direct Commit Mode (Configuration)
1094
+
1095
+ Configuration: git_strategy.mode = "manual"
1096
+ Branch Creation: prompt_always = false → Auto-skipped
1097
+
1098
+ No Branch Created (Manual Mode Default):
1099
+ - SPEC files created on current branch
1100
+ - NO manager-git invoked (as configured)
1101
+ - Ready for direct implementation
1102
+ - Commits will be made directly to current branch
1103
+
1104
+ Next Steps:
1105
+ 1. Review SPEC in `.moai/specs/SPEC-{SPEC_ID}/`
1106
+ 2. Execute `/moai:2-run SPEC-{SPEC_ID}` to begin implementation
1107
+ 3. Make commits directly to current branch
1108
+ 4. Follow TDD: RED → GREEN → REFACTOR cycles
1109
+ ```
1110
+
1111
+ ---
1112
+
1113
+ #### Case 4: Branch Creation Skipped with Auto-Enable Prompt (Personal/Team + `prompt_always: false` + `auto_enabled: false`)
1114
+
1115
+ ```
1116
+ Phase 3 Status: Direct Commit Mode (Manual Default for Personal/Team)
1117
+
1118
+ Configuration: git_strategy.mode = "{git_mode}" (personal or team)
1119
+ Branch Creation: prompt_always = false, auto_enabled = false → Manual Default
1120
+
1121
+ Branch Creation: Not created yet (pending user approval)
1122
+ - SPEC files created on current branch
1123
+ - Ready for implementation
1124
+ - Commits will be made directly to current branch initially
1125
+
1126
+ Automation Approval Offered:
1127
+ ─────────────────────────────────────────
1128
+ Would you like to enable automatic branch creation for future SPEC creations?
1129
+ (This will update your config.yaml)
1130
+
1131
+ Yes → Set branch_creation.auto_enabled = true
1132
+ → Next SPEC will auto-create feature/SPEC-XXX branch
1133
+
1134
+ No → Keep manual mode
1135
+ → Continue working on current branch for this SPEC
1136
+ → No config changes made
1137
+ ─────────────────────────────────────────
1138
+
1139
+ Next Steps:
1140
+ 1. Review SPEC in `.moai/specs/SPEC-{SPEC_ID}/`
1141
+ 2. Execute `/moai:2-run SPEC-{SPEC_ID}` to begin implementation
1142
+ 3. Make commits directly to current branch
1143
+ 4. Follow TDD: RED → GREEN → REFACTOR cycles
1144
+ 5. Create PR in `/moai:3-sync` when implementation complete
1145
+ ```
1146
+
1147
+ ---
1148
+
1149
+ #### Case 5: Branch Creation Auto-Enabled (Personal/Team + `prompt_always: false` + `auto_enabled: true`)
1150
+
1151
+ ```
1152
+ Phase 3 Status: Feature Branch Created (Auto-Enabled)
1153
+
1154
+ Configuration: git_strategy.mode = "{git_mode}" (personal or team)
1155
+ Branch Creation: prompt_always = false, auto_enabled = true → Auto-enabled
1156
+
1157
+ Feature Branch Created:
1158
+ - Branch: `feature/SPEC-{SPEC_ID}`
1159
+ - Current branch switched to feature branch
1160
+ - Ready for implementation on isolated branch
1161
+
1162
+ {IF TEAM MODE:
1163
+ Draft PR Created (Team Mode):
1164
+ - PR Title: "feat(spec): Add SPEC-{SPEC_ID} [DRAFT]"
1165
+ - Target Branch: develop/main
1166
+ - Status: DRAFT (awaiting review)
1167
+ }
1168
+
1169
+ Next Steps:
1170
+ 1. Review SPEC in `.moai/specs/SPEC-{SPEC_ID}/`
1171
+ 2. Execute `/moai:2-run SPEC-{SPEC_ID}` to begin implementation
1172
+ 3. 🌿 All commits will be made to feature branch
1173
+ {IF TEAM MODE:
1174
+ 4. Share draft PR with team for early review
1175
+ 5. Team can comment on draft PR during development
1176
+ 6. Finalize PR in `/moai:3-sync` when complete
1177
+ :ELSE:
1178
+ 4. Create PR in `/moai:3-sync` when implementation complete
1179
+ }
1180
+ ```
1181
+
1182
+ ---
1183
+
1184
+ #### Case 6: Worktree Creation (--worktree flag or user choice)
1185
+
1186
+ ```
1187
+ Phase 3 Status: Worktree Created (Isolated Development Environment)
1188
+
1189
+ Worktree Creation: --worktree flag provided OR user chose "Create Worktree"
1190
+ SPEC Created: SPEC-{SPEC_ID} documents generated successfully
1191
+
1192
+ Isolated Worktree Created:
1193
+ - Path: ~/worktrees/MoAI-ADK/SPEC-{SPEC_ID}/
1194
+ - Branch: feature/SPEC-{SPEC_ID}
1195
+ - Status: Ready for parallel development
1196
+
1197
+ Next Steps:
1198
+ 1. Switch to worktree: `moai-worktree switch SPEC-{SPEC_ID}`
1199
+ 2. Or use shell eval: `eval $(moai-worktree go SPEC-{SPEC_ID})`
1200
+ 3. Review SPEC documents in worktree: `.moai/specs/SPEC-{SPEC_ID}/`
1201
+ 4. Execute `/moai:2-run SPEC-{SPEC_ID}` to begin TDD implementation
1202
+ 5. Work on isolated environment without affecting other SPECs
1203
+
1204
+ Benefits of Worktree Development:
1205
+ - Complete isolation from other SPEC work
1206
+ - 🔀 Easy switching between multiple SPECs
1207
+ - 🧹 Automatic cleanup when SPEC is completed
1208
+ - Lower memory usage than full repository clones
1209
+ ```
1210
+
1211
+ ---
1212
+
1213
+ ## Output Format
1214
+
1215
+ All command execution phases must produce structured output with semantic XML sections:
1216
+
1217
+ Analysis Output Format:
1218
+
1219
+ Project analysis results structured as:
1220
+ - Context: Current project state and relevant files discovered
1221
+ - Findings: SPEC candidates identified with rationale
1222
+ - Assessment: Technical constraints and implementation feasibility
1223
+ - Recommendations: Next steps and decision options
1224
+
1225
+ Plan Output Format:
1226
+
1227
+ SPEC planning results structured as:
1228
+ - Requirements: Approved SPEC title, ID, priority, and scope
1229
+ - Architecture: Technical stack, dependencies, and integration points
1230
+ - Decomposition: Task breakdown and implementation sequence
1231
+ - Validation: Quality criteria and acceptance conditions
1232
+
1233
+ Implementation Output Format:
1234
+
1235
+ SPEC creation results structured as:
1236
+ - Status: Phase completion status and artifacts created
1237
+ - Artifacts: Location and format of created SPEC files
1238
+ - Validation: Quality gate results and compliance verification
1239
+ - NextSteps: User guidance for proceeding to implementation phase
1240
+
1241
+ WHY: Structured output enables parsing for automated workflows and tool integration
1242
+ IMPACT: Unstructured output prevents downstream automation and creates manual overhead
1243
+
1244
+ ---
1245
+
1246
+ ## Summary: Your Execution Checklist
1247
+
1248
+ Before you consider this command complete, verify:
1249
+
1250
+ - [ ] PHASE 1 executed: manager-spec analyzed project and proposed SPEC candidates
1251
+ - [ ] Progress report displayed: User shown detailed progress report with analysis results
1252
+ - [ ] User approval obtained: User explicitly approved SPEC creation (via enhanced AskUserQuestion)
1253
+ - [ ] PHASE 2 executed: manager-spec created all 3 SPEC files (spec.md, plan.md, acceptance.md)
1254
+ - [ ] Directory naming correct: `.moai/specs/SPEC-{ID}/` format followed
1255
+ - [ ] YAML frontmatter valid: All 7 required fields present
1256
+ - [ ] HISTORY section present: Immediately after YAML frontmatter
1257
+ - [ ] EARS structure complete: All 5 requirement types included
1258
+ - [ ] PHASE 3 executed: Appropriate action taken based on flags/user choice:
1259
+ - [ ] If --worktree: WorktreeManager created isolated worktree environment
1260
+ - [ ] If --branch: manager-git created feature branch
1261
+ - [ ] If prompt: User choice implemented (worktree/branch/current)
1262
+ - [ ] If Team mode: Draft PR created (when branch created, not worktree)
1263
+ - [ ] Branch/Worktree naming correct: `feature/SPEC-{ID}` format for branches, `SPEC-{ID}` for worktrees
1264
+ - [ ] Next steps presented: User shown appropriate guidance for worktree navigation or branch development
1265
+ - [ ] Worktree guidance displayed: Worktree switch/eval instructions shown (when applicable)
1266
+
1267
+ IF all checkboxes are checked → Command execution successful
1268
+
1269
+ IF any checkbox is unchecked → Identify missing step and complete it before ending
1270
+
1271
+ ---
1272
+
1273
+ ## Quick Reference
1274
+
1275
+ | Scenario | Mode | Entry Point | Key Phases | Expected Outcome |
1276
+ | ---------------------- | ------------------ | ------------------------------------------------------------------- | ------------------------------------------------------------ | -------------------------------------------- |
1277
+ | Clear feature request | Direct to Planning | `/moai:1-plan "feature description"` | Phase 1B → Phase 2 → Phase 3 | SPEC created + branch/worktree (conditional) |
1278
+ | Vague user request | Exploration First | `/moai:1-plan "vague request"` | Phase 1A → Phase 1B → Phase 2 → Phase 3 | Exploration → SPEC + branch/worktree |
1279
+ | Resume draft SPEC | Resume Existing | `/moai:1-plan resume SPEC-XXX` | Phase 1B → Phase 2 → Phase 3 | Complete existing SPEC |
1280
+ | Worktree creation | NEW | `/moai:1-plan "feature" --worktree` | Phase 1B → Phase 2 → Phase 3 (worktree) | SPEC + isolated worktree environment |
1281
+ | Branch creation prompt | User Choice | `/moai:1-plan "feature"` (prompt_always: true) | Phase 1-2 → User chooses (worktree/branch/current) → Phase 3 | SPEC + user-selected strategy |
1282
+ | Auto branch creation | Automated | `/moai:1-plan "feature"` (prompt_always: false, auto_enabled: true) | Phase 1-2 → Auto branch creation → Phase 3 | SPEC + auto branch (Personal/Team) |
1283
+
1284
+ ### New Worktree Workflow Examples
1285
+
1286
+ Basic Worktree Creation:
1287
+
1288
+ ```bash
1289
+ /moai:1-plan "User authentication system" --worktree
1290
+ # Output:
1291
+ # SPEC created: SPEC-AUTH-001
1292
+ # Worktree created: ~/worktrees/MoAI-ADK/SPEC-AUTH-001
1293
+ #
1294
+ # Next steps:
1295
+ # 1. Switch to worktree: moai-worktree switch SPEC-AUTH-001
1296
+ # 2. Or use shell eval: eval $(moai-worktree go SPEC-AUTH-001)
1297
+ ```
1298
+
1299
+ Interactive Environment Selection:
1300
+
1301
+ ```bash
1302
+ /moai:1-plan "Payment integration"
1303
+ # User prompted to choose:
1304
+ # - Create Worktree (recommended for parallel development)
1305
+ # - Create Branch (traditional workflow)
1306
+ # - Use current branch
1307
+ ```
1308
+
1309
+ Associated Agents & Components:
1310
+
1311
+ - `Explore` - Project exploration and file discovery (Phase 1A, optional)
1312
+ - `manager-spec` - SPEC planning and document creation (Phase 1B-2, required)
1313
+ - `manager-git` - Branch and PR creation (Phase 3, conditional)
1314
+ - WorktreeManager - Worktree creation and management (Phase 3, when --worktree flag used)
1315
+
1316
+ Key Integration Points:
1317
+
1318
+ - WorktreeManager Import: `from moai_adk.cli.worktree.manager import WorktreeManager`
1319
+ - Worktree Registry: Automatic registration in `~/worktrees/MoAI-ADK/.moai-worktree-registry.json`
1320
+ - Git Integration: Creates feature branch `feature/SPEC-{ID}` and associated worktree
1321
+ - Error Handling: Graceful fallback if worktree creation fails
1322
+
1323
+ SPEC Documents Directory:
1324
+
1325
+ - Location: `.moai/specs/SPEC-{ID}/` (directory format, NOT single .md file)
1326
+ - Files: `spec.md`, `plan.md`, `acceptance.md` (created simultaneously via MultiEdit)
1327
+ - Format: EARS structure with YAML frontmatter + HISTORY section
1328
+ - Language: All content in user's conversation_language
1329
+
1330
+ Version: 5.1.0 (4-Step Agent-Based Workflow + Worktree Integration)
1331
+ Last Updated: 2025-11-28
1332
+ Architecture: Commands → Agents → Skills (Complete delegation)
1333
+ NEW: WorktreeManager integration for parallel SPEC development
1334
+
1335
+ ---
1336
+
1337
+ ## SPEC-WORKTREE-001 Integration Status
1338
+
1339
+ Status: COMPLETE - Full integration achieved on 2025-11-28
1340
+
1341
+ ### What Was Implemented
1342
+
1343
+ 1. --worktree Flag Support: Added argument parsing for `--worktree` flag in `/moai:1-plan`
1344
+ 2. WorktreeManager Integration: Automatic worktree creation using existing `src/moai_adk/cli/worktree/manager.py`
1345
+ 3. Guidance Messages: Clear next-step instructions for worktree navigation
1346
+ 4. Interactive Flow: AskUserQuestion integration for worktree/branch/current choice
1347
+ 5. Error Handling: Graceful fallback when worktree creation fails
1348
+
1349
+ ### Expected Behavior
1350
+
1351
+ ```bash
1352
+ # Command execution:
1353
+ /moai:1-plan "User authentication" --worktree
1354
+
1355
+ # Expected output:
1356
+ SPEC created: SPEC-AUTH-001
1357
+ Worktree created: ~/worktrees/MoAI-ADK/SPEC-AUTH-001
1358
+
1359
+ Next steps:
1360
+ 1. Switch to worktree: moai-worktree switch SPEC-AUTH-001
1361
+ 2. Or use shell eval: eval $(moai-worktree go SPEC-AUTH-001)
1362
+ 3. Then run: /moai:2-run SPEC-AUTH-001
1363
+ ```
1364
+
1365
+ ### Integration Points
1366
+
1367
+ - Import: `from moai_adk.cli.worktree.manager import WorktreeManager`
1368
+ - Worktree Registry: Automatic registration in `~/worktrees/MoAI-ADK/.moai-worktree-registry.json`
1369
+ - Branch Creation: Creates feature branch `feature/SPEC-{SPEC_ID}` automatically
1370
+ - Documentation: Updated all examples, checklists, and status reports
1371
+
1372
+ ### Completion Criteria (All Met)
1373
+
1374
+ - Flag Parsing: `--worktree` flag detected and processed correctly
1375
+ - Worktree Creation: WorktreeManager.create() called with correct parameters
1376
+ - User Guidance: Next steps displayed in user-friendly format
1377
+ - Error Handling: Fallback messages when worktree creation fails
1378
+ - Documentation: All references updated with worktree scenarios
1379
+ - Backward Compatibility: Existing --branch and default behavior preserved
1380
+
1381
+ SPEC-WORKTREE-001: 100% Complete - All 85% existing implementation + 15% missing integration now complete
1382
+
1383
+ ---
1384
+
1385
+ ## End of command execution guide
1386
+
1387
+ ## Final Step: Next Action Selection
1388
+
1389
+ After SPEC creation completes, use AskUserQuestion tool to guide user to next action:
1390
+
1391
+ ```python
1392
+ AskUserQuestion({
1393
+ "questions": [{
1394
+ "question": "SPEC document creation is complete. What would you like to do next?",
1395
+ "header": "Next Steps",
1396
+ "multiSelect": false,
1397
+ "options": [
1398
+ {
1399
+ "label": "Start Implementation",
1400
+ "description": "Execute /moai:2-run to begin TDD development"
1401
+ },
1402
+ {
1403
+ "label": "Modify Plan",
1404
+ "description": "Modify and enhance SPEC content"
1405
+ },
1406
+ {
1407
+ "label": "Add New Feature",
1408
+ "description": "Create additional SPEC document"
1409
+ }
1410
+ ]
1411
+ }]
1412
+ })
1413
+ ```
1414
+
1415
+ Important:
1416
+
1417
+ - Use conversation language from config
1418
+ - No emojis in any AskUserQuestion fields
1419
+ - Always provide clear next step options
1420
+
1421
+ ## EXECUTION DIRECTIVE
1422
+
1423
+ You must NOW execute the command following the "The 4-Step Agent-Based Workflow Command Logic" described above.
1424
+
1425
+ 1. Start PHASE 1: Project Analysis & SPEC Planning immediately.
1426
+ 2. Use the manager-spec subagent (or Explore subagent as appropriate).
1427
+ 3. Do NOT just describe what you will do. DO IT.