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,335 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# @CODE:HOOK-REALTIME-001 | SPEC: TAG-REALTIME-HOOK-001 | TEST: tests/hooks/test_realtime_tag_monitor.py
|
|
3
|
+
"""실시간 TAG 모니터링 Hook
|
|
4
|
+
|
|
5
|
+
지속적인 TAG 상태 모니터링과 실시간 위반 탐지.
|
|
6
|
+
PreToolUse 단계에서 프로젝트 전체 TAG 상태를 빠르게 검사.
|
|
7
|
+
|
|
8
|
+
기능:
|
|
9
|
+
- 실시간 TAG 상태 모니터링
|
|
10
|
+
- 빠른 위반 탐지 (5초 내)
|
|
11
|
+
- 프로젝트 전체 TAG 무결성 검사
|
|
12
|
+
- 사용자에게 즉각적인 피드백
|
|
13
|
+
|
|
14
|
+
사용법:
|
|
15
|
+
python3 pre_tool__realtime_tag_monitor.py <tool_name> <tool_args_json>
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import sys
|
|
20
|
+
import time
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
from typing import Any, Dict, List
|
|
23
|
+
|
|
24
|
+
# 모듈 경로 추가
|
|
25
|
+
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent / "src"))
|
|
26
|
+
|
|
27
|
+
from moai_adk.core.tags.validator import CentralValidationResult, CentralValidator, ValidationConfig
|
|
28
|
+
|
|
29
|
+
from ..utils.hook_config import get_graceful_degradation, load_hook_timeout
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def load_config() -> Dict[str, Any]:
|
|
33
|
+
"""설정 파일 로드
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
설정 딕셔너리
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
config_file = Path(".moai/config.json")
|
|
40
|
+
if config_file.exists():
|
|
41
|
+
with open(config_file, 'r', encoding='utf-8') as f:
|
|
42
|
+
return json.load(f)
|
|
43
|
+
except Exception:
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
return {}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def create_validator() -> CentralValidator:
|
|
50
|
+
"""중앙 검증기 생성
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
CentralValidator 인스턴스
|
|
54
|
+
"""
|
|
55
|
+
config_data = load_config()
|
|
56
|
+
tag_policy_config = config_data.get("tags", {}).get("policy", {})
|
|
57
|
+
|
|
58
|
+
# ValidationConfig 생성
|
|
59
|
+
validation_config = ValidationConfig(
|
|
60
|
+
strict_mode=tag_policy_config.get("enforcement_mode", "strict") == "strict",
|
|
61
|
+
check_duplicates=True,
|
|
62
|
+
check_orphans=True,
|
|
63
|
+
check_chain_integrity=tag_policy_config.get("realtime_validation", {}).get("enforce_chains", True)
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return CentralValidator(config=validation_config)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def should_monitor(tool_name: str, tool_args: Dict[str, Any]) -> bool:
|
|
70
|
+
"""모니터링 대상 툴인지 확인
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
tool_name: 툴 이름
|
|
74
|
+
tool_args: 툴 인자
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
모니터링 대상이면 True
|
|
78
|
+
"""
|
|
79
|
+
# 파일 조작 툴만 모니터링
|
|
80
|
+
monitoring_tools = {"Edit", "Write", "MultiEdit"}
|
|
81
|
+
return tool_name in monitoring_tools
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def get_project_files_to_scan() -> List[str]:
|
|
85
|
+
"""스캔할 프로젝트 파일 목록 가져오기
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
파일 경로 목록
|
|
89
|
+
"""
|
|
90
|
+
files = []
|
|
91
|
+
important_patterns = [
|
|
92
|
+
"src/**/*.py",
|
|
93
|
+
"tests/**/*.py",
|
|
94
|
+
"**/*.md",
|
|
95
|
+
".claude/**/*",
|
|
96
|
+
".moai/**/*"
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
# 빠른 스캔을 위해 파일 수 제한
|
|
100
|
+
max_files = 50
|
|
101
|
+
|
|
102
|
+
for pattern in important_patterns:
|
|
103
|
+
if len(files) >= max_files:
|
|
104
|
+
break
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
for path in Path(".").glob(pattern):
|
|
108
|
+
if len(files) >= max_files:
|
|
109
|
+
break
|
|
110
|
+
if path.is_file():
|
|
111
|
+
files.append(str(path))
|
|
112
|
+
except Exception:
|
|
113
|
+
continue
|
|
114
|
+
|
|
115
|
+
return files[:max_files]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def create_quick_scan_result(validation_result: CentralValidationResult,
|
|
119
|
+
scan_time_ms: float) -> Dict[str, Any]:
|
|
120
|
+
"""빠른 스캔 결과 생성
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
validation_result: 검증 결과
|
|
124
|
+
scan_time_ms: 스캔 시간
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
스캔 결과 딕셔너리
|
|
128
|
+
"""
|
|
129
|
+
result = {
|
|
130
|
+
"quick_scan_completed": True,
|
|
131
|
+
"scan_time_ms": scan_time_ms,
|
|
132
|
+
"files_scanned": validation_result.statistics.total_files_scanned,
|
|
133
|
+
"tags_found": validation_result.statistics.total_tags_found,
|
|
134
|
+
"total_issues": validation_result.statistics.total_issues,
|
|
135
|
+
"is_valid": validation_result.is_valid
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# 심각한 문제만 요약
|
|
139
|
+
if validation_result.errors:
|
|
140
|
+
result["critical_issues"] = len(validation_result.errors)
|
|
141
|
+
result["error_summary"] = [
|
|
142
|
+
{
|
|
143
|
+
"type": error.type,
|
|
144
|
+
"tag": error.tag,
|
|
145
|
+
"message": error.message
|
|
146
|
+
}
|
|
147
|
+
for error in validation_result.errors[:5] # 최대 5개만 표시
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
if validation_result.warnings:
|
|
151
|
+
result["warnings"] = len(validation_result.warnings)
|
|
152
|
+
|
|
153
|
+
# 커버리지 정보
|
|
154
|
+
result["coverage_percentage"] = validation_result.statistics.coverage_percentage
|
|
155
|
+
|
|
156
|
+
# 상태 메시지
|
|
157
|
+
if validation_result.is_valid:
|
|
158
|
+
result["status_message"] = "✅ 프로젝트 TAG 상태 양호"
|
|
159
|
+
elif validation_result.errors:
|
|
160
|
+
result["status_message"] = f"🚨 {len(validation_result.errors)}개 치명적 문제 발견"
|
|
161
|
+
else:
|
|
162
|
+
result["status_message"] = f"⚠️ {len(validation_result.warnings)}개 경고 발견"
|
|
163
|
+
|
|
164
|
+
return result
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def create_health_check_result(issues_count: int,
|
|
168
|
+
coverage_percentage: float,
|
|
169
|
+
scan_time_ms: float) -> Dict[str, Any]:
|
|
170
|
+
"""프로젝트 건강 상태 결과 생성
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
issues_count: 문제 수
|
|
174
|
+
coverage_percentage: 커버리지
|
|
175
|
+
scan_time_ms: 스캔 시간
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
건강 상태 결과
|
|
179
|
+
"""
|
|
180
|
+
# 건강 상태 계산
|
|
181
|
+
health_score = 100
|
|
182
|
+
|
|
183
|
+
# 문제 점수 차감
|
|
184
|
+
health_score -= min(issues_count * 5, 50) # 최대 50점 차감
|
|
185
|
+
|
|
186
|
+
# 커버리지 점수
|
|
187
|
+
if coverage_percentage < 50:
|
|
188
|
+
health_score -= 20
|
|
189
|
+
elif coverage_percentage < 75:
|
|
190
|
+
health_score -= 10
|
|
191
|
+
|
|
192
|
+
health_score = max(0, health_score)
|
|
193
|
+
|
|
194
|
+
# 건강 등급
|
|
195
|
+
if health_score >= 90:
|
|
196
|
+
health_grade = "A"
|
|
197
|
+
health_message = "매우 좋음"
|
|
198
|
+
elif health_score >= 80:
|
|
199
|
+
health_grade = "B"
|
|
200
|
+
health_message = "좋음"
|
|
201
|
+
elif health_score >= 70:
|
|
202
|
+
health_grade = "C"
|
|
203
|
+
health_message = "보통"
|
|
204
|
+
elif health_score >= 60:
|
|
205
|
+
health_grade = "D"
|
|
206
|
+
health_message = "주의 필요"
|
|
207
|
+
else:
|
|
208
|
+
health_grade = "F"
|
|
209
|
+
health_message = "개선 필요"
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
"health_score": health_score,
|
|
213
|
+
"health_grade": health_grade,
|
|
214
|
+
"health_message": health_message,
|
|
215
|
+
"issues_count": issues_count,
|
|
216
|
+
"coverage_percentage": coverage_percentage,
|
|
217
|
+
"scan_time_ms": scan_time_ms
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def main() -> None:
|
|
222
|
+
"""메인 함수"""
|
|
223
|
+
try:
|
|
224
|
+
# 설정에서 타임아웃 값 로드 (밀리초 → 초)
|
|
225
|
+
timeout_seconds = load_hook_timeout() / 1000
|
|
226
|
+
graceful_degradation = get_graceful_degradation()
|
|
227
|
+
|
|
228
|
+
# 인자 파싱
|
|
229
|
+
if len(sys.argv) < 3:
|
|
230
|
+
print(json.dumps({
|
|
231
|
+
"quick_scan_completed": False,
|
|
232
|
+
"error": "Invalid arguments. Usage: python3 pre_tool__realtime_tag_monitor.py <tool_name> <tool_args_json>"
|
|
233
|
+
}))
|
|
234
|
+
sys.exit(0)
|
|
235
|
+
|
|
236
|
+
tool_name = sys.argv[1]
|
|
237
|
+
try:
|
|
238
|
+
tool_args = json.loads(sys.argv[2])
|
|
239
|
+
except json.JSONDecodeError:
|
|
240
|
+
print(json.dumps({
|
|
241
|
+
"quick_scan_completed": False,
|
|
242
|
+
"error": "Invalid tool_args JSON"
|
|
243
|
+
}))
|
|
244
|
+
sys.exit(0)
|
|
245
|
+
|
|
246
|
+
# 모니터링 대상 확인
|
|
247
|
+
if not should_monitor(tool_name, tool_args):
|
|
248
|
+
print(json.dumps({
|
|
249
|
+
"quick_scan_completed": True,
|
|
250
|
+
"message": "모니터링 대상 아님"
|
|
251
|
+
}))
|
|
252
|
+
sys.exit(0)
|
|
253
|
+
|
|
254
|
+
# 시작 시간 기록
|
|
255
|
+
start_time = time.time()
|
|
256
|
+
|
|
257
|
+
# 스캔할 파일 목록 가져오기
|
|
258
|
+
files_to_scan = get_project_files_to_scan()
|
|
259
|
+
if not files_to_scan:
|
|
260
|
+
print(json.dumps({
|
|
261
|
+
"quick_scan_completed": True,
|
|
262
|
+
"message": "스캔할 파일 없음"
|
|
263
|
+
}))
|
|
264
|
+
sys.exit(0)
|
|
265
|
+
|
|
266
|
+
# 검증기 생성
|
|
267
|
+
validator = create_validator()
|
|
268
|
+
|
|
269
|
+
# 빠른 검증 실행 (설정된 타임아웃 사용)
|
|
270
|
+
try:
|
|
271
|
+
# 타임아웃 체크
|
|
272
|
+
if time.time() - start_time > timeout_seconds:
|
|
273
|
+
raise TimeoutError("Real-time monitoring timeout")
|
|
274
|
+
|
|
275
|
+
validation_result = validator.validate_files(files_to_scan)
|
|
276
|
+
except Exception as e:
|
|
277
|
+
# 검증 실패시 타임아웃 처리
|
|
278
|
+
scan_time = (time.time() - start_time) * 1000
|
|
279
|
+
error_response = {
|
|
280
|
+
"quick_scan_completed": False,
|
|
281
|
+
"error": f"검증 타임아웃: {str(e)}",
|
|
282
|
+
"scan_time_ms": scan_time,
|
|
283
|
+
"message": "실시간 검증 타임아웃 - 정상 작동으로 간주"
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if graceful_degradation:
|
|
287
|
+
error_response["graceful_degradation"] = True
|
|
288
|
+
error_response["message"] = "Real-time monitoring timeout but continuing due to graceful degradation"
|
|
289
|
+
|
|
290
|
+
print(json.dumps(error_response, ensure_ascii=False))
|
|
291
|
+
sys.exit(0)
|
|
292
|
+
|
|
293
|
+
scan_time_ms = (time.time() - start_time) * 1000
|
|
294
|
+
|
|
295
|
+
# 결과 생성
|
|
296
|
+
scan_result = create_quick_scan_result(validation_result, scan_time_ms)
|
|
297
|
+
|
|
298
|
+
# 건강 상태 검사
|
|
299
|
+
health_result = create_health_check_result(
|
|
300
|
+
validation_result.statistics.total_issues,
|
|
301
|
+
validation_result.statistics.coverage_percentage,
|
|
302
|
+
scan_time_ms
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
# 최종 응답
|
|
306
|
+
response = {
|
|
307
|
+
**scan_result,
|
|
308
|
+
"health_check": health_result,
|
|
309
|
+
"monitoring_type": "realtime_quick_scan"
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
# 타임아웃 경고
|
|
313
|
+
timeout_warning_ms = timeout_seconds * 1000 * 0.8 # 80% of timeout
|
|
314
|
+
if scan_time_ms > timeout_warning_ms:
|
|
315
|
+
response["performance_warning"] = f"스캔 시간이 설정된 타임아웃의 80%를 초과했습니다 ({scan_time_ms:.0f}ms / {timeout_warning_ms:.0f}ms)"
|
|
316
|
+
|
|
317
|
+
print(json.dumps(response, ensure_ascii=False, indent=2))
|
|
318
|
+
|
|
319
|
+
except Exception as e:
|
|
320
|
+
# 예외 발생시 기본 응답
|
|
321
|
+
error_response = {
|
|
322
|
+
"quick_scan_completed": False,
|
|
323
|
+
"error": f"Hook execution error: {str(e)}",
|
|
324
|
+
"message": "실시간 모니터링 오류 - 정상 작동으로 간주"
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if graceful_degradation:
|
|
328
|
+
error_response["graceful_degradation"] = True
|
|
329
|
+
error_response["message"] = "Real-time monitoring failed but continuing due to graceful degradation"
|
|
330
|
+
|
|
331
|
+
print(json.dumps(error_response, ensure_ascii=False))
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
if __name__ == "__main__":
|
|
335
|
+
main()
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# @CODE:HOOK-PRE-TAG-001 | SPEC: TAG-PRE-HOOK-001 | TEST: tests/hooks/test_pre_tool_tag_validator.py
|
|
3
|
+
"""PreToolUse Hook: TAG 정책 위반 실시간 차단
|
|
4
|
+
|
|
5
|
+
Edit/Write/MultiEdit 실행 전 TAG 정책 위반을 탐지하고 차단.
|
|
6
|
+
SPEC-first 원칙을 강제하여 코드 품질 보증.
|
|
7
|
+
|
|
8
|
+
기능:
|
|
9
|
+
- 파일 생성 전 TAG 정책 검증
|
|
10
|
+
- SPEC 없이 CODE 생성 시 차단
|
|
11
|
+
- 실시간 위반 보고 및 수정 가이드
|
|
12
|
+
- 작업 차단 또는 경고 제공
|
|
13
|
+
|
|
14
|
+
사용법:
|
|
15
|
+
python3 pre_tool__tag_policy_validator.py <tool_name> <tool_args_json>
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import sys
|
|
20
|
+
import time
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
from typing import Any, Dict, List
|
|
23
|
+
|
|
24
|
+
# 모듈 경로 추가
|
|
25
|
+
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent / "src"))
|
|
26
|
+
|
|
27
|
+
from moai_adk.core.tags.policy_validator import (
|
|
28
|
+
PolicyValidationConfig,
|
|
29
|
+
PolicyViolation,
|
|
30
|
+
PolicyViolationLevel,
|
|
31
|
+
TagPolicyValidator,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
from ..utils.hook_config import get_graceful_degradation, load_hook_timeout
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def load_config() -> Dict[str, Any]:
|
|
38
|
+
"""설정 파일 로드
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
설정 딕셔너리
|
|
42
|
+
"""
|
|
43
|
+
try:
|
|
44
|
+
config_file = Path(".moai/config.json")
|
|
45
|
+
if config_file.exists():
|
|
46
|
+
with open(config_file, 'r', encoding='utf-8') as f:
|
|
47
|
+
return json.load(f)
|
|
48
|
+
except Exception:
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
return {}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def create_policy_validator() -> TagPolicyValidator:
|
|
55
|
+
"""TAG 정책 검증기 생성
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
TagPolicyValidator 인스턴스
|
|
59
|
+
"""
|
|
60
|
+
config_data = load_config()
|
|
61
|
+
tag_policy_config = config_data.get("tags", {}).get("policy", {})
|
|
62
|
+
|
|
63
|
+
# PolicyValidationConfig 생성
|
|
64
|
+
policy_config = PolicyValidationConfig(
|
|
65
|
+
strict_mode=tag_policy_config.get("enforcement_mode", "strict") == "strict",
|
|
66
|
+
require_spec_before_code=tag_policy_config.get("require_spec_before_code", True),
|
|
67
|
+
require_test_for_code=tag_policy_config.get("require_test_for_code", True),
|
|
68
|
+
allow_duplicate_tags=not tag_policy_config.get("enforce_chains", True),
|
|
69
|
+
validation_timeout=tag_policy_config.get("realtime_validation", {}).get("validation_timeout", 5),
|
|
70
|
+
auto_fix_enabled=tag_policy_config.get("auto_correction", {}).get("enabled", False)
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return TagPolicyValidator(config=policy_config)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def should_validate_tool(tool_name: str, tool_args: Dict[str, Any]) -> bool:
|
|
77
|
+
"""검증 대상 툴인지 확인
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
tool_name: 툴 이름
|
|
81
|
+
tool_args: 툴 인자
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
검증 대상이면 True
|
|
85
|
+
"""
|
|
86
|
+
# 파일 조작 툴만 검증
|
|
87
|
+
validation_tools = {"Edit", "Write", "MultiEdit"}
|
|
88
|
+
if tool_name not in validation_tools:
|
|
89
|
+
return False
|
|
90
|
+
|
|
91
|
+
# CLAUDE.md 파일은 TAG 검증에서 제외
|
|
92
|
+
if tool_name in {"Edit", "Write"}:
|
|
93
|
+
file_path = tool_args.get("file_path", "")
|
|
94
|
+
if file_path.endswith("CLAUDE.md"):
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
# MultiEdit의 경우 CLAUDE.md 포함 여부 확인
|
|
98
|
+
if tool_name == "MultiEdit":
|
|
99
|
+
edits = tool_args.get("edits", [])
|
|
100
|
+
for edit in edits:
|
|
101
|
+
file_path = edit.get("file_path", "")
|
|
102
|
+
if file_path.endswith("CLAUDE.md"):
|
|
103
|
+
return False
|
|
104
|
+
|
|
105
|
+
return True
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def extract_file_paths(tool_name: str, tool_args: Dict[str, Any]) -> List[str]:
|
|
109
|
+
"""툴 인자에서 파일 경로 추출
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
tool_name: 툴 이름
|
|
113
|
+
tool_args: 툴 인자
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
파일 경로 목록
|
|
117
|
+
"""
|
|
118
|
+
file_paths = []
|
|
119
|
+
|
|
120
|
+
if tool_name in {"Edit", "Write"}:
|
|
121
|
+
file_path = tool_args.get("file_path", "")
|
|
122
|
+
if file_path:
|
|
123
|
+
file_paths.append(file_path)
|
|
124
|
+
|
|
125
|
+
elif tool_name == "MultiEdit":
|
|
126
|
+
# MultiEdit의 경우 여러 파일 경로 추출
|
|
127
|
+
edits = tool_args.get("edits", [])
|
|
128
|
+
for edit in edits:
|
|
129
|
+
file_path = edit.get("file_path", "")
|
|
130
|
+
if file_path:
|
|
131
|
+
file_paths.append(file_path)
|
|
132
|
+
|
|
133
|
+
return file_paths
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def get_file_content(tool_name: str, tool_args: Dict[str, Any], file_path: str) -> str:
|
|
137
|
+
"""파일 내용 가져오기
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
tool_name: 툴 이름
|
|
141
|
+
tool_args: 툴 인자
|
|
142
|
+
file_path: 파일 경로
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
파일 내용
|
|
146
|
+
"""
|
|
147
|
+
# Write: 새 내용
|
|
148
|
+
if tool_name == "Write":
|
|
149
|
+
return tool_args.get("content", "")
|
|
150
|
+
|
|
151
|
+
# Edit/MultiEdit: 기존 내용에 수정 적용
|
|
152
|
+
try:
|
|
153
|
+
path = Path(file_path)
|
|
154
|
+
if path.exists():
|
|
155
|
+
return path.read_text(encoding="utf-8", errors="ignore")
|
|
156
|
+
except Exception:
|
|
157
|
+
pass
|
|
158
|
+
|
|
159
|
+
return ""
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def create_block_response(violations: List[PolicyViolation]) -> Dict[str, Any]:
|
|
163
|
+
"""작업 차단 응답 생성
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
violations: 정책 위반 목록
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
차단 응답 딕셔너리
|
|
170
|
+
"""
|
|
171
|
+
critical_violations = [v for v in violations if v.level == PolicyViolationLevel.CRITICAL]
|
|
172
|
+
blocking_violations = [v for v in violations if v.should_block_operation()]
|
|
173
|
+
|
|
174
|
+
response = {
|
|
175
|
+
"block_execution": True,
|
|
176
|
+
"reason": "TAG 정책 위반",
|
|
177
|
+
"violations": [v.to_dict() for v in blocking_violations],
|
|
178
|
+
"message": "❌ TAG 정책 위반으로 작업이 차단되었습니다.",
|
|
179
|
+
"guidance": []
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if critical_violations:
|
|
183
|
+
response["message"] = "🚨 치명적인 TAG 정책 위반입니다. 작업을 진행할 수 없습니다."
|
|
184
|
+
response["critical_violations"] = [v.to_dict() for v in critical_violations]
|
|
185
|
+
|
|
186
|
+
# 수정 가이드 추가
|
|
187
|
+
for violation in blocking_violations:
|
|
188
|
+
if violation.guidance:
|
|
189
|
+
response["guidance"].append(f"• {violation.guidance}")
|
|
190
|
+
|
|
191
|
+
return response
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def create_warning_response(violations: List[PolicyViolation]) -> Dict[str, Any]:
|
|
195
|
+
"""경고 응답 생성
|
|
196
|
+
|
|
197
|
+
Args:
|
|
198
|
+
violations: 정책 위반 목록
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
경고 응답 딕셔너리
|
|
202
|
+
"""
|
|
203
|
+
response = {
|
|
204
|
+
"block_execution": False,
|
|
205
|
+
"reason": "TAG 정책 경고",
|
|
206
|
+
"violations": [v.to_dict() for v in violations],
|
|
207
|
+
"message": "⚠️ TAG 정책 경고가 있지만 작업을 진행할 수 있습니다.",
|
|
208
|
+
"guidance": []
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
# 수정 가이드 추가
|
|
212
|
+
for violation in violations:
|
|
213
|
+
if violation.guidance:
|
|
214
|
+
response["guidance"].append(f"• {violation.guidance}")
|
|
215
|
+
|
|
216
|
+
return response
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def create_success_response() -> Dict[str, Any]:
|
|
220
|
+
"""성공 응답 생성
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
성공 응답 딕셔너리
|
|
224
|
+
"""
|
|
225
|
+
return {
|
|
226
|
+
"block_execution": False,
|
|
227
|
+
"reason": "TAG 정책 준수",
|
|
228
|
+
"violations": [],
|
|
229
|
+
"message": "✅ TAG 정책 검증 통과",
|
|
230
|
+
"guidance": []
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def main() -> None:
|
|
235
|
+
"""메인 함수"""
|
|
236
|
+
try:
|
|
237
|
+
# 설정에서 타임아웃 값 로드 (밀리초 → 초)
|
|
238
|
+
timeout_seconds = load_hook_timeout() / 1000
|
|
239
|
+
graceful_degradation = get_graceful_degradation()
|
|
240
|
+
|
|
241
|
+
# 인자 파싱
|
|
242
|
+
if len(sys.argv) < 3:
|
|
243
|
+
print(json.dumps({
|
|
244
|
+
"block_execution": False,
|
|
245
|
+
"error": "Invalid arguments. Usage: python3 pre_tool__tag_policy_validator.py <tool_name> <tool_args_json>"
|
|
246
|
+
}))
|
|
247
|
+
sys.exit(0)
|
|
248
|
+
|
|
249
|
+
tool_name = sys.argv[1]
|
|
250
|
+
try:
|
|
251
|
+
tool_args = json.loads(sys.argv[2])
|
|
252
|
+
except json.JSONDecodeError:
|
|
253
|
+
print(json.dumps({
|
|
254
|
+
"block_execution": False,
|
|
255
|
+
"error": "Invalid tool_args JSON"
|
|
256
|
+
}))
|
|
257
|
+
sys.exit(0)
|
|
258
|
+
|
|
259
|
+
# 시작 시간 기록 (타임아웃 체크용)
|
|
260
|
+
start_time = time.time()
|
|
261
|
+
|
|
262
|
+
# 툴 검증 여부 확인
|
|
263
|
+
if not should_validate_tool(tool_name, tool_args):
|
|
264
|
+
print(json.dumps(create_success_response()))
|
|
265
|
+
sys.exit(0)
|
|
266
|
+
|
|
267
|
+
# 파일 경로 추출
|
|
268
|
+
file_paths = extract_file_paths(tool_name, tool_args)
|
|
269
|
+
if not file_paths:
|
|
270
|
+
print(json.dumps(create_success_response()))
|
|
271
|
+
sys.exit(0)
|
|
272
|
+
|
|
273
|
+
# 정책 검증기 생성
|
|
274
|
+
validator = create_policy_validator()
|
|
275
|
+
|
|
276
|
+
# 모든 파일에 대해 검증
|
|
277
|
+
all_violations = []
|
|
278
|
+
for file_path in file_paths:
|
|
279
|
+
# 타임아웃 체크
|
|
280
|
+
if time.time() - start_time > timeout_seconds:
|
|
281
|
+
break
|
|
282
|
+
|
|
283
|
+
# 파일 내용 가져오기
|
|
284
|
+
content = get_file_content(tool_name, tool_args, file_path)
|
|
285
|
+
|
|
286
|
+
# 정책 검증
|
|
287
|
+
violations = validator.validate_before_creation(file_path, content)
|
|
288
|
+
all_violations.extend(violations)
|
|
289
|
+
|
|
290
|
+
# 위반 수준별 분류
|
|
291
|
+
blocking_violations = [v for v in all_violations if v.should_block_operation()]
|
|
292
|
+
warning_violations = [v for v in all_violations if not v.should_block_operation()]
|
|
293
|
+
|
|
294
|
+
# 응답 생성
|
|
295
|
+
if blocking_violations:
|
|
296
|
+
response = create_block_response(blocking_violations)
|
|
297
|
+
elif warning_violations:
|
|
298
|
+
response = create_warning_response(warning_violations)
|
|
299
|
+
else:
|
|
300
|
+
response = create_success_response()
|
|
301
|
+
|
|
302
|
+
# 검증 보고서 추가
|
|
303
|
+
if all_violations:
|
|
304
|
+
validation_report = validator.create_validation_report(all_violations)
|
|
305
|
+
response["validation_report"] = validation_report
|
|
306
|
+
|
|
307
|
+
print(json.dumps(response, ensure_ascii=False, indent=2))
|
|
308
|
+
|
|
309
|
+
except Exception as e:
|
|
310
|
+
# 예외 발생 시 차단하지 않고 로그만 남김
|
|
311
|
+
error_response = {
|
|
312
|
+
"block_execution": False,
|
|
313
|
+
"error": f"Hook execution error: {str(e)}",
|
|
314
|
+
"message": "Hook 실행 중 오류가 발생했지만 작업을 진행합니다."
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if graceful_degradation:
|
|
318
|
+
error_response["graceful_degradation"] = True
|
|
319
|
+
error_response["message"] = "Hook failed but continuing due to graceful degradation"
|
|
320
|
+
|
|
321
|
+
print(json.dumps(error_response, ensure_ascii=False))
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
if __name__ == "__main__":
|
|
325
|
+
main()
|