moai-adk 0.11.0__py3-none-any.whl → 0.12.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/core/issue_creator.py +2 -2
- moai_adk/core/project/detector.py +285 -12
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +316 -0
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +208 -0
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +214 -0
- moai_adk/templates/.claude/agents/alfred/git-manager.md +406 -0
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +350 -0
- moai_adk/templates/.claude/agents/alfred/project-manager.md +273 -0
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +343 -0
- moai_adk/templates/.claude/agents/alfred/skill-factory.md +865 -0
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +287 -0
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +287 -0
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +326 -0
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +375 -0
- moai_adk/templates/.claude/commands/alfred/0-project.md +1187 -0
- moai_adk/templates/.claude/commands/alfred/1-plan.md +734 -0
- moai_adk/templates/.claude/commands/alfred/2-run.md +551 -0
- moai_adk/templates/.claude/commands/alfred/3-sync.md +689 -0
- moai_adk/templates/.claude/commands/alfred/9-feedback.md +149 -0
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +208 -0
- moai_adk/templates/.claude/hooks/alfred/core/project.py +744 -0
- moai_adk/templates/.claude/hooks/alfred/core/timeout.py +136 -0
- moai_adk/templates/.claude/hooks/alfred/core/ttl_cache.py +109 -0
- moai_adk/templates/.claude/hooks/alfred/core/version_cache.py +198 -0
- moai_adk/templates/.claude/hooks/alfred/notification__handle_events.py +94 -0
- moai_adk/templates/.claude/hooks/alfred/post_tool__log_changes.py +94 -0
- moai_adk/templates/.claude/hooks/alfred/pre_tool__auto_checkpoint.py +100 -0
- moai_adk/templates/.claude/hooks/alfred/session_end__cleanup.py +94 -0
- moai_adk/templates/.claude/hooks/alfred/session_start__show_project_info.py +94 -0
- moai_adk/templates/.claude/hooks/alfred/shared/core/__init__.py +170 -0
- moai_adk/templates/.claude/hooks/alfred/shared/core/checkpoint.py +271 -0
- moai_adk/templates/.claude/hooks/alfred/shared/core/context.py +67 -0
- 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/notification.py +156 -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/stop__handle_interrupt.py +94 -0
- moai_adk/templates/.claude/hooks/alfred/subagent_stop__handle_subagent_end.py +94 -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/timeout.py +136 -0
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +640 -0
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +696 -0
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +474 -0
- moai_adk/templates/.claude/settings.json +144 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +113 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +122 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/reference.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +237 -0
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +615 -0
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +653 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +113 -0
- 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-spec-metadata-validation/SKILL.md +113 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +113 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/reference.md +28 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +113 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/examples.md +29 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/reference.md +28 -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-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-domain-backend/SKILL.md +290 -0
- 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 +123 -0
- 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 +123 -0
- 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 +123 -0
- 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 +124 -0
- 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 +124 -0
- 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 +123 -0
- 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 +123 -0
- 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 +123 -0
- 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 +123 -0
- 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 +303 -0
- 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 +113 -0
- 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 +113 -0
- 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 +113 -0
- 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 +116 -0
- 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 +122 -0
- 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 +113 -0
- 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 +113 -0
- 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 +113 -0
- 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/SKILL.md +307 -0
- 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-lang-c/SKILL.md +124 -0
- 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 +124 -0
- 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 +123 -0
- 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 +123 -0
- 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 +124 -0
- 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 +124 -0
- 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 +125 -0
- 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 +124 -0
- 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 +123 -0
- 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 +431 -0
- 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 +123 -0
- 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 +124 -0
- 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 +124 -0
- 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 +123 -0
- 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 +123 -0
- 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 +124 -0
- 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 +123 -0
- 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-typescript/SKILL.md +127 -0
- 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-skill-factory/CHECKLIST.md +482 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/EXAMPLES.md +278 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/INTERACTIVE-DISCOVERY.md +524 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/METADATA.md +477 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/PARALLEL-ANALYSIS-REPORT.md +429 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/PYTHON-VERSION-MATRIX.md +391 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-FACTORY-WORKFLOW.md +431 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-UPDATE-ADVISOR.md +577 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/SKILL.md +271 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/STEP-BY-STEP-GUIDE.md +466 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/STRUCTURE.md +583 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/WEB-RESEARCH.md +526 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/reference.md +465 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/scripts/generate-structure.sh +328 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/scripts/validate-skill.sh +312 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/templates/SKILL_TEMPLATE.md +245 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/templates/examples-template.md +285 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/templates/reference-template.md +278 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/templates/scripts-template.sh +303 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/README.md +137 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/SKILL.md +219 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/examples/validate-spec.sh +161 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/examples.md +541 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/reference.md +622 -0
- moai_adk/templates/.github/workflows/c-tag-validation.yml +83 -0
- moai_adk/templates/.github/workflows/cpp-tag-validation.yml +79 -0
- moai_adk/templates/.github/workflows/csharp-tag-validation.yml +65 -0
- moai_adk/templates/.github/workflows/dart-tag-validation.yml +82 -0
- moai_adk/templates/.github/workflows/java-tag-validation.yml +75 -0
- moai_adk/templates/.github/workflows/kotlin-tag-validation.yml +67 -0
- moai_adk/templates/.github/workflows/php-tag-validation.yml +56 -0
- moai_adk/templates/.github/workflows/ruby-tag-validation.yml +68 -0
- moai_adk/templates/.github/workflows/rust-tag-validation.yml +73 -0
- moai_adk/templates/.github/workflows/shell-tag-validation.yml +65 -0
- moai_adk/templates/.github/workflows/swift-tag-validation.yml +79 -0
- moai_adk/templates/.moai/config.json +113 -0
- moai_adk/templates/.moai/memory/CLAUDE-AGENTS-GUIDE.md +208 -0
- moai_adk/templates/.moai/memory/CLAUDE-PRACTICES.md +369 -0
- moai_adk/templates/.moai/memory/CLAUDE-RULES.md +539 -0
- moai_adk/templates/.moai/memory/DEVELOPMENT-GUIDE.md +344 -0
- moai_adk/templates/.moai/memory/GITFLOW-PROTECTION-POLICY.md +330 -0
- moai_adk/templates/.moai/memory/ISSUE-LABEL-MAPPING.md +150 -0
- moai_adk/templates/.moai/memory/SKILLS-DESCRIPTION-POLICY.md +218 -0
- moai_adk/templates/.moai/memory/SPEC-METADATA.md +356 -0
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +330 -0
- moai_adk/templates/.moai/memory/spec-metadata.md +356 -0
- moai_adk/templates/.moai/project/product.md +161 -0
- moai_adk/templates/.moai/project/structure.md +156 -0
- moai_adk/templates/.moai/project/tech.md +227 -0
- moai_adk/templates/CLAUDE.md +90 -10
- moai_adk/templates/workflows/go-tag-validation.yml +130 -0
- moai_adk/templates/workflows/javascript-tag-validation.yml +135 -0
- moai_adk/templates/workflows/python-tag-validation.yml +118 -0
- moai_adk/templates/workflows/typescript-tag-validation.yml +154 -0
- {moai_adk-0.11.0.dist-info → moai_adk-0.12.1.dist-info}/METADATA +43 -1
- moai_adk-0.12.1.dist-info/RECORD +330 -0
- moai_adk-0.11.0.dist-info/RECORD +0 -77
- /moai_adk/templates/.github/workflows/{release.yml → moai-adk-release.yml} +0 -0
- /moai_adk/templates/.github/workflows/{spec-issue-sync.yml → moai-adk-spec-issue-sync.yml} +0 -0
- /moai_adk/templates/.github/workflows/{tag-validation.yml → moai-adk-tag-validation.yml} +0 -0
- {moai_adk-0.11.0.dist-info → moai_adk-0.12.1.dist-info}/WHEEL +0 -0
- {moai_adk-0.11.0.dist-info → moai_adk-0.12.1.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.11.0.dist-info → moai_adk-0.12.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Event-Driven Checkpoint system
|
|
3
|
+
|
|
4
|
+
Detect risky tasks and create automatic checkpoints
|
|
5
|
+
@TAG:CHECKPOINT-EVENT-001
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
import subprocess
|
|
11
|
+
from datetime import datetime
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
# Script execution pattern for each language supported by MoAI-ADK
|
|
16
|
+
# Python, TypeScript, Java, Go, Rust, Dart, Swift, Kotlin + Shell
|
|
17
|
+
SCRIPT_EXECUTION_PATTERN = re.compile(
|
|
18
|
+
r"\b("
|
|
19
|
+
# Python ecosystem
|
|
20
|
+
r"python3?|pytest|pip|uv|"
|
|
21
|
+
# JavaScript/TypeScript ecosystem
|
|
22
|
+
r"node|npm|npx|yarn|bun|tsx|ts-node|vitest|jest|"
|
|
23
|
+
# Java ecosystem
|
|
24
|
+
r"java|javac|mvn|gradle|"
|
|
25
|
+
# Go
|
|
26
|
+
r"go|"
|
|
27
|
+
# Rust
|
|
28
|
+
r"cargo|"
|
|
29
|
+
# Dart/Flutter
|
|
30
|
+
r"dart|flutter|"
|
|
31
|
+
# Swift
|
|
32
|
+
r"swift|xcodebuild|"
|
|
33
|
+
# Kotlin
|
|
34
|
+
r"kotlinc?|"
|
|
35
|
+
# Shell scripts and build tools
|
|
36
|
+
r"bash|sh|zsh|fish|make"
|
|
37
|
+
r")\b"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def detect_risky_operation(tool_name: str, tool_args: dict[str, Any], cwd: str) -> tuple[bool, str]:
|
|
42
|
+
"""Risk task detection (for Event-Driven Checkpoint)
|
|
43
|
+
|
|
44
|
+
Claude Code tool automatically detects dangerous tasks before use.
|
|
45
|
+
When a risk is detected, a checkpoint is automatically created to enable rollback.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
tool_name: Name of the Claude Code tool (Bash, Edit, Write, MultiEdit)
|
|
49
|
+
tool_args: Tool argument dictionary
|
|
50
|
+
cwd: Project root directory path
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
(is_risky, operation_type) tuple
|
|
54
|
+
- is_risky: Whether the operation is dangerous (bool)
|
|
55
|
+
- operation_type: operation type (str: delete, merge, script, critical-file, refactor)
|
|
56
|
+
|
|
57
|
+
Risky Operations:
|
|
58
|
+
- Bash tool: rm -rf, git merge, git reset --hard, git rebase, script execution
|
|
59
|
+
- Edit/Write tool: CLAUDE.md, config.json, .moai/memory/*.md
|
|
60
|
+
- MultiEdit tool: Edit ≥10 items File simultaneously
|
|
61
|
+
- Script execution: Python, Node, Java, Go, Rust, Dart, Swift, Kotlin, Shell scripts
|
|
62
|
+
|
|
63
|
+
Examples:
|
|
64
|
+
>>> detect_risky_operation("Bash", {"command": "rm -rf src/"}, ".")
|
|
65
|
+
(True, 'delete')
|
|
66
|
+
>>> detect_risky_operation("Edit", {"file_path": "CLAUDE.md"}, ".")
|
|
67
|
+
(True, 'critical-file')
|
|
68
|
+
>>> detect_risky_operation("Read", {"file_path": "test.py"}, ".")
|
|
69
|
+
(False, '')
|
|
70
|
+
|
|
71
|
+
Notes:
|
|
72
|
+
- Minimize false positives: ignore safe operations
|
|
73
|
+
- Performance: lightweight string matching (< 1ms)
|
|
74
|
+
- Extensibility: Easily added to the patterns dictionary
|
|
75
|
+
|
|
76
|
+
@TAG:CHECKPOINT-EVENT-001
|
|
77
|
+
"""
|
|
78
|
+
# Bash tool: Detect dangerous commands
|
|
79
|
+
if tool_name == "Bash":
|
|
80
|
+
command = tool_args.get("command", "")
|
|
81
|
+
|
|
82
|
+
# Mass Delete
|
|
83
|
+
if any(pattern in command for pattern in ["rm -rf", "git rm"]):
|
|
84
|
+
return (True, "delete")
|
|
85
|
+
|
|
86
|
+
# Git merge/reset/rebase
|
|
87
|
+
if any(pattern in command for pattern in ["git merge", "git reset --hard", "git rebase"]):
|
|
88
|
+
return (True, "merge")
|
|
89
|
+
|
|
90
|
+
# Execute external script (potentially destructive)
|
|
91
|
+
if any(command.startswith(prefix) for prefix in ["python ", "node ", "bash ", "sh "]):
|
|
92
|
+
return (True, "script")
|
|
93
|
+
|
|
94
|
+
# Edit/Write tool: Detect important files
|
|
95
|
+
if tool_name in ("Edit", "Write"):
|
|
96
|
+
file_path = tool_args.get("file_path", "")
|
|
97
|
+
|
|
98
|
+
critical_files = [
|
|
99
|
+
"CLAUDE.md",
|
|
100
|
+
"config.json",
|
|
101
|
+
".moai/memory/development-guide.md",
|
|
102
|
+
".moai/memory/spec-metadata.md",
|
|
103
|
+
".moai/config.json",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
if any(cf in file_path for cf in critical_files):
|
|
107
|
+
return (True, "critical-file")
|
|
108
|
+
|
|
109
|
+
# MultiEdit tool: Detect large edits
|
|
110
|
+
if tool_name == "MultiEdit":
|
|
111
|
+
edits = tool_args.get("edits", [])
|
|
112
|
+
if len(edits) >= 10:
|
|
113
|
+
return (True, "refactor")
|
|
114
|
+
|
|
115
|
+
return (False, "")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def create_checkpoint(cwd: str, operation_type: str) -> str:
|
|
119
|
+
"""Create checkpoint (Git local branch)
|
|
120
|
+
|
|
121
|
+
Automatically creates checkpoints before dangerous operations.
|
|
122
|
+
Prevent remote repository contamination by creating a Git local branch.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
cwd: Project root directory path
|
|
126
|
+
operation_type: operation type (delete, merge, script, etc.)
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
checkpoint_branch: Created branch name
|
|
130
|
+
Returns "checkpoint-failed" on failure
|
|
131
|
+
|
|
132
|
+
Branch Naming:
|
|
133
|
+
before-{operation}-{YYYYMMDD-HHMMSS}
|
|
134
|
+
Example: before-delete-20251015-143000
|
|
135
|
+
|
|
136
|
+
Examples:
|
|
137
|
+
>>> create_checkpoint(".", "delete")
|
|
138
|
+
'before-delete-20251015-143000'
|
|
139
|
+
|
|
140
|
+
Notes:
|
|
141
|
+
- Create only local branch (no remote push)
|
|
142
|
+
- Fallback in case of Git error (ignore and continue)
|
|
143
|
+
- Do not check dirty working directory (allow uncommitted changes)
|
|
144
|
+
- Automatically record checkpoint logs (.moai/checkpoints.log)
|
|
145
|
+
|
|
146
|
+
@TAG:CHECKPOINT-EVENT-001
|
|
147
|
+
"""
|
|
148
|
+
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
|
149
|
+
branch_name = f"before-{operation_type}-{timestamp}"
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
# Create a new local branch from the current branch (without checking out)
|
|
153
|
+
subprocess.run(
|
|
154
|
+
["git", "branch", branch_name],
|
|
155
|
+
cwd=cwd,
|
|
156
|
+
check=True,
|
|
157
|
+
capture_output=True,
|
|
158
|
+
text=True,
|
|
159
|
+
timeout=2,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# Checkpoint log records
|
|
163
|
+
log_checkpoint(cwd, branch_name, operation_type)
|
|
164
|
+
|
|
165
|
+
return branch_name
|
|
166
|
+
|
|
167
|
+
except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError):
|
|
168
|
+
# Fallback (ignore) in case of Git error
|
|
169
|
+
return "checkpoint-failed"
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def log_checkpoint(cwd: str, branch_name: str, operation_type: str) -> None:
|
|
173
|
+
"""Checkpoint log records (.moai/checkpoints.log)
|
|
174
|
+
|
|
175
|
+
Checkpoint creation history is recorded in JSON Lines format.
|
|
176
|
+
SessionStart reads this log to display a list of checkpoints.
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
cwd: Project root directory path
|
|
180
|
+
branch_name: Created checkpoint branch name
|
|
181
|
+
operation_type: operation type
|
|
182
|
+
|
|
183
|
+
Log Format (JSON Lines):
|
|
184
|
+
{"timestamp": "2025-10-15T14:30:00", "branch": "before-delete-...", "operation": "delete"}
|
|
185
|
+
|
|
186
|
+
Examples:
|
|
187
|
+
>>> log_checkpoint(".", "before-delete-20251015-143000", "delete")
|
|
188
|
+
# Add 1 line to .moai/checkpoints.log
|
|
189
|
+
|
|
190
|
+
Notes:
|
|
191
|
+
- If the file does not exist, it is automatically created.
|
|
192
|
+
- Record in append mode (preserve existing logs)
|
|
193
|
+
- Ignored in case of failure (not critical)
|
|
194
|
+
|
|
195
|
+
@TAG:CHECKPOINT-EVENT-001
|
|
196
|
+
"""
|
|
197
|
+
log_file = Path(cwd) / ".moai" / "checkpoints.log"
|
|
198
|
+
|
|
199
|
+
try:
|
|
200
|
+
log_file.parent.mkdir(parents=True, exist_ok=True)
|
|
201
|
+
|
|
202
|
+
log_entry = {
|
|
203
|
+
"timestamp": datetime.now().isoformat(),
|
|
204
|
+
"branch": branch_name,
|
|
205
|
+
"operation": operation_type,
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
with log_file.open("a") as f:
|
|
209
|
+
f.write(json.dumps(log_entry) + "\n")
|
|
210
|
+
|
|
211
|
+
except (OSError, PermissionError):
|
|
212
|
+
# Ignore log failures (not critical)
|
|
213
|
+
pass
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def list_checkpoints(cwd: str, max_count: int = 10) -> list[dict[str, str]]:
|
|
217
|
+
"""Checkpoint list (parsing .moai/checkpoints.log)
|
|
218
|
+
|
|
219
|
+
Returns a list of recently created checkpoints.
|
|
220
|
+
Used in the SessionStart, /alfred:0-project restore command.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
cwd: Project root directory path
|
|
224
|
+
max_count: Maximum number to return (default 10 items)
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
Checkpoint list (most recent)
|
|
228
|
+
[{"timestamp": "...", "branch": "...", "operation": "..."}, ...]
|
|
229
|
+
|
|
230
|
+
Examples:
|
|
231
|
+
>>> list_checkpoints(".")
|
|
232
|
+
[
|
|
233
|
+
{"timestamp": "2025-10-15T14:30:00", "branch": "before-delete-...", "operation": "delete"},
|
|
234
|
+
{"timestamp": "2025-10-15T14:25:00", "branch": "before-merge-...", "operation": "merge"},
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
Notes:
|
|
238
|
+
- If there is no log file, an empty list is returned.
|
|
239
|
+
- Ignore lines where JSON parsing fails
|
|
240
|
+
- Return only the latest max_count
|
|
241
|
+
|
|
242
|
+
@TAG:CHECKPOINT-EVENT-001
|
|
243
|
+
"""
|
|
244
|
+
log_file = Path(cwd) / ".moai" / "checkpoints.log"
|
|
245
|
+
|
|
246
|
+
if not log_file.exists():
|
|
247
|
+
return []
|
|
248
|
+
|
|
249
|
+
checkpoints = []
|
|
250
|
+
|
|
251
|
+
try:
|
|
252
|
+
with log_file.open("r") as f:
|
|
253
|
+
for line in f:
|
|
254
|
+
try:
|
|
255
|
+
checkpoints.append(json.loads(line.strip()))
|
|
256
|
+
except json.JSONDecodeError:
|
|
257
|
+
# Ignore lines where parsing failed
|
|
258
|
+
pass
|
|
259
|
+
except (OSError, PermissionError):
|
|
260
|
+
return []
|
|
261
|
+
|
|
262
|
+
# Return only the most recent max_count items (in order of latest)
|
|
263
|
+
return checkpoints[-max_count:]
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
__all__ = [
|
|
267
|
+
"detect_risky_operation",
|
|
268
|
+
"create_checkpoint",
|
|
269
|
+
"log_checkpoint",
|
|
270
|
+
"list_checkpoints",
|
|
271
|
+
]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Context Engineering utilities
|
|
3
|
+
|
|
4
|
+
JIT (Just-in-Time) Retrieval
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_jit_context(prompt: str, cwd: str) -> list[str]:
|
|
11
|
+
"""JIT Context Retrieval based on prompt.
|
|
12
|
+
|
|
13
|
+
Analyze user prompts and automatically recommend relevant documents.
|
|
14
|
+
Alfred commands and keyword-based pattern matching load only the documents you need.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
prompt: Prompt for user input (case is irrelevant)
|
|
18
|
+
cwd: Project root directory path
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
List of recommended document paths (relative paths).
|
|
22
|
+
If there is no matching pattern or file, an empty list []
|
|
23
|
+
|
|
24
|
+
Patterns:
|
|
25
|
+
- "/alfred:1-plan" → .moai/memory/spec-metadata.md
|
|
26
|
+
- "/alfred:2-run" → .moai/memory/development-guide.md
|
|
27
|
+
- "test" → tests/ (if directory exists)
|
|
28
|
+
|
|
29
|
+
Examples:
|
|
30
|
+
>>> get_jit_context("/alfred:1-plan", "/project")
|
|
31
|
+
['.moai/memory/spec-metadata.md']
|
|
32
|
+
>>> get_jit_context("implement test", "/project")
|
|
33
|
+
['tests/']
|
|
34
|
+
>>> get_jit_context("unknown", "/project")
|
|
35
|
+
[]
|
|
36
|
+
|
|
37
|
+
Notes:
|
|
38
|
+
- Context Engineering: Compliance with JIT Retrieval principles
|
|
39
|
+
- Minimize initial context burden by loading only necessary documents
|
|
40
|
+
- Return after checking whether file exists
|
|
41
|
+
|
|
42
|
+
TDD History:
|
|
43
|
+
- RED: 18 items scenario testing (command matching, keywords, empty results)
|
|
44
|
+
- GREEN: Pattern matching dictionary-based implementation
|
|
45
|
+
- REFACTOR: Expandable pattern structure, file existence validation added
|
|
46
|
+
"""
|
|
47
|
+
context_files = []
|
|
48
|
+
cwd_path = Path(cwd)
|
|
49
|
+
|
|
50
|
+
# Pattern matching
|
|
51
|
+
patterns = {
|
|
52
|
+
"/alfred:1-plan": [".moai/memory/spec-metadata.md"],
|
|
53
|
+
"/alfred:2-run": [".moai/memory/development-guide.md"],
|
|
54
|
+
"test": ["tests/"],
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for pattern, files in patterns.items():
|
|
58
|
+
if pattern in prompt.lower():
|
|
59
|
+
for file in files:
|
|
60
|
+
file_path = cwd_path / file
|
|
61
|
+
if file_path.exists():
|
|
62
|
+
context_files.append(file)
|
|
63
|
+
|
|
64
|
+
return context_files
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
__all__ = ["get_jit_context"]
|