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
moai_adk/cli/commands/update.py
CHANGED
|
@@ -13,6 +13,7 @@ Includes:
|
|
|
13
13
|
- 70-80% performance improvement for up-to-date projects
|
|
14
14
|
|
|
15
15
|
## Skill Invocation Guide (English-Only)
|
|
16
|
+
# mypy: disable-error-code=return-value
|
|
16
17
|
|
|
17
18
|
### Related Skills
|
|
18
19
|
- **moai-foundation-trust**: For post-update validation
|
|
@@ -25,19 +26,20 @@ Includes:
|
|
|
25
26
|
|
|
26
27
|
### When to Invoke Skills in Related Workflows
|
|
27
28
|
1. **After successful update**:
|
|
28
|
-
- Run `Skill("moai-foundation-trust")` to validate all TRUST
|
|
29
|
+
- Run `Skill("moai-foundation-trust")` to validate all TRUST 4 gates
|
|
29
30
|
- Run `Skill("moai-foundation-langs")` to confirm language toolchain still works
|
|
30
31
|
- Run project doctor command for full system validation
|
|
31
32
|
|
|
32
33
|
2. **Before updating**:
|
|
33
34
|
- Create backup with `python -m moai_adk backup`
|
|
34
|
-
- Run `Skill("moai-foundation-tags")` to document current TAG state
|
|
35
35
|
|
|
36
36
|
3. **If update fails**:
|
|
37
37
|
- Use backup to restore previous state
|
|
38
38
|
- Debug with `python -m moai_adk doctor --verbose`
|
|
39
39
|
"""
|
|
40
40
|
|
|
41
|
+
# type: ignore
|
|
42
|
+
|
|
41
43
|
from __future__ import annotations
|
|
42
44
|
|
|
43
45
|
import json
|
|
@@ -52,6 +54,7 @@ from packaging import version
|
|
|
52
54
|
from rich.console import Console
|
|
53
55
|
|
|
54
56
|
from moai_adk import __version__
|
|
57
|
+
from moai_adk.core.migration import VersionMigrator
|
|
55
58
|
from moai_adk.core.template.processor import TemplateProcessor
|
|
56
59
|
|
|
57
60
|
console = Console()
|
|
@@ -64,7 +67,6 @@ PIPX_COMMAND = ["pipx", "upgrade", "moai-adk"]
|
|
|
64
67
|
PIP_COMMAND = ["pip", "install", "--upgrade", "moai-adk"]
|
|
65
68
|
|
|
66
69
|
|
|
67
|
-
# @CODE:UPDATE-REFACTOR-002-004
|
|
68
70
|
# Custom exceptions for better error handling
|
|
69
71
|
class UpdateError(Exception):
|
|
70
72
|
"""Base exception for update operations."""
|
|
@@ -104,7 +106,11 @@ def _is_installed_via_uv_tool() -> bool:
|
|
|
104
106
|
"""
|
|
105
107
|
try:
|
|
106
108
|
result = subprocess.run(
|
|
107
|
-
["uv", "tool", "list"],
|
|
109
|
+
["uv", "tool", "list"],
|
|
110
|
+
capture_output=True,
|
|
111
|
+
text=True,
|
|
112
|
+
timeout=TOOL_DETECTION_TIMEOUT,
|
|
113
|
+
check=False,
|
|
108
114
|
)
|
|
109
115
|
return result.returncode == 0 and "moai-adk" in result.stdout
|
|
110
116
|
except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
|
|
@@ -119,7 +125,11 @@ def _is_installed_via_pipx() -> bool:
|
|
|
119
125
|
"""
|
|
120
126
|
try:
|
|
121
127
|
result = subprocess.run(
|
|
122
|
-
["pipx", "list"],
|
|
128
|
+
["pipx", "list"],
|
|
129
|
+
capture_output=True,
|
|
130
|
+
text=True,
|
|
131
|
+
timeout=TOOL_DETECTION_TIMEOUT,
|
|
132
|
+
check=False,
|
|
123
133
|
)
|
|
124
134
|
return result.returncode == 0 and "moai-adk" in result.stdout
|
|
125
135
|
except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
|
|
@@ -134,14 +144,17 @@ def _is_installed_via_pip() -> bool:
|
|
|
134
144
|
"""
|
|
135
145
|
try:
|
|
136
146
|
result = subprocess.run(
|
|
137
|
-
["pip", "show", "moai-adk"],
|
|
147
|
+
["pip", "show", "moai-adk"],
|
|
148
|
+
capture_output=True,
|
|
149
|
+
text=True,
|
|
150
|
+
timeout=TOOL_DETECTION_TIMEOUT,
|
|
151
|
+
check=False,
|
|
138
152
|
)
|
|
139
153
|
return result.returncode == 0
|
|
140
154
|
except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
|
|
141
155
|
return False
|
|
142
156
|
|
|
143
157
|
|
|
144
|
-
# @CODE:UPDATE-REFACTOR-002-001
|
|
145
158
|
def _detect_tool_installer() -> list[str] | None:
|
|
146
159
|
"""Detect which tool installed moai-adk.
|
|
147
160
|
|
|
@@ -181,7 +194,6 @@ def _detect_tool_installer() -> list[str] | None:
|
|
|
181
194
|
return None
|
|
182
195
|
|
|
183
196
|
|
|
184
|
-
# @CODE:UPDATE-REFACTOR-002-002
|
|
185
197
|
def _get_current_version() -> str:
|
|
186
198
|
"""Get currently installed moai-adk version.
|
|
187
199
|
|
|
@@ -208,7 +220,9 @@ def _get_latest_version() -> str:
|
|
|
208
220
|
import urllib.request
|
|
209
221
|
|
|
210
222
|
url = "https://pypi.org/pypi/moai-adk/json"
|
|
211
|
-
with urllib.request.urlopen(
|
|
223
|
+
with urllib.request.urlopen(
|
|
224
|
+
url, timeout=5
|
|
225
|
+
) as response: # nosec B310 - URL is hardcoded HTTPS to PyPI API, no user input
|
|
212
226
|
data = json.loads(response.read().decode("utf-8"))
|
|
213
227
|
return cast(str, data["info"]["version"])
|
|
214
228
|
except (urllib.error.URLError, json.JSONDecodeError, KeyError, TimeoutError) as e:
|
|
@@ -238,7 +252,6 @@ def _compare_versions(current: str, latest: str) -> int:
|
|
|
238
252
|
return 1
|
|
239
253
|
|
|
240
254
|
|
|
241
|
-
# @CODE:UPDATE-REFACTOR-002-006
|
|
242
255
|
def _get_package_config_version() -> str:
|
|
243
256
|
"""Get the current package template version.
|
|
244
257
|
|
|
@@ -253,11 +266,10 @@ def _get_package_config_version() -> str:
|
|
|
253
266
|
return __version__
|
|
254
267
|
|
|
255
268
|
|
|
256
|
-
# @CODE:UPDATE-REFACTOR-002-007
|
|
257
269
|
def _get_project_config_version(project_path: Path) -> str:
|
|
258
270
|
"""Get current project config.json template version.
|
|
259
271
|
|
|
260
|
-
This reads the project's .moai/config.json to determine the current
|
|
272
|
+
This reads the project's .moai/config/config.json to determine the current
|
|
261
273
|
template version that the project is configured with.
|
|
262
274
|
|
|
263
275
|
Args:
|
|
@@ -273,9 +285,11 @@ def _get_project_config_version(project_path: Path) -> str:
|
|
|
273
285
|
|
|
274
286
|
def _is_placeholder(value: str) -> bool:
|
|
275
287
|
"""Check if value contains unsubstituted template placeholders."""
|
|
276
|
-
return
|
|
288
|
+
return (
|
|
289
|
+
isinstance(value, str) and value.startswith("{{") and value.endswith("}}")
|
|
290
|
+
)
|
|
277
291
|
|
|
278
|
-
config_path = project_path / ".moai" / "config.json"
|
|
292
|
+
config_path = project_path / ".moai" / "config" / "config.json"
|
|
279
293
|
|
|
280
294
|
if not config_path.exists():
|
|
281
295
|
# No config yet, treat as version 0.0.0 (needs initial sync)
|
|
@@ -299,8 +313,9 @@ def _get_project_config_version(project_path: Path) -> str:
|
|
|
299
313
|
raise ValueError(f"Failed to parse project config.json: {e}") from e
|
|
300
314
|
|
|
301
315
|
|
|
302
|
-
|
|
303
|
-
|
|
316
|
+
def _detect_stale_cache(
|
|
317
|
+
upgrade_output: str, current_version: str, latest_version: str
|
|
318
|
+
) -> bool:
|
|
304
319
|
"""
|
|
305
320
|
Detect if uv cache is stale by comparing versions.
|
|
306
321
|
|
|
@@ -345,7 +360,6 @@ def _detect_stale_cache(upgrade_output: str, current_version: str, latest_versio
|
|
|
345
360
|
return False
|
|
346
361
|
|
|
347
362
|
|
|
348
|
-
# @CODE:UPDATE-CACHE-FIX-001-002-CLEAR-SUCCESS
|
|
349
363
|
def _clear_uv_package_cache(package_name: str = "moai-adk") -> bool:
|
|
350
364
|
"""
|
|
351
365
|
Clear uv cache for specific package.
|
|
@@ -396,8 +410,9 @@ def _clear_uv_package_cache(package_name: str = "moai-adk") -> bool:
|
|
|
396
410
|
return False
|
|
397
411
|
|
|
398
412
|
|
|
399
|
-
|
|
400
|
-
|
|
413
|
+
def _execute_upgrade_with_retry(
|
|
414
|
+
installer_cmd: list[str], package_name: str = "moai-adk"
|
|
415
|
+
) -> bool:
|
|
401
416
|
"""
|
|
402
417
|
Execute upgrade with automatic cache retry on stale detection.
|
|
403
418
|
|
|
@@ -444,7 +459,9 @@ def _execute_upgrade_with_retry(installer_cmd: list[str], package_name: str = "m
|
|
|
444
459
|
"""
|
|
445
460
|
# Stage 1: First upgrade attempt
|
|
446
461
|
try:
|
|
447
|
-
result = subprocess.run(
|
|
462
|
+
result = subprocess.run(
|
|
463
|
+
installer_cmd, capture_output=True, text=True, timeout=60, check=False
|
|
464
|
+
)
|
|
448
465
|
except subprocess.TimeoutExpired:
|
|
449
466
|
raise # Re-raise timeout for caller to handle
|
|
450
467
|
except Exception:
|
|
@@ -472,7 +489,13 @@ def _execute_upgrade_with_retry(installer_cmd: list[str], package_name: str = "m
|
|
|
472
489
|
|
|
473
490
|
# Stage 6: Retry upgrade
|
|
474
491
|
try:
|
|
475
|
-
result = subprocess.run(
|
|
492
|
+
result = subprocess.run(
|
|
493
|
+
installer_cmd,
|
|
494
|
+
capture_output=True,
|
|
495
|
+
text=True,
|
|
496
|
+
timeout=60,
|
|
497
|
+
check=False,
|
|
498
|
+
)
|
|
476
499
|
|
|
477
500
|
if result.returncode == 0:
|
|
478
501
|
return True
|
|
@@ -507,7 +530,9 @@ def _execute_upgrade(installer_cmd: list[str]) -> bool:
|
|
|
507
530
|
subprocess.TimeoutExpired: If upgrade times out
|
|
508
531
|
"""
|
|
509
532
|
try:
|
|
510
|
-
result = subprocess.run(
|
|
533
|
+
result = subprocess.run(
|
|
534
|
+
installer_cmd, capture_output=True, text=True, timeout=60, check=False
|
|
535
|
+
)
|
|
511
536
|
return result.returncode == 0
|
|
512
537
|
except subprocess.TimeoutExpired:
|
|
513
538
|
raise # Re-raise timeout for caller to handle
|
|
@@ -516,7 +541,7 @@ def _execute_upgrade(installer_cmd: list[str]) -> bool:
|
|
|
516
541
|
|
|
517
542
|
|
|
518
543
|
def _sync_templates(project_path: Path, force: bool = False) -> bool:
|
|
519
|
-
"""Sync templates to project.
|
|
544
|
+
"""Sync templates to project with rollback mechanism.
|
|
520
545
|
|
|
521
546
|
Args:
|
|
522
547
|
project_path: Project path (absolute)
|
|
@@ -525,9 +550,19 @@ def _sync_templates(project_path: Path, force: bool = False) -> bool:
|
|
|
525
550
|
Returns:
|
|
526
551
|
True if sync succeeded, False otherwise
|
|
527
552
|
"""
|
|
553
|
+
from moai_adk.core.template.backup import TemplateBackup
|
|
554
|
+
|
|
555
|
+
backup_path = None
|
|
528
556
|
try:
|
|
529
557
|
processor = TemplateProcessor(project_path)
|
|
530
558
|
|
|
559
|
+
# Create pre-sync backup for rollback
|
|
560
|
+
if not force:
|
|
561
|
+
backup = TemplateBackup(project_path)
|
|
562
|
+
if backup.has_existing_files():
|
|
563
|
+
backup_path = backup.create_backup()
|
|
564
|
+
console.print(f"đž Created backup: {backup_path.name}")
|
|
565
|
+
|
|
531
566
|
# Load existing config
|
|
532
567
|
existing_config = _load_existing_config(project_path)
|
|
533
568
|
|
|
@@ -539,6 +574,18 @@ def _sync_templates(project_path: Path, force: bool = False) -> bool:
|
|
|
539
574
|
# Copy templates
|
|
540
575
|
processor.copy_templates(backup=False, silent=True)
|
|
541
576
|
|
|
577
|
+
# Validate template substitution
|
|
578
|
+
validation_passed = _validate_template_substitution_with_rollback(
|
|
579
|
+
project_path, backup_path
|
|
580
|
+
)
|
|
581
|
+
if not validation_passed:
|
|
582
|
+
if backup_path:
|
|
583
|
+
console.print(
|
|
584
|
+
f"[yellow]đ Rolling back to backup: {backup_path.name}[/yellow]"
|
|
585
|
+
)
|
|
586
|
+
backup.restore_backup(backup_path)
|
|
587
|
+
return False
|
|
588
|
+
|
|
542
589
|
# Preserve metadata
|
|
543
590
|
_preserve_project_metadata(project_path, context, existing_config, __version__)
|
|
544
591
|
_apply_context_to_file(processor, project_path / "CLAUDE.md")
|
|
@@ -547,7 +594,18 @@ def _sync_templates(project_path: Path, force: bool = False) -> bool:
|
|
|
547
594
|
set_optimized_false(project_path)
|
|
548
595
|
|
|
549
596
|
return True
|
|
550
|
-
except Exception:
|
|
597
|
+
except Exception as e:
|
|
598
|
+
console.print(f"[red]â Template sync failed: {e}[/red]")
|
|
599
|
+
if backup_path:
|
|
600
|
+
console.print(
|
|
601
|
+
f"[yellow]đ Rolling back to backup: {backup_path.name}[/yellow]"
|
|
602
|
+
)
|
|
603
|
+
try:
|
|
604
|
+
backup = TemplateBackup(project_path)
|
|
605
|
+
backup.restore_backup(backup_path)
|
|
606
|
+
console.print("[green]â
Rollback completed[/green]")
|
|
607
|
+
except Exception as rollback_error:
|
|
608
|
+
console.print(f"[red]â Rollback failed: {rollback_error}[/red]")
|
|
551
609
|
return False
|
|
552
610
|
|
|
553
611
|
|
|
@@ -573,14 +631,17 @@ def set_optimized_false(project_path: Path) -> None:
|
|
|
573
631
|
Args:
|
|
574
632
|
project_path: Project path (absolute).
|
|
575
633
|
"""
|
|
576
|
-
config_path = project_path / ".moai" / "config.json"
|
|
634
|
+
config_path = project_path / ".moai" / "config" / "config.json"
|
|
577
635
|
if not config_path.exists():
|
|
578
636
|
return
|
|
579
637
|
|
|
580
638
|
try:
|
|
581
639
|
config_data = json.loads(config_path.read_text(encoding="utf-8"))
|
|
582
640
|
config_data.setdefault("project", {})["optimized"] = False
|
|
583
|
-
config_path.write_text(
|
|
641
|
+
config_path.write_text(
|
|
642
|
+
json.dumps(config_data, indent=2, ensure_ascii=False) + "\n",
|
|
643
|
+
encoding="utf-8",
|
|
644
|
+
)
|
|
584
645
|
except (json.JSONDecodeError, KeyError):
|
|
585
646
|
# Ignore errors if config.json is invalid
|
|
586
647
|
pass
|
|
@@ -588,18 +649,24 @@ def set_optimized_false(project_path: Path) -> None:
|
|
|
588
649
|
|
|
589
650
|
def _load_existing_config(project_path: Path) -> dict[str, Any]:
|
|
590
651
|
"""Load existing config.json if available."""
|
|
591
|
-
config_path = project_path / ".moai" / "config.json"
|
|
652
|
+
config_path = project_path / ".moai" / "config" / "config.json"
|
|
592
653
|
if config_path.exists():
|
|
593
654
|
try:
|
|
594
655
|
return json.loads(config_path.read_text(encoding="utf-8"))
|
|
595
656
|
except json.JSONDecodeError:
|
|
596
|
-
console.print(
|
|
657
|
+
console.print(
|
|
658
|
+
"[yellow]â Existing config.json could not be parsed. Proceeding with defaults.[/yellow]"
|
|
659
|
+
)
|
|
597
660
|
return {}
|
|
598
661
|
|
|
599
662
|
|
|
600
663
|
def _is_placeholder(value: Any) -> bool:
|
|
601
664
|
"""Check if a string value is an unsubstituted template placeholder."""
|
|
602
|
-
return
|
|
665
|
+
return (
|
|
666
|
+
isinstance(value, str)
|
|
667
|
+
and value.strip().startswith("{{")
|
|
668
|
+
and value.strip().endswith("}}")
|
|
669
|
+
)
|
|
603
670
|
|
|
604
671
|
|
|
605
672
|
def _coalesce(*values: Any, default: str = "") -> str:
|
|
@@ -631,6 +698,8 @@ def _build_template_context(
|
|
|
631
698
|
version_for_config: str,
|
|
632
699
|
) -> dict[str, str]:
|
|
633
700
|
"""Build substitution context for template files."""
|
|
701
|
+
import platform
|
|
702
|
+
|
|
634
703
|
project_section = _extract_project_section(existing_config)
|
|
635
704
|
|
|
636
705
|
project_name = _coalesce(
|
|
@@ -660,6 +729,18 @@ def _build_template_context(
|
|
|
660
729
|
default=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
661
730
|
)
|
|
662
731
|
|
|
732
|
+
# Detect OS for cross-platform Hook path configuration
|
|
733
|
+
hook_project_dir = (
|
|
734
|
+
"%CLAUDE_PROJECT_DIR%"
|
|
735
|
+
if platform.system() == "Windows"
|
|
736
|
+
else "$CLAUDE_PROJECT_DIR"
|
|
737
|
+
)
|
|
738
|
+
|
|
739
|
+
# Extract language configuration
|
|
740
|
+
language_config = existing_config.get("language", {})
|
|
741
|
+
if not isinstance(language_config, dict):
|
|
742
|
+
language_config = {}
|
|
743
|
+
|
|
663
744
|
return {
|
|
664
745
|
"MOAI_VERSION": version_for_config,
|
|
665
746
|
"PROJECT_NAME": project_name,
|
|
@@ -667,6 +748,14 @@ def _build_template_context(
|
|
|
667
748
|
"PROJECT_DESCRIPTION": project_description,
|
|
668
749
|
"PROJECT_VERSION": project_version,
|
|
669
750
|
"CREATION_TIMESTAMP": created_at,
|
|
751
|
+
"PROJECT_DIR": hook_project_dir,
|
|
752
|
+
"CONVERSATION_LANGUAGE": language_config.get("conversation_language", "en"),
|
|
753
|
+
"CONVERSATION_LANGUAGE_NAME": language_config.get(
|
|
754
|
+
"conversation_language_name", "English"
|
|
755
|
+
),
|
|
756
|
+
"CODEBASE_LANGUAGE": project_section.get("language", "generic"),
|
|
757
|
+
"PROJECT_OWNER": project_section.get("author", "@user"),
|
|
758
|
+
"AUTHOR": project_section.get("author", "@user"),
|
|
670
759
|
}
|
|
671
760
|
|
|
672
761
|
|
|
@@ -680,7 +769,7 @@ def _preserve_project_metadata(
|
|
|
680
769
|
|
|
681
770
|
Also updates template_version to track which template version is synchronized.
|
|
682
771
|
"""
|
|
683
|
-
config_path = project_path / ".moai" / "config.json"
|
|
772
|
+
config_path = project_path / ".moai" / "config" / "config.json"
|
|
684
773
|
if not config_path.exists():
|
|
685
774
|
return
|
|
686
775
|
|
|
@@ -707,18 +796,21 @@ def _preserve_project_metadata(
|
|
|
707
796
|
if locale:
|
|
708
797
|
project_data["locale"] = locale
|
|
709
798
|
|
|
710
|
-
language = _coalesce(
|
|
799
|
+
language = _coalesce(
|
|
800
|
+
existing_project.get("language"), existing_config.get("language")
|
|
801
|
+
)
|
|
711
802
|
if language:
|
|
712
803
|
project_data["language"] = language
|
|
713
804
|
|
|
714
805
|
config_data.setdefault("moai", {})
|
|
715
806
|
config_data["moai"]["version"] = version_for_config
|
|
716
807
|
|
|
717
|
-
# @CODE:UPDATE-REFACTOR-002-008: Update template_version to track sync status
|
|
718
808
|
# This allows Stage 2 to compare package vs project template versions
|
|
719
809
|
project_data["template_version"] = version_for_config
|
|
720
810
|
|
|
721
|
-
config_path.write_text(
|
|
811
|
+
config_path.write_text(
|
|
812
|
+
json.dumps(config_data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8"
|
|
813
|
+
)
|
|
722
814
|
|
|
723
815
|
|
|
724
816
|
def _apply_context_to_file(processor: TemplateProcessor, target_path: Path) -> None:
|
|
@@ -731,7 +823,9 @@ def _apply_context_to_file(processor: TemplateProcessor, target_path: Path) -> N
|
|
|
731
823
|
except UnicodeDecodeError:
|
|
732
824
|
return
|
|
733
825
|
|
|
734
|
-
substituted, warnings = processor._substitute_variables(
|
|
826
|
+
substituted, warnings = processor._substitute_variables(
|
|
827
|
+
content
|
|
828
|
+
) # pylint: disable=protected-access
|
|
735
829
|
if warnings:
|
|
736
830
|
console.print("[yellow]â Template warnings:[/yellow]")
|
|
737
831
|
for warning in warnings:
|
|
@@ -740,7 +834,104 @@ def _apply_context_to_file(processor: TemplateProcessor, target_path: Path) -> N
|
|
|
740
834
|
target_path.write_text(substituted, encoding="utf-8")
|
|
741
835
|
|
|
742
836
|
|
|
743
|
-
|
|
837
|
+
def _validate_template_substitution(project_path: Path) -> None:
|
|
838
|
+
"""Validate that all template variables have been properly substituted."""
|
|
839
|
+
import re
|
|
840
|
+
|
|
841
|
+
# Files to check for unsubstituted variables
|
|
842
|
+
files_to_check = [
|
|
843
|
+
project_path / ".claude" / "settings.json",
|
|
844
|
+
project_path / "CLAUDE.md",
|
|
845
|
+
]
|
|
846
|
+
|
|
847
|
+
issues_found = []
|
|
848
|
+
|
|
849
|
+
for file_path in files_to_check:
|
|
850
|
+
if not file_path.exists():
|
|
851
|
+
continue
|
|
852
|
+
|
|
853
|
+
try:
|
|
854
|
+
content = file_path.read_text(encoding="utf-8")
|
|
855
|
+
# Look for unsubstituted template variables
|
|
856
|
+
unsubstituted = re.findall(r"\{\{([A-Z_]+)\}\}", content)
|
|
857
|
+
if unsubstituted:
|
|
858
|
+
unique_vars = sorted(set(unsubstituted))
|
|
859
|
+
issues_found.append(
|
|
860
|
+
f"{file_path.relative_to(project_path)}: {', '.join(unique_vars)}"
|
|
861
|
+
)
|
|
862
|
+
except Exception as e:
|
|
863
|
+
console.print(
|
|
864
|
+
f"[yellow]â ī¸ Could not validate {file_path.relative_to(project_path)}: {e}[/yellow]"
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
if issues_found:
|
|
868
|
+
console.print("[red]â Template substitution validation failed:[/red]")
|
|
869
|
+
for issue in issues_found:
|
|
870
|
+
console.print(f" {issue}")
|
|
871
|
+
console.print(
|
|
872
|
+
"[yellow]đĄ Run '/alfred:0-project' to fix template variables[/yellow]"
|
|
873
|
+
)
|
|
874
|
+
else:
|
|
875
|
+
console.print("[green]â
Template substitution validation passed[/green]")
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
def _validate_template_substitution_with_rollback(
|
|
879
|
+
project_path: Path, backup_path: Path | None
|
|
880
|
+
) -> bool:
|
|
881
|
+
"""Validate template substitution with rollback capability.
|
|
882
|
+
|
|
883
|
+
Returns:
|
|
884
|
+
True if validation passed, False if failed (rollback handled by caller)
|
|
885
|
+
"""
|
|
886
|
+
import re
|
|
887
|
+
|
|
888
|
+
# Files to check for unsubstituted variables
|
|
889
|
+
files_to_check = [
|
|
890
|
+
project_path / ".claude" / "settings.json",
|
|
891
|
+
project_path / "CLAUDE.md",
|
|
892
|
+
]
|
|
893
|
+
|
|
894
|
+
issues_found = []
|
|
895
|
+
|
|
896
|
+
for file_path in files_to_check:
|
|
897
|
+
if not file_path.exists():
|
|
898
|
+
continue
|
|
899
|
+
|
|
900
|
+
try:
|
|
901
|
+
content = file_path.read_text(encoding="utf-8")
|
|
902
|
+
# Look for unsubstituted template variables
|
|
903
|
+
unsubstituted = re.findall(r"\{\{([A-Z_]+)\}\}", content)
|
|
904
|
+
if unsubstituted:
|
|
905
|
+
unique_vars = sorted(set(unsubstituted))
|
|
906
|
+
issues_found.append(
|
|
907
|
+
f"{file_path.relative_to(project_path)}: {', '.join(unique_vars)}"
|
|
908
|
+
)
|
|
909
|
+
except Exception as e:
|
|
910
|
+
console.print(
|
|
911
|
+
f"[yellow]â ī¸ Could not validate {file_path.relative_to(project_path)}: {e}[/yellow]"
|
|
912
|
+
)
|
|
913
|
+
|
|
914
|
+
if issues_found:
|
|
915
|
+
console.print("[red]â Template substitution validation failed:[/red]")
|
|
916
|
+
for issue in issues_found:
|
|
917
|
+
console.print(f" {issue}")
|
|
918
|
+
|
|
919
|
+
if backup_path:
|
|
920
|
+
console.print(
|
|
921
|
+
"[yellow]đ Rolling back due to validation failure...[/yellow]"
|
|
922
|
+
)
|
|
923
|
+
else:
|
|
924
|
+
console.print(
|
|
925
|
+
"[yellow]đĄ Run '/alfred:0-project' to fix template variables[/yellow]"
|
|
926
|
+
)
|
|
927
|
+
console.print("[red]â ī¸ No backup available - manual fix required[/red]")
|
|
928
|
+
|
|
929
|
+
return False
|
|
930
|
+
else:
|
|
931
|
+
console.print("[green]â
Template substitution validation passed[/green]")
|
|
932
|
+
return True
|
|
933
|
+
|
|
934
|
+
|
|
744
935
|
def _show_version_info(current: str, latest: str) -> None:
|
|
745
936
|
"""Display version information.
|
|
746
937
|
|
|
@@ -753,7 +944,6 @@ def _show_version_info(current: str, latest: str) -> None:
|
|
|
753
944
|
console.print(f" Latest version: {latest}")
|
|
754
945
|
|
|
755
946
|
|
|
756
|
-
# @CODE:UPDATE-REFACTOR-002-005
|
|
757
947
|
def _show_installer_not_found_help() -> None:
|
|
758
948
|
"""Show help when installer not found."""
|
|
759
949
|
console.print("[red]â Cannot detect package installer[/red]\n")
|
|
@@ -788,14 +978,18 @@ def _show_network_error_help() -> None:
|
|
|
788
978
|
console.print("Options:")
|
|
789
979
|
console.print(" 1. Check network connection")
|
|
790
980
|
console.print(" 2. Try again with: [cyan]moai-adk update --force[/cyan]")
|
|
791
|
-
console.print(
|
|
981
|
+
console.print(
|
|
982
|
+
" 3. Skip version check: [cyan]moai-adk update --templates-only[/cyan]"
|
|
983
|
+
)
|
|
792
984
|
|
|
793
985
|
|
|
794
986
|
def _show_template_sync_failure_help() -> None:
|
|
795
987
|
"""Show help when template sync fails."""
|
|
796
988
|
console.print("[yellow]â ī¸ Template sync failed[/yellow]\n")
|
|
797
989
|
console.print("Rollback options:")
|
|
798
|
-
console.print(
|
|
990
|
+
console.print(
|
|
991
|
+
" 1. Restore from backup: [cyan]cp -r .moai-backups/TIMESTAMP .moai/[/cyan]"
|
|
992
|
+
)
|
|
799
993
|
console.print(" 2. Skip backup and retry: [cyan]moai-adk update --force[/cyan]")
|
|
800
994
|
console.print(" 3. Report issue: https://github.com/modu-ai/moai-adk/issues")
|
|
801
995
|
|
|
@@ -807,13 +1001,88 @@ def _show_timeout_error_help() -> None:
|
|
|
807
1001
|
console.print(" [cyan]moai-adk update --yes --force[/cyan]")
|
|
808
1002
|
|
|
809
1003
|
|
|
1004
|
+
def _execute_migration_if_needed(project_path: Path, yes: bool = False) -> bool:
|
|
1005
|
+
"""Check and execute migration if needed.
|
|
1006
|
+
|
|
1007
|
+
Args:
|
|
1008
|
+
project_path: Project directory path
|
|
1009
|
+
yes: Auto-confirm without prompting
|
|
1010
|
+
|
|
1011
|
+
Returns:
|
|
1012
|
+
True if no migration needed or migration succeeded, False if migration failed
|
|
1013
|
+
"""
|
|
1014
|
+
try:
|
|
1015
|
+
migrator = VersionMigrator(project_path)
|
|
1016
|
+
|
|
1017
|
+
# Check if migration is needed
|
|
1018
|
+
if not migrator.needs_migration():
|
|
1019
|
+
return True
|
|
1020
|
+
|
|
1021
|
+
# Get migration info
|
|
1022
|
+
info = migrator.get_migration_info()
|
|
1023
|
+
console.print("\n[cyan]đ Migration Required[/cyan]")
|
|
1024
|
+
console.print(f" Current version: {info['current_version']}")
|
|
1025
|
+
console.print(f" Target version: {info['target_version']}")
|
|
1026
|
+
console.print(f" Files to migrate: {info['file_count']}")
|
|
1027
|
+
console.print()
|
|
1028
|
+
console.print(" This will migrate configuration files to new locations:")
|
|
1029
|
+
console.print(" âĸ .moai/config.json â .moai/config/config.json")
|
|
1030
|
+
console.print(
|
|
1031
|
+
" âĸ .claude/statusline-config.yaml â .moai/config/statusline-config.yaml"
|
|
1032
|
+
)
|
|
1033
|
+
console.print()
|
|
1034
|
+
console.print(" A backup will be created automatically.")
|
|
1035
|
+
console.print()
|
|
1036
|
+
|
|
1037
|
+
# Confirm with user (unless --yes)
|
|
1038
|
+
if not yes:
|
|
1039
|
+
if not click.confirm(
|
|
1040
|
+
"Do you want to proceed with migration?", default=True
|
|
1041
|
+
):
|
|
1042
|
+
console.print(
|
|
1043
|
+
"[yellow]â ī¸ Migration skipped. Some features may not work correctly.[/yellow]"
|
|
1044
|
+
)
|
|
1045
|
+
console.print(
|
|
1046
|
+
"[cyan]đĄ Run 'moai-adk migrate' manually when ready[/cyan]"
|
|
1047
|
+
)
|
|
1048
|
+
return False
|
|
1049
|
+
|
|
1050
|
+
# Execute migration
|
|
1051
|
+
console.print("[cyan]đ Starting migration...[/cyan]")
|
|
1052
|
+
success = migrator.migrate_to_v024(dry_run=False, cleanup=True)
|
|
1053
|
+
|
|
1054
|
+
if success:
|
|
1055
|
+
console.print("[green]â
Migration completed successfully![/green]")
|
|
1056
|
+
return True
|
|
1057
|
+
else:
|
|
1058
|
+
console.print("[red]â Migration failed[/red]")
|
|
1059
|
+
console.print(
|
|
1060
|
+
"[cyan]đĄ Use 'moai-adk migrate --rollback' to restore from backup[/cyan]"
|
|
1061
|
+
)
|
|
1062
|
+
return False
|
|
1063
|
+
|
|
1064
|
+
except Exception as e:
|
|
1065
|
+
console.print(f"[red]â Migration error: {e}[/red]")
|
|
1066
|
+
logger.error(f"Migration failed: {e}", exc_info=True)
|
|
1067
|
+
return False
|
|
1068
|
+
|
|
1069
|
+
|
|
810
1070
|
@click.command()
|
|
811
|
-
@click.option(
|
|
1071
|
+
@click.option(
|
|
1072
|
+
"--path",
|
|
1073
|
+
type=click.Path(exists=True),
|
|
1074
|
+
default=".",
|
|
1075
|
+
help="Project path (default: current directory)",
|
|
1076
|
+
)
|
|
812
1077
|
@click.option("--force", is_flag=True, help="Skip backup and force the update")
|
|
813
1078
|
@click.option("--check", is_flag=True, help="Only check version (do not update)")
|
|
814
|
-
@click.option(
|
|
1079
|
+
@click.option(
|
|
1080
|
+
"--templates-only", is_flag=True, help="Skip package upgrade, sync templates only"
|
|
1081
|
+
)
|
|
815
1082
|
@click.option("--yes", is_flag=True, help="Auto-confirm all prompts (CI/CD mode)")
|
|
816
|
-
def update(
|
|
1083
|
+
def update(
|
|
1084
|
+
path: str, force: bool, check: bool, templates_only: bool, yes: bool
|
|
1085
|
+
) -> None:
|
|
817
1086
|
"""Update command with 3-stage workflow (v0.6.3+).
|
|
818
1087
|
|
|
819
1088
|
Stage 1 (Package Version Check):
|
|
@@ -856,7 +1125,9 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
856
1125
|
except RuntimeError as e:
|
|
857
1126
|
console.print(f"[red]Error: {e}[/red]")
|
|
858
1127
|
if not force:
|
|
859
|
-
console.print(
|
|
1128
|
+
console.print(
|
|
1129
|
+
"[yellow]â Cannot check for updates. Use --force to update anyway.[/yellow]"
|
|
1130
|
+
)
|
|
860
1131
|
raise click.Abort()
|
|
861
1132
|
# With --force, proceed to Stage 2 even if version check fails
|
|
862
1133
|
current = __version__
|
|
@@ -868,12 +1139,16 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
868
1139
|
if check:
|
|
869
1140
|
comparison = _compare_versions(current, latest)
|
|
870
1141
|
if comparison < 0:
|
|
871
|
-
console.print(
|
|
1142
|
+
console.print(
|
|
1143
|
+
f"\n[yellow]đĻ Update available: {current} â {latest}[/yellow]"
|
|
1144
|
+
)
|
|
872
1145
|
console.print(" Run 'moai-adk update' to upgrade")
|
|
873
1146
|
elif comparison == 0:
|
|
874
1147
|
console.print(f"[green]â Already up to date ({current})[/green]")
|
|
875
1148
|
else:
|
|
876
|
-
console.print(
|
|
1149
|
+
console.print(
|
|
1150
|
+
f"[cyan]âšī¸ Dev version: {current} (latest: {latest})[/cyan]"
|
|
1151
|
+
)
|
|
877
1152
|
return
|
|
878
1153
|
|
|
879
1154
|
# Step 2: Handle --templates-only (skip upgrade, go straight to sync)
|
|
@@ -892,7 +1167,9 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
892
1167
|
raise click.Abort()
|
|
893
1168
|
|
|
894
1169
|
console.print(" [green]â
.claude/ update complete[/green]")
|
|
895
|
-
console.print(
|
|
1170
|
+
console.print(
|
|
1171
|
+
" [green]â
.moai/ update complete (specs/reports preserved)[/green]"
|
|
1172
|
+
)
|
|
896
1173
|
console.print(" [green]đ CLAUDE.md merge complete[/green]")
|
|
897
1174
|
console.print(" [green]đ config.json merge complete[/green]")
|
|
898
1175
|
console.print("\n[green]â Template sync complete![/green]")
|
|
@@ -902,7 +1179,6 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
902
1179
|
comparison = _compare_versions(current, latest)
|
|
903
1180
|
|
|
904
1181
|
# Stage 1: Package Upgrade (if current < latest)
|
|
905
|
-
# @CODE:UPDATE-REFACTOR-002-009: Stage 1 - Package version check and upgrade
|
|
906
1182
|
if comparison < 0:
|
|
907
1183
|
console.print(f"\n[cyan]đĻ Upgrading: {current} â {latest}[/cyan]")
|
|
908
1184
|
|
|
@@ -928,7 +1204,9 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
928
1204
|
try:
|
|
929
1205
|
upgrade_result = _execute_upgrade(installer_cmd)
|
|
930
1206
|
if not upgrade_result:
|
|
931
|
-
raise UpgradeError(
|
|
1207
|
+
raise UpgradeError(
|
|
1208
|
+
f"Upgrade command failed: {' '.join(installer_cmd)}"
|
|
1209
|
+
)
|
|
932
1210
|
except subprocess.TimeoutExpired:
|
|
933
1211
|
_show_timeout_error_help()
|
|
934
1212
|
raise click.Abort()
|
|
@@ -938,13 +1216,22 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
938
1216
|
|
|
939
1217
|
# Prompt re-run
|
|
940
1218
|
console.print("\n[green]â Upgrade complete![/green]")
|
|
941
|
-
console.print(
|
|
1219
|
+
console.print(
|
|
1220
|
+
"[cyan]đĸ Run 'moai-adk update' again to sync templates[/cyan]"
|
|
1221
|
+
)
|
|
942
1222
|
return
|
|
943
1223
|
|
|
944
|
-
# Stage
|
|
945
|
-
# @CODE:UPDATE-REFACTOR-002-010: Stage 2 - Compare template versions to determine if sync needed
|
|
1224
|
+
# Stage 1.5: Migration Check (NEW in v0.24.0)
|
|
946
1225
|
console.print(f"â Package already up to date ({current})")
|
|
947
1226
|
|
|
1227
|
+
# Execute migration if needed
|
|
1228
|
+
if not _execute_migration_if_needed(project_path, yes):
|
|
1229
|
+
console.print("[yellow]â ī¸ Update continuing without migration[/yellow]")
|
|
1230
|
+
console.print(
|
|
1231
|
+
"[cyan]đĄ Some features may require migration to work correctly[/cyan]"
|
|
1232
|
+
)
|
|
1233
|
+
|
|
1234
|
+
# Stage 2: Config Version Comparison
|
|
948
1235
|
try:
|
|
949
1236
|
package_config_version = _get_package_config_version()
|
|
950
1237
|
project_config_version = _get_project_config_version(project_path)
|
|
@@ -959,23 +1246,32 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
959
1246
|
console.print(f" Project config: {project_config_version}")
|
|
960
1247
|
|
|
961
1248
|
try:
|
|
962
|
-
config_comparison = _compare_versions(
|
|
1249
|
+
config_comparison = _compare_versions(
|
|
1250
|
+
package_config_version, project_config_version
|
|
1251
|
+
)
|
|
963
1252
|
except version.InvalidVersion as e:
|
|
964
1253
|
# Handle invalid version strings (e.g., unsubstituted template placeholders, corrupted configs)
|
|
965
1254
|
console.print(f"[yellow]â Invalid version format in config: {e}[/yellow]")
|
|
966
|
-
console.print(
|
|
1255
|
+
console.print(
|
|
1256
|
+
"[cyan]âšī¸ Forcing template sync to repair configuration...[/cyan]"
|
|
1257
|
+
)
|
|
967
1258
|
# Force template sync by treating project version as outdated
|
|
968
1259
|
config_comparison = 1 # package_config_version > project_config_version
|
|
969
1260
|
|
|
970
1261
|
# If versions are equal, no sync needed
|
|
971
1262
|
if config_comparison <= 0:
|
|
972
|
-
console.print(
|
|
973
|
-
|
|
1263
|
+
console.print(
|
|
1264
|
+
f"\n[green]â Project already has latest template version ({project_config_version})[/green]"
|
|
1265
|
+
)
|
|
1266
|
+
console.print(
|
|
1267
|
+
"[cyan]âšī¸ Templates are up to date! No changes needed.[/cyan]"
|
|
1268
|
+
)
|
|
974
1269
|
return
|
|
975
1270
|
|
|
976
1271
|
# Stage 3: Template Sync (Only if package_config_version > project_config_version)
|
|
977
|
-
|
|
978
|
-
|
|
1272
|
+
console.print(
|
|
1273
|
+
f"\n[cyan]đ Syncing templates ({project_config_version} â {package_config_version})...[/cyan]"
|
|
1274
|
+
)
|
|
979
1275
|
|
|
980
1276
|
# Create backup unless --force
|
|
981
1277
|
if not force:
|
|
@@ -983,7 +1279,9 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
983
1279
|
try:
|
|
984
1280
|
processor = TemplateProcessor(project_path)
|
|
985
1281
|
backup_path = processor.create_backup()
|
|
986
|
-
console.print(
|
|
1282
|
+
console.print(
|
|
1283
|
+
f" [green]â Backup: {backup_path.relative_to(project_path)}/[/green]"
|
|
1284
|
+
)
|
|
987
1285
|
except Exception as e:
|
|
988
1286
|
console.print(f" [yellow]â Backup failed: {e}[/yellow]")
|
|
989
1287
|
console.print(" [yellow]â Continuing without backup...[/yellow]")
|
|
@@ -1004,13 +1302,19 @@ def update(path: str, force: bool, check: bool, templates_only: bool, yes: bool)
|
|
|
1004
1302
|
raise click.Abort()
|
|
1005
1303
|
|
|
1006
1304
|
console.print(" [green]â
.claude/ update complete[/green]")
|
|
1007
|
-
console.print(
|
|
1305
|
+
console.print(
|
|
1306
|
+
" [green]â
.moai/ update complete (specs/reports preserved)[/green]"
|
|
1307
|
+
)
|
|
1008
1308
|
console.print(" [green]đ CLAUDE.md merge complete[/green]")
|
|
1009
1309
|
console.print(" [green]đ config.json merge complete[/green]")
|
|
1010
|
-
console.print(
|
|
1310
|
+
console.print(
|
|
1311
|
+
" [yellow]âī¸ Set optimized=false (optimization needed)[/yellow]"
|
|
1312
|
+
)
|
|
1011
1313
|
|
|
1012
1314
|
console.print("\n[green]â Update complete![/green]")
|
|
1013
|
-
console.print(
|
|
1315
|
+
console.print(
|
|
1316
|
+
"[cyan]âšī¸ Next step: Run /alfred:0-project update to optimize template changes[/cyan]"
|
|
1317
|
+
)
|
|
1014
1318
|
|
|
1015
1319
|
except Exception as e:
|
|
1016
1320
|
console.print(f"[red]â Update failed: {e}[/red]")
|