moai-adk 0.25.4__py3-none-any.whl → 0.32.8__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 (378) hide show
  1. moai_adk/__init__.py +2 -5
  2. moai_adk/__main__.py +114 -82
  3. moai_adk/cli/__init__.py +6 -1
  4. moai_adk/cli/commands/__init__.py +1 -3
  5. moai_adk/cli/commands/analyze.py +5 -16
  6. moai_adk/cli/commands/doctor.py +6 -18
  7. moai_adk/cli/commands/init.py +56 -125
  8. moai_adk/cli/commands/language.py +14 -35
  9. moai_adk/cli/commands/status.py +9 -15
  10. moai_adk/cli/commands/update.py +1555 -190
  11. moai_adk/cli/prompts/init_prompts.py +112 -56
  12. moai_adk/cli/spec_status.py +263 -0
  13. moai_adk/cli/ui/__init__.py +44 -0
  14. moai_adk/cli/ui/progress.py +422 -0
  15. moai_adk/cli/ui/prompts.py +389 -0
  16. moai_adk/cli/ui/theme.py +129 -0
  17. moai_adk/cli/worktree/__init__.py +27 -0
  18. moai_adk/cli/worktree/__main__.py +31 -0
  19. moai_adk/cli/worktree/cli.py +672 -0
  20. moai_adk/cli/worktree/exceptions.py +89 -0
  21. moai_adk/cli/worktree/manager.py +490 -0
  22. moai_adk/cli/worktree/models.py +65 -0
  23. moai_adk/cli/worktree/registry.py +128 -0
  24. moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
  25. moai_adk/core/analysis/session_analyzer.py +17 -56
  26. moai_adk/core/claude_integration.py +26 -54
  27. moai_adk/core/command_helpers.py +10 -10
  28. moai_adk/core/comprehensive_monitoring_system.py +1183 -0
  29. moai_adk/core/config/auto_spec_config.py +5 -11
  30. moai_adk/core/config/migration.py +19 -9
  31. moai_adk/core/config/unified.py +436 -0
  32. moai_adk/core/context_manager.py +6 -12
  33. moai_adk/core/enterprise_features.py +1404 -0
  34. moai_adk/core/error_recovery_system.py +725 -112
  35. moai_adk/core/event_driven_hook_system.py +1371 -0
  36. moai_adk/core/git/__init__.py +8 -0
  37. moai_adk/core/git/branch_manager.py +3 -11
  38. moai_adk/core/git/checkpoint.py +1 -3
  39. moai_adk/core/git/conflict_detector.py +413 -0
  40. moai_adk/core/git/manager.py +91 -1
  41. moai_adk/core/hooks/post_tool_auto_spec_completion.py +56 -80
  42. moai_adk/core/input_validation_middleware.py +1006 -0
  43. moai_adk/core/integration/engine.py +6 -18
  44. moai_adk/core/integration/integration_tester.py +10 -9
  45. moai_adk/core/integration/utils.py +1 -1
  46. moai_adk/core/issue_creator.py +10 -28
  47. moai_adk/core/jit_context_loader.py +956 -0
  48. moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
  49. moai_adk/core/language_config_resolver.py +485 -0
  50. moai_adk/core/language_validator.py +28 -41
  51. moai_adk/core/mcp/setup.py +15 -12
  52. moai_adk/core/merge/__init__.py +9 -0
  53. moai_adk/core/merge/analyzer.py +481 -0
  54. moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
  55. moai_adk/core/migration/backup_manager.py +78 -9
  56. moai_adk/core/migration/custom_element_scanner.py +358 -0
  57. moai_adk/core/migration/file_migrator.py +8 -17
  58. moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
  59. moai_adk/core/migration/selective_restorer.py +470 -0
  60. moai_adk/core/migration/template_utils.py +74 -0
  61. moai_adk/core/migration/user_selection_ui.py +338 -0
  62. moai_adk/core/migration/version_detector.py +6 -10
  63. moai_adk/core/migration/version_migrator.py +3 -3
  64. moai_adk/core/performance/cache_system.py +8 -10
  65. moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
  66. moai_adk/core/project/checker.py +2 -4
  67. moai_adk/core/project/detector.py +1 -3
  68. moai_adk/core/project/initializer.py +135 -23
  69. moai_adk/core/project/phase_executor.py +54 -81
  70. moai_adk/core/project/validator.py +6 -12
  71. moai_adk/core/quality/trust_checker.py +9 -27
  72. moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
  73. moai_adk/core/robust_json_parser.py +611 -0
  74. moai_adk/core/rollback_manager.py +73 -148
  75. moai_adk/core/session_manager.py +10 -26
  76. moai_adk/core/skill_loading_system.py +579 -0
  77. moai_adk/core/spec/confidence_scoring.py +31 -100
  78. moai_adk/core/spec/ears_template_engine.py +351 -286
  79. moai_adk/core/spec/quality_validator.py +35 -69
  80. moai_adk/core/spec_status_manager.py +64 -74
  81. moai_adk/core/template/backup.py +45 -20
  82. moai_adk/core/template/config.py +112 -39
  83. moai_adk/core/template/merger.py +11 -19
  84. moai_adk/core/template/processor.py +253 -149
  85. moai_adk/core/template_engine.py +73 -40
  86. moai_adk/core/template_variable_synchronizer.py +417 -0
  87. moai_adk/core/unified_permission_manager.py +745 -0
  88. moai_adk/core/user_behavior_analytics.py +851 -0
  89. moai_adk/core/version_sync.py +429 -0
  90. moai_adk/foundation/__init__.py +56 -0
  91. moai_adk/foundation/backend.py +1027 -0
  92. moai_adk/foundation/database.py +1115 -0
  93. moai_adk/foundation/devops.py +1585 -0
  94. moai_adk/foundation/ears.py +431 -0
  95. moai_adk/foundation/frontend.py +870 -0
  96. moai_adk/foundation/git/commit_templates.py +4 -12
  97. moai_adk/foundation/git.py +376 -0
  98. moai_adk/foundation/langs.py +484 -0
  99. moai_adk/foundation/ml_ops.py +1162 -0
  100. moai_adk/foundation/testing.py +1524 -0
  101. moai_adk/foundation/trust/trust_principles.py +23 -72
  102. moai_adk/foundation/trust/validation_checklist.py +57 -162
  103. moai_adk/project/__init__.py +0 -0
  104. moai_adk/project/configuration.py +1084 -0
  105. moai_adk/project/documentation.py +566 -0
  106. moai_adk/project/schema.py +447 -0
  107. moai_adk/statusline/alfred_detector.py +1 -3
  108. moai_adk/statusline/config.py +13 -4
  109. moai_adk/statusline/enhanced_output_style_detector.py +23 -15
  110. moai_adk/statusline/main.py +51 -15
  111. moai_adk/statusline/renderer.py +104 -48
  112. moai_adk/statusline/update_checker.py +3 -9
  113. moai_adk/statusline/version_reader.py +140 -46
  114. moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +549 -0
  115. moai_adk/templates/.claude/agents/moai/builder-agent.md +445 -0
  116. moai_adk/templates/.claude/agents/moai/builder-command.md +1132 -0
  117. moai_adk/templates/.claude/agents/moai/builder-skill.md +601 -0
  118. moai_adk/templates/.claude/agents/moai/expert-backend.md +831 -0
  119. moai_adk/templates/.claude/agents/moai/expert-database.md +774 -0
  120. moai_adk/templates/.claude/agents/moai/expert-debug.md +396 -0
  121. moai_adk/templates/.claude/agents/moai/expert-devops.md +711 -0
  122. moai_adk/templates/.claude/agents/moai/expert-frontend.md +666 -0
  123. moai_adk/templates/.claude/agents/moai/expert-security.md +474 -0
  124. moai_adk/templates/.claude/agents/moai/expert-uiux.md +1038 -0
  125. moai_adk/templates/.claude/agents/moai/manager-claude-code.md +429 -0
  126. moai_adk/templates/.claude/agents/moai/manager-docs.md +570 -0
  127. moai_adk/templates/.claude/agents/moai/manager-git.md +937 -0
  128. moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
  129. moai_adk/templates/.claude/agents/moai/manager-quality.md +598 -0
  130. moai_adk/templates/.claude/agents/moai/manager-spec.md +713 -0
  131. moai_adk/templates/.claude/agents/moai/manager-strategy.md +600 -0
  132. moai_adk/templates/.claude/agents/moai/manager-tdd.md +603 -0
  133. moai_adk/templates/.claude/agents/moai/mcp-context7.md +369 -0
  134. moai_adk/templates/.claude/agents/moai/mcp-figma.md +1567 -0
  135. moai_adk/templates/.claude/agents/moai/mcp-notion.md +749 -0
  136. moai_adk/templates/.claude/agents/moai/mcp-playwright.md +427 -0
  137. moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +994 -0
  138. moai_adk/templates/.claude/commands/moai/0-project.md +1143 -0
  139. moai_adk/templates/.claude/commands/moai/1-plan.md +1435 -0
  140. moai_adk/templates/.claude/commands/moai/2-run.md +883 -0
  141. moai_adk/templates/.claude/commands/moai/3-sync.md +993 -0
  142. moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
  143. moai_adk/templates/.claude/hooks/__init__.py +8 -0
  144. moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
  145. moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
  146. moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
  147. moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
  148. moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
  149. moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
  150. moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
  151. moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
  152. moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
  153. moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
  154. moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
  155. moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
  156. moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
  157. moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
  158. moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
  159. moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
  160. moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +921 -0
  161. moai_adk/templates/.claude/output-styles/moai/r2d2.md +380 -0
  162. moai_adk/templates/.claude/output-styles/moai/yoda.md +338 -0
  163. moai_adk/templates/.claude/settings.json +172 -0
  164. moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +247 -0
  165. moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
  166. moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
  167. moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
  168. moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
  169. moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
  170. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +319 -0
  171. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +320 -0
  172. moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
  173. moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
  174. moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
  175. moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
  176. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +496 -0
  177. moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +453 -0
  178. moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
  179. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
  180. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
  181. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/design-system-tokens.md +405 -0
  182. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
  183. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
  184. moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
  185. moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +491 -0
  186. moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
  187. moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
  188. moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
  189. moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
  190. moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
  191. moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
  192. moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +201 -0
  193. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
  194. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
  195. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
  196. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
  197. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
  198. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
  199. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
  200. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
  201. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
  202. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
  203. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
  204. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
  205. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
  206. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
  207. moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +438 -0
  208. moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +515 -0
  209. moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
  210. moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +346 -0
  211. moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
  212. moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
  213. moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
  214. moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
  215. moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
  216. moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
  217. moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
  218. moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
  219. moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +362 -0
  220. moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
  221. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
  222. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
  223. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
  224. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
  225. moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
  226. moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
  227. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
  228. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
  229. moai_adk/templates/.claude/skills/moai-integration-mcp/SKILL.md +352 -0
  230. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/README.md +52 -0
  231. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/error-handling.md +334 -0
  232. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/integration-patterns.md +310 -0
  233. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/security-authentication.md +256 -0
  234. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/server-architecture.md +253 -0
  235. moai_adk/templates/.claude/skills/moai-lang-unified/README.md +133 -0
  236. moai_adk/templates/.claude/skills/moai-lang-unified/SKILL.md +296 -0
  237. moai_adk/templates/.claude/skills/moai-lang-unified/examples.md +1269 -0
  238. moai_adk/templates/.claude/skills/moai-lang-unified/reference.md +331 -0
  239. moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +298 -0
  240. moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
  241. moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
  242. moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
  243. moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
  244. moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +316 -0
  245. moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
  246. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
  247. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
  248. moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
  249. moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
  250. moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
  251. moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
  252. moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
  253. moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
  254. moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
  255. moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +370 -0
  256. moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
  257. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
  258. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
  259. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
  260. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
  261. moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
  262. moai_adk/templates/.claude/skills/moai-platform-baas/README.md +186 -0
  263. moai_adk/templates/.claude/skills/moai-platform-baas/SKILL.md +290 -0
  264. moai_adk/templates/.claude/skills/moai-platform-baas/examples.md +1225 -0
  265. moai_adk/templates/.claude/skills/moai-platform-baas/reference.md +567 -0
  266. moai_adk/templates/.claude/skills/moai-platform-baas/scripts/provider-selector.py +323 -0
  267. moai_adk/templates/.claude/skills/moai-platform-baas/templates/stack-config.yaml +204 -0
  268. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +446 -0
  269. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
  270. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
  271. moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
  272. moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +387 -0
  273. moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
  274. moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
  275. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
  276. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
  277. moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
  278. moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +135 -0
  279. moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
  280. moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
  281. moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
  282. moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
  283. moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
  284. moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
  285. moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
  286. moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
  287. moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
  288. moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
  289. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
  290. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1362 -0
  291. moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
  292. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
  293. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
  294. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +71 -0
  295. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
  296. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
  297. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
  298. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
  299. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
  300. moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
  301. moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +374 -0
  302. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
  303. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
  304. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
  305. moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
  306. moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +453 -0
  307. moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
  308. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
  309. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
  310. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
  311. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
  312. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
  313. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
  314. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
  315. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
  316. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
  317. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
  318. moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
  319. moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
  320. moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
  321. moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
  322. moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
  323. moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +410 -0
  324. moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
  325. moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
  326. moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
  327. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
  328. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
  329. moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
  330. moai_adk/templates/.git-hooks/pre-commit +103 -41
  331. moai_adk/templates/.git-hooks/pre-push +116 -21
  332. moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
  333. moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
  334. moai_adk/templates/.gitignore +184 -44
  335. moai_adk/templates/.mcp.json +7 -9
  336. moai_adk/templates/.moai/cache/personalization.json +10 -0
  337. moai_adk/templates/.moai/config/config.yaml +344 -0
  338. moai_adk/templates/.moai/config/presets/manual.yaml +28 -0
  339. moai_adk/templates/.moai/config/presets/personal.yaml +30 -0
  340. moai_adk/templates/.moai/config/presets/team.yaml +33 -0
  341. moai_adk/templates/.moai/config/questions/_schema.yaml +79 -0
  342. moai_adk/templates/.moai/config/questions/tab1-user.yaml +108 -0
  343. moai_adk/templates/.moai/config/questions/tab2-project.yaml +122 -0
  344. moai_adk/templates/.moai/config/questions/tab3-git.yaml +542 -0
  345. moai_adk/templates/.moai/config/questions/tab4-quality.yaml +167 -0
  346. moai_adk/templates/.moai/config/questions/tab5-system.yaml +152 -0
  347. moai_adk/templates/.moai/config/sections/git-strategy.yaml +40 -0
  348. moai_adk/templates/.moai/config/sections/language.yaml +11 -0
  349. moai_adk/templates/.moai/config/sections/project.yaml +13 -0
  350. moai_adk/templates/.moai/config/sections/quality.yaml +15 -0
  351. moai_adk/templates/.moai/config/sections/system.yaml +14 -0
  352. moai_adk/templates/.moai/config/sections/user.yaml +5 -0
  353. moai_adk/templates/.moai/config/statusline-config.yaml +86 -0
  354. moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
  355. moai_adk/templates/CLAUDE.md +382 -501
  356. moai_adk/utils/__init__.py +24 -1
  357. moai_adk/utils/banner.py +7 -10
  358. moai_adk/utils/common.py +16 -30
  359. moai_adk/utils/link_validator.py +4 -12
  360. moai_adk/utils/safe_file_reader.py +2 -6
  361. moai_adk/utils/timeout.py +160 -0
  362. moai_adk/utils/toon_utils.py +256 -0
  363. moai_adk/version.py +22 -0
  364. moai_adk-0.32.8.dist-info/METADATA +2478 -0
  365. moai_adk-0.32.8.dist-info/RECORD +396 -0
  366. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/WHEEL +1 -1
  367. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/entry_points.txt +1 -0
  368. moai_adk/cli/commands/backup.py +0 -82
  369. moai_adk/cli/commands/improve_user_experience.py +0 -348
  370. moai_adk/cli/commands/migrate.py +0 -158
  371. moai_adk/cli/commands/validate_links.py +0 -118
  372. moai_adk/templates/.github/workflows/moai-gitflow.yml +0 -413
  373. moai_adk/templates/.github/workflows/moai-release-create.yml +0 -100
  374. moai_adk/templates/.github/workflows/moai-release-pipeline.yml +0 -188
  375. moai_adk/utils/user_experience.py +0 -531
  376. moai_adk-0.25.4.dist-info/METADATA +0 -2279
  377. moai_adk-0.25.4.dist-info/RECORD +0 -112
  378. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/licenses/LICENSE +0 -0
