moai-adk 0.11.0__py3-none-any.whl → 0.12.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of moai-adk might be problematic. Click here for more details.

Files changed (268) hide show
  1. moai_adk/core/issue_creator.py +2 -2
  2. moai_adk/core/project/detector.py +195 -12
  3. moai_adk/core/tags/ci_validator.py +1 -1
  4. moai_adk/core/tags/pre_commit_validator.py +1 -1
  5. moai_adk/core/tags/validator.py +1 -1
  6. moai_adk/templates/.claude/agents/alfred/cc-manager.md +316 -0
  7. moai_adk/templates/.claude/agents/alfred/debug-helper.md +208 -0
  8. moai_adk/templates/.claude/agents/alfred/doc-syncer.md +214 -0
  9. moai_adk/templates/.claude/agents/alfred/git-manager.md +406 -0
  10. moai_adk/templates/.claude/agents/alfred/implementation-planner.md +350 -0
  11. moai_adk/templates/.claude/agents/alfred/project-manager.md +273 -0
  12. moai_adk/templates/.claude/agents/alfred/quality-gate.md +343 -0
  13. moai_adk/templates/.claude/agents/alfred/skill-factory.md +865 -0
  14. moai_adk/templates/.claude/agents/alfred/spec-builder.md +287 -0
  15. moai_adk/templates/.claude/agents/alfred/tag-agent.md +287 -0
  16. moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +326 -0
  17. moai_adk/templates/.claude/agents/alfred/trust-checker.md +375 -0
  18. moai_adk/templates/.claude/commands/alfred/0-project.md +1275 -0
  19. moai_adk/templates/.claude/commands/alfred/1-plan.md +734 -0
  20. moai_adk/templates/.claude/commands/alfred/2-run.md +551 -0
  21. moai_adk/templates/.claude/commands/alfred/3-sync.md +689 -0
  22. moai_adk/templates/.claude/commands/alfred/9-feedback.md +149 -0
  23. moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +206 -0
  24. moai_adk/templates/.claude/hooks/alfred/core/project.py +742 -0
  25. moai_adk/templates/.claude/hooks/alfred/core/timeout.py +136 -0
  26. moai_adk/templates/.claude/hooks/alfred/core/ttl_cache.py +108 -0
  27. moai_adk/templates/.claude/hooks/alfred/core/version_cache.py +198 -0
  28. moai_adk/templates/.claude/hooks/alfred/notification__handle_events.py +95 -0
  29. moai_adk/templates/.claude/hooks/alfred/post_tool__log_changes.py +95 -0
  30. moai_adk/templates/.claude/hooks/alfred/pre_tool__auto_checkpoint.py +101 -0
  31. moai_adk/templates/.claude/hooks/alfred/session_end__cleanup.py +95 -0
  32. moai_adk/templates/.claude/hooks/alfred/session_start__show_project_info.py +97 -0
  33. moai_adk/templates/.claude/hooks/alfred/shared/core/__init__.py +170 -0
  34. moai_adk/templates/.claude/hooks/alfred/shared/core/checkpoint.py +271 -0
  35. moai_adk/templates/.claude/hooks/alfred/shared/core/context.py +67 -0
  36. moai_adk/templates/.claude/hooks/alfred/shared/core/project.py +749 -0
  37. moai_adk/templates/.claude/hooks/alfred/shared/core/tags.py +230 -0
  38. moai_adk/templates/.claude/hooks/alfred/shared/core/version_cache.py +198 -0
  39. moai_adk/templates/.claude/hooks/alfred/shared/handlers/__init__.py +21 -0
  40. moai_adk/templates/.claude/hooks/alfred/shared/handlers/notification.py +154 -0
  41. moai_adk/templates/.claude/hooks/alfred/shared/handlers/session.py +174 -0
  42. moai_adk/templates/.claude/hooks/alfred/shared/handlers/tool.py +87 -0
  43. moai_adk/templates/.claude/hooks/alfred/shared/handlers/user.py +61 -0
  44. moai_adk/templates/.claude/hooks/alfred/stop__handle_interrupt.py +95 -0
  45. moai_adk/templates/.claude/hooks/alfred/subagent_stop__handle_subagent_end.py +95 -0
  46. moai_adk/templates/.claude/hooks/alfred/user_prompt__jit_load_docs.py +111 -0
  47. moai_adk/templates/.claude/hooks/alfred/utils/__init__.py +1 -0
  48. moai_adk/templates/.claude/hooks/alfred/utils/timeout.py +136 -0
  49. moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +640 -0
  50. moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +696 -0
  51. moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +474 -0
  52. moai_adk/templates/.claude/settings.json +144 -0
  53. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +113 -0
  54. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/examples.md +29 -0
  55. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/reference.md +28 -0
  56. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +122 -0
  57. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/examples.md +29 -0
  58. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/reference.md +29 -0
  59. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +237 -0
  60. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +615 -0
  61. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +653 -0
  62. moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +113 -0
  63. moai_adk/templates/.claude/skills/moai-alfred-language-detection/examples.md +29 -0
  64. moai_adk/templates/.claude/skills/moai-alfred-language-detection/reference.md +28 -0
  65. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +113 -0
  66. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/examples.md +29 -0
  67. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/reference.md +28 -0
  68. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +113 -0
  69. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/examples.md +29 -0
  70. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/reference.md +28 -0
  71. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +113 -0
  72. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/examples.md +29 -0
  73. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/reference.md +28 -0
  74. moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +269 -0
  75. moai_adk/templates/.claude/skills/moai-cc-agents/templates/agent-template.md +32 -0
  76. moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +298 -0
  77. moai_adk/templates/.claude/skills/moai-cc-claude-md/templates/CLAUDE-template.md +26 -0
  78. moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +307 -0
  79. moai_adk/templates/.claude/skills/moai-cc-commands/templates/command-template.md +21 -0
  80. moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +252 -0
  81. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/pre-bash-check.sh +19 -0
  82. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/preserve-permissions.sh +19 -0
  83. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/validate-bash-command.py +24 -0
  84. moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +199 -0
  85. moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/templates/settings-mcp-template.json +39 -0
  86. moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +316 -0
  87. moai_adk/templates/.claude/skills/moai-cc-memory/templates/session-summary-template.md +18 -0
  88. moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +263 -0
  89. moai_adk/templates/.claude/skills/moai-cc-settings/templates/settings-complete-template.json +30 -0
  90. moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +291 -0
  91. moai_adk/templates/.claude/skills/moai-cc-skills/templates/SKILL-template.md +15 -0
  92. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +290 -0
  93. moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +1633 -0
  94. moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +660 -0
  95. moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +123 -0
  96. moai_adk/templates/.claude/skills/moai-domain-cli-tool/examples.md +29 -0
  97. moai_adk/templates/.claude/skills/moai-domain-cli-tool/reference.md +30 -0
  98. moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +123 -0
  99. moai_adk/templates/.claude/skills/moai-domain-data-science/examples.md +29 -0
  100. moai_adk/templates/.claude/skills/moai-domain-data-science/reference.md +30 -0
  101. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +123 -0
  102. moai_adk/templates/.claude/skills/moai-domain-database/examples.md +29 -0
  103. moai_adk/templates/.claude/skills/moai-domain-database/reference.md +30 -0
  104. moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +124 -0
  105. moai_adk/templates/.claude/skills/moai-domain-devops/examples.md +29 -0
  106. moai_adk/templates/.claude/skills/moai-domain-devops/reference.md +31 -0
  107. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +124 -0
  108. moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +29 -0
  109. moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +31 -0
  110. moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +123 -0
  111. moai_adk/templates/.claude/skills/moai-domain-ml/examples.md +29 -0
  112. moai_adk/templates/.claude/skills/moai-domain-ml/reference.md +30 -0
  113. moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +123 -0
  114. moai_adk/templates/.claude/skills/moai-domain-mobile-app/examples.md +29 -0
  115. moai_adk/templates/.claude/skills/moai-domain-mobile-app/reference.md +30 -0
  116. moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +123 -0
  117. moai_adk/templates/.claude/skills/moai-domain-security/examples.md +29 -0
  118. moai_adk/templates/.claude/skills/moai-domain-security/reference.md +30 -0
  119. moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +123 -0
  120. moai_adk/templates/.claude/skills/moai-domain-web-api/examples.md +29 -0
  121. moai_adk/templates/.claude/skills/moai-domain-web-api/reference.md +30 -0
  122. moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +303 -0
  123. moai_adk/templates/.claude/skills/moai-essentials-debug/examples.md +1064 -0
  124. moai_adk/templates/.claude/skills/moai-essentials-debug/reference.md +1047 -0
  125. moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +113 -0
  126. moai_adk/templates/.claude/skills/moai-essentials-perf/examples.md +29 -0
  127. moai_adk/templates/.claude/skills/moai-essentials-perf/reference.md +28 -0
  128. moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +113 -0
  129. moai_adk/templates/.claude/skills/moai-essentials-refactor/examples.md +29 -0
  130. moai_adk/templates/.claude/skills/moai-essentials-refactor/reference.md +28 -0
  131. moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +113 -0
  132. moai_adk/templates/.claude/skills/moai-essentials-review/examples.md +29 -0
  133. moai_adk/templates/.claude/skills/moai-essentials-review/reference.md +28 -0
  134. moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +116 -0
  135. moai_adk/templates/.claude/skills/moai-foundation-ears/examples.md +29 -0
  136. moai_adk/templates/.claude/skills/moai-foundation-ears/reference.md +28 -0
  137. moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +122 -0
  138. moai_adk/templates/.claude/skills/moai-foundation-git/examples.md +29 -0
  139. moai_adk/templates/.claude/skills/moai-foundation-git/reference.md +29 -0
  140. moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +113 -0
  141. moai_adk/templates/.claude/skills/moai-foundation-langs/examples.md +29 -0
  142. moai_adk/templates/.claude/skills/moai-foundation-langs/reference.md +28 -0
  143. moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +113 -0
  144. moai_adk/templates/.claude/skills/moai-foundation-specs/examples.md +29 -0
  145. moai_adk/templates/.claude/skills/moai-foundation-specs/reference.md +28 -0
  146. moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +113 -0
  147. moai_adk/templates/.claude/skills/moai-foundation-tags/examples.md +29 -0
  148. moai_adk/templates/.claude/skills/moai-foundation-tags/reference.md +28 -0
  149. moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +307 -0
  150. moai_adk/templates/.claude/skills/moai-foundation-trust/examples.md +0 -0
  151. moai_adk/templates/.claude/skills/moai-foundation-trust/reference.md +1099 -0
  152. moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +124 -0
  153. moai_adk/templates/.claude/skills/moai-lang-c/examples.md +29 -0
  154. moai_adk/templates/.claude/skills/moai-lang-c/reference.md +31 -0
  155. moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +124 -0
  156. moai_adk/templates/.claude/skills/moai-lang-cpp/examples.md +29 -0
  157. moai_adk/templates/.claude/skills/moai-lang-cpp/reference.md +31 -0
  158. moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +123 -0
  159. moai_adk/templates/.claude/skills/moai-lang-csharp/examples.md +29 -0
  160. moai_adk/templates/.claude/skills/moai-lang-csharp/reference.md +30 -0
  161. moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +123 -0
  162. moai_adk/templates/.claude/skills/moai-lang-dart/examples.md +29 -0
  163. moai_adk/templates/.claude/skills/moai-lang-dart/reference.md +30 -0
  164. moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +124 -0
  165. moai_adk/templates/.claude/skills/moai-lang-go/examples.md +29 -0
  166. moai_adk/templates/.claude/skills/moai-lang-go/reference.md +31 -0
  167. moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +124 -0
  168. moai_adk/templates/.claude/skills/moai-lang-java/examples.md +29 -0
  169. moai_adk/templates/.claude/skills/moai-lang-java/reference.md +31 -0
  170. moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +125 -0
  171. moai_adk/templates/.claude/skills/moai-lang-javascript/examples.md +29 -0
  172. moai_adk/templates/.claude/skills/moai-lang-javascript/reference.md +32 -0
  173. moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +124 -0
  174. moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +29 -0
  175. moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +31 -0
  176. moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +123 -0
  177. moai_adk/templates/.claude/skills/moai-lang-php/examples.md +29 -0
  178. moai_adk/templates/.claude/skills/moai-lang-php/reference.md +30 -0
  179. moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +431 -0
  180. moai_adk/templates/.claude/skills/moai-lang-python/examples.md +624 -0
  181. moai_adk/templates/.claude/skills/moai-lang-python/reference.md +316 -0
  182. moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +123 -0
  183. moai_adk/templates/.claude/skills/moai-lang-r/examples.md +29 -0
  184. moai_adk/templates/.claude/skills/moai-lang-r/reference.md +30 -0
  185. moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +124 -0
  186. moai_adk/templates/.claude/skills/moai-lang-ruby/examples.md +29 -0
  187. moai_adk/templates/.claude/skills/moai-lang-ruby/reference.md +31 -0
  188. moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +124 -0
  189. moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +29 -0
  190. moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +31 -0
  191. moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +123 -0
  192. moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +29 -0
  193. moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +30 -0
  194. moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +123 -0
  195. moai_adk/templates/.claude/skills/moai-lang-shell/examples.md +29 -0
  196. moai_adk/templates/.claude/skills/moai-lang-shell/reference.md +30 -0
  197. moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +124 -0
  198. moai_adk/templates/.claude/skills/moai-lang-sql/examples.md +29 -0
  199. moai_adk/templates/.claude/skills/moai-lang-sql/reference.md +31 -0
  200. moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +123 -0
  201. moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +29 -0
  202. moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +30 -0
  203. moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +127 -0
  204. moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +29 -0
  205. moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +34 -0
  206. moai_adk/templates/.claude/skills/moai-skill-factory/CHECKLIST.md +482 -0
  207. moai_adk/templates/.claude/skills/moai-skill-factory/EXAMPLES.md +278 -0
  208. moai_adk/templates/.claude/skills/moai-skill-factory/INTERACTIVE-DISCOVERY.md +524 -0
  209. moai_adk/templates/.claude/skills/moai-skill-factory/METADATA.md +477 -0
  210. moai_adk/templates/.claude/skills/moai-skill-factory/PARALLEL-ANALYSIS-REPORT.md +429 -0
  211. moai_adk/templates/.claude/skills/moai-skill-factory/PYTHON-VERSION-MATRIX.md +391 -0
  212. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-FACTORY-WORKFLOW.md +431 -0
  213. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-UPDATE-ADVISOR.md +577 -0
  214. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL.md +271 -0
  215. moai_adk/templates/.claude/skills/moai-skill-factory/STEP-BY-STEP-GUIDE.md +466 -0
  216. moai_adk/templates/.claude/skills/moai-skill-factory/STRUCTURE.md +583 -0
  217. moai_adk/templates/.claude/skills/moai-skill-factory/WEB-RESEARCH.md +526 -0
  218. moai_adk/templates/.claude/skills/moai-skill-factory/reference.md +465 -0
  219. moai_adk/templates/.claude/skills/moai-skill-factory/scripts/generate-structure.sh +328 -0
  220. moai_adk/templates/.claude/skills/moai-skill-factory/scripts/validate-skill.sh +312 -0
  221. moai_adk/templates/.claude/skills/moai-skill-factory/templates/SKILL_TEMPLATE.md +245 -0
  222. moai_adk/templates/.claude/skills/moai-skill-factory/templates/examples-template.md +285 -0
  223. moai_adk/templates/.claude/skills/moai-skill-factory/templates/reference-template.md +278 -0
  224. moai_adk/templates/.claude/skills/moai-skill-factory/templates/scripts-template.sh +303 -0
  225. moai_adk/templates/.claude/skills/moai-spec-authoring/README.md +137 -0
  226. moai_adk/templates/.claude/skills/moai-spec-authoring/SKILL.md +219 -0
  227. moai_adk/templates/.claude/skills/moai-spec-authoring/examples/validate-spec.sh +161 -0
  228. moai_adk/templates/.claude/skills/moai-spec-authoring/examples.md +541 -0
  229. moai_adk/templates/.claude/skills/moai-spec-authoring/reference.md +622 -0
  230. moai_adk/templates/.github/workflows/c-tag-validation.yml +83 -0
  231. moai_adk/templates/.github/workflows/cpp-tag-validation.yml +79 -0
  232. moai_adk/templates/.github/workflows/csharp-tag-validation.yml +65 -0
  233. moai_adk/templates/.github/workflows/dart-tag-validation.yml +82 -0
  234. moai_adk/templates/.github/workflows/java-tag-validation.yml +75 -0
  235. moai_adk/templates/.github/workflows/kotlin-tag-validation.yml +67 -0
  236. moai_adk/templates/.github/workflows/php-tag-validation.yml +56 -0
  237. moai_adk/templates/.github/workflows/ruby-tag-validation.yml +68 -0
  238. moai_adk/templates/.github/workflows/rust-tag-validation.yml +73 -0
  239. moai_adk/templates/.github/workflows/shell-tag-validation.yml +65 -0
  240. moai_adk/templates/.github/workflows/swift-tag-validation.yml +79 -0
  241. moai_adk/templates/.moai/config.json +113 -0
  242. moai_adk/templates/.moai/memory/CLAUDE-AGENTS-GUIDE.md +208 -0
  243. moai_adk/templates/.moai/memory/CLAUDE-PRACTICES.md +369 -0
  244. moai_adk/templates/.moai/memory/CLAUDE-RULES.md +539 -0
  245. moai_adk/templates/.moai/memory/DEVELOPMENT-GUIDE.md +344 -0
  246. moai_adk/templates/.moai/memory/GITFLOW-PROTECTION-POLICY.md +330 -0
  247. moai_adk/templates/.moai/memory/ISSUE-LABEL-MAPPING.md +150 -0
  248. moai_adk/templates/.moai/memory/SKILLS-DESCRIPTION-POLICY.md +218 -0
  249. moai_adk/templates/.moai/memory/SPEC-METADATA.md +356 -0
  250. moai_adk/templates/.moai/memory/gitflow-protection-policy.md +330 -0
  251. moai_adk/templates/.moai/memory/spec-metadata.md +356 -0
  252. moai_adk/templates/.moai/project/product.md +161 -0
  253. moai_adk/templates/.moai/project/structure.md +156 -0
  254. moai_adk/templates/.moai/project/tech.md +227 -0
  255. moai_adk/templates/CLAUDE.md +90 -10
  256. moai_adk/templates/workflows/go-tag-validation.yml +130 -0
  257. moai_adk/templates/workflows/javascript-tag-validation.yml +135 -0
  258. moai_adk/templates/workflows/python-tag-validation.yml +118 -0
  259. moai_adk/templates/workflows/typescript-tag-validation.yml +154 -0
  260. {moai_adk-0.11.0.dist-info → moai_adk-0.12.0.dist-info}/METADATA +43 -1
  261. moai_adk-0.12.0.dist-info/RECORD +330 -0
  262. moai_adk-0.11.0.dist-info/RECORD +0 -77
  263. /moai_adk/templates/.github/workflows/{release.yml → moai-adk-release.yml} +0 -0
  264. /moai_adk/templates/.github/workflows/{spec-issue-sync.yml → moai-adk-spec-issue-sync.yml} +0 -0
  265. /moai_adk/templates/.github/workflows/{tag-validation.yml → moai-adk-tag-validation.yml} +0 -0
  266. {moai_adk-0.11.0.dist-info → moai_adk-0.12.0.dist-info}/WHEEL +0 -0
  267. {moai_adk-0.11.0.dist-info → moai_adk-0.12.0.dist-info}/entry_points.txt +0 -0
  268. {moai_adk-0.11.0.dist-info → moai_adk-0.12.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env python3
2
+ """Session event handlers
3
+
4
+ SessionStart, SessionEnd event handling
5
+ """
6
+
7
+ from core import HookPayload, HookResult
8
+ from core.checkpoint import list_checkpoints
9
+ from core.project import count_specs, get_git_info, get_package_version_info
10
+
11
+
12
+ def handle_session_start(payload: HookPayload) -> HookResult:
13
+ """SessionStart event handler with GRACEFUL DEGRADATION
14
+
15
+ When Claude Code Session starts, it displays a summary of project status.
16
+ You can check the language, Git status, SPEC progress, and checkpoint list at a glance.
17
+ All optional operations are wrapped in try-except to ensure hook completes quickly even if
18
+ Git commands, file I/O, or other operations timeout or fail.
19
+
20
+ Args:
21
+ payload: Claude Code event payload (cwd key required)
22
+
23
+ Returns:
24
+ HookResult(system_message=project status summary message)
25
+
26
+ Message Format:
27
+ 🚀 MoAI-ADK Session Started
28
+ [Version: {version}] - optional if version check fails
29
+ [Branch: {branch} ({commit hash})] - optional if git fails
30
+ [Changes: {Number of Changed Files}] - optional if git fails
31
+ [SPEC Progress: {Complete}/{Total} ({percent}%)] - optional if specs fail
32
+ [Checkpoints: {number} available] - optional if checkpoint list fails
33
+
34
+ Graceful Degradation Strategy:
35
+ - OPTIONAL: Version info (skip if timeout/failure)
36
+ - OPTIONAL: Git info (skip if timeout/failure)
37
+ - OPTIONAL: SPEC progress (skip if timeout/failure)
38
+ - OPTIONAL: Checkpoint list (skip if timeout/failure)
39
+ - Always display SOMETHING to user, never return empty message
40
+
41
+ Note:
42
+ - Claude Code processes SessionStart in several stages (clear → compact)
43
+ - Display message only at "compact" stage to prevent duplicate output
44
+ - "clear" step returns minimal result (empty hookSpecificOutput)
45
+ - CRITICAL: All optional operations must complete within 2-3 seconds total
46
+
47
+ TDD History:
48
+ - RED: Session startup message format test
49
+ - GREEN: Generate status message by combining helper functions
50
+ - REFACTOR: Improved message format, improved readability, added checkpoint list
51
+ - FIX: Prevent duplicate output of clear step (only compact step is displayed)
52
+ - UPDATE: Migrated to Claude Code standard Hook schema
53
+ - HOTFIX: Add graceful degradation for timeout scenarios (Issue #66)
54
+ - Phase 3: Add major version warning and release notes display (@TEST:MAJOR-UPDATE-001-07/08)
55
+
56
+ @TAG:CHECKPOINT-EVENT-001
57
+ @TAG:HOOKS-TIMEOUT-001
58
+ @CODE:MAJOR-UPDATE-WARN-001
59
+ """
60
+ # Claude Code SessionStart runs in several stages (clear, compact, etc.)
61
+ # Ignore the "clear" stage and output messages only at the "compact" stage
62
+ event_phase = payload.get("phase", "")
63
+ if event_phase == "clear":
64
+ # Return minimal valid Hook result for clear phase
65
+ return HookResult(continue_execution=True)
66
+
67
+ cwd = payload.get("cwd", ".")
68
+
69
+ # OPTIONAL: Git info - skip if timeout/failure
70
+ git_info = {}
71
+ try:
72
+ git_info = get_git_info(cwd)
73
+ except Exception:
74
+ # Graceful degradation - continue without git info
75
+ pass
76
+
77
+ # OPTIONAL: SPEC progress - skip if timeout/failure
78
+ specs = {"completed": 0, "total": 0, "percentage": 0}
79
+ try:
80
+ specs = count_specs(cwd)
81
+ except Exception:
82
+ # Graceful degradation - continue without spec info
83
+ pass
84
+
85
+ # OPTIONAL: Checkpoint list - skip if timeout/failure
86
+ checkpoints = []
87
+ try:
88
+ checkpoints = list_checkpoints(cwd, max_count=10)
89
+ except Exception:
90
+ # Graceful degradation - continue without checkpoints
91
+ pass
92
+
93
+ # OPTIONAL: Package version info - skip if timeout/failure
94
+ version_info = {}
95
+ try:
96
+ version_info = get_package_version_info()
97
+ except Exception:
98
+ # Graceful degradation - continue without version info
99
+ pass
100
+
101
+ # Build message with available information
102
+ branch = git_info.get("branch", "N/A") if git_info else "N/A"
103
+ commit = git_info.get("commit", "N/A")[:7] if git_info else "N/A"
104
+ changes = git_info.get("changes", 0) if git_info else 0
105
+ spec_progress = f"{specs['completed']}/{specs['total']}" if specs["total"] > 0 else "0/0"
106
+
107
+ # system_message: displayed directly to the user
108
+ lines = [
109
+ "🚀 MoAI-ADK Session Started",
110
+ "", # Blank line after title
111
+ ]
112
+
113
+ # Add version info first (at the top, right after title)
114
+ if version_info and version_info.get("current") != "unknown":
115
+ if version_info.get("update_available"):
116
+ # Check if this is a major version update
117
+ if version_info.get("is_major_update"):
118
+ # Major version warning
119
+ lines.append(
120
+ f" ⚠️ Major version update available: {version_info['current']} → {version_info['latest']}"
121
+ )
122
+ lines.append(" Breaking changes detected. Review release notes:")
123
+ if version_info.get("release_notes_url"):
124
+ lines.append(f" 📝 {version_info['release_notes_url']}")
125
+ else:
126
+ # Regular update
127
+ lines.append(
128
+ f" 🗿 MoAI-ADK Ver: {version_info['current']} → {version_info['latest']} available ✨"
129
+ )
130
+ if version_info.get("release_notes_url"):
131
+ lines.append(f" 📝 Release Notes: {version_info['release_notes_url']}")
132
+
133
+ # Add upgrade recommendation
134
+ if version_info.get("upgrade_command"):
135
+ lines.append(f" ⬆️ Upgrade: {version_info['upgrade_command']}")
136
+ else:
137
+ # No update available - show current version only
138
+ lines.append(f" 🗿 MoAI-ADK Ver: {version_info['current']}")
139
+
140
+
141
+ # Add Git info only if available (not degraded)
142
+ if git_info:
143
+ lines.append(f" 🌿 Branch: {branch} ({commit})")
144
+ lines.append(f" 📝 Changes: {changes}")
145
+
146
+ # Add last commit message if available
147
+ last_commit = git_info.get("last_commit", "")
148
+ if last_commit:
149
+ lines.append(f" 🔨 Last: {last_commit}")
150
+
151
+ # Add Checkpoint list (show only the latest 3 items)
152
+ if checkpoints:
153
+ lines.append(f" 🗂️ Checkpoints: {len(checkpoints)} available")
154
+ for cp in reversed(checkpoints[-3:]): # Latest 3 items
155
+ branch_short = cp["branch"].replace("before-", "")
156
+ lines.append(f" 📌 {branch_short}")
157
+ lines.append("") # Blank line before restore command
158
+ lines.append(" ↩️ Restore: /alfred:0-project restore")
159
+
160
+ # Add SPEC progress only if available (not degraded) - at the bottom
161
+ if specs["total"] > 0:
162
+ lines.append(f" 📋 SPEC Progress: {spec_progress} ({specs['percentage']}%)")
163
+
164
+ system_message = "\n".join(lines)
165
+
166
+ return HookResult(system_message=system_message)
167
+
168
+
169
+ def handle_session_end(payload: HookPayload) -> HookResult:
170
+ """SessionEnd event handler (default implementation)"""
171
+ return HookResult()
172
+
173
+
174
+ __all__ = ["handle_session_start", "handle_session_end"]
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env python3
2
+ # @CODE:HOOK-TOOL-001 | SPEC: TBD | TEST: tests/hooks/test_handlers.py
3
+ """Tool usage handlers
4
+
5
+ PreToolUse, PostToolUse event handling
6
+ """
7
+
8
+ from core import HookPayload, HookResult
9
+ from core.checkpoint import create_checkpoint, detect_risky_operation
10
+ from core.tags import scan_recent_changes_for_missing_tags
11
+
12
+
13
+ def handle_pre_tool_use(payload: HookPayload) -> HookResult:
14
+ """PreToolUse event handler (Event-Driven Checkpoint integration)
15
+
16
+ Automatically creates checkpoints before dangerous operations.
17
+ Called before using the Claude Code tool, it notifies the user when danger is detected.
18
+
19
+ Args:
20
+ payload: Claude Code event payload
21
+ (includes tool, arguments, cwd keys)
22
+
23
+ Returns:
24
+ HookResult(
25
+ system_message=checkpoint creation notification (when danger is detected);
26
+ continue_execution=True (always continue operation)
27
+ )
28
+
29
+ Checkpoint Triggers:
30
+ - Bash: rm -rf, git merge, git reset --hard
31
+ - Edit/Write: CLAUDE.md, config.json
32
+ - MultiEdit: ≥10 files
33
+
34
+ Examples:
35
+ Bash tool (rm -rf) detection:
36
+ → "🛡️ Checkpoint created: before-delete-20251015-143000"
37
+
38
+ Notes:
39
+ - Return continue_execution=True even after detection of danger (continue operation)
40
+ - Work continues even when checkpoint fails (ignores)
41
+ - Transparent background operation
42
+
43
+ @TAG:CHECKPOINT-EVENT-001
44
+ """
45
+ tool_name = payload.get("tool", "")
46
+ tool_args = payload.get("arguments", {})
47
+ cwd = payload.get("cwd", ".")
48
+
49
+ # Dangerous operation detection (best-effort)
50
+ try:
51
+ is_risky, operation_type = detect_risky_operation(tool_name, tool_args, cwd)
52
+ # Create checkpoint when danger is detected
53
+ if is_risky:
54
+ checkpoint_branch = create_checkpoint(cwd, operation_type)
55
+ if checkpoint_branch != "checkpoint-failed":
56
+ system_message = (
57
+ f"🛡️ Checkpoint created: {checkpoint_branch}\n Operation: {operation_type}"
58
+ )
59
+ return HookResult(system_message=system_message, continue_execution=True)
60
+ except Exception:
61
+ # Do not fail the hook if risk detection errors out
62
+ pass
63
+
64
+ # TAG Guard (gentle): warn when recent changes miss @TAG
65
+ issues = scan_recent_changes_for_missing_tags(cwd)
66
+ if issues:
67
+ # Summarize first few issues for display
68
+ preview = "\n".join(f" - {i.path} → 기대 태그: {i.expected}" for i in issues[:5])
69
+ more = "" if len(issues) <= 5 else f"\n (외 {len(issues) - 5}건 더 존재)"
70
+ msg = (
71
+ "⚠️ TAG 누락 감지: 생성/수정한 파일 중 @TAG가 없는 항목이 있습니다.\n"
72
+ f"{preview}{more}\n"
73
+ "권장 조치:\n"
74
+ " 1) SPEC/TEST/CODE/DOC 유형에 맞는 @TAG를 파일 상단 주석이나 헤더에 추가\n"
75
+ " 2) rg로 확인: rg '@(SPEC|TEST|CODE|DOC):' -n <경로>\n"
76
+ )
77
+ return HookResult(system_message=msg, continue_execution=True)
78
+
79
+ return HookResult(continue_execution=True)
80
+
81
+
82
+ def handle_post_tool_use(payload: HookPayload) -> HookResult:
83
+ """PostToolUse event handler (default implementation)"""
84
+ return HookResult()
85
+
86
+
87
+ __all__ = ["handle_pre_tool_use", "handle_post_tool_use"]
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env python3
2
+ """User interaction handlers
3
+
4
+ Handling the UserPromptSubmit event
5
+ """
6
+
7
+ from datetime import datetime
8
+ from pathlib import Path
9
+
10
+ from core import HookPayload, HookResult
11
+ from core.context import get_jit_context
12
+
13
+
14
+ def handle_user_prompt_submit(payload: HookPayload) -> HookResult:
15
+ """UserPromptSubmit event handler
16
+
17
+ Analyze user prompts and automatically add relevant documents into context.
18
+ Follow the just-in-time (JIT) retrieval principle to load only the documents you need.
19
+
20
+ Args:
21
+ payload: Claude Code event payload
22
+ (includes userPrompt, cwd keys)
23
+
24
+ Returns:
25
+ HookResult(
26
+ system_message=Number of Files loaded (or None),
27
+ context_files=Recommended document path list
28
+ )
29
+
30
+ TDD History:
31
+ - RED: JIT document loading scenario testing
32
+ - GREEN: Recommend documents by calling get_jit_context()
33
+ - REFACTOR: Message conditional display (only when there is a file)
34
+ - UPDATE: Migrated to Claude Code standard Hook schema with snake_case fields
35
+ - FEATURE: Command execution logging for tracking double-run debugging
36
+ """
37
+ user_prompt = payload.get("userPrompt", "")
38
+ cwd = payload.get("cwd", ".")
39
+ context_files = get_jit_context(user_prompt, cwd)
40
+
41
+ # Command execution logging (DEBUG feature for tracking invocations)
42
+ if user_prompt.startswith("/alfred:"):
43
+ try:
44
+ log_dir = Path(cwd) / ".moai" / "logs"
45
+ log_dir.mkdir(parents=True, exist_ok=True)
46
+
47
+ log_file = log_dir / "command-invocations.log"
48
+ timestamp = datetime.now().isoformat()
49
+
50
+ with open(log_file, "a", encoding="utf-8") as f:
51
+ f.write(f"{timestamp} | {user_prompt}\n")
52
+ except Exception:
53
+ # Silently fail if logging fails (don't interrupt main flow)
54
+ pass
55
+
56
+ system_message = f"📎 Loaded {len(context_files)} context file(s)" if context_files else None
57
+
58
+ return HookResult(system_message=system_message, context_files=context_files)
59
+
60
+
61
+ __all__ = ["handle_user_prompt_submit"]
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env python3
2
+ # @CODE:HOOKS-CLARITY-STOP | SPEC: Individual hook files for better UX
3
+ """Stop Hook: Handle Execution Interruption
4
+
5
+ Claude Code Event: Stop
6
+ Purpose: Handle graceful shutdown when execution is interrupted by user
7
+ Execution: Triggered when user stops Claude Code execution (Ctrl+C, stop button)
8
+
9
+ Output: Continue execution (currently a stub for future enhancements)
10
+ """
11
+
12
+ import json
13
+ import sys
14
+ from pathlib import Path
15
+ from typing import Any
16
+
17
+ from utils.timeout import CrossPlatformTimeout, TimeoutError as PlatformTimeoutError
18
+
19
+ # Setup import path for shared modules
20
+ HOOKS_DIR = Path(__file__).parent
21
+ SHARED_DIR = HOOKS_DIR / "shared"
22
+ if str(SHARED_DIR) not in sys.path:
23
+ sys.path.insert(0, str(SHARED_DIR))
24
+
25
+ from handlers import handle_stop
26
+
27
+
28
+
29
+
30
+ def main() -> None:
31
+ """Main entry point for Stop hook
32
+
33
+ Currently a stub for future functionality:
34
+ - Save partial work before interruption
35
+ - Create recovery checkpoint
36
+ - Log interruption reason and context
37
+ - Notify external systems of stop event
38
+
39
+ Exit Codes:
40
+ 0: Success
41
+ 1: Error (timeout, JSON parse failure, handler exception)
42
+ """
43
+ # Set 5-second timeout
44
+ timeout = CrossPlatformTimeout(5)
45
+ timeout.start()
46
+
47
+ try:
48
+ # Read JSON payload from stdin
49
+ input_data = sys.stdin.read()
50
+ data = json.loads(input_data) if input_data.strip() else {}
51
+
52
+ # Call handler
53
+ result = handle_stop(data)
54
+
55
+ # Output result as JSON
56
+ print(json.dumps(result.to_dict()))
57
+ sys.exit(0)
58
+
59
+ except PlatformTimeoutError:
60
+ # Timeout - return minimal valid response
61
+ timeout_response: dict[str, Any] = {
62
+ "continue": True,
63
+ "systemMessage": "⚠️ Stop handler timeout",
64
+ }
65
+ print(json.dumps(timeout_response))
66
+ print("Stop hook timeout after 5 seconds", file=sys.stderr)
67
+ sys.exit(1)
68
+
69
+ except json.JSONDecodeError as e:
70
+ # JSON parse error
71
+ error_response: dict[str, Any] = {
72
+ "continue": True,
73
+ "hookSpecificOutput": {"error": f"JSON parse error: {e}"},
74
+ }
75
+ print(json.dumps(error_response))
76
+ print(f"Stop JSON parse error: {e}", file=sys.stderr)
77
+ sys.exit(1)
78
+
79
+ except Exception as e:
80
+ # Unexpected error
81
+ error_response: dict[str, Any] = {
82
+ "continue": True,
83
+ "hookSpecificOutput": {"error": f"Stop error: {e}"},
84
+ }
85
+ print(json.dumps(error_response))
86
+ print(f"Stop unexpected error: {e}", file=sys.stderr)
87
+ sys.exit(1)
88
+
89
+ finally:
90
+ # Always cancel alarm
91
+ timeout.cancel()
92
+
93
+
94
+ if __name__ == "__main__":
95
+ main()
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env python3
2
+ # @CODE:HOOKS-CLARITY-SUBAGENT | SPEC: Individual hook files for better UX
3
+ """SubagentStop Hook: Handle Sub-agent Termination
4
+
5
+ Claude Code Event: SubagentStop
6
+ Purpose: Handle cleanup when a sub-agent execution completes or is terminated
7
+ Execution: Triggered when Task tool completes (sub-agent finishes)
8
+
9
+ Output: Continue execution (currently a stub for future enhancements)
10
+ """
11
+
12
+ import json
13
+ import sys
14
+ from pathlib import Path
15
+ from typing import Any
16
+
17
+ from utils.timeout import CrossPlatformTimeout, TimeoutError as PlatformTimeoutError
18
+
19
+ # Setup import path for shared modules
20
+ HOOKS_DIR = Path(__file__).parent
21
+ SHARED_DIR = HOOKS_DIR / "shared"
22
+ if str(SHARED_DIR) not in sys.path:
23
+ sys.path.insert(0, str(SHARED_DIR))
24
+
25
+ from handlers import handle_subagent_stop
26
+
27
+
28
+
29
+
30
+ def main() -> None:
31
+ """Main entry point for SubagentStop hook
32
+
33
+ Currently a stub for future functionality:
34
+ - Collect sub-agent execution metrics
35
+ - Log sub-agent results and errors
36
+ - Update workflow state based on sub-agent outcome
37
+ - Trigger follow-up actions based on results
38
+
39
+ Exit Codes:
40
+ 0: Success
41
+ 1: Error (timeout, JSON parse failure, handler exception)
42
+ """
43
+ # Set 5-second timeout
44
+ timeout = CrossPlatformTimeout(5)
45
+ timeout.start()
46
+
47
+ try:
48
+ # Read JSON payload from stdin
49
+ input_data = sys.stdin.read()
50
+ data = json.loads(input_data) if input_data.strip() else {}
51
+
52
+ # Call handler
53
+ result = handle_subagent_stop(data)
54
+
55
+ # Output result as JSON
56
+ print(json.dumps(result.to_dict()))
57
+ sys.exit(0)
58
+
59
+ except PlatformTimeoutError:
60
+ # Timeout - return minimal valid response
61
+ timeout_response: dict[str, Any] = {
62
+ "continue": True,
63
+ "systemMessage": "⚠️ SubagentStop handler timeout",
64
+ }
65
+ print(json.dumps(timeout_response))
66
+ print("SubagentStop hook timeout after 5 seconds", file=sys.stderr)
67
+ sys.exit(1)
68
+
69
+ except json.JSONDecodeError as e:
70
+ # JSON parse error
71
+ error_response: dict[str, Any] = {
72
+ "continue": True,
73
+ "hookSpecificOutput": {"error": f"JSON parse error: {e}"},
74
+ }
75
+ print(json.dumps(error_response))
76
+ print(f"SubagentStop JSON parse error: {e}", file=sys.stderr)
77
+ sys.exit(1)
78
+
79
+ except Exception as e:
80
+ # Unexpected error
81
+ error_response: dict[str, Any] = {
82
+ "continue": True,
83
+ "hookSpecificOutput": {"error": f"SubagentStop error: {e}"},
84
+ }
85
+ print(json.dumps(error_response))
86
+ print(f"SubagentStop unexpected error: {e}", file=sys.stderr)
87
+ sys.exit(1)
88
+
89
+ finally:
90
+ # Always cancel alarm
91
+ timeout.cancel()
92
+
93
+
94
+ if __name__ == "__main__":
95
+ main()
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env python3
2
+ # @CODE:HOOKS-CLARITY-DOCS | SPEC: Individual hook files for better UX
3
+ """UserPromptSubmit Hook: Just-In-Time Document Loading
4
+
5
+ Claude Code Event: UserPromptSubmit
6
+ Purpose: Analyze user prompt and recommend relevant documents to load into context
7
+ Execution: Triggered when user submits a prompt
8
+
9
+ Output: additionalContext with document path suggestions
10
+ """
11
+
12
+ import json
13
+ import sys
14
+ from pathlib import Path
15
+ from utils.timeout import CrossPlatformTimeout, TimeoutError as PlatformTimeoutError
16
+ from typing import Any
17
+
18
+ # Setup import path for shared modules
19
+ HOOKS_DIR = Path(__file__).parent
20
+ SHARED_DIR = HOOKS_DIR / "shared"
21
+ if str(SHARED_DIR) not in sys.path:
22
+ sys.path.insert(0, str(SHARED_DIR))
23
+
24
+ from handlers import handle_user_prompt_submit
25
+
26
+
27
+
28
+ def main() -> None:
29
+ """Main entry point for UserPromptSubmit hook
30
+
31
+ Analyzes user prompt patterns and recommends relevant documents:
32
+ - /alfred:1-plan → spec-metadata.md
33
+ - /alfred:2-run → development-guide.md
34
+ - @TAG mentions → TAG documentation
35
+ - SPEC references → related SPEC files
36
+
37
+ Exit Codes:
38
+ 0: Success
39
+ 1: Error (timeout, JSON parse failure, handler exception)
40
+
41
+ Note: Uses special output schema for UserPromptSubmit:
42
+ {
43
+ "continue": true,
44
+ "hookSpecificOutput": {
45
+ "hookEventName": "UserPromptSubmit",
46
+ "additionalContext": "Document path suggestions..."
47
+ }
48
+ }
49
+ """
50
+ # Set 5-second timeout
51
+ timeout = CrossPlatformTimeout(5)
52
+ timeout.start()
53
+
54
+ try:
55
+ # Read JSON payload from stdin
56
+ input_data = sys.stdin.read()
57
+ data = json.loads(input_data) if input_data.strip() else {}
58
+
59
+ # Call handler
60
+ result = handle_user_prompt_submit(data)
61
+
62
+ # Output result using UserPromptSubmit-specific schema
63
+ print(json.dumps(result.to_user_prompt_submit_dict()))
64
+ sys.exit(0)
65
+
66
+ except PlatformTimeoutError:
67
+ # Timeout - return minimal valid response
68
+ timeout_response: dict[str, Any] = {
69
+ "continue": True,
70
+ "hookSpecificOutput": {
71
+ "hookEventName": "UserPromptSubmit",
72
+ "additionalContext": "⚠️ JIT context timeout - continuing without suggestions",
73
+ },
74
+ }
75
+ print(json.dumps(timeout_response))
76
+ print("UserPromptSubmit hook timeout after 5 seconds", file=sys.stderr)
77
+ sys.exit(1)
78
+
79
+ except json.JSONDecodeError as e:
80
+ # JSON parse error
81
+ error_response: dict[str, Any] = {
82
+ "continue": True,
83
+ "hookSpecificOutput": {
84
+ "hookEventName": "UserPromptSubmit",
85
+ "error": f"JSON parse error: {e}",
86
+ },
87
+ }
88
+ print(json.dumps(error_response))
89
+ print(f"UserPromptSubmit JSON parse error: {e}", file=sys.stderr)
90
+ sys.exit(1)
91
+
92
+ except Exception as e:
93
+ # Unexpected error
94
+ error_response: dict[str, Any] = {
95
+ "continue": True,
96
+ "hookSpecificOutput": {
97
+ "hookEventName": "UserPromptSubmit",
98
+ "error": f"UserPromptSubmit error: {e}",
99
+ },
100
+ }
101
+ print(json.dumps(error_response))
102
+ print(f"UserPromptSubmit unexpected error: {e}", file=sys.stderr)
103
+ sys.exit(1)
104
+
105
+ finally:
106
+ # Always cancel alarm
107
+ timeout.cancel()
108
+
109
+
110
+ if __name__ == "__main__":
111
+ main()
@@ -0,0 +1 @@
1
+ """Utility modules for Alfred hooks."""