moai-adk 0.15.0__py3-none-any.whl â 0.25.4__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 +1 -2
- moai_adk/__main__.py +85 -2
- moai_adk/cli/__init__.py +0 -1
- moai_adk/cli/commands/__init__.py +0 -1
- moai_adk/cli/commands/analyze.py +127 -0
- moai_adk/cli/commands/backup.py +5 -3
- moai_adk/cli/commands/doctor.py +35 -11
- moai_adk/cli/commands/improve_user_experience.py +348 -0
- moai_adk/cli/commands/init.py +150 -23
- moai_adk/cli/commands/language.py +269 -0
- moai_adk/cli/commands/migrate.py +158 -0
- moai_adk/cli/commands/status.py +13 -12
- moai_adk/cli/commands/update.py +364 -60
- moai_adk/cli/commands/validate_links.py +118 -0
- moai_adk/cli/main.py +3 -2
- moai_adk/cli/prompts/init_prompts.py +79 -82
- moai_adk/core/__init__.py +0 -1
- moai_adk/core/analysis/__init__.py +9 -0
- moai_adk/core/analysis/session_analyzer.py +439 -0
- moai_adk/core/claude_integration.py +421 -0
- moai_adk/core/command_helpers.py +270 -0
- moai_adk/core/config/__init__.py +6 -0
- moai_adk/core/config/auto_spec_config.py +346 -0
- moai_adk/core/config/migration.py +133 -12
- moai_adk/core/context_manager.py +279 -0
- moai_adk/core/diagnostics/slash_commands.py +0 -1
- moai_adk/core/error_recovery_system.py +1289 -0
- moai_adk/core/git/__init__.py +0 -1
- moai_adk/core/git/branch.py +0 -1
- moai_adk/core/git/branch_manager.py +4 -4
- moai_adk/core/git/checkpoint.py +1 -5
- moai_adk/core/git/commit.py +0 -1
- moai_adk/core/git/event_detector.py +3 -5
- moai_adk/core/git/manager.py +0 -1
- moai_adk/core/hooks/post_tool_auto_spec_completion.py +925 -0
- moai_adk/core/integration/__init__.py +22 -0
- moai_adk/core/integration/engine.py +169 -0
- moai_adk/core/integration/integration_tester.py +225 -0
- moai_adk/core/integration/models.py +88 -0
- moai_adk/core/integration/utils.py +211 -0
- moai_adk/core/issue_creator.py +28 -18
- moai_adk/core/language_config.py +202 -0
- moai_adk/core/language_validator.py +556 -0
- moai_adk/core/mcp/setup.py +113 -0
- moai_adk/core/migration/__init__.py +18 -0
- moai_adk/core/migration/backup_manager.py +208 -0
- moai_adk/core/migration/file_migrator.py +218 -0
- moai_adk/core/migration/version_detector.py +143 -0
- moai_adk/core/migration/version_migrator.py +228 -0
- moai_adk/core/performance/__init__.py +6 -0
- moai_adk/core/performance/cache_system.py +318 -0
- moai_adk/core/performance/parallel_processor.py +116 -0
- moai_adk/core/project/__init__.py +0 -1
- moai_adk/core/project/backup_utils.py +2 -7
- moai_adk/core/project/checker.py +3 -3
- moai_adk/core/project/detector.py +20 -40
- moai_adk/core/project/initializer.py +42 -17
- moai_adk/core/project/phase_executor.py +415 -58
- moai_adk/core/project/validator.py +6 -25
- moai_adk/core/quality/__init__.py +1 -1
- moai_adk/core/quality/trust_checker.py +64 -110
- moai_adk/core/quality/validators/__init__.py +1 -1
- moai_adk/core/quality/validators/base_validator.py +1 -1
- moai_adk/core/rollback_manager.py +993 -0
- moai_adk/core/session_manager.py +667 -0
- moai_adk/core/spec/confidence_scoring.py +749 -0
- moai_adk/core/spec/ears_template_engine.py +1182 -0
- moai_adk/core/spec/quality_validator.py +721 -0
- moai_adk/core/spec_status_manager.py +488 -0
- moai_adk/core/template/__init__.py +0 -1
- moai_adk/core/template/backup.py +41 -1
- moai_adk/core/template/config.py +11 -12
- moai_adk/core/template/languages.py +0 -1
- moai_adk/core/template/merger.py +79 -22
- moai_adk/core/template/processor.py +614 -40
- moai_adk/core/template_engine.py +36 -27
- moai_adk/foundation/git/commit_templates.py +565 -0
- moai_adk/foundation/trust/trust_principles.py +725 -0
- moai_adk/foundation/trust/validation_checklist.py +1678 -0
- moai_adk/statusline/__init__.py +38 -0
- moai_adk/statusline/alfred_detector.py +107 -0
- moai_adk/statusline/config.py +364 -0
- moai_adk/statusline/enhanced_output_style_detector.py +364 -0
- moai_adk/statusline/git_collector.py +190 -0
- moai_adk/statusline/main.py +228 -0
- moai_adk/statusline/metrics_tracker.py +78 -0
- moai_adk/statusline/renderer.py +327 -0
- moai_adk/statusline/update_checker.py +135 -0
- moai_adk/statusline/version_reader.py +647 -0
- moai_adk/templates/.git-hooks/pre-commit +66 -0
- moai_adk/templates/.git-hooks/pre-push +116 -4
- moai_adk/templates/.github/workflows/moai-gitflow.yml +1 -7
- moai_adk/templates/.github/workflows/spec-issue-sync.yml +0 -1
- moai_adk/templates/.gitignore +44 -0
- moai_adk/templates/.mcp.json +22 -0
- moai_adk/templates/CLAUDE.md +450 -1071
- moai_adk/utils/__init__.py +0 -1
- moai_adk/utils/banner.py +0 -1
- moai_adk/utils/common.py +308 -0
- moai_adk/utils/link_validator.py +249 -0
- moai_adk/utils/logger.py +4 -9
- moai_adk/utils/safe_file_reader.py +210 -0
- moai_adk/utils/user_experience.py +531 -0
- moai_adk-0.25.4.dist-info/METADATA +2279 -0
- moai_adk-0.25.4.dist-info/RECORD +112 -0
- moai_adk/core/tags/__init__.py +0 -86
- moai_adk/core/tags/ci_validator.py +0 -463
- moai_adk/core/tags/cli.py +0 -283
- moai_adk/core/tags/generator.py +0 -109
- moai_adk/core/tags/inserter.py +0 -99
- moai_adk/core/tags/mapper.py +0 -126
- moai_adk/core/tags/parser.py +0 -76
- moai_adk/core/tags/pre_commit_validator.py +0 -393
- moai_adk/core/tags/reporter.py +0 -956
- moai_adk/core/tags/tags.py +0 -149
- moai_adk/core/tags/validator.py +0 -897
- moai_adk/templates/.claude/agents/alfred/backend-expert.md +0 -319
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +0 -316
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +0 -208
- moai_adk/templates/.claude/agents/alfred/devops-expert.md +0 -464
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +0 -214
- moai_adk/templates/.claude/agents/alfred/frontend-expert.md +0 -357
- moai_adk/templates/.claude/agents/alfred/git-manager.md +0 -406
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +0 -423
- moai_adk/templates/.claude/agents/alfred/project-manager.md +0 -312
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +0 -343
- moai_adk/templates/.claude/agents/alfred/skill-factory.md +0 -865
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +0 -392
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +0 -361
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +0 -428
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +0 -375
- moai_adk/templates/.claude/agents/alfred/ui-ux-expert.md +0 -571
- moai_adk/templates/.claude/commands/alfred/0-project.md +0 -1525
- moai_adk/templates/.claude/commands/alfred/1-plan.md +0 -802
- moai_adk/templates/.claude/commands/alfred/2-run.md +0 -709
- moai_adk/templates/.claude/commands/alfred/3-sync.md +0 -1009
- moai_adk/templates/.claude/commands/alfred/9-feedback.md +0 -149
- moai_adk/templates/.claude/hooks/alfred/core/project.py +0 -748
- moai_adk/templates/.claude/hooks/alfred/core/timeout.py +0 -136
- moai_adk/templates/.claude/hooks/alfred/core/ttl_cache.py +0 -108
- moai_adk/templates/.claude/hooks/alfred/core/version_cache.py +0 -198
- moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +0 -29
- moai_adk/templates/.claude/hooks/alfred/post_tool__log_changes.py +0 -94
- moai_adk/templates/.claude/hooks/alfred/pre_tool__auto_checkpoint.py +0 -100
- moai_adk/templates/.claude/hooks/alfred/session_end__cleanup.py +0 -94
- moai_adk/templates/.claude/hooks/alfred/session_start__show_project_info.py +0 -94
- moai_adk/templates/.claude/hooks/alfred/shared/core/__init__.py +0 -170
- moai_adk/templates/.claude/hooks/alfred/shared/core/checkpoint.py +0 -271
- moai_adk/templates/.claude/hooks/alfred/shared/core/context.py +0 -67
- moai_adk/templates/.claude/hooks/alfred/shared/core/project.py +0 -749
- moai_adk/templates/.claude/hooks/alfred/shared/core/tags.py +0 -230
- moai_adk/templates/.claude/hooks/alfred/shared/core/version_cache.py +0 -198
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/__init__.py +0 -21
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/notification.py +0 -154
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/session.py +0 -174
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/tool.py +0 -87
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/user.py +0 -61
- moai_adk/templates/.claude/hooks/alfred/user_prompt__jit_load_docs.py +0 -112
- moai_adk/templates/.claude/hooks/alfred/utils/__init__.py +0 -1
- moai_adk/templates/.claude/hooks/alfred/utils/timeout.py +0 -161
- moai_adk/templates/.claude/settings.json +0 -144
- moai_adk/templates/.claude/skills/moai-alfred-agent-guide/SKILL.md +0 -70
- moai_adk/templates/.claude/skills/moai-alfred-agent-guide/examples.md +0 -62
- moai_adk/templates/.claude/skills/moai-alfred-agent-guide/reference.md +0 -242
- moai_adk/templates/.claude/skills/moai-alfred-config-schema/SKILL.md +0 -56
- moai_adk/templates/.claude/skills/moai-alfred-config-schema/examples.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-config-schema/reference.md +0 -444
- moai_adk/templates/.claude/skills/moai-alfred-context-budget/SKILL.md +0 -62
- moai_adk/templates/.claude/skills/moai-alfred-context-budget/examples.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-context-budget/reference.md +0 -405
- moai_adk/templates/.claude/skills/moai-alfred-dev-guide/SKILL.md +0 -51
- moai_adk/templates/.claude/skills/moai-alfred-dev-guide/examples.md +0 -355
- moai_adk/templates/.claude/skills/moai-alfred-dev-guide/reference.md +0 -239
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-expertise-detection/SKILL.md +0 -323
- moai_adk/templates/.claude/skills/moai-alfred-expertise-detection/examples.md +0 -286
- moai_adk/templates/.claude/skills/moai-alfred-expertise-detection/reference.md +0 -126
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +0 -122
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/reference.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-gitflow-policy/SKILL.md +0 -74
- moai_adk/templates/.claude/skills/moai-alfred-gitflow-policy/examples.md +0 -4
- moai_adk/templates/.claude/skills/moai-alfred-gitflow-policy/reference.md +0 -269
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +0 -237
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +0 -615
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +0 -653
- moai_adk/templates/.claude/skills/moai-alfred-issue-labels/SKILL.md +0 -19
- moai_adk/templates/.claude/skills/moai-alfred-issue-labels/examples.md +0 -4
- moai_adk/templates/.claude/skills/moai-alfred-issue-labels/reference.md +0 -150
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-persona-roles/SKILL.md +0 -198
- moai_adk/templates/.claude/skills/moai-alfred-persona-roles/examples.md +0 -431
- moai_adk/templates/.claude/skills/moai-alfred-persona-roles/reference.md +0 -141
- moai_adk/templates/.claude/skills/moai-alfred-practices/SKILL.md +0 -89
- moai_adk/templates/.claude/skills/moai-alfred-practices/examples.md +0 -122
- moai_adk/templates/.claude/skills/moai-alfred-practices/reference.md +0 -369
- moai_adk/templates/.claude/skills/moai-alfred-proactive-suggestions/SKILL.md +0 -508
- moai_adk/templates/.claude/skills/moai-alfred-proactive-suggestions/examples.md +0 -481
- moai_adk/templates/.claude/skills/moai-alfred-proactive-suggestions/reference.md +0 -100
- moai_adk/templates/.claude/skills/moai-alfred-reporting/SKILL.md +0 -273
- moai_adk/templates/.claude/skills/moai-alfred-rules/SKILL.md +0 -77
- moai_adk/templates/.claude/skills/moai-alfred-rules/examples.md +0 -265
- moai_adk/templates/.claude/skills/moai-alfred-rules/reference.md +0 -539
- moai_adk/templates/.claude/skills/moai-alfred-session-state/SKILL.md +0 -19
- moai_adk/templates/.claude/skills/moai-alfred-session-state/examples.md +0 -4
- moai_adk/templates/.claude/skills/moai-alfred-session-state/reference.md +0 -84
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/README.md +0 -137
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/SKILL.md +0 -219
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/examples/validate-spec.sh +0 -161
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/examples.md +0 -541
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/reference.md +0 -622
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-extended/SKILL.md +0 -115
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-extended/examples.md +0 -4
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-extended/reference.md +0 -348
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-todowrite-pattern/SKILL.md +0 -19
- moai_adk/templates/.claude/skills/moai-alfred-todowrite-pattern/examples.md +0 -4
- moai_adk/templates/.claude/skills/moai-alfred-todowrite-pattern/reference.md +0 -211
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-workflow/SKILL.md +0 -288
- moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +0 -269
- moai_adk/templates/.claude/skills/moai-cc-agents/templates/agent-template.md +0 -32
- moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +0 -298
- moai_adk/templates/.claude/skills/moai-cc-claude-md/templates/CLAUDE-template.md +0 -26
- moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +0 -307
- moai_adk/templates/.claude/skills/moai-cc-commands/templates/command-template.md +0 -21
- moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +0 -252
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/pre-bash-check.sh +0 -19
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/preserve-permissions.sh +0 -19
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/validate-bash-command.py +0 -24
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +0 -199
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/templates/settings-mcp-template.json +0 -39
- moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +0 -316
- moai_adk/templates/.claude/skills/moai-cc-memory/templates/session-summary-template.md +0 -18
- moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +0 -263
- moai_adk/templates/.claude/skills/moai-cc-settings/templates/settings-complete-template.json +0 -30
- moai_adk/templates/.claude/skills/moai-cc-skill-descriptions/SKILL.md +0 -19
- moai_adk/templates/.claude/skills/moai-cc-skill-descriptions/examples.md +0 -4
- moai_adk/templates/.claude/skills/moai-cc-skill-descriptions/reference.md +0 -218
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/CHECKLIST.md +0 -482
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/EXAMPLES.md +0 -278
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/INTERACTIVE-DISCOVERY.md +0 -524
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/METADATA.md +0 -477
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/PARALLEL-ANALYSIS-REPORT.md +0 -429
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/PYTHON-VERSION-MATRIX.md +0 -391
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/SKILL-FACTORY-WORKFLOW.md +0 -431
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/SKILL-UPDATE-ADVISOR.md +0 -577
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/SKILL.md +0 -271
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/STEP-BY-STEP-GUIDE.md +0 -466
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/STRUCTURE.md +0 -583
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/WEB-RESEARCH.md +0 -526
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/reference.md +0 -465
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/scripts/generate-structure.sh +0 -328
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/scripts/validate-skill.sh +0 -312
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/SKILL_TEMPLATE.md +0 -245
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/examples-template.md +0 -285
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/reference-template.md +0 -278
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/scripts-template.sh +0 -303
- moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +0 -291
- moai_adk/templates/.claude/skills/moai-cc-skills/templates/SKILL-template.md +0 -15
- moai_adk/templates/.claude/skills/moai-design-systems/SKILL.md +0 -802
- moai_adk/templates/.claude/skills/moai-design-systems/examples.md +0 -1238
- moai_adk/templates/.claude/skills/moai-design-systems/reference.md +0 -673
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +0 -290
- moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +0 -1633
- moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +0 -660
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-data-science/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-data-science/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-database/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-database/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-domain-devops/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-devops/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +0 -128
- moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-ml/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-ml/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-security/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-security/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-domain-web-api/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-domain-web-api/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +0 -303
- moai_adk/templates/.claude/skills/moai-essentials-debug/examples.md +0 -1064
- moai_adk/templates/.claude/skills/moai-essentials-debug/reference.md +0 -1047
- moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-essentials-perf/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-essentials-perf/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-essentials-refactor/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-essentials-refactor/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-essentials-review/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-essentials-review/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +0 -116
- moai_adk/templates/.claude/skills/moai-foundation-ears/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-foundation-ears/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +0 -122
- moai_adk/templates/.claude/skills/moai-foundation-git/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-foundation-git/reference.md +0 -29
- moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-foundation-langs/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-foundation-langs/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-foundation-specs/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-foundation-specs/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-foundation-tags/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-foundation-tags/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +0 -307
- moai_adk/templates/.claude/skills/moai-foundation-trust/examples.md +0 -0
- moai_adk/templates/.claude/skills/moai-foundation-trust/reference.md +0 -1099
- moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-c/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-c/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-cpp/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-cpp/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-csharp/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-csharp/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-dart/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-dart/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +0 -127
- moai_adk/templates/.claude/skills/moai-lang-go/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-go/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +0 -126
- moai_adk/templates/.claude/skills/moai-lang-java/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-java/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +0 -125
- moai_adk/templates/.claude/skills/moai-lang-javascript/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-javascript/reference.md +0 -32
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +0 -126
- moai_adk/templates/.claude/skills/moai-lang-php/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-php/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +0 -433
- moai_adk/templates/.claude/skills/moai-lang-python/examples.md +0 -624
- moai_adk/templates/.claude/skills/moai-lang-python/reference.md +0 -316
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-r/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-r/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-ruby/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-ruby/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +0 -127
- moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +0 -125
- moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-shell/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-shell/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-sql/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-sql/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +0 -133
- moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +0 -34
- moai_adk/templates/.claude/skills/moai-project-documentation.md +0 -622
- moai_adk/templates/.github/workflows/c-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/cpp-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/csharp-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/dart-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/go-tag-validation.yml +0 -130
- moai_adk/templates/.github/workflows/java-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/javascript-tag-validation.yml +0 -135
- moai_adk/templates/.github/workflows/kotlin-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/php-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/python-tag-validation.yml +0 -118
- moai_adk/templates/.github/workflows/release.yml +0 -118
- moai_adk/templates/.github/workflows/ruby-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/rust-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/shell-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/swift-tag-validation.yml +0 -11
- moai_adk/templates/.github/workflows/tag-report.yml +0 -269
- moai_adk/templates/.github/workflows/tag-validation.yml +0 -186
- moai_adk/templates/.github/workflows/typescript-tag-validation.yml +0 -154
- moai_adk/templates/.moai/config.json +0 -115
- moai_adk/templates/workflows/go-tag-validation.yml +0 -30
- moai_adk/templates/workflows/javascript-tag-validation.yml +0 -41
- moai_adk/templates/workflows/python-tag-validation.yml +0 -42
- moai_adk/templates/workflows/typescript-tag-validation.yml +0 -31
- moai_adk-0.15.0.dist-info/METADATA +0 -3079
- moai_adk-0.15.0.dist-info/RECORD +0 -365
- {moai_adk-0.15.0.dist-info â moai_adk-0.25.4.dist-info}/WHEEL +0 -0
- {moai_adk-0.15.0.dist-info â moai_adk-0.25.4.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.15.0.dist-info â moai_adk-0.25.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Language Validator
|
|
3
|
+
|
|
4
|
+
Provides comprehensive language validation capabilities for programming languages.
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any, Dict, List, Optional, Set, Tuple
|
|
10
|
+
|
|
11
|
+
# Language detector functionality removed due to missing dependency
|
|
12
|
+
# Using simplified language detection for now
|
|
13
|
+
def get_all_supported_languages():
|
|
14
|
+
"""Get all supported programming languages."""
|
|
15
|
+
return {"python", "javascript", "typescript", "java", "go", "rust", "cpp", "c"}
|
|
16
|
+
|
|
17
|
+
def get_language_by_file_extension(extension: str) -> Optional[str]:
|
|
18
|
+
"""Get programming language by file extension."""
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
# Handle Path objects and strings
|
|
22
|
+
if hasattr(extension, 'suffix'):
|
|
23
|
+
# Path object
|
|
24
|
+
ext = extension.suffix.lower()
|
|
25
|
+
else:
|
|
26
|
+
# String - extract extension
|
|
27
|
+
ext = str(extension).lower()
|
|
28
|
+
if not ext.startswith('.'):
|
|
29
|
+
# Extract extension from filename
|
|
30
|
+
if '.' in ext:
|
|
31
|
+
ext = '.' + ext.split('.')[-1]
|
|
32
|
+
else:
|
|
33
|
+
ext = ''
|
|
34
|
+
|
|
35
|
+
EXTENSION_MAP = {
|
|
36
|
+
".py": "python",
|
|
37
|
+
".js": "javascript",
|
|
38
|
+
".ts": "typescript",
|
|
39
|
+
".java": "java",
|
|
40
|
+
".go": "go",
|
|
41
|
+
".rs": "rust",
|
|
42
|
+
".cpp": "cpp",
|
|
43
|
+
".c": "c",
|
|
44
|
+
".pyw": "python",
|
|
45
|
+
".pyx": "python",
|
|
46
|
+
}
|
|
47
|
+
return EXTENSION_MAP.get(ext)
|
|
48
|
+
|
|
49
|
+
def is_code_directory(path: str) -> bool:
|
|
50
|
+
"""Check if directory is a code directory."""
|
|
51
|
+
code_dirs = {"src", "lib", "app", "components", "modules", "packages"}
|
|
52
|
+
return any(dir_name in path for dir_name in code_dirs)
|
|
53
|
+
|
|
54
|
+
LANGUAGE_DIRECTORY_MAP = {
|
|
55
|
+
"python": ["src", "tests", "examples"],
|
|
56
|
+
"javascript": ["src", "lib", "packages"],
|
|
57
|
+
"typescript": ["src", "lib", "packages"],
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def get_exclude_patterns():
|
|
61
|
+
"""Get patterns to exclude from language detection."""
|
|
62
|
+
return ["*.pyc", "*.pyo", "__pycache__", ".git", "node_modules", ".venv"]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class LanguageValidator:
|
|
66
|
+
"""
|
|
67
|
+
A comprehensive language validator for programming languages.
|
|
68
|
+
|
|
69
|
+
This class provides language detection, validation, and project structure
|
|
70
|
+
analysis capabilities based on existing language detection infrastructure.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
# Extended file extension mapping for better language detection
|
|
74
|
+
EXTENSION_MAP = {
|
|
75
|
+
"python": [".py", ".pyw", ".pyx", ".pxd"],
|
|
76
|
+
"javascript": [".js", ".jsx", ".mjs"],
|
|
77
|
+
"typescript": [".ts", ".tsx", ".cts", ".mts"],
|
|
78
|
+
"go": [".go"],
|
|
79
|
+
"rust": [".rs"],
|
|
80
|
+
"kotlin": [".kt", ".kts"],
|
|
81
|
+
"ruby": [".rb"],
|
|
82
|
+
"php": [".php", ".php3", ".php4", ".php5", ".phtml"],
|
|
83
|
+
"java": [".java"],
|
|
84
|
+
"csharp": [".cs"],
|
|
85
|
+
"cpp": [".cpp", ".cxx", ".cc", ".c++", ".h", ".hpp"],
|
|
86
|
+
"c": [".c", ".h"],
|
|
87
|
+
"swift": [".swift"],
|
|
88
|
+
"dart": [".dart"],
|
|
89
|
+
"scala": [".scala"],
|
|
90
|
+
"clojure": [".clj", ".cljs", ".cljc"],
|
|
91
|
+
"haskell": [".hs", ".lhs"],
|
|
92
|
+
"lua": [".lua"],
|
|
93
|
+
"ocaml": [".ml", ".mli", ".mll", ".mly"],
|
|
94
|
+
"elixir": [".ex", ".exs"],
|
|
95
|
+
"bash": [".sh", ".bash"],
|
|
96
|
+
"powershell": [".ps1", ".psm1", ".psd1"],
|
|
97
|
+
"sql": [".sql"],
|
|
98
|
+
"html": [".html", ".htm"],
|
|
99
|
+
"css": [".css", ".scss", ".sass"],
|
|
100
|
+
"json": [".json", ".json5"],
|
|
101
|
+
"yaml": [".yaml", ".yml"],
|
|
102
|
+
"toml": [".toml"],
|
|
103
|
+
"xml": [".xml", ".xsl", ".xslt"],
|
|
104
|
+
"markdown": [".md", ".markdown"],
|
|
105
|
+
"dockerfile": ["dockerfile", "dockerfile.", "dockerfile.*"],
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
def __init__(
|
|
109
|
+
self,
|
|
110
|
+
supported_languages: Optional[List[str]] = None,
|
|
111
|
+
auto_validate: bool = True,
|
|
112
|
+
):
|
|
113
|
+
"""
|
|
114
|
+
Initialize the language validator.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
supported_languages: List of supported language codes.
|
|
118
|
+
If None, uses all available languages.
|
|
119
|
+
auto_validate: Whether to automatically validate inputs and perform cleanup
|
|
120
|
+
"""
|
|
121
|
+
self.auto_validate = auto_validate
|
|
122
|
+
|
|
123
|
+
if supported_languages is None:
|
|
124
|
+
# Use all languages from the existing language detection system
|
|
125
|
+
self.supported_languages = set(get_all_supported_languages())
|
|
126
|
+
else:
|
|
127
|
+
self.supported_languages = set(lang.lower() for lang in supported_languages)
|
|
128
|
+
|
|
129
|
+
# Compile regex patterns for efficient matching
|
|
130
|
+
self._directory_patterns = {}
|
|
131
|
+
self._exclude_patterns_cache = {}
|
|
132
|
+
|
|
133
|
+
# Initialize analysis cache for statistics tracking
|
|
134
|
+
self._analysis_cache = {
|
|
135
|
+
"last_analysis_files": 0,
|
|
136
|
+
"detected_extensions": [],
|
|
137
|
+
"supported_languages_found": 0,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
def _validate_and_normalize_input(
|
|
141
|
+
self, value: Any, input_type: str
|
|
142
|
+
) -> Optional[Any]:
|
|
143
|
+
"""
|
|
144
|
+
Validate and normalize input values.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
value: Input value to validate
|
|
148
|
+
input_type: Type of input ('language', 'file_path', 'list', etc.)
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Normalized value or None if validation fails
|
|
152
|
+
"""
|
|
153
|
+
if not value and input_type != "language": # Empty language is valid sometimes
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
if input_type == "language":
|
|
157
|
+
if not isinstance(value, str):
|
|
158
|
+
return None
|
|
159
|
+
return value.strip().lower() if value else None
|
|
160
|
+
|
|
161
|
+
elif input_type == "file_path":
|
|
162
|
+
if isinstance(value, str):
|
|
163
|
+
return Path(value).resolve()
|
|
164
|
+
elif isinstance(value, Path):
|
|
165
|
+
return value.resolve()
|
|
166
|
+
else:
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
elif input_type == "list":
|
|
170
|
+
if not isinstance(value, list):
|
|
171
|
+
return None
|
|
172
|
+
return value
|
|
173
|
+
|
|
174
|
+
return None
|
|
175
|
+
|
|
176
|
+
def validate_language(self, language: str) -> bool:
|
|
177
|
+
"""
|
|
178
|
+
Validate if a language is supported.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
language: Language code to validate.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
True if language is supported, False otherwise.
|
|
185
|
+
"""
|
|
186
|
+
if self.auto_validate:
|
|
187
|
+
normalized_lang = self._validate_and_normalize_input(language, "language")
|
|
188
|
+
if normalized_lang is None:
|
|
189
|
+
return False
|
|
190
|
+
else:
|
|
191
|
+
normalized_lang = self.normalize_language_code(language)
|
|
192
|
+
|
|
193
|
+
return normalized_lang in self.supported_languages
|
|
194
|
+
|
|
195
|
+
def detect_language_from_extension(self, file_path: Any) -> Optional[str]:
|
|
196
|
+
"""
|
|
197
|
+
Detect language from file extension using enhanced mapping.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
file_path: File path as string or Path object.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
Detected language code or None if not recognized.
|
|
204
|
+
"""
|
|
205
|
+
if self.auto_validate:
|
|
206
|
+
path_obj = self._validate_and_normalize_input(file_path, "file_path")
|
|
207
|
+
if path_obj is None:
|
|
208
|
+
return None
|
|
209
|
+
else:
|
|
210
|
+
if isinstance(file_path, str):
|
|
211
|
+
path_obj = Path(file_path)
|
|
212
|
+
elif isinstance(file_path, Path):
|
|
213
|
+
path_obj = file_path
|
|
214
|
+
else:
|
|
215
|
+
return None
|
|
216
|
+
|
|
217
|
+
# First try the enhanced mapping
|
|
218
|
+
extension = path_obj.suffix.lower()
|
|
219
|
+
for lang, extensions in self.EXTENSION_MAP.items():
|
|
220
|
+
if extension in extensions:
|
|
221
|
+
return lang
|
|
222
|
+
|
|
223
|
+
# Fall back to existing system for backwards compatibility
|
|
224
|
+
return get_language_by_file_extension(path_obj)
|
|
225
|
+
|
|
226
|
+
def get_expected_directories(self, language: str) -> List[str]:
|
|
227
|
+
"""
|
|
228
|
+
Get expected directory patterns for a language.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
language: Language code.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
List of expected directory patterns.
|
|
235
|
+
"""
|
|
236
|
+
if self.auto_validate:
|
|
237
|
+
normalized_lang = self._validate_and_normalize_input(language, "language")
|
|
238
|
+
if normalized_lang is None:
|
|
239
|
+
return []
|
|
240
|
+
else:
|
|
241
|
+
normalized_lang = self.normalize_language_code(language)
|
|
242
|
+
|
|
243
|
+
if normalized_lang in LANGUAGE_DIRECTORY_MAP:
|
|
244
|
+
dirs = LANGUAGE_DIRECTORY_MAP[normalized_lang].copy()
|
|
245
|
+
# Add trailing slash for consistency with test expectations
|
|
246
|
+
return [f"{dir}/" if not dir.endswith('/') else dir for dir in dirs]
|
|
247
|
+
|
|
248
|
+
# Return default Python directories as fallback with trailing slashes
|
|
249
|
+
default_dirs = LANGUAGE_DIRECTORY_MAP.get("python", [])
|
|
250
|
+
return [f"{dir}/" if not dir.endswith('/') else dir for dir in default_dirs]
|
|
251
|
+
|
|
252
|
+
def get_file_extensions(self, language: str) -> List[str]:
|
|
253
|
+
"""
|
|
254
|
+
Get file extensions for a language.
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
language: Language code.
|
|
258
|
+
|
|
259
|
+
Returns:
|
|
260
|
+
List of file extensions (including dot).
|
|
261
|
+
"""
|
|
262
|
+
if self.auto_validate:
|
|
263
|
+
normalized_lang = self._validate_and_normalize_input(language, "language")
|
|
264
|
+
if normalized_lang is None:
|
|
265
|
+
return []
|
|
266
|
+
else:
|
|
267
|
+
normalized_lang = self.normalize_language_code(language)
|
|
268
|
+
|
|
269
|
+
return self.EXTENSION_MAP.get(normalized_lang, [])
|
|
270
|
+
|
|
271
|
+
def get_all_supported_extensions(self) -> Set[str]:
|
|
272
|
+
"""
|
|
273
|
+
Get all supported file extensions.
|
|
274
|
+
|
|
275
|
+
Returns:
|
|
276
|
+
Set of all supported file extensions.
|
|
277
|
+
"""
|
|
278
|
+
all_extensions = set()
|
|
279
|
+
for extensions in self.EXTENSION_MAP.values():
|
|
280
|
+
all_extensions.update(extensions)
|
|
281
|
+
return all_extensions
|
|
282
|
+
|
|
283
|
+
def detect_language_from_filename(self, file_name: str) -> Optional[str]:
|
|
284
|
+
"""
|
|
285
|
+
Detect language from filename (including special cases like Dockerfile).
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
file_name: Filename or full path.
|
|
289
|
+
|
|
290
|
+
Returns:
|
|
291
|
+
Detected language code or None if not recognized.
|
|
292
|
+
"""
|
|
293
|
+
if self.auto_validate:
|
|
294
|
+
normalized_name = self._validate_and_normalize_input(file_name, "file_path")
|
|
295
|
+
if normalized_name is None:
|
|
296
|
+
return None
|
|
297
|
+
else:
|
|
298
|
+
if not file_name or not isinstance(file_name, str):
|
|
299
|
+
return None
|
|
300
|
+
normalized_name = Path(file_name)
|
|
301
|
+
|
|
302
|
+
# Extract filename from path if needed
|
|
303
|
+
filename = normalized_name.name.lower()
|
|
304
|
+
|
|
305
|
+
# Check for special filenames
|
|
306
|
+
if filename in ["dockerfile", "dockerfile.dev", "dockerfile.prod"]:
|
|
307
|
+
return "dockerfile"
|
|
308
|
+
|
|
309
|
+
# Check for common build/config files
|
|
310
|
+
config_patterns = {
|
|
311
|
+
"makefile": "bash",
|
|
312
|
+
"cmakelists.txt": "cpp",
|
|
313
|
+
"pom.xml": "java",
|
|
314
|
+
"build.gradle": "kotlin",
|
|
315
|
+
"package.json": "javascript",
|
|
316
|
+
"pyproject.toml": "python",
|
|
317
|
+
"cargo.toml": "rust",
|
|
318
|
+
"go.mod": "go",
|
|
319
|
+
"requirements.txt": "python",
|
|
320
|
+
"gemfile": "ruby",
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if filename in config_patterns:
|
|
324
|
+
return config_patterns[filename]
|
|
325
|
+
|
|
326
|
+
# Extract extension and try normal detection
|
|
327
|
+
extension = Path(filename).suffix.lower()
|
|
328
|
+
return self.detect_language_from_extension(filename)
|
|
329
|
+
|
|
330
|
+
def validate_file_extension(self, file_path: Any, language: str) -> bool:
|
|
331
|
+
"""
|
|
332
|
+
Validate if a file has the correct extension for a language.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
file_path: File path to validate.
|
|
336
|
+
language: Expected language code.
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
True if file extension matches language, False otherwise.
|
|
340
|
+
"""
|
|
341
|
+
if language is None:
|
|
342
|
+
# Any file is valid when no specific language is required
|
|
343
|
+
return True
|
|
344
|
+
|
|
345
|
+
if self.auto_validate:
|
|
346
|
+
normalized_lang = self._validate_and_normalize_input(language, "language")
|
|
347
|
+
if normalized_lang is None:
|
|
348
|
+
return False
|
|
349
|
+
else:
|
|
350
|
+
normalized_lang = self.normalize_language_code(language)
|
|
351
|
+
|
|
352
|
+
detected_lang = self.detect_language_from_extension(file_path)
|
|
353
|
+
return detected_lang == normalized_lang
|
|
354
|
+
|
|
355
|
+
def get_supported_languages(self) -> List[str]:
|
|
356
|
+
"""
|
|
357
|
+
Get list of supported languages.
|
|
358
|
+
|
|
359
|
+
Returns:
|
|
360
|
+
Sorted list of supported language codes.
|
|
361
|
+
"""
|
|
362
|
+
return sorted(self.supported_languages)
|
|
363
|
+
|
|
364
|
+
def normalize_language_code(self, language: str) -> str:
|
|
365
|
+
"""
|
|
366
|
+
Normalize language code to lowercase with stripped whitespace.
|
|
367
|
+
|
|
368
|
+
Args:
|
|
369
|
+
language: Raw language code.
|
|
370
|
+
|
|
371
|
+
Returns:
|
|
372
|
+
Normalized language code.
|
|
373
|
+
"""
|
|
374
|
+
if not language or not isinstance(language, str):
|
|
375
|
+
return ""
|
|
376
|
+
|
|
377
|
+
return language.strip().lower()
|
|
378
|
+
|
|
379
|
+
def validate_project_configuration(
|
|
380
|
+
self, config: Dict[str, Any]
|
|
381
|
+
) -> Tuple[bool, List[str]]:
|
|
382
|
+
"""
|
|
383
|
+
Validate project configuration for language support.
|
|
384
|
+
|
|
385
|
+
Args:
|
|
386
|
+
config: Project configuration dictionary.
|
|
387
|
+
|
|
388
|
+
Returns:
|
|
389
|
+
Tuple of (is_valid, issues) where is_valid is boolean and issues is list of strings.
|
|
390
|
+
"""
|
|
391
|
+
if self.auto_validate:
|
|
392
|
+
validated_config = self._validate_and_normalize_input(config, "dict")
|
|
393
|
+
if validated_config is None:
|
|
394
|
+
return False, ["Invalid configuration format"]
|
|
395
|
+
|
|
396
|
+
issues = []
|
|
397
|
+
|
|
398
|
+
# Check if project section exists
|
|
399
|
+
if "project" not in config:
|
|
400
|
+
issues.append("Missing 'project' section in configuration")
|
|
401
|
+
return False, issues
|
|
402
|
+
|
|
403
|
+
project_config = config["project"]
|
|
404
|
+
|
|
405
|
+
# Check if language is specified
|
|
406
|
+
if "language" not in project_config:
|
|
407
|
+
issues.append("Missing 'language' field in project configuration")
|
|
408
|
+
return False, issues
|
|
409
|
+
|
|
410
|
+
project_language = project_config["language"]
|
|
411
|
+
|
|
412
|
+
# Validate the language
|
|
413
|
+
if not self.validate_language(project_language):
|
|
414
|
+
issues.append(f"Unsupported language: {project_language}")
|
|
415
|
+
return False, issues
|
|
416
|
+
|
|
417
|
+
# Check if name is specified
|
|
418
|
+
if "name" not in project_config:
|
|
419
|
+
issues.append("Missing 'name' field in project configuration")
|
|
420
|
+
return False, issues
|
|
421
|
+
|
|
422
|
+
# Check if name is valid (not empty)
|
|
423
|
+
if not project_config["name"] or not isinstance(project_config["name"], str):
|
|
424
|
+
issues.append("Project name must be a non-empty string")
|
|
425
|
+
return False, issues
|
|
426
|
+
|
|
427
|
+
# Additional validation for empty strings and whitespace-only names
|
|
428
|
+
if (
|
|
429
|
+
isinstance(project_config["name"], str)
|
|
430
|
+
and not project_config["name"].strip()
|
|
431
|
+
):
|
|
432
|
+
issues.append("Project name cannot be empty or contain only whitespace")
|
|
433
|
+
return False, issues
|
|
434
|
+
|
|
435
|
+
return True, issues
|
|
436
|
+
|
|
437
|
+
def validate_project_structure(
|
|
438
|
+
self, project_files: Dict[str, bool], language: str
|
|
439
|
+
) -> Tuple[bool, List[str]]:
|
|
440
|
+
"""
|
|
441
|
+
Validate project structure for a specific language.
|
|
442
|
+
|
|
443
|
+
Args:
|
|
444
|
+
project_files: Dictionary mapping file paths to boolean (is_source_file).
|
|
445
|
+
language: Project language to validate against.
|
|
446
|
+
|
|
447
|
+
Returns:
|
|
448
|
+
Tuple of (is_valid, issues) where is_valid is boolean and issues is list of strings.
|
|
449
|
+
"""
|
|
450
|
+
if self.auto_validate:
|
|
451
|
+
validated_project_files = self._validate_and_normalize_input(
|
|
452
|
+
project_files, "dict"
|
|
453
|
+
)
|
|
454
|
+
validated_language = self._validate_and_normalize_input(
|
|
455
|
+
language, "language"
|
|
456
|
+
)
|
|
457
|
+
if validated_project_files is None or validated_language is None:
|
|
458
|
+
return False, ["Invalid input format for project structure validation"]
|
|
459
|
+
|
|
460
|
+
issues = []
|
|
461
|
+
expected_dirs = self.get_expected_directories(language)
|
|
462
|
+
|
|
463
|
+
# Group files by directory
|
|
464
|
+
files_by_dir = {}
|
|
465
|
+
for file_path, is_source in project_files.items():
|
|
466
|
+
if is_source: # Only validate source files
|
|
467
|
+
dir_path = str(Path(file_path).parent) + "/"
|
|
468
|
+
if dir_path not in files_by_dir:
|
|
469
|
+
files_by_dir[dir_path] = []
|
|
470
|
+
files_by_dir[dir_path].append(file_path)
|
|
471
|
+
|
|
472
|
+
# Check if expected directories exist and have files
|
|
473
|
+
for expected_dir in expected_dirs:
|
|
474
|
+
found_files_in_dir = False
|
|
475
|
+
for actual_dir in files_by_dir:
|
|
476
|
+
if actual_dir.startswith(expected_dir):
|
|
477
|
+
found_files_in_dir = True
|
|
478
|
+
break
|
|
479
|
+
|
|
480
|
+
if not found_files_in_dir and expected_dir != "{package_name}/":
|
|
481
|
+
issues.append(
|
|
482
|
+
f"No source files found in expected directory: {expected_dir}"
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
# Check for files in unexpected directories
|
|
486
|
+
config = {} # Using empty config for default exclude patterns
|
|
487
|
+
exclude_patterns = get_exclude_patterns(config)
|
|
488
|
+
|
|
489
|
+
for file_path, is_source in project_files.items():
|
|
490
|
+
if is_source:
|
|
491
|
+
path_obj = Path(file_path)
|
|
492
|
+
if not is_code_directory(path_obj, config, language):
|
|
493
|
+
issues.append(f"Source file in unexpected location: {file_path}")
|
|
494
|
+
|
|
495
|
+
return len(issues) == 0, issues
|
|
496
|
+
|
|
497
|
+
def get_language_statistics(self, files: List[Any]) -> Dict[str, int]:
|
|
498
|
+
"""
|
|
499
|
+
Get language statistics from a list of files.
|
|
500
|
+
|
|
501
|
+
Args:
|
|
502
|
+
files: List of file paths.
|
|
503
|
+
|
|
504
|
+
Returns:
|
|
505
|
+
Dictionary mapping language codes to file counts.
|
|
506
|
+
"""
|
|
507
|
+
if self.auto_validate:
|
|
508
|
+
validated_files = self._validate_and_normalize_input(files, "list")
|
|
509
|
+
if validated_files is None:
|
|
510
|
+
return {}
|
|
511
|
+
else:
|
|
512
|
+
validated_files = files
|
|
513
|
+
|
|
514
|
+
stats = {}
|
|
515
|
+
total_files = 0
|
|
516
|
+
detected_extensions = set()
|
|
517
|
+
|
|
518
|
+
for file_path in validated_files:
|
|
519
|
+
if file_path: # Ensure file path is not None
|
|
520
|
+
detected_lang = self.detect_language_from_extension(file_path)
|
|
521
|
+
if detected_lang:
|
|
522
|
+
stats[detected_lang] = stats.get(detected_lang, 0) + 1
|
|
523
|
+
total_files += 1
|
|
524
|
+
|
|
525
|
+
# Track detected extensions for analysis
|
|
526
|
+
if hasattr(file_path, "suffix"):
|
|
527
|
+
detected_extensions.add(file_path.suffix.lower())
|
|
528
|
+
elif isinstance(file_path, str):
|
|
529
|
+
detected_extensions.add(Path(file_path).suffix.lower())
|
|
530
|
+
|
|
531
|
+
# Add analysis information
|
|
532
|
+
if hasattr(self, "_analysis_cache"):
|
|
533
|
+
self._analysis_cache["last_analysis_files"] = total_files
|
|
534
|
+
self._analysis_cache["detected_extensions"] = list(detected_extensions)
|
|
535
|
+
self._analysis_cache["supported_languages_found"] = len(stats)
|
|
536
|
+
|
|
537
|
+
return stats
|
|
538
|
+
|
|
539
|
+
def get_analysis_cache(self) -> Dict[str, Any]:
|
|
540
|
+
"""
|
|
541
|
+
Get the analysis cache with language detection statistics.
|
|
542
|
+
|
|
543
|
+
Returns:
|
|
544
|
+
Dictionary containing analysis statistics.
|
|
545
|
+
"""
|
|
546
|
+
return self._analysis_cache.copy()
|
|
547
|
+
|
|
548
|
+
def clear_analysis_cache(self) -> None:
|
|
549
|
+
"""
|
|
550
|
+
Clear the analysis cache.
|
|
551
|
+
"""
|
|
552
|
+
self._analysis_cache = {
|
|
553
|
+
"last_analysis_files": 0,
|
|
554
|
+
"detected_extensions": [],
|
|
555
|
+
"supported_languages_found": 0,
|
|
556
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# MCP Setup - Cross-platform npx execution with Windows support
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import platform
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
|
|
9
|
+
console = Console()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MCPSetupManager:
|
|
13
|
+
"""Cross-platform MCP Setup Manager with Windows npx support"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, project_path: Path):
|
|
16
|
+
self.project_path = project_path
|
|
17
|
+
self.is_windows = platform.system().lower() == "windows"
|
|
18
|
+
|
|
19
|
+
def _adapt_command_for_platform(self, command: str) -> str:
|
|
20
|
+
"""Adapt command for Windows compatibility.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
command: Original command (e.g., "npx")
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Platform-adapted command (e.g., "cmd /c npx" on Windows)
|
|
27
|
+
"""
|
|
28
|
+
if self.is_windows and command == "npx":
|
|
29
|
+
return "cmd /c npx"
|
|
30
|
+
return command
|
|
31
|
+
|
|
32
|
+
def _adapt_mcp_config_for_platform(self, mcp_config: dict) -> dict:
|
|
33
|
+
"""Adapt MCP server commands for the current platform.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
mcp_config: Original MCP configuration
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Platform-adapted MCP configuration
|
|
40
|
+
"""
|
|
41
|
+
adapted_config = mcp_config.copy()
|
|
42
|
+
|
|
43
|
+
if "mcpServers" in adapted_config:
|
|
44
|
+
for server_name, server_config in adapted_config["mcpServers"].items():
|
|
45
|
+
if "command" in server_config:
|
|
46
|
+
original_command = server_config["command"]
|
|
47
|
+
adapted_command = self._adapt_command_for_platform(original_command)
|
|
48
|
+
|
|
49
|
+
if adapted_command != original_command:
|
|
50
|
+
# Need to split command and args for Windows
|
|
51
|
+
if self.is_windows and original_command == "npx":
|
|
52
|
+
# Convert "command": "npx", "args": ["-y", "pkg"]
|
|
53
|
+
# to "command": "cmd", "args": ["/c", "npx", "-y", "pkg"]
|
|
54
|
+
server_config["command"] = "cmd"
|
|
55
|
+
server_config["args"] = ["/c", "npx"] + server_config.get(
|
|
56
|
+
"args", []
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
server_config["command"] = adapted_command
|
|
60
|
+
|
|
61
|
+
return adapted_config
|
|
62
|
+
|
|
63
|
+
def copy_template_mcp_config(self) -> bool:
|
|
64
|
+
"""Copy MCP configuration from package template with platform adaptation"""
|
|
65
|
+
try:
|
|
66
|
+
# Get the package template path
|
|
67
|
+
import moai_adk
|
|
68
|
+
|
|
69
|
+
package_path = Path(moai_adk.__file__).parent
|
|
70
|
+
template_mcp_path = package_path / "templates" / ".mcp.json"
|
|
71
|
+
|
|
72
|
+
if template_mcp_path.exists():
|
|
73
|
+
# Copy template to project
|
|
74
|
+
project_mcp_path = self.project_path / ".mcp.json"
|
|
75
|
+
|
|
76
|
+
# Read template
|
|
77
|
+
with open(template_mcp_path, "r") as f:
|
|
78
|
+
mcp_config = json.load(f)
|
|
79
|
+
|
|
80
|
+
# Adapt for platform
|
|
81
|
+
adapted_config = self._adapt_mcp_config_for_platform(mcp_config)
|
|
82
|
+
|
|
83
|
+
# Write adapted config to project
|
|
84
|
+
with open(project_mcp_path, "w") as f:
|
|
85
|
+
json.dump(adapted_config, f, indent=2)
|
|
86
|
+
|
|
87
|
+
server_names = list(adapted_config.get("mcpServers", {}).keys())
|
|
88
|
+
console.print("â
MCP configuration copied and adapted for platform")
|
|
89
|
+
|
|
90
|
+
# Show platform info
|
|
91
|
+
if self.is_windows:
|
|
92
|
+
console.print(
|
|
93
|
+
"đĒ Windows platform detected - npx commands wrapped with 'cmd /c'"
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
console.print(f"đ Configured servers: {', '.join(server_names)}")
|
|
97
|
+
return True
|
|
98
|
+
else:
|
|
99
|
+
console.print("â Template MCP configuration not found")
|
|
100
|
+
return False
|
|
101
|
+
|
|
102
|
+
except Exception as e:
|
|
103
|
+
console.print(f"â Failed to copy MCP configuration: {e}")
|
|
104
|
+
return False
|
|
105
|
+
|
|
106
|
+
def setup_mcp_servers(self, selected_servers: list[str]) -> bool:
|
|
107
|
+
"""Complete MCP server setup process with platform adaptation"""
|
|
108
|
+
if not selected_servers:
|
|
109
|
+
console.print("âšī¸ No MCP servers selected")
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
console.print("đ§ Setting up MCP servers...")
|
|
113
|
+
return self.copy_template_mcp_config()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Migration module for MoAI-ADK version upgrades
|
|
3
|
+
|
|
4
|
+
Handles automatic migration of configuration files and project structure
|
|
5
|
+
when upgrading between versions.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .backup_manager import BackupManager
|
|
9
|
+
from .file_migrator import FileMigrator
|
|
10
|
+
from .version_detector import VersionDetector
|
|
11
|
+
from .version_migrator import VersionMigrator
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"VersionMigrator",
|
|
15
|
+
"VersionDetector",
|
|
16
|
+
"BackupManager",
|
|
17
|
+
"FileMigrator",
|
|
18
|
+
]
|