moai-adk 0.4.5__py3-none-any.whl → 0.20.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 +1 -1
- moai_adk/__main__.py +74 -1
- moai_adk/cli/commands/__init__.py +1 -1
- moai_adk/cli/commands/analyze.py +119 -0
- moai_adk/cli/commands/backup.py +25 -1
- moai_adk/cli/commands/doctor.py +31 -5
- moai_adk/cli/commands/improve_user_experience.py +307 -0
- moai_adk/cli/commands/init.py +111 -10
- moai_adk/cli/commands/status.py +33 -3
- moai_adk/cli/commands/update.py +921 -130
- moai_adk/cli/commands/validate_links.py +120 -0
- moai_adk/cli/prompts/init_prompts.py +22 -87
- moai_adk/core/analysis/__init__.py +9 -0
- moai_adk/core/analysis/session_analyzer.py +388 -0
- moai_adk/core/analysis/tag_chain_analyzer.py +344 -0
- moai_adk/core/analysis/tag_chain_repair.py +879 -0
- moai_adk/core/config/__init__.py +19 -0
- moai_adk/core/config/migration.py +235 -0
- moai_adk/core/git/__init__.py +1 -1
- moai_adk/core/git/branch.py +1 -1
- moai_adk/core/git/commit.py +1 -1
- moai_adk/core/git/manager.py +1 -1
- moai_adk/core/issue_creator.py +313 -0
- moai_adk/core/mcp/setup.py +56 -0
- moai_adk/core/mcp/setup_old.py +296 -0
- moai_adk/core/project/backup_utils.py +1 -1
- moai_adk/core/project/checker.py +2 -2
- moai_adk/core/project/detector.py +211 -12
- moai_adk/core/project/initializer.py +85 -15
- moai_adk/core/project/phase_executor.py +76 -13
- moai_adk/core/project/validator.py +13 -13
- moai_adk/core/quality/__init__.py +1 -1
- moai_adk/core/quality/trust_checker.py +1 -1
- moai_adk/core/quality/validators/__init__.py +1 -1
- moai_adk/core/quality/validators/base_validator.py +1 -1
- moai_adk/core/tags/__init__.py +86 -0
- moai_adk/core/tags/auto_corrector.py +693 -0
- moai_adk/core/tags/ci_validator.py +463 -0
- moai_adk/core/tags/cli.py +283 -0
- moai_adk/core/tags/generator.py +109 -0
- moai_adk/core/tags/inserter.py +99 -0
- moai_adk/core/tags/mapper.py +126 -0
- moai_adk/core/tags/parser.py +76 -0
- moai_adk/core/tags/policy_validator.py +580 -0
- moai_adk/core/tags/pre_commit_validator.py +421 -0
- moai_adk/core/tags/reporter.py +956 -0
- moai_adk/core/tags/rollback_manager.py +525 -0
- moai_adk/core/tags/tags.py +149 -0
- moai_adk/core/tags/validator.py +897 -0
- moai_adk/core/template/__init__.py +1 -1
- moai_adk/core/template/backup.py +1 -1
- moai_adk/core/template/merger.py +50 -1
- moai_adk/core/template/processor.py +119 -13
- moai_adk/core/template_engine.py +268 -0
- moai_adk/templates/.claude/agents/alfred/backend-expert.md +348 -0
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +209 -944
- moai_adk/templates/.claude/agents/alfred/database-expert.md +352 -0
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +34 -5
- moai_adk/templates/.claude/agents/alfred/devops-expert.md +464 -0
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +38 -8
- moai_adk/templates/.claude/agents/alfred/format-expert.md +469 -0
- moai_adk/templates/.claude/agents/alfred/frontend-expert.md +357 -0
- moai_adk/templates/.claude/agents/alfred/git-manager.md +128 -9
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +104 -6
- moai_adk/templates/.claude/agents/alfred/project-manager.md +88 -16
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +36 -9
- moai_adk/templates/.claude/agents/alfred/security-expert.md +270 -0
- moai_adk/templates/.claude/agents/alfred/skill-factory.md +865 -0
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +214 -43
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +111 -9
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +309 -160
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +36 -7
- moai_adk/templates/.claude/agents/alfred/ui-ux-expert.md +605 -0
- moai_adk/templates/.claude/commands/alfred/0-project.md +393 -966
- moai_adk/templates/.claude/commands/alfred/1-plan.md +651 -367
- moai_adk/templates/.claude/commands/alfred/2-run.md +388 -241
- moai_adk/templates/.claude/commands/alfred/3-sync.md +1921 -410
- moai_adk/templates/.claude/commands/alfred/9-feedback.md +153 -0
- moai_adk/templates/.claude/commands/alfred/release-new.md +3604 -0
- moai_adk/templates/.claude/hooks/alfred/core/project.py +484 -20
- moai_adk/templates/.claude/hooks/alfred/core/timeout.py +136 -0
- moai_adk/templates/.claude/hooks/alfred/core/ttl_cache.py +108 -0
- moai_adk/templates/.claude/hooks/alfred/core/version_cache.py +198 -0
- moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +14 -6
- moai_adk/templates/.claude/hooks/alfred/post_tool__enable_streaming_ui.py +50 -0
- moai_adk/templates/.claude/hooks/alfred/post_tool__log_changes.py +93 -0
- moai_adk/templates/.claude/hooks/alfred/post_tool__tag_auto_corrector.py +407 -0
- moai_adk/templates/.claude/hooks/alfred/pre_tool__auto_checkpoint.py +99 -0
- moai_adk/templates/.claude/hooks/alfred/pre_tool__realtime_tag_monitor.py +335 -0
- moai_adk/templates/.claude/hooks/alfred/pre_tool__tag_policy_validator.py +325 -0
- moai_adk/templates/.claude/hooks/alfred/session_end__cleanup.py +93 -0
- moai_adk/templates/.claude/hooks/alfred/session_start__auto_cleanup.py +580 -0
- moai_adk/templates/.claude/hooks/alfred/session_start__show_project_info.py +298 -0
- moai_adk/templates/.claude/hooks/alfred/shared/core/__init__.py +170 -0
- moai_adk/templates/.claude/hooks/alfred/{core → shared/core}/checkpoint.py +3 -3
- moai_adk/templates/.claude/hooks/alfred/{core → shared/core}/context.py +5 -5
- moai_adk/templates/.claude/hooks/alfred/shared/core/project.py +749 -0
- moai_adk/templates/.claude/hooks/alfred/shared/core/tags.py +230 -0
- moai_adk/templates/.claude/hooks/alfred/shared/core/version_cache.py +198 -0
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/__init__.py +21 -0
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/daily_analysis.py +351 -0
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/notification.py +154 -0
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/session.py +174 -0
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/tool.py +87 -0
- moai_adk/templates/.claude/hooks/alfred/shared/handlers/user.py +61 -0
- moai_adk/templates/.claude/hooks/alfred/user_prompt__jit_load_docs.py +111 -0
- moai_adk/templates/.claude/hooks/alfred/utils/__init__.py +1 -0
- moai_adk/templates/.claude/hooks/alfred/utils/hook_config.py +94 -0
- moai_adk/templates/.claude/hooks/alfred/utils/timeout.py +161 -0
- moai_adk/templates/.claude/output-styles/alfred/alfred-moai-adk-beginner.md +267 -0
- moai_adk/templates/.claude/output-styles/alfred/keating-personal-tutor.md +440 -0
- moai_adk/templates/.claude/output-styles/alfred/r2d2-agentic-coding.md +583 -0
- moai_adk/templates/.claude/settings.json +96 -14
- moai_adk/templates/.claude/skills/moai-alfred-agent-guide/SKILL.md +70 -0
- moai_adk/templates/.claude/skills/moai-alfred-agent-guide/examples.md +62 -0
- moai_adk/templates/.claude/skills/moai-alfred-agent-guide/reference.md +242 -0
- moai_adk/templates/.claude/skills/moai-alfred-ask-user-questions/SKILL.md +237 -0
- moai_adk/templates/.claude/skills/moai-alfred-ask-user-questions/examples.md +871 -0
- moai_adk/templates/.claude/skills/moai-alfred-ask-user-questions/reference.md +653 -0
- moai_adk/templates/.claude/skills/moai-alfred-clone-pattern/README.md +162 -0
- moai_adk/templates/.claude/skills/moai-alfred-clone-pattern/SKILL.md +227 -0
- moai_adk/templates/.claude/skills/moai-alfred-clone-pattern/examples.md +354 -0
- moai_adk/templates/.claude/skills/moai-alfred-clone-pattern/reference.md +158 -0
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +179 -79
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/examples.md +117 -0
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/scripts/pre-review-check.sh +62 -0
- moai_adk/templates/.claude/skills/moai-alfred-config-schema/SKILL.md +132 -0
- moai_adk/templates/.claude/skills/moai-alfred-config-schema/examples.md +28 -0
- moai_adk/templates/.claude/skills/moai-alfred-config-schema/reference.md +444 -0
- moai_adk/templates/.claude/skills/moai-alfred-context-budget/SKILL.md +62 -0
- moai_adk/templates/.claude/skills/moai-alfred-context-budget/examples.md +28 -0
- moai_adk/templates/.claude/skills/moai-alfred-context-budget/reference.md +405 -0
- moai_adk/templates/.claude/skills/moai-alfred-dev-guide/SKILL.md +51 -0
- moai_adk/templates/.claude/skills/moai-alfred-dev-guide/examples.md +355 -0
- moai_adk/templates/.claude/skills/moai-alfred-dev-guide/reference.md +239 -0
- moai_adk/templates/.claude/skills/moai-alfred-expertise-detection/SKILL.md +323 -0
- moai_adk/templates/.claude/skills/moai-alfred-expertise-detection/examples.md +286 -0
- moai_adk/templates/.claude/skills/moai-alfred-expertise-detection/reference.md +126 -0
- moai_adk/templates/.claude/skills/moai-alfred-issue-labels/SKILL.md +229 -0
- moai_adk/templates/.claude/skills/moai-alfred-issue-labels/examples.md +4 -0
- moai_adk/templates/.claude/skills/moai-alfred-issue-labels/reference.md +150 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +87 -73
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-alfred-personas/README.md +42 -0
- moai_adk/templates/.claude/skills/moai-alfred-personas/SKILL.md +429 -0
- moai_adk/templates/.claude/skills/moai-alfred-personas/examples.md +520 -0
- moai_adk/templates/.claude/skills/moai-alfred-personas/reference.md +405 -0
- moai_adk/templates/.claude/skills/moai-alfred-practices/SKILL.md +89 -0
- moai_adk/templates/.claude/skills/moai-alfred-practices/examples.md +122 -0
- moai_adk/templates/.claude/skills/moai-alfred-practices/reference.md +369 -0
- moai_adk/templates/.claude/skills/moai-alfred-proactive-suggestions/SKILL.md +508 -0
- moai_adk/templates/.claude/skills/moai-alfred-proactive-suggestions/examples.md +481 -0
- moai_adk/templates/.claude/skills/moai-alfred-proactive-suggestions/reference.md +100 -0
- moai_adk/templates/.claude/skills/moai-alfred-rules/SKILL.md +77 -0
- moai_adk/templates/.claude/skills/moai-alfred-rules/examples.md +265 -0
- moai_adk/templates/.claude/skills/moai-alfred-rules/reference.md +539 -0
- moai_adk/templates/.claude/skills/moai-alfred-session-state/SKILL.md +320 -0
- moai_adk/templates/.claude/skills/moai-alfred-session-state/examples.md +4 -0
- moai_adk/templates/.claude/skills/moai-alfred-session-state/reference.md +84 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/README.md +137 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/SKILL.md +219 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/examples/validate-spec.sh +161 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/examples.md +541 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-authoring/reference.md +622 -0
- moai_adk/templates/.claude/skills/moai-alfred-todowrite-pattern/SKILL.md +19 -0
- moai_adk/templates/.claude/skills/moai-alfred-todowrite-pattern/examples.md +4 -0
- moai_adk/templates/.claude/skills/moai-alfred-todowrite-pattern/reference.md +211 -0
- moai_adk/templates/.claude/skills/moai-alfred-workflow/SKILL.md +288 -0
- moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +269 -0
- moai_adk/templates/.claude/skills/moai-cc-agents/templates/agent-template.md +32 -0
- moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +298 -0
- moai_adk/templates/.claude/skills/moai-cc-claude-md/templates/CLAUDE-template.md +26 -0
- moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +307 -0
- moai_adk/templates/.claude/skills/moai-cc-commands/templates/command-template.md +21 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +252 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/pre-bash-check.sh +19 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/preserve-permissions.sh +19 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/validate-bash-command.py +24 -0
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +199 -0
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/templates/settings-mcp-template.json +39 -0
- moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +316 -0
- moai_adk/templates/.claude/skills/moai-cc-memory/templates/session-summary-template.md +18 -0
- moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +263 -0
- moai_adk/templates/.claude/skills/moai-cc-settings/templates/settings-complete-template.json +30 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/CHECKLIST.md +482 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/EXAMPLES.md +303 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/INTERACTIVE-DISCOVERY.md +524 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/METADATA.md +477 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/PARALLEL-ANALYSIS-REPORT.md +429 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/PYTHON-VERSION-MATRIX.md +391 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/SKILL-FACTORY-WORKFLOW.md +431 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/SKILL-UPDATE-ADVISOR.md +577 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/SKILL.md +273 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/STEP-BY-STEP-GUIDE.md +466 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/STRUCTURE.md +583 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/WEB-RESEARCH.md +526 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/reference.md +608 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/scripts/generate-structure.sh +328 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/scripts/validate-skill.sh +312 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/SKILL_TEMPLATE.md +245 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/examples-template.md +285 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/reference-template.md +278 -0
- moai_adk/templates/.claude/skills/moai-cc-skill-factory/templates/scripts-template.sh +303 -0
- moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +291 -0
- moai_adk/templates/.claude/skills/moai-cc-skills/templates/SKILL-template.md +15 -0
- moai_adk/templates/.claude/skills/moai-change-logger/SKILL.md +563 -0
- moai_adk/templates/.claude/skills/moai-design-systems/SKILL.md +802 -0
- moai_adk/templates/.claude/skills/moai-design-systems/examples.md +1238 -0
- moai_adk/templates/.claude/skills/moai-design-systems/reference.md +673 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +234 -43
- moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +1633 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +660 -0
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +97 -69
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +97 -72
- moai_adk/templates/.claude/skills/moai-domain-data-science/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-data-science/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +97 -74
- moai_adk/templates/.claude/skills/moai-domain-database/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-database/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +98 -74
- moai_adk/templates/.claude/skills/moai-domain-devops/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-devops/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +102 -73
- moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +97 -73
- moai_adk/templates/.claude/skills/moai-domain-ml/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-ml/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +97 -67
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +97 -79
- moai_adk/templates/.claude/skills/moai-domain-security/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-security/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +97 -71
- moai_adk/templates/.claude/skills/moai-domain-web-api/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-domain-web-api/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +265 -64
- moai_adk/templates/.claude/skills/moai-essentials-debug/examples.md +1064 -0
- moai_adk/templates/.claude/skills/moai-essentials-debug/reference.md +1047 -0
- moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +87 -78
- moai_adk/templates/.claude/skills/moai-essentials-perf/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-essentials-perf/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +87 -70
- moai_adk/templates/.claude/skills/moai-essentials-refactor/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-essentials-refactor/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +87 -86
- moai_adk/templates/.claude/skills/moai-essentials-review/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-essentials-review/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +80 -62
- moai_adk/templates/.claude/skills/moai-foundation-ears/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-foundation-ears/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +207 -50
- moai_adk/templates/.claude/skills/moai-foundation-git/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-foundation-git/reference.md +29 -0
- moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +90 -71
- moai_adk/templates/.claude/skills/moai-foundation-langs/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-foundation-langs/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +78 -58
- moai_adk/templates/.claude/skills/moai-foundation-specs/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-foundation-specs/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +78 -51
- moai_adk/templates/.claude/skills/moai-foundation-tags/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-foundation-tags/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-foundation-trust/.!11330!examples.md +0 -0
- moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +253 -32
- moai_adk/templates/.claude/skills/moai-foundation-trust/examples.md +0 -0
- moai_adk/templates/.claude/skills/moai-foundation-trust/reference.md +1099 -0
- moai_adk/templates/.claude/skills/moai-jit-docs-enhanced/SKILL.md +460 -0
- moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +98 -74
- moai_adk/templates/.claude/skills/moai-lang-c/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-c/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +98 -76
- moai_adk/templates/.claude/skills/moai-lang-cpp/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +2358 -70
- moai_adk/templates/.claude/skills/moai-lang-csharp/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +2962 -68
- moai_adk/templates/.claude/skills/moai-lang-dart/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-dart/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +1898 -70
- moai_adk/templates/.claude/skills/moai-lang-go/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-go/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +1465 -68
- moai_adk/templates/.claude/skills/moai-lang-java/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-java/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +2364 -66
- moai_adk/templates/.claude/skills/moai-lang-javascript/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-javascript/reference.md +32 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +1630 -69
- moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +89 -61
- moai_adk/templates/.claude/skills/moai-lang-php/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-php/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +735 -66
- moai_adk/templates/.claude/skills/moai-lang-python/examples.md +624 -0
- moai_adk/templates/.claude/skills/moai-lang-python/reference.md +316 -0
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +97 -73
- moai_adk/templates/.claude/skills/moai-lang-r/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-r/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +98 -73
- moai_adk/templates/.claude/skills/moai-lang-ruby/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +1834 -70
- moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +99 -74
- moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +97 -74
- moai_adk/templates/.claude/skills/moai-lang-shell/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-shell/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +98 -74
- moai_adk/templates/.claude/skills/moai-lang-sql/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-sql/reference.md +31 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +1959 -69
- moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +30 -0
- moai_adk/templates/.claude/skills/moai-lang-template/SKILL.md +348 -0
- moai_adk/templates/.claude/skills/moai-lang-template/VARIABLES.md +98 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +1230 -66
- moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +34 -0
- moai_adk/templates/.claude/skills/moai-learning-optimizer/SKILL.md +575 -0
- moai_adk/templates/.claude/skills/moai-project-batch-questions/README.md +50 -0
- moai_adk/templates/.claude/skills/moai-project-batch-questions/SKILL.md +304 -0
- moai_adk/templates/.claude/skills/moai-project-batch-questions/examples.md +417 -0
- moai_adk/templates/.claude/skills/moai-project-batch-questions/reference.md +704 -0
- moai_adk/templates/.claude/skills/moai-project-config-manager/README.md +87 -0
- moai_adk/templates/.claude/skills/moai-project-config-manager/SKILL.md +552 -0
- moai_adk/templates/.claude/skills/moai-project-config-manager/examples.md +1109 -0
- moai_adk/templates/.claude/skills/moai-project-config-manager/reference.md +514 -0
- moai_adk/templates/.claude/skills/moai-project-config-manager/validate.py +106 -0
- moai_adk/templates/.claude/skills/moai-project-documentation/README.md +11 -0
- moai_adk/templates/.claude/skills/moai-project-documentation/SKILL.md +622 -0
- moai_adk/templates/.claude/skills/moai-project-documentation/examples.md +20 -0
- moai_adk/templates/.claude/skills/moai-project-documentation/reference.md +12 -0
- moai_adk/templates/.claude/skills/moai-project-language-initializer/README.md +152 -0
- moai_adk/templates/.claude/skills/moai-project-language-initializer/SKILL.md +285 -0
- moai_adk/templates/.claude/skills/moai-project-language-initializer/examples.md +333 -0
- moai_adk/templates/.claude/skills/moai-project-language-initializer/reference.md +386 -0
- moai_adk/templates/.claude/skills/moai-project-template-optimizer/README.md +49 -0
- moai_adk/templates/.claude/skills/moai-project-template-optimizer/SKILL.md +319 -0
- moai_adk/templates/.claude/skills/moai-project-template-optimizer/examples.md +58 -0
- moai_adk/templates/.claude/skills/moai-project-template-optimizer/reference.md +123 -0
- moai_adk/templates/.claude/skills/moai-session-info/SKILL.md +314 -0
- moai_adk/templates/.claude/skills/moai-streaming-ui/SKILL.md +552 -0
- moai_adk/templates/.claude/skills/moai-tag-policy-validator/SKILL.md +570 -0
- moai_adk/templates/.git-hooks/pre-commit +66 -0
- moai_adk/templates/.git-hooks/pre-push +255 -0
- moai_adk/templates/.github/workflows/c-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/cpp-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/csharp-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/dart-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/go-tag-validation.yml +130 -0
- moai_adk/templates/.github/workflows/java-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/javascript-tag-validation.yml +135 -0
- moai_adk/templates/.github/workflows/kotlin-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/moai-gitflow.yml +166 -3
- moai_adk/templates/.github/workflows/moai-release-create.yml +100 -0
- moai_adk/templates/.github/workflows/moai-release-pipeline.yml +188 -0
- moai_adk/templates/.github/workflows/php-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/python-tag-validation.yml +118 -0
- moai_adk/templates/.github/workflows/release.yml +118 -0
- moai_adk/templates/.github/workflows/ruby-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/rust-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/shell-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/spec-issue-sync.yml +338 -0
- moai_adk/templates/.github/workflows/swift-tag-validation.yml +11 -0
- moai_adk/templates/.github/workflows/tag-report.yml +269 -0
- moai_adk/templates/.github/workflows/tag-validation.yml +186 -0
- moai_adk/templates/.github/workflows/typescript-tag-validation.yml +154 -0
- moai_adk/templates/.mcp.json +31 -0
- moai_adk/templates/.moai/config.json +80 -7
- moai_adk/templates/CLAUDE.md +562 -546
- moai_adk/utils/banner.py +5 -5
- moai_adk/utils/common.py +294 -0
- moai_adk/utils/link_validator.py +235 -0
- moai_adk/utils/logger.py +8 -8
- moai_adk/utils/user_experience.py +451 -0
- moai_adk-0.20.1.dist-info/METADATA +233 -0
- moai_adk-0.20.1.dist-info/RECORD +404 -0
- moai_adk/templates/.claude/hooks/alfred/README.md +0 -230
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +0 -156
- moai_adk/templates/.claude/hooks/alfred/core/__init__.py +0 -85
- moai_adk/templates/.claude/hooks/alfred/handlers/notification.py +0 -25
- moai_adk/templates/.claude/hooks/alfred/handlers/session.py +0 -92
- moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +0 -70
- moai_adk/templates/.claude/hooks/alfred/handlers/user.py +0 -41
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +0 -636
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +0 -692
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +0 -470
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +0 -103
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +0 -103
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +0 -95
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +0 -105
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +0 -97
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +0 -97
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +0 -90
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +0 -99
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +0 -87
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +0 -62
- moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +0 -94
- moai_adk/templates/.claude/skills/moai-claude-code/examples.md +0 -513
- moai_adk/templates/.claude/skills/moai-claude-code/reference.md +0 -433
- moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +0 -332
- moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +0 -384
- moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +0 -363
- moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +0 -595
- moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +0 -496
- moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +0 -100
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +0 -99
- moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +0 -100
- moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +0 -98
- moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +0 -98
- moai_adk/templates/.github/PULL_REQUEST_TEMPLATE.md +0 -69
- moai_adk/templates/.moai/memory/development-guide.md +0 -344
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +0 -220
- moai_adk/templates/.moai/memory/spec-metadata.md +0 -356
- moai_adk/templates/.moai/project/product.md +0 -161
- moai_adk/templates/.moai/project/structure.md +0 -156
- moai_adk/templates/.moai/project/tech.md +0 -227
- moai_adk/templates/__init__.py +0 -2
- moai_adk-0.4.5.dist-info/METADATA +0 -369
- moai_adk-0.4.5.dist-info/RECORD +0 -152
- {moai_adk-0.4.5.dist-info → moai_adk-0.20.1.dist-info}/WHEEL +0 -0
- {moai_adk-0.4.5.dist-info → moai_adk-0.20.1.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.4.5.dist-info → moai_adk-0.20.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# @CODE:DOC-TAG-004 | Component 2: CI/CD pipeline TAG validator
|
|
3
|
+
"""CI/CD TAG validation module for GitHub Actions
|
|
4
|
+
|
|
5
|
+
This module extends PreCommitValidator for CI/CD environments:
|
|
6
|
+
- Fetches PR changed files via GitHub API
|
|
7
|
+
- Generates structured validation reports (JSON/markdown)
|
|
8
|
+
- Posts validation results as PR comments
|
|
9
|
+
- Supports strict mode (block merge on warnings) and info mode
|
|
10
|
+
|
|
11
|
+
Used by GitHub Actions workflow to validate TAGs on every PR.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
from typing import Any, Dict, List, Optional
|
|
17
|
+
|
|
18
|
+
import requests
|
|
19
|
+
from requests.adapters import HTTPAdapter
|
|
20
|
+
from urllib3.util import Retry
|
|
21
|
+
|
|
22
|
+
from .pre_commit_validator import (
|
|
23
|
+
PreCommitValidator,
|
|
24
|
+
ValidationResult,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CIValidator(PreCommitValidator):
|
|
29
|
+
"""CI/CD TAG validator for GitHub Actions
|
|
30
|
+
|
|
31
|
+
Extends PreCommitValidator with CI/CD-specific features:
|
|
32
|
+
- GitHub API integration for PR file detection
|
|
33
|
+
- Structured report generation for automation
|
|
34
|
+
- Markdown comment formatting for PR feedback
|
|
35
|
+
- Environment variable support for GitHub Actions
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
github_token: GitHub API token (default: from GITHUB_TOKEN env)
|
|
39
|
+
repo_owner: Repository owner (default: from GITHUB_REPOSITORY env)
|
|
40
|
+
repo_name: Repository name (default: from GITHUB_REPOSITORY env)
|
|
41
|
+
strict_mode: Treat warnings as errors
|
|
42
|
+
check_orphans: Enable orphan TAG detection
|
|
43
|
+
tag_pattern: Custom TAG regex pattern
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
github_token: Optional[str] = None,
|
|
49
|
+
repo_owner: Optional[str] = None,
|
|
50
|
+
repo_name: Optional[str] = None,
|
|
51
|
+
strict_mode: bool = False,
|
|
52
|
+
check_orphans: bool = True,
|
|
53
|
+
tag_pattern: Optional[str] = None
|
|
54
|
+
):
|
|
55
|
+
super().__init__(strict_mode, check_orphans, tag_pattern)
|
|
56
|
+
|
|
57
|
+
# GitHub configuration from environment or parameters
|
|
58
|
+
self.github_token = github_token or os.environ.get('GITHUB_TOKEN', '')
|
|
59
|
+
|
|
60
|
+
# Parse repo info from GITHUB_REPOSITORY (format: "owner/repo")
|
|
61
|
+
repo_full = os.environ.get('GITHUB_REPOSITORY', '')
|
|
62
|
+
if '/' in repo_full and not repo_owner and not repo_name:
|
|
63
|
+
parts = repo_full.split('/', 1)
|
|
64
|
+
self.repo_owner = parts[0]
|
|
65
|
+
self.repo_name = parts[1]
|
|
66
|
+
else:
|
|
67
|
+
self.repo_owner = repo_owner or ''
|
|
68
|
+
self.repo_name = repo_name or ''
|
|
69
|
+
|
|
70
|
+
def get_pr_changed_files(self, pr_number: int) -> List[str]:
|
|
71
|
+
"""Fetch list of changed files in a PR via GitHub API
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
pr_number: Pull request number
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
List of relative file paths changed in the PR
|
|
78
|
+
"""
|
|
79
|
+
if not self.github_token or not self.repo_owner or not self.repo_name:
|
|
80
|
+
return []
|
|
81
|
+
|
|
82
|
+
url = (
|
|
83
|
+
f"https://api.github.com/repos/"
|
|
84
|
+
f"{self.repo_owner}/{self.repo_name}/pulls/{pr_number}/files"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
headers = {
|
|
88
|
+
'Authorization': f'Bearer {self.github_token}',
|
|
89
|
+
'Accept': 'application/vnd.github.v3+json'
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Create session with retry strategy
|
|
93
|
+
session = requests.Session()
|
|
94
|
+
retry = Retry(
|
|
95
|
+
total=3,
|
|
96
|
+
backoff_factor=0.5,
|
|
97
|
+
status_forcelist=[500, 502, 503, 504],
|
|
98
|
+
allowed_methods=["GET"]
|
|
99
|
+
)
|
|
100
|
+
adapter = HTTPAdapter(max_retries=retry)
|
|
101
|
+
session.mount("https://", adapter)
|
|
102
|
+
|
|
103
|
+
try:
|
|
104
|
+
# Dual timeout: (connect_timeout, read_timeout)
|
|
105
|
+
response = session.get(
|
|
106
|
+
url,
|
|
107
|
+
headers=headers,
|
|
108
|
+
timeout=(5, 10)
|
|
109
|
+
)
|
|
110
|
+
response.raise_for_status()
|
|
111
|
+
|
|
112
|
+
files_data = response.json()
|
|
113
|
+
return [file_info['filename'] for file_info in files_data]
|
|
114
|
+
|
|
115
|
+
except requests.exceptions.Timeout:
|
|
116
|
+
# Network timeout - return empty list gracefully
|
|
117
|
+
return []
|
|
118
|
+
except requests.exceptions.HTTPError as e:
|
|
119
|
+
# HTTP error (4xx, 5xx)
|
|
120
|
+
if e.response.status_code == 404:
|
|
121
|
+
# PR not found
|
|
122
|
+
return []
|
|
123
|
+
# Other HTTP errors: log but continue
|
|
124
|
+
return []
|
|
125
|
+
except requests.exceptions.RequestException:
|
|
126
|
+
# Network/connection errors
|
|
127
|
+
return []
|
|
128
|
+
finally:
|
|
129
|
+
session.close()
|
|
130
|
+
|
|
131
|
+
def validate_pr_changes(
|
|
132
|
+
self,
|
|
133
|
+
pr_number: int,
|
|
134
|
+
base_branch: str = "main"
|
|
135
|
+
) -> ValidationResult:
|
|
136
|
+
"""Validate TAG annotations in PR changed files
|
|
137
|
+
|
|
138
|
+
Main CI/CD validation method:
|
|
139
|
+
1. Fetch changed files from GitHub API
|
|
140
|
+
2. Run validation checks on those files
|
|
141
|
+
3. Return structured validation result
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
pr_number: Pull request number
|
|
145
|
+
base_branch: Base branch name (not used currently)
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
ValidationResult with errors and warnings
|
|
149
|
+
"""
|
|
150
|
+
# Get PR changed files
|
|
151
|
+
files = self.get_pr_changed_files(pr_number)
|
|
152
|
+
|
|
153
|
+
if not files:
|
|
154
|
+
return ValidationResult(is_valid=True)
|
|
155
|
+
|
|
156
|
+
# Validate the changed files
|
|
157
|
+
return self.validate_files(files)
|
|
158
|
+
|
|
159
|
+
def generate_report(self, result: ValidationResult) -> Dict[str, Any]:
|
|
160
|
+
"""Generate structured validation report
|
|
161
|
+
|
|
162
|
+
Creates JSON-serializable report with:
|
|
163
|
+
- Status (success/failure/success_with_warnings)
|
|
164
|
+
- Error details (message, tag, locations)
|
|
165
|
+
- Warning details (message, tag, location)
|
|
166
|
+
- Statistics (counts)
|
|
167
|
+
- Configuration (strict_mode)
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
result: ValidationResult from validation
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Dictionary with structured report data
|
|
174
|
+
"""
|
|
175
|
+
# Determine status
|
|
176
|
+
if not result.is_valid:
|
|
177
|
+
status = 'failure'
|
|
178
|
+
elif result.warnings:
|
|
179
|
+
status = 'success_with_warnings'
|
|
180
|
+
else:
|
|
181
|
+
status = 'success'
|
|
182
|
+
|
|
183
|
+
# Build error list
|
|
184
|
+
errors = []
|
|
185
|
+
for error in result.errors:
|
|
186
|
+
errors.append({
|
|
187
|
+
'message': error.message,
|
|
188
|
+
'tag': error.tag,
|
|
189
|
+
'locations': [
|
|
190
|
+
{'file': filepath, 'line': line_num}
|
|
191
|
+
for filepath, line_num in error.locations
|
|
192
|
+
]
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
# Build warning list
|
|
196
|
+
warnings = []
|
|
197
|
+
for warning in result.warnings:
|
|
198
|
+
warnings.append({
|
|
199
|
+
'message': warning.message,
|
|
200
|
+
'tag': warning.tag,
|
|
201
|
+
'location': {
|
|
202
|
+
'file': warning.location[0],
|
|
203
|
+
'line': warning.location[1]
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
# Calculate statistics
|
|
208
|
+
statistics = {
|
|
209
|
+
'total_errors': len(result.errors),
|
|
210
|
+
'total_warnings': len(result.warnings),
|
|
211
|
+
'total_issues': len(result.errors) + len(result.warnings)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
# Build complete report
|
|
215
|
+
report = {
|
|
216
|
+
'status': status,
|
|
217
|
+
'is_valid': result.is_valid,
|
|
218
|
+
'strict_mode': self.strict_mode,
|
|
219
|
+
'summary': self._generate_summary(result),
|
|
220
|
+
'errors': errors,
|
|
221
|
+
'warnings': warnings,
|
|
222
|
+
'statistics': statistics
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return report
|
|
226
|
+
|
|
227
|
+
def _generate_summary(self, result: ValidationResult) -> str:
|
|
228
|
+
"""Generate human-readable summary text
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
result: ValidationResult
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
Summary string
|
|
235
|
+
"""
|
|
236
|
+
if result.is_valid and not result.warnings:
|
|
237
|
+
return "All TAG validations passed. No issues found."
|
|
238
|
+
elif result.is_valid and result.warnings:
|
|
239
|
+
return f"Validation passed with {len(result.warnings)} warning(s)."
|
|
240
|
+
else:
|
|
241
|
+
return f"Validation failed with {len(result.errors)} error(s)."
|
|
242
|
+
|
|
243
|
+
def format_pr_comment(
|
|
244
|
+
self,
|
|
245
|
+
result: ValidationResult,
|
|
246
|
+
pr_url: str
|
|
247
|
+
) -> str:
|
|
248
|
+
"""Format validation result as markdown PR comment
|
|
249
|
+
|
|
250
|
+
Creates formatted markdown comment with:
|
|
251
|
+
- Status indicator (emoji)
|
|
252
|
+
- Summary message
|
|
253
|
+
- Error/warning table
|
|
254
|
+
- Action items
|
|
255
|
+
- Documentation links
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
result: ValidationResult from validation
|
|
259
|
+
pr_url: URL of the pull request
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
Markdown-formatted comment string
|
|
263
|
+
"""
|
|
264
|
+
lines = []
|
|
265
|
+
|
|
266
|
+
# Header with status indicator
|
|
267
|
+
if result.is_valid and not result.warnings:
|
|
268
|
+
lines.append("## ✅ TAG Validation Passed")
|
|
269
|
+
lines.append("")
|
|
270
|
+
lines.append("All TAG annotations are valid. No issues found.")
|
|
271
|
+
elif result.is_valid and result.warnings:
|
|
272
|
+
lines.append("## ⚠️ TAG Validation Passed with Warnings")
|
|
273
|
+
lines.append("")
|
|
274
|
+
lines.append(f"Validation passed but found {len(result.warnings)} warning(s).")
|
|
275
|
+
else:
|
|
276
|
+
lines.append("## ❌ TAG Validation Failed")
|
|
277
|
+
lines.append("")
|
|
278
|
+
lines.append(f"Found {len(result.errors)} error(s) that must be fixed.")
|
|
279
|
+
|
|
280
|
+
lines.append("")
|
|
281
|
+
|
|
282
|
+
# Error table
|
|
283
|
+
if result.errors:
|
|
284
|
+
lines.append("### Errors")
|
|
285
|
+
lines.append("")
|
|
286
|
+
lines.append("| TAG | Issue | Location |")
|
|
287
|
+
lines.append("|-----|-------|----------|")
|
|
288
|
+
|
|
289
|
+
for error in result.errors:
|
|
290
|
+
tag = error.tag
|
|
291
|
+
message = error.message
|
|
292
|
+
locations = ', '.join([
|
|
293
|
+
f"`{f}:{line}`" for f, line in error.locations[:3]
|
|
294
|
+
])
|
|
295
|
+
if len(error.locations) > 3:
|
|
296
|
+
locations += f" (+{len(error.locations) - 3} more)"
|
|
297
|
+
|
|
298
|
+
lines.append(f"| `{tag}` | {message} | {locations} |")
|
|
299
|
+
|
|
300
|
+
lines.append("")
|
|
301
|
+
|
|
302
|
+
# Warning table
|
|
303
|
+
if result.warnings:
|
|
304
|
+
lines.append("### Warnings")
|
|
305
|
+
lines.append("")
|
|
306
|
+
lines.append("| TAG | Issue | Location |")
|
|
307
|
+
lines.append("|-----|-------|----------|")
|
|
308
|
+
|
|
309
|
+
for warning in result.warnings:
|
|
310
|
+
tag = warning.tag
|
|
311
|
+
message = warning.message
|
|
312
|
+
location = f"`{warning.location[0]}:{warning.location[1]}`"
|
|
313
|
+
|
|
314
|
+
lines.append(f"| `{tag}` | {message} | {location} |")
|
|
315
|
+
|
|
316
|
+
lines.append("")
|
|
317
|
+
|
|
318
|
+
# Action items
|
|
319
|
+
if result.errors or result.warnings:
|
|
320
|
+
lines.append("### How to Fix")
|
|
321
|
+
lines.append("")
|
|
322
|
+
|
|
323
|
+
if result.errors:
|
|
324
|
+
lines.append("**Errors (must fix):**")
|
|
325
|
+
lines.append("- Remove duplicate TAG declarations")
|
|
326
|
+
lines.append("- Ensure TAGs follow format: `@PREFIX:DOMAIN-TYPE-NNN`")
|
|
327
|
+
lines.append("")
|
|
328
|
+
|
|
329
|
+
if result.warnings:
|
|
330
|
+
lines.append("**Warnings (recommended):**")
|
|
331
|
+
lines.append("- Add corresponding TEST tags for CODE tags")
|
|
332
|
+
lines.append("- Add corresponding CODE tags for TEST tags")
|
|
333
|
+
lines.append("- Complete TAG chain: SPEC → CODE → TEST → DOC")
|
|
334
|
+
lines.append("")
|
|
335
|
+
|
|
336
|
+
# Documentation link
|
|
337
|
+
lines.append("---")
|
|
338
|
+
lines.append("")
|
|
339
|
+
lines.append("📚 **Documentation:** [TAG System Guide](.moai/memory/tag-system-guide.md)")
|
|
340
|
+
lines.append("")
|
|
341
|
+
lines.append(f"🔗 **PR:** {pr_url}")
|
|
342
|
+
|
|
343
|
+
return "\n".join(lines)
|
|
344
|
+
|
|
345
|
+
def get_pr_number_from_event(self) -> Optional[int]:
|
|
346
|
+
"""Extract PR number from GitHub Actions event file
|
|
347
|
+
|
|
348
|
+
Reads GITHUB_EVENT_PATH to get PR number from event payload.
|
|
349
|
+
|
|
350
|
+
Returns:
|
|
351
|
+
PR number or None if not found
|
|
352
|
+
"""
|
|
353
|
+
event_path = os.environ.get('GITHUB_EVENT_PATH')
|
|
354
|
+
if not event_path:
|
|
355
|
+
return None
|
|
356
|
+
|
|
357
|
+
try:
|
|
358
|
+
with open(event_path, 'r') as f:
|
|
359
|
+
event_data = json.load(f)
|
|
360
|
+
return event_data.get('pull_request', {}).get('number')
|
|
361
|
+
except Exception:
|
|
362
|
+
return None
|
|
363
|
+
|
|
364
|
+
def generate_tag_report_link(self, pr_number: int) -> str:
|
|
365
|
+
"""Generate link to TAG reports for this PR
|
|
366
|
+
|
|
367
|
+
Integration point with Component 4 (Reporting).
|
|
368
|
+
Provides link to automated TAG reports generated by GitHub Actions.
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
pr_number: Pull request number
|
|
372
|
+
|
|
373
|
+
Returns:
|
|
374
|
+
Markdown link to TAG reports
|
|
375
|
+
"""
|
|
376
|
+
# Link to GitHub Actions artifacts or docs directory
|
|
377
|
+
if self.repo_owner and self.repo_name:
|
|
378
|
+
docs_url = (
|
|
379
|
+
f"https://github.com/{self.repo_owner}/{self.repo_name}/tree/main/docs"
|
|
380
|
+
)
|
|
381
|
+
return f"📊 [View TAG Reports]({docs_url})"
|
|
382
|
+
else:
|
|
383
|
+
return "📊 TAG Reports: See docs/ directory"
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def main():
|
|
387
|
+
"""CLI entry point for CI/CD validation"""
|
|
388
|
+
import argparse
|
|
389
|
+
import sys
|
|
390
|
+
|
|
391
|
+
parser = argparse.ArgumentParser(
|
|
392
|
+
description="Validate TAG annotations in GitHub PR"
|
|
393
|
+
)
|
|
394
|
+
parser.add_argument(
|
|
395
|
+
"--pr-number",
|
|
396
|
+
type=int,
|
|
397
|
+
help="Pull request number (default: from GitHub Actions event)"
|
|
398
|
+
)
|
|
399
|
+
parser.add_argument(
|
|
400
|
+
"--strict",
|
|
401
|
+
action="store_true",
|
|
402
|
+
help="Treat warnings as errors"
|
|
403
|
+
)
|
|
404
|
+
parser.add_argument(
|
|
405
|
+
"--no-orphan-check",
|
|
406
|
+
action="store_true",
|
|
407
|
+
help="Disable orphan TAG checking"
|
|
408
|
+
)
|
|
409
|
+
parser.add_argument(
|
|
410
|
+
"--output-json",
|
|
411
|
+
help="Output report to JSON file"
|
|
412
|
+
)
|
|
413
|
+
parser.add_argument(
|
|
414
|
+
"--output-comment",
|
|
415
|
+
help="Output PR comment to file"
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
args = parser.parse_args()
|
|
419
|
+
|
|
420
|
+
validator = CIValidator(
|
|
421
|
+
strict_mode=args.strict,
|
|
422
|
+
check_orphans=not args.no_orphan_check
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
# Get PR number
|
|
426
|
+
pr_number = args.pr_number
|
|
427
|
+
if not pr_number:
|
|
428
|
+
pr_number = validator.get_pr_number_from_event()
|
|
429
|
+
|
|
430
|
+
if not pr_number:
|
|
431
|
+
print("Error: Could not determine PR number", file=sys.stderr)
|
|
432
|
+
sys.exit(1)
|
|
433
|
+
|
|
434
|
+
# Run validation
|
|
435
|
+
result = validator.validate_pr_changes(pr_number)
|
|
436
|
+
|
|
437
|
+
# Generate report
|
|
438
|
+
report = validator.generate_report(result)
|
|
439
|
+
|
|
440
|
+
# Output JSON report if requested
|
|
441
|
+
if args.output_json:
|
|
442
|
+
with open(args.output_json, 'w') as f:
|
|
443
|
+
json.dump(report, f, indent=2)
|
|
444
|
+
|
|
445
|
+
# Output PR comment if requested
|
|
446
|
+
if args.output_comment:
|
|
447
|
+
pr_url = (
|
|
448
|
+
f"https://github.com/{validator.repo_owner}/"
|
|
449
|
+
f"{validator.repo_name}/pull/{pr_number}"
|
|
450
|
+
)
|
|
451
|
+
comment = validator.format_pr_comment(result, pr_url)
|
|
452
|
+
with open(args.output_comment, 'w') as f:
|
|
453
|
+
f.write(comment)
|
|
454
|
+
|
|
455
|
+
# Print summary
|
|
456
|
+
print(result.format())
|
|
457
|
+
|
|
458
|
+
# Exit with error code if validation failed
|
|
459
|
+
sys.exit(0 if result.is_valid else 1)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
if __name__ == "__main__":
|
|
463
|
+
main()
|