moai-adk 0.9.1__py3-none-any.whl → 0.11.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 (260) hide show
  1. moai_adk/core/project/phase_executor.py +4 -0
  2. moai_adk/core/tags/ci_validator.py +33 -3
  3. moai_adk/core/template_engine.py +6 -2
  4. moai_adk/templates/.git-hooks/pre-push +143 -0
  5. moai_adk/templates/.github/workflows/moai-gitflow.yml +6 -1
  6. moai_adk/templates/.github/workflows/release.yml +6 -2
  7. moai_adk/templates/.github/workflows/tag-validation.yml +57 -8
  8. moai_adk/templates/CLAUDE.md +477 -28
  9. moai_adk/templates/README.md +256 -0
  10. {moai_adk-0.9.1.dist-info → moai_adk-0.11.0.dist-info}/METADATA +740 -90
  11. moai_adk-0.11.0.dist-info/RECORD +77 -0
  12. moai_adk/templates/.claude/agents/alfred/cc-manager.md +0 -316
  13. moai_adk/templates/.claude/agents/alfred/debug-helper.md +0 -208
  14. moai_adk/templates/.claude/agents/alfred/doc-syncer.md +0 -214
  15. moai_adk/templates/.claude/agents/alfred/git-manager.md +0 -406
  16. moai_adk/templates/.claude/agents/alfred/implementation-planner.md +0 -350
  17. moai_adk/templates/.claude/agents/alfred/project-manager.md +0 -273
  18. moai_adk/templates/.claude/agents/alfred/quality-gate.md +0 -343
  19. moai_adk/templates/.claude/agents/alfred/skill-factory.md +0 -865
  20. moai_adk/templates/.claude/agents/alfred/spec-builder.md +0 -287
  21. moai_adk/templates/.claude/agents/alfred/tag-agent.md +0 -287
  22. moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +0 -326
  23. moai_adk/templates/.claude/agents/alfred/trust-checker.md +0 -375
  24. moai_adk/templates/.claude/commands/alfred/0-project.md +0 -1189
  25. moai_adk/templates/.claude/commands/alfred/1-plan.md +0 -728
  26. moai_adk/templates/.claude/commands/alfred/2-run.md +0 -545
  27. moai_adk/templates/.claude/commands/alfred/3-sync.md +0 -683
  28. moai_adk/templates/.claude/commands/alfred/9-feedback.md +0 -149
  29. moai_adk/templates/.claude/hooks/alfred/.moai/cache/version-check.json +0 -9
  30. moai_adk/templates/.claude/hooks/alfred/README.md +0 -343
  31. moai_adk/templates/.claude/hooks/alfred/TROUBLESHOOTING.md +0 -471
  32. moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +0 -209
  33. moai_adk/templates/.claude/hooks/alfred/core/version_cache.py +0 -198
  34. moai_adk/templates/.claude/hooks/alfred/notification__handle_events.py +0 -102
  35. moai_adk/templates/.claude/hooks/alfred/post_tool__log_changes.py +0 -102
  36. moai_adk/templates/.claude/hooks/alfred/pre_tool__auto_checkpoint.py +0 -108
  37. moai_adk/templates/.claude/hooks/alfred/session_end__cleanup.py +0 -102
  38. moai_adk/templates/.claude/hooks/alfred/session_start__show_project_info.py +0 -102
  39. moai_adk/templates/.claude/hooks/alfred/shared/core/__init__.py +0 -170
  40. moai_adk/templates/.claude/hooks/alfred/shared/core/checkpoint.py +0 -271
  41. moai_adk/templates/.claude/hooks/alfred/shared/core/context.py +0 -67
  42. moai_adk/templates/.claude/hooks/alfred/shared/core/project.py +0 -683
  43. moai_adk/templates/.claude/hooks/alfred/shared/core/tags.py +0 -198
  44. moai_adk/templates/.claude/hooks/alfred/shared/core/version_cache.py +0 -198
  45. moai_adk/templates/.claude/hooks/alfred/shared/handlers/__init__.py +0 -21
  46. moai_adk/templates/.claude/hooks/alfred/shared/handlers/notification.py +0 -25
  47. moai_adk/templates/.claude/hooks/alfred/shared/handlers/session.py +0 -175
  48. moai_adk/templates/.claude/hooks/alfred/shared/handlers/tool.py +0 -90
  49. moai_adk/templates/.claude/hooks/alfred/shared/handlers/user.py +0 -61
  50. moai_adk/templates/.claude/hooks/alfred/stop__handle_interrupt.py +0 -102
  51. moai_adk/templates/.claude/hooks/alfred/subagent_stop__handle_subagent_end.py +0 -102
  52. moai_adk/templates/.claude/hooks/alfred/user_prompt__jit_load_docs.py +0 -120
  53. moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +0 -640
  54. moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +0 -696
  55. moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +0 -474
  56. moai_adk/templates/.claude/settings.json +0 -144
  57. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +0 -113
  58. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/examples.md +0 -29
  59. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/reference.md +0 -28
  60. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +0 -122
  61. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/examples.md +0 -29
  62. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/reference.md +0 -29
  63. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +0 -237
  64. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +0 -615
  65. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +0 -653
  66. moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +0 -113
  67. moai_adk/templates/.claude/skills/moai-alfred-language-detection/examples.md +0 -29
  68. moai_adk/templates/.claude/skills/moai-alfred-language-detection/reference.md +0 -28
  69. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +0 -113
  70. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/examples.md +0 -29
  71. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/reference.md +0 -28
  72. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +0 -113
  73. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/examples.md +0 -29
  74. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/reference.md +0 -28
  75. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +0 -113
  76. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/examples.md +0 -29
  77. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/reference.md +0 -28
  78. moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +0 -269
  79. moai_adk/templates/.claude/skills/moai-cc-agents/templates/agent-template.md +0 -32
  80. moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +0 -298
  81. moai_adk/templates/.claude/skills/moai-cc-claude-md/templates/CLAUDE-template.md +0 -26
  82. moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +0 -307
  83. moai_adk/templates/.claude/skills/moai-cc-commands/templates/command-template.md +0 -21
  84. moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +0 -252
  85. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/pre-bash-check.sh +0 -19
  86. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/preserve-permissions.sh +0 -19
  87. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/validate-bash-command.py +0 -24
  88. moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +0 -199
  89. moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/templates/settings-mcp-template.json +0 -39
  90. moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +0 -316
  91. moai_adk/templates/.claude/skills/moai-cc-memory/templates/session-summary-template.md +0 -18
  92. moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +0 -263
  93. moai_adk/templates/.claude/skills/moai-cc-settings/templates/settings-complete-template.json +0 -30
  94. moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +0 -291
  95. moai_adk/templates/.claude/skills/moai-cc-skills/templates/SKILL-template.md +0 -15
  96. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +0 -290
  97. moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +0 -1633
  98. moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +0 -660
  99. moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +0 -123
  100. moai_adk/templates/.claude/skills/moai-domain-cli-tool/examples.md +0 -29
  101. moai_adk/templates/.claude/skills/moai-domain-cli-tool/reference.md +0 -30
  102. moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +0 -123
  103. moai_adk/templates/.claude/skills/moai-domain-data-science/examples.md +0 -29
  104. moai_adk/templates/.claude/skills/moai-domain-data-science/reference.md +0 -30
  105. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +0 -123
  106. moai_adk/templates/.claude/skills/moai-domain-database/examples.md +0 -29
  107. moai_adk/templates/.claude/skills/moai-domain-database/reference.md +0 -30
  108. moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +0 -124
  109. moai_adk/templates/.claude/skills/moai-domain-devops/examples.md +0 -29
  110. moai_adk/templates/.claude/skills/moai-domain-devops/reference.md +0 -31
  111. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +0 -124
  112. moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +0 -29
  113. moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +0 -31
  114. moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +0 -123
  115. moai_adk/templates/.claude/skills/moai-domain-ml/examples.md +0 -29
  116. moai_adk/templates/.claude/skills/moai-domain-ml/reference.md +0 -30
  117. moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +0 -123
  118. moai_adk/templates/.claude/skills/moai-domain-mobile-app/examples.md +0 -29
  119. moai_adk/templates/.claude/skills/moai-domain-mobile-app/reference.md +0 -30
  120. moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +0 -123
  121. moai_adk/templates/.claude/skills/moai-domain-security/examples.md +0 -29
  122. moai_adk/templates/.claude/skills/moai-domain-security/reference.md +0 -30
  123. moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +0 -123
  124. moai_adk/templates/.claude/skills/moai-domain-web-api/examples.md +0 -29
  125. moai_adk/templates/.claude/skills/moai-domain-web-api/reference.md +0 -30
  126. moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +0 -303
  127. moai_adk/templates/.claude/skills/moai-essentials-debug/examples.md +0 -1064
  128. moai_adk/templates/.claude/skills/moai-essentials-debug/reference.md +0 -1047
  129. moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +0 -113
  130. moai_adk/templates/.claude/skills/moai-essentials-perf/examples.md +0 -29
  131. moai_adk/templates/.claude/skills/moai-essentials-perf/reference.md +0 -28
  132. moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +0 -113
  133. moai_adk/templates/.claude/skills/moai-essentials-refactor/examples.md +0 -29
  134. moai_adk/templates/.claude/skills/moai-essentials-refactor/reference.md +0 -28
  135. moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +0 -113
  136. moai_adk/templates/.claude/skills/moai-essentials-review/examples.md +0 -29
  137. moai_adk/templates/.claude/skills/moai-essentials-review/reference.md +0 -28
  138. moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +0 -116
  139. moai_adk/templates/.claude/skills/moai-foundation-ears/examples.md +0 -29
  140. moai_adk/templates/.claude/skills/moai-foundation-ears/reference.md +0 -28
  141. moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +0 -122
  142. moai_adk/templates/.claude/skills/moai-foundation-git/examples.md +0 -29
  143. moai_adk/templates/.claude/skills/moai-foundation-git/reference.md +0 -29
  144. moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +0 -113
  145. moai_adk/templates/.claude/skills/moai-foundation-langs/examples.md +0 -29
  146. moai_adk/templates/.claude/skills/moai-foundation-langs/reference.md +0 -28
  147. moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +0 -113
  148. moai_adk/templates/.claude/skills/moai-foundation-specs/examples.md +0 -29
  149. moai_adk/templates/.claude/skills/moai-foundation-specs/reference.md +0 -28
  150. moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +0 -113
  151. moai_adk/templates/.claude/skills/moai-foundation-tags/examples.md +0 -29
  152. moai_adk/templates/.claude/skills/moai-foundation-tags/reference.md +0 -28
  153. moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +0 -307
  154. moai_adk/templates/.claude/skills/moai-foundation-trust/examples.md +0 -0
  155. moai_adk/templates/.claude/skills/moai-foundation-trust/reference.md +0 -1099
  156. moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +0 -124
  157. moai_adk/templates/.claude/skills/moai-lang-c/examples.md +0 -29
  158. moai_adk/templates/.claude/skills/moai-lang-c/reference.md +0 -31
  159. moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +0 -124
  160. moai_adk/templates/.claude/skills/moai-lang-cpp/examples.md +0 -29
  161. moai_adk/templates/.claude/skills/moai-lang-cpp/reference.md +0 -31
  162. moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +0 -123
  163. moai_adk/templates/.claude/skills/moai-lang-csharp/examples.md +0 -29
  164. moai_adk/templates/.claude/skills/moai-lang-csharp/reference.md +0 -30
  165. moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +0 -123
  166. moai_adk/templates/.claude/skills/moai-lang-dart/examples.md +0 -29
  167. moai_adk/templates/.claude/skills/moai-lang-dart/reference.md +0 -30
  168. moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +0 -124
  169. moai_adk/templates/.claude/skills/moai-lang-go/examples.md +0 -29
  170. moai_adk/templates/.claude/skills/moai-lang-go/reference.md +0 -31
  171. moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +0 -124
  172. moai_adk/templates/.claude/skills/moai-lang-java/examples.md +0 -29
  173. moai_adk/templates/.claude/skills/moai-lang-java/reference.md +0 -31
  174. moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +0 -125
  175. moai_adk/templates/.claude/skills/moai-lang-javascript/examples.md +0 -29
  176. moai_adk/templates/.claude/skills/moai-lang-javascript/reference.md +0 -32
  177. moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +0 -124
  178. moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +0 -29
  179. moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +0 -31
  180. moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +0 -123
  181. moai_adk/templates/.claude/skills/moai-lang-php/examples.md +0 -29
  182. moai_adk/templates/.claude/skills/moai-lang-php/reference.md +0 -30
  183. moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +0 -431
  184. moai_adk/templates/.claude/skills/moai-lang-python/examples.md +0 -624
  185. moai_adk/templates/.claude/skills/moai-lang-python/reference.md +0 -316
  186. moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +0 -123
  187. moai_adk/templates/.claude/skills/moai-lang-r/examples.md +0 -29
  188. moai_adk/templates/.claude/skills/moai-lang-r/reference.md +0 -30
  189. moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +0 -124
  190. moai_adk/templates/.claude/skills/moai-lang-ruby/examples.md +0 -29
  191. moai_adk/templates/.claude/skills/moai-lang-ruby/reference.md +0 -31
  192. moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +0 -124
  193. moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +0 -29
  194. moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +0 -31
  195. moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +0 -123
  196. moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +0 -29
  197. moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +0 -30
  198. moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +0 -123
  199. moai_adk/templates/.claude/skills/moai-lang-shell/examples.md +0 -29
  200. moai_adk/templates/.claude/skills/moai-lang-shell/reference.md +0 -30
  201. moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +0 -124
  202. moai_adk/templates/.claude/skills/moai-lang-sql/examples.md +0 -29
  203. moai_adk/templates/.claude/skills/moai-lang-sql/reference.md +0 -31
  204. moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +0 -123
  205. moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +0 -29
  206. moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +0 -30
  207. moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +0 -127
  208. moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +0 -29
  209. moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +0 -34
  210. moai_adk/templates/.claude/skills/moai-skill-factory/CHECKLIST.md +0 -482
  211. moai_adk/templates/.claude/skills/moai-skill-factory/EXAMPLES.md +0 -278
  212. moai_adk/templates/.claude/skills/moai-skill-factory/INTERACTIVE-DISCOVERY.md +0 -524
  213. moai_adk/templates/.claude/skills/moai-skill-factory/METADATA.md +0 -477
  214. moai_adk/templates/.claude/skills/moai-skill-factory/PARALLEL-ANALYSIS-REPORT.md +0 -429
  215. moai_adk/templates/.claude/skills/moai-skill-factory/PYTHON-VERSION-MATRIX.md +0 -391
  216. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-FACTORY-WORKFLOW.md +0 -431
  217. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-UPDATE-ADVISOR.md +0 -577
  218. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL.md +0 -271
  219. moai_adk/templates/.claude/skills/moai-skill-factory/STEP-BY-STEP-GUIDE.md +0 -466
  220. moai_adk/templates/.claude/skills/moai-skill-factory/STRUCTURE.md +0 -583
  221. moai_adk/templates/.claude/skills/moai-skill-factory/WEB-RESEARCH.md +0 -526
  222. moai_adk/templates/.claude/skills/moai-skill-factory/reference.md +0 -465
  223. moai_adk/templates/.claude/skills/moai-skill-factory/scripts/generate-structure.sh +0 -328
  224. moai_adk/templates/.claude/skills/moai-skill-factory/scripts/validate-skill.sh +0 -312
  225. moai_adk/templates/.claude/skills/moai-skill-factory/templates/SKILL_TEMPLATE.md +0 -245
  226. moai_adk/templates/.claude/skills/moai-skill-factory/templates/examples-template.md +0 -285
  227. moai_adk/templates/.claude/skills/moai-skill-factory/templates/reference-template.md +0 -278
  228. moai_adk/templates/.claude/skills/moai-skill-factory/templates/scripts-template.sh +0 -303
  229. moai_adk/templates/.claude/skills/moai-spec-authoring/README.md +0 -137
  230. moai_adk/templates/.claude/skills/moai-spec-authoring/SKILL.md +0 -219
  231. moai_adk/templates/.claude/skills/moai-spec-authoring/examples/validate-spec.sh +0 -161
  232. moai_adk/templates/.claude/skills/moai-spec-authoring/examples.md +0 -541
  233. moai_adk/templates/.claude/skills/moai-spec-authoring/reference.md +0 -622
  234. moai_adk/templates/.github/workflows/tag-report.yml +0 -261
  235. moai_adk/templates/.moai/config.json +0 -113
  236. moai_adk/templates/.moai/docs/quick-issue-creation-guide.md +0 -219
  237. moai_adk/templates/.moai/hooks/install.sh +0 -79
  238. moai_adk/templates/.moai/hooks/pre-commit.sh +0 -66
  239. moai_adk/templates/.moai/memory/CLAUDE-AGENTS-GUIDE.md +0 -208
  240. moai_adk/templates/.moai/memory/CLAUDE-PRACTICES.md +0 -369
  241. moai_adk/templates/.moai/memory/CLAUDE-RULES.md +0 -539
  242. moai_adk/templates/.moai/memory/DEVELOPMENT-GUIDE.md +0 -344
  243. moai_adk/templates/.moai/memory/GITFLOW-PROTECTION-POLICY.md +0 -220
  244. moai_adk/templates/.moai/memory/ISSUE-LABEL-MAPPING.md +0 -150
  245. moai_adk/templates/.moai/memory/SKILLS-DESCRIPTION-POLICY.md +0 -218
  246. moai_adk/templates/.moai/memory/SPEC-METADATA.md +0 -356
  247. moai_adk/templates/.moai/memory/gitflow-protection-policy.md +0 -220
  248. moai_adk/templates/.moai/memory/spec-metadata.md +0 -356
  249. moai_adk/templates/.moai/project/product.md +0 -161
  250. moai_adk/templates/.moai/project/structure.md +0 -156
  251. moai_adk/templates/.moai/project/tech.md +0 -227
  252. moai_adk/templates/src/moai_adk/core/__init__.py +0 -5
  253. moai_adk/templates/src/moai_adk/core/tags/__init__.py +0 -86
  254. moai_adk/templates/src/moai_adk/core/tags/ci_validator.py +0 -433
  255. moai_adk/templates/src/moai_adk/core/tags/cli.py +0 -283
  256. moai_adk/templates/src/moai_adk/core/tags/validator.py +0 -897
  257. moai_adk-0.9.1.dist-info/RECORD +0 -320
  258. {moai_adk-0.9.1.dist-info → moai_adk-0.11.0.dist-info}/WHEEL +0 -0
  259. {moai_adk-0.9.1.dist-info → moai_adk-0.11.0.dist-info}/entry_points.txt +0 -0
  260. {moai_adk-0.9.1.dist-info → moai_adk-0.11.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,897 +0,0 @@
1
- #!/usr/bin/env python3
2
- # @CODE:DOC-TAG-004 | Component 3: Central validation system
3
- """Central TAG validation system for MoAI-ADK
4
-
5
- This module provides a unified, extensible validation engine that:
6
- - Validates TAG format, duplicates, orphans, and chain integrity
7
- - Supports multiple validator types with priority ordering
8
- - Generates reports in multiple formats (detailed, summary, JSON)
9
- - Provides CLI integration via moai-adk validate-tags
10
-
11
- Architecture:
12
- CentralValidator (orchestrator)
13
- ├── DuplicateValidator (priority: 90)
14
- ├── OrphanValidator (priority: 50)
15
- ├── ChainValidator (priority: 30)
16
- └── FormatValidator (priority: 100)
17
-
18
- Usage:
19
- config = ValidationConfig(strict_mode=True)
20
- validator = CentralValidator(config=config)
21
- result = validator.validate_directory("/path/to/project")
22
- report = validator.create_report(result, format="json")
23
- """
24
-
25
- import json
26
- import re
27
- import time
28
- from abc import ABC, abstractmethod
29
- from dataclasses import dataclass, field
30
- from datetime import datetime
31
- from pathlib import Path
32
- from typing import Any, Dict, List, Optional, Set, Tuple
33
-
34
-
35
- @dataclass
36
- class ValidationConfig:
37
- """Configuration for validation behavior
38
-
39
- Attributes:
40
- strict_mode: Treat warnings as errors (block on warnings)
41
- check_duplicates: Enable duplicate TAG detection
42
- check_orphans: Enable orphan TAG detection (CODE without TEST)
43
- check_chain_integrity: Enable SPEC→CODE→TEST→DOC chain validation
44
- allowed_file_types: List of file extensions to validate (e.g., ["py", "js"])
45
- ignore_patterns: List of glob patterns to ignore (e.g., [".git/*", "*.pyc"])
46
- report_format: Default report format (detailed|summary|json)
47
- """
48
- strict_mode: bool = False
49
- check_duplicates: bool = True
50
- check_orphans: bool = True
51
- check_chain_integrity: bool = True
52
- allowed_file_types: List[str] = field(default_factory=lambda: [
53
- "py", "js", "ts", "jsx", "tsx", "md", "txt", "yml", "yaml", "json"
54
- ])
55
- ignore_patterns: List[str] = field(default_factory=lambda: [
56
- ".git/*", "node_modules/*", "__pycache__/*", "*.pyc", ".venv/*", "venv/*"
57
- ])
58
- report_format: str = "detailed"
59
-
60
-
61
- @dataclass
62
- class ValidationIssue:
63
- """Validation issue with severity, type, and location
64
-
65
- Attributes:
66
- severity: Issue severity (error|warning|info)
67
- type: Issue type (duplicate|orphan|chain|format)
68
- tag: TAG string (e.g., "@CODE:TEST-001")
69
- message: Human-readable issue description
70
- locations: List of (file, line) tuples where issue occurs
71
- suggestion: How to fix the issue
72
- """
73
- severity: str # error|warning|info
74
- type: str # duplicate|orphan|chain|format
75
- tag: str
76
- message: str
77
- locations: List[Tuple[str, int]] = field(default_factory=list)
78
- suggestion: str = ""
79
-
80
- def to_dict(self) -> Dict[str, Any]:
81
- """Convert to dictionary for JSON serialization"""
82
- return {
83
- "severity": self.severity,
84
- "type": self.type,
85
- "tag": self.tag,
86
- "message": self.message,
87
- "locations": [
88
- {"file": f, "line": l} for f, l in self.locations
89
- ],
90
- "suggestion": self.suggestion
91
- }
92
-
93
-
94
- @dataclass
95
- class ValidationStatistics:
96
- """Validation statistics
97
-
98
- Attributes:
99
- total_files_scanned: Number of files scanned
100
- total_tags_found: Total TAG count across all files
101
- total_issues: Total issues found (errors + warnings)
102
- error_count: Number of errors
103
- warning_count: Number of warnings
104
- coverage_percentage: Percentage of SPEC tags with CODE implementation
105
- """
106
- total_files_scanned: int
107
- total_tags_found: int
108
- total_issues: int
109
- error_count: int
110
- warning_count: int
111
- coverage_percentage: float
112
-
113
- def to_dict(self) -> Dict[str, Any]:
114
- """Convert to dictionary for JSON serialization"""
115
- return {
116
- "total_files_scanned": self.total_files_scanned,
117
- "total_tags_found": self.total_tags_found,
118
- "total_issues": self.total_issues,
119
- "error_count": self.error_count,
120
- "warning_count": self.warning_count,
121
- "coverage_percentage": self.coverage_percentage
122
- }
123
-
124
-
125
- @dataclass
126
- class CentralValidationResult:
127
- """Complete validation result from CentralValidator
128
-
129
- Attributes:
130
- is_valid: Overall validation status (False if errors, or warnings in strict mode)
131
- issues: All issues (errors + warnings combined)
132
- errors: Error-level issues only
133
- warnings: Warning-level issues only
134
- statistics: Validation statistics
135
- timestamp: When validation was performed
136
- execution_time_ms: Validation execution time in milliseconds
137
- """
138
- is_valid: bool
139
- issues: List[ValidationIssue]
140
- errors: List[ValidationIssue]
141
- warnings: List[ValidationIssue]
142
- statistics: ValidationStatistics
143
- timestamp: datetime
144
- execution_time_ms: float
145
-
146
- def to_dict(self) -> Dict[str, Any]:
147
- """Convert to dictionary for JSON serialization"""
148
- return {
149
- "is_valid": self.is_valid,
150
- "issues": [issue.to_dict() for issue in self.issues],
151
- "errors": [error.to_dict() for error in self.errors],
152
- "warnings": [warning.to_dict() for warning in self.warnings],
153
- "statistics": self.statistics.to_dict(),
154
- "timestamp": self.timestamp.isoformat(),
155
- "execution_time_ms": self.execution_time_ms
156
- }
157
-
158
-
159
- class TagValidator(ABC):
160
- """Abstract base class for all validators
161
-
162
- All validators must extend this class and implement:
163
- - validate(): Perform validation and return issues
164
- - get_name(): Return validator name
165
- - get_priority(): Return priority (higher = runs first)
166
- """
167
-
168
- # Default TAG pattern: @(SPEC|CODE|TEST|DOC):DOMAIN-TYPE-NNN
169
- TAG_PATTERN = re.compile(r"@(SPEC|CODE|TEST|DOC):([A-Z]+(?:-[A-Z]+)*-\d{3})")
170
-
171
- @abstractmethod
172
- def validate(self, files: List[str]) -> List[ValidationIssue]:
173
- """Validate files and return list of issues
174
-
175
- Args:
176
- files: List of file paths to validate
177
-
178
- Returns:
179
- List of ValidationIssue objects
180
- """
181
- pass
182
-
183
- @abstractmethod
184
- def get_name(self) -> str:
185
- """Return validator name"""
186
- pass
187
-
188
- @abstractmethod
189
- def get_priority(self) -> int:
190
- """Return validator priority (higher = runs first)
191
-
192
- Priority guidelines:
193
- - 100: Format validation (must pass before other checks)
194
- - 90: Duplicate detection (errors that block)
195
- - 50: Orphan detection (warnings)
196
- - 30: Chain integrity (warnings)
197
- """
198
- pass
199
-
200
- def extract_tags_from_file(self, filepath: str) -> List[Tuple[str, str, int]]:
201
- """Extract TAGs from a file
202
-
203
- Args:
204
- filepath: Path to file to scan
205
-
206
- Returns:
207
- List of (tag_type, domain, line_number) tuples
208
- Example: [("CODE", "USER-REG-001", 10), ("TEST", "USER-REG-001", 25)]
209
- """
210
- try:
211
- path = Path(filepath)
212
- if not path.exists() or not path.is_file():
213
- return []
214
-
215
- content = path.read_text(encoding="utf-8", errors="ignore")
216
- lines = content.splitlines()
217
-
218
- tags = []
219
- for line_num, line in enumerate(lines, start=1):
220
- matches = self.TAG_PATTERN.findall(line)
221
- for tag_type, domain in matches:
222
- tags.append((tag_type, domain, line_num))
223
-
224
- return tags
225
-
226
- except Exception:
227
- return []
228
-
229
-
230
- class DuplicateValidator(TagValidator):
231
- """Validator for duplicate TAG detection
232
-
233
- Detects duplicate TAGs within same file or across multiple files.
234
- Returns error-level issues for all duplicates found.
235
-
236
- Priority: 90 (high - errors that must be fixed)
237
- """
238
-
239
- def validate(self, files: List[str]) -> List[ValidationIssue]:
240
- """Detect duplicate TAGs across all files
241
-
242
- Args:
243
- files: List of file paths to validate
244
-
245
- Returns:
246
- List of ValidationIssue objects for duplicates
247
- """
248
- issues: List[ValidationIssue] = []
249
- tag_locations: Dict[str, List[Tuple[str, int]]] = {}
250
-
251
- # Collect all TAGs and their locations
252
- for filepath in files:
253
- tags = self.extract_tags_from_file(filepath)
254
- for tag_type, domain, line_num in tags:
255
- full_tag = f"@{tag_type}:{domain}"
256
- if full_tag not in tag_locations:
257
- tag_locations[full_tag] = []
258
- tag_locations[full_tag].append((filepath, line_num))
259
-
260
- # Find duplicates (tags with more than one location)
261
- for tag, locations in tag_locations.items():
262
- if len(locations) > 1:
263
- issues.append(ValidationIssue(
264
- severity="error",
265
- type="duplicate",
266
- tag=tag,
267
- message=f"Duplicate TAG found in {len(locations)} locations",
268
- locations=locations,
269
- suggestion="Remove duplicate TAG declarations. Each TAG must be unique across the codebase."
270
- ))
271
-
272
- return issues
273
-
274
- def get_name(self) -> str:
275
- """Return validator name"""
276
- return "DuplicateValidator"
277
-
278
- def get_priority(self) -> int:
279
- """Return high priority (errors block early)"""
280
- return 90
281
-
282
-
283
- class OrphanValidator(TagValidator):
284
- """Validator for orphan TAG detection
285
-
286
- Detects orphan TAGs:
287
- - @CODE without corresponding @TEST
288
- - @TEST without corresponding @CODE
289
- - @SPEC without implementation (@CODE)
290
-
291
- Returns warning-level issues for all orphans found.
292
-
293
- Priority: 50 (medium - warnings that should be addressed)
294
- """
295
-
296
- def validate(self, files: List[str]) -> List[ValidationIssue]:
297
- """Detect orphan TAGs across all files
298
-
299
- Args:
300
- files: List of file paths to validate
301
-
302
- Returns:
303
- List of ValidationIssue objects for orphans
304
- """
305
- issues: List[ValidationIssue] = []
306
-
307
- # Collect all TAGs by type and domain
308
- tags_by_type: Dict[str, Dict[str, List[Tuple[str, int]]]] = {
309
- "SPEC": {},
310
- "CODE": {},
311
- "TEST": {},
312
- "DOC": {}
313
- }
314
-
315
- for filepath in files:
316
- tags = self.extract_tags_from_file(filepath)
317
- for tag_type, domain, line_num in tags:
318
- if domain not in tags_by_type[tag_type]:
319
- tags_by_type[tag_type][domain] = []
320
- tags_by_type[tag_type][domain].append((filepath, line_num))
321
-
322
- # Check for orphans: CODE without TEST
323
- for domain, locations in tags_by_type["CODE"].items():
324
- if domain not in tags_by_type["TEST"]:
325
- for filepath, line_num in locations:
326
- issues.append(ValidationIssue(
327
- severity="warning",
328
- type="orphan",
329
- tag=f"@CODE:{domain}",
330
- message="CODE TAG without corresponding TEST",
331
- locations=[(filepath, line_num)],
332
- suggestion=f"Add @TEST:{domain} to test this code implementation"
333
- ))
334
-
335
- # Check for orphans: TEST without CODE
336
- for domain, locations in tags_by_type["TEST"].items():
337
- if domain not in tags_by_type["CODE"]:
338
- for filepath, line_num in locations:
339
- issues.append(ValidationIssue(
340
- severity="warning",
341
- type="orphan",
342
- tag=f"@TEST:{domain}",
343
- message="TEST TAG without corresponding CODE",
344
- locations=[(filepath, line_num)],
345
- suggestion=f"Add @CODE:{domain} for the implementation being tested"
346
- ))
347
-
348
- return issues
349
-
350
- def get_name(self) -> str:
351
- """Return validator name"""
352
- return "OrphanValidator"
353
-
354
- def get_priority(self) -> int:
355
- """Return medium priority"""
356
- return 50
357
-
358
-
359
- class ChainValidator(TagValidator):
360
- """Validator for TAG chain integrity (NEW in Component 3)
361
-
362
- Validates complete SPEC→CODE→TEST→DOC chain:
363
- - @SPEC should have corresponding @CODE (implementation)
364
- - @CODE should have corresponding @TEST (test coverage)
365
- - Complete chain optionally includes @DOC (documentation)
366
-
367
- Returns warning-level issues for incomplete chains.
368
-
369
- Priority: 30 (low - runs after duplicates and orphans)
370
- """
371
-
372
- def validate(self, files: List[str]) -> List[ValidationIssue]:
373
- """Validate TAG chain integrity
374
-
375
- Args:
376
- files: List of file paths to validate
377
-
378
- Returns:
379
- List of ValidationIssue objects for chain problems
380
- """
381
- issues: List[ValidationIssue] = []
382
-
383
- # Collect all TAGs by type
384
- tags_by_type: Dict[str, Set[str]] = {
385
- "SPEC": set(),
386
- "CODE": set(),
387
- "TEST": set(),
388
- "DOC": set()
389
- }
390
-
391
- for filepath in files:
392
- tags = self.extract_tags_from_file(filepath)
393
- for tag_type, domain, _ in tags:
394
- tags_by_type[tag_type].add(domain)
395
-
396
- # Check SPEC→CODE chain
397
- for spec_domain in tags_by_type["SPEC"]:
398
- if spec_domain not in tags_by_type["CODE"]:
399
- issues.append(ValidationIssue(
400
- severity="warning",
401
- type="chain",
402
- tag=f"@SPEC:{spec_domain}",
403
- message="SPEC without CODE implementation",
404
- locations=[],
405
- suggestion=f"Implement @CODE:{spec_domain} for this specification"
406
- ))
407
-
408
- # Check CODE→SPEC chain (reverse: CODE should have SPEC)
409
- for code_domain in tags_by_type["CODE"]:
410
- if code_domain not in tags_by_type["SPEC"]:
411
- issues.append(ValidationIssue(
412
- severity="warning",
413
- type="chain",
414
- tag=f"@CODE:{code_domain}",
415
- message="CODE implementation without SPEC",
416
- locations=[],
417
- suggestion=f"Add @SPEC:{code_domain} to document the specification"
418
- ))
419
-
420
- # Check TEST→SPEC chain (reverse: TEST should have SPEC)
421
- for test_domain in tags_by_type["TEST"]:
422
- if test_domain not in tags_by_type["SPEC"]:
423
- issues.append(ValidationIssue(
424
- severity="warning",
425
- type="chain",
426
- tag=f"@TEST:{test_domain}",
427
- message="TEST without SPEC",
428
- locations=[],
429
- suggestion=f"Add @SPEC:{test_domain} to document what is being tested"
430
- ))
431
-
432
- # Check SPEC+CODE without TEST chain
433
- spec_with_code = tags_by_type["SPEC"] & tags_by_type["CODE"]
434
- for domain in spec_with_code:
435
- if domain not in tags_by_type["TEST"]:
436
- issues.append(ValidationIssue(
437
- severity="warning",
438
- type="chain",
439
- tag=f"@CODE:{domain}",
440
- message="CODE implementation without TEST",
441
- locations=[],
442
- suggestion=f"Add @TEST:{domain} to test this implementation"
443
- ))
444
-
445
- # Check for documentation (info level - optional)
446
- complete_implementations = tags_by_type["SPEC"] & tags_by_type["CODE"] & tags_by_type["TEST"]
447
- for domain in complete_implementations:
448
- if domain not in tags_by_type["DOC"]:
449
- issues.append(ValidationIssue(
450
- severity="info",
451
- type="chain",
452
- tag=f"@SPEC:{domain}",
453
- message="Complete implementation without documentation",
454
- locations=[],
455
- suggestion=f"Consider adding @DOC:{domain} to document this feature"
456
- ))
457
-
458
- return issues
459
-
460
- def get_name(self) -> str:
461
- """Return validator name"""
462
- return "ChainValidator"
463
-
464
- def get_priority(self) -> int:
465
- """Return low priority (runs after other checks)"""
466
- return 30
467
-
468
-
469
- class FormatValidator(TagValidator):
470
- """Validator for TAG format validation
471
-
472
- Validates TAG format: @PREFIX:DOMAIN-TYPE-NNN
473
- Returns error-level issues for invalid formats.
474
-
475
- Priority: 100 (highest - format must be valid before other checks)
476
- """
477
-
478
- def validate(self, files: List[str]) -> List[ValidationIssue]:
479
- """Validate TAG format in all files
480
-
481
- Args:
482
- files: List of file paths to validate
483
-
484
- Returns:
485
- List of ValidationIssue objects for format problems
486
- """
487
- # Format validation is implicitly done by TAG_PATTERN regex
488
- # Invalid formats won't be extracted, so no issues to report here
489
- # This validator is a placeholder for future format-specific checks
490
- return []
491
-
492
- def get_name(self) -> str:
493
- """Return validator name"""
494
- return "FormatValidator"
495
-
496
- def get_priority(self) -> int:
497
- """Return highest priority"""
498
- return 100
499
-
500
-
501
- class CentralValidator:
502
- """Central validation orchestrator
503
-
504
- Coordinates multiple validators to provide unified validation:
505
- 1. Registers default validators (Duplicate, Orphan, Chain, Format)
506
- 2. Runs validators in priority order (high to low)
507
- 3. Collects all issues and generates statistics
508
- 4. Creates formatted reports in multiple formats
509
-
510
- Usage:
511
- config = ValidationConfig(strict_mode=True)
512
- validator = CentralValidator(config=config)
513
- result = validator.validate_directory("/path/to/project")
514
- print(validator.create_report(result, format="summary"))
515
-
516
- Args:
517
- config: ValidationConfig object (default: ValidationConfig())
518
- """
519
-
520
- def __init__(self, config: Optional[ValidationConfig] = None):
521
- """Initialize CentralValidator with configuration
522
-
523
- Args:
524
- config: ValidationConfig object (default: ValidationConfig())
525
- """
526
- self.config = config or ValidationConfig()
527
- self.validators: List[TagValidator] = []
528
-
529
- # Register default validators based on configuration
530
- if self.config.check_duplicates:
531
- self.register_validator(DuplicateValidator())
532
-
533
- if self.config.check_orphans:
534
- self.register_validator(OrphanValidator())
535
-
536
- if self.config.check_chain_integrity:
537
- self.register_validator(ChainValidator())
538
-
539
- # Always register format validator
540
- self.register_validator(FormatValidator())
541
-
542
- # Sort validators by priority (high to low)
543
- self.validators.sort(key=lambda v: v.get_priority(), reverse=True)
544
-
545
- def register_validator(self, validator: TagValidator) -> None:
546
- """Register a custom validator
547
-
548
- Args:
549
- validator: TagValidator instance to register
550
- """
551
- self.validators.append(validator)
552
- # Re-sort by priority
553
- self.validators.sort(key=lambda v: v.get_priority(), reverse=True)
554
-
555
- def get_validators(self) -> List[TagValidator]:
556
- """Get list of registered validators
557
-
558
- Returns:
559
- List of TagValidator instances sorted by priority
560
- """
561
- return self.validators.copy()
562
-
563
- def _should_scan_file(self, filepath: str) -> bool:
564
- """Check if file should be scanned based on configuration
565
-
566
- Args:
567
- filepath: Path to file
568
-
569
- Returns:
570
- True if file should be scanned
571
- """
572
- path = Path(filepath)
573
-
574
- # Check file extension
575
- if self.config.allowed_file_types:
576
- suffix = path.suffix.lstrip(".")
577
- if suffix and suffix not in self.config.allowed_file_types:
578
- return False
579
-
580
- # Check ignore patterns
581
- for pattern in self.config.ignore_patterns:
582
- # Simple pattern matching (can be enhanced with fnmatch)
583
- pattern_clean = pattern.replace("/*", "").replace("*", "")
584
- if pattern_clean in str(path):
585
- return False
586
-
587
- return True
588
-
589
- def _collect_files_from_directory(self, directory: str) -> List[str]:
590
- """Collect all files from directory recursively
591
-
592
- Args:
593
- directory: Directory path to scan
594
-
595
- Returns:
596
- List of file paths that should be scanned
597
- """
598
- dir_path = Path(directory)
599
- if not dir_path.exists() or not dir_path.is_dir():
600
- return []
601
-
602
- files = []
603
- for path in dir_path.rglob("*"):
604
- if path.is_file() and self._should_scan_file(str(path)):
605
- files.append(str(path))
606
-
607
- return files
608
-
609
- def validate_files(self, files: List[str]) -> CentralValidationResult:
610
- """Validate list of files
611
-
612
- Main validation method that:
613
- 1. Runs all registered validators in priority order
614
- 2. Collects all issues (errors + warnings)
615
- 3. Generates statistics
616
- 4. Returns CentralValidationResult
617
-
618
- Args:
619
- files: List of file paths to validate
620
-
621
- Returns:
622
- CentralValidationResult with all issues and statistics
623
- """
624
- start_time = time.time()
625
-
626
- # Filter files based on configuration
627
- files_to_scan = [f for f in files if self._should_scan_file(f)]
628
-
629
- # Run all validators
630
- all_issues: List[ValidationIssue] = []
631
- for validator in self.validators:
632
- issues = validator.validate(files_to_scan)
633
- all_issues.extend(issues)
634
-
635
- # Separate errors and warnings
636
- errors = [issue for issue in all_issues if issue.severity == "error"]
637
- warnings = [issue for issue in all_issues if issue.severity == "warning"]
638
-
639
- # Calculate statistics
640
- total_tags = 0
641
- spec_tags = set()
642
- code_tags = set()
643
-
644
- for filepath in files_to_scan:
645
- try:
646
- path = Path(filepath)
647
- if not path.exists():
648
- continue
649
- content = path.read_text(encoding="utf-8", errors="ignore")
650
- matches = TagValidator.TAG_PATTERN.findall(content)
651
- total_tags += len(matches)
652
-
653
- for tag_type, domain in matches:
654
- if tag_type == "SPEC":
655
- spec_tags.add(domain)
656
- elif tag_type == "CODE":
657
- code_tags.add(domain)
658
- except Exception:
659
- continue
660
-
661
- # Calculate coverage percentage (SPEC tags with CODE implementation)
662
- if spec_tags:
663
- implemented_specs = spec_tags & code_tags
664
- coverage_percentage = (len(implemented_specs) / len(spec_tags)) * 100
665
- else:
666
- coverage_percentage = 0.0 if code_tags else 100.0
667
-
668
- statistics = ValidationStatistics(
669
- total_files_scanned=len(files_to_scan),
670
- total_tags_found=total_tags,
671
- total_issues=len(all_issues),
672
- error_count=len(errors),
673
- warning_count=len(warnings),
674
- coverage_percentage=round(coverage_percentage, 2)
675
- )
676
-
677
- # Determine if validation passed
678
- if self.config.strict_mode:
679
- is_valid = len(errors) == 0 and len(warnings) == 0
680
- else:
681
- is_valid = len(errors) == 0
682
-
683
- execution_time_ms = (time.time() - start_time) * 1000
684
-
685
- return CentralValidationResult(
686
- is_valid=is_valid,
687
- issues=all_issues,
688
- errors=errors,
689
- warnings=warnings,
690
- statistics=statistics,
691
- timestamp=datetime.now(),
692
- execution_time_ms=round(execution_time_ms, 2)
693
- )
694
-
695
- def validate_directory(self, directory: str, config: Optional[ValidationConfig] = None) -> CentralValidationResult:
696
- """Validate all files in a directory recursively
697
-
698
- Args:
699
- directory: Directory path to scan
700
- config: Optional custom configuration (overrides instance config)
701
-
702
- Returns:
703
- CentralValidationResult
704
- """
705
- # Temporarily override config if provided
706
- original_config = self.config
707
- if config:
708
- self.config = config
709
-
710
- # Collect files from directory
711
- files = self._collect_files_from_directory(directory)
712
-
713
- # Validate files
714
- result = self.validate_files(files)
715
-
716
- # Restore original config
717
- self.config = original_config
718
-
719
- return result
720
-
721
- def create_report(self, result: CentralValidationResult, format: str = "detailed") -> str:
722
- """Create formatted validation report
723
-
724
- Args:
725
- result: CentralValidationResult from validation
726
- format: Report format (detailed|summary|json)
727
-
728
- Returns:
729
- Formatted report string
730
- """
731
- if format == "json":
732
- return json.dumps(result.to_dict(), indent=2)
733
- elif format == "summary":
734
- return self._create_summary_report(result)
735
- else: # detailed
736
- return self._create_detailed_report(result)
737
-
738
- def _create_summary_report(self, result: CentralValidationResult) -> str:
739
- """Create summary report
740
-
741
- Args:
742
- result: CentralValidationResult
743
-
744
- Returns:
745
- Summary report string
746
- """
747
- lines = []
748
- lines.append("=" * 60)
749
- lines.append("TAG Validation Summary")
750
- lines.append("=" * 60)
751
- lines.append("")
752
-
753
- # Status
754
- if result.is_valid:
755
- lines.append("✅ Validation PASSED")
756
- else:
757
- lines.append("❌ Validation FAILED")
758
- lines.append("")
759
-
760
- # Statistics
761
- stats = result.statistics
762
- lines.append(f"Files Scanned: {stats.total_files_scanned}")
763
- lines.append(f"Tags Found: {stats.total_tags_found}")
764
- lines.append(f"Total Issues: {stats.total_issues}")
765
- lines.append(f" - Errors: {stats.error_count}")
766
- lines.append(f" - Warnings: {stats.warning_count}")
767
- lines.append(f"Coverage: {stats.coverage_percentage:.1f}%")
768
- lines.append("")
769
-
770
- # Execution time
771
- lines.append(f"Execution Time: {result.execution_time_ms:.2f} ms")
772
- lines.append("")
773
-
774
- return "\n".join(lines)
775
-
776
- def _create_detailed_report(self, result: CentralValidationResult) -> str:
777
- """Create detailed report with all issues
778
-
779
- Args:
780
- result: CentralValidationResult
781
-
782
- Returns:
783
- Detailed report string
784
- """
785
- lines = []
786
- lines.append("=" * 60)
787
- lines.append("TAG Validation Report")
788
- lines.append("=" * 60)
789
- lines.append("")
790
-
791
- # Status
792
- if result.is_valid:
793
- lines.append("✅ Validation PASSED")
794
- else:
795
- lines.append("❌ Validation FAILED")
796
- lines.append("")
797
-
798
- # Errors
799
- if result.errors:
800
- lines.append("ERRORS:")
801
- lines.append("-" * 60)
802
- for error in result.errors:
803
- lines.append(f" {error.tag}")
804
- lines.append(f" Type: {error.type}")
805
- lines.append(f" Message: {error.message}")
806
- if error.locations:
807
- lines.append(" Locations:")
808
- for filepath, line_num in error.locations:
809
- lines.append(f" - {filepath}:{line_num}")
810
- if error.suggestion:
811
- lines.append(f" Suggestion: {error.suggestion}")
812
- lines.append("")
813
-
814
- # Warnings
815
- if result.warnings:
816
- lines.append("WARNINGS:")
817
- lines.append("-" * 60)
818
- for warning in result.warnings:
819
- lines.append(f" {warning.tag}")
820
- lines.append(f" Type: {warning.type}")
821
- lines.append(f" Message: {warning.message}")
822
- if warning.locations:
823
- lines.append(" Locations:")
824
- for filepath, line_num in warning.locations:
825
- lines.append(f" - {filepath}:{line_num}")
826
- if warning.suggestion:
827
- lines.append(f" Suggestion: {warning.suggestion}")
828
- lines.append("")
829
-
830
- # Statistics
831
- lines.append("STATISTICS:")
832
- lines.append("-" * 60)
833
- stats = result.statistics
834
- lines.append(f"Files Scanned: {stats.total_files_scanned}")
835
- lines.append(f"Tags Found: {stats.total_tags_found}")
836
- lines.append(f"Total Issues: {stats.total_issues}")
837
- lines.append(f" - Errors: {stats.error_count}")
838
- lines.append(f" - Warnings: {stats.warning_count}")
839
- lines.append(f"Spec→Code Coverage: {stats.coverage_percentage:.1f}%")
840
- lines.append(f"Execution Time: {result.execution_time_ms:.2f} ms")
841
- lines.append("")
842
-
843
- return "\n".join(lines)
844
-
845
- def export_for_reporting(self, result: CentralValidationResult) -> Dict[str, Any]:
846
- """Export validation result in format compatible with ReportGenerator
847
-
848
- This method bridges Component 3 (Validation) with Component 4 (Reporting).
849
- Exports validation results as structured data for integration with
850
- automated reporting workflows.
851
-
852
- Args:
853
- result: CentralValidationResult from validation
854
-
855
- Returns:
856
- Dictionary with validation data formatted for reporting:
857
- {
858
- "timestamp": ISO timestamp,
859
- "is_valid": bool,
860
- "statistics": {
861
- "total_files_scanned": int,
862
- "total_tags_found": int,
863
- "total_issues": int,
864
- "error_count": int,
865
- "warning_count": int,
866
- "coverage_percentage": float
867
- },
868
- "issues_by_type": {
869
- "duplicate": [...],
870
- "orphan": [...],
871
- "chain": [...],
872
- "format": [...]
873
- },
874
- "execution_time_ms": float
875
- }
876
- """
877
- # Group issues by type
878
- issues_by_type: Dict[str, List[Dict[str, Any]]] = {
879
- "duplicate": [],
880
- "orphan": [],
881
- "chain": [],
882
- "format": []
883
- }
884
-
885
- for issue in result.issues:
886
- issues_by_type[issue.type].append(issue.to_dict())
887
-
888
- # Build export data
889
- export_data = {
890
- "timestamp": result.timestamp.isoformat(),
891
- "is_valid": result.is_valid,
892
- "statistics": result.statistics.to_dict(),
893
- "issues_by_type": issues_by_type,
894
- "execution_time_ms": result.execution_time_ms
895
- }
896
-
897
- return export_data