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
|
@@ -14,13 +14,54 @@ Enhanced Features:
|
|
|
14
14
|
- Risk assessment with performance metrics
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
17
19
|
import json
|
|
18
20
|
import logging
|
|
19
21
|
import sys
|
|
20
22
|
from datetime import datetime
|
|
21
23
|
from pathlib import Path
|
|
22
|
-
from typing import Any
|
|
24
|
+
from typing import Any
|
|
23
25
|
|
|
26
|
+
# =============================================================================
|
|
27
|
+
# Windows UTF-8 Encoding Fix (Issue #249)
|
|
28
|
+
# Ensures emoji characters are properly displayed on Windows terminals
|
|
29
|
+
# =============================================================================
|
|
30
|
+
if sys.platform == "win32":
|
|
31
|
+
try:
|
|
32
|
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
33
|
+
sys.stderr.reconfigure(encoding="utf-8", errors="replace")
|
|
34
|
+
except (AttributeError, OSError):
|
|
35
|
+
# Python < 3.7 or reconfigure not available
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
# =============================================================================
|
|
39
|
+
# Constants - Risk Assessment Thresholds
|
|
40
|
+
# =============================================================================
|
|
41
|
+
# These thresholds determine project risk level based on various factors
|
|
42
|
+
RISK_SCORE_HIGH = 20 # Score >= this is HIGH risk
|
|
43
|
+
RISK_SCORE_MEDIUM = 10 # Score >= this (and < HIGH) is MEDIUM risk
|
|
44
|
+
|
|
45
|
+
# Git changes thresholds for risk calculation
|
|
46
|
+
GIT_CHANGES_HIGH_THRESHOLD = 20 # Adds 10 to risk score
|
|
47
|
+
GIT_CHANGES_MEDIUM_THRESHOLD = 10 # Adds 5 to risk score
|
|
48
|
+
|
|
49
|
+
# SPEC progress thresholds
|
|
50
|
+
SPEC_PROGRESS_LOW = 50 # Below this adds 15 to risk score
|
|
51
|
+
SPEC_PROGRESS_MEDIUM = 80 # Below this adds 8 to risk score
|
|
52
|
+
|
|
53
|
+
# Risk score contributions
|
|
54
|
+
RISK_GIT_CHANGES_HIGH = 10
|
|
55
|
+
RISK_GIT_CHANGES_MEDIUM = 5
|
|
56
|
+
RISK_SPEC_LOW = 15
|
|
57
|
+
RISK_SPEC_MEDIUM = 8
|
|
58
|
+
RISK_TEST_FAILED = 12
|
|
59
|
+
RISK_COVERAGE_UNKNOWN = 5
|
|
60
|
+
|
|
61
|
+
# Setup message suppression period (days)
|
|
62
|
+
SETUP_MESSAGE_RESCAN_DAYS = 7
|
|
63
|
+
|
|
64
|
+
# =============================================================================
|
|
24
65
|
# Setup import path for shared modules
|
|
25
66
|
HOOKS_DIR = Path(__file__).parent
|
|
26
67
|
LIB_DIR = HOOKS_DIR / "lib"
|
|
@@ -28,6 +69,7 @@ if str(LIB_DIR) not in sys.path:
|
|
|
28
69
|
sys.path.insert(0, str(LIB_DIR))
|
|
29
70
|
|
|
30
71
|
# Import path utils for project root resolution
|
|
72
|
+
from lib.file_utils import check_file_size # noqa: E402
|
|
31
73
|
from lib.path_utils import find_project_root # noqa: E402
|
|
32
74
|
|
|
33
75
|
# Import unified timeout manager and Git operations manager
|
|
@@ -98,10 +140,10 @@ except ImportError:
|
|
|
98
140
|
|
|
99
141
|
Handles:
|
|
100
142
|
- Top-level keys with nested values
|
|
101
|
-
- String values (quoted or unquoted)
|
|
143
|
+
- String values (quoted or unquoted, including empty strings)
|
|
102
144
|
- Boolean values (true/false)
|
|
103
145
|
- Numeric values
|
|
104
|
-
- Comments (lines starting with #)
|
|
146
|
+
- Comments (lines starting with # or inline after values)
|
|
105
147
|
|
|
106
148
|
Does NOT handle:
|
|
107
149
|
- Lists
|
|
@@ -127,18 +169,39 @@ except ImportError:
|
|
|
127
169
|
key = key_part.strip()
|
|
128
170
|
value = value_part.strip()
|
|
129
171
|
|
|
130
|
-
#
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
172
|
+
# Track if value was explicitly quoted (including empty strings)
|
|
173
|
+
was_quoted = False
|
|
174
|
+
|
|
175
|
+
# Handle quoted strings first - extract value within quotes
|
|
176
|
+
if value.startswith('"'):
|
|
177
|
+
# Find the closing quote
|
|
178
|
+
close_quote = value.find('"', 1)
|
|
179
|
+
if close_quote > 0:
|
|
180
|
+
value = value[1:close_quote]
|
|
181
|
+
was_quoted = True
|
|
182
|
+
elif value == '""':
|
|
183
|
+
# Handle explicit empty string ""
|
|
184
|
+
value = ""
|
|
185
|
+
was_quoted = True
|
|
186
|
+
elif value.startswith("'"):
|
|
187
|
+
# Find the closing quote
|
|
188
|
+
close_quote = value.find("'", 1)
|
|
189
|
+
if close_quote > 0:
|
|
190
|
+
value = value[1:close_quote]
|
|
191
|
+
was_quoted = True
|
|
192
|
+
elif value == "''":
|
|
193
|
+
# Handle explicit empty string ''
|
|
194
|
+
value = ""
|
|
195
|
+
was_quoted = True
|
|
196
|
+
else:
|
|
197
|
+
# Remove inline comments for unquoted values
|
|
198
|
+
if "#" in value:
|
|
199
|
+
value = value.split("#")[0].strip()
|
|
137
200
|
|
|
138
201
|
# Top-level key (no indentation or minimal indentation)
|
|
139
202
|
if indent == 0:
|
|
140
|
-
if value:
|
|
141
|
-
# Simple key: value
|
|
203
|
+
if value or was_quoted:
|
|
204
|
+
# Simple key: value (including empty quoted strings)
|
|
142
205
|
result[key] = _parse_simple_value(value)
|
|
143
206
|
else:
|
|
144
207
|
# Section header (e.g., "user:", "language:")
|
|
@@ -146,10 +209,11 @@ except ImportError:
|
|
|
146
209
|
result[current_section] = {}
|
|
147
210
|
elif current_section and indent > 0:
|
|
148
211
|
# Nested key under current section
|
|
149
|
-
if value:
|
|
212
|
+
if value or was_quoted:
|
|
213
|
+
# Store value (including empty quoted strings)
|
|
150
214
|
result[current_section][key] = _parse_simple_value(value)
|
|
151
215
|
else:
|
|
152
|
-
# Nested section (2-level nesting)
|
|
216
|
+
# Nested section (2-level nesting) - only when no value at all
|
|
153
217
|
result[current_section][key] = {}
|
|
154
218
|
|
|
155
219
|
return result
|
|
@@ -189,6 +253,13 @@ except ImportError:
|
|
|
189
253
|
"""Load a YAML file using PyYAML or simple parser."""
|
|
190
254
|
if not file_path.exists():
|
|
191
255
|
return {}
|
|
256
|
+
|
|
257
|
+
# Check file size before reading (H2: 10MB limit)
|
|
258
|
+
is_safe, error_msg = check_file_size(file_path)
|
|
259
|
+
if not is_safe:
|
|
260
|
+
# File too large or other error, skip loading
|
|
261
|
+
return {}
|
|
262
|
+
|
|
192
263
|
try:
|
|
193
264
|
content = file_path.read_text(encoding="utf-8")
|
|
194
265
|
if HAS_YAML_FALLBACK:
|
|
@@ -219,9 +290,14 @@ except ImportError:
|
|
|
219
290
|
if not config:
|
|
220
291
|
json_config_path = config_dir / "config.json"
|
|
221
292
|
if json_config_path.exists():
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
293
|
+
# Check file size before reading (H2: 10MB limit)
|
|
294
|
+
is_safe, _ = check_file_size(json_config_path)
|
|
295
|
+
if is_safe:
|
|
296
|
+
try:
|
|
297
|
+
config = json.loads(json_config_path.read_text(encoding="utf-8"))
|
|
298
|
+
except (json.JSONDecodeError, OSError):
|
|
299
|
+
config = {}
|
|
300
|
+
else:
|
|
225
301
|
config = {}
|
|
226
302
|
|
|
227
303
|
# Merge section files (they take priority for their specific keys)
|
|
@@ -326,7 +402,7 @@ def should_show_setup_messages() -> bool:
|
|
|
326
402
|
# Flag is False, show messages
|
|
327
403
|
return True
|
|
328
404
|
|
|
329
|
-
# Flag is True, check time threshold
|
|
405
|
+
# Flag is True, check time threshold
|
|
330
406
|
suppressed_at_str = session_config.get("setup_messages_suppressed_at")
|
|
331
407
|
if not suppressed_at_str:
|
|
332
408
|
# No timestamp recorded, show messages
|
|
@@ -337,8 +413,8 @@ def should_show_setup_messages() -> bool:
|
|
|
337
413
|
now = datetime.now(suppressed_at.tzinfo) if suppressed_at.tzinfo else datetime.now()
|
|
338
414
|
days_passed = (now - suppressed_at).days
|
|
339
415
|
|
|
340
|
-
# Show messages if
|
|
341
|
-
return days_passed >=
|
|
416
|
+
# Show messages if threshold exceeded
|
|
417
|
+
return days_passed >= SETUP_MESSAGE_RESCAN_DAYS
|
|
342
418
|
except (ValueError, TypeError):
|
|
343
419
|
# If timestamp is invalid, show messages
|
|
344
420
|
return True
|
|
@@ -358,7 +434,7 @@ def check_git_initialized() -> bool:
|
|
|
358
434
|
return False
|
|
359
435
|
|
|
360
436
|
|
|
361
|
-
def get_git_info() ->
|
|
437
|
+
def get_git_info() -> dict[str, Any]:
|
|
362
438
|
"""Get comprehensive git information using optimized Git operations manager
|
|
363
439
|
|
|
364
440
|
FIXED: Handles git not initialized state properly
|
|
@@ -407,6 +483,7 @@ def get_git_info() -> Dict[str, Any]:
|
|
|
407
483
|
|
|
408
484
|
# Fallback to basic Git operations
|
|
409
485
|
try:
|
|
486
|
+
import concurrent.futures
|
|
410
487
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
411
488
|
|
|
412
489
|
# Define git commands to run in parallel
|
|
@@ -425,14 +502,27 @@ def get_git_info() -> Dict[str, Any]:
|
|
|
425
502
|
# Submit all tasks
|
|
426
503
|
futures = {executor.submit(_run_git_command_fallback, cmd): key for cmd, key in git_commands}
|
|
427
504
|
|
|
428
|
-
# Collect results as they complete
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
505
|
+
# Collect results as they complete with overall timeout
|
|
506
|
+
# FIX #254: Add timeout to prevent infinite waiting on stuck git operations
|
|
507
|
+
try:
|
|
508
|
+
for future in as_completed(futures, timeout=8):
|
|
509
|
+
key = futures[future]
|
|
510
|
+
try:
|
|
511
|
+
results[key] = future.result()
|
|
512
|
+
except (TimeoutError, RuntimeError):
|
|
513
|
+
# Future execution timeout or runtime errors
|
|
514
|
+
results[key] = ""
|
|
515
|
+
except concurrent.futures.TimeoutError:
|
|
516
|
+
# Overall timeout exceeded - use whatever results we have
|
|
517
|
+
logging.warning("Git operations timeout after 8 seconds - using partial results")
|
|
518
|
+
# Collect any completed futures before timeout
|
|
519
|
+
for future, key in futures.items():
|
|
520
|
+
if future.done():
|
|
521
|
+
try:
|
|
522
|
+
if key not in results:
|
|
523
|
+
results[key] = future.result()
|
|
524
|
+
except (TimeoutError, RuntimeError):
|
|
525
|
+
results[key] = ""
|
|
436
526
|
|
|
437
527
|
# Process results with proper handling for empty values
|
|
438
528
|
branch = results.get("branch", "")
|
|
@@ -628,31 +718,31 @@ def get_spec_progress() -> dict[str, Any]:
|
|
|
628
718
|
|
|
629
719
|
|
|
630
720
|
def calculate_risk(git_info: dict, spec_progress: dict, test_info: dict) -> str:
|
|
631
|
-
"""Calculate overall project risk level"""
|
|
721
|
+
"""Calculate overall project risk level using defined thresholds."""
|
|
632
722
|
risk_score = 0
|
|
633
723
|
|
|
634
724
|
# Git changes contribute to risk
|
|
635
|
-
if git_info["changes"] >
|
|
636
|
-
risk_score +=
|
|
637
|
-
elif git_info["changes"] >
|
|
638
|
-
risk_score +=
|
|
725
|
+
if git_info["changes"] > GIT_CHANGES_HIGH_THRESHOLD:
|
|
726
|
+
risk_score += RISK_GIT_CHANGES_HIGH
|
|
727
|
+
elif git_info["changes"] > GIT_CHANGES_MEDIUM_THRESHOLD:
|
|
728
|
+
risk_score += RISK_GIT_CHANGES_MEDIUM
|
|
639
729
|
|
|
640
730
|
# SPEC progress contributes to risk
|
|
641
|
-
if spec_progress["percentage"] <
|
|
642
|
-
risk_score +=
|
|
643
|
-
elif spec_progress["percentage"] <
|
|
644
|
-
risk_score +=
|
|
731
|
+
if spec_progress["percentage"] < SPEC_PROGRESS_LOW:
|
|
732
|
+
risk_score += RISK_SPEC_LOW
|
|
733
|
+
elif spec_progress["percentage"] < SPEC_PROGRESS_MEDIUM:
|
|
734
|
+
risk_score += RISK_SPEC_MEDIUM
|
|
645
735
|
|
|
646
736
|
# Test status contributes to risk
|
|
647
737
|
if test_info["status"] != "✅":
|
|
648
|
-
risk_score +=
|
|
738
|
+
risk_score += RISK_TEST_FAILED
|
|
649
739
|
elif test_info["coverage"] == "unknown":
|
|
650
|
-
risk_score +=
|
|
740
|
+
risk_score += RISK_COVERAGE_UNKNOWN
|
|
651
741
|
|
|
652
742
|
# Determine risk level
|
|
653
|
-
if risk_score >=
|
|
743
|
+
if risk_score >= RISK_SCORE_HIGH:
|
|
654
744
|
return "HIGH"
|
|
655
|
-
elif risk_score >=
|
|
745
|
+
elif risk_score >= RISK_SCORE_MEDIUM:
|
|
656
746
|
return "MEDIUM"
|
|
657
747
|
else:
|
|
658
748
|
return "LOW"
|
|
@@ -871,31 +961,35 @@ def format_session_output() -> str:
|
|
|
871
961
|
]
|
|
872
962
|
|
|
873
963
|
# FIX #5: Add personalization or setup guidance (never show template variables)
|
|
964
|
+
# Multilingual support: ko, en, ja, zh
|
|
965
|
+
conv_lang = personalization.get("conversation_language", "en")
|
|
966
|
+
|
|
874
967
|
if personalization.get("needs_setup", False):
|
|
875
968
|
# Show setup guidance (based on conversation_language)
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
"to configure your name and project settings"
|
|
885
|
-
)
|
|
969
|
+
# Guide user to generate project documentation with /moai:0-project
|
|
970
|
+
setup_messages = {
|
|
971
|
+
"ko": " 👋 환영합니다! '/moai:0-project' 명령어로 프로젝트 문서를 생성해주세요",
|
|
972
|
+
"ja": " 👋 ようこそ!'/moai:0-project' コマンドでプロジェクトドキュメントを生成してください",
|
|
973
|
+
"zh": " 👋 欢迎!请运行 '/moai:0-project' 命令生成项目文档",
|
|
974
|
+
"en": " 👋 Welcome! Please run '/moai:0-project' to generate project documentation",
|
|
975
|
+
}
|
|
976
|
+
output.append(setup_messages.get(conv_lang, setup_messages["en"]))
|
|
886
977
|
elif personalization["has_personalization"]:
|
|
887
978
|
user_greeting = personalization.get("personalized_greeting", "")
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
else
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
979
|
+
user_name = personalization.get("user_name", "")
|
|
980
|
+
display_name = user_greeting if user_greeting else user_name
|
|
981
|
+
|
|
982
|
+
# Prevent duplicate honorifics (e.g., "님님" in Korean, "さんさん" in Japanese)
|
|
983
|
+
ko_suffix = "" if display_name.endswith("님") else "님"
|
|
984
|
+
ja_suffix = "" if display_name.endswith("さん") else "さん"
|
|
985
|
+
|
|
986
|
+
welcome_back_messages = {
|
|
987
|
+
"ko": f" 👋 다시 오신 것을 환영합니다, {display_name}{ko_suffix}!",
|
|
988
|
+
"ja": f" 👋 おかえりなさい、{display_name}{ja_suffix}!",
|
|
989
|
+
"zh": f" 👋 欢迎回来,{display_name}!",
|
|
990
|
+
"en": f" 👋 Welcome back, {display_name}!",
|
|
991
|
+
}
|
|
992
|
+
output.append(welcome_back_messages.get(conv_lang, welcome_back_messages["en"]))
|
|
899
993
|
|
|
900
994
|
# Configuration source is now handled silently for cleaner output
|
|
901
995
|
# Users can check configuration using dedicated tools if needed
|
|
@@ -938,8 +1032,9 @@ def main() -> None:
|
|
|
938
1032
|
"""Execute session start logic with proper error handling"""
|
|
939
1033
|
# Read JSON payload from stdin (for compatibility)
|
|
940
1034
|
# Handle Docker/non-interactive environments by checking TTY
|
|
1035
|
+
# Note: SessionStart hook receives session info but we don't need it currently
|
|
941
1036
|
input_data = sys.stdin.read() if not sys.stdin.isatty() else "{}"
|
|
942
|
-
json.loads(input_data) if input_data.strip() else {}
|
|
1037
|
+
_ = json.loads(input_data) if input_data.strip() else {} # Explicitly ignore
|
|
943
1038
|
|
|
944
1039
|
# Check if setup messages should be shown
|
|
945
1040
|
show_messages = should_show_setup_messages()
|
|
@@ -948,7 +1043,7 @@ def main() -> None:
|
|
|
948
1043
|
session_output = format_session_output() if show_messages else ""
|
|
949
1044
|
|
|
950
1045
|
# Return as system message
|
|
951
|
-
result:
|
|
1046
|
+
result: dict[str, Any] = {
|
|
952
1047
|
"continue": True,
|
|
953
1048
|
"systemMessage": session_output,
|
|
954
1049
|
"performance": {
|
|
@@ -974,7 +1069,7 @@ def main() -> None:
|
|
|
974
1069
|
|
|
975
1070
|
except HookTimeoutError as e:
|
|
976
1071
|
# Enhanced timeout error handling
|
|
977
|
-
timeout_response:
|
|
1072
|
+
timeout_response: dict[str, Any] = {
|
|
978
1073
|
"continue": True,
|
|
979
1074
|
"systemMessage": "⚠️ Session start timeout - continuing without project info",
|
|
980
1075
|
"error_details": {
|
|
@@ -990,7 +1085,7 @@ def main() -> None:
|
|
|
990
1085
|
|
|
991
1086
|
except Exception as e:
|
|
992
1087
|
# Enhanced error handling with context
|
|
993
|
-
error_response:
|
|
1088
|
+
error_response: dict[str, Any] = {
|
|
994
1089
|
"continue": True,
|
|
995
1090
|
"systemMessage": "⚠️ Session start encountered an error - continuing",
|
|
996
1091
|
"error_details": {
|
|
@@ -1020,7 +1115,7 @@ def main() -> None:
|
|
|
1020
1115
|
|
|
1021
1116
|
except PlatformTimeoutError:
|
|
1022
1117
|
# Timeout - return minimal valid response
|
|
1023
|
-
timeout_response_legacy:
|
|
1118
|
+
timeout_response_legacy: dict[str, Any] = {
|
|
1024
1119
|
"continue": True,
|
|
1025
1120
|
"systemMessage": "⚠️ Session start timeout - continuing without project info",
|
|
1026
1121
|
}
|
|
@@ -1052,7 +1147,7 @@ def main() -> None:
|
|
|
1052
1147
|
|
|
1053
1148
|
except json.JSONDecodeError as e:
|
|
1054
1149
|
# JSON parse error
|
|
1055
|
-
json_error_response:
|
|
1150
|
+
json_error_response: dict[str, Any] = {
|
|
1056
1151
|
"continue": True,
|
|
1057
1152
|
"hookSpecificOutput": {"error": f"JSON parse error: {e}"},
|
|
1058
1153
|
}
|
|
@@ -1062,7 +1157,7 @@ def main() -> None:
|
|
|
1062
1157
|
|
|
1063
1158
|
except Exception as e:
|
|
1064
1159
|
# Unexpected error
|
|
1065
|
-
general_error_response:
|
|
1160
|
+
general_error_response: dict[str, Any] = {
|
|
1066
1161
|
"continue": True,
|
|
1067
1162
|
"hookSpecificOutput": {"error": f"SessionStart error: {e}"},
|
|
1068
1163
|
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Announcement translator for multi-language companyAnnouncements support.
|
|
3
|
+
|
|
4
|
+
This module loads language-specific announcements from .moai/announcements/{lang}.json
|
|
5
|
+
based on the conversation_language setting in language.yaml.
|
|
6
|
+
|
|
7
|
+
Supported languages: ko, en, ja, zh
|
|
8
|
+
Fallback: en (English)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
|
|
15
|
+
# Import atomic_write from lib directory (go up two levels from shared/utils/)
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from pathlib import Path as _Path
|
|
19
|
+
|
|
20
|
+
_lib_path = _Path(__file__).parent.parent.parent / "lib"
|
|
21
|
+
if str(_lib_path) not in sys.path:
|
|
22
|
+
sys.path.insert(0, str(_lib_path))
|
|
23
|
+
from atomic_write import atomic_write_json # noqa: E402
|
|
24
|
+
|
|
25
|
+
# Default language if not configured
|
|
26
|
+
DEFAULT_LANGUAGE = "en"
|
|
27
|
+
|
|
28
|
+
# Supported languages
|
|
29
|
+
SUPPORTED_LANGUAGES = {"ko", "en", "ja", "zh"}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def get_language_from_config(project_path: Path | str) -> str:
|
|
33
|
+
"""Get conversation_language from language.yaml config.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
project_path: Path to the project root directory
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Language code (ko, en, ja, zh). Defaults to 'en' if not found.
|
|
40
|
+
"""
|
|
41
|
+
project_path = Path(project_path)
|
|
42
|
+
language_file = project_path / ".moai" / "config" / "sections" / "language.yaml"
|
|
43
|
+
|
|
44
|
+
if not language_file.exists():
|
|
45
|
+
return DEFAULT_LANGUAGE
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
import yaml
|
|
49
|
+
|
|
50
|
+
with open(language_file, encoding="utf-8") as f:
|
|
51
|
+
config = yaml.safe_load(f)
|
|
52
|
+
|
|
53
|
+
language = config.get("language", {}).get("conversation_language", DEFAULT_LANGUAGE)
|
|
54
|
+
|
|
55
|
+
# Validate language code
|
|
56
|
+
if language not in SUPPORTED_LANGUAGES:
|
|
57
|
+
return DEFAULT_LANGUAGE
|
|
58
|
+
|
|
59
|
+
return language
|
|
60
|
+
|
|
61
|
+
except Exception:
|
|
62
|
+
return DEFAULT_LANGUAGE
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def get_announcements_path(project_path: Path | str) -> Path:
|
|
66
|
+
"""Get the path to announcements directory.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
project_path: Path to the project root directory
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Path to .moai/announcements directory
|
|
73
|
+
"""
|
|
74
|
+
project_path = Path(project_path)
|
|
75
|
+
return project_path / ".moai" / "announcements"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def load_announcements_from_file(announcements_file: Path) -> list[str]:
|
|
79
|
+
"""Load announcements from a JSON file.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
announcements_file: Path to the announcements JSON file
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
List of announcement strings
|
|
86
|
+
"""
|
|
87
|
+
if not announcements_file.exists():
|
|
88
|
+
return []
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
with open(announcements_file, encoding="utf-8") as f:
|
|
92
|
+
data = json.load(f)
|
|
93
|
+
return data.get("companyAnnouncements", [])
|
|
94
|
+
except Exception:
|
|
95
|
+
return []
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def translate_announcements(language: str, project_path: Path | str) -> list[str]:
|
|
99
|
+
"""Get announcements for the specified language.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
language: Language code (ko, en, ja, zh)
|
|
103
|
+
project_path: Path to the project root directory
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
List of announcement strings in the specified language.
|
|
107
|
+
Falls back to English if language file not found.
|
|
108
|
+
"""
|
|
109
|
+
project_path = Path(project_path)
|
|
110
|
+
announcements_dir = get_announcements_path(project_path)
|
|
111
|
+
|
|
112
|
+
# Try requested language first
|
|
113
|
+
language_file = announcements_dir / f"{language}.json"
|
|
114
|
+
announcements = load_announcements_from_file(language_file)
|
|
115
|
+
|
|
116
|
+
if announcements:
|
|
117
|
+
return announcements
|
|
118
|
+
|
|
119
|
+
# Fallback to English
|
|
120
|
+
if language != DEFAULT_LANGUAGE:
|
|
121
|
+
english_file = announcements_dir / f"{DEFAULT_LANGUAGE}.json"
|
|
122
|
+
announcements = load_announcements_from_file(english_file)
|
|
123
|
+
if announcements:
|
|
124
|
+
return announcements
|
|
125
|
+
|
|
126
|
+
# Final fallback: return default announcements
|
|
127
|
+
return get_default_announcements()
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def get_default_announcements() -> list[str]:
|
|
131
|
+
"""Get default English announcements as fallback.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
List of default announcement strings in English
|
|
135
|
+
"""
|
|
136
|
+
return [
|
|
137
|
+
"🗿 MoAI-ADK: SPEC-First TDD with 48 Skills and Context7 integration",
|
|
138
|
+
"⚡ /moai:alfred: One-stop Plan→Run→Sync automation with intelligent routing",
|
|
139
|
+
"🌳 moai-worktree: Parallel SPEC development - work on multiple features simultaneously",
|
|
140
|
+
"🤖 20 Agents: 8 Expert + 8 Manager + 4 Builder for specialized tasks",
|
|
141
|
+
"📋 Workflow: /moai:1-plan (SPEC) → /moai:2-run (TDD) → /moai:3-sync (Docs)",
|
|
142
|
+
"✅ Quality: TRUST 5 + ≥85% coverage + Ralph Engine (LSP + AST-grep)",
|
|
143
|
+
"📚 Tip: moai update --templates-only syncs latest skills and agents",
|
|
144
|
+
"🏆 moai rank: Track your Claude token usage on rank.mo.ai.kr",
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def update_settings_announcements(project_path: Path | str) -> bool:
|
|
149
|
+
"""Update companyAnnouncements in settings.local.json based on language config.
|
|
150
|
+
|
|
151
|
+
This function is called during 'moai update' to refresh announcements
|
|
152
|
+
according to the current language setting.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
project_path: Path to the project root directory
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
True if update successful, False otherwise
|
|
159
|
+
"""
|
|
160
|
+
project_path = Path(project_path)
|
|
161
|
+
settings_file = project_path / ".claude" / "settings.local.json"
|
|
162
|
+
|
|
163
|
+
if not settings_file.exists():
|
|
164
|
+
return False
|
|
165
|
+
|
|
166
|
+
try:
|
|
167
|
+
# Load current settings
|
|
168
|
+
with open(settings_file, encoding="utf-8") as f:
|
|
169
|
+
settings = json.load(f)
|
|
170
|
+
|
|
171
|
+
# Get language and announcements
|
|
172
|
+
language = get_language_from_config(project_path)
|
|
173
|
+
announcements = translate_announcements(language, project_path)
|
|
174
|
+
|
|
175
|
+
# Update announcements
|
|
176
|
+
settings["companyAnnouncements"] = announcements
|
|
177
|
+
|
|
178
|
+
# Write back using atomic write (H3)
|
|
179
|
+
atomic_write_json(settings_file, settings, indent=2, ensure_ascii=False)
|
|
180
|
+
|
|
181
|
+
return True
|
|
182
|
+
|
|
183
|
+
except Exception:
|
|
184
|
+
return False
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# Alias for backward compatibility with update.py
|
|
188
|
+
auto_translate_and_update = update_settings_announcements
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
if __name__ == "__main__":
|
|
192
|
+
# Test the module
|
|
193
|
+
import sys
|
|
194
|
+
|
|
195
|
+
if len(sys.argv) > 1:
|
|
196
|
+
test_path = Path(sys.argv[1])
|
|
197
|
+
else:
|
|
198
|
+
test_path = Path.cwd()
|
|
199
|
+
|
|
200
|
+
lang = get_language_from_config(test_path)
|
|
201
|
+
print(f"Detected language: {lang}")
|
|
202
|
+
|
|
203
|
+
announcements = translate_announcements(lang, test_path)
|
|
204
|
+
print(f"Announcements ({len(announcements)} items):")
|
|
205
|
+
for ann in announcements:
|
|
206
|
+
print(f" - {ann}")
|