@@ -26,42 +26,77 @@ class EARSTemplateEngine:
26
26
 
27
27
  # Domain-specific templates
28
28
  self.domain_templates = {
29
- 'auth': {
30
- 'description': 'User authentication and security system',
31
- 'common_features': ['Login', 'Registration', 'Password Reset', 'Session Management'],
32
- 'security_requirements': ['Encryption', 'Password Hashing', 'Rate Limiting'],
33
- 'environment': 'Web Application with User Management'
29
+ "auth": {
30
+ "description": "User authentication and security system",
31
+ "common_features": [
32
+ "Login",
33
+ "Registration",
34
+ "Password Reset",
35
+ "Session Management",
36
+ ],
37
+ "security_requirements": [
38
+ "Encryption",
39
+ "Password Hashing",
40
+ "Rate Limiting",
41
+ ],
42
+ "environment": "Web Application with User Management",
34
43
  },
35
- 'api': {
36
- 'description': 'RESTful API service',
37
- 'common_features': ['Endpoints', 'Authentication', 'Rate Limiting', 'Caching'],
38
- 'technical_requirements': ['RESTful Design', 'JSON Format', 'HTTP Status Codes'],
39
- 'environment': 'Microservice Architecture'
44
+ "api": {
45
+ "description": "RESTful API service",
46
+ "common_features": [
47
+ "Endpoints",
48
+ "Authentication",
49
+ "Rate Limiting",
50
+ "Caching",
51
+ ],
52
+ "technical_requirements": [
53
+ "RESTful Design",
54
+ "JSON Format",
55
+ "HTTP Status Codes",
56
+ ],
57
+ "environment": "Microservice Architecture",
40
58
  },
41
- 'data': {
42
- 'description': 'Data processing and storage system',
43
- 'common_features': ['Data Validation', 'Persistence', 'Backup', 'Migration'],
44
- 'technical_requirements': ['Data Integrity', 'Performance', 'Scalability'],
45
- 'environment': 'Database System with Analytics'
59
+ "data": {
60
+ "description": "Data processing and storage system",
61
+ "common_features": [
62
+ "Data Validation",
63
+ "Persistence",
64
+ "Backup",
65
+ "Migration",
66
+ ],
67
+ "technical_requirements": [
68
+ "Data Integrity",
69
+ "Performance",
70
+ "Scalability",
71
+ ],
72
+ "environment": "Database System with Analytics",
46
73
  },
47
- 'ui': {
48
- 'description': 'User interface and experience system',
49
- 'common_features': ['Components', 'Navigation', 'Forms', 'Validation'],
50
- 'experience_requirements': ['Responsive Design', 'Accessibility', 'Performance'],
51
- 'environment': 'Web Frontend with React/Angular/Vue'
74
+ "ui": {
75
+ "description": "User interface and experience system",
76
+ "common_features": ["Components", "Navigation", "Forms", "Validation"],
77
+ "experience_requirements": [
78
+ "Responsive Design",
79
+ "Accessibility",
80
+ "Performance",
81
+ ],
82
+ "environment": "Web Frontend with React/Angular/Vue",
83
+ },
84
+ "business": {
85
+ "description": "Business logic and workflow system",
86
+ "common_features": [
87
+ "Process Management",
88
+ "Rules Engine",
89
+ "Notifications",
90
+ ],
91
+ "business_requirements": ["Compliance", "Audit Trail", "Reporting"],
92
+ "environment": "Enterprise Application",
52
93
  },
53
- 'business': {
54
- 'description': 'Business logic and workflow system',
55
- 'common_features': ['Process Management', 'Rules Engine', 'Notifications'],
56
- 'business_requirements': ['Compliance', 'Audit Trail', 'Reporting'],
57
- 'environment': 'Enterprise Application'
58
- }
59
94
  }
60
95
 
61
96
  # EARS section templates
62
97
  self.ears_templates = {
63
- 'environment': {
64
- 'template': '''### Environment
98
+ "environment": {
99
+ "template": """### Environment
65
100
 
66
101
  - **Project**: {project_name}
67
102
  - **Language**: {language}
@@ -70,11 +105,16 @@ class EARSTemplateEngine:
70
105
  - **Platform**: {platform}
71
106
  - **Deployment**: {deployment}
72
107
  - **Status**: {status}
73
- - **Generation Method**: Auto-analysis based''',
74
- 'required_fields': ['project_name', 'language', 'framework', 'paradigm']
108
+ - **Generation Method**: Auto-analysis based""",
109
+ "required_fields": [
110
+ "project_name",
111
+ "language",
112
+ "framework",
113
+ "paradigm",
114
+ ],
75
115
  },
76
- 'assumptions': {
77
- 'template': '''### Assumptions
116
+ "assumptions": {
117
+ "template": """### Assumptions
78
118
 
79
119
  1. System follows standard development practices
80
120
  2. Users have basic domain knowledge
@@ -83,11 +123,11 @@ class EARSTemplateEngine:
83
123
  5. Security requirements comply with industry standards
84
124
  6. Data integrity is maintained
85
125
  7. User interface is intuitively designed
86
- 8. Performance requirements are met''',
87
- 'required_fields': []
126
+ 8. Performance requirements are met""",
127
+ "required_fields": [],
88
128
  },
89
- 'requirements': {
90
- 'template': '''### Requirements
129
+ "requirements": {
130
+ "template": """### Requirements
91
131
 
92
132
  #### Ubiquitous Requirements
93
133
 
@@ -113,11 +153,11 @@ class EARSTemplateEngine:
113
153
  - **REQ-009**: Automatic backup and restore features MAY be required
114
154
  - **REQ-010**: User activity logging MAY be required
115
155
  - **REQ-011**: Multi-language support MAY be required
116
- - **REQ-012**: Mobile compatibility MAY be required''',
117
- 'required_fields': ['primary_function']
156
+ - **REQ-012**: Mobile compatibility MAY be required""",
157
+ "required_fields": ["primary_function"],
118
158
  },
119
- 'specifications': {
120
- 'template': '''### Specifications
159
+ "specifications": {
160
+ "template": """### Specifications
121
161
 
122
162
  {technical_specs}
123
163
 
@@ -147,14 +187,17 @@ class EARSTemplateEngine:
147
187
 
148
188
  #### Scalability Specifications
149
189
 
150
- {scalability_specs}''',
151
- 'required_fields': []
152
- }
190
+ {scalability_specs}""",
191
+ "required_fields": [],
192
+ },
153
193
  }
154
194
 
155
- def generate_complete_spec(self, code_analysis: Dict[str, Any],
156
- file_path: str,
157
- custom_config: Dict[str, Any] = None) -> Dict[str, str]:
195
+ def generate_complete_spec(
196
+ self,
197
+ code_analysis: Dict[str, Any],
198
+ file_path: str,
199
+ custom_config: Dict[str, Any] = None,
200
+ ) -> Dict[str, str]:
158
201
  """
159
202
  Generate complete SPEC document in EARS format.
160
203
 
@@ -183,60 +226,62 @@ class EARSTemplateEngine:
183
226
  acceptance_md_content = self._generate_acceptance_content(extraction_result, domain, spec_id, custom_config)
184
227
 
185
228
  # Validate content
186
- validation_result = self._validate_ears_compliance({
187
- 'spec_md': spec_md_content,
188
- 'plan_md': plan_md_content,
189
- 'acceptance_md': acceptance_md_content
190
- })
229
+ validation_result = self._validate_ears_compliance(
230
+ {
231
+ "spec_md": spec_md_content,
232
+ "plan_md": plan_md_content,
233
+ "acceptance_md": acceptance_md_content,
234
+ }
235
+ )
191
236
 
192
237
  # Create result
193
238
  result = {
194
- 'spec_id': spec_id,
195
- 'domain': domain,
196
- 'spec_md': spec_md_content,
197
- 'plan_md': plan_md_content,
198
- 'acceptance_md': acceptance_md_content,
199
- 'validation': validation_result,
200
- 'generation_time': time.time() - start_time,
201
- 'extraction': extraction_result
239
+ "spec_id": spec_id,
240
+ "domain": domain,
241
+ "spec_md": spec_md_content,
242
+ "plan_md": plan_md_content,
243
+ "acceptance_md": acceptance_md_content,
244
+ "validation": validation_result,
245
+ "generation_time": time.time() - start_time,
246
+ "extraction": extraction_result,
202
247
  }
203
248
 
204
- return result
249
+ return result # type: ignore[return-value]
205
250
 
206
251
  def _extract_information_from_analysis(self, code_analysis: Dict[str, Any], file_path: str) -> Dict[str, Any]:
207
252
  """Extract information from code analysis."""
208
253
  extraction = {
209
- 'file_path': file_path,
210
- 'file_name': Path(file_path).stem,
211
- 'file_extension': Path(file_path).suffix,
212
- 'language': self._detect_language(file_path),
213
- 'classes': [],
214
- 'functions': [],
215
- 'imports': [],
216
- 'domain_keywords': [],
217
- 'technical_indicators': [],
218
- 'complexity': 'low',
219
- 'architecture': 'simple'
254
+ "file_path": file_path,
255
+ "file_name": Path(file_path).stem,
256
+ "file_extension": Path(file_path).suffix,
257
+ "language": self._detect_language(file_path),
258
+ "classes": [],
259
+ "functions": [],
260
+ "imports": [],
261
+ "domain_keywords": [],
262
+ "technical_indicators": [],
263
+ "complexity": "low",
264
+ "architecture": "simple",
220
265
  }
221
266
 
222
267
  # Extract from code_analysis
223
- if 'structure_info' in code_analysis:
224
- structure = code_analysis['structure_info']
225
- extraction['classes'] = structure.get('classes', [])
226
- extraction['functions'] = structure.get('functions', [])
227
- extraction['imports'] = structure.get('imports', [])
268
+ if "structure_info" in code_analysis:
269
+ structure = code_analysis["structure_info"]
270
+ extraction["classes"] = structure.get("classes", [])
271
+ extraction["functions"] = structure.get("functions", [])
272
+ extraction["imports"] = structure.get("imports", [])
228
273
 
229
- if 'domain_keywords' in code_analysis:
230
- extraction['domain_keywords'] = code_analysis['domain_keywords']
274
+ if "domain_keywords" in code_analysis:
275
+ extraction["domain_keywords"] = code_analysis["domain_keywords"]
231
276
 
232
277
  # Extract from AST analysis if available
233
- if hasattr(code_analysis, 'ast_info'):
234
- ast_info = code_analysis.ast_info
278
+ if hasattr(code_analysis, "ast_info"):
279
+ pass
235
280
  # Additional extraction logic here
236
281
 
237
282
  # Determine complexity and architecture
238
- extraction['complexity'] = self._analyze_complexity(extraction)
239
- extraction['architecture'] = self._analyze_architecture(extraction)
283
+ extraction["complexity"] = self._analyze_complexity(extraction)
284
+ extraction["architecture"] = self._analyze_architecture(extraction)
240
285
 
241
286
  return extraction
242
287
 
@@ -245,64 +290,64 @@ class EARSTemplateEngine:
245
290
  extension = Path(file_path).suffix.lower()
246
291
 
247
292
  language_map = {
248
- '.py': 'Python',
249
- '.js': 'JavaScript',
250
- '.jsx': 'JavaScript',
251
- '.ts': 'TypeScript',
252
- '.tsx': 'TypeScript',
253
- '.go': 'Go',
254
- '.java': 'Java',
255
- '.cpp': 'C++',
256
- '.c': 'C',
257
- '.cs': 'C#',
258
- '.rb': 'Ruby',
259
- '.php': 'PHP',
260
- '.swift': 'Swift',
261
- '.kt': 'Kotlin'
293
+ ".py": "Python",
294
+ ".js": "JavaScript",
295
+ ".jsx": "JavaScript",
296
+ ".ts": "TypeScript",
297
+ ".tsx": "TypeScript",
298
+ ".go": "Go",
299
+ ".java": "Java",
300
+ ".cpp": "C++",
301
+ ".c": "C",
302
+ ".cs": "C#",
303
+ ".rb": "Ruby",
304
+ ".php": "PHP",
305
+ ".swift": "Swift",
306
+ ".kt": "Kotlin",
262
307
  }
263
308
 
264
- return language_map.get(extension, 'Unknown')
309
+ return language_map.get(extension, "Unknown")
265
310
 
266
311
  def _analyze_complexity(self, extraction: Dict[str, Any]) -> str:
267
312
  """Analyze code complexity."""
268
- class_count = len(extraction['classes'])
269
- function_count = len(extraction['functions'])
313
+ class_count = len(extraction["classes"])
314
+ function_count = len(extraction["functions"])
270
315
 
271
316
  if class_count > 5 or function_count > 20:
272
- return 'high'
317
+ return "high"
273
318
  elif class_count > 2 or function_count > 10:
274
- return 'medium'
319
+ return "medium"
275
320
  else:
276
- return 'low'
321
+ return "low"
277
322
 
278
323
  def _analyze_architecture(self, extraction: Dict[str, Any]) -> str:
279
324
  """Analyze system architecture."""
280
- imports = extraction['imports']
325
+ imports = extraction["imports"]
281
326
 
282
327
  # Check for architectural patterns
283
- if any('django' in imp.lower() for imp in imports):
284
- return 'mvc'
285
- elif any('react' in imp.lower() or 'vue' in imp.lower() for imp in imports):
286
- return 'frontend'
287
- elif any('fastapi' in imp.lower() or 'flask' in imp.lower() for imp in imports):
288
- return 'api'
289
- elif any('sqlalchemy' in imp.lower() or 'django' in imp.lower() for imp in imports):
290
- return 'data'
328
+ if any("django" in imp.lower() for imp in imports):
329
+ return "mvc"
330
+ elif any("react" in imp.lower() or "vue" in imp.lower() for imp in imports):
331
+ return "frontend"
332
+ elif any("fastapi" in imp.lower() or "flask" in imp.lower() for imp in imports):
333
+ return "api"
334
+ elif any("sqlalchemy" in imp.lower() or "django" in imp.lower() for imp in imports):
335
+ return "data"
291
336
  else:
292
- return 'simple'
337
+ return "simple"
293
338
 
294
339
  def _determine_domain(self, extraction: Dict[str, Any]) -> str:
295
340
  """Determine the domain based on code analysis."""
296
- domain_keywords = extraction['domain_keywords']
297
- imports = extraction['imports']
341
+ domain_keywords = extraction["domain_keywords"]
342
+ extraction["imports"]
298
343
 
299
344
  # Check for domain indicators
300
345
  domain_indicators = {
301
- 'auth': ['auth', 'login', 'password', 'security', 'bcrypt', 'token'],
302
- 'api': ['api', 'endpoint', 'route', 'controller', 'service'],
303
- 'data': ['model', 'entity', 'schema', 'database', 'persistence'],
304
- 'ui': ['ui', 'interface', 'component', 'view', 'template'],
305
- 'business': ['business', 'logic', 'process', 'workflow', 'rule']
346
+ "auth": ["auth", "login", "password", "security", "bcrypt", "token"],
347
+ "api": ["api", "endpoint", "route", "controller", "service"],
348
+ "data": ["model", "entity", "schema", "database", "persistence"],
349
+ "ui": ["ui", "interface", "component", "view", "template"],
350
+ "business": ["business", "logic", "process", "workflow", "rule"],
306
351
  }
307
352
 
308
353
  domain_scores = {}
@@ -314,33 +359,42 @@ class EARSTemplateEngine:
314
359
  if domain_scores:
315
360
  return max(domain_scores, key=domain_scores.get)
316
361
  else:
317
- return 'general'
362
+ return "general"
318
363
 
319
364
  def _generate_spec_id(self, extraction: Dict[str, Any], domain: str) -> str:
320
365
  """Generate unique SPEC ID."""
321
- file_name = extraction['file_name']
366
+ file_name = extraction["file_name"]
322
367
  domain_upper = domain.upper()
323
368
 
324
369
  # Clean file name
325
- clean_name = re.sub(r'[^a-zA-Z0-9]', '', file_name)
370
+ clean_name = re.sub(r"[^a-zA-Z0-9]", "", file_name)
326
371
 
327
372
  # Generate hash for uniqueness
328
373
  import hashlib
329
- file_hash = hashlib.md5(f"{file_name}{domain}{time.time()}".encode()).hexdigest()[:4]
374
+
375
+ file_hash = hashlib.md5(f"{file_name}{domain}{time.time()}".encode(), usedforsecurity=False).hexdigest()[:4]
330
376
 
331
377
  return f"{domain_upper}-{clean_name[:8]}-{file_hash}"
332
378
 
333
- def _generate_spec_content(self, extraction: Dict[str, Any], domain: str,
334
- spec_id: str, custom_config: Dict[str, Any] = None) -> str:
379
+ def _generate_spec_content(
380
+ self,
381
+ extraction: Dict[str, Any],
382
+ domain: str,
383
+ spec_id: str,
384
+ custom_config: Dict[str, Any] = None,
385
+ ) -> str:
335
386
  """Generate main spec.md content."""
336
387
  config = custom_config or {}
337
388
 
338
389
  # Get domain template
339
- domain_info = self.domain_templates.get(domain, {
340
- 'description': 'General system',
341
- 'common_features': ['Standard Features'],
342
- 'environment': 'General Purpose'
343
- })
390
+ domain_info = self.domain_templates.get(
391
+ domain,
392
+ {
393
+ "description": "General system",
394
+ "common_features": ["Standard Features"],
395
+ "environment": "General Purpose",
396
+ },
397
+ )
344
398
 
345
399
  # Extract information
346
400
  primary_function = self._extract_primary_function(extraction, domain)
@@ -350,44 +404,41 @@ class EARSTemplateEngine:
350
404
 
351
405
  # Generate template content
352
406
  spec_content = self._render_template(
353
- self.ears_templates['environment'],
407
+ self.ears_templates["environment"],
354
408
  {
355
- 'project_name': config.get('project_name', f'{domain.capitalize()} System'),
356
- 'language': extraction['language'],
357
- 'framework': config.get('framework', self._detect_framework(extraction)),
358
- 'paradigm': config.get('paradigm', 'Object-Oriented'),
359
- 'platform': config.get('platform', 'Web/Server'),
360
- 'deployment': config.get('deployment', 'Cloud-based'),
361
- 'status': config.get('status', 'Development'),
362
- **extraction
363
- }
409
+ "project_name": config.get("project_name", f"{domain.capitalize()} System"),
410
+ "language": extraction["language"],
411
+ "framework": config.get("framework", self._detect_framework(extraction)),
412
+ "paradigm": config.get("paradigm", "Object-Oriented"),
413
+ "platform": config.get("platform", "Web/Server"),
414
+ "deployment": config.get("deployment", "Cloud-based"),
415
+ "status": config.get("status", "Development"),
416
+ **extraction,
417
+ },
364
418
  )
365
419
 
366
420
  # Add assumptions
367
- spec_content += "\n\n" + self._render_template(
368
- self.ears_templates['assumptions'],
369
- extraction
370
- )
421
+ spec_content += "\n\n" + self._render_template(self.ears_templates["assumptions"], extraction)
371
422
 
372
423
  # Add requirements
373
424
  spec_content += "\n\n" + self._render_template(
374
- self.ears_templates['requirements'],
425
+ self.ears_templates["requirements"],
375
426
  {
376
- 'primary_function': primary_function,
377
- 'state_requirements': state_requirements,
378
- 'event_requirements': event_requirements,
379
- **extraction
380
- }
427
+ "primary_function": primary_function,
428
+ "state_requirements": state_requirements,
429
+ "event_requirements": event_requirements,
430
+ **extraction,
431
+ },
381
432
  )
382
433
 
383
434
  # Add specifications
384
435
  spec_content += "\n\n" + self._render_template(
385
- self.ears_templates['specifications'],
436
+ self.ears_templates["specifications"],
386
437
  {
387
- 'technical_specs': technical_specs,
438
+ "technical_specs": technical_specs,
388
439
  **self._generate_technical_details(extraction, domain),
389
- **extraction
390
- }
440
+ **extraction,
441
+ },
391
442
  )
392
443
 
393
444
  # Add traceability
@@ -399,27 +450,27 @@ class EARSTemplateEngine:
399
450
  # Add meta information
400
451
  spec_md = f"""---
401
452
  "id": "SPEC-{spec_id}",
402
- "title": "Auto-generated SPEC for {extraction['file_name']}",
403
- "title_en": "Auto-generated SPEC for {extraction['file_name']}",
453
+ "title": "Auto-generated SPEC for {extraction["file_name"]}",
454
+ "title_en": "Auto-generated SPEC for {extraction["file_name"]}",
404
455
  "version": "1.0.0",
405
456
  "status": "pending",
406
- "created": "{time.strftime('%Y-%m-%d')}",
457
+ "created": "{time.strftime("%Y-%m-%d")}",
407
458
  "author": "@alfred-auto",
408
459
  "reviewer": "",
409
460
  "category": "FEATURE",
410
461
  "priority": "MEDIUM",
411
462
  "tags": ["auto-generated", "{spec_id}", "{domain}"],
412
463
  "language": "en",
413
- "estimated_complexity": "{extraction['complexity']}",
464
+ "estimated_complexity": "{extraction["complexity"]}",
414
465
  "domain": "{domain}"
415
466
  }}
416
467
  ---
417
468
 
418
- ## Auto-generated SPEC for {extraction['file_name']}
469
+ ## Auto-generated SPEC for {extraction["file_name"]}
419
470
 
420
471
  ### Overview
421
472
 
422
- {domain_info['description']}
473
+ {domain_info["description"]}
423
474
 
424
475
  {spec_content}
425
476
  """
@@ -428,19 +479,25 @@ class EARSTemplateEngine:
428
479
 
429
480
  def _render_template(self, template: Dict[str, str], context: Dict[str, Any]) -> str:
430
481
  """Render template with context."""
431
- template_text = template['template']
482
+ template_text = template["template"]
432
483
 
433
484
  # Replace placeholders
434
485
  for key, value in context.items():
435
486
  placeholder = f"{{{key}}}"
436
- template_text = template_text.replace(placeholder, str(value))
487
+ # Handle both string and sequence values
488
+ if isinstance(value, (list, tuple)):
489
+ # Convert sequence to newline-separated string
490
+ str_value = "\n".join(str(v) for v in value)
491
+ else:
492
+ str_value = str(value)
493
+ template_text = template_text.replace(placeholder, str_value)
437
494
 
438
495
  return template_text
439
496
 
440
497
  def _extract_primary_function(self, extraction: Dict[str, Any], domain: str) -> str:
441
498
  """Extract primary function from code analysis."""
442
- classes = extraction['classes']
443
- functions = extraction['functions']
499
+ classes = extraction["classes"]
500
+ functions = extraction["functions"]
444
501
 
445
502
  if classes:
446
503
  return f"Manage {classes[0]} class and related operations"
@@ -456,25 +513,25 @@ class EARSTemplateEngine:
456
513
  "- **REQ-007**: State changes SHALL occur only under valid conditions",
457
514
  "- **REQ-008**: System SHALL maintain integrity of each state",
458
515
  "- **REQ-009**: State changes SHALL be logged and traceable",
459
- "- **REQ-010**: System SHALL provide recovery mechanism from error state"
516
+ "- **REQ-010**: System SHALL provide recovery mechanism from error state",
460
517
  ]
461
518
 
462
519
  domain_specific = {
463
- 'auth': [
520
+ "auth": [
464
521
  "- **AUTH-001**: User SHALL be able to transition from unauthenticated to authenticated state",
465
522
  "- **AUTH-002**: System SHALL be accessible in authenticated state",
466
- "- **AUTH-003**: System SHALL automatically transition to unauthenticated state on session expiry"
523
+ "- **AUTH-003**: System SHALL automatically transition to unauthenticated state on session expiry",
467
524
  ],
468
- 'api': [
525
+ "api": [
469
526
  "- **API-001**: API SHALL have ready, executing, and error states",
470
527
  "- **API-002**: System SHALL return appropriate error response in error state",
471
- "- **API-003**: State changes SHALL be notified as events"
528
+ "- **API-003**: State changes SHALL be notified as events",
472
529
  ],
473
- 'data': [
530
+ "data": [
474
531
  "- **DATA-001**: Data SHALL have create, update, and delete states",
475
532
  "- **DATA-002**: Data integrity SHALL be maintained at all times",
476
- "- **DATA-003**: Data backup state SHALL be monitored"
477
- ]
533
+ "- **DATA-003**: Data backup state SHALL be monitored",
534
+ ],
478
535
  }
479
536
 
480
537
  result = "\n".join(base_requirements)
@@ -490,25 +547,25 @@ class EARSTemplateEngine:
490
547
  "- **EVT-002**: System SHALL handle internal system events",
491
548
  "- **EVT-003**: System SHALL receive external service events",
492
549
  "- **EVT-004**: Event processing errors SHALL be handled appropriately",
493
- "- **EVT-005**: Event logs SHALL be maintained"
550
+ "- **EVT-005**: Event logs SHALL be maintained",
494
551
  ]
495
552
 
496
553
  domain_specific = {
497
- 'auth': [
554
+ "auth": [
498
555
  "- **AUTH-EVT-001**: System SHALL handle login events",
499
556
  "- **AUTH-EVT-002**: System SHALL handle logout events",
500
- "- **AUTH-EVT-003**: System SHALL handle password change events"
557
+ "- **AUTH-EVT-003**: System SHALL handle password change events",
501
558
  ],
502
- 'api': [
559
+ "api": [
503
560
  "- **API-EVT-001**: System SHALL handle API request events",
504
561
  "- **API-EVT-002**: System SHALL handle authentication events",
505
- "- **API-EVT-003**: System SHALL handle rate limit events"
562
+ "- **API-EVT-003**: System SHALL handle rate limit events",
506
563
  ],
507
- 'data': [
564
+ "data": [
508
565
  "- **DATA-EVT-001**: System SHALL handle data save events",
509
566
  "- **DATA-EVT-002**: System SHALL handle data retrieval events",
510
- "- **DATA-EVT-003**: System SHALL handle data deletion events"
511
- ]
567
+ "- **DATA-EVT-003**: System SHALL handle data deletion events",
568
+ ],
512
569
  }
513
570
 
514
571
  result = "\n".join(base_events)
@@ -521,22 +578,21 @@ class EARSTemplateEngine:
521
578
  """Generate technical specifications."""
522
579
  technical_specs = [
523
580
  "#### Core Implementation",
524
-
525
- f"- **SPEC-001**: {extraction['classes'][0] if extraction['classes'] else 'Main'} class SHALL be implemented",
526
- f"- **SPEC-002**: {extraction['functions'][0] if extraction['functions'] else 'Core'} function SHALL be implemented",
581
+ f"- **SPEC-001**: {extraction['classes'][0] if extraction['classes'] else 'Main'} "
582
+ "class SHALL be implemented",
583
+ f"- **SPEC-002**: {extraction['functions'][0] if extraction['functions'] else 'Core'} "
584
+ "function SHALL be implemented",
527
585
  "- **SPEC-003**: Input validation SHALL be implemented",
528
586
  "- **SPEC-004**: Error handling mechanism SHALL be implemented",
529
587
  "- **SPEC-005**: Logging system SHALL be implemented",
530
-
531
588
  "#### Extensibility",
532
589
  "- **SPEC-006**: Plugin architecture support",
533
590
  "- **SPEC-007**: Configuration-based feature enable/disable",
534
591
  "- **SPEC-008**: Testable design",
535
-
536
592
  "#### Maintainability",
537
593
  "- **SPEC-009**: Code documentation",
538
594
  "- **SPEC-010**: Unit test coverage",
539
- "- **SPEC-011**: Code quality validation"
595
+ "- **SPEC-011**: Code quality validation",
540
596
  ]
541
597
 
542
598
  return "\n".join(technical_specs)
@@ -544,13 +600,13 @@ class EARSTemplateEngine:
544
600
  def _generate_technical_details(self, extraction: Dict[str, Any], domain: str) -> Dict[str, str]:
545
601
  """Generate technical details for specifications."""
546
602
  return {
547
- 'technical_details': f"""#### Technical Details
603
+ "technical_details": f"""#### Technical Details
548
604
 
549
- - **Architecture**: {extraction['architecture'].title()} Architecture
550
- - **Complexity**: {extraction['complexity'].title()}
551
- - **Language**: {extraction['language']}
552
- - **Module Count**: {len(extraction['classes'])} classes, {len(extraction['functions'])} functions
553
- - **Dependencies**: {len(extraction['imports'])} external dependencies
605
+ - **Architecture**: {extraction["architecture"].title()} Architecture
606
+ - **Complexity**: {extraction["complexity"].title()}
607
+ - **Language**: {extraction["language"]}
608
+ - **Module Count**: {len(extraction["classes"])} classes, {len(extraction["functions"])} functions
609
+ - **Dependencies**: {len(extraction["imports"])} external dependencies
554
610
 
555
611
  #### Data Models
556
612
 
@@ -575,31 +631,33 @@ class EARSTemplateEngine:
575
631
  #### Scalability Specification
576
632
 
577
633
  {self._generate_scalability_specs(extraction, domain)}""",
578
- 'data_models': self._generate_data_models(extraction, domain),
579
- 'api_specs': self._generate_api_specs(extraction, domain),
580
- 'interface_specs': self._generate_interface_specs(extraction, domain),
581
- 'security_specs': self._generate_security_specs(extraction, domain),
582
- 'performance_specs': self._generate_performance_specs(extraction, domain),
583
- 'scalability_specs': self._generate_scalability_specs(extraction, domain)
634
+ "data_models": self._generate_data_models(extraction, domain),
635
+ "api_specs": self._generate_api_specs(extraction, domain),
636
+ "interface_specs": self._generate_interface_specs(extraction, domain),
637
+ "security_specs": self._generate_security_specs(extraction, domain),
638
+ "performance_specs": self._generate_performance_specs(extraction, domain),
639
+ "scalability_specs": self._generate_scalability_specs(extraction, domain),
584
640
  }
585
641
 
586
642
  def _generate_data_models(self, extraction: Dict[str, Any], domain: str) -> str:
587
643
  """Generate data models section."""
588
- if extraction['classes']:
644
+ if extraction["classes"]:
589
645
  models = []
590
- for class_name in extraction['classes'][:3]: # Limit to 3 models
591
- models.append(f"""
646
+ for class_name in extraction["classes"][:3]: # Limit to 3 models
647
+ models.append(
648
+ f"""
592
649
  **{class_name}**:
593
650
  - Attributes: ID, created_at, status
594
651
  - Methods: create, update, delete, retrieve
595
- - Relations: Relationships with other models""")
652
+ - Relations: Relationships with other models"""
653
+ )
596
654
  return "\n".join(models)
597
655
  else:
598
656
  return "Data models are not explicitly defined."
599
657
 
600
658
  def _generate_api_specs(self, extraction: Dict[str, Any], domain: str) -> str:
601
659
  """Generate API specifications."""
602
- if domain in ['api', 'auth']:
660
+ if domain in ["api", "auth"]:
603
661
  return """
604
662
  **RESTful API Endpoints**:
605
663
  - `GET /api/{resource}`: Retrieve resource list
@@ -616,7 +674,7 @@ class EARSTemplateEngine:
616
674
 
617
675
  def _generate_interface_specs(self, extraction: Dict[str, Any], domain: str) -> str:
618
676
  """Generate interface specifications."""
619
- if domain in ['ui', 'api']:
677
+ if domain in ["ui", "api"]:
620
678
  return """
621
679
  **User Interface**:
622
680
  - Web Interface: Responsive design
@@ -632,7 +690,7 @@ class EARSTemplateEngine:
632
690
 
633
691
  def _generate_security_specs(self, extraction: Dict[str, Any], domain: str) -> str:
634
692
  """Generate security specifications."""
635
- if domain in ['auth', 'api']:
693
+ if domain in ["auth", "api"]:
636
694
  return """
637
695
  **Security Requirements**:
638
696
  - Authentication and authorization
@@ -700,7 +758,6 @@ class EARSTemplateEngine:
700
758
  - Impact analysis documented
701
759
  - Stakeholder approvals recorded"""
702
760
 
703
-
704
761
  def _generate_edit_guide(self, extraction: Dict[str, Any], domain: str) -> str:
705
762
  """Generate edit guide section."""
706
763
  return f"""
@@ -726,31 +783,35 @@ class EARSTemplateEngine:
726
783
  def _get_domain_specific_review(self, domain: str) -> str:
727
784
  """Get domain-specific review guidance."""
728
785
  domain_reviews = {
729
- 'auth': 'Review security requirements, verify authentication flow, review session management',
730
- 'api': 'Review API design, review error handling, review performance',
731
- 'data': 'Review data integrity, review backup and restore',
732
- 'ui': 'Review user experience, review accessibility, review performance',
733
- 'business': 'Review business rules, review compliance'
786
+ "auth": "Review security requirements, verify authentication flow, review session management",
787
+ "api": "Review API design, review error handling, review performance",
788
+ "data": "Review data integrity, review backup and restore",
789
+ "ui": "Review user experience, review accessibility, review performance",
790
+ "business": "Review business rules, review compliance",
734
791
  }
735
- return domain_reviews.get(domain, 'Review general requirements')
736
-
737
- def _generate_plan_content(self, extraction: Dict[str, Any], domain: str,
738
- spec_id: str, custom_config: Dict[str, Any] = None) -> str:
792
+ return domain_reviews.get(domain, "Review general requirements")
793
+
794
+ def _generate_plan_content(
795
+ self,
796
+ extraction: Dict[str, Any],
797
+ domain: str,
798
+ spec_id: str,
799
+ custom_config: Dict[str, Any] = None,
800
+ ) -> str:
739
801
  """Generate plan.md content."""
740
- config = custom_config or {}
741
802
 
742
803
  # Generate implementation plan based on complexity and domain
743
804
  plan_content = f"""---
744
805
  id: "PLAN-{spec_id}"
745
806
  spec_id: "SPEC-{spec_id}"
746
- title: "Auto-generated Implementation Plan for {extraction['file_name']}"
807
+ title: "Auto-generated Implementation Plan for {extraction["file_name"]}"
747
808
  version: "1.0.0"
748
809
  status: "pending"
749
- created: "{time.strftime('%Y-%m-%d')}"
810
+ created: "{time.strftime("%Y-%m-%d")}"
750
811
  author: "@alfred-auto"
751
812
  domain: "{domain}"
752
813
  ---
753
- ## Auto-generated Implementation Plan for {extraction['file_name']}
814
+ ## Auto-generated Implementation Plan for {extraction["file_name"]}
754
815
 
755
816
  ### Implementation Phases
756
817
 
@@ -853,13 +914,13 @@ domain: "{domain}"
853
914
 
854
915
  def _generate_architecture_diagram(self, extraction: Dict[str, Any], domain: str) -> str:
855
916
  """Generate architecture diagram."""
856
- if domain == 'auth':
917
+ if domain == "auth":
857
918
  return """
858
919
  Client → [API Gateway] → [Auth Service] → [Database]
859
920
  ↑ ↓ ↓
860
921
  [UI Layer] [Log Service] [Cache]
861
922
  """
862
- elif domain == 'api':
923
+ elif domain == "api":
863
924
  return """
864
925
  Client → [Load Balancer] → [API Gateway] → [Service 1]
865
926
 
@@ -867,7 +928,7 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
867
928
 
868
929
  [Database]
869
930
  """
870
- elif domain == 'data':
931
+ elif domain == "data":
871
932
  return """
872
933
  [Application] → [Data Service] → [Database]
873
934
  ↑ ↓
@@ -883,76 +944,80 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
883
944
  def _get_main_component(self, extraction: Dict[str, Any], domain: str) -> str:
884
945
  """Get main component name."""
885
946
  components = {
886
- 'auth': 'AuthService',
887
- 'api': 'APIController',
888
- 'data': 'DataService',
889
- 'ui': 'UIController',
890
- 'business': 'BusinessLogic'
947
+ "auth": "AuthService",
948
+ "api": "APIController",
949
+ "data": "DataService",
950
+ "ui": "UIController",
951
+ "business": "BusinessLogic",
891
952
  }
892
- return components.get(domain, 'MainComponent')
953
+ return components.get(domain, "MainComponent")
893
954
 
894
955
  def _get_service_component(self, extraction: Dict[str, Any], domain: str) -> str:
895
956
  """Get service component name."""
896
957
  components = {
897
- 'auth': 'UserService',
898
- 'api': 'ExternalService',
899
- 'data': 'PersistenceService',
900
- 'ui': 'ClientService',
901
- 'business': 'WorkflowService'
958
+ "auth": "UserService",
959
+ "api": "ExternalService",
960
+ "data": "PersistenceService",
961
+ "ui": "ClientService",
962
+ "business": "WorkflowService",
902
963
  }
903
- return components.get(domain, 'ServiceComponent')
964
+ return components.get(domain, "ServiceComponent")
904
965
 
905
966
  def _get_data_component(self, extraction: Dict[str, Any], domain: str) -> str:
906
967
  """Get data component name."""
907
968
  components = {
908
- 'auth': 'UserRepository',
909
- 'api': 'DataRepository',
910
- 'data': 'DataAccessLayer',
911
- 'ui': 'StateManagement',
912
- 'business': 'DataProcessor'
969
+ "auth": "UserRepository",
970
+ "api": "DataRepository",
971
+ "data": "DataAccessLayer",
972
+ "ui": "StateManagement",
973
+ "business": "DataProcessor",
913
974
  }
914
- return components.get(domain, 'DataComponent')
975
+ return components.get(domain, "DataComponent")
915
976
 
916
977
  def _get_component_4(self, extraction: Dict[str, Any], domain: str) -> str:
917
978
  """Get fourth component name."""
918
979
  components = {
919
- 'auth': 'SecurityManager',
920
- 'api': 'RateLimiter',
921
- 'data': 'DataValidator',
922
- 'ui': 'FormValidator',
923
- 'business': 'RuleEngine'
980
+ "auth": "SecurityManager",
981
+ "api": "RateLimiter",
982
+ "data": "DataValidator",
983
+ "ui": "FormValidator",
984
+ "business": "RuleEngine",
924
985
  }
925
- return components.get(domain, 'ValidationComponent')
986
+ return components.get(domain, "ValidationComponent")
926
987
 
927
988
  def _get_new_modules(self, extraction: Dict[str, Any], domain: str) -> str:
928
989
  """Get new modules to be added."""
929
990
  modules = {
930
- 'auth': 'Authentication module, Security module, Session management module',
931
- 'api': 'Routing module, Middleware module, Authentication module',
932
- 'data': 'Database module, Cache module, Backup module',
933
- 'ui': 'Component library, State management module',
934
- 'business': 'Business rules module, Workflow module'
991
+ "auth": "Authentication module, Security module, Session management module",
992
+ "api": "Routing module, Middleware module, Authentication module",
993
+ "data": "Database module, Cache module, Backup module",
994
+ "ui": "Component library, State management module",
995
+ "business": "Business rules module, Workflow module",
935
996
  }
936
- return modules.get(domain, 'Standard modules')
937
-
938
- def _generate_acceptance_content(self, extraction: Dict[str, Any], domain: str,
939
- spec_id: str, custom_config: Dict[str, Any] = None) -> str:
997
+ return modules.get(domain, "Standard modules")
998
+
999
+ def _generate_acceptance_content(
1000
+ self,
1001
+ extraction: Dict[str, Any],
1002
+ domain: str,
1003
+ spec_id: str,
1004
+ custom_config: Dict[str, Any] = None,
1005
+ ) -> str:
940
1006
  """Generate acceptance.md content."""
941
- config = custom_config or {}
942
1007
 
943
1008
  acceptance_content = f"""---
944
1009
  "id": "ACCEPT-{spec_id}",
945
1010
  "spec_id": "SPEC-{spec_id}",
946
- "title": "Auto-generated Acceptance Criteria for {extraction['file_name']}",
1011
+ "title": "Auto-generated Acceptance Criteria for {extraction["file_name"]}",
947
1012
  "version": "1.0.0",
948
1013
  "status": "pending",
949
- "created": "{time.strftime('%Y-%m-%d')}",
1014
+ "created": "{time.strftime("%Y-%m-%d")}",
950
1015
  "author": "@alfred-auto",
951
1016
  "domain": "{domain}"
952
1017
  }}
953
1018
  ---
954
1019
 
955
- ## Auto-generated Acceptance Criteria for {extraction['file_name']}
1020
+ ## Auto-generated Acceptance Criteria for {extraction["file_name"]}
956
1021
 
957
1022
  ### Acceptance Criteria
958
1023
 
@@ -1079,7 +1144,7 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
1079
1144
  def _generate_domain_specific_acceptance(self, domain: str) -> str:
1080
1145
  """Generate domain-specific acceptance criteria."""
1081
1146
  domain_criteria = {
1082
- 'auth': """
1147
+ "auth": """
1083
1148
  - **AUTH-001**: User login functionality validation
1084
1149
  - SHALL allow login with user ID and password
1085
1150
  - SHALL issue session token on success
@@ -1092,7 +1157,7 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
1092
1157
  - SHALL allow password change after verification
1093
1158
  - SHALL validate password complexity
1094
1159
  - SHALL send notification on change""",
1095
- 'api': """
1160
+ "api": """
1096
1161
  - **API-001**: REST API functionality validation
1097
1162
  - SHALL operate CRUD operations correctly
1098
1163
  - SHALL return correct HTTP status codes
@@ -1104,7 +1169,7 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
1104
1169
  - **API-003**: Rate limiting functionality validation
1105
1170
  - SHALL operate request limits correctly
1106
1171
  - SHALL return appropriate errors when limit exceeded""",
1107
- 'data': """
1172
+ "data": """
1108
1173
  - **DATA-001**: Data storage functionality validation
1109
1174
  - SHALL store data correctly
1110
1175
  - SHALL maintain data integrity
@@ -1116,22 +1181,22 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
1116
1181
  - **DATA-003**: Data management functionality validation
1117
1182
  - SHALL allow data modification
1118
1183
  - SHALL handle data deletion safely
1119
- - MAY require data migration functionality"""
1184
+ - MAY require data migration functionality""",
1120
1185
  }
1121
1186
  return domain_criteria.get(domain, "")
1122
1187
 
1123
1188
  def _validate_ears_compliance(self, spec_content: Dict[str, str]) -> Dict[str, Any]:
1124
1189
  """Validate EARS format compliance."""
1125
- spec_md = spec_content.get('spec_md', '')
1190
+ spec_md = spec_content.get("spec_md", "")
1126
1191
 
1127
1192
  # Check for required sections
1128
1193
  required_sections = [
1129
- 'Overview',
1130
- 'Environment',
1131
- 'Assumptions',
1132
- 'Requirements',
1133
- 'Specifications',
1134
- 'Traceability'
1194
+ "Overview",
1195
+ "Environment",
1196
+ "Assumptions",
1197
+ "Requirements",
1198
+ "Specifications",
1199
+ "Traceability",
1135
1200
  ]
1136
1201
 
1137
1202
  section_scores = {}
@@ -1151,27 +1216,27 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
1151
1216
  suggestions.append(f"Required: {section} section must be included")
1152
1217
 
1153
1218
  return {
1154
- 'ears_compliance': round(overall_compliance, 2),
1155
- 'section_scores': section_scores,
1156
- 'suggestions': suggestions[:5], # Top 5 suggestions
1157
- 'total_sections': len(required_sections),
1158
- 'present_sections': sum(1 for score in section_scores.values() if score > 0)
1219
+ "ears_compliance": round(overall_compliance, 2),
1220
+ "section_scores": section_scores,
1221
+ "suggestions": suggestions[:5], # Top 5 suggestions
1222
+ "total_sections": len(required_sections),
1223
+ "present_sections": sum(1 for score in section_scores.values() if score > 0),
1159
1224
  }
1160
1225
 
1161
1226
  def _detect_framework(self, extraction: Dict[str, Any]) -> str:
1162
1227
  """Detect framework from imports."""
1163
- imports = extraction['imports']
1228
+ imports = extraction["imports"]
1164
1229
 
1165
1230
  framework_indicators = {
1166
- 'Django': ['django'],
1167
- 'Flask': ['flask'],
1168
- 'FastAPI': ['fastapi'],
1169
- 'Spring': ['spring'],
1170
- 'Express': ['express'],
1171
- 'React': ['react'],
1172
- 'Angular': ['angular'],
1173
- 'Vue': ['vue'],
1174
- 'Next.js': ['next']
1231
+ "Django": ["django"],
1232
+ "Flask": ["flask"],
1233
+ "FastAPI": ["fastapi"],
1234
+ "Spring": ["spring"],
1235
+ "Express": ["express"],
1236
+ "React": ["react"],
1237
+ "Angular": ["angular"],
1238
+ "Vue": ["vue"],
1239
+ "Next.js": ["next"],
1175
1240
  }
1176
1241
 
1177
1242
  for framework, indicators in framework_indicators.items():
@@ -1179,4 +1244,4 @@ Client → [Load Balancer] → [API Gateway] → [Service 1]
1179
1244
  if any(indicator in imp.lower() for indicator in indicators):
1180
1245
  return framework
1181
1246
 
1182
- return 'Custom'
1247
+ return "Custom"