moai-adk 0.35.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/__init__.py +10 -0
- moai_adk/__main__.py +199 -0
- moai_adk/cli/__init__.py +6 -0
- moai_adk/cli/commands/__init__.py +17 -0
- moai_adk/cli/commands/analyze.py +116 -0
- moai_adk/cli/commands/doctor.py +272 -0
- moai_adk/cli/commands/init.py +372 -0
- moai_adk/cli/commands/language.py +248 -0
- moai_adk/cli/commands/status.py +104 -0
- moai_adk/cli/commands/update.py +2686 -0
- moai_adk/cli/main.py +13 -0
- moai_adk/cli/prompts/__init__.py +5 -0
- moai_adk/cli/prompts/init_prompts.py +219 -0
- moai_adk/cli/spec_status.py +263 -0
- moai_adk/cli/ui/__init__.py +44 -0
- moai_adk/cli/ui/progress.py +422 -0
- moai_adk/cli/ui/prompts.py +389 -0
- moai_adk/cli/ui/theme.py +129 -0
- moai_adk/cli/worktree/__init__.py +27 -0
- moai_adk/cli/worktree/__main__.py +31 -0
- moai_adk/cli/worktree/cli.py +683 -0
- moai_adk/cli/worktree/exceptions.py +89 -0
- moai_adk/cli/worktree/manager.py +493 -0
- moai_adk/cli/worktree/models.py +65 -0
- moai_adk/cli/worktree/registry.py +422 -0
- moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
- moai_adk/core/__init__.py +1 -0
- moai_adk/core/analysis/__init__.py +9 -0
- moai_adk/core/analysis/session_analyzer.py +400 -0
- moai_adk/core/claude_integration.py +393 -0
- moai_adk/core/command_helpers.py +270 -0
- moai_adk/core/comprehensive_monitoring_system.py +1183 -0
- moai_adk/core/config/__init__.py +19 -0
- moai_adk/core/config/auto_spec_config.py +340 -0
- moai_adk/core/config/migration.py +244 -0
- moai_adk/core/config/unified.py +436 -0
- moai_adk/core/context_manager.py +273 -0
- moai_adk/core/diagnostics/__init__.py +19 -0
- moai_adk/core/diagnostics/slash_commands.py +159 -0
- moai_adk/core/enterprise_features.py +1404 -0
- moai_adk/core/error_recovery_system.py +1902 -0
- moai_adk/core/event_driven_hook_system.py +1371 -0
- moai_adk/core/git/__init__.py +31 -0
- moai_adk/core/git/branch.py +25 -0
- moai_adk/core/git/branch_manager.py +129 -0
- moai_adk/core/git/checkpoint.py +134 -0
- moai_adk/core/git/commit.py +67 -0
- moai_adk/core/git/conflict_detector.py +413 -0
- moai_adk/core/git/event_detector.py +79 -0
- moai_adk/core/git/manager.py +216 -0
- moai_adk/core/hooks/post_tool_auto_spec_completion.py +901 -0
- moai_adk/core/input_validation_middleware.py +1006 -0
- moai_adk/core/integration/__init__.py +22 -0
- moai_adk/core/integration/engine.py +157 -0
- moai_adk/core/integration/integration_tester.py +226 -0
- moai_adk/core/integration/models.py +88 -0
- moai_adk/core/integration/utils.py +211 -0
- moai_adk/core/issue_creator.py +305 -0
- moai_adk/core/jit_context_loader.py +956 -0
- moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
- moai_adk/core/language_config.py +202 -0
- moai_adk/core/language_config_resolver.py +572 -0
- moai_adk/core/language_validator.py +543 -0
- moai_adk/core/mcp/setup.py +116 -0
- moai_adk/core/merge/__init__.py +9 -0
- moai_adk/core/merge/analyzer.py +605 -0
- moai_adk/core/migration/__init__.py +18 -0
- moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
- moai_adk/core/migration/backup_manager.py +277 -0
- moai_adk/core/migration/custom_element_scanner.py +358 -0
- moai_adk/core/migration/file_migrator.py +209 -0
- moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
- moai_adk/core/migration/selective_restorer.py +470 -0
- moai_adk/core/migration/template_utils.py +74 -0
- moai_adk/core/migration/user_selection_ui.py +338 -0
- moai_adk/core/migration/version_detector.py +139 -0
- moai_adk/core/migration/version_migrator.py +228 -0
- moai_adk/core/performance/__init__.py +6 -0
- moai_adk/core/performance/cache_system.py +316 -0
- moai_adk/core/performance/parallel_processor.py +116 -0
- moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
- moai_adk/core/project/__init__.py +1 -0
- moai_adk/core/project/backup_utils.py +70 -0
- moai_adk/core/project/checker.py +300 -0
- moai_adk/core/project/detector.py +293 -0
- moai_adk/core/project/initializer.py +387 -0
- moai_adk/core/project/phase_executor.py +716 -0
- moai_adk/core/project/validator.py +139 -0
- moai_adk/core/quality/__init__.py +6 -0
- moai_adk/core/quality/trust_checker.py +377 -0
- moai_adk/core/quality/validators/__init__.py +6 -0
- moai_adk/core/quality/validators/base_validator.py +19 -0
- moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
- moai_adk/core/robust_json_parser.py +611 -0
- moai_adk/core/rollback_manager.py +918 -0
- moai_adk/core/session_manager.py +651 -0
- moai_adk/core/skill_loading_system.py +579 -0
- moai_adk/core/spec/confidence_scoring.py +680 -0
- moai_adk/core/spec/ears_template_engine.py +1247 -0
- moai_adk/core/spec/quality_validator.py +687 -0
- moai_adk/core/spec_status_manager.py +478 -0
- moai_adk/core/template/__init__.py +7 -0
- moai_adk/core/template/backup.py +174 -0
- moai_adk/core/template/config.py +191 -0
- moai_adk/core/template/languages.py +43 -0
- moai_adk/core/template/merger.py +233 -0
- moai_adk/core/template/processor.py +1200 -0
- moai_adk/core/template_engine.py +310 -0
- moai_adk/core/template_variable_synchronizer.py +417 -0
- moai_adk/core/unified_permission_manager.py +745 -0
- moai_adk/core/user_behavior_analytics.py +851 -0
- moai_adk/core/version_sync.py +429 -0
- moai_adk/foundation/__init__.py +56 -0
- moai_adk/foundation/backend.py +1027 -0
- moai_adk/foundation/database.py +1115 -0
- moai_adk/foundation/devops.py +1585 -0
- moai_adk/foundation/ears.py +431 -0
- moai_adk/foundation/frontend.py +870 -0
- moai_adk/foundation/git/commit_templates.py +557 -0
- moai_adk/foundation/git.py +376 -0
- moai_adk/foundation/langs.py +484 -0
- moai_adk/foundation/ml_ops.py +1162 -0
- moai_adk/foundation/testing.py +1524 -0
- moai_adk/foundation/trust/trust_principles.py +676 -0
- moai_adk/foundation/trust/validation_checklist.py +1573 -0
- moai_adk/project/__init__.py +0 -0
- moai_adk/project/configuration.py +1084 -0
- moai_adk/project/documentation.py +566 -0
- moai_adk/project/schema.py +447 -0
- moai_adk/statusline/__init__.py +38 -0
- moai_adk/statusline/alfred_detector.py +105 -0
- moai_adk/statusline/config.py +376 -0
- moai_adk/statusline/enhanced_output_style_detector.py +372 -0
- moai_adk/statusline/git_collector.py +190 -0
- moai_adk/statusline/main.py +322 -0
- moai_adk/statusline/metrics_tracker.py +78 -0
- moai_adk/statusline/renderer.py +343 -0
- moai_adk/statusline/update_checker.py +129 -0
- moai_adk/statusline/version_reader.py +741 -0
- moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +714 -0
- moai_adk/templates/.claude/agents/moai/builder-agent.md +474 -0
- moai_adk/templates/.claude/agents/moai/builder-command.md +1172 -0
- moai_adk/templates/.claude/agents/moai/builder-plugin.md +637 -0
- moai_adk/templates/.claude/agents/moai/builder-skill.md +666 -0
- moai_adk/templates/.claude/agents/moai/expert-backend.md +899 -0
- moai_adk/templates/.claude/agents/moai/expert-database.md +777 -0
- moai_adk/templates/.claude/agents/moai/expert-debug.md +401 -0
- moai_adk/templates/.claude/agents/moai/expert-devops.md +720 -0
- moai_adk/templates/.claude/agents/moai/expert-frontend.md +734 -0
- moai_adk/templates/.claude/agents/moai/expert-performance.md +657 -0
- moai_adk/templates/.claude/agents/moai/expert-security.md +513 -0
- moai_adk/templates/.claude/agents/moai/expert-testing.md +733 -0
- moai_adk/templates/.claude/agents/moai/expert-uiux.md +1041 -0
- moai_adk/templates/.claude/agents/moai/manager-claude-code.md +432 -0
- moai_adk/templates/.claude/agents/moai/manager-docs.md +573 -0
- moai_adk/templates/.claude/agents/moai/manager-git.md +1060 -0
- moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
- moai_adk/templates/.claude/agents/moai/manager-quality.md +624 -0
- moai_adk/templates/.claude/agents/moai/manager-spec.md +809 -0
- moai_adk/templates/.claude/agents/moai/manager-strategy.md +780 -0
- moai_adk/templates/.claude/agents/moai/manager-tdd.md +784 -0
- moai_adk/templates/.claude/agents/moai/mcp-context7.md +458 -0
- moai_adk/templates/.claude/agents/moai/mcp-figma.md +1607 -0
- moai_adk/templates/.claude/agents/moai/mcp-notion.md +789 -0
- moai_adk/templates/.claude/agents/moai/mcp-playwright.md +469 -0
- moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +1032 -0
- moai_adk/templates/.claude/commands/moai/0-project.md +1386 -0
- moai_adk/templates/.claude/commands/moai/1-plan.md +1427 -0
- moai_adk/templates/.claude/commands/moai/2-run.md +943 -0
- moai_adk/templates/.claude/commands/moai/3-sync.md +1324 -0
- moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
- moai_adk/templates/.claude/hooks/__init__.py +8 -0
- moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
- moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
- moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
- moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
- moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
- moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
- moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
- moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
- moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
- moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
- moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
- moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
- moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
- moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
- moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +1083 -0
- moai_adk/templates/.claude/output-styles/moai/r2d2.md +560 -0
- moai_adk/templates/.claude/output-styles/moai/yoda.md +359 -0
- moai_adk/templates/.claude/settings.json +172 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/SKILL.md +307 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/examples.md +431 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/scripts/batch_generate.py +560 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/scripts/generate_image.py +362 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +249 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/examples.md +406 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/reference.md +328 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +320 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +718 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +464 -0
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +323 -0
- moai_adk/templates/.claude/skills/moai-domain-database/examples.md +830 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
- moai_adk/templates/.claude/skills/moai-domain-database/reference.md +545 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +497 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +968 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +664 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +455 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
- moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +492 -0
- moai_adk/templates/.claude/skills/moai-formats-data/examples.md +804 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
- moai_adk/templates/.claude/skills/moai-formats-data/reference.md +585 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +202 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/examples.md +732 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference.md +209 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +441 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/examples.md +1048 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/reference.md +246 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +420 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/examples.md +358 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +359 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/reference.md +478 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/SKILL.md +315 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/examples.md +228 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/assumption-matrix.md +80 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/cognitive-bias.md +199 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/first-principles.md +140 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/trade-off-analysis.md +154 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/reference.md +157 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +364 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +649 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +478 -0
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +612 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/SKILL.md +477 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/examples.md +1090 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/reference.md +686 -0
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +376 -0
- moai_adk/templates/.claude/skills/moai-lang-go/examples.md +919 -0
- moai_adk/templates/.claude/skills/moai-lang-go/reference.md +737 -0
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +385 -0
- moai_adk/templates/.claude/skills/moai-lang-java/examples.md +864 -0
- moai_adk/templates/.claude/skills/moai-lang-java/reference.md +291 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +382 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +1006 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +562 -0
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +644 -0
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +481 -0
- moai_adk/templates/.claude/skills/moai-lang-python/examples.md +977 -0
- moai_adk/templates/.claude/skills/moai-lang-python/reference.md +804 -0
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +579 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +687 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +372 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +659 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +504 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +497 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +633 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +423 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +497 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +918 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +672 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +368 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +1089 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +731 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +300 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +319 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/examples.md +592 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/reference.md +379 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +372 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
- moai_adk/templates/.claude/skills/moai-mcp-figma/SKILL.md +402 -0
- moai_adk/templates/.claude/skills/moai-mcp-figma/advanced-patterns.md +607 -0
- moai_adk/templates/.claude/skills/moai-mcp-notion/SKILL.md +300 -0
- moai_adk/templates/.claude/skills/moai-mcp-notion/advanced-patterns.md +537 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/SKILL.md +291 -0
- moai_adk/templates/.claude/skills/moai-platform-clerk/SKILL.md +390 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/SKILL.md +398 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/SKILL.md +379 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/SKILL.md +358 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/SKILL.md +467 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/SKILL.md +377 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/SKILL.md +466 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/SKILL.md +482 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/SKILL.md +474 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/examples.md +621 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/migration.md +341 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/reference.md +463 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/validation.md +373 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/SKILL.md +275 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/adaptive-mfa.md +233 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/akamai-integration.md +215 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/application-credentials.md +280 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/attack-protection-log-events.md +225 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/attack-protection-overview.md +140 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/bot-detection.md +144 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/breached-password-detection.md +187 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/brute-force-protection.md +189 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/certifications.md +282 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/compliance-overview.md +263 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/continuous-session-protection.md +307 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/customize-mfa.md +178 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/dpop-implementation.md +283 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/fapi-implementation.md +259 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/gdpr-compliance.md +313 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/guardian-configuration.md +269 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/highly-regulated-identity.md +272 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/jwt-fundamentals.md +248 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mdl-verification.md +211 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-api-management.md +278 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-factors.md +226 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-overview.md +174 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mtls-sender-constraining.md +316 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/ropg-flow-mfa.md +217 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/security-center.md +325 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/security-guidance.md +277 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/state-parameters.md +178 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/step-up-authentication.md +251 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/suspicious-ip-throttling.md +240 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/tenant-access-control.md +180 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/webauthn-fido.md +235 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +449 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/examples.md +544 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/reference.md +307 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +390 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +175 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples.md +547 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/reference.md +275 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1434 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +92 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
- moai_adk/templates/.claude/skills/moai-workflow-spec/SKILL.md +534 -0
- moai_adk/templates/.claude/skills/moai-workflow-spec/examples.md +900 -0
- moai_adk/templates/.claude/skills/moai-workflow-spec/reference.md +704 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +377 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/examples.md +552 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/reference.md +346 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +456 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples.md +672 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/reference.md +440 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
- moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +411 -0
- moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
- moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
- moai_adk/templates/.git-hooks/pre-commit +128 -0
- moai_adk/templates/.git-hooks/pre-push +365 -0
- moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
- moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
- moai_adk/templates/.github/workflows/spec-issue-sync.yml +337 -0
- moai_adk/templates/.gitignore +222 -0
- moai_adk/templates/.mcp.json +13 -0
- moai_adk/templates/.moai/config/config.yaml +58 -0
- moai_adk/templates/.moai/config/questions/_schema.yaml +174 -0
- moai_adk/templates/.moai/config/questions/tab0-init.yaml +251 -0
- moai_adk/templates/.moai/config/questions/tab1-user.yaml +107 -0
- moai_adk/templates/.moai/config/questions/tab2-project.yaml +79 -0
- moai_adk/templates/.moai/config/questions/tab3-git.yaml +632 -0
- moai_adk/templates/.moai/config/questions/tab4-quality.yaml +182 -0
- moai_adk/templates/.moai/config/questions/tab5-system.yaml +96 -0
- moai_adk/templates/.moai/config/sections/git-strategy.yaml +116 -0
- moai_adk/templates/.moai/config/sections/language.yaml +11 -0
- moai_adk/templates/.moai/config/sections/project.yaml +13 -0
- moai_adk/templates/.moai/config/sections/quality.yaml +17 -0
- moai_adk/templates/.moai/config/sections/system.yaml +24 -0
- moai_adk/templates/.moai/config/sections/user.yaml +5 -0
- moai_adk/templates/.moai/config/statusline-config.yaml +92 -0
- moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
- moai_adk/templates/CLAUDE.md +642 -0
- moai_adk/utils/__init__.py +30 -0
- moai_adk/utils/banner.py +38 -0
- moai_adk/utils/common.py +294 -0
- moai_adk/utils/link_validator.py +241 -0
- moai_adk/utils/logger.py +147 -0
- moai_adk/utils/safe_file_reader.py +206 -0
- moai_adk/utils/timeout.py +160 -0
- moai_adk/utils/toon_utils.py +256 -0
- moai_adk/version.py +22 -0
- moai_adk-0.35.1.dist-info/METADATA +3018 -0
- moai_adk-0.35.1.dist-info/RECORD +502 -0
- moai_adk-0.35.1.dist-info/WHEEL +4 -0
- moai_adk-0.35.1.dist-info/entry_points.txt +3 -0
- moai_adk-0.35.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moai-lang-elixir
|
|
3
|
+
description: Elixir 1.17+ development specialist covering Phoenix 1.7, LiveView, Ecto, and OTP patterns. Use when developing real-time applications, distributed systems, or Phoenix projects.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
updated: 2025-12-07
|
|
6
|
+
status: active
|
|
7
|
+
allowed-tools: Read, Grep, Glob, Bash, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Quick Reference (30 seconds)
|
|
11
|
+
|
|
12
|
+
Elixir 1.17+ Development Specialist - Phoenix 1.7, LiveView, Ecto, OTP patterns, and functional programming.
|
|
13
|
+
|
|
14
|
+
Auto-Triggers: `.ex`, `.exs` files, `mix.exs`, `config/`, Phoenix/LiveView discussions
|
|
15
|
+
|
|
16
|
+
Core Capabilities:
|
|
17
|
+
- Elixir 1.17: Pattern matching, pipes, protocols, behaviours, macros
|
|
18
|
+
- Phoenix 1.7: Controllers, LiveView, Channels, PubSub, Verified Routes
|
|
19
|
+
- Ecto: Schemas, Changesets, Queries, Migrations, Multi
|
|
20
|
+
- OTP: GenServer, Supervisor, Agent, Task, Registry
|
|
21
|
+
- ExUnit: Testing with setup, describe, async
|
|
22
|
+
- Mix: Build tool, tasks, releases
|
|
23
|
+
- Oban: Background job processing
|
|
24
|
+
|
|
25
|
+
### Quick Patterns
|
|
26
|
+
|
|
27
|
+
Phoenix Controller:
|
|
28
|
+
```elixir
|
|
29
|
+
defmodule MyAppWeb.UserController do
|
|
30
|
+
use MyAppWeb, :controller
|
|
31
|
+
|
|
32
|
+
alias MyApp.Accounts
|
|
33
|
+
|
|
34
|
+
def show(conn, %{"id" => id}) do
|
|
35
|
+
user = Accounts.get_user!(id)
|
|
36
|
+
render(conn, :show, user: user)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def create(conn, %{"user" => user_params}) do
|
|
40
|
+
case Accounts.create_user(user_params) do
|
|
41
|
+
{:ok, user} ->
|
|
42
|
+
conn
|
|
43
|
+
|> put_flash(:info, "User created successfully.")
|
|
44
|
+
|> redirect(to: ~p"/users/#{user}")
|
|
45
|
+
|
|
46
|
+
{:error, %Ecto.Changeset{} = changeset} ->
|
|
47
|
+
render(conn, :new, changeset: changeset)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Ecto Schema with Changeset:
|
|
54
|
+
```elixir
|
|
55
|
+
defmodule MyApp.Accounts.User do
|
|
56
|
+
use Ecto.Schema
|
|
57
|
+
import Ecto.Changeset
|
|
58
|
+
|
|
59
|
+
schema "users" do
|
|
60
|
+
field :name, :string
|
|
61
|
+
field :email, :string
|
|
62
|
+
field :password_hash, :string
|
|
63
|
+
field :password, :string, virtual: true
|
|
64
|
+
|
|
65
|
+
timestamps()
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def changeset(user, attrs) do
|
|
69
|
+
user
|
|
70
|
+
|> cast(attrs, [:name, :email, :password])
|
|
71
|
+
|> validate_required([:name, :email, :password])
|
|
72
|
+
|> validate_format(:email, ~r/@/)
|
|
73
|
+
|> validate_length(:password, min: 8)
|
|
74
|
+
|> unique_constraint(:email)
|
|
75
|
+
|> put_password_hash()
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
GenServer Pattern:
|
|
81
|
+
```elixir
|
|
82
|
+
defmodule MyApp.Counter do
|
|
83
|
+
use GenServer
|
|
84
|
+
|
|
85
|
+
def start_link(initial_value) do
|
|
86
|
+
GenServer.start_link(__MODULE__, initial_value, name: __MODULE__)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def increment, do: GenServer.call(__MODULE__, :increment)
|
|
90
|
+
def get_count, do: GenServer.call(__MODULE__, :get)
|
|
91
|
+
|
|
92
|
+
@impl true
|
|
93
|
+
def init(initial_value), do: {:ok, initial_value}
|
|
94
|
+
|
|
95
|
+
@impl true
|
|
96
|
+
def handle_call(:increment, _from, count), do: {:reply, count + 1, count + 1}
|
|
97
|
+
def handle_call(:get, _from, count), do: {:reply, count, count}
|
|
98
|
+
end
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Implementation Guide (5 minutes)
|
|
104
|
+
|
|
105
|
+
### Elixir 1.17 Features
|
|
106
|
+
|
|
107
|
+
Set-Theoretic Types (Gradual Typing):
|
|
108
|
+
- Type annotations for better code documentation
|
|
109
|
+
- Compile-time warnings for type mismatches
|
|
110
|
+
- Enhanced dialyzer integration
|
|
111
|
+
|
|
112
|
+
Pattern Matching Advanced:
|
|
113
|
+
```elixir
|
|
114
|
+
def process_message(%{type: :email, to: to} = message) when is_binary(to) do
|
|
115
|
+
send_email(message)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def process_message(%{type: :sms, phone: phone}) when byte_size(phone) == 10 do
|
|
119
|
+
send_sms(phone)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def process_message(_), do: {:error, :invalid_message}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Pipe Operator Best Practices:
|
|
126
|
+
```elixir
|
|
127
|
+
def process_order(order_params) do
|
|
128
|
+
order_params
|
|
129
|
+
|> validate_order()
|
|
130
|
+
|> calculate_total()
|
|
131
|
+
|> apply_discounts()
|
|
132
|
+
|> create_order()
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# With error handling using with
|
|
136
|
+
def process_order_safe(params) do
|
|
137
|
+
with {:ok, validated} <- validate_order(params),
|
|
138
|
+
{:ok, total} <- calculate_total(validated),
|
|
139
|
+
{:ok, discounted} <- apply_discounts(total),
|
|
140
|
+
{:ok, order} <- create_order(discounted) do
|
|
141
|
+
{:ok, order}
|
|
142
|
+
else
|
|
143
|
+
{:error, reason} -> {:error, reason}
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Protocols for Polymorphism:
|
|
149
|
+
```elixir
|
|
150
|
+
defprotocol Stringify do
|
|
151
|
+
@doc "Converts a data structure to string"
|
|
152
|
+
def to_string(data)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
defimpl Stringify, for: Map do
|
|
156
|
+
def to_string(map), do: Jason.encode!(map)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
defimpl Stringify, for: List do
|
|
160
|
+
def to_string(list), do: Enum.join(list, ", ")
|
|
161
|
+
end
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Phoenix 1.7 Patterns
|
|
165
|
+
|
|
166
|
+
LiveView Component:
|
|
167
|
+
```elixir
|
|
168
|
+
defmodule MyAppWeb.CounterLive do
|
|
169
|
+
use MyAppWeb, :live_view
|
|
170
|
+
|
|
171
|
+
def mount(_params, _session, socket) do
|
|
172
|
+
{:ok, assign(socket, count: 0)}
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def handle_event("increment", _, socket) do
|
|
176
|
+
{:noreply, update(socket, :count, &(&1 + 1))}
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def render(assigns) do
|
|
180
|
+
~H"""
|
|
181
|
+
<div class="counter">
|
|
182
|
+
<h1>Count: <%= @count %></h1>
|
|
183
|
+
<button phx-click="increment">Increment</button>
|
|
184
|
+
</div>
|
|
185
|
+
"""
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
LiveView Form with Changesets:
|
|
191
|
+
```elixir
|
|
192
|
+
defmodule MyAppWeb.UserFormLive do
|
|
193
|
+
use MyAppWeb, :live_view
|
|
194
|
+
|
|
195
|
+
alias MyApp.Accounts
|
|
196
|
+
alias MyApp.Accounts.User
|
|
197
|
+
|
|
198
|
+
def mount(_params, _session, socket) do
|
|
199
|
+
changeset = Accounts.change_user(%User{})
|
|
200
|
+
{:ok, assign(socket, form: to_form(changeset))}
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def handle_event("validate", %{"user" => user_params}, socket) do
|
|
204
|
+
changeset =
|
|
205
|
+
%User{}
|
|
206
|
+
|> Accounts.change_user(user_params)
|
|
207
|
+
|> Map.put(:action, :validate)
|
|
208
|
+
|
|
209
|
+
{:noreply, assign(socket, form: to_form(changeset))}
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def handle_event("save", %{"user" => user_params}, socket) do
|
|
213
|
+
case Accounts.create_user(user_params) do
|
|
214
|
+
{:ok, user} ->
|
|
215
|
+
{:noreply,
|
|
216
|
+
socket
|
|
217
|
+
|> put_flash(:info, "User created!")
|
|
218
|
+
|> push_navigate(to: ~p"/users/#{user}")}
|
|
219
|
+
|
|
220
|
+
{:error, %Ecto.Changeset{} = changeset} ->
|
|
221
|
+
{:noreply, assign(socket, form: to_form(changeset))}
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def render(assigns) do
|
|
226
|
+
~H"""
|
|
227
|
+
<.form for={@form} phx-change="validate" phx-submit="save">
|
|
228
|
+
<.input field={@form[:name]} label="Name" />
|
|
229
|
+
<.input field={@form[:email]} type="email" label="Email" />
|
|
230
|
+
<.button>Save</.button>
|
|
231
|
+
</.form>
|
|
232
|
+
"""
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Phoenix Channels:
|
|
238
|
+
```elixir
|
|
239
|
+
defmodule MyAppWeb.RoomChannel do
|
|
240
|
+
use MyAppWeb, :channel
|
|
241
|
+
|
|
242
|
+
@impl true
|
|
243
|
+
def join("room:" <> room_id, _params, socket) do
|
|
244
|
+
send(self(), :after_join)
|
|
245
|
+
{:ok, assign(socket, :room_id, room_id)}
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
@impl true
|
|
249
|
+
def handle_info(:after_join, socket) do
|
|
250
|
+
push(socket, "presence_state", MyAppWeb.Presence.list(socket))
|
|
251
|
+
{:ok, _} = MyAppWeb.Presence.track(socket, socket.assigns.user_id, %{
|
|
252
|
+
online_at: System.system_time(:second)
|
|
253
|
+
})
|
|
254
|
+
{:noreply, socket}
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
@impl true
|
|
258
|
+
def handle_in("new_message", %{"body" => body}, socket) do
|
|
259
|
+
broadcast!(socket, "new_message", %{
|
|
260
|
+
user_id: socket.assigns.user_id,
|
|
261
|
+
body: body,
|
|
262
|
+
inserted_at: DateTime.utc_now()
|
|
263
|
+
})
|
|
264
|
+
{:noreply, socket}
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Verified Routes:
|
|
270
|
+
```elixir
|
|
271
|
+
# In router.ex
|
|
272
|
+
scope "/", MyAppWeb do
|
|
273
|
+
pipe_through :browser
|
|
274
|
+
|
|
275
|
+
live "/users", UserLive.Index, :index
|
|
276
|
+
live "/users/:id", UserLive.Show, :show
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Usage with ~p sigil
|
|
280
|
+
~p"/users" # "/users"
|
|
281
|
+
~p"/users/#{user}" # "/users/123"
|
|
282
|
+
~p"/users?page=1" # "/users?page=1"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Ecto Advanced Patterns
|
|
286
|
+
|
|
287
|
+
Multi for Transactions:
|
|
288
|
+
```elixir
|
|
289
|
+
def transfer_funds(from_account, to_account, amount) do
|
|
290
|
+
Ecto.Multi.new()
|
|
291
|
+
|> Ecto.Multi.update(:withdraw, withdraw_changeset(from_account, amount))
|
|
292
|
+
|> Ecto.Multi.update(:deposit, deposit_changeset(to_account, amount))
|
|
293
|
+
|> Ecto.Multi.insert(:transaction, fn %{withdraw: from, deposit: to} ->
|
|
294
|
+
Transaction.changeset(%Transaction{}, %{
|
|
295
|
+
from_account_id: from.id,
|
|
296
|
+
to_account_id: to.id,
|
|
297
|
+
amount: amount
|
|
298
|
+
})
|
|
299
|
+
end)
|
|
300
|
+
|> Repo.transaction()
|
|
301
|
+
end
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Query Composition:
|
|
305
|
+
```elixir
|
|
306
|
+
defmodule MyApp.Accounts.UserQuery do
|
|
307
|
+
import Ecto.Query
|
|
308
|
+
|
|
309
|
+
def base, do: from(u in User)
|
|
310
|
+
|
|
311
|
+
def active(query \\ base()) do
|
|
312
|
+
from u in query, where: u.active == true
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def by_email(query \\ base(), email) do
|
|
316
|
+
from u in query, where: u.email == ^email
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def with_posts(query \\ base()) do
|
|
320
|
+
from u in query, preload: [:posts]
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def order_by_recent(query \\ base()) do
|
|
324
|
+
from u in query, order_by: [desc: u.inserted_at]
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Usage
|
|
329
|
+
User
|
|
330
|
+
|> UserQuery.active()
|
|
331
|
+
|> UserQuery.with_posts()
|
|
332
|
+
|> UserQuery.order_by_recent()
|
|
333
|
+
|> Repo.all()
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Embedded Schemas:
|
|
337
|
+
```elixir
|
|
338
|
+
defmodule MyApp.Order do
|
|
339
|
+
use Ecto.Schema
|
|
340
|
+
import Ecto.Changeset
|
|
341
|
+
|
|
342
|
+
schema "orders" do
|
|
343
|
+
field :status, :string
|
|
344
|
+
embeds_one :shipping_address, Address, on_replace: :update
|
|
345
|
+
embeds_many :items, Item, on_replace: :delete
|
|
346
|
+
|
|
347
|
+
timestamps()
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
def changeset(order, attrs) do
|
|
351
|
+
order
|
|
352
|
+
|> cast(attrs, [:status])
|
|
353
|
+
|> cast_embed(:shipping_address, required: true)
|
|
354
|
+
|> cast_embed(:items, required: true)
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
defmodule MyApp.Order.Address do
|
|
359
|
+
use Ecto.Schema
|
|
360
|
+
import Ecto.Changeset
|
|
361
|
+
|
|
362
|
+
embedded_schema do
|
|
363
|
+
field :street, :string
|
|
364
|
+
field :city, :string
|
|
365
|
+
field :zip, :string
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def changeset(address, attrs) do
|
|
369
|
+
address
|
|
370
|
+
|> cast(attrs, [:street, :city, :zip])
|
|
371
|
+
|> validate_required([:street, :city, :zip])
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### OTP Patterns
|
|
377
|
+
|
|
378
|
+
Supervisor Tree:
|
|
379
|
+
```elixir
|
|
380
|
+
defmodule MyApp.Application do
|
|
381
|
+
use Application
|
|
382
|
+
|
|
383
|
+
@impl true
|
|
384
|
+
def start(_type, _args) do
|
|
385
|
+
children = [
|
|
386
|
+
MyApp.Repo,
|
|
387
|
+
MyAppWeb.Telemetry,
|
|
388
|
+
{Phoenix.PubSub, name: MyApp.PubSub},
|
|
389
|
+
MyAppWeb.Endpoint,
|
|
390
|
+
{MyApp.Cache, []},
|
|
391
|
+
{Task.Supervisor, name: MyApp.TaskSupervisor},
|
|
392
|
+
MyApp.SchedulerSupervisor
|
|
393
|
+
]
|
|
394
|
+
|
|
395
|
+
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
|
|
396
|
+
Supervisor.start_link(children, opts)
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
Dynamic Supervisor:
|
|
402
|
+
```elixir
|
|
403
|
+
defmodule MyApp.WorkerSupervisor do
|
|
404
|
+
use DynamicSupervisor
|
|
405
|
+
|
|
406
|
+
def start_link(init_arg) do
|
|
407
|
+
DynamicSupervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
@impl true
|
|
411
|
+
def init(_init_arg) do
|
|
412
|
+
DynamicSupervisor.init(strategy: :one_for_one)
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
def start_worker(args) do
|
|
416
|
+
spec = {MyApp.Worker, args}
|
|
417
|
+
DynamicSupervisor.start_child(__MODULE__, spec)
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def stop_worker(pid) do
|
|
421
|
+
DynamicSupervisor.terminate_child(__MODULE__, pid)
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Registry for Named Processes:
|
|
427
|
+
```elixir
|
|
428
|
+
# Start registry in application supervision tree
|
|
429
|
+
{Registry, keys: :unique, name: MyApp.Registry}
|
|
430
|
+
|
|
431
|
+
# GenServer with dynamic name
|
|
432
|
+
defmodule MyApp.Session do
|
|
433
|
+
use GenServer
|
|
434
|
+
|
|
435
|
+
def start_link(user_id) do
|
|
436
|
+
GenServer.start_link(__MODULE__, user_id, name: via_tuple(user_id))
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
defp via_tuple(user_id) do
|
|
440
|
+
{:via, Registry, {MyApp.Registry, {:session, user_id}}}
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
def get_session(user_id) do
|
|
444
|
+
GenServer.call(via_tuple(user_id), :get)
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### ExUnit Testing
|
|
450
|
+
|
|
451
|
+
Async Tests with Setup:
|
|
452
|
+
```elixir
|
|
453
|
+
defmodule MyApp.AccountsTest do
|
|
454
|
+
use MyApp.DataCase, async: true
|
|
455
|
+
|
|
456
|
+
alias MyApp.Accounts
|
|
457
|
+
|
|
458
|
+
describe "users" do
|
|
459
|
+
setup do
|
|
460
|
+
user = insert(:user)
|
|
461
|
+
{:ok, user: user}
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
test "get_user!/1 returns the user with given id", %{user: user} do
|
|
465
|
+
assert Accounts.get_user!(user.id) == user
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
test "create_user/1 with valid data creates a user" do
|
|
469
|
+
valid_attrs = %{name: "Test", email: "test@example.com", password: "password123"}
|
|
470
|
+
|
|
471
|
+
assert {:ok, %User{} = user} = Accounts.create_user(valid_attrs)
|
|
472
|
+
assert user.name == "Test"
|
|
473
|
+
assert user.email == "test@example.com"
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
test "create_user/1 with invalid data returns error changeset" do
|
|
477
|
+
assert {:error, %Ecto.Changeset{}} = Accounts.create_user(%{})
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
LiveView Testing:
|
|
484
|
+
```elixir
|
|
485
|
+
defmodule MyAppWeb.CounterLiveTest do
|
|
486
|
+
use MyAppWeb.ConnCase
|
|
487
|
+
|
|
488
|
+
import Phoenix.LiveViewTest
|
|
489
|
+
|
|
490
|
+
test "renders counter", %{conn: conn} do
|
|
491
|
+
{:ok, view, html} = live(conn, ~p"/counter")
|
|
492
|
+
|
|
493
|
+
assert html =~ "Count: 0"
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
test "increments counter on click", %{conn: conn} do
|
|
497
|
+
{:ok, view, _html} = live(conn, ~p"/counter")
|
|
498
|
+
|
|
499
|
+
assert view
|
|
500
|
+
|> element("button", "Increment")
|
|
501
|
+
|> render_click() =~ "Count: 1"
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Oban Background Jobs
|
|
507
|
+
|
|
508
|
+
Job Worker:
|
|
509
|
+
```elixir
|
|
510
|
+
defmodule MyApp.Workers.EmailWorker do
|
|
511
|
+
use Oban.Worker, queue: :mailers, max_attempts: 3
|
|
512
|
+
|
|
513
|
+
@impl Oban.Worker
|
|
514
|
+
def perform(%Oban.Job{args: %{"email" => email, "template" => template}}) do
|
|
515
|
+
case MyApp.Mailer.send_email(email, template) do
|
|
516
|
+
{:ok, _} -> :ok
|
|
517
|
+
{:error, reason} -> {:error, reason}
|
|
518
|
+
end
|
|
519
|
+
end
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
# Enqueue job
|
|
523
|
+
%{email: "user@example.com", template: "welcome"}
|
|
524
|
+
|> MyApp.Workers.EmailWorker.new()
|
|
525
|
+
|> Oban.insert()
|
|
526
|
+
|
|
527
|
+
# Scheduled job
|
|
528
|
+
%{email: "user@example.com", template: "reminder"}
|
|
529
|
+
|> MyApp.Workers.EmailWorker.new(scheduled_at: DateTime.add(DateTime.utc_now(), 3600))
|
|
530
|
+
|> Oban.insert()
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
## Advanced Implementation (10+ minutes)
|
|
536
|
+
|
|
537
|
+
For comprehensive coverage including:
|
|
538
|
+
- Production deployment with releases
|
|
539
|
+
- Distributed systems with libcluster
|
|
540
|
+
- Advanced LiveView patterns (streams, components)
|
|
541
|
+
- Telemetry and observability
|
|
542
|
+
- Security best practices
|
|
543
|
+
- CI/CD integration patterns
|
|
544
|
+
|
|
545
|
+
See:
|
|
546
|
+
- [reference.md](reference.md) - Complete reference documentation
|
|
547
|
+
- [examples.md](examples.md) - Production-ready code examples
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## Context7 Library Mappings
|
|
552
|
+
|
|
553
|
+
```
|
|
554
|
+
/elixir-lang/elixir - Elixir language documentation
|
|
555
|
+
/phoenixframework/phoenix - Phoenix web framework
|
|
556
|
+
/phoenixframework/phoenix_live_view - LiveView real-time UI
|
|
557
|
+
/elixir-ecto/ecto - Database wrapper and query language
|
|
558
|
+
/sorentwo/oban - Background job processing
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## Works Well With
|
|
564
|
+
|
|
565
|
+
- `moai-domain-backend` - REST API and microservices architecture
|
|
566
|
+
- `moai-domain-database` - SQL patterns and query optimization
|
|
567
|
+
- `moai-quality-testing` - TDD and testing strategies
|
|
568
|
+
- `moai-essentials-debug` - AI-powered debugging
|
|
569
|
+
- `moai-platform-deploy` - Deployment and infrastructure
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Troubleshooting
|
|
574
|
+
|
|
575
|
+
Common Issues:
|
|
576
|
+
|
|
577
|
+
Elixir Version Check:
|
|
578
|
+
```bash
|
|
579
|
+
elixir --version # Should be 1.17+
|
|
580
|
+
mix --version # Mix build tool version
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
Dependency Issues:
|
|
584
|
+
```bash
|
|
585
|
+
mix deps.get # Fetch dependencies
|
|
586
|
+
mix deps.compile # Compile dependencies
|
|
587
|
+
mix clean # Clean build artifacts
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
Database Migrations:
|
|
591
|
+
```bash
|
|
592
|
+
mix ecto.create # Create database
|
|
593
|
+
mix ecto.migrate # Run migrations
|
|
594
|
+
mix ecto.rollback # Rollback last migration
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Phoenix Server:
|
|
598
|
+
```bash
|
|
599
|
+
mix phx.server # Start server
|
|
600
|
+
iex -S mix phx.server # Start with IEx
|
|
601
|
+
MIX_ENV=prod mix release # Build release
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
LiveView Not Loading:
|
|
605
|
+
- Check websocket connection in browser console
|
|
606
|
+
- Verify endpoint configuration for websocket
|
|
607
|
+
- Ensure Phoenix.LiveView is in mix.exs dependencies
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
Last Updated: 2025-12-07
|
|
612
|
+
Status: Active (v1.0.0)
|