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.
- moai_adk/__init__.py +2 -5
- moai_adk/__main__.py +114 -82
- moai_adk/cli/__init__.py +6 -1
- moai_adk/cli/commands/__init__.py +1 -3
- moai_adk/cli/commands/analyze.py +5 -16
- moai_adk/cli/commands/doctor.py +6 -18
- moai_adk/cli/commands/init.py +56 -125
- moai_adk/cli/commands/language.py +14 -35
- moai_adk/cli/commands/status.py +9 -15
- moai_adk/cli/commands/update.py +1555 -190
- moai_adk/cli/prompts/init_prompts.py +112 -56
- moai_adk/cli/spec_status.py +263 -0
- moai_adk/cli/ui/__init__.py +44 -0
- moai_adk/cli/ui/progress.py +422 -0
- moai_adk/cli/ui/prompts.py +389 -0
- moai_adk/cli/ui/theme.py +129 -0
- moai_adk/cli/worktree/__init__.py +27 -0
- moai_adk/cli/worktree/__main__.py +31 -0
- moai_adk/cli/worktree/cli.py +672 -0
- moai_adk/cli/worktree/exceptions.py +89 -0
- moai_adk/cli/worktree/manager.py +490 -0
- moai_adk/cli/worktree/models.py +65 -0
- moai_adk/cli/worktree/registry.py +128 -0
- moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
- moai_adk/core/analysis/session_analyzer.py +17 -56
- moai_adk/core/claude_integration.py +26 -54
- moai_adk/core/command_helpers.py +10 -10
- moai_adk/core/comprehensive_monitoring_system.py +1183 -0
- moai_adk/core/config/auto_spec_config.py +5 -11
- moai_adk/core/config/migration.py +19 -9
- moai_adk/core/config/unified.py +436 -0
- moai_adk/core/context_manager.py +6 -12
- moai_adk/core/enterprise_features.py +1404 -0
- moai_adk/core/error_recovery_system.py +725 -112
- moai_adk/core/event_driven_hook_system.py +1371 -0
- moai_adk/core/git/__init__.py +8 -0
- moai_adk/core/git/branch_manager.py +3 -11
- moai_adk/core/git/checkpoint.py +1 -3
- moai_adk/core/git/conflict_detector.py +413 -0
- moai_adk/core/git/manager.py +91 -1
- moai_adk/core/hooks/post_tool_auto_spec_completion.py +56 -80
- moai_adk/core/input_validation_middleware.py +1006 -0
- moai_adk/core/integration/engine.py +6 -18
- moai_adk/core/integration/integration_tester.py +10 -9
- moai_adk/core/integration/utils.py +1 -1
- moai_adk/core/issue_creator.py +10 -28
- moai_adk/core/jit_context_loader.py +956 -0
- moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
- moai_adk/core/language_config_resolver.py +485 -0
- moai_adk/core/language_validator.py +28 -41
- moai_adk/core/mcp/setup.py +15 -12
- moai_adk/core/merge/__init__.py +9 -0
- moai_adk/core/merge/analyzer.py +481 -0
- moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
- moai_adk/core/migration/backup_manager.py +78 -9
- moai_adk/core/migration/custom_element_scanner.py +358 -0
- moai_adk/core/migration/file_migrator.py +8 -17
- moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
- moai_adk/core/migration/selective_restorer.py +470 -0
- moai_adk/core/migration/template_utils.py +74 -0
- moai_adk/core/migration/user_selection_ui.py +338 -0
- moai_adk/core/migration/version_detector.py +6 -10
- moai_adk/core/migration/version_migrator.py +3 -3
- moai_adk/core/performance/cache_system.py +8 -10
- moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
- moai_adk/core/project/checker.py +2 -4
- moai_adk/core/project/detector.py +1 -3
- moai_adk/core/project/initializer.py +135 -23
- moai_adk/core/project/phase_executor.py +54 -81
- moai_adk/core/project/validator.py +6 -12
- moai_adk/core/quality/trust_checker.py +9 -27
- moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
- moai_adk/core/robust_json_parser.py +611 -0
- moai_adk/core/rollback_manager.py +73 -148
- moai_adk/core/session_manager.py +10 -26
- moai_adk/core/skill_loading_system.py +579 -0
- moai_adk/core/spec/confidence_scoring.py +31 -100
- moai_adk/core/spec/ears_template_engine.py +351 -286
- moai_adk/core/spec/quality_validator.py +35 -69
- moai_adk/core/spec_status_manager.py +64 -74
- moai_adk/core/template/backup.py +45 -20
- moai_adk/core/template/config.py +112 -39
- moai_adk/core/template/merger.py +11 -19
- moai_adk/core/template/processor.py +253 -149
- moai_adk/core/template_engine.py +73 -40
- moai_adk/core/template_variable_synchronizer.py +417 -0
- moai_adk/core/unified_permission_manager.py +745 -0
- moai_adk/core/user_behavior_analytics.py +851 -0
- moai_adk/core/version_sync.py +429 -0
- moai_adk/foundation/__init__.py +56 -0
- moai_adk/foundation/backend.py +1027 -0
- moai_adk/foundation/database.py +1115 -0
- moai_adk/foundation/devops.py +1585 -0
- moai_adk/foundation/ears.py +431 -0
- moai_adk/foundation/frontend.py +870 -0
- moai_adk/foundation/git/commit_templates.py +4 -12
- moai_adk/foundation/git.py +376 -0
- moai_adk/foundation/langs.py +484 -0
- moai_adk/foundation/ml_ops.py +1162 -0
- moai_adk/foundation/testing.py +1524 -0
- moai_adk/foundation/trust/trust_principles.py +23 -72
- moai_adk/foundation/trust/validation_checklist.py +57 -162
- moai_adk/project/__init__.py +0 -0
- moai_adk/project/configuration.py +1084 -0
- moai_adk/project/documentation.py +566 -0
- moai_adk/project/schema.py +447 -0
- moai_adk/statusline/alfred_detector.py +1 -3
- moai_adk/statusline/config.py +13 -4
- moai_adk/statusline/enhanced_output_style_detector.py +23 -15
- moai_adk/statusline/main.py +51 -15
- moai_adk/statusline/renderer.py +104 -48
- moai_adk/statusline/update_checker.py +3 -9
- moai_adk/statusline/version_reader.py +140 -46
- moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +549 -0
- moai_adk/templates/.claude/agents/moai/builder-agent.md +445 -0
- moai_adk/templates/.claude/agents/moai/builder-command.md +1132 -0
- moai_adk/templates/.claude/agents/moai/builder-skill.md +601 -0
- moai_adk/templates/.claude/agents/moai/expert-backend.md +831 -0
- moai_adk/templates/.claude/agents/moai/expert-database.md +774 -0
- moai_adk/templates/.claude/agents/moai/expert-debug.md +396 -0
- moai_adk/templates/.claude/agents/moai/expert-devops.md +711 -0
- moai_adk/templates/.claude/agents/moai/expert-frontend.md +666 -0
- moai_adk/templates/.claude/agents/moai/expert-security.md +474 -0
- moai_adk/templates/.claude/agents/moai/expert-uiux.md +1038 -0
- moai_adk/templates/.claude/agents/moai/manager-claude-code.md +429 -0
- moai_adk/templates/.claude/agents/moai/manager-docs.md +570 -0
- moai_adk/templates/.claude/agents/moai/manager-git.md +937 -0
- moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
- moai_adk/templates/.claude/agents/moai/manager-quality.md +598 -0
- moai_adk/templates/.claude/agents/moai/manager-spec.md +713 -0
- moai_adk/templates/.claude/agents/moai/manager-strategy.md +600 -0
- moai_adk/templates/.claude/agents/moai/manager-tdd.md +603 -0
- moai_adk/templates/.claude/agents/moai/mcp-context7.md +369 -0
- moai_adk/templates/.claude/agents/moai/mcp-figma.md +1567 -0
- moai_adk/templates/.claude/agents/moai/mcp-notion.md +749 -0
- moai_adk/templates/.claude/agents/moai/mcp-playwright.md +427 -0
- moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +994 -0
- moai_adk/templates/.claude/commands/moai/0-project.md +1143 -0
- moai_adk/templates/.claude/commands/moai/1-plan.md +1435 -0
- moai_adk/templates/.claude/commands/moai/2-run.md +883 -0
- moai_adk/templates/.claude/commands/moai/3-sync.md +993 -0
- moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
- moai_adk/templates/.claude/hooks/__init__.py +8 -0
- moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
- moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
- moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
- moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
- moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
- moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
- moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
- moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
- moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
- moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
- moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
- moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
- moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
- moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
- moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +921 -0
- moai_adk/templates/.claude/output-styles/moai/r2d2.md +380 -0
- moai_adk/templates/.claude/output-styles/moai/yoda.md +338 -0
- moai_adk/templates/.claude/settings.json +172 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +247 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +319 -0
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +320 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +496 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +453 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/design-system-tokens.md +405 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
- moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +491 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +201 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +438 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +515 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +346 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +362 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
- moai_adk/templates/.claude/skills/moai-integration-mcp/SKILL.md +352 -0
- moai_adk/templates/.claude/skills/moai-integration-mcp/modules/README.md +52 -0
- moai_adk/templates/.claude/skills/moai-integration-mcp/modules/error-handling.md +334 -0
- moai_adk/templates/.claude/skills/moai-integration-mcp/modules/integration-patterns.md +310 -0
- moai_adk/templates/.claude/skills/moai-integration-mcp/modules/security-authentication.md +256 -0
- moai_adk/templates/.claude/skills/moai-integration-mcp/modules/server-architecture.md +253 -0
- moai_adk/templates/.claude/skills/moai-lang-unified/README.md +133 -0
- moai_adk/templates/.claude/skills/moai-lang-unified/SKILL.md +296 -0
- moai_adk/templates/.claude/skills/moai-lang-unified/examples.md +1269 -0
- moai_adk/templates/.claude/skills/moai-lang-unified/reference.md +331 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +298 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +316 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +370 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
- moai_adk/templates/.claude/skills/moai-platform-baas/README.md +186 -0
- moai_adk/templates/.claude/skills/moai-platform-baas/SKILL.md +290 -0
- moai_adk/templates/.claude/skills/moai-platform-baas/examples.md +1225 -0
- moai_adk/templates/.claude/skills/moai-platform-baas/reference.md +567 -0
- moai_adk/templates/.claude/skills/moai-platform-baas/scripts/provider-selector.py +323 -0
- moai_adk/templates/.claude/skills/moai-platform-baas/templates/stack-config.yaml +204 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +446 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +387 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +135 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1362 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +71 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +374 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +453 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
- moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +410 -0
- moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
- moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
- moai_adk/templates/.git-hooks/pre-commit +103 -41
- moai_adk/templates/.git-hooks/pre-push +116 -21
- moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
- moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
- moai_adk/templates/.gitignore +184 -44
- moai_adk/templates/.mcp.json +7 -9
- moai_adk/templates/.moai/cache/personalization.json +10 -0
- moai_adk/templates/.moai/config/config.yaml +344 -0
- moai_adk/templates/.moai/config/presets/manual.yaml +28 -0
- moai_adk/templates/.moai/config/presets/personal.yaml +30 -0
- moai_adk/templates/.moai/config/presets/team.yaml +33 -0
- moai_adk/templates/.moai/config/questions/_schema.yaml +79 -0
- moai_adk/templates/.moai/config/questions/tab1-user.yaml +108 -0
- moai_adk/templates/.moai/config/questions/tab2-project.yaml +122 -0
- moai_adk/templates/.moai/config/questions/tab3-git.yaml +542 -0
- moai_adk/templates/.moai/config/questions/tab4-quality.yaml +167 -0
- moai_adk/templates/.moai/config/questions/tab5-system.yaml +152 -0
- moai_adk/templates/.moai/config/sections/git-strategy.yaml +40 -0
- moai_adk/templates/.moai/config/sections/language.yaml +11 -0
- moai_adk/templates/.moai/config/sections/project.yaml +13 -0
- moai_adk/templates/.moai/config/sections/quality.yaml +15 -0
- moai_adk/templates/.moai/config/sections/system.yaml +14 -0
- moai_adk/templates/.moai/config/sections/user.yaml +5 -0
- moai_adk/templates/.moai/config/statusline-config.yaml +86 -0
- moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
- moai_adk/templates/CLAUDE.md +382 -501
- moai_adk/utils/__init__.py +24 -1
- moai_adk/utils/banner.py +7 -10
- moai_adk/utils/common.py +16 -30
- moai_adk/utils/link_validator.py +4 -12
- moai_adk/utils/safe_file_reader.py +2 -6
- moai_adk/utils/timeout.py +160 -0
- moai_adk/utils/toon_utils.py +256 -0
- moai_adk/version.py +22 -0
- moai_adk-0.32.8.dist-info/METADATA +2478 -0
- moai_adk-0.32.8.dist-info/RECORD +396 -0
- {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/WHEEL +1 -1
- {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/entry_points.txt +1 -0
- moai_adk/cli/commands/backup.py +0 -82
- moai_adk/cli/commands/improve_user_experience.py +0 -348
- moai_adk/cli/commands/migrate.py +0 -158
- moai_adk/cli/commands/validate_links.py +0 -118
- moai_adk/templates/.github/workflows/moai-gitflow.yml +0 -413
- moai_adk/templates/.github/workflows/moai-release-create.yml +0 -100
- moai_adk/templates/.github/workflows/moai-release-pipeline.yml +0 -188
- moai_adk/utils/user_experience.py +0 -531
- moai_adk-0.25.4.dist-info/METADATA +0 -2279
- moai_adk-0.25.4.dist-info/RECORD +0 -112
- {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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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
|
-
|
|
108
|
+
- **Generation Method**: Auto-analysis based""",
|
|
109
|
+
"required_fields": [
|
|
110
|
+
"project_name",
|
|
111
|
+
"language",
|
|
112
|
+
"framework",
|
|
113
|
+
"paradigm",
|
|
114
|
+
],
|
|
75
115
|
},
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
126
|
+
8. Performance requirements are met""",
|
|
127
|
+
"required_fields": [],
|
|
88
128
|
},
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
156
|
+
- **REQ-012**: Mobile compatibility MAY be required""",
|
|
157
|
+
"required_fields": ["primary_function"],
|
|
118
158
|
},
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
152
|
-
}
|
|
190
|
+
{scalability_specs}""",
|
|
191
|
+
"required_fields": [],
|
|
192
|
+
},
|
|
153
193
|
}
|
|
154
194
|
|
|
155
|
-
def generate_complete_spec(
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
|
224
|
-
structure = code_analysis[
|
|
225
|
-
extraction[
|
|
226
|
-
extraction[
|
|
227
|
-
extraction[
|
|
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
|
|
230
|
-
extraction[
|
|
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,
|
|
234
|
-
|
|
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[
|
|
239
|
-
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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,
|
|
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[
|
|
269
|
-
function_count = len(extraction[
|
|
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
|
|
317
|
+
return "high"
|
|
273
318
|
elif class_count > 2 or function_count > 10:
|
|
274
|
-
return
|
|
319
|
+
return "medium"
|
|
275
320
|
else:
|
|
276
|
-
return
|
|
321
|
+
return "low"
|
|
277
322
|
|
|
278
323
|
def _analyze_architecture(self, extraction: Dict[str, Any]) -> str:
|
|
279
324
|
"""Analyze system architecture."""
|
|
280
|
-
imports = extraction[
|
|
325
|
+
imports = extraction["imports"]
|
|
281
326
|
|
|
282
327
|
# Check for architectural patterns
|
|
283
|
-
if any(
|
|
284
|
-
return
|
|
285
|
-
elif any(
|
|
286
|
-
return
|
|
287
|
-
elif any(
|
|
288
|
-
return
|
|
289
|
-
elif any(
|
|
290
|
-
return
|
|
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
|
|
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[
|
|
297
|
-
|
|
341
|
+
domain_keywords = extraction["domain_keywords"]
|
|
342
|
+
extraction["imports"]
|
|
298
343
|
|
|
299
344
|
# Check for domain indicators
|
|
300
345
|
domain_indicators = {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
|
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[
|
|
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
|
|
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
|
-
|
|
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(
|
|
334
|
-
|
|
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(
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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[
|
|
407
|
+
self.ears_templates["environment"],
|
|
354
408
|
{
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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[
|
|
425
|
+
self.ears_templates["requirements"],
|
|
375
426
|
{
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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[
|
|
436
|
+
self.ears_templates["specifications"],
|
|
386
437
|
{
|
|
387
|
-
|
|
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[
|
|
403
|
-
"title_en": "Auto-generated SPEC for {extraction[
|
|
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(
|
|
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[
|
|
464
|
+
"estimated_complexity": "{extraction["complexity"]}",
|
|
414
465
|
"domain": "{domain}"
|
|
415
466
|
}}
|
|
416
467
|
---
|
|
417
468
|
|
|
418
|
-
## Auto-generated SPEC for {extraction[
|
|
469
|
+
## Auto-generated SPEC for {extraction["file_name"]}
|
|
419
470
|
|
|
420
471
|
### Overview
|
|
421
472
|
|
|
422
|
-
{domain_info[
|
|
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[
|
|
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
|
-
|
|
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[
|
|
443
|
-
functions = extraction[
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
526
|
-
f"- **SPEC-002**: {extraction['functions'][0] if extraction['functions'] else 'Core'}
|
|
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
|
-
|
|
603
|
+
"technical_details": f"""#### Technical Details
|
|
548
604
|
|
|
549
|
-
- **Architecture**: {extraction[
|
|
550
|
-
- **Complexity**: {extraction[
|
|
551
|
-
- **Language**: {extraction[
|
|
552
|
-
- **Module Count**: {len(extraction[
|
|
553
|
-
- **Dependencies**: {len(extraction[
|
|
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
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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[
|
|
644
|
+
if extraction["classes"]:
|
|
589
645
|
models = []
|
|
590
|
-
for class_name in extraction[
|
|
591
|
-
models.append(
|
|
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 [
|
|
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 [
|
|
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 [
|
|
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
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
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,
|
|
736
|
-
|
|
737
|
-
def _generate_plan_content(
|
|
738
|
-
|
|
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[
|
|
807
|
+
title: "Auto-generated Implementation Plan for {extraction["file_name"]}"
|
|
747
808
|
version: "1.0.0"
|
|
748
809
|
status: "pending"
|
|
749
|
-
created: "{time.strftime(
|
|
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[
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
947
|
+
"auth": "AuthService",
|
|
948
|
+
"api": "APIController",
|
|
949
|
+
"data": "DataService",
|
|
950
|
+
"ui": "UIController",
|
|
951
|
+
"business": "BusinessLogic",
|
|
891
952
|
}
|
|
892
|
-
return components.get(domain,
|
|
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
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
958
|
+
"auth": "UserService",
|
|
959
|
+
"api": "ExternalService",
|
|
960
|
+
"data": "PersistenceService",
|
|
961
|
+
"ui": "ClientService",
|
|
962
|
+
"business": "WorkflowService",
|
|
902
963
|
}
|
|
903
|
-
return components.get(domain,
|
|
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
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
969
|
+
"auth": "UserRepository",
|
|
970
|
+
"api": "DataRepository",
|
|
971
|
+
"data": "DataAccessLayer",
|
|
972
|
+
"ui": "StateManagement",
|
|
973
|
+
"business": "DataProcessor",
|
|
913
974
|
}
|
|
914
|
-
return components.get(domain,
|
|
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
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
980
|
+
"auth": "SecurityManager",
|
|
981
|
+
"api": "RateLimiter",
|
|
982
|
+
"data": "DataValidator",
|
|
983
|
+
"ui": "FormValidator",
|
|
984
|
+
"business": "RuleEngine",
|
|
924
985
|
}
|
|
925
|
-
return components.get(domain,
|
|
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
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
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,
|
|
937
|
-
|
|
938
|
-
def _generate_acceptance_content(
|
|
939
|
-
|
|
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[
|
|
1011
|
+
"title": "Auto-generated Acceptance Criteria for {extraction["file_name"]}",
|
|
947
1012
|
"version": "1.0.0",
|
|
948
1013
|
"status": "pending",
|
|
949
|
-
"created": "{time.strftime(
|
|
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[
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
1190
|
+
spec_md = spec_content.get("spec_md", "")
|
|
1126
1191
|
|
|
1127
1192
|
# Check for required sections
|
|
1128
1193
|
required_sections = [
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
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
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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[
|
|
1228
|
+
imports = extraction["imports"]
|
|
1164
1229
|
|
|
1165
1230
|
framework_indicators = {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
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
|
|
1247
|
+
return "Custom"
|