xtrm-tools 2.0.0

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.
Files changed (447) hide show
  1. package/CHANGELOG.md +496 -0
  2. package/README.md +762 -0
  3. package/cli/dist/index.cjs +55245 -0
  4. package/cli/dist/index.cjs.map +1 -0
  5. package/cli/dist/index.d.cts +2 -0
  6. package/cli/package.json +43 -0
  7. package/config/.env.example +40 -0
  8. package/config/hooks.json +36 -0
  9. package/config/mcp_servers.json +46 -0
  10. package/config/mcp_servers_optional.json +53 -0
  11. package/config/settings.json +70 -0
  12. package/hooks/README.md +156 -0
  13. package/hooks/__pycache__/agent_context.cpython-314.pyc +0 -0
  14. package/hooks/agent_context.py +105 -0
  15. package/hooks/gitnexus/gitnexus-hook.cjs +133 -0
  16. package/hooks/serena-workflow-reminder.py +74 -0
  17. package/hooks/skill-discovery.py +90 -0
  18. package/hooks/skill-suggestion.py +112 -0
  19. package/hooks/test_agent_context.py +112 -0
  20. package/hooks/type-safety-enforcement.py +107 -0
  21. package/package.json +48 -0
  22. package/project-skills/main-guard/.claude/hooks/main-guard.cjs +188 -0
  23. package/project-skills/main-guard/.claude/settings.json +16 -0
  24. package/project-skills/main-guard/.claude/skills/using-main-guard/SKILL.md +135 -0
  25. package/project-skills/main-guard/README.md +163 -0
  26. package/project-skills/py-quality-gate/.claude/hooks/quality-check.py +311 -0
  27. package/project-skills/py-quality-gate/.claude/settings.json +16 -0
  28. package/project-skills/py-quality-gate/.claude/skills/using-py-quality-gate/SKILL.md +112 -0
  29. package/project-skills/py-quality-gate/README.md +147 -0
  30. package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/doc_reminder.cpython-314.pyc +0 -0
  31. package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/skill_staleness.cpython-314.pyc +0 -0
  32. package/project-skills/service-skills-set/.claude/git-hooks/doc_reminder.py +67 -0
  33. package/project-skills/service-skills-set/.claude/git-hooks/skill_staleness.py +194 -0
  34. package/project-skills/service-skills-set/.claude/service-registry.json +4 -0
  35. package/project-skills/service-skills-set/.claude/settings.json +37 -0
  36. package/project-skills/service-skills-set/.claude/skills/creating-service-skills/SKILL.md +433 -0
  37. package/project-skills/service-skills-set/.claude/skills/creating-service-skills/references/script_quality_standards.md +412 -0
  38. package/project-skills/service-skills-set/.claude/skills/creating-service-skills/references/service_skill_system_guide.md +264 -0
  39. package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/bootstrap.py +308 -0
  40. package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/deep_dive.py +304 -0
  41. package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/scaffolder.py +482 -0
  42. package/project-skills/service-skills-set/.claude/skills/scoping-service-skills/SKILL.md +231 -0
  43. package/project-skills/service-skills-set/.claude/skills/scoping-service-skills/scripts/scope.py +74 -0
  44. package/project-skills/service-skills-set/.claude/skills/updating-service-skills/SKILL.md +136 -0
  45. package/project-skills/service-skills-set/.claude/skills/updating-service-skills/scripts/__pycache__/drift_detector.cpython-314.pyc +0 -0
  46. package/project-skills/service-skills-set/.claude/skills/updating-service-skills/scripts/drift_detector.py +222 -0
  47. package/project-skills/service-skills-set/.claude/skills/using-service-skills/SKILL.md +108 -0
  48. package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/cataloger.cpython-314.pyc +0 -0
  49. package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/skill_activator.cpython-314.pyc +0 -0
  50. package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/cataloger.py +74 -0
  51. package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/skill_activator.py +152 -0
  52. package/project-skills/service-skills-set/README.md +93 -0
  53. package/project-skills/service-skills-set/__pycache__/install-service-skills.cpython-314.pyc +0 -0
  54. package/project-skills/service-skills-set/install-service-skills.py +163 -0
  55. package/project-skills/service-skills-set/service-skills-readme.md +236 -0
  56. package/project-skills/tdd-guard/.claude/settings.json +38 -0
  57. package/project-skills/tdd-guard/.claude/skills/using-tdd-guard/SKILL.md +74 -0
  58. package/project-skills/tdd-guard/CLAUDE.md +98 -0
  59. package/project-skills/tdd-guard/CONTRIBUTING.md +38 -0
  60. package/project-skills/tdd-guard/DEVELOPMENT.md +127 -0
  61. package/project-skills/tdd-guard/LICENSE +21 -0
  62. package/project-skills/tdd-guard/README.md +396 -0
  63. package/project-skills/tdd-guard/docs/adr/001-claude-session-subdirectory.md +52 -0
  64. package/project-skills/tdd-guard/docs/adr/002-secure-claude-binary-path.md +56 -0
  65. package/project-skills/tdd-guard/docs/adr/003-remove-configurable-data-directory.md +56 -0
  66. package/project-skills/tdd-guard/docs/adr/004-monorepo-architecture.md +64 -0
  67. package/project-skills/tdd-guard/docs/adr/005-claude-project-dir-support.md +55 -0
  68. package/project-skills/tdd-guard/docs/adr/006-phpunit-separate-repository.md +93 -0
  69. package/project-skills/tdd-guard/docs/adr/007-golangci-lint-path-support.md +83 -0
  70. package/project-skills/tdd-guard/docs/adr/008-storybook-reporter-design.md +182 -0
  71. package/project-skills/tdd-guard/docs/assets/tdd-guard-demo-screenshot.gif +0 -0
  72. package/project-skills/tdd-guard/docs/config-migration.md +143 -0
  73. package/project-skills/tdd-guard/docs/configuration.md +137 -0
  74. package/project-skills/tdd-guard/docs/custom-instructions.md +43 -0
  75. package/project-skills/tdd-guard/docs/enforcement.md +46 -0
  76. package/project-skills/tdd-guard/docs/ignore-patterns.md +81 -0
  77. package/project-skills/tdd-guard/docs/linting.md +109 -0
  78. package/project-skills/tdd-guard/docs/quick-commands.md +52 -0
  79. package/project-skills/tdd-guard/docs/session-management.md +75 -0
  80. package/project-skills/tdd-guard/docs/storybook-vitest-addon.md +120 -0
  81. package/project-skills/tdd-guard/docs/validation-model.md +63 -0
  82. package/project-skills/tdd-guard/eslint.config.mjs +140 -0
  83. package/project-skills/tdd-guard/package-lock.json +16937 -0
  84. package/project-skills/tdd-guard/package.json +102 -0
  85. package/project-skills/tdd-guard/reporters/go/README.md +67 -0
  86. package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main.go +127 -0
  87. package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main_test.go +280 -0
  88. package/project-skills/tdd-guard/reporters/go/go.mod +3 -0
  89. package/project-skills/tdd-guard/reporters/go/go.sum +0 -0
  90. package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter.go +126 -0
  91. package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter_test.go +264 -0
  92. package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader.go +26 -0
  93. package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader_test.go +37 -0
  94. package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader.go +94 -0
  95. package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader_test.go +198 -0
  96. package/project-skills/tdd-guard/reporters/go/internal/parser/parser.go +245 -0
  97. package/project-skills/tdd-guard/reporters/go/internal/parser/parser_test.go +547 -0
  98. package/project-skills/tdd-guard/reporters/go/internal/storage/storage.go +35 -0
  99. package/project-skills/tdd-guard/reporters/go/internal/storage/storage_test.go +113 -0
  100. package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer.go +103 -0
  101. package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer_test.go +303 -0
  102. package/project-skills/tdd-guard/reporters/jest/README.md +102 -0
  103. package/project-skills/tdd-guard/reporters/jest/package.json +38 -0
  104. package/project-skills/tdd-guard/reporters/phpunit/.php-cs-fixer.php +28 -0
  105. package/project-skills/tdd-guard/reporters/phpunit/README.md +97 -0
  106. package/project-skills/tdd-guard/reporters/phpunit/SYNC_README.md +29 -0
  107. package/project-skills/tdd-guard/reporters/phpunit/composer.json +55 -0
  108. package/project-skills/tdd-guard/reporters/phpunit/phpunit.xml.dist +19 -0
  109. package/project-skills/tdd-guard/reporters/phpunit/psalm.xml +44 -0
  110. package/project-skills/tdd-guard/reporters/phpunit/src/Event/ErroredTestSubscriber.php +28 -0
  111. package/project-skills/tdd-guard/reporters/phpunit/src/Event/FailedTestSubscriber.php +28 -0
  112. package/project-skills/tdd-guard/reporters/phpunit/src/Event/IncompleteTestSubscriber.php +28 -0
  113. package/project-skills/tdd-guard/reporters/phpunit/src/Event/PassedTestSubscriber.php +27 -0
  114. package/project-skills/tdd-guard/reporters/phpunit/src/Event/SkippedTestSubscriber.php +28 -0
  115. package/project-skills/tdd-guard/reporters/phpunit/src/Event/TestRunnerFinishedSubscriber.php +24 -0
  116. package/project-skills/tdd-guard/reporters/phpunit/src/PathValidator.php +88 -0
  117. package/project-skills/tdd-guard/reporters/phpunit/src/Storage.php +26 -0
  118. package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardExtension.php +33 -0
  119. package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardListener.php +158 -0
  120. package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardSubscriber.php +35 -0
  121. package/project-skills/tdd-guard/reporters/phpunit/src/TestResultCollector.php +105 -0
  122. package/project-skills/tdd-guard/reporters/phpunit/tests/PathValidatorTest.php +74 -0
  123. package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionFailedTest.php +241 -0
  124. package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionTest.php +84 -0
  125. package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardStorageLocationTest.php +71 -0
  126. package/project-skills/tdd-guard/reporters/pytest/README.md +77 -0
  127. package/project-skills/tdd-guard/reporters/pytest/pyproject.toml +43 -0
  128. package/project-skills/tdd-guard/reporters/pytest/pytest.ini.example +7 -0
  129. package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/__init__.py +1 -0
  130. package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/pytest_reporter.py +134 -0
  131. package/project-skills/tdd-guard/reporters/pytest/tests/__init__.py +1 -0
  132. package/project-skills/tdd-guard/reporters/pytest/tests/conftest.py +3 -0
  133. package/project-skills/tdd-guard/reporters/pytest/tests/helpers.py +293 -0
  134. package/project-skills/tdd-guard/reporters/pytest/tests/test_config_option.py +38 -0
  135. package/project-skills/tdd-guard/reporters/pytest/tests/test_path_validation.py +59 -0
  136. package/project-skills/tdd-guard/reporters/pytest/tests/test_plugin_config.py +32 -0
  137. package/project-skills/tdd-guard/reporters/pytest/tests/test_project_root.py +296 -0
  138. package/project-skills/tdd-guard/reporters/pytest/tests/test_pytest_reporter.py +137 -0
  139. package/project-skills/tdd-guard/reporters/rspec/Gemfile +3 -0
  140. package/project-skills/tdd-guard/reporters/rust/Cargo.lock +458 -0
  141. package/project-skills/tdd-guard/reporters/rust/Cargo.toml +33 -0
  142. package/project-skills/tdd-guard/reporters/rust/Makefile.example +95 -0
  143. package/project-skills/tdd-guard/reporters/rust/README.md +88 -0
  144. package/project-skills/tdd-guard/reporters/rust/src/error_parser.rs +309 -0
  145. package/project-skills/tdd-guard/reporters/rust/src/main.rs +464 -0
  146. package/project-skills/tdd-guard/reporters/rust/src/parser.rs +225 -0
  147. package/project-skills/tdd-guard/reporters/rust/src/transformer.rs +409 -0
  148. package/project-skills/tdd-guard/reporters/storybook/README.md +108 -0
  149. package/project-skills/tdd-guard/reporters/storybook/package-lock.json +9482 -0
  150. package/project-skills/tdd-guard/reporters/storybook/package.json +43 -0
  151. package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test-data.ts +22 -0
  152. package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test.ts +190 -0
  153. package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.ts +88 -0
  154. package/project-skills/tdd-guard/reporters/storybook/src/index.ts +12 -0
  155. package/project-skills/tdd-guard/reporters/storybook/src/types.ts +37 -0
  156. package/project-skills/tdd-guard/reporters/storybook/tsconfig.json +11 -0
  157. package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/go.mod +3 -0
  158. package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/single_failing_test.go +13 -0
  159. package/project-skills/tdd-guard/reporters/test/artifacts/go/import/go.mod +3 -0
  160. package/project-skills/tdd-guard/reporters/test/artifacts/go/import/single_import_error_test.go +17 -0
  161. package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/go.mod +3 -0
  162. package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/single_passing_test.go +13 -0
  163. package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-failing.test.js +5 -0
  164. package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-import-error.test.js +8 -0
  165. package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-passing.test.js +5 -0
  166. package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleFailingTest.php +11 -0
  167. package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleImportErrorTest.php +14 -0
  168. package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SinglePassingTest.php +11 -0
  169. package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_failing.py +3 -0
  170. package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_import_error.py +6 -0
  171. package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_passing.py +3 -0
  172. package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.lock +7 -0
  173. package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.toml +4 -0
  174. package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/src/lib.rs +14 -0
  175. package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.lock +7 -0
  176. package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.toml +4 -0
  177. package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/src/lib.rs +13 -0
  178. package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.lock +7 -0
  179. package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.toml +4 -0
  180. package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/src/lib.rs +14 -0
  181. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/Calculator.js +4 -0
  182. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-failing.stories.js +15 -0
  183. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-import-error.stories.js +14 -0
  184. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-passing.stories.js +15 -0
  185. package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-failing.test.js +7 -0
  186. package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-import-error.test.js +9 -0
  187. package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-passing.test.js +7 -0
  188. package/project-skills/tdd-guard/reporters/test/factories/go.ts +59 -0
  189. package/project-skills/tdd-guard/reporters/test/factories/helpers.ts +48 -0
  190. package/project-skills/tdd-guard/reporters/test/factories/index.ts +7 -0
  191. package/project-skills/tdd-guard/reporters/test/factories/jest.ts +51 -0
  192. package/project-skills/tdd-guard/reporters/test/factories/phpunit.ts +63 -0
  193. package/project-skills/tdd-guard/reporters/test/factories/pytest.ts +41 -0
  194. package/project-skills/tdd-guard/reporters/test/factories/rust.ts +158 -0
  195. package/project-skills/tdd-guard/reporters/test/factories/storybook.ts +198 -0
  196. package/project-skills/tdd-guard/reporters/test/factories/vitest.ts +51 -0
  197. package/project-skills/tdd-guard/reporters/test/reporters.integration.test.ts +735 -0
  198. package/project-skills/tdd-guard/reporters/test/types.ts +28 -0
  199. package/project-skills/tdd-guard/reporters/vitest/README.md +64 -0
  200. package/project-skills/tdd-guard/reporters/vitest/package.json +35 -0
  201. package/project-skills/tdd-guard/src/cli/buildContext.test.ts +200 -0
  202. package/project-skills/tdd-guard/src/cli/buildContext.ts +48 -0
  203. package/project-skills/tdd-guard/src/cli/tdd-guard.test.ts +159 -0
  204. package/project-skills/tdd-guard/src/cli/tdd-guard.ts +48 -0
  205. package/project-skills/tdd-guard/src/config/Config.test.ts +538 -0
  206. package/project-skills/tdd-guard/src/config/Config.ts +172 -0
  207. package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.test.ts +58 -0
  208. package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.ts +8 -0
  209. package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.test.ts +347 -0
  210. package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.ts +61 -0
  211. package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.test.ts +24 -0
  212. package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.ts +7 -0
  213. package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.test.ts +377 -0
  214. package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.ts +75 -0
  215. package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.test.ts +563 -0
  216. package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.ts +140 -0
  217. package/project-skills/tdd-guard/src/contracts/types/ClientType.ts +1 -0
  218. package/project-skills/tdd-guard/src/contracts/types/ConfigOptions.ts +12 -0
  219. package/project-skills/tdd-guard/src/contracts/types/Context.ts +16 -0
  220. package/project-skills/tdd-guard/src/contracts/types/ModelClient.ts +3 -0
  221. package/project-skills/tdd-guard/src/contracts/types/ValidationResult.ts +6 -0
  222. package/project-skills/tdd-guard/src/guard/GuardManager.test.ts +336 -0
  223. package/project-skills/tdd-guard/src/guard/GuardManager.ts +83 -0
  224. package/project-skills/tdd-guard/src/hooks/HookEvents.test.ts +107 -0
  225. package/project-skills/tdd-guard/src/hooks/HookEvents.ts +39 -0
  226. package/project-skills/tdd-guard/src/hooks/fileTypeDetection.ts +16 -0
  227. package/project-skills/tdd-guard/src/hooks/postToolLint.test.ts +327 -0
  228. package/project-skills/tdd-guard/src/hooks/postToolLint.ts +165 -0
  229. package/project-skills/tdd-guard/src/hooks/processHookData.test.ts +465 -0
  230. package/project-skills/tdd-guard/src/hooks/processHookData.ts +203 -0
  231. package/project-skills/tdd-guard/src/hooks/sessionHandler.test.ts +136 -0
  232. package/project-skills/tdd-guard/src/hooks/sessionHandler.ts +31 -0
  233. package/project-skills/tdd-guard/src/hooks/userPromptHandler.test.ts +131 -0
  234. package/project-skills/tdd-guard/src/hooks/userPromptHandler.ts +55 -0
  235. package/project-skills/tdd-guard/src/index.ts +19 -0
  236. package/project-skills/tdd-guard/src/linters/Linter.ts +5 -0
  237. package/project-skills/tdd-guard/src/linters/eslint/ESLint.test.ts +183 -0
  238. package/project-skills/tdd-guard/src/linters/eslint/ESLint.ts +82 -0
  239. package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.test.ts +170 -0
  240. package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.ts +148 -0
  241. package/project-skills/tdd-guard/src/processors/index.ts +1 -0
  242. package/project-skills/tdd-guard/src/processors/lintProcessor.ts +77 -0
  243. package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.test.ts +303 -0
  244. package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.ts +255 -0
  245. package/project-skills/tdd-guard/src/providers/LinterProvider.test.ts +43 -0
  246. package/project-skills/tdd-guard/src/providers/LinterProvider.ts +20 -0
  247. package/project-skills/tdd-guard/src/providers/ModelClientProvider.test.ts +68 -0
  248. package/project-skills/tdd-guard/src/providers/ModelClientProvider.ts +22 -0
  249. package/project-skills/tdd-guard/src/storage/FileStorage.test.ts +76 -0
  250. package/project-skills/tdd-guard/src/storage/FileStorage.ts +108 -0
  251. package/project-skills/tdd-guard/src/storage/MemoryStorage.ts +57 -0
  252. package/project-skills/tdd-guard/src/storage/Storage.test.ts +227 -0
  253. package/project-skills/tdd-guard/src/storage/Storage.ts +17 -0
  254. package/project-skills/tdd-guard/src/validation/context/context.test.ts +364 -0
  255. package/project-skills/tdd-guard/src/validation/context/context.ts +155 -0
  256. package/project-skills/tdd-guard/src/validation/models/AnthropicApi.test.ts +171 -0
  257. package/project-skills/tdd-guard/src/validation/models/AnthropicApi.ts +49 -0
  258. package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.test.ts +167 -0
  259. package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.ts +54 -0
  260. package/project-skills/tdd-guard/src/validation/models/ClaudeCli.test.ts +239 -0
  261. package/project-skills/tdd-guard/src/validation/models/ClaudeCli.ts +57 -0
  262. package/project-skills/tdd-guard/src/validation/prompts/file-types.ts +52 -0
  263. package/project-skills/tdd-guard/src/validation/prompts/operations/edit.ts +58 -0
  264. package/project-skills/tdd-guard/src/validation/prompts/operations/multi-edit.ts +54 -0
  265. package/project-skills/tdd-guard/src/validation/prompts/operations/write.ts +54 -0
  266. package/project-skills/tdd-guard/src/validation/prompts/response.ts +40 -0
  267. package/project-skills/tdd-guard/src/validation/prompts/rules.ts +51 -0
  268. package/project-skills/tdd-guard/src/validation/prompts/system-prompt.ts +10 -0
  269. package/project-skills/tdd-guard/src/validation/prompts/tools/lint-results.ts +15 -0
  270. package/project-skills/tdd-guard/src/validation/prompts/tools/test-output.ts +14 -0
  271. package/project-skills/tdd-guard/src/validation/prompts/tools/todos.ts +9 -0
  272. package/project-skills/tdd-guard/src/validation/validator.test.ts +268 -0
  273. package/project-skills/tdd-guard/src/validation/validator.ts +159 -0
  274. package/project-skills/tdd-guard/test/artifacts/go/.golangci.yml +6 -0
  275. package/project-skills/tdd-guard/test/artifacts/go/with-issues/file-with-issues.go +12 -0
  276. package/project-skills/tdd-guard/test/artifacts/go/with-issues/go.mod +3 -0
  277. package/project-skills/tdd-guard/test/artifacts/go/without-issues/file-without-issues.go +7 -0
  278. package/project-skills/tdd-guard/test/artifacts/go/without-issues/go.mod +3 -0
  279. package/project-skills/tdd-guard/test/artifacts/javascript/eslint.config.js +20 -0
  280. package/project-skills/tdd-guard/test/artifacts/javascript/file-with-issues.js +12 -0
  281. package/project-skills/tdd-guard/test/artifacts/javascript/file-without-issues.js +10 -0
  282. package/project-skills/tdd-guard/test/hooks/fileTypeDetection.test.ts +26 -0
  283. package/project-skills/tdd-guard/test/hooks/processHookData.fileType.test.ts +46 -0
  284. package/project-skills/tdd-guard/test/hooks/processHookData.python.test.ts +68 -0
  285. package/project-skills/tdd-guard/test/integration/test-context.test.ts +66 -0
  286. package/project-skills/tdd-guard/test/integration/validator.core.test.ts +96 -0
  287. package/project-skills/tdd-guard/test/integration/validator.scenarios.test.ts +497 -0
  288. package/project-skills/tdd-guard/test/utils/assertions.ts +29 -0
  289. package/project-skills/tdd-guard/test/utils/factories/contextFactory.ts +30 -0
  290. package/project-skills/tdd-guard/test/utils/factories/editFactory.ts +82 -0
  291. package/project-skills/tdd-guard/test/utils/factories/helpers.test.ts +46 -0
  292. package/project-skills/tdd-guard/test/utils/factories/helpers.ts +46 -0
  293. package/project-skills/tdd-guard/test/utils/factories/lintFactory.ts +352 -0
  294. package/project-skills/tdd-guard/test/utils/factories/modelClientProviderFactory.ts +21 -0
  295. package/project-skills/tdd-guard/test/utils/factories/multiEditFactory.ts +79 -0
  296. package/project-skills/tdd-guard/test/utils/factories/operations.ts +57 -0
  297. package/project-skills/tdd-guard/test/utils/factories/reporterFactory.ts +55 -0
  298. package/project-skills/tdd-guard/test/utils/factories/scenarios/index.ts +22 -0
  299. package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/python.ts +745 -0
  300. package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/typescript.ts +767 -0
  301. package/project-skills/tdd-guard/test/utils/factories/scenarios/types.ts +77 -0
  302. package/project-skills/tdd-guard/test/utils/factories/scenarios/utils.ts +15 -0
  303. package/project-skills/tdd-guard/test/utils/factories/sessionStartFactory.ts +36 -0
  304. package/project-skills/tdd-guard/test/utils/factories/testDefaults.ts +90 -0
  305. package/project-skills/tdd-guard/test/utils/factories/testResultsFactory.ts +234 -0
  306. package/project-skills/tdd-guard/test/utils/factories/todoFactory.ts +99 -0
  307. package/project-skills/tdd-guard/test/utils/factories/userPromptSubmitFactory.ts +39 -0
  308. package/project-skills/tdd-guard/test/utils/factories/writeFactory.ts +70 -0
  309. package/project-skills/tdd-guard/test/utils/index.ts +131 -0
  310. package/project-skills/tdd-guard/tsconfig.build.json +16 -0
  311. package/project-skills/tdd-guard/tsconfig.eslint.json +17 -0
  312. package/project-skills/tdd-guard/tsconfig.json +32 -0
  313. package/project-skills/tdd-guard/tsconfig.node.json +10 -0
  314. package/project-skills/tdd-guard/vitest.config.ts +85 -0
  315. package/project-skills/ts-quality-gate/.claude/hooks/hook-config.json +66 -0
  316. package/project-skills/ts-quality-gate/.claude/hooks/quality-check.cjs +1251 -0
  317. package/project-skills/ts-quality-gate/.claude/settings.json +16 -0
  318. package/project-skills/ts-quality-gate/.claude/skills/using-ts-quality-gate/SKILL.md +81 -0
  319. package/project-skills/ts-quality-gate/README.md +115 -0
  320. package/skills/README.txt +31 -0
  321. package/skills/clean-code/SKILL.md +201 -0
  322. package/skills/delegating/SKILL.md +196 -0
  323. package/skills/delegating/config.yaml +210 -0
  324. package/skills/delegating/references/orchestration-protocols.md +41 -0
  325. package/skills/docker-expert/SKILL.md +409 -0
  326. package/skills/documenting/CHANGELOG.md +23 -0
  327. package/skills/documenting/README.md +148 -0
  328. package/skills/documenting/SKILL.md +113 -0
  329. package/skills/documenting/examples/example_pattern.md +70 -0
  330. package/skills/documenting/examples/example_reference.md +70 -0
  331. package/skills/documenting/examples/example_ssot_analytics.md +64 -0
  332. package/skills/documenting/examples/example_workflow.md +141 -0
  333. package/skills/documenting/references/changelog-format.md +97 -0
  334. package/skills/documenting/references/metadata-schema.md +136 -0
  335. package/skills/documenting/references/taxonomy.md +81 -0
  336. package/skills/documenting/references/versioning-rules.md +78 -0
  337. package/skills/documenting/scripts/__pycache__/drift_detector.cpython-314.pyc +0 -0
  338. package/skills/documenting/scripts/__pycache__/orchestrator.cpython-314.pyc +0 -0
  339. package/skills/documenting/scripts/__pycache__/validate_metadata.cpython-314.pyc +0 -0
  340. package/skills/documenting/scripts/bump_version.sh +60 -0
  341. package/skills/documenting/scripts/changelog/__init__.py +0 -0
  342. package/skills/documenting/scripts/changelog/__pycache__/__init__.cpython-314.pyc +0 -0
  343. package/skills/documenting/scripts/changelog/__pycache__/add_entry.cpython-314.pyc +0 -0
  344. package/skills/documenting/scripts/changelog/__pycache__/bump_release.cpython-314.pyc +0 -0
  345. package/skills/documenting/scripts/changelog/__pycache__/validate_changelog.cpython-314.pyc +0 -0
  346. package/skills/documenting/scripts/changelog/add_entry.py +216 -0
  347. package/skills/documenting/scripts/changelog/bump_release.py +117 -0
  348. package/skills/documenting/scripts/changelog/init_changelog.py +54 -0
  349. package/skills/documenting/scripts/changelog/validate_changelog.py +128 -0
  350. package/skills/documenting/scripts/drift_detector.py +266 -0
  351. package/skills/documenting/scripts/generate_template.py +311 -0
  352. package/skills/documenting/scripts/list_by_category.sh +84 -0
  353. package/skills/documenting/scripts/orchestrator.py +255 -0
  354. package/skills/documenting/scripts/validate_metadata.py +242 -0
  355. package/skills/documenting/templates/CHANGELOG.md.template +13 -0
  356. package/skills/documenting/tests/__pycache__/test_changelog.cpython-314-pytest-9.0.2.pyc +0 -0
  357. package/skills/documenting/tests/__pycache__/test_drift_detector.cpython-314-pytest-9.0.2.pyc +0 -0
  358. package/skills/documenting/tests/__pycache__/test_orchestrator.cpython-314-pytest-9.0.2.pyc +0 -0
  359. package/skills/documenting/tests/__pycache__/test_validate_metadata.cpython-314-pytest-9.0.2.pyc +0 -0
  360. package/skills/documenting/tests/integration_test.sh +70 -0
  361. package/skills/documenting/tests/test_changelog.py +201 -0
  362. package/skills/documenting/tests/test_drift_detector.py +80 -0
  363. package/skills/documenting/tests/test_orchestrator.py +52 -0
  364. package/skills/documenting/tests/test_validate_metadata.py +64 -0
  365. package/skills/find-skills/SKILL.md +133 -0
  366. package/skills/gitnexus-debugging/SKILL.md +85 -0
  367. package/skills/gitnexus-exploring/SKILL.md +75 -0
  368. package/skills/gitnexus-impact-analysis/SKILL.md +94 -0
  369. package/skills/gitnexus-refactoring/SKILL.md +113 -0
  370. package/skills/hook-development/SKILL.md +797 -0
  371. package/skills/hook-development/examples/load-context.sh +55 -0
  372. package/skills/hook-development/examples/quality-check.js +1168 -0
  373. package/skills/hook-development/examples/validate-bash.sh +43 -0
  374. package/skills/hook-development/examples/validate-write.sh +38 -0
  375. package/skills/hook-development/references/advanced.md +527 -0
  376. package/skills/hook-development/references/migration.md +369 -0
  377. package/skills/hook-development/references/patterns.md +412 -0
  378. package/skills/hook-development/scripts/README.md +164 -0
  379. package/skills/hook-development/scripts/hook-linter.sh +153 -0
  380. package/skills/hook-development/scripts/test-hook.sh +252 -0
  381. package/skills/hook-development/scripts/validate-hook-schema.sh +159 -0
  382. package/skills/obsidian-cli/SKILL.md +106 -0
  383. package/skills/orchestrating-agents/SKILL.md +135 -0
  384. package/skills/orchestrating-agents/config.yaml +45 -0
  385. package/skills/orchestrating-agents/references/agent-context-integration.md +37 -0
  386. package/skills/orchestrating-agents/references/examples.md +45 -0
  387. package/skills/orchestrating-agents/references/handover-protocol.md +31 -0
  388. package/skills/orchestrating-agents/references/workflows.md +42 -0
  389. package/skills/orchestrating-agents/scripts/detect_neighbors.py +23 -0
  390. package/skills/prompt-improving/README.md +162 -0
  391. package/skills/prompt-improving/SKILL.md +74 -0
  392. package/skills/prompt-improving/references/analysis_commands.md +24 -0
  393. package/skills/prompt-improving/references/chain_of_thought.md +24 -0
  394. package/skills/prompt-improving/references/mcp_definitions.md +20 -0
  395. package/skills/prompt-improving/references/multishot.md +23 -0
  396. package/skills/prompt-improving/references/xml_core.md +60 -0
  397. package/skills/python-testing/SKILL.md +815 -0
  398. package/skills/senior-backend/SKILL.md +209 -0
  399. package/skills/senior-backend/references/api_design_patterns.md +103 -0
  400. package/skills/senior-backend/references/backend_security_practices.md +103 -0
  401. package/skills/senior-backend/references/database_optimization_guide.md +103 -0
  402. package/skills/senior-backend/scripts/api_load_tester.py +114 -0
  403. package/skills/senior-backend/scripts/api_scaffolder.py +114 -0
  404. package/skills/senior-backend/scripts/database_migration_tool.py +114 -0
  405. package/skills/senior-data-scientist/SKILL.md +226 -0
  406. package/skills/senior-data-scientist/references/experiment_design_frameworks.md +80 -0
  407. package/skills/senior-data-scientist/references/feature_engineering_patterns.md +80 -0
  408. package/skills/senior-data-scientist/references/statistical_methods_advanced.md +80 -0
  409. package/skills/senior-data-scientist/scripts/experiment_designer.py +100 -0
  410. package/skills/senior-data-scientist/scripts/feature_engineering_pipeline.py +100 -0
  411. package/skills/senior-data-scientist/scripts/model_evaluation_suite.py +100 -0
  412. package/skills/senior-devops/SKILL.md +209 -0
  413. package/skills/senior-devops/references/cicd_pipeline_guide.md +103 -0
  414. package/skills/senior-devops/references/deployment_strategies.md +103 -0
  415. package/skills/senior-devops/references/infrastructure_as_code.md +103 -0
  416. package/skills/senior-devops/scripts/deployment_manager.py +114 -0
  417. package/skills/senior-devops/scripts/pipeline_generator.py +114 -0
  418. package/skills/senior-devops/scripts/terraform_scaffolder.py +114 -0
  419. package/skills/senior-security/SKILL.md +209 -0
  420. package/skills/senior-security/references/cryptography_implementation.md +103 -0
  421. package/skills/senior-security/references/penetration_testing_guide.md +103 -0
  422. package/skills/senior-security/references/security_architecture_patterns.md +103 -0
  423. package/skills/senior-security/scripts/pentest_automator.py +114 -0
  424. package/skills/senior-security/scripts/security_auditor.py +114 -0
  425. package/skills/senior-security/scripts/threat_modeler.py +114 -0
  426. package/skills/skill-creator/LICENSE.txt +202 -0
  427. package/skills/skill-creator/SKILL.md +479 -0
  428. package/skills/skill-creator/agents/analyzer.md +274 -0
  429. package/skills/skill-creator/agents/comparator.md +202 -0
  430. package/skills/skill-creator/agents/grader.md +223 -0
  431. package/skills/skill-creator/assets/eval_review.html +146 -0
  432. package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  433. package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  434. package/skills/skill-creator/references/schemas.md +430 -0
  435. package/skills/skill-creator/scripts/__init__.py +0 -0
  436. package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  437. package/skills/skill-creator/scripts/generate_report.py +326 -0
  438. package/skills/skill-creator/scripts/improve_description.py +248 -0
  439. package/skills/skill-creator/scripts/package_skill.py +136 -0
  440. package/skills/skill-creator/scripts/quick_validate.py +103 -0
  441. package/skills/skill-creator/scripts/run_eval.py +310 -0
  442. package/skills/skill-creator/scripts/run_loop.py +332 -0
  443. package/skills/skill-creator/scripts/utils.py +47 -0
  444. package/skills/using-TDD/SKILL.md +410 -0
  445. package/skills/using-serena-lsp/README.md +8 -0
  446. package/skills/using-serena-lsp/REFERENCE.md +194 -0
  447. package/skills/using-serena-lsp/SKILL.md +82 -0
