claude-flow-novice 2.18.13 → 2.18.14

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 (300) hide show
  1. package/.backups/unknown/1765417503_2999b9ec66f591dd76075617ec31fcea/metadata.json +8 -0
  2. package/.backups/unknown/1765417503_2999b9ec66f591dd76075617ec31fcea/original +3 -0
  3. package/.backups/unknown/1765417503_2999b9ec66f591dd76075617ec31fcea/revert.sh +7 -0
  4. package/.backups/unknown/1765417531_2999b9ec66f591dd76075617ec31fcea/metadata.json +8 -0
  5. package/.backups/unknown/1765417531_2999b9ec66f591dd76075617ec31fcea/original +3 -0
  6. package/.backups/unknown/1765417531_2999b9ec66f591dd76075617ec31fcea/revert.sh +7 -0
  7. package/.backups/unknown/1765417552_2999b9ec66f591dd76075617ec31fcea/metadata.json +8 -0
  8. package/.backups/unknown/1765417552_2999b9ec66f591dd76075617ec31fcea/original +3 -0
  9. package/.backups/unknown/1765417552_2999b9ec66f591dd76075617ec31fcea/revert.sh +7 -0
  10. package/.backups/unknown/1765417613_1f34dbf0fe1ec3b6cb74ba7c4e12a2a4/metadata.json +8 -0
  11. package/.backups/unknown/1765417613_1f34dbf0fe1ec3b6cb74ba7c4e12a2a4/original +1212 -0
  12. package/.backups/unknown/1765417613_1f34dbf0fe1ec3b6cb74ba7c4e12a2a4/revert.sh +7 -0
  13. package/.backups/unknown/1765417613_332e9bb223a26270398922640c1c1653/metadata.json +8 -0
  14. package/.backups/unknown/1765417613_332e9bb223a26270398922640c1c1653/original +1212 -0
  15. package/.backups/unknown/1765417613_332e9bb223a26270398922640c1c1653/revert.sh +7 -0
  16. package/.backups/unknown/1765417613_45880a7afef063347b701e7e88e2df9c/metadata.json +8 -0
  17. package/.backups/unknown/1765417613_45880a7afef063347b701e7e88e2df9c/original +1212 -0
  18. package/.backups/unknown/1765417613_45880a7afef063347b701e7e88e2df9c/revert.sh +7 -0
  19. package/.backups/unknown/1765417614_1b6c3b658c2891dbe245aea4bad41661/metadata.json +8 -0
  20. package/.backups/unknown/1765417614_1b6c3b658c2891dbe245aea4bad41661/original +1228 -0
  21. package/.backups/unknown/1765417614_1b6c3b658c2891dbe245aea4bad41661/revert.sh +7 -0
  22. package/.backups/unknown/1765417614_1ed5bd129f0b5d1b297a04ec5267ef62/metadata.json +8 -0
  23. package/.backups/unknown/1765417614_1ed5bd129f0b5d1b297a04ec5267ef62/original +1237 -0
  24. package/.backups/unknown/1765417614_1ed5bd129f0b5d1b297a04ec5267ef62/revert.sh +7 -0
  25. package/.backups/unknown/1765417614_28e032bd1b62dbfcecbd56327a0b0e23/metadata.json +8 -0
  26. package/.backups/unknown/1765417614_28e032bd1b62dbfcecbd56327a0b0e23/original +1240 -0
  27. package/.backups/unknown/1765417614_28e032bd1b62dbfcecbd56327a0b0e23/revert.sh +7 -0
  28. package/.backups/unknown/1765417614_40a1ce1b0efa2e1ba1958c27b2cbc557/metadata.json +8 -0
  29. package/.backups/unknown/1765417614_40a1ce1b0efa2e1ba1958c27b2cbc557/original +1216 -0
  30. package/.backups/unknown/1765417614_40a1ce1b0efa2e1ba1958c27b2cbc557/revert.sh +7 -0
  31. package/.backups/unknown/1765417614_f65dbf58cff7a9aa1c5c3d0d1618074a/metadata.json +8 -0
  32. package/.backups/unknown/1765417614_f65dbf58cff7a9aa1c5c3d0d1618074a/original +1238 -0
  33. package/.backups/unknown/1765417614_f65dbf58cff7a9aa1c5c3d0d1618074a/revert.sh +7 -0
  34. package/.backups/unknown/1765417615_0f45c28b9b8d5204974421c06075ff74/metadata.json +8 -0
  35. package/.backups/unknown/1765417615_0f45c28b9b8d5204974421c06075ff74/original +1167 -0
  36. package/.backups/unknown/1765417615_0f45c28b9b8d5204974421c06075ff74/revert.sh +7 -0
  37. package/.backups/unknown/1765417615_41d36156891ddb6f63d1b4da59d1db4c/metadata.json +8 -0
  38. package/.backups/unknown/1765417615_41d36156891ddb6f63d1b4da59d1db4c/original +1242 -0
  39. package/.backups/unknown/1765417615_41d36156891ddb6f63d1b4da59d1db4c/revert.sh +7 -0
  40. package/.backups/unknown/1765417709_77dda8631459cfc2ab94b8928f7d90b4/metadata.json +8 -0
  41. package/.backups/unknown/1765417709_77dda8631459cfc2ab94b8928f7d90b4/original +2 -0
  42. package/.backups/unknown/1765417709_77dda8631459cfc2ab94b8928f7d90b4/revert.sh +7 -0
  43. package/.backups/unknown/1765417775_1405837bacf112ba832a139840fe94e7/metadata.json +8 -0
  44. package/.backups/unknown/1765417775_1405837bacf112ba832a139840fe94e7/original +1169 -0
  45. package/.backups/unknown/1765417775_1405837bacf112ba832a139840fe94e7/revert.sh +7 -0
  46. package/.backups/unknown/1765417775_8044b4a5cfdcb5cd71317831ad53f5a2/metadata.json +8 -0
  47. package/.backups/unknown/1765417775_8044b4a5cfdcb5cd71317831ad53f5a2/original +1171 -0
  48. package/.backups/unknown/1765417775_8044b4a5cfdcb5cd71317831ad53f5a2/revert.sh +7 -0
  49. package/.backups/unknown/1765417775_8eb94d60151e1db262377fbf8a187212/metadata.json +8 -0
  50. package/.backups/unknown/1765417775_8eb94d60151e1db262377fbf8a187212/original +1170 -0
  51. package/.backups/unknown/1765417775_8eb94d60151e1db262377fbf8a187212/revert.sh +7 -0
  52. package/.backups/unknown/1765417776_a0d4b709e15e0bfa002c4b128f5e4603/metadata.json +8 -0
  53. package/.backups/unknown/1765417776_a0d4b709e15e0bfa002c4b128f5e4603/original +1173 -0
  54. package/.backups/unknown/1765417776_a0d4b709e15e0bfa002c4b128f5e4603/revert.sh +7 -0
  55. package/.backups/unknown/1765417776_cb1bc24d98b63564eb73ef782b8c68b3/metadata.json +8 -0
  56. package/.backups/unknown/1765417776_cb1bc24d98b63564eb73ef782b8c68b3/original +1170 -0
  57. package/.backups/unknown/1765417776_cb1bc24d98b63564eb73ef782b8c68b3/revert.sh +7 -0
  58. package/.backups/unknown/1765417777_1c4cc8c33f476f0c87c8efd4e34efc22/metadata.json +8 -0
  59. package/.backups/unknown/1765417777_1c4cc8c33f476f0c87c8efd4e34efc22/original +1172 -0
  60. package/.backups/unknown/1765417777_1c4cc8c33f476f0c87c8efd4e34efc22/revert.sh +7 -0
  61. package/.backups/unknown/1765417777_325de83ffd34544909b8b9aa6e18dd05/metadata.json +8 -0
  62. package/.backups/unknown/1765417777_325de83ffd34544909b8b9aa6e18dd05/original +1175 -0
  63. package/.backups/unknown/1765417777_325de83ffd34544909b8b9aa6e18dd05/revert.sh +7 -0
  64. package/.backups/unknown/1765417950_402e7c1a8956b56ac7b88e89f024acb4/metadata.json +8 -0
  65. package/.backups/unknown/1765417950_402e7c1a8956b56ac7b88e89f024acb4/original +1178 -0
  66. package/.backups/unknown/1765417950_402e7c1a8956b56ac7b88e89f024acb4/revert.sh +7 -0
  67. package/.backups/unknown/1765417950_647e27e4da18ae42c339e04b4d334feb/metadata.json +8 -0
  68. package/.backups/unknown/1765417950_647e27e4da18ae42c339e04b4d334feb/original +1174 -0
  69. package/.backups/unknown/1765417950_647e27e4da18ae42c339e04b4d334feb/revert.sh +7 -0
  70. package/.backups/unknown/1765417951_1424d2dd67b8c8a4e7cf649b379d21f2/metadata.json +8 -0
  71. package/.backups/unknown/1765417951_1424d2dd67b8c8a4e7cf649b379d21f2/original +1194 -0
  72. package/.backups/unknown/1765417951_1424d2dd67b8c8a4e7cf649b379d21f2/revert.sh +7 -0
  73. package/.backups/unknown/1765417951_6df070ca287ea94a7f08efc69ec9ea51/metadata.json +8 -0
  74. package/.backups/unknown/1765417951_6df070ca287ea94a7f08efc69ec9ea51/original +1186 -0
  75. package/.backups/unknown/1765417951_6df070ca287ea94a7f08efc69ec9ea51/revert.sh +7 -0
  76. package/.backups/unknown/1765417951_848919a1365f6536e5ef8d85d0c80fa7/metadata.json +8 -0
  77. package/.backups/unknown/1765417951_848919a1365f6536e5ef8d85d0c80fa7/original +1180 -0
  78. package/.backups/unknown/1765417951_848919a1365f6536e5ef8d85d0c80fa7/revert.sh +7 -0
  79. package/.backups/unknown/1765417951_b0d1d4ecf85ad10cda0f3900d414b608/metadata.json +8 -0
  80. package/.backups/unknown/1765417951_b0d1d4ecf85ad10cda0f3900d414b608/original +1198 -0
  81. package/.backups/unknown/1765417951_b0d1d4ecf85ad10cda0f3900d414b608/revert.sh +7 -0
  82. package/.backups/unknown/1765417952_2b720e213b5197cbaad53f9f0857f23f/metadata.json +8 -0
  83. package/.backups/unknown/1765417952_2b720e213b5197cbaad53f9f0857f23f/original +1202 -0
  84. package/.backups/unknown/1765417952_2b720e213b5197cbaad53f9f0857f23f/revert.sh +7 -0
  85. package/.backups/unknown/1765417952_ef1d15e8b83a802a0c0f0fc03e56a89c/metadata.json +8 -0
  86. package/.backups/unknown/1765417952_ef1d15e8b83a802a0c0f0fc03e56a89c/original +1202 -0
  87. package/.backups/unknown/1765417952_ef1d15e8b83a802a0c0f0fc03e56a89c/revert.sh +7 -0
  88. package/.backups/unknown/1765418048_ac94238a69a6f86a6ba9d31f623c18a7/metadata.json +8 -0
  89. package/.backups/unknown/1765418048_ac94238a69a6f86a6ba9d31f623c18a7/original +1209 -0
  90. package/.backups/unknown/1765418048_ac94238a69a6f86a6ba9d31f623c18a7/revert.sh +7 -0
  91. package/.backups/unknown/1765418048_f3afed98da63fef9ff57fb5646976f63/metadata.json +8 -0
  92. package/.backups/unknown/1765418048_f3afed98da63fef9ff57fb5646976f63/original +1207 -0
  93. package/.backups/unknown/1765418048_f3afed98da63fef9ff57fb5646976f63/revert.sh +7 -0
  94. package/.backups/unknown/1765418049_9c392702a4e1cace37d17f6f2dfaf54e/metadata.json +8 -0
  95. package/.backups/unknown/1765418049_9c392702a4e1cace37d17f6f2dfaf54e/original +1207 -0
  96. package/.backups/unknown/1765418049_9c392702a4e1cace37d17f6f2dfaf54e/revert.sh +7 -0
  97. package/.backups/unknown/1765418049_9e0777555b51dea4d24d0503b584cfc5/metadata.json +8 -0
  98. package/.backups/unknown/1765418049_9e0777555b51dea4d24d0503b584cfc5/original +1193 -0
  99. package/.backups/unknown/1765418049_9e0777555b51dea4d24d0503b584cfc5/revert.sh +7 -0
  100. package/.backups/unknown/1765418050_22d534bed68f9f5d883bee54e7cbc4d3/metadata.json +8 -0
  101. package/.backups/unknown/1765418050_22d534bed68f9f5d883bee54e7cbc4d3/original +1194 -0
  102. package/.backups/unknown/1765418050_22d534bed68f9f5d883bee54e7cbc4d3/revert.sh +7 -0
  103. package/.backups/unknown/1765418051_d9243722dc90dabc851c5767a62ac7f2/metadata.json +8 -0
  104. package/.backups/unknown/1765418051_d9243722dc90dabc851c5767a62ac7f2/original +1193 -0
  105. package/.backups/unknown/1765418051_d9243722dc90dabc851c5767a62ac7f2/revert.sh +7 -0
  106. package/.backups/unknown/1765418177_21a2fa816d25d419b54ef2d429aab474/metadata.json +8 -0
  107. package/.backups/unknown/1765418177_21a2fa816d25d419b54ef2d429aab474/original +1191 -0
  108. package/.backups/unknown/1765418177_21a2fa816d25d419b54ef2d429aab474/revert.sh +7 -0
  109. package/.backups/unknown/1765418177_33b673dce1eb59d7eb4f752aec882794/metadata.json +8 -0
  110. package/.backups/unknown/1765418177_33b673dce1eb59d7eb4f752aec882794/original +1190 -0
  111. package/.backups/unknown/1765418177_33b673dce1eb59d7eb4f752aec882794/revert.sh +7 -0
  112. package/.backups/unknown/1765418177_72568812ea5a73cf6861a6b14da065fa/metadata.json +8 -0
  113. package/.backups/unknown/1765418177_72568812ea5a73cf6861a6b14da065fa/original +1191 -0
  114. package/.backups/unknown/1765418177_72568812ea5a73cf6861a6b14da065fa/revert.sh +7 -0
  115. package/.backups/unknown/1765418178_20c28b95f12194fe4b81cfb35f4f3757/metadata.json +8 -0
  116. package/.backups/unknown/1765418178_20c28b95f12194fe4b81cfb35f4f3757/original +1189 -0
  117. package/.backups/unknown/1765418178_20c28b95f12194fe4b81cfb35f4f3757/revert.sh +7 -0
  118. package/.backups/unknown/1765418178_cdf68719cc09173769027743e2718ad4/metadata.json +8 -0
  119. package/.backups/unknown/1765418178_cdf68719cc09173769027743e2718ad4/original +1197 -0
  120. package/.backups/unknown/1765418178_cdf68719cc09173769027743e2718ad4/revert.sh +7 -0
  121. package/.backups/unknown/1765418178_eb19e0f8542405480e51af09fad84b71/metadata.json +8 -0
  122. package/.backups/unknown/1765418178_eb19e0f8542405480e51af09fad84b71/original +1190 -0
  123. package/.backups/unknown/1765418178_eb19e0f8542405480e51af09fad84b71/revert.sh +7 -0
  124. package/.backups/unknown/1765418236_c016507725847318a3c369b047cbb802/metadata.json +8 -0
  125. package/.backups/unknown/1765418236_c016507725847318a3c369b047cbb802/original +1197 -0
  126. package/.backups/unknown/1765418236_c016507725847318a3c369b047cbb802/revert.sh +7 -0
  127. package/.backups/unknown/1765418237_932c3cc3a5c537b7933c2370b65f4b39/metadata.json +8 -0
  128. package/.backups/unknown/1765418237_932c3cc3a5c537b7933c2370b65f4b39/original +1197 -0
  129. package/.backups/unknown/1765418237_932c3cc3a5c537b7933c2370b65f4b39/revert.sh +7 -0
  130. package/.claude/agents/cfn-dev-team/utility/epic-creator-v2.md +194 -2
  131. package/.claude/agents/cfn-dev-team/utility/epic-creator-v2.sh +264 -0
  132. package/.claude/agents/cfn-dev-team/utility/epic-creator-v2.sh.backup +698 -0
  133. package/.claude/hooks/README.md +148 -0
  134. package/.claude/hooks/SessionStart:cfn-load-openai-key.sh +35 -0
  135. package/.claude/hooks/cfn-invoke-pre-edit.sh +1 -1
  136. package/.claude/hooks/cfn-load-cerebras-env.sh +65 -0
  137. package/.claude/hooks/cfn-precompact-enhanced.sh +283 -0
  138. package/.claude/hooks/deprecated/README.md +27 -0
  139. package/.claude/settings.json +71 -6
  140. package/.claude/skills/cfn-cerebras-coordinator/QUICKSTART.md +348 -0
  141. package/.claude/skills/cfn-cerebras-coordinator/README.md +525 -0
  142. package/.claude/skills/cfn-cerebras-coordinator/TDD_COORDINATOR_OVERVIEW.md +284 -0
  143. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-py-v2-test-1733854200.json +36 -0
  144. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-py-v3-test-1765383241.json +36 -0
  145. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-rust-v2-test-1765381361.json +36 -0
  146. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-rust-v3-test-1765383242.json +46 -0
  147. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-ts-v2-test-1733864400.json +66 -0
  148. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-ts-v3-test-1765383238.json +66 -0
  149. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-ts-v4-test-1765386506.json +66 -0
  150. package/.claude/skills/cfn-cerebras-coordinator/conversations/2025-12-10-ts-v5-test-1765393100.json +66 -0
  151. package/.claude/skills/cfn-cerebras-coordinator/example-usage.sh +206 -0
  152. package/.claude/skills/cfn-cerebras-coordinator/lib/tdd-conversation-coordinator.ts +569 -0
  153. package/.claude/skills/cfn-cerebras-coordinator/test-tdd-coordinator.sh +250 -0
  154. package/.claude/skills/cfn-epic-creator/SKILL.md +392 -0
  155. package/.claude/skills/cfn-epic-creator/estimate-costs.sh +524 -0
  156. package/.claude/skills/cfn-epic-creator/invoke.sh +445 -0
  157. package/.claude/skills/cfn-epic-creator/parse-personas.sh +533 -0
  158. package/.claude/skills/cfn-epic-creator/security-utils.sh +268 -0
  159. package/.claude/skills/cfn-epic-creator/security-verification-demo.sh +127 -0
  160. package/.claude/skills/cfn-epic-creator/test-invoke.sh +620 -0
  161. package/.claude/skills/cfn-epic-creator/test-security-fixes.sh +195 -0
  162. package/.claude/skills/cfn-epic-creator/test-security-simple.sh +165 -0
  163. package/.claude/skills/cfn-epic-creator/validate-epic.sh +474 -0
  164. package/.claude/skills/cfn-local-ruvector-accelerator/.backups/unknown/1765358428_2cf0ad7377232c919ff0a65630cb307d/metadata.json +8 -0
  165. package/.claude/skills/cfn-local-ruvector-accelerator/.backups/unknown/1765358428_2cf0ad7377232c919ff0a65630cb307d/original +209 -0
  166. package/.claude/skills/cfn-local-ruvector-accelerator/.backups/unknown/1765358428_2cf0ad7377232c919ff0a65630cb307d/revert.sh +7 -0
  167. package/.claude/skills/cfn-local-ruvector-accelerator/AGENT_INTEGRATION_PATTERNS.md +255 -0
  168. package/.claude/skills/cfn-local-ruvector-accelerator/Cargo.toml +8 -1
  169. package/.claude/skills/cfn-local-ruvector-accelerator/Cargo.toml.backup +47 -0
  170. package/.claude/skills/cfn-local-ruvector-accelerator/EXTRACTION_EXAMPLES.md +287 -0
  171. package/.claude/skills/cfn-local-ruvector-accelerator/README.md +2 -563
  172. package/.claude/skills/cfn-local-ruvector-accelerator/SCHEMA_V2_IMPLEMENTATION.md +151 -0
  173. package/.claude/skills/cfn-local-ruvector-accelerator/SECURITY_IMPLEMENTATION.md +185 -0
  174. package/.claude/skills/cfn-local-ruvector-accelerator/SKILL.md +8 -351
  175. package/.claude/skills/cfn-local-ruvector-accelerator/docs/EXECUTIVE_SUMMARY.txt +90 -0
  176. package/.claude/skills/cfn-local-ruvector-accelerator/docs/PHASE_4_QUERY_API.md +210 -0
  177. package/.claude/skills/cfn-local-ruvector-accelerator/docs/RUST_AST_EXTRACTOR_IMPLEMENTATION.md +222 -0
  178. package/.claude/skills/cfn-local-ruvector-accelerator/docs/TRANSACTION_MANAGEMENT.md +241 -0
  179. package/.claude/skills/cfn-local-ruvector-accelerator/docs/VALIDATION_FINDINGS.txt +250 -0
  180. package/.claude/skills/cfn-local-ruvector-accelerator/epic-ast-indexer.json +335 -0
  181. package/.claude/skills/cfn-local-ruvector-accelerator/index-code.sh +292 -96
  182. package/.claude/skills/cfn-local-ruvector-accelerator/index-code.sh.backup +249 -0
  183. package/.claude/skills/cfn-local-ruvector-accelerator/index_all.sh +65 -0
  184. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/find.rs +214 -0
  185. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/index.rs +259 -103
  186. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/index_ast.rs +767 -0
  187. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/index_modified.rs +37 -0
  188. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/init.rs +17 -12
  189. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/migration.rs +34 -1
  190. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/mod.rs +6 -0
  191. package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/refs.rs +209 -0
  192. package/.claude/skills/cfn-local-ruvector-accelerator/src/embeddings.rs +82 -33
  193. package/.claude/skills/cfn-local-ruvector-accelerator/src/extractors/mod.rs +251 -0
  194. package/.claude/skills/cfn-local-ruvector-accelerator/src/extractors/rust.rs +425 -0
  195. package/.claude/skills/cfn-local-ruvector-accelerator/src/extractors/rust_placeholder.rs +420 -0
  196. package/.claude/skills/cfn-local-ruvector-accelerator/src/extractors/text_fallback.rs +490 -0
  197. package/.claude/skills/cfn-local-ruvector-accelerator/src/extractors/typescript.rs +520 -0
  198. package/.claude/skills/cfn-local-ruvector-accelerator/src/extractors/typescript_full.rs +531 -0
  199. package/.claude/skills/cfn-local-ruvector-accelerator/src/lib.rs +20 -0
  200. package/.claude/skills/cfn-local-ruvector-accelerator/src/main.rs +33 -2
  201. package/.claude/skills/cfn-local-ruvector-accelerator/src/main.rs.backup +360 -0
  202. package/.claude/skills/cfn-local-ruvector-accelerator/src/migration.rs +325 -318
  203. package/.claude/skills/cfn-local-ruvector-accelerator/src/migration_backup.rs +325 -0
  204. package/.claude/skills/cfn-local-ruvector-accelerator/src/migration_tx.rs +513 -0
  205. package/.claude/skills/cfn-local-ruvector-accelerator/src/paths.rs +29 -0
  206. package/.claude/skills/cfn-local-ruvector-accelerator/src/query_api.rs +609 -0
  207. package/.claude/skills/cfn-local-ruvector-accelerator/src/schema_v2.rs +603 -0
  208. package/.claude/skills/cfn-local-ruvector-accelerator/src/security_tests.rs +154 -0
  209. package/.claude/skills/cfn-local-ruvector-accelerator/src/store_v2.rs +583 -0
  210. package/.claude/skills/cfn-local-ruvector-accelerator/src/store_v2_backup.rs +560 -0
  211. package/.claude/skills/cfn-local-ruvector-accelerator/src/store_v2_fixed.rs +0 -0
  212. package/.claude/skills/cfn-local-ruvector-accelerator/src/store_v2_tx.rs +397 -0
  213. package/.claude/skills/cfn-local-ruvector-accelerator/src/test_schema.rs +228 -0
  214. package/.claude/skills/cfn-local-ruvector-accelerator/src/transaction_tests.rs +410 -0
  215. package/.claude/skills/cfn-local-ruvector-accelerator/test_ast_indexing.rs +59 -0
  216. package/.claude/skills/cfn-local-ruvector-accelerator/test_query_api.sh +103 -0
  217. package/.claude/skills/cfn-local-ruvector-accelerator/test_schema.sql +158 -0
  218. package/.claude/skills/cfn-local-ruvector-accelerator/test_schema_v2.sql +147 -0
  219. package/.claude/skills/cfn-mdap-context-injection/SKILL.md +31 -10
  220. package/.claude/skills/cfn-mdap-error-fixer/skill.md +15 -205
  221. package/.claude/skills/cfn-session-handoff/SKILL.md +1 -53
  222. package/.claude/skills/cfn-task-decomposition/SKILL.md +1 -0
  223. package/.claude/skills/cfn-task-intelligence/SKILL.md +39 -18
  224. package/.claude/skills/cfn-task-planning/SKILL.md +37 -12
  225. package/.claude/skills/cfn-validation-framework/SKILL.md +3 -60
  226. package/.claude/skills/cfn-vision-analysis/SKILL.md +3 -20
  227. package/.claude-flow/metrics/performance.json +3 -3
  228. package/.claude-flow/metrics/task-metrics.json +3 -3
  229. package/.ruvector/index_v2.db-shm +0 -0
  230. package/.ruvector/index_v2.db-wal +0 -0
  231. package/CLAUDE.md +9 -1
  232. package/README.md +56 -0
  233. package/docs/AGENT_PRODUCTION_FEEDBACK_PATTERNS.md +389 -0
  234. package/docs/CEREBRAS_TDD_COORDINATOR_TEST_RESULTS.md +213 -0
  235. package/docs/CEREBRAS_TDD_ROUND1_VS_ROUND2_COMPARISON.md +225 -0
  236. package/docs/CEREBRAS_TDD_ROUND3_FINAL_RESULTS.md +264 -0
  237. package/docs/EPIC_CREATOR_V2_ARCHITECTURE.md +629 -0
  238. package/docs/HOOKS_IMPLEMENTATION_PRIORITY.md +585 -0
  239. package/docs/SKILLS_HOOKS_INTEGRATION.md +1074 -0
  240. package/epic-with-personas-2025-12-09-17-15-13.json +253 -0
  241. package/package.json +2 -1
  242. package/test-epic-creator-security.sh +203 -0
  243. package/.claude/skills/cfn-local-ruvector-accelerator/__pycache__/search_engine_v2.cpython-312.pyc +0 -0
  244. package/.claude/skills/cfn-local-ruvector-accelerator/search_engine.py +0 -200
  245. package/jest.config.ts.cjs +0 -17
  246. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-cerebras-code-generator/SKILL.md +0 -0
  247. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-cerebras-code-generator/context-analyzer.sh +0 -0
  248. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-cerebras-code-generator/generate-code.sh +0 -0
  249. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/SKILL.md +0 -0
  250. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/execute.sh +0 -0
  251. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/INTEGRATION.md +0 -0
  252. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/SAMPLE_OUTPUTS.md +0 -0
  253. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/SKILL.md +0 -0
  254. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/capture-container-logs.sh +0 -0
  255. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/enable-logging.sh +0 -0
  256. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/init-hybrid-logging.sh +0 -0
  257. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/queries/analytics-summary.sh +0 -0
  258. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/queries/query-agent-timeline.sh +0 -0
  259. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/queries/query-consensus-history.sh +0 -0
  260. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/queries/query-coordination-timeline.sh +0 -0
  261. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/queries/query-failed-containers.sh +0 -0
  262. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/queries/query-gate-checks.sh +0 -0
  263. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/schema.sql +0 -0
  264. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/sqlite-helpers.sh +0 -0
  265. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/logging/test-hybrid-logging.sh +0 -0
  266. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/mcp/SKILL.md +0 -0
  267. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/mcp/skill-mcp-selector.js +0 -0
  268. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/orchestration/SKILL.md +0 -0
  269. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/orchestration/orchestrate.sh +0 -0
  270. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/spawning/SKILL.md +0 -0
  271. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/spawning/spawn-agent.sh +0 -0
  272. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/waves/SKILL.md +0 -0
  273. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/waves/cleanup-wave.sh +0 -0
  274. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/waves/lib/docker-helpers.sh +0 -0
  275. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/waves/monitor-wave.sh +0 -0
  276. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-docker-runtime/lib/waves/spawn-wave.sh +0 -0
  277. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-node-heap-sizer/SKILL.md +0 -0
  278. /package/.claude/{skills → cfn-extras/skills/deprecated}/cfn-node-heap-sizer/task-mode-heap-limiter.sh +0 -0
  279. /package/.claude/{skills → cfn-extras/skills/deprecated}/deprecated/analyze-patterns.sh +0 -0
  280. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/README.md +0 -0
  281. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/SECURITY.md +0 -0
  282. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/SKILL.md +0 -0
  283. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/package.json +0 -0
  284. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/solve.sh +0 -0
  285. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/test-equation-solver-minimal.sh +0 -0
  286. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/test-equation-solver.sh +0 -0
  287. /package/.claude/{skills → cfn-extras/skills/deprecated}/equation-solver/test.cjs +0 -0
  288. /package/.claude/hooks/{cfn-credential-scanner.sh → deprecated/cfn-credential-scanner.sh} +0 -0
  289. /package/.claude/hooks/{cfn-detect-hardcoded-credentials.sh → deprecated/cfn-detect-hardcoded-credentials.sh} +0 -0
  290. /package/.claude/hooks/{cfn-invoke-post-edit-ts.sh → deprecated/cfn-invoke-post-edit-ts.sh} +0 -0
  291. /package/.claude/hooks/{cfn-invoke-pre-edit-ts.sh → deprecated/cfn-invoke-pre-edit-ts.sh} +0 -0
  292. /package/.claude/hooks/{cfn-invoke-security-validation.sh → deprecated/cfn-invoke-security-validation.sh} +0 -0
  293. /package/.claude/hooks/{cfn-lint-sql-injection.sh → deprecated/cfn-lint-sql-injection.sh} +0 -0
  294. /package/.claude/hooks/{cfn-post-edit.sh → deprecated/cfn-post-edit.sh} +0 -0
  295. /package/.claude/hooks/{cfn-pre-edit-backup.sh → deprecated/cfn-pre-edit-backup.sh} +0 -0
  296. /package/.claude/skills/cfn-local-ruvector-accelerator/{embeddings_manager.py → embeddings_manager.py.backup} +0 -0
  297. /package/{.ruvector → .claude/skills/cfn-local-ruvector-accelerator/index}/index.bin +0 -0
  298. /package/{.ruvector → .claude/skills/cfn-local-ruvector-accelerator/index}/metadata.json +0 -0
  299. /package/.claude/skills/cfn-local-ruvector-accelerator/{search_engine_v2.py → search_engine_v2.py.backup} +0 -0
  300. /package/.claude/skills/cfn-local-ruvector-accelerator/{sqlite_store.py → sqlite_store.py.backup} +0 -0
