moai-adk 0.34.0__py3-none-any.whl → 1.1.0__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.
- moai_adk/__main__.py +136 -5
- moai_adk/astgrep/__init__.py +37 -0
- moai_adk/astgrep/analyzer.py +522 -0
- moai_adk/astgrep/models.py +124 -0
- moai_adk/astgrep/rules.py +179 -0
- moai_adk/cli/commands/analyze.py +11 -2
- moai_adk/cli/commands/doctor.py +7 -1
- moai_adk/cli/commands/init.py +321 -11
- moai_adk/cli/commands/language.py +7 -1
- moai_adk/cli/commands/rank.py +449 -0
- moai_adk/cli/commands/status.py +7 -1
- moai_adk/cli/commands/switch.py +325 -0
- moai_adk/cli/commands/update.py +296 -23
- moai_adk/cli/prompts/init_prompts.py +362 -66
- moai_adk/cli/prompts/translations/__init__.py +573 -0
- moai_adk/cli/ui/prompts.py +61 -2
- moai_adk/cli/worktree/cli.py +106 -1
- moai_adk/cli/worktree/manager.py +155 -0
- moai_adk/core/config/unified.py +244 -63
- moai_adk/core/credentials.py +264 -0
- moai_adk/core/error_recovery_system.py +22 -4
- moai_adk/core/git/conflict_detector.py +10 -1
- moai_adk/core/git/event_detector.py +16 -5
- moai_adk/core/integration/engine.py +2 -2
- moai_adk/core/integration/integration_tester.py +5 -5
- moai_adk/core/language_config_resolver.py +9 -3
- moai_adk/core/merge/analyzer.py +509 -324
- moai_adk/core/migration/alfred_to_moai_migrator.py +7 -1
- moai_adk/core/migration/backup_manager.py +54 -4
- moai_adk/core/migration/file_migrator.py +174 -2
- moai_adk/core/migration/interactive_checkbox_ui.py +42 -31
- moai_adk/core/migration/version_detector.py +123 -19
- moai_adk/core/migration/version_migrator.py +44 -9
- moai_adk/core/model_allocator.py +241 -0
- moai_adk/core/project/backup_utils.py +12 -2
- moai_adk/core/project/initializer.py +44 -87
- moai_adk/core/project/phase_executor.py +95 -33
- moai_adk/core/project/validator.py +16 -1
- moai_adk/core/quality/trust_checker.py +30 -10
- moai_adk/core/rollback_manager.py +60 -25
- moai_adk/core/template/backup.py +88 -6
- moai_adk/core/template/config.py +33 -9
- moai_adk/core/template/merger.py +34 -8
- moai_adk/core/template/processor.py +334 -11
- moai_adk/core/template_engine.py +10 -1
- moai_adk/core/template_variable_synchronizer.py +16 -2
- moai_adk/core/version_sync.py +54 -6
- moai_adk/foundation/__init__.py +1 -20
- moai_adk/foundation/testing.py +1 -1
- moai_adk/loop/__init__.py +54 -0
- moai_adk/loop/controller.py +305 -0
- moai_adk/loop/feedback.py +230 -0
- moai_adk/loop/state.py +209 -0
- moai_adk/loop/storage.py +220 -0
- moai_adk/lsp/__init__.py +70 -0
- moai_adk/lsp/client.py +320 -0
- moai_adk/lsp/models.py +261 -0
- moai_adk/lsp/protocol.py +404 -0
- moai_adk/lsp/server_manager.py +248 -0
- moai_adk/project/configuration.py +8 -1
- moai_adk/py.typed +0 -0
- moai_adk/ralph/__init__.py +37 -0
- moai_adk/ralph/engine.py +307 -0
- moai_adk/rank/__init__.py +21 -0
- moai_adk/rank/auth.py +425 -0
- moai_adk/rank/client.py +557 -0
- moai_adk/rank/config.py +147 -0
- moai_adk/rank/hook.py +1503 -0
- moai_adk/rank/py.typed +0 -0
- moai_adk/statusline/__init__.py +3 -0
- moai_adk/statusline/enhanced_output_style_detector.py +5 -5
- moai_adk/statusline/main.py +20 -1
- moai_adk/statusline/memory_collector.py +268 -0
- moai_adk/statusline/renderer.py +54 -38
- moai_adk/tag_system/__init__.py +48 -0
- moai_adk/tag_system/atomic_ops.py +117 -0
- moai_adk/tag_system/linkage.py +335 -0
- moai_adk/tag_system/parser.py +176 -0
- moai_adk/tag_system/validator.py +200 -0
- moai_adk/templates/.claude/agents/moai/builder-agent.md +19 -3
- moai_adk/templates/.claude/agents/moai/builder-command.md +62 -16
- moai_adk/templates/.claude/agents/moai/builder-plugin.md +763 -0
- moai_adk/templates/.claude/agents/moai/builder-skill.md +21 -5
- moai_adk/templates/.claude/agents/moai/expert-backend.md +103 -39
- moai_adk/templates/.claude/agents/moai/expert-debug.md +9 -3
- moai_adk/templates/.claude/agents/moai/expert-devops.md +16 -14
- moai_adk/templates/.claude/agents/moai/expert-frontend.md +45 -31
- moai_adk/templates/.claude/agents/moai/expert-performance.md +13 -9
- moai_adk/templates/.claude/agents/moai/expert-refactoring.md +228 -0
- moai_adk/templates/.claude/agents/moai/expert-security.md +19 -3
- moai_adk/templates/.claude/agents/moai/expert-testing.md +13 -9
- moai_adk/templates/.claude/agents/moai/manager-claude-code.md +8 -2
- moai_adk/templates/.claude/agents/moai/manager-docs.md +10 -5
- moai_adk/templates/.claude/agents/moai/manager-git.md +99 -27
- moai_adk/templates/.claude/agents/moai/manager-project.md +87 -7
- moai_adk/templates/.claude/agents/moai/manager-quality.md +22 -5
- moai_adk/templates/.claude/agents/moai/manager-spec.md +8 -2
- moai_adk/templates/.claude/agents/moai/manager-strategy.md +45 -14
- moai_adk/templates/.claude/agents/moai/manager-tdd.md +16 -3
- moai_adk/templates/.claude/commands/moai/0-project.md +239 -1185
- moai_adk/templates/.claude/commands/moai/1-plan.md +383 -363
- moai_adk/templates/.claude/commands/moai/2-run.md +254 -347
- moai_adk/templates/.claude/commands/moai/3-sync.md +174 -100
- moai_adk/templates/.claude/commands/moai/9-feedback.md +49 -33
- moai_adk/templates/.claude/commands/moai/alfred.md +339 -0
- moai_adk/templates/.claude/commands/moai/cancel-loop.md +163 -0
- moai_adk/templates/.claude/commands/moai/fix.md +264 -0
- moai_adk/templates/.claude/commands/moai/loop.md +363 -0
- moai_adk/templates/.claude/hooks/moai/lib/README.md +143 -0
- moai_adk/templates/.claude/hooks/moai/lib/__init__.py +37 -81
- moai_adk/templates/.claude/hooks/moai/lib/alfred_detector.py +105 -0
- moai_adk/templates/.claude/hooks/moai/lib/atomic_write.py +122 -0
- moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +4 -1
- moai_adk/templates/.claude/hooks/moai/lib/common.py +35 -5
- moai_adk/templates/.claude/hooks/moai/lib/config.py +376 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +24 -28
- moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +14 -14
- moai_adk/templates/.claude/hooks/moai/lib/enhanced_output_style_detector.py +372 -0
- moai_adk/templates/.claude/hooks/moai/lib/exceptions.py +171 -0
- moai_adk/templates/.claude/hooks/moai/lib/file_utils.py +95 -0
- moai_adk/templates/.claude/hooks/moai/lib/git_collector.py +190 -0
- moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +15 -13
- moai_adk/templates/.claude/hooks/moai/lib/language_detector.py +298 -0
- moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +125 -25
- moai_adk/templates/.claude/hooks/moai/lib/main.py +341 -0
- moai_adk/templates/.claude/hooks/moai/lib/memory_collector.py +268 -0
- moai_adk/templates/.claude/hooks/moai/lib/metrics_tracker.py +78 -0
- moai_adk/templates/.claude/hooks/moai/lib/models.py +9 -7
- moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +204 -13
- moai_adk/templates/.claude/hooks/moai/lib/project.py +23 -14
- moai_adk/templates/.claude/hooks/moai/lib/renderer.py +359 -0
- moai_adk/templates/.claude/hooks/moai/lib/tag_linkage.py +333 -0
- moai_adk/templates/.claude/hooks/moai/lib/tag_parser.py +176 -0
- moai_adk/templates/.claude/hooks/moai/lib/tag_validator.py +200 -0
- moai_adk/templates/.claude/hooks/moai/lib/timeout.py +5 -5
- moai_adk/templates/.claude/hooks/moai/lib/tool_registry.py +896 -0
- moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +30 -18
- moai_adk/templates/.claude/hooks/moai/lib/update_checker.py +129 -0
- moai_adk/templates/.claude/hooks/moai/lib/version_reader.py +741 -0
- moai_adk/templates/.claude/hooks/moai/post_tool__ast_grep_scan.py +276 -0
- moai_adk/templates/.claude/hooks/moai/post_tool__code_formatter.py +255 -0
- moai_adk/templates/.claude/hooks/moai/post_tool__coverage_guard.py +325 -0
- moai_adk/templates/.claude/hooks/moai/post_tool__linter.py +315 -0
- moai_adk/templates/.claude/hooks/moai/post_tool__lsp_diagnostic.py +508 -0
- moai_adk/templates/.claude/hooks/moai/pre_commit__tag_validator.py +287 -0
- moai_adk/templates/.claude/hooks/moai/pre_tool__security_guard.py +268 -0
- moai_adk/templates/.claude/hooks/moai/pre_tool__tdd_enforcer.py +208 -0
- moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +93 -61
- moai_adk/templates/.claude/hooks/moai/session_end__rank_submit.py +69 -0
- moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +165 -70
- moai_adk/templates/.claude/hooks/moai/shared/utils/announcement_translator.py +206 -0
- moai_adk/templates/.claude/hooks/moai/stop__loop_controller.py +621 -0
- moai_adk/templates/.claude/output-styles/moai/alfred.md +758 -0
- moai_adk/templates/.claude/output-styles/moai/r2d2.md +86 -3
- moai_adk/templates/.claude/output-styles/moai/yoda.md +2 -2
- moai_adk/templates/.claude/settings.json +154 -77
- moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +252 -198
- moai_adk/templates/.claude/skills/moai-docs-generation/examples.md +169 -323
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +39 -27
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +115 -125
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +150 -150
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +182 -175
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +198 -138
- moai_adk/templates/.claude/skills/moai-docs-generation/reference.md +226 -320
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +43 -222
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +75 -219
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +103 -463
- moai_adk/templates/.claude/skills/moai-domain-frontend/modules/component-architecture.md +723 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/modules/nextjs16-patterns.md +713 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/modules/performance-optimization.md +694 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/modules/react19-patterns.md +591 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/modules/state-management.md +680 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/modules/vue35-patterns.md +802 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +118 -339
- moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +74 -377
- moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +299 -70
- moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +205 -182
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/advanced-agent-patterns.md +370 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-cli-reference-official.md +420 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +32 -22
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-devcontainers-official.md +381 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-discover-plugins-official.md +379 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-headless-official.md +378 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +110 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-plugin-marketplaces-official.md +308 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-plugins-official.md +640 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sandboxing-official.md +282 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +425 -71
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-statusline-official.md +293 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +325 -143
- moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +96 -316
- moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +116 -294
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-advanced.md +279 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-implementation.md +267 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +121 -650
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/patterns.md +22 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-ears-format.md +200 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +37 -730
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-tdd-implementation.md +275 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +77 -819
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-implementation.md +244 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-validation.md +219 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/SKILL.md +14 -18
- moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +86 -270
- moai_adk/templates/.claude/skills/moai-framework-electron/SKILL.md +288 -0
- moai_adk/templates/.claude/skills/moai-framework-electron/examples.md +2082 -0
- moai_adk/templates/.claude/skills/moai-framework-electron/reference.md +1649 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +76 -582
- moai_adk/templates/.claude/skills/moai-lang-cpp/examples.md +1239 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/modules/advanced-patterns.md +401 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/reference.md +1136 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +82 -436
- moai_adk/templates/.claude/skills/moai-lang-csharp/examples.md +585 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/modules/aspnet-core.md +627 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/modules/blazor-components.md +767 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/modules/cqrs-validation.md +626 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/modules/csharp12-features.md +580 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/modules/efcore-patterns.md +622 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/reference.md +403 -0
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +65 -542
- moai_adk/templates/.claude/skills/moai-lang-elixir/examples.md +1171 -0
- moai_adk/templates/.claude/skills/moai-lang-elixir/modules/advanced-patterns.md +531 -0
- moai_adk/templates/.claude/skills/moai-lang-elixir/reference.md +889 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/SKILL.md +32 -405
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +114 -293
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +83 -307
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +179 -0
- moai_adk/templates/.claude/skills/moai-lang-javascript/examples.md +973 -0
- moai_adk/templates/.claude/skills/moai-lang-javascript/reference.md +1543 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +42 -279
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +94 -556
- moai_adk/templates/.claude/skills/moai-lang-php/examples.md +1608 -0
- moai_adk/templates/.claude/skills/moai-lang-php/modules/advanced-patterns.md +538 -0
- moai_adk/templates/.claude/skills/moai-lang-php/reference.md +1323 -0
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +108 -358
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +84 -482
- moai_adk/templates/.claude/skills/moai-lang-r/examples.md +1154 -0
- moai_adk/templates/.claude/skills/moai-lang-r/modules/advanced-patterns.md +489 -0
- moai_adk/templates/.claude/skills/moai-lang-r/reference.md +1087 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +106 -610
- moai_adk/templates/.claude/skills/moai-lang-ruby/examples.md +1106 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/modules/advanced-patterns.md +309 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/modules/testing-patterns.md +306 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/reference.md +1024 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +51 -265
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +106 -442
- moai_adk/templates/.claude/skills/moai-lang-scala/modules/akka-actors.md +479 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/modules/cats-effect.md +489 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/modules/functional-programming.md +460 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/modules/spark-data.md +498 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/modules/zio-patterns.md +541 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +88 -457
- moai_adk/templates/.claude/skills/moai-lang-swift/modules/combine-reactive.md +256 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/modules/concurrency.md +270 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/modules/swift6-features.md +265 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/modules/swiftui-patterns.md +314 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +75 -283
- moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +97 -252
- moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +64 -240
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +331 -12
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +330 -37
- moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +90 -287
- moai_adk/templates/.claude/skills/moai-platform-auth0/SKILL.md +200 -206
- moai_adk/templates/.claude/skills/moai-platform-auth0/examples.md +2446 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/adaptive-mfa.md +233 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/akamai-integration.md +214 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/application-credentials.md +280 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/attack-protection-log-events.md +224 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/attack-protection-overview.md +140 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/bot-detection.md +144 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/breached-password-detection.md +187 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/brute-force-protection.md +189 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/certifications.md +282 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/compliance-overview.md +263 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/continuous-session-protection.md +307 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/customize-mfa.md +177 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/dpop-implementation.md +283 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/fapi-implementation.md +259 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/gdpr-compliance.md +313 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/guardian-configuration.md +269 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/highly-regulated-identity.md +272 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/jwt-fundamentals.md +248 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/mdl-verification.md +210 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/mfa-api-management.md +278 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/mfa-factors.md +226 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/mfa-overview.md +174 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/mtls-sender-constraining.md +316 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/ropg-flow-mfa.md +216 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/security-center.md +325 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/security-guidance.md +277 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/state-parameters.md +177 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/step-up-authentication.md +251 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/suspicious-ip-throttling.md +240 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/tenant-access-control.md +179 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/modules/webauthn-fido.md +235 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/reference.md +224 -0
- moai_adk/templates/.claude/skills/moai-platform-clerk/SKILL.md +75 -330
- moai_adk/templates/.claude/skills/moai-platform-clerk/examples.md +1426 -0
- moai_adk/templates/.claude/skills/moai-platform-clerk/modules/advanced-patterns.md +417 -0
- moai_adk/templates/.claude/skills/moai-platform-clerk/reference.md +273 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/SKILL.md +100 -340
- moai_adk/templates/.claude/skills/moai-platform-convex/examples.md +506 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/modules/auth-integration.md +421 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/modules/file-storage.md +474 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/modules/reactive-queries.md +302 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/modules/server-functions.md +452 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/reference.md +385 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/SKILL.md +113 -326
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/examples.md +514 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/modules/custom-claims.md +374 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/modules/phone-auth.md +372 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/modules/social-auth.md +339 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/reference.md +382 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/SKILL.md +71 -302
- moai_adk/templates/.claude/skills/moai-platform-firestore/examples.md +445 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/modules/offline-cache.md +392 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/modules/realtime-listeners.md +441 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/modules/security-rules.md +352 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/modules/transactions.md +452 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/reference.md +322 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/SKILL.md +101 -412
- moai_adk/templates/.claude/skills/moai-platform-neon/examples.md +470 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/modules/auto-scaling.md +349 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/modules/branching-workflows.md +354 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/modules/connection-pooling.md +412 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/modules/pitr-backups.md +458 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/reference.md +272 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/SKILL.md +96 -327
- moai_adk/templates/.claude/skills/moai-platform-railway/examples.md +539 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/modules/docker-deployment.md +261 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/modules/multi-service.md +291 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/modules/networking-domains.md +338 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/modules/volumes-storage.md +353 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/reference.md +374 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/SKILL.md +103 -428
- moai_adk/templates/.claude/skills/moai-platform-supabase/examples.md +502 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/auth-integration.md +384 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/edge-functions.md +371 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/postgresql-pgvector.md +231 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/realtime-presence.md +354 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/row-level-security.md +286 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/storage-cdn.md +319 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/modules/typescript-patterns.md +453 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/reference.md +284 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/SKILL.md +96 -446
- moai_adk/templates/.claude/skills/moai-platform-vercel/examples.md +502 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/modules/analytics-speed.md +348 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/modules/deployment-config.md +344 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/modules/edge-functions.md +222 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/modules/isr-caching.md +306 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/modules/kv-storage.md +399 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/reference.md +360 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/SKILL.md +193 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/examples.md +1099 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/modules/language-specific.md +307 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/modules/pattern-syntax.md +237 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/modules/refactoring-patterns.md +260 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/modules/security-rules.md +239 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/reference.md +288 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/languages/go.yml +90 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/languages/python.yml +101 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/languages/typescript.yml +83 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/quality/complexity-check.yml +94 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/quality/deprecated-apis.yml +84 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/security/secrets-detection.yml +89 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/security/sql-injection.yml +45 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/security/xss-prevention.yml +50 -0
- moai_adk/templates/.claude/skills/moai-tool-ast-grep/rules/sgconfig.yml +54 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +225 -423
- moai_adk/templates/.claude/skills/moai-workflow-loop/SKILL.md +197 -0
- moai_adk/templates/.claude/skills/moai-workflow-loop/examples.md +1063 -0
- moai_adk/templates/.claude/skills/moai-workflow-loop/reference.md +1414 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +211 -314
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +15 -43
- moai_adk/templates/.claude/skills/moai-workflow-spec/SKILL.md +119 -316
- moai_adk/templates/.claude/skills/moai-workflow-spec/modules/advanced-patterns.md +237 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +96 -203
- moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +201 -388
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +52 -3
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +263 -806
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/context7-integration.md +286 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/review-workflows.md +500 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework/relevance-analysis.md +154 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework/safety-analysis.md +148 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework/scoring-algorithms.md +196 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework/timeliness-analysis.md +168 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework/truthfulness-analysis.md +136 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework/usability-analysis.md +153 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review/trust5-framework.md +257 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +191 -1344
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/code-review/analysis-patterns.md +340 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/code-review/core-classes.md +299 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/code-review/tool-integration.md +380 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/debugging/debugging-workflows.md +451 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/debugging/error-analysis.md +442 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance/optimization-patterns.md +473 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance/profiling-techniques.md +481 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization/ai-optimization.md +241 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization/bottleneck-detection.md +397 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization/optimization-plan.md +315 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization/profiler-core.md +277 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization/real-time-monitoring.md +187 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +287 -1194
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/quality-metrics.md +415 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/refactoring/ai-workflows.md +620 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/refactoring/patterns.md +692 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/security-analysis.md +429 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +262 -1192
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/static-analysis.md +438 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd/core-classes.md +397 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7/advanced-features.md +494 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7/red-green-refactor.md +316 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7/test-generation.md +471 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7/test-patterns.md +371 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +227 -1222
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/trust5-validation.md +428 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/SKILL.md +228 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/integration-patterns.md +149 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/moai-adk-integration.md +245 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/parallel-advanced.md +310 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/parallel-development.md +202 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/parallel-workflows.md +302 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/registry-architecture.md +271 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/resource-optimization.md +300 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/tools-integration.md +280 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/troubleshooting.md +397 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/worktree-commands.md +296 -0
- moai_adk/templates/.claude/skills/moai-workflow-worktree/modules/worktree-management.md +217 -0
- moai_adk/templates/.git-hooks/pre-push +162 -59
- moai_adk/templates/.github/workflows/ci-universal.yml +934 -133
- moai_adk/templates/.gitignore +65 -107
- moai_adk/templates/.lsp.json +152 -0
- moai_adk/templates/.mcp.json +2 -20
- moai_adk/templates/.moai/announcements/en.json +18 -0
- moai_adk/templates/.moai/announcements/ja.json +18 -0
- moai_adk/templates/.moai/announcements/ko.json +18 -0
- moai_adk/templates/.moai/announcements/zh.json +18 -0
- moai_adk/templates/.moai/config/config.yaml +8 -2
- moai_adk/templates/.moai/config/multilingual-triggers.yaml +213 -0
- moai_adk/templates/.moai/config/sections/language.yaml +2 -2
- moai_adk/templates/.moai/config/sections/llm.yaml +41 -0
- moai_adk/templates/.moai/config/sections/pricing.yaml +30 -0
- moai_adk/templates/.moai/config/sections/project.yaml +2 -2
- moai_adk/templates/.moai/config/sections/quality.yaml +43 -5
- moai_adk/templates/.moai/config/sections/ralph.yaml +55 -0
- moai_adk/templates/.moai/config/sections/system.yaml +46 -1
- moai_adk/templates/.moai/config/sections/user.yaml +1 -1
- moai_adk/templates/.moai/config/statusline-config.yaml +2 -2
- moai_adk/templates/.moai/llm-configs/glm.json +22 -0
- moai_adk/templates/CLAUDE.ja.md +343 -0
- moai_adk/templates/CLAUDE.ko.md +343 -0
- moai_adk/templates/CLAUDE.md +200 -499
- moai_adk/templates/CLAUDE.zh.md +343 -0
- moai_adk/utils/common.py +37 -0
- moai_adk/version.py +1 -1
- moai_adk-1.1.0.dist-info/METADATA +2443 -0
- moai_adk-1.1.0.dist-info/RECORD +701 -0
- {moai_adk-0.34.0.dist-info → moai_adk-1.1.0.dist-info}/entry_points.txt +2 -0
- moai_adk-1.1.0.dist-info/licenses/LICENSE +99 -0
- moai_adk/core/config/auto_spec_config.py +0 -340
- moai_adk/core/hooks/post_tool_auto_spec_completion.py +0 -901
- moai_adk/core/spec/confidence_scoring.py +0 -680
- moai_adk/core/spec/ears_template_engine.py +0 -1247
- moai_adk/core/spec/quality_validator.py +0 -687
- moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +0 -670
- moai_adk/templates/.claude/agents/moai/expert-database.md +0 -777
- moai_adk/templates/.claude/agents/moai/expert-uiux.md +0 -1041
- moai_adk/templates/.claude/agents/moai/mcp-context7.md +0 -458
- moai_adk/templates/.claude/agents/moai/mcp-figma.md +0 -1607
- moai_adk/templates/.claude/agents/moai/mcp-notion.md +0 -789
- moai_adk/templates/.claude/agents/moai/mcp-playwright.md +0 -469
- moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +0 -1032
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/SKILL.md +0 -438
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/examples.md +0 -431
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/design-system-tokens.md +0 -405
- moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +0 -336
- moai_adk/templates/.claude/skills/moai-mcp-figma/SKILL.md +0 -402
- moai_adk/templates/.claude/skills/moai-mcp-figma/advanced-patterns.md +0 -607
- moai_adk/templates/.claude/skills/moai-mcp-notion/SKILL.md +0 -300
- moai_adk/templates/.claude/skills/moai-mcp-notion/advanced-patterns.md +0 -537
- moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +0 -520
- moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +0 -574
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +0 -317
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +0 -663
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +0 -190
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +0 -175
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +0 -196
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +0 -17
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +0 -158
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +0 -340
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +0 -713
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +0 -538
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +0 -1336
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +0 -730
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +0 -608
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +0 -1005
- moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +0 -436
- moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +0 -411
- moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +0 -982
- moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +0 -778
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +0 -646
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +0 -782
- moai_adk/templates/.moai/config/questions/_schema.yaml +0 -151
- moai_adk/templates/.moai/config/questions/tab0-init.yaml +0 -251
- moai_adk/templates/.moai/config/questions/tab1-user.yaml +0 -108
- moai_adk/templates/.moai/config/questions/tab2-project.yaml +0 -81
- moai_adk/templates/.moai/config/questions/tab3-git.yaml +0 -634
- moai_adk/templates/.moai/config/questions/tab4-quality.yaml +0 -170
- moai_adk/templates/.moai/config/questions/tab5-system.yaml +0 -87
- moai_adk/templates/.moai/scripts/setup-glm.py +0 -136
- moai_adk-0.34.0.dist-info/METADATA +0 -2999
- moai_adk-0.34.0.dist-info/RECORD +0 -463
- moai_adk-0.34.0.dist-info/licenses/LICENSE +0 -21
- /moai_adk/foundation/{git.py → git/__init__.py} +0 -0
- /moai_adk/templates/.claude/skills/moai-library-mermaid/{advanced-patterns.md → modules/advanced-patterns.md} +0 -0
- /moai_adk/templates/.claude/skills/moai-library-mermaid/{optimization.md → modules/optimization.md} +0 -0
- /moai_adk/templates/.claude/skills/moai-library-nextra/{optimization.md → modules/optimization.md} +0 -0
- /moai_adk/templates/.claude/skills/moai-workflow-jit-docs/{advanced-patterns.md → modules/advanced-patterns.md} +0 -0
- /moai_adk/templates/.claude/skills/moai-workflow-jit-docs/{optimization.md → modules/optimization.md} +0 -0
- /moai_adk/templates/.claude/skills/moai-workflow-testing/{advanced-patterns.md → modules/advanced-patterns.md} +0 -0
- /moai_adk/templates/.claude/skills/moai-workflow-testing/{optimization.md → modules/optimization.md} +0 -0
- /moai_adk/templates/.claude/skills/{moai-worktree → moai-workflow-worktree}/examples.md +0 -0
- /moai_adk/templates/.claude/skills/{moai-worktree → moai-workflow-worktree}/reference.md +0 -0
- {moai_adk-0.34.0.dist-info → moai_adk-1.1.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# AST-grep rule management
|
|
2
|
+
"""Rule loading and management for AST-grep analyzer.
|
|
3
|
+
|
|
4
|
+
This module provides classes for defining AST-grep rules and loading
|
|
5
|
+
them from YAML configuration files.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
import yaml
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class Rule:
|
|
19
|
+
"""AST-grep rule definition.
|
|
20
|
+
|
|
21
|
+
Represents a single AST-grep rule that can be used for pattern
|
|
22
|
+
matching and code analysis.
|
|
23
|
+
|
|
24
|
+
Attributes:
|
|
25
|
+
id: Unique identifier for the rule.
|
|
26
|
+
language: Programming language this rule applies to.
|
|
27
|
+
severity: Severity level (error, warning, info, hint).
|
|
28
|
+
message: Human-readable description of the rule.
|
|
29
|
+
pattern: AST-grep pattern to match.
|
|
30
|
+
fix: Optional fix pattern for automatic correction.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
id: str
|
|
34
|
+
language: str
|
|
35
|
+
severity: str # error, warning, info, hint
|
|
36
|
+
message: str
|
|
37
|
+
pattern: str
|
|
38
|
+
fix: str | None = None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RuleLoader:
|
|
42
|
+
"""Loader for AST-grep rules from various sources.
|
|
43
|
+
|
|
44
|
+
Supports loading rules from individual YAML files, directories
|
|
45
|
+
containing multiple rule files, and built-in rule sets.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def __init__(self) -> None:
|
|
49
|
+
"""Initialize the RuleLoader."""
|
|
50
|
+
self._rules: list[Rule] = []
|
|
51
|
+
|
|
52
|
+
def load_from_file(self, config_path: str) -> list[Rule]:
|
|
53
|
+
"""Load rules from a YAML configuration file.
|
|
54
|
+
|
|
55
|
+
Supports both single-document and multi-document YAML files
|
|
56
|
+
(documents separated by ---).
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
config_path: Path to the YAML configuration file.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
List of Rule objects loaded from the file.
|
|
63
|
+
|
|
64
|
+
Raises:
|
|
65
|
+
FileNotFoundError: If the file does not exist.
|
|
66
|
+
ValueError: If the YAML content is invalid.
|
|
67
|
+
"""
|
|
68
|
+
path = Path(config_path)
|
|
69
|
+
if not path.exists():
|
|
70
|
+
raise FileNotFoundError(f"Rule file not found: {config_path}")
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
content = path.read_text()
|
|
74
|
+
documents = list(yaml.safe_load_all(content))
|
|
75
|
+
except yaml.YAMLError as e:
|
|
76
|
+
raise ValueError(f"Invalid YAML in {config_path}: {e}") from e
|
|
77
|
+
|
|
78
|
+
rules: list[Rule] = []
|
|
79
|
+
for doc in documents:
|
|
80
|
+
if doc is None:
|
|
81
|
+
continue
|
|
82
|
+
rule = self._parse_rule_document(doc)
|
|
83
|
+
if rule:
|
|
84
|
+
rules.append(rule)
|
|
85
|
+
|
|
86
|
+
self._rules.extend(rules)
|
|
87
|
+
return rules
|
|
88
|
+
|
|
89
|
+
def _parse_rule_document(self, doc: dict[str, Any]) -> Rule | None:
|
|
90
|
+
"""Parse a single rule document from YAML.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
doc: Dictionary representing a rule document.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Rule object or None if parsing fails.
|
|
97
|
+
"""
|
|
98
|
+
if not isinstance(doc, dict):
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
rule_id = doc.get("id")
|
|
102
|
+
language = doc.get("language")
|
|
103
|
+
severity = doc.get("severity", "warning")
|
|
104
|
+
message = doc.get("message", "")
|
|
105
|
+
|
|
106
|
+
# Extract pattern from rule.pattern or direct pattern field
|
|
107
|
+
pattern = None
|
|
108
|
+
if "rule" in doc and isinstance(doc["rule"], dict):
|
|
109
|
+
pattern = doc["rule"].get("pattern")
|
|
110
|
+
elif "pattern" in doc:
|
|
111
|
+
pattern = doc["pattern"]
|
|
112
|
+
|
|
113
|
+
# Extract fix if present
|
|
114
|
+
fix = doc.get("fix")
|
|
115
|
+
|
|
116
|
+
if not rule_id or not language or not pattern:
|
|
117
|
+
return None
|
|
118
|
+
|
|
119
|
+
return Rule(
|
|
120
|
+
id=rule_id,
|
|
121
|
+
language=language,
|
|
122
|
+
severity=severity,
|
|
123
|
+
message=message,
|
|
124
|
+
pattern=pattern,
|
|
125
|
+
fix=fix,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
def load_builtin_rules(self) -> list[Rule]:
|
|
129
|
+
"""Load built-in rules.
|
|
130
|
+
|
|
131
|
+
Returns the default set of rules bundled with the analyzer.
|
|
132
|
+
Currently returns an empty list; built-in rules can be added
|
|
133
|
+
in future versions.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
List of built-in Rule objects.
|
|
137
|
+
"""
|
|
138
|
+
# Built-in rules can be defined here or loaded from bundled files
|
|
139
|
+
builtin_rules: list[Rule] = []
|
|
140
|
+
self._rules.extend(builtin_rules)
|
|
141
|
+
return builtin_rules
|
|
142
|
+
|
|
143
|
+
def get_rules_for_language(self, language: str) -> list[Rule]:
|
|
144
|
+
"""Get all rules for a specific programming language.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
language: The programming language to filter by.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
List of Rule objects for the specified language.
|
|
151
|
+
"""
|
|
152
|
+
return [rule for rule in self._rules if rule.language == language]
|
|
153
|
+
|
|
154
|
+
def load_from_directory(self, directory_path: str) -> list[Rule]:
|
|
155
|
+
"""Load rules from all YAML files in a directory.
|
|
156
|
+
|
|
157
|
+
Scans the directory for .yml and .yaml files and loads rules
|
|
158
|
+
from each one.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
directory_path: Path to the directory containing rule files.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
List of all Rule objects loaded from the directory.
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
FileNotFoundError: If the directory does not exist.
|
|
168
|
+
"""
|
|
169
|
+
path = Path(directory_path)
|
|
170
|
+
if not path.exists():
|
|
171
|
+
raise FileNotFoundError(f"Directory not found: {directory_path}")
|
|
172
|
+
|
|
173
|
+
rules: list[Rule] = []
|
|
174
|
+
for yaml_file in path.glob("*.yml"):
|
|
175
|
+
rules.extend(self.load_from_file(str(yaml_file)))
|
|
176
|
+
for yaml_file in path.glob("*.yaml"):
|
|
177
|
+
rules.extend(self.load_from_file(str(yaml_file)))
|
|
178
|
+
|
|
179
|
+
return rules
|
moai_adk/cli/commands/analyze.py
CHANGED
|
@@ -5,6 +5,8 @@ Analyze command for MoAI-ADK
|
|
|
5
5
|
Analyze Claude Code sessions and generate improvement suggestions.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
8
10
|
from pathlib import Path
|
|
9
11
|
from typing import Optional
|
|
10
12
|
|
|
@@ -14,7 +16,12 @@ from rich.table import Table
|
|
|
14
16
|
|
|
15
17
|
from moai_adk.core.analysis.session_analyzer import SessionAnalyzer
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
# Force UTF-8 encoding for Windows compatibility
|
|
20
|
+
# Windows PowerShell/Console uses 'charmap' by default, which can't encode emojis
|
|
21
|
+
if sys.platform == "win32":
|
|
22
|
+
console = Console(force_terminal=True, legacy_windows=False)
|
|
23
|
+
else:
|
|
24
|
+
console = Console()
|
|
18
25
|
|
|
19
26
|
|
|
20
27
|
@click.command()
|
|
@@ -47,7 +54,9 @@ def analyze(
|
|
|
47
54
|
moai-adk analyze session --output /path/to/report.md
|
|
48
55
|
"""
|
|
49
56
|
if project_path is None:
|
|
50
|
-
project_path = Path.
|
|
57
|
+
project_path = Path(os.getcwd())
|
|
58
|
+
elif isinstance(project_path, str):
|
|
59
|
+
project_path = Path(project_path)
|
|
51
60
|
|
|
52
61
|
# Validate project path
|
|
53
62
|
if not (project_path / ".moai").exists():
|
moai_adk/cli/commands/doctor.py
CHANGED
|
@@ -33,6 +33,7 @@ System diagnostics command:
|
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
35
|
import json
|
|
36
|
+
import sys
|
|
36
37
|
from pathlib import Path
|
|
37
38
|
|
|
38
39
|
import click
|
|
@@ -43,7 +44,12 @@ from rich.table import Table
|
|
|
43
44
|
from moai_adk.core.project.checker import SystemChecker, check_environment
|
|
44
45
|
from moai_adk.core.project.detector import detect_project_language
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
# Force UTF-8 encoding for Windows compatibility
|
|
48
|
+
# Windows PowerShell/Console uses 'charmap' by default, which can't encode emojis
|
|
49
|
+
if sys.platform == "win32":
|
|
50
|
+
console = Console(force_terminal=True, legacy_windows=False)
|
|
51
|
+
else:
|
|
52
|
+
console = Console()
|
|
47
53
|
|
|
48
54
|
|
|
49
55
|
@click.command()
|
moai_adk/cli/commands/init.py
CHANGED
|
@@ -27,6 +27,8 @@ Project initialization command (interactive/non-interactive):
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
import json
|
|
30
|
+
import os
|
|
31
|
+
import sys
|
|
30
32
|
from pathlib import Path
|
|
31
33
|
from typing import Sequence
|
|
32
34
|
|
|
@@ -44,7 +46,12 @@ from moai_adk.statusline.version_reader import (
|
|
|
44
46
|
)
|
|
45
47
|
from moai_adk.utils.banner import print_banner, print_welcome_message
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
# Force UTF-8 encoding for Windows compatibility
|
|
50
|
+
# Windows PowerShell/Console uses 'charmap' by default, which can't encode emojis
|
|
51
|
+
if sys.platform == "win32":
|
|
52
|
+
console = Console(force_terminal=True, legacy_windows=False)
|
|
53
|
+
else:
|
|
54
|
+
console = Console()
|
|
48
55
|
|
|
49
56
|
|
|
50
57
|
def create_progress_callback(progress: Progress, task_ids: Sequence[TaskID]):
|
|
@@ -151,11 +158,28 @@ def init(
|
|
|
151
158
|
custom_language = None
|
|
152
159
|
|
|
153
160
|
# 3. Interactive vs Non-Interactive
|
|
161
|
+
# Default values for new settings (GLM-only simplified flow)
|
|
162
|
+
user_name = ""
|
|
163
|
+
service_type = "glm" # Always GLM
|
|
164
|
+
pricing_plan = None # Not used in GLM-only flow
|
|
165
|
+
glm_pricing_plan = "basic" # Default GLM pricing plan
|
|
166
|
+
anthropic_api_key = None # Not used in GLM-only flow
|
|
167
|
+
glm_api_key = None
|
|
168
|
+
git_mode = "manual"
|
|
169
|
+
github_username = None
|
|
170
|
+
git_commit_lang = "en"
|
|
171
|
+
code_comment_lang = "en"
|
|
172
|
+
doc_lang = "en"
|
|
173
|
+
tag_enabled = True # NEW - SPEC-TAG-002
|
|
174
|
+
tag_mode = "warn" # NEW - SPEC-TAG-002
|
|
175
|
+
|
|
154
176
|
if non_interactive:
|
|
155
177
|
# Non-Interactive Mode
|
|
156
178
|
console.print(f"\n[cyan]🚀 Initializing project at {project_path}...[/cyan]\n")
|
|
157
179
|
project_name = project_path.name if is_current_dir else path
|
|
158
180
|
locale = locale or "en"
|
|
181
|
+
# Read GLM API key from environment variable in non-interactive mode
|
|
182
|
+
glm_api_key = os.getenv("MOAI_GLM_API_KEY") or os.getenv("GLM_API_KEY")
|
|
159
183
|
# Language detection happens in /moai:0-project, so default to None here
|
|
160
184
|
# This will become "generic" internally, but Summary will show more helpful message
|
|
161
185
|
if not language:
|
|
@@ -164,7 +188,7 @@ def init(
|
|
|
164
188
|
# Interactive Mode
|
|
165
189
|
print_welcome_message()
|
|
166
190
|
|
|
167
|
-
# Interactive prompt
|
|
191
|
+
# Interactive prompt with simplified GLM-only flow
|
|
168
192
|
answers = prompt_project_setup(
|
|
169
193
|
project_name=None if is_current_dir else path,
|
|
170
194
|
is_current_dir=is_current_dir,
|
|
@@ -172,18 +196,33 @@ def init(
|
|
|
172
196
|
initial_locale=locale,
|
|
173
197
|
)
|
|
174
198
|
|
|
175
|
-
#
|
|
176
|
-
mode = answers["mode"]
|
|
199
|
+
# Extract answers (GLM-only flow)
|
|
177
200
|
locale = answers["locale"]
|
|
178
|
-
|
|
201
|
+
user_name = answers["user_name"]
|
|
179
202
|
project_name = answers["project_name"]
|
|
180
|
-
|
|
203
|
+
glm_api_key = answers["glm_api_key"]
|
|
204
|
+
git_mode = answers["git_mode"]
|
|
205
|
+
github_username = answers["github_username"]
|
|
206
|
+
git_commit_lang = answers["git_commit_lang"]
|
|
207
|
+
code_comment_lang = answers["code_comment_lang"]
|
|
208
|
+
doc_lang = answers["doc_lang"]
|
|
209
|
+
tag_enabled = answers["tag_enabled"] # NEW - SPEC-TAG-002
|
|
210
|
+
tag_mode = answers["tag_mode"] # NEW - SPEC-TAG-002
|
|
211
|
+
|
|
212
|
+
# GLM-only defaults (not prompted in simplified flow)
|
|
213
|
+
service_type = "glm"
|
|
214
|
+
glm_pricing_plan = "basic"
|
|
215
|
+
pricing_plan = None
|
|
216
|
+
anthropic_api_key = None
|
|
217
|
+
|
|
218
|
+
# Map git_mode to mode for backward compatibility
|
|
219
|
+
mode = "personal" if git_mode in ("personal", "team") else "personal"
|
|
220
|
+
|
|
221
|
+
# Language detection happens in /moai:0-project
|
|
222
|
+
language = None
|
|
181
223
|
|
|
182
224
|
console.print("\n[cyan]🚀 Starting installation...[/cyan]\n")
|
|
183
225
|
|
|
184
|
-
if locale is None:
|
|
185
|
-
locale = answers["locale"]
|
|
186
|
-
|
|
187
226
|
# 4. Check for reinitialization (SPEC-INIT-003 v0.3.0) - DEFAULT TO FORCE MODE
|
|
188
227
|
initializer = ProjectInitializer(project_path)
|
|
189
228
|
|
|
@@ -200,7 +239,9 @@ def init(
|
|
|
200
239
|
# Always allow reinit (force mode by default)
|
|
201
240
|
is_reinit = initializer.is_initialized()
|
|
202
241
|
|
|
203
|
-
# Reinit mode:
|
|
242
|
+
# Reinit mode: update configuration files (v0.3.1+)
|
|
243
|
+
# As of v0.37.0, we use section YAML files (.moai/config/sections/)
|
|
244
|
+
# but still support legacy config.yaml and config.json for backward compatibility
|
|
204
245
|
if is_reinit:
|
|
205
246
|
# Migration: Remove old hook files (Issue #163)
|
|
206
247
|
old_hook_files = [
|
|
@@ -215,6 +256,7 @@ def init(
|
|
|
215
256
|
pass # Ignore removal failures
|
|
216
257
|
|
|
217
258
|
# Support both YAML (v0.32.5+) and JSON (legacy) config files
|
|
259
|
+
# New projects use section files; legacy projects may still have config.yaml/json
|
|
218
260
|
config_yaml_path = project_path / ".moai" / "config" / "config.yaml"
|
|
219
261
|
config_json_path = project_path / ".moai" / "config" / "config.json"
|
|
220
262
|
|
|
@@ -254,7 +296,11 @@ def init(
|
|
|
254
296
|
with open(config_path, "w", encoding="utf-8") as f:
|
|
255
297
|
if is_yaml:
|
|
256
298
|
yaml.safe_dump(
|
|
257
|
-
config_data,
|
|
299
|
+
config_data,
|
|
300
|
+
f,
|
|
301
|
+
default_flow_style=False,
|
|
302
|
+
allow_unicode=True,
|
|
303
|
+
sort_keys=False,
|
|
258
304
|
)
|
|
259
305
|
else:
|
|
260
306
|
json.dump(config_data, f, indent=2, ensure_ascii=False)
|
|
@@ -288,8 +334,36 @@ def init(
|
|
|
288
334
|
backup_enabled=True,
|
|
289
335
|
progress_callback=callback,
|
|
290
336
|
reinit=True, # Always allow reinit (force mode by default)
|
|
337
|
+
tag_enabled=tag_enabled, # NEW - SPEC-TAG-002
|
|
338
|
+
tag_mode=tag_mode, # NEW - SPEC-TAG-002
|
|
291
339
|
)
|
|
292
340
|
|
|
341
|
+
# 5.5. Save additional configuration (both interactive and non-interactive)
|
|
342
|
+
if result.success:
|
|
343
|
+
# In non-interactive mode, only save API keys if provided via environment
|
|
344
|
+
if non_interactive:
|
|
345
|
+
# Only save GLM key if provided via environment variable
|
|
346
|
+
if glm_api_key:
|
|
347
|
+
_save_glm_key(glm_api_key)
|
|
348
|
+
else:
|
|
349
|
+
# Interactive mode: save all additional config
|
|
350
|
+
_save_additional_config(
|
|
351
|
+
project_path=project_path,
|
|
352
|
+
project_name=project_name,
|
|
353
|
+
locale=locale,
|
|
354
|
+
user_name=user_name,
|
|
355
|
+
service_type=service_type,
|
|
356
|
+
pricing_plan=pricing_plan,
|
|
357
|
+
glm_pricing_plan=glm_pricing_plan,
|
|
358
|
+
anthropic_api_key=anthropic_api_key,
|
|
359
|
+
glm_api_key=glm_api_key,
|
|
360
|
+
git_mode=git_mode,
|
|
361
|
+
github_username=github_username,
|
|
362
|
+
git_commit_lang=git_commit_lang,
|
|
363
|
+
code_comment_lang=code_comment_lang,
|
|
364
|
+
doc_lang=doc_lang,
|
|
365
|
+
)
|
|
366
|
+
|
|
293
367
|
# 6. Output results
|
|
294
368
|
if result.success:
|
|
295
369
|
separator = "[dim]" + ("─" * 60) + "[/dim]"
|
|
@@ -348,6 +422,14 @@ def init(
|
|
|
348
422
|
console.print(" [blue]3.[/blue] Start developing with MoAI-ADK!\n")
|
|
349
423
|
else:
|
|
350
424
|
console.print(" [blue]2.[/blue] Start developing with MoAI-ADK!\n")
|
|
425
|
+
|
|
426
|
+
# Prompt for MoAI Rank hook installation if eligible
|
|
427
|
+
try:
|
|
428
|
+
from moai_adk.rank.hook import prompt_hook_installation
|
|
429
|
+
|
|
430
|
+
prompt_hook_installation(console=console)
|
|
431
|
+
except ImportError:
|
|
432
|
+
pass # rank module not available
|
|
351
433
|
else:
|
|
352
434
|
console.print("\n[red bold]❌ Initialization Failed![/red bold]")
|
|
353
435
|
if result.errors:
|
|
@@ -370,3 +452,231 @@ def init(
|
|
|
370
452
|
finally:
|
|
371
453
|
# Explicitly flush output buffer
|
|
372
454
|
console.file.flush()
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def _save_glm_key(glm_api_key: str) -> None:
|
|
458
|
+
"""Save GLM API key to .env.glm file.
|
|
459
|
+
|
|
460
|
+
Args:
|
|
461
|
+
glm_api_key: The GLM API key to save
|
|
462
|
+
"""
|
|
463
|
+
import os
|
|
464
|
+
|
|
465
|
+
from moai_adk.core.credentials import (
|
|
466
|
+
get_env_glm_path,
|
|
467
|
+
remove_glm_key_from_shell_config,
|
|
468
|
+
save_glm_key_to_env,
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
save_glm_key_to_env(glm_api_key)
|
|
472
|
+
console.print(f"[green]✓[/green] GLM API key saved to [cyan]{get_env_glm_path()}[/cyan]")
|
|
473
|
+
|
|
474
|
+
# Automatically remove GLM_API_KEY from shell config if present
|
|
475
|
+
if os.environ.get("GLM_API_KEY"):
|
|
476
|
+
results = remove_glm_key_from_shell_config()
|
|
477
|
+
modified = [name for name, mod in results.items() if mod]
|
|
478
|
+
if modified:
|
|
479
|
+
files_str = ", ~/.".join(modified)
|
|
480
|
+
console.print(f"[green]✓[/green] Removed GLM_API_KEY from: [cyan]~/.{files_str}[/cyan]")
|
|
481
|
+
console.print("[dim]Backup: .moai-backup | Run 'source ~/.zshrc' to apply[/dim]")
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def _save_additional_config(
|
|
485
|
+
project_path: Path,
|
|
486
|
+
project_name: str,
|
|
487
|
+
locale: str,
|
|
488
|
+
user_name: str,
|
|
489
|
+
service_type: str,
|
|
490
|
+
pricing_plan: str | None,
|
|
491
|
+
glm_pricing_plan: str | None,
|
|
492
|
+
anthropic_api_key: str | None,
|
|
493
|
+
glm_api_key: str | None,
|
|
494
|
+
git_mode: str,
|
|
495
|
+
github_username: str | None,
|
|
496
|
+
git_commit_lang: str,
|
|
497
|
+
code_comment_lang: str,
|
|
498
|
+
doc_lang: str,
|
|
499
|
+
) -> None:
|
|
500
|
+
"""Save additional configuration from interactive mode.
|
|
501
|
+
|
|
502
|
+
Args:
|
|
503
|
+
project_path: Project directory path
|
|
504
|
+
project_name: Project name
|
|
505
|
+
locale: Conversation language (ko, en, ja, zh)
|
|
506
|
+
user_name: User name for personalization (can be empty)
|
|
507
|
+
service_type: Service type (claude_subscription, claude_api, glm, hybrid)
|
|
508
|
+
pricing_plan: Claude pricing plan (pro, max5, max20)
|
|
509
|
+
glm_pricing_plan: GLM pricing plan (basic, glm_pro, enterprise)
|
|
510
|
+
anthropic_api_key: Anthropic API key (if provided)
|
|
511
|
+
glm_api_key: GLM API key (if provided)
|
|
512
|
+
git_mode: Git mode (manual, personal, team)
|
|
513
|
+
github_username: GitHub username (if provided)
|
|
514
|
+
git_commit_lang: Commit message language
|
|
515
|
+
code_comment_lang: Code comment language
|
|
516
|
+
doc_lang: Documentation language
|
|
517
|
+
"""
|
|
518
|
+
sections_dir = project_path / ".moai" / "config" / "sections"
|
|
519
|
+
# Ensure sections directory exists
|
|
520
|
+
sections_dir.mkdir(parents=True, exist_ok=True)
|
|
521
|
+
|
|
522
|
+
# 1. Save API keys to global locations
|
|
523
|
+
# Anthropic key → ~/.moai/credentials.yaml
|
|
524
|
+
# GLM key → ~/.moai/.env.glm (new dotenv format)
|
|
525
|
+
if anthropic_api_key:
|
|
526
|
+
from moai_adk.core.credentials import save_credentials
|
|
527
|
+
|
|
528
|
+
save_credentials(
|
|
529
|
+
anthropic_api_key=anthropic_api_key,
|
|
530
|
+
merge=True, # Preserve existing keys
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
if glm_api_key:
|
|
534
|
+
import os
|
|
535
|
+
|
|
536
|
+
from moai_adk.core.credentials import (
|
|
537
|
+
get_env_glm_path,
|
|
538
|
+
remove_glm_key_from_shell_config,
|
|
539
|
+
save_glm_key_to_env,
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
save_glm_key_to_env(glm_api_key)
|
|
543
|
+
console.print(f"[green]✓[/green] GLM API key saved to [cyan]{get_env_glm_path()}[/cyan]")
|
|
544
|
+
|
|
545
|
+
# Automatically remove GLM_API_KEY from shell config if present
|
|
546
|
+
if os.environ.get("GLM_API_KEY"):
|
|
547
|
+
results = remove_glm_key_from_shell_config()
|
|
548
|
+
modified = [name for name, mod in results.items() if mod]
|
|
549
|
+
if modified:
|
|
550
|
+
files_str = ", ~/.".join(modified)
|
|
551
|
+
console.print(f"[green]✓[/green] Removed GLM_API_KEY from: [cyan]~/.{files_str}[/cyan]")
|
|
552
|
+
console.print("[dim]Backup: .moai-backup | Run 'source ~/.zshrc' to apply[/dim]")
|
|
553
|
+
|
|
554
|
+
# 2. Save service/pricing to pricing.yaml
|
|
555
|
+
pricing_path = sections_dir / "pricing.yaml"
|
|
556
|
+
if pricing_path.exists():
|
|
557
|
+
try:
|
|
558
|
+
pricing_data = yaml.safe_load(pricing_path.read_text()) or {}
|
|
559
|
+
except Exception:
|
|
560
|
+
pricing_data = {}
|
|
561
|
+
else:
|
|
562
|
+
pricing_data = {}
|
|
563
|
+
|
|
564
|
+
if "service" not in pricing_data:
|
|
565
|
+
pricing_data["service"] = {}
|
|
566
|
+
|
|
567
|
+
pricing_data["service"]["type"] = service_type
|
|
568
|
+
if pricing_plan:
|
|
569
|
+
pricing_data["service"]["claude_pricing_plan"] = pricing_plan
|
|
570
|
+
if glm_pricing_plan:
|
|
571
|
+
pricing_data["service"]["glm_pricing_plan"] = glm_pricing_plan
|
|
572
|
+
|
|
573
|
+
with open(pricing_path, "w", encoding="utf-8") as f:
|
|
574
|
+
yaml.safe_dump(
|
|
575
|
+
pricing_data,
|
|
576
|
+
f,
|
|
577
|
+
default_flow_style=False,
|
|
578
|
+
allow_unicode=True,
|
|
579
|
+
sort_keys=False,
|
|
580
|
+
)
|
|
581
|
+
|
|
582
|
+
# 3. Update language.yaml with output language settings
|
|
583
|
+
language_path = sections_dir / "language.yaml"
|
|
584
|
+
if language_path.exists():
|
|
585
|
+
try:
|
|
586
|
+
lang_data = yaml.safe_load(language_path.read_text()) or {}
|
|
587
|
+
except Exception:
|
|
588
|
+
lang_data = {}
|
|
589
|
+
else:
|
|
590
|
+
lang_data = {}
|
|
591
|
+
|
|
592
|
+
if "language" not in lang_data:
|
|
593
|
+
lang_data["language"] = {}
|
|
594
|
+
|
|
595
|
+
# Conversation language mapping
|
|
596
|
+
locale_names = {
|
|
597
|
+
"ko": "Korean (한국어)",
|
|
598
|
+
"en": "English",
|
|
599
|
+
"ja": "Japanese (日本語)",
|
|
600
|
+
"zh": "Chinese (中文)",
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
lang_data["language"]["conversation_language"] = locale
|
|
604
|
+
lang_data["language"]["conversation_language_name"] = locale_names.get(locale, "English")
|
|
605
|
+
lang_data["language"]["git_commit_messages"] = git_commit_lang
|
|
606
|
+
lang_data["language"]["code_comments"] = code_comment_lang
|
|
607
|
+
lang_data["language"]["documentation"] = doc_lang
|
|
608
|
+
|
|
609
|
+
with open(language_path, "w", encoding="utf-8") as f:
|
|
610
|
+
yaml.safe_dump(lang_data, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
611
|
+
|
|
612
|
+
# 4. Update git-strategy.yaml with git mode
|
|
613
|
+
git_path = sections_dir / "git-strategy.yaml"
|
|
614
|
+
if git_path.exists():
|
|
615
|
+
try:
|
|
616
|
+
git_data = yaml.safe_load(git_path.read_text()) or {}
|
|
617
|
+
except Exception:
|
|
618
|
+
git_data = {}
|
|
619
|
+
else:
|
|
620
|
+
git_data = {}
|
|
621
|
+
|
|
622
|
+
if "git_strategy" not in git_data:
|
|
623
|
+
git_data["git_strategy"] = {}
|
|
624
|
+
|
|
625
|
+
git_data["git_strategy"]["mode"] = git_mode
|
|
626
|
+
|
|
627
|
+
with open(git_path, "w", encoding="utf-8") as f:
|
|
628
|
+
yaml.safe_dump(git_data, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
629
|
+
|
|
630
|
+
# 5. Update project.yaml with project name and GitHub username
|
|
631
|
+
project_yaml_path = sections_dir / "project.yaml"
|
|
632
|
+
if project_yaml_path.exists():
|
|
633
|
+
try:
|
|
634
|
+
project_data = yaml.safe_load(project_yaml_path.read_text()) or {}
|
|
635
|
+
except Exception:
|
|
636
|
+
project_data = {}
|
|
637
|
+
else:
|
|
638
|
+
project_data = {}
|
|
639
|
+
|
|
640
|
+
# Save project name
|
|
641
|
+
if "project" not in project_data:
|
|
642
|
+
project_data["project"] = {}
|
|
643
|
+
project_data["project"]["name"] = project_name
|
|
644
|
+
|
|
645
|
+
# Save GitHub username if provided
|
|
646
|
+
if github_username:
|
|
647
|
+
if "github" not in project_data:
|
|
648
|
+
project_data["github"] = {}
|
|
649
|
+
project_data["github"]["profile_name"] = github_username
|
|
650
|
+
|
|
651
|
+
with open(project_yaml_path, "w", encoding="utf-8") as f:
|
|
652
|
+
yaml.safe_dump(
|
|
653
|
+
project_data,
|
|
654
|
+
f,
|
|
655
|
+
default_flow_style=False,
|
|
656
|
+
allow_unicode=True,
|
|
657
|
+
sort_keys=False,
|
|
658
|
+
)
|
|
659
|
+
|
|
660
|
+
# 6. Update user.yaml with user name
|
|
661
|
+
user_yaml_path = sections_dir / "user.yaml"
|
|
662
|
+
if user_yaml_path.exists():
|
|
663
|
+
try:
|
|
664
|
+
user_data = yaml.safe_load(user_yaml_path.read_text()) or {}
|
|
665
|
+
except Exception:
|
|
666
|
+
user_data = {}
|
|
667
|
+
else:
|
|
668
|
+
user_data = {}
|
|
669
|
+
|
|
670
|
+
if "user" not in user_data:
|
|
671
|
+
user_data["user"] = {}
|
|
672
|
+
|
|
673
|
+
user_data["user"]["name"] = user_name
|
|
674
|
+
|
|
675
|
+
with open(user_yaml_path, "w", encoding="utf-8") as f:
|
|
676
|
+
yaml.safe_dump(
|
|
677
|
+
user_data,
|
|
678
|
+
f,
|
|
679
|
+
default_flow_style=False,
|
|
680
|
+
allow_unicode=True,
|
|
681
|
+
sort_keys=False,
|
|
682
|
+
)
|
|
@@ -5,6 +5,7 @@ and multilingual content generation.
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import json
|
|
8
|
+
import sys
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
|
|
10
11
|
import click
|
|
@@ -20,7 +21,12 @@ from ...core.language_config import (
|
|
|
20
21
|
)
|
|
21
22
|
from ...core.template_engine import TemplateEngine
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
# Force UTF-8 encoding for Windows compatibility
|
|
25
|
+
# Windows PowerShell/Console uses 'charmap' by default, which can't encode emojis
|
|
26
|
+
if sys.platform == "win32":
|
|
27
|
+
console = Console(force_terminal=True, legacy_windows=False)
|
|
28
|
+
else:
|
|
29
|
+
console = Console()
|
|
24
30
|
|
|
25
31
|
|
|
26
32
|
@click.group()
|