@@ -0,0 +1,547 @@
1
+ package parser
2
+
3
+ import (
4
+ "bufio"
5
+ "encoding/json"
6
+ "strings"
7
+ "testing"
8
+ )
9
+
10
+ // Test fixtures - common JSON events
11
+ const (
12
+ passEvent = `{"Action":"pass","Package":"example.com/pkg","Test":"TestAdd"}`
13
+ failEvent = `{"Action":"fail","Package":"example.com/pkg","Test":"TestFail"}`
14
+ runEvent = `{"Action":"run","Package":"example.com/pkg","Test":"TestAdd"}`
15
+ )
16
+
17
+ func TestParser(t *testing.T) {
18
+ t.Run("Creation", func(t *testing.T) {
19
+ t.Run("creates new parser", func(t *testing.T) {
20
+ parser := NewParser()
21
+ if parser == nil {
22
+ t.Fatal("Expected parser to be created")
23
+ }
24
+ })
25
+
26
+ t.Run("returns empty results initially", func(t *testing.T) {
27
+ parser := NewParser()
28
+ results := parser.GetResults()
29
+ if results == nil {
30
+ t.Fatal("Expected results to be non-nil")
31
+ }
32
+ if len(results) != 0 {
33
+ t.Fatalf("Expected empty results, got %d items", len(results))
34
+ }
35
+ })
36
+ })
37
+
38
+ t.Run("Parsing", func(t *testing.T) {
39
+ t.Run("accepts io.Reader", func(t *testing.T) {
40
+ parser := NewParser()
41
+ err := parser.Parse(strings.NewReader(""))
42
+ if err != nil {
43
+ t.Fatalf("Parse returned error: %v", err)
44
+ }
45
+ })
46
+
47
+ t.Run("handles invalid JSON", func(t *testing.T) {
48
+ results := parseJSON(t, "not json")
49
+ if len(results) != 0 {
50
+ t.Fatal("Expected no results for invalid JSON")
51
+ }
52
+ })
53
+ })
54
+
55
+ t.Run("Recording tests", func(t *testing.T) {
56
+ t.Run("records passing test", func(t *testing.T) {
57
+ results := parseJSON(t, passEvent)
58
+
59
+ if len(results) != 1 {
60
+ t.Fatalf("Expected 1 package, got %d", len(results))
61
+ }
62
+
63
+ tests := getPackageTests(t, results, "example.com/pkg")
64
+ if _, exists := tests["TestAdd"]; !exists {
65
+ t.Fatal("Expected test 'TestAdd' to be recorded")
66
+ }
67
+ })
68
+
69
+ t.Run("records failing test", func(t *testing.T) {
70
+ results := parseJSON(t, failEvent)
71
+ tests := getPackageTests(t, results, "example.com/pkg")
72
+
73
+ if _, exists := tests["TestFail"]; !exists {
74
+ t.Fatal("Expected test 'TestFail' to be recorded")
75
+ }
76
+ })
77
+
78
+ t.Run("ignores non-terminal actions", func(t *testing.T) {
79
+ results := parseJSON(t, runEvent)
80
+
81
+ // Package should exist but with no tests
82
+ if tests, exists := results["example.com/pkg"]; exists {
83
+ if _, hasTest := tests["TestAdd"]; hasTest {
84
+ t.Fatal("Should not record test with 'run' action")
85
+ }
86
+ }
87
+ })
88
+ })
89
+
90
+ t.Run("Test states", func(t *testing.T) {
91
+ testCases := []struct {
92
+ name string
93
+ input string
94
+ testName string
95
+ expected TestState
96
+ }{
97
+ {"passing test", passEvent, "TestAdd", StatePassed},
98
+ {"failing test", failEvent, "TestFail", StateFailed},
99
+ }
100
+
101
+ for _, tc := range testCases {
102
+ t.Run(tc.name, func(t *testing.T) {
103
+ results := parseJSON(t, tc.input)
104
+ tests := getPackageTests(t, results, "example.com/pkg")
105
+
106
+ state, exists := tests[tc.testName]
107
+ if !exists {
108
+ t.Fatalf("Test %s not found", tc.testName)
109
+ }
110
+ if state != tc.expected {
111
+ t.Errorf("Expected state %s, got %v", tc.expected, state)
112
+ }
113
+ })
114
+ }
115
+ })
116
+
117
+ t.Run("Multiple tests", func(t *testing.T) {
118
+ input := strings.Join([]string{
119
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestOne"}`,
120
+ `{"Action":"fail","Package":"example.com/pkg","Test":"TestTwo"}`,
121
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestThree"}`,
122
+ }, "\n")
123
+
124
+ results := parseJSON(t, input)
125
+ tests := getPackageTests(t, results, "example.com/pkg")
126
+
127
+ if len(tests) != 3 {
128
+ t.Fatalf("Expected 3 tests, got %d", len(tests))
129
+ }
130
+
131
+ // Verify individual test states
132
+ expectedStates := map[string]TestState{
133
+ "TestOne": StatePassed,
134
+ "TestTwo": StateFailed,
135
+ "TestThree": StatePassed,
136
+ }
137
+
138
+ for name, expectedState := range expectedStates {
139
+ if state, exists := tests[name]; !exists {
140
+ t.Errorf("Test %s not found", name)
141
+ } else if state != expectedState {
142
+ t.Errorf("Test %s: expected state %s, got %v", name, expectedState, state)
143
+ }
144
+ }
145
+ })
146
+
147
+ t.Run("Multiple packages", func(t *testing.T) {
148
+ input := strings.Join([]string{
149
+ `{"Action":"pass","Package":"example.com/pkg1","Test":"TestA"}`,
150
+ `{"Action":"pass","Package":"example.com/pkg2","Test":"TestB"}`,
151
+ }, "\n")
152
+
153
+ results := parseJSON(t, input)
154
+
155
+ if len(results) != 2 {
156
+ t.Fatalf("Expected 2 packages, got %d", len(results))
157
+ }
158
+
159
+ // Verify both packages exist
160
+ for _, pkg := range []string{"example.com/pkg1", "example.com/pkg2"} {
161
+ if _, exists := results[pkg]; !exists {
162
+ t.Errorf("Package %s not found", pkg)
163
+ }
164
+ }
165
+ })
166
+
167
+ t.Run("Subtest filtering", func(t *testing.T) {
168
+ t.Run("filters out parent test when one subtest exists", func(t *testing.T) {
169
+ // Simplest case: parent with one child
170
+ input := strings.Join([]string{
171
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent"}`,
172
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent/Child"}`,
173
+ }, "\n")
174
+
175
+ results := parseJSON(t, input)
176
+ tests := getPackageTests(t, results, "example.com/pkg")
177
+
178
+ // Should only have the child test, not the parent
179
+ if _, exists := tests["TestParent"]; exists {
180
+ t.Error("Expected TestParent to be filtered out when child exists")
181
+ }
182
+ })
183
+
184
+ t.Run("keeps test without children", func(t *testing.T) {
185
+ input := strings.Join([]string{
186
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestSimple"}`,
187
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent"}`,
188
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent/Child"}`,
189
+ }, "\n")
190
+
191
+ results := parseJSON(t, input)
192
+ tests := getPackageTests(t, results, "example.com/pkg")
193
+
194
+ // TestSimple has no children, should be kept
195
+ if _, exists := tests["TestSimple"]; !exists {
196
+ t.Error("Expected TestSimple to exist (has no children)")
197
+ }
198
+ })
199
+
200
+ t.Run("filters parent with multiple children", func(t *testing.T) {
201
+ input := strings.Join([]string{
202
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent"}`,
203
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent/Child1"}`,
204
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestParent/Child2"}`,
205
+ }, "\n")
206
+
207
+ results := parseJSON(t, input)
208
+ tests := getPackageTests(t, results, "example.com/pkg")
209
+
210
+ // Parent should be filtered out
211
+ if _, exists := tests["TestParent"]; exists {
212
+ t.Error("Expected TestParent to be filtered out when multiple children exist")
213
+ }
214
+ })
215
+
216
+ t.Run("filters intermediate level in nested tests", func(t *testing.T) {
217
+ input := strings.Join([]string{
218
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestAPI"}`,
219
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestAPI/Users"}`,
220
+ `{"Action":"pass","Package":"example.com/pkg","Test":"TestAPI/Users/Create"}`,
221
+ }, "\n")
222
+
223
+ results := parseJSON(t, input)
224
+ tests := getPackageTests(t, results, "example.com/pkg")
225
+
226
+ // TestAPI/Users should be filtered out (has child)
227
+ if _, exists := tests["TestAPI/Users"]; exists {
228
+ t.Error("Expected TestAPI/Users to be filtered out when it has children")
229
+ }
230
+ })
231
+ })
232
+
233
+ t.Run("Test output capture", func(t *testing.T) {
234
+ t.Run("captures output for specific test", func(t *testing.T) {
235
+ input := strings.Join([]string{
236
+ `{"Action":"run","Package":"example.com/pkg","Test":"ExampleTest"}`,
237
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"=== RUN ExampleTest\n"}`,
238
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":" main_test.go:10: Expected 6 but got 5\n"}`,
239
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"--- FAIL: ExampleTest (0.00s)\n"}`,
240
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest","Elapsed":0}`,
241
+ }, "\n")
242
+
243
+ output := parseAndGetOutput(t, input)
244
+ if output == "" {
245
+ t.Fatal("Expected test output to be captured")
246
+ }
247
+ })
248
+
249
+ t.Run("returns empty string for non-existent test", func(t *testing.T) {
250
+ parser := NewParser()
251
+
252
+ testOutput := parser.GetTestOutput("example.com/pkg", "NonExistentTest")
253
+ if testOutput != "" {
254
+ t.Fatalf("Expected empty string for non-existent test, got %q", testOutput)
255
+ }
256
+ })
257
+
258
+ t.Run("returns empty string when test exists but has no output", func(t *testing.T) {
259
+ input := `{"Action":"pass","Package":"example.com/pkg","Test":"ExampleTest"}`
260
+
261
+ output := parseAndGetOutput(t, input)
262
+ if output != "" {
263
+ t.Fatalf("Expected empty string for test without output, got %q", output)
264
+ }
265
+ })
266
+
267
+ t.Run("returns actual output content", func(t *testing.T) {
268
+ input := strings.Join([]string{
269
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"Expected 6 but got 5\n"}`,
270
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest"}`,
271
+ }, "\n")
272
+
273
+ output := parseAndGetOutput(t, input)
274
+ expected := "Expected 6 but got 5"
275
+ if output != expected {
276
+ t.Fatalf("Expected %q, got %q", expected, output)
277
+ }
278
+ })
279
+
280
+ t.Run("concatenates multiple output lines", func(t *testing.T) {
281
+ input := strings.Join([]string{
282
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"Line 1\n"}`,
283
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"Line 2\n"}`,
284
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest"}`,
285
+ }, "\n")
286
+
287
+ output := parseAndGetOutput(t, input)
288
+ expected := "Line 1\nLine 2"
289
+ if output != expected {
290
+ t.Fatalf("Expected %q, got %q", expected, output)
291
+ }
292
+ })
293
+
294
+ t.Run("excludes RUN lines from output", func(t *testing.T) {
295
+ input := strings.Join([]string{
296
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"=== RUN ExampleTest\n"}`,
297
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"Error message\n"}`,
298
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest"}`,
299
+ }, "\n")
300
+
301
+ output := parseAndGetOutput(t, input)
302
+ if strings.Contains(output, "=== RUN") {
303
+ t.Fatalf("Output should not contain RUN line, got %q", output)
304
+ }
305
+ })
306
+
307
+ t.Run("excludes FAIL lines from output", func(t *testing.T) {
308
+ input := strings.Join([]string{
309
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"Error message\n"}`,
310
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"--- FAIL: ExampleTest (0.00s)\n"}`,
311
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest"}`,
312
+ }, "\n")
313
+
314
+ output := parseAndGetOutput(t, input)
315
+ if strings.Contains(output, "--- FAIL") {
316
+ t.Fatalf("Output should not contain FAIL line, got %q", output)
317
+ }
318
+ })
319
+
320
+ t.Run("trims leading whitespace from error lines", func(t *testing.T) {
321
+ input := strings.Join([]string{
322
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":" test.go:10: Expected 6 but got 5\n"}`,
323
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest"}`,
324
+ }, "\n")
325
+
326
+ output := parseAndGetOutput(t, input)
327
+ expected := "test.go:10: Expected 6 but got 5"
328
+ if output != expected {
329
+ t.Fatalf("Expected %q, got %q", expected, output)
330
+ }
331
+ })
332
+
333
+ t.Run("trims trailing newline from output", func(t *testing.T) {
334
+ input := strings.Join([]string{
335
+ `{"Action":"output","Package":"example.com/pkg","Test":"ExampleTest","Output":"test.go:10: Error message\n"}`,
336
+ `{"Action":"fail","Package":"example.com/pkg","Test":"ExampleTest"}`,
337
+ }, "\n")
338
+
339
+ output := parseAndGetOutput(t, input)
340
+ expected := "test.go:10: Error message"
341
+ if output != expected {
342
+ t.Fatalf("Expected %q, got %q", expected, output)
343
+ }
344
+ })
345
+ })
346
+
347
+ t.Run("Build events", func(t *testing.T) {
348
+ t.Run("TestEvent includes ImportPath field", func(t *testing.T) {
349
+ input := `{"Action":"build-output","ImportPath":"example.com/pkg","Output":"# example.com/pkg\n"}`
350
+
351
+ reader := strings.NewReader(input)
352
+ scanner := bufio.NewScanner(reader)
353
+
354
+ if scanner.Scan() {
355
+ var event TestEvent
356
+ err := json.Unmarshal(scanner.Bytes(), &event)
357
+ if err != nil {
358
+ t.Fatalf("Failed to unmarshal: %v", err)
359
+ }
360
+
361
+ if event.ImportPath != "example.com/pkg" {
362
+ t.Errorf("Expected ImportPath to be 'example.com/pkg', got '%s'", event.ImportPath)
363
+ }
364
+ }
365
+ })
366
+
367
+ t.Run("TestEvent includes FailedBuild field", func(t *testing.T) {
368
+ input := `{"Action":"fail","Package":"example.com/pkg","FailedBuild":"example.com/pkg"}`
369
+
370
+ reader := strings.NewReader(input)
371
+ scanner := bufio.NewScanner(reader)
372
+
373
+ if scanner.Scan() {
374
+ var event TestEvent
375
+ err := json.Unmarshal(scanner.Bytes(), &event)
376
+ if err != nil {
377
+ t.Fatalf("Failed to unmarshal: %v", err)
378
+ }
379
+
380
+ if event.FailedBuild != "example.com/pkg" {
381
+ t.Errorf("Expected FailedBuild to be 'example.com/pkg', got '%s'", event.FailedBuild)
382
+ }
383
+ }
384
+ })
385
+
386
+ t.Run("captures build-output events", func(t *testing.T) {
387
+ parser := NewParser()
388
+
389
+ input := `{"Action":"build-output","ImportPath":"example.com/pkg","Output":"compilation error\n"}`
390
+ err := parser.Parse(strings.NewReader(input))
391
+ if err != nil {
392
+ t.Fatalf("Parse failed: %v", err)
393
+ }
394
+
395
+ // We need a way to verify the build output was captured
396
+ // For now, let's add a GetBuildFailure method
397
+ buildOutput := parser.GetBuildFailure("example.com/pkg")
398
+ if buildOutput != "compilation error\n" {
399
+ t.Errorf("Expected build output 'compilation error\\n', got %q", buildOutput)
400
+ }
401
+ })
402
+
403
+ t.Run("creates CompilationError test for build failure", func(t *testing.T) {
404
+ parser := NewParser()
405
+
406
+ input := `{"Action":"fail","Package":"example.com/pkg","FailedBuild":"example.com/pkg"}`
407
+ err := parser.Parse(strings.NewReader(input))
408
+ if err != nil {
409
+ t.Fatalf("Parse failed: %v", err)
410
+ }
411
+
412
+ results := parser.GetResults()
413
+ tests := results["example.com/pkg"]
414
+
415
+ state, exists := tests["CompilationError"]
416
+ if !exists {
417
+ t.Fatal("Expected CompilationError test to be created")
418
+ }
419
+
420
+ if state != StateFailed {
421
+ t.Errorf("Expected CompilationError to have state 'failed', got %v", state)
422
+ }
423
+ })
424
+
425
+ t.Run("GetTestOutput returns build failure for CompilationError", func(t *testing.T) {
426
+ parser := NewParser()
427
+
428
+ // First capture build output
429
+ buildOutput := `{"Action":"build-output","ImportPath":"example.com/pkg","Output":"undefined: someFunc\n"}`
430
+ err := parser.Parse(strings.NewReader(buildOutput))
431
+ if err != nil {
432
+ t.Fatalf("Parse failed: %v", err)
433
+ }
434
+
435
+ // Then process the build failure
436
+ failEvent := `{"Action":"fail","Package":"example.com/pkg","FailedBuild":"example.com/pkg"}`
437
+ err = parser.Parse(strings.NewReader(failEvent))
438
+ if err != nil {
439
+ t.Fatalf("Parse failed: %v", err)
440
+ }
441
+
442
+ // GetTestOutput should return the build failure message for CompilationError
443
+ output := parser.GetTestOutput("example.com/pkg", "CompilationError")
444
+ if output != "undefined: someFunc" {
445
+ t.Errorf("Expected 'undefined: someFunc', got %q", output)
446
+ }
447
+ })
448
+ })
449
+
450
+ t.Run("Package-level output", func(t *testing.T) {
451
+ t.Run("captures error output messages", func(t *testing.T) {
452
+ // When compilation fails, Go emits output events before the fail event
453
+ input := strings.Join([]string{
454
+ `{"Action":"output","Package":"example.com/pkg","Output":"# example.com/pkg\n"}`,
455
+ `{"Action":"output","Package":"example.com/pkg","Output":"./main.go:3:8: package foo is not in std\n"}`,
456
+ `{"Action":"fail","Package":"example.com/pkg","Elapsed":0.001}`,
457
+ }, "\n")
458
+
459
+ parser := NewParser()
460
+ err := parser.Parse(strings.NewReader(input))
461
+ if err != nil {
462
+ t.Fatalf("Parse failed: %v", err)
463
+ }
464
+
465
+ // Check if we have error output stored
466
+ errorOutput := parser.GetErrorOutput("example.com/pkg")
467
+ if errorOutput == "" {
468
+ t.Fatal("Expected error output to be captured")
469
+ }
470
+ })
471
+
472
+ t.Run("marks package as failed when package-level fail with no tests", func(t *testing.T) {
473
+ // This simulates a build failure that produces JSON output
474
+ // The package fails but has no test entries
475
+ input := `{"Action":"fail","Package":"example.com/pkg","Elapsed":0}`
476
+
477
+ parser := NewParser()
478
+ err := parser.Parse(strings.NewReader(input))
479
+ if err != nil {
480
+ t.Fatalf("Parse failed: %v", err)
481
+ }
482
+
483
+ results := parser.GetResults()
484
+ if pkg, exists := results["example.com/pkg"]; exists {
485
+ if pkg["CompilationError"] != StateFailed {
486
+ t.Fatal("Expected CompilationError to be failed for package-level failure")
487
+ }
488
+ } else {
489
+ t.Fatal("Expected package to exist in results")
490
+ }
491
+ })
492
+
493
+ t.Run("combines multiple output lines", func(t *testing.T) {
494
+ input := strings.Join([]string{
495
+ `{"Action":"output","Package":"example.com/pkg","Output":"# example.com/pkg\n"}`,
496
+ `{"Action":"output","Package":"example.com/pkg","Output":"./main.go:3:8: package foo is not in std\n"}`,
497
+ `{"Action":"output","Package":"example.com/pkg","Output":"./main.go:4:8: package bar is not in std\n"}`,
498
+ `{"Action":"fail","Package":"example.com/pkg","Elapsed":0.001}`,
499
+ }, "\n")
500
+
501
+ parser := NewParser()
502
+ err := parser.Parse(strings.NewReader(input))
503
+ if err != nil {
504
+ t.Fatalf("Parse failed: %v", err)
505
+ }
506
+
507
+ errorOutput := parser.GetErrorOutput("example.com/pkg")
508
+ expected := "# example.com/pkg\n./main.go:3:8: package foo is not in std\n./main.go:4:8: package bar is not in std\n"
509
+ if errorOutput != expected {
510
+ t.Errorf("Expected output:\n%q\nGot:\n%q", expected, errorOutput)
511
+ }
512
+ })
513
+ })
514
+ }
515
+
516
+ // Helper functions
517
+
518
+ func parseJSON(t *testing.T, input string) Results {
519
+ t.Helper()
520
+ parser := NewParser()
521
+ err := parser.Parse(strings.NewReader(input))
522
+ if err != nil {
523
+ t.Fatalf("Parse failed: %v", err)
524
+ }
525
+ return parser.GetResults()
526
+ }
527
+
528
+ func getPackageTests(t *testing.T, results Results, pkg string) PackageResults {
529
+ t.Helper()
530
+ tests, exists := results[pkg]
531
+ if !exists {
532
+ t.Fatalf("Package %s not found", pkg)
533
+ }
534
+ return tests
535
+ }
536
+
537
+ // parseAndGetOutput is a helper for test output capture tests
538
+ // It uses the default package "example.com/pkg" and test name ExampleTest"
539
+ func parseAndGetOutput(t *testing.T, input string) string {
540
+ t.Helper()
541
+ parser := NewParser()
542
+ err := parser.Parse(strings.NewReader(input))
543
+ if err != nil {
544
+ t.Fatalf("Parse failed: %v", err)
545
+ }
546
+ return parser.GetTestOutput("example.com/pkg", "ExampleTest")
547
+ }
@@ -0,0 +1,35 @@
1
+ package storage
2
+
3
+ import (
4
+ "encoding/json"
5
+ "os"
6
+ "path/filepath"
7
+
8
+ "github.com/nizos/tdd-guard/reporters/go/internal/transformer"
9
+ )
10
+
11
+ var (
12
+ // Path components for cross-platform compatibility
13
+ TestResultsPath = []string{".claude", "tdd-guard", "data", "test.json"}
14
+ )
15
+
16
+ type Storage struct {
17
+ basePath string
18
+ }
19
+
20
+ func NewStorage(projectRoot string) *Storage {
21
+ return &Storage{basePath: projectRoot}
22
+ }
23
+
24
+ func (s *Storage) Save(results *transformer.TestResult) error {
25
+ parts := append([]string{s.basePath}, TestResultsPath...)
26
+ filePath := filepath.Join(parts...)
27
+
28
+ // Ensure directory exists
29
+ dir := filepath.Dir(filePath)
30
+ os.MkdirAll(dir, 0755)
31
+
32
+ // Marshal to JSON
33
+ data, _ := json.Marshal(results)
34
+ return os.WriteFile(filePath, data, 0644)
35
+ }
@@ -0,0 +1,113 @@
1
+ package storage
2
+
3
+ import (
4
+ "os"
5
+ "path/filepath"
6
+ "testing"
7
+ )
8
+
9
+ func TestStorage(t *testing.T) {
10
+ t.Run("NewStorage", func(t *testing.T) {
11
+ t.Run("creates storage with empty path", func(t *testing.T) {
12
+ storage := NewStorage("")
13
+ if storage == nil {
14
+ t.Fatal("Expected storage to be created")
15
+ }
16
+ })
17
+
18
+ t.Run("creates storage with project root", func(t *testing.T) {
19
+ storage := NewStorage("/some/path")
20
+ if storage == nil {
21
+ t.Fatal("Expected storage to be created with root")
22
+ }
23
+ })
24
+ })
25
+
26
+ t.Run("Save", func(t *testing.T) {
27
+ // Setup: Create temp directory and change to it for all tests
28
+ oldWd, _ := os.Getwd()
29
+ tempDir := t.TempDir()
30
+ os.Chdir(tempDir)
31
+ t.Cleanup(func() {
32
+ os.Chdir(oldWd)
33
+ })
34
+
35
+ t.Run("returns no error", func(t *testing.T) {
36
+ storage := NewStorage("")
37
+ err := storage.Save(nil)
38
+ if err != nil {
39
+ t.Fatalf("Save failed: %v", err)
40
+ }
41
+ })
42
+
43
+ t.Run("without project root", func(t *testing.T) {
44
+ storage := NewStorage("")
45
+
46
+ t.Run("creates directory in current directory", func(t *testing.T) {
47
+ storage.Save(nil)
48
+
49
+ // Extract directory path from TestResultsPath
50
+ dirParts := TestResultsPath[:len(TestResultsPath)-1]
51
+ expectedDir := filepath.Join(append([]string{tempDir}, dirParts...)...)
52
+
53
+ if _, err := os.Stat(expectedDir); os.IsNotExist(err) {
54
+ t.Fatal("Expected directory to be created")
55
+ }
56
+ })
57
+
58
+ t.Run("creates file in current directory", func(t *testing.T) {
59
+ storage.Save(nil)
60
+
61
+ // Build expected file path
62
+ parts := append([]string{tempDir}, TestResultsPath...)
63
+ expectedPath := filepath.Join(parts...)
64
+
65
+ if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
66
+ t.Fatal("Expected file to be created")
67
+ }
68
+ })
69
+ })
70
+
71
+ t.Run("with project root", func(t *testing.T) {
72
+ projectDir := filepath.Join(tempDir, "project")
73
+ storage := NewStorage(projectDir)
74
+
75
+ t.Run("creates directory in project root", func(t *testing.T) {
76
+ storage.Save(nil)
77
+
78
+ // Extract directory path from TestResultsPath
79
+ dirParts := TestResultsPath[:len(TestResultsPath)-1]
80
+ expectedDir := filepath.Join(append([]string{projectDir}, dirParts...)...)
81
+
82
+ if _, err := os.Stat(expectedDir); os.IsNotExist(err) {
83
+ t.Fatal("Expected directory to be created in project root")
84
+ }
85
+ })
86
+
87
+ t.Run("creates file in project root", func(t *testing.T) {
88
+ storage.Save(nil)
89
+
90
+ // Build expected file path
91
+ parts := append([]string{projectDir}, TestResultsPath...)
92
+ expectedPath := filepath.Join(parts...)
93
+
94
+ if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
95
+ t.Fatal("Expected file to be created in project root")
96
+ }
97
+ })
98
+ })
99
+
100
+ t.Run("writes data to file", func(t *testing.T) {
101
+ storage := NewStorage("")
102
+ storage.Save(nil)
103
+
104
+ parts := append([]string{tempDir}, TestResultsPath...)
105
+ filePath := filepath.Join(parts...)
106
+ content, _ := os.ReadFile(filePath)
107
+
108
+ if len(content) == 0 {
109
+ t.Fatal("Expected file to contain data")
110
+ }
111
+ })
112
+ })
113
+ }