@@ -0,0 +1,569 @@
1
+ /**
2
+ * TDD Conversation Coordinator (TypeScript)
3
+ *
4
+ * Iterative TDD with Cerebras SDK + conversation memory for self-correction.
5
+ * Reads context file contents and embeds them in prompts.
6
+ *
7
+ * Uses GLM 4.6 best practices:
8
+ * - disable_reasoning: true (skip verbose reasoning for code generation)
9
+ * - temperature: 0.6 (instruction following)
10
+ * - top_p: 0.95
11
+ */
12
+
13
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
14
+ import { dirname, basename, extname, join } from 'path';
15
+ import { execSync } from 'child_process';
16
+ import { fileURLToPath } from 'url';
17
+ import Cerebras from '@cerebras/cerebras_cloud_sdk';
18
+
19
+ // ESM compatibility: Create __dirname equivalent
20
+ const __filename = fileURLToPath(import.meta.url);
21
+ const __dirname = dirname(__filename);
22
+
23
+ // Configuration
24
+ const CEREBRAS_MODEL = process.env.CEREBRAS_MODEL || 'zai-glm-4.6';
25
+
26
+ // Initialize Cerebras client (uses CEREBRAS_API_KEY env var by default)
27
+ const client = new Cerebras({
28
+ warmTCPConnection: true, // Reduces TTFT
29
+ });
30
+
31
+ // Types
32
+ export interface TDDCoordinatorOptions {
33
+ agentId: string;
34
+ feature: string;
35
+ filePath: string;
36
+ contextFiles?: string[];
37
+ testCommand: string;
38
+ maxIterations?: number;
39
+ verbose?: boolean;
40
+ }
41
+
42
+ interface ConversationMessage {
43
+ role: 'system' | 'user' | 'assistant';
44
+ content: string;
45
+ timestamp?: string;
46
+ }
47
+
48
+ export interface TDDResult {
49
+ success: boolean;
50
+ implementationFile: string;
51
+ testFile: string;
52
+ iterations: number;
53
+ conversationId: string;
54
+ error?: string;
55
+ }
56
+
57
+
58
+ export class TDDConversationCoordinator {
59
+ private options: Required<Omit<TDDCoordinatorOptions, 'contextFiles'>> & { contextFiles: string[] };
60
+ private conversation: ConversationMessage[] = [];
61
+ private conversationId: string;
62
+
63
+ constructor(options: TDDCoordinatorOptions) {
64
+ this.options = {
65
+ maxIterations: 5,
66
+ verbose: false,
67
+ contextFiles: [],
68
+ ...options
69
+ };
70
+ this.conversationId = `${options.agentId}-${Date.now()}`;
71
+ this.initConversation();
72
+ }
73
+
74
+ private initConversation(): void {
75
+ this.conversation = [{
76
+ role: 'system',
77
+ content: `You are a TDD expert. Follow Red-Green-Refactor strictly. Use Given/When/Then test structure. Generate ONLY code - no markdown code blocks, no explanations, just raw code.`
78
+ }];
79
+ }
80
+
81
+ private log(message: string): void {
82
+ if (this.options.verbose) {
83
+ console.error(`[${new Date().toISOString()}] ${message}`);
84
+ }
85
+ }
86
+
87
+ private logError(message: string): void {
88
+ console.error(`[ERROR] ${message}`);
89
+ }
90
+
91
+ /**
92
+ * Call Cerebras API with full conversation history
93
+ */
94
+ private async callCerebras(prompt: string): Promise<string> {
95
+ // Add user message to conversation
96
+ this.conversation.push({
97
+ role: 'user',
98
+ content: prompt,
99
+ timestamp: new Date().toISOString()
100
+ });
101
+
102
+ this.log(`Calling Cerebras (${CEREBRAS_MODEL}) with ${this.conversation.length} messages...`);
103
+
104
+ const completion = await client.chat.completions.create({
105
+ model: CEREBRAS_MODEL,
106
+ messages: this.conversation.map(m => ({ role: m.role, content: m.content })),
107
+ max_completion_tokens: 20000,
108
+ temperature: 0.6, // Recommended for instruction following
109
+ top_p: 0.95, // Recommended default
110
+ // @ts-expect-error disable_reasoning is undocumented but supported
111
+ disable_reasoning: true, // Skip verbose reasoning for code generation
112
+ });
113
+
114
+ const content = completion.choices?.[0]?.message?.content;
115
+ if (!content) {
116
+ throw new Error('Empty response from Cerebras API');
117
+ }
118
+
119
+ // Add assistant response to conversation
120
+ this.conversation.push({
121
+ role: 'assistant',
122
+ content,
123
+ timestamp: new Date().toISOString()
124
+ });
125
+
126
+ this.log(`Received response (${content.length} chars)`);
127
+ return content;
128
+ }
129
+
130
+ /**
131
+ * Read context files and return their contents formatted for prompts
132
+ */
133
+ private readContextFiles(): string {
134
+ if (!this.options.contextFiles.length) {
135
+ return '';
136
+ }
137
+
138
+ const sections: string[] = [];
139
+
140
+ for (const filePath of this.options.contextFiles) {
141
+ const trimmedPath = filePath.trim();
142
+ if (!trimmedPath) continue;
143
+
144
+ if (!existsSync(trimmedPath)) {
145
+ this.logError(`Context file not found: ${trimmedPath}`);
146
+ continue;
147
+ }
148
+
149
+ try {
150
+ const content = readFileSync(trimmedPath, 'utf-8');
151
+ this.log(`Loaded context: ${trimmedPath} (${content.length} chars)`);
152
+ sections.push(`## ${trimmedPath}\n\`\`\`\n${content}\n\`\`\``);
153
+ } catch (err) {
154
+ this.logError(`Failed to read ${trimmedPath}: ${err}`);
155
+ }
156
+ }
157
+
158
+ return sections.join('\n\n');
159
+ }
160
+
161
+ /**
162
+ * Determine test file path based on implementation file
163
+ */
164
+ private getTestFilePath(): string {
165
+ const ext = extname(this.options.filePath);
166
+ const base = basename(this.options.filePath, ext);
167
+ const dir = dirname(this.options.filePath);
168
+
169
+ switch (ext) {
170
+ case '.ts':
171
+ case '.tsx':
172
+ return join(dir, `${base}.test.ts`);
173
+ case '.js':
174
+ case '.jsx':
175
+ return join(dir, `${base}.test.js`);
176
+ case '.py':
177
+ return join(dir, `test_${base}.py`);
178
+ case '.go':
179
+ return join(dir, `${base}_test.go`);
180
+ case '.rs':
181
+ return join(dir, `${base}_test.rs`);
182
+ default:
183
+ return join(dir, `${base}.test${ext}`);
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Extract code from response (removes markdown blocks if present)
189
+ */
190
+ private extractCode(content: string): string {
191
+ // Try to extract from markdown code block
192
+ const codeBlockMatch = content.match(/```(?:\w+)?\n([\s\S]*?)```/);
193
+ if (codeBlockMatch) {
194
+ return codeBlockMatch[1].trim();
195
+ }
196
+ // Return as-is if no code block
197
+ return content.trim();
198
+ }
199
+
200
+ /**
201
+ * Run test command and capture output
202
+ */
203
+ private runTests(): { success: boolean; output: string } {
204
+ this.log(`Running: ${this.options.testCommand}`);
205
+
206
+ try {
207
+ // Change to implementation file's directory for test execution
208
+ // This fixes vitest/jest issues with absolute paths
209
+ const workDir = dirname(this.options.filePath);
210
+ this.log(`Working directory: ${workDir}`);
211
+
212
+ const output = execSync(this.options.testCommand, {
213
+ encoding: 'utf-8',
214
+ stdio: ['pipe', 'pipe', 'pipe'],
215
+ timeout: 60000, // 60 second timeout
216
+ cwd: workDir // Run from the directory containing the files
217
+ });
218
+ return { success: true, output };
219
+ } catch (err: unknown) {
220
+ const error = err as { stderr?: string; stdout?: string; message?: string };
221
+ const output = error.stderr || error.stdout || error.message || 'Unknown error';
222
+ return { success: false, output };
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Save conversation to file for learning
228
+ */
229
+ private saveConversation(): void {
230
+ try {
231
+ const dir = join(__dirname, '..', 'conversations');
232
+ mkdirSync(dir, { recursive: true });
233
+
234
+ const date = new Date().toISOString().split('T')[0];
235
+ const file = join(dir, `${date}-${this.options.agentId}.json`);
236
+
237
+ const data = {
238
+ conversationId: this.conversationId,
239
+ metadata: {
240
+ agentId: this.options.agentId,
241
+ feature: this.options.feature,
242
+ filePath: this.options.filePath,
243
+ contextFiles: this.options.contextFiles,
244
+ completedAt: new Date().toISOString()
245
+ },
246
+ conversation: this.conversation
247
+ };
248
+
249
+ writeFileSync(file, JSON.stringify(data, null, 2));
250
+ this.log(`Conversation saved: ${file}`);
251
+ } catch (err) {
252
+ this.logError(`Failed to save conversation: ${err}`);
253
+ }
254
+ }
255
+
256
+ /**
257
+ * Run the full TDD workflow
258
+ */
259
+ async run(): Promise<TDDResult> {
260
+ console.log('🧪 TDD Conversation Coordinator (TypeScript)');
261
+ console.log('='.repeat(50));
262
+ console.log(`Feature: ${this.options.feature}`);
263
+ console.log(`Target File: ${this.options.filePath}`);
264
+ console.log(`Agent ID: ${this.options.agentId}`);
265
+ console.log(`Max Iterations: ${this.options.maxIterations}`);
266
+ console.log(`Test Command: ${this.options.testCommand}`);
267
+ console.log('='.repeat(50));
268
+ console.log();
269
+
270
+ const testFile = this.getTestFilePath();
271
+ const contextContent = this.readContextFiles();
272
+
273
+ // === PHASE 2: Generate tests (RED) ===
274
+ console.log('🔴 Phase 2 (RED): Generating failing tests...');
275
+
276
+ const testPrompt = `# TDD Red Phase: Write Failing Tests
277
+
278
+ ## Feature
279
+ ${this.options.feature}
280
+
281
+ ## Target Implementation File
282
+ ${this.options.filePath}
283
+
284
+ ## Context Files
285
+ ${contextContent || '(none provided)'}
286
+
287
+ ## Requirements
288
+ 1. Write comprehensive tests using STANDARD test framework syntax (do NOT create custom helper functions):
289
+ - **TypeScript/JavaScript**: Use describe/it/expect blocks from vitest or jest
290
+ - Import framework: \`import { describe, it, expect } from 'vitest';\`
291
+ - Import functions: \`import { functionName } from './filename';\`
292
+ - Structure: \`describe('feature', () => { it('should...', () => { expect(...).toBe(...) }) })\`
293
+ - **Python**: Use pytest with def test_* functions
294
+ - Import: \`from filename import ClassName\` or \`import pytest\`
295
+ - Structure: \`def test_feature(): assert value == expected\`
296
+ - **Rust**: Use #[test] attribute or #[cfg(test)] module
297
+ - Import: \`use super::*;\` or \`use crate::module::*;\`
298
+ - Structure: \`#[test] fn test_name() { assert_eq!(result, expected) }\`
299
+ 2. Tests MUST fail initially (no implementation exists yet)
300
+ 3. Cover happy path AND edge cases
301
+ 4. Include setup/teardown if needed
302
+ 5. **CRITICAL: Include ALL necessary import statements at the top of the test file**
303
+ 6. **Do NOT create custom test helper functions (Given/When/Then helpers, etc.)**
304
+
305
+ IMPORTANT: Generate ONLY the test file content. No markdown code blocks, no explanations, just raw code.`;
306
+
307
+ let testCode: string;
308
+ try {
309
+ testCode = this.extractCode(await this.callCerebras(testPrompt));
310
+ } catch (err) {
311
+ return {
312
+ success: false,
313
+ implementationFile: this.options.filePath,
314
+ testFile,
315
+ iterations: 0,
316
+ conversationId: this.conversationId,
317
+ error: `Test generation failed: ${err}`
318
+ };
319
+ }
320
+
321
+ // Write test file
322
+ mkdirSync(dirname(testFile), { recursive: true });
323
+ writeFileSync(testFile, testCode);
324
+ console.log(`📝 Tests written to: ${testFile}`);
325
+
326
+ // === PHASE 4: Generate implementation (GREEN) ===
327
+ console.log('🟢 Phase 4 (GREEN): Generating implementation...');
328
+
329
+ const implPrompt = `# TDD Green Phase: Write Implementation
330
+
331
+ The tests you just wrote are now failing. Write the MINIMUM implementation to make them pass.
332
+
333
+ ## Test File Content
334
+ \`\`\`
335
+ ${testCode}
336
+ \`\`\`
337
+
338
+ ## Target Implementation File
339
+ ${this.options.filePath}
340
+
341
+ ## Requirements
342
+ 1. Implement ONLY what the tests require
343
+ 2. Don't add extra features (YAGNI)
344
+ 3. Make all tests pass
345
+ 4. Follow existing code patterns from context
346
+ 5. **CRITICAL: Export all functions/classes that the tests import**
347
+ 6. **For TypeScript/JavaScript: use \`export function name()\` or \`export { name }\`**
348
+ 7. **For Python: functions are exported by default**
349
+ 8. **For Rust: use \`pub fn name()\` for public functions**
350
+
351
+ IMPORTANT: Generate ONLY the implementation file content. No markdown code blocks, no explanations, just raw code.`;
352
+
353
+ let implCode: string;
354
+ try {
355
+ implCode = this.extractCode(await this.callCerebras(implPrompt));
356
+ } catch (err) {
357
+ return {
358
+ success: false,
359
+ implementationFile: this.options.filePath,
360
+ testFile,
361
+ iterations: 0,
362
+ conversationId: this.conversationId,
363
+ error: `Implementation generation failed: ${err}`
364
+ };
365
+ }
366
+
367
+ // Write implementation file
368
+ mkdirSync(dirname(this.options.filePath), { recursive: true });
369
+ writeFileSync(this.options.filePath, implCode);
370
+ console.log(`📝 Implementation written to: ${this.options.filePath}`);
371
+
372
+ // === PHASE 5-6: Test + Fix Loop ===
373
+ for (let iteration = 1; iteration <= this.options.maxIterations; iteration++) {
374
+ console.log();
375
+ console.log(`--- Iteration ${iteration}/${this.options.maxIterations} ---`);
376
+
377
+ const { success, output } = this.runTests();
378
+
379
+ if (success) {
380
+ console.log('🎉 SUCCESS! All tests pass.');
381
+ this.saveConversation();
382
+
383
+ return {
384
+ success: true,
385
+ implementationFile: this.options.filePath,
386
+ testFile,
387
+ iterations: iteration,
388
+ conversationId: this.conversationId
389
+ };
390
+ }
391
+
392
+ console.log('❌ Tests failed, sending error to Cerebras for fix...');
393
+
394
+ // Detect if error is test-related or implementation-related
395
+ const errorLower = output.toLowerCase();
396
+
397
+ // Implementation issues (assertion failures, logic errors) - check FIRST
398
+ const isImplementationIssue =
399
+ errorLower.includes('expected') || // Assertion: expected X but got Y
400
+ errorLower.includes('assertion') || // Assertion failure
401
+ errorLower.includes('to be') || // expect(x).toBe(y) failures
402
+ errorLower.includes('to equal') || // expect(x).toEqual(y) failures
403
+ errorLower.includes('received') || // Jest: Expected X, Received Y
404
+ errorLower.includes('assert') || // assert failures
405
+ /\d+ (passing|failed)/.test(errorLower); // Test results with failures = impl issue
406
+
407
+ // Test file issues (syntax, imports, missing files) - only if NOT impl issue
408
+ const isTestFileIssue = !isImplementationIssue && (
409
+ errorLower.includes('no test') ||
410
+ errorLower.includes('cannot find test') ||
411
+ errorLower.includes('test file') ||
412
+ errorLower.includes('error: no tests') ||
413
+ errorLower.includes('cannot find module') || // Import errors
414
+ errorLower.includes('is not defined') || // Missing imports
415
+ errorLower.includes('syntaxerror') || // Syntax errors in test
416
+ (errorLower.includes('cannot find') && testFile && errorLower.includes(basename(testFile)))
417
+ );
418
+
419
+ const targetFile = isTestFileIssue ? testFile : this.options.filePath;
420
+ const fileType = isTestFileIssue ? 'TEST' : 'IMPLEMENTATION';
421
+
422
+ console.log(`🔍 Detected ${fileType} file issue, will fix: ${targetFile}`);
423
+
424
+ const fixPrompt = `# Fix Required - Tests Still Failing (Iteration ${iteration})
425
+
426
+ ## Error Output
427
+ \`\`\`
428
+ ${output.slice(0, 2000)}
429
+ \`\`\`
430
+
431
+ ## Target File to Fix
432
+ ${fileType} file: ${targetFile}
433
+
434
+ ## Instructions
435
+ 1. Carefully analyze the error output above
436
+ 2. Review your previous ${fileType.toLowerCase()} in the conversation
437
+ 3. Identify what's wrong (logic error, **missing imports**, missing edge case, incorrect behavior)
438
+ 4. **CRITICAL: If error says "X is not defined" or "cannot find name X":**
439
+ - Check if X exists in the implementation file
440
+ - If YES: Add import statement to the TEST file (not implementation)
441
+ - Example: \`import { X } from './filename';\`
442
+ 5. Fix ONLY the specific issue in the ${fileType} file
443
+ 6. Preserve all working functionality
444
+
445
+ IMPORTANT: Generate the COMPLETE fixed ${fileType} file content for ${basename(targetFile)}. No markdown code blocks, no explanations, just raw code.`;
446
+
447
+ try {
448
+ const fixedCode = this.extractCode(await this.callCerebras(fixPrompt));
449
+ writeFileSync(targetFile, fixedCode);
450
+ console.log(`📝 Fixed ${fileType} written to: ${targetFile}`);
451
+ } catch (err) {
452
+ this.logError(`Fix generation failed: ${err}`);
453
+ }
454
+ }
455
+
456
+ console.log();
457
+ console.log(`❌ Failed after ${this.options.maxIterations} iterations`);
458
+ this.saveConversation();
459
+
460
+ return {
461
+ success: false,
462
+ implementationFile: this.options.filePath,
463
+ testFile,
464
+ iterations: this.options.maxIterations,
465
+ conversationId: this.conversationId,
466
+ error: `Failed after ${this.options.maxIterations} iterations`
467
+ };
468
+ }
469
+ }
470
+
471
+ // === CLI Entry Point ===
472
+ async function main(): Promise<void> {
473
+ const args = process.argv.slice(2);
474
+
475
+ if (args.includes('--help') || args.includes('-h')) {
476
+ console.log(`
477
+ TDD Conversation Coordinator (TypeScript)
478
+
479
+ Usage:
480
+ npx ts-node tdd-conversation-coordinator.ts [options]
481
+
482
+ Required Options:
483
+ --agent-id ID Agent identifier
484
+ --feature DESCRIPTION Feature to implement
485
+ --file-path PATH Target implementation file
486
+ --test-command CMD Command to run tests
487
+
488
+ Optional:
489
+ --context-files FILES Comma-separated context file paths
490
+ --max-iterations N Max fix iterations (default: 5)
491
+ --verbose Enable verbose logging
492
+
493
+ Environment Variables:
494
+ CEREBRAS_API_KEY Cerebras API key (required, auto-loaded by SDK)
495
+ CEREBRAS_MODEL Model name (default: zai-glm-4.6)
496
+
497
+ Example:
498
+ npx ts-node tdd-conversation-coordinator.ts \\
499
+ --agent-id tdd-001 \\
500
+ --feature "Email validator" \\
501
+ --file-path ./src/email.ts \\
502
+ --test-command "npm test email.test.ts" \\
503
+ --context-files "./src/types.ts,./src/utils.ts" \\
504
+ --max-iterations 3 \\
505
+ --verbose
506
+ `);
507
+ process.exit(0);
508
+ }
509
+
510
+ // Parse arguments
511
+ const options: Partial<TDDCoordinatorOptions> = {};
512
+
513
+ for (let i = 0; i < args.length; i++) {
514
+ const arg = args[i];
515
+
516
+ if (arg === '--verbose') {
517
+ options.verbose = true;
518
+ continue;
519
+ }
520
+
521
+ if (arg.startsWith('--') && i + 1 < args.length) {
522
+ const key = arg.slice(2).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
523
+ const value = args[++i];
524
+
525
+ switch (key) {
526
+ case 'agentId':
527
+ options.agentId = value;
528
+ break;
529
+ case 'feature':
530
+ options.feature = value;
531
+ break;
532
+ case 'filePath':
533
+ options.filePath = value;
534
+ break;
535
+ case 'testCommand':
536
+ options.testCommand = value;
537
+ break;
538
+ case 'contextFiles':
539
+ options.contextFiles = value.split(',').map(f => f.trim());
540
+ break;
541
+ case 'maxIterations':
542
+ options.maxIterations = parseInt(value, 10);
543
+ break;
544
+ }
545
+ }
546
+ }
547
+
548
+ // Validate required options
549
+ if (!options.agentId || !options.feature || !options.filePath || !options.testCommand) {
550
+ console.error('Error: Missing required arguments');
551
+ console.error('Run with --help for usage information');
552
+ process.exit(1);
553
+ }
554
+
555
+ // Run coordinator
556
+ const coordinator = new TDDConversationCoordinator(options as TDDCoordinatorOptions);
557
+ const result = await coordinator.run();
558
+
559
+ console.log();
560
+ console.log('Result:');
561
+ console.log(JSON.stringify(result, null, 2));
562
+
563
+ process.exit(result.success ? 0 : 1);
564
+ }
565
+
566
+ main().catch(err => {
567
+ console.error('Fatal error:', err);
568
+ process.exit(1);
569
+ });