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,397 @@
1
+ // Transaction-extended version of store_v2.rs with proper batch transaction management
2
+ use anyhow::{Result, Context, anyhow};
3
+ use rusqlite::{Connection, params, Row, Transaction};
4
+ use std::path::Path;
5
+ use serde::{Serialize, Deserialize};
6
+ use tracing::{info, debug, error, warn};
7
+ use chrono::{DateTime, Utc};
8
+
9
+ use crate::schema_v2::{EntityKind, RefKind, Visibility};
10
+ use crate::search_engine::SearchResult;
11
+
12
+ // Re-export the original structs
13
+ pub use crate::store_v2::{Entity, Reference, TypeUsage, Module, StoreStats, StoreV2};
14
+
15
+ pub struct StoreV2WithTx {
16
+ pub(crate) conn: Connection,
17
+ }
18
+
19
+ impl StoreV2WithTx {
20
+ pub fn new(db_path: &Path) -> Result<Self> {
21
+ let conn = Connection::open(db_path)
22
+ .context("Failed to open database")?;
23
+
24
+ // Performance optimizations
25
+ conn.pragma_update(None, "journal_mode", "WAL")?;
26
+ conn.pragma_update(None, "synchronous", "NORMAL")?;
27
+ conn.pragma_update(None, "cache_size", 10000)?; // 10MB cache
28
+ conn.pragma_update(None, "temp_store", "memory")?;
29
+ conn.pragma_update(None, "mmap_size", 268435456)?; // 256MB memory map
30
+
31
+ Ok(Self { conn })
32
+ }
33
+
34
+ pub fn transaction(&self) -> Result<Transaction> {
35
+ Ok(self.conn.unchecked_transaction()?)
36
+ }
37
+
38
+ // Batch operations with transaction support
39
+ pub fn insert_entities_batch(&self, entities: &[Entity]) -> Result<Vec<i64>> {
40
+ if entities.is_empty() {
41
+ return Ok(Vec::new());
42
+ }
43
+
44
+ debug!("Inserting batch of {} entities", entities.len());
45
+ let tx = self.transaction()
46
+ .context("Failed to start transaction for batch entity insert")?;
47
+
48
+ let mut ids = Vec::with_capacity(entities.len());
49
+
50
+ // Prepare statement once for performance
51
+ {
52
+ let mut stmt = tx.prepare(
53
+ r#"
54
+ INSERT INTO entities (
55
+ kind, name, signature, visibility, parent_id, file_path,
56
+ line_number, column_number, doc_comment, attributes, metadata
57
+ ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11)
58
+ "#
59
+ )?;
60
+
61
+ for entity in entities {
62
+ stmt.execute(params![
63
+ entity.kind.as_str(),
64
+ entity.name,
65
+ entity.signature,
66
+ entity.visibility.as_str(),
67
+ entity.parent_id,
68
+ entity.file_path,
69
+ entity.line_number,
70
+ entity.column_number,
71
+ entity.doc_comment,
72
+ entity.attributes,
73
+ entity.metadata
74
+ ])?;
75
+
76
+ ids.push(tx.last_insert_rowid());
77
+ }
78
+ } // stmt is dropped here, releasing the borrow
79
+
80
+ tx.commit()
81
+ .context("Failed to commit transaction for batch entity insert")?;
82
+
83
+ debug!("Successfully inserted {} entities", ids.len());
84
+ Ok(ids)
85
+ }
86
+
87
+ pub fn insert_references_batch(&self, references: &[Reference]) -> Result<Vec<i64>> {
88
+ if references.is_empty() {
89
+ return Ok(Vec::new());
90
+ }
91
+
92
+ debug!("Inserting batch of {} references", references.len());
93
+ let tx = self.transaction()
94
+ .context("Failed to start transaction for batch reference insert")?;
95
+
96
+ let mut ids = Vec::with_capacity(references.len());
97
+
98
+ // Prepare statement once for performance
99
+ {
100
+ let mut stmt = tx.prepare(
101
+ r#"
102
+ INSERT INTO refs (
103
+ source_entity_id, target_entity_id, ref_kind, file_path,
104
+ line_number, column_number, context
105
+ ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)
106
+ "#
107
+ )?;
108
+
109
+ for reference in references {
110
+ stmt.execute(params![
111
+ reference.source_entity_id,
112
+ reference.target_entity_id,
113
+ reference.ref_kind.as_str(),
114
+ reference.file_path,
115
+ reference.line_number,
116
+ reference.column_number,
117
+ reference.context
118
+ ])?;
119
+
120
+ ids.push(tx.last_insert_rowid());
121
+ }
122
+ } // stmt is dropped here
123
+
124
+ tx.commit()
125
+ .context("Failed to commit transaction for batch reference insert")?;
126
+
127
+ debug!("Successfully inserted {} references", ids.len());
128
+ Ok(ids)
129
+ }
130
+
131
+ pub fn insert_type_usages_batch(&self, type_usages: &[TypeUsage]) -> Result<Vec<i64>> {
132
+ if type_usages.is_empty() {
133
+ return Ok(Vec::new());
134
+ }
135
+
136
+ debug!("Inserting batch of {} type usages", type_usages.len());
137
+ let tx = self.transaction()
138
+ .context("Failed to start transaction for batch type usage insert")?;
139
+
140
+ let mut ids = Vec::with_capacity(type_usages.len());
141
+
142
+ // Prepare statement once for performance
143
+ {
144
+ let mut stmt = tx.prepare(
145
+ r#"
146
+ INSERT INTO type_usage (
147
+ entity_id, type_name, usage_kind, file_path, line_number
148
+ ) VALUES (?1, ?2, ?3, ?4, ?5)
149
+ "#
150
+ )?;
151
+
152
+ for type_usage in type_usages {
153
+ stmt.execute(params![
154
+ type_usage.entity_id,
155
+ type_usage.type_name,
156
+ type_usage.usage_kind,
157
+ type_usage.file_path,
158
+ type_usage.line_number
159
+ ])?;
160
+
161
+ ids.push(tx.last_insert_rowid());
162
+ }
163
+ } // stmt is dropped here
164
+
165
+ tx.commit()
166
+ .context("Failed to commit transaction for batch type usage insert")?;
167
+
168
+ debug!("Successfully inserted {} type usages", ids.len());
169
+ Ok(ids)
170
+ }
171
+
172
+ pub fn store_embeddings_batch(&self, embeddings: &[(i64, &[f32])], model: &str) -> Result<()> {
173
+ if embeddings.is_empty() {
174
+ return Ok(());
175
+ }
176
+
177
+ debug!("Storing batch of {} embeddings", embeddings.len());
178
+ let tx = self.transaction()
179
+ .context("Failed to start transaction for batch embedding store")?;
180
+
181
+ // Prepare statement once for performance
182
+ {
183
+ let mut stmt = tx.prepare(
184
+ "INSERT OR REPLACE INTO entity_embeddings (entity_id, embedding, embedding_model) VALUES (?1, ?2, ?3)"
185
+ )?;
186
+
187
+ for (entity_id, embedding) in embeddings {
188
+ // Serialize embedding to bytes
189
+ let embedding_bytes: Vec<u8> = embedding
190
+ .iter()
191
+ .flat_map(|&v| v.to_le_bytes().to_vec())
192
+ .collect();
193
+
194
+ stmt.execute(params![entity_id, embedding_bytes, model])?;
195
+ }
196
+ } // stmt is dropped here
197
+
198
+ tx.commit()
199
+ .context("Failed to commit transaction for batch embedding store")?;
200
+
201
+ debug!("Successfully stored {} embeddings", embeddings.len());
202
+ Ok(())
203
+ }
204
+
205
+ // Atomic file indexing operations
206
+ pub fn index_file_atomic<F>(&self, file_path: &str, file_hash: &str, f: F) -> Result<()>
207
+ where
208
+ F: FnOnce(&Transaction) -> Result<()>,
209
+ {
210
+ let tx = self.transaction()
211
+ .context("Failed to start transaction for file indexing")?;
212
+
213
+ // Delete existing data for this file
214
+ debug!("Clearing existing data for file: {}", file_path);
215
+ tx.execute("DELETE FROM entities WHERE file_path = ?", [file_path])?;
216
+ tx.execute("DELETE FROM refs WHERE file_path = ?", [file_path])?;
217
+ tx.execute("DELETE FROM type_usage WHERE file_path = ?", [file_path])?;
218
+
219
+ // Execute the indexing operation
220
+ f(&tx)
221
+ .context("Failed to execute indexing operation")?;
222
+
223
+ // Update file hash
224
+ tx.execute(
225
+ "INSERT OR REPLACE INTO file_hashes (file_path, file_hash, indexed_at) VALUES (?1, ?2, ?3)",
226
+ params![
227
+ file_path,
228
+ file_hash,
229
+ Utc::now().timestamp()
230
+ ],
231
+ )?;
232
+
233
+ tx.commit()
234
+ .context("Failed to commit transaction for file indexing")?;
235
+
236
+ debug!("Successfully indexed file: {}", file_path);
237
+ Ok(())
238
+ }
239
+
240
+ // Atomic schema migration with rollback capability
241
+ pub fn migrate_schema_atomic<F>(&self, migration_name: &str, f: F) -> Result<()>
242
+ where
243
+ F: FnOnce(&Transaction) -> Result<()>,
244
+ {
245
+ // Check if migration already applied
246
+ let migration_exists: bool = self.conn.query_row(
247
+ "SELECT 1 FROM schema_migrations WHERE name = ?",
248
+ [migration_name],
249
+ |_| Ok(true)
250
+ ).unwrap_or(false);
251
+
252
+ if migration_exists {
253
+ info!("Migration {} already applied", migration_name);
254
+ return Ok(());
255
+ }
256
+
257
+ let tx = self.transaction()
258
+ .context("Failed to start transaction for migration")?;
259
+
260
+ // Create migrations table if not exists
261
+ tx.execute(
262
+ r#"
263
+ CREATE TABLE IF NOT EXISTS schema_migrations (
264
+ name TEXT PRIMARY KEY,
265
+ applied_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
266
+ )
267
+ "#,
268
+ [],
269
+ )?;
270
+
271
+ // Execute migration
272
+ info!("Applying migration: {}", migration_name);
273
+ f(&tx)
274
+ .with_context(|| format!("Failed to apply migration: {}", migration_name))?;
275
+
276
+ // Mark migration as applied
277
+ tx.execute(
278
+ "INSERT INTO schema_migrations (name) VALUES (?)",
279
+ [migration_name]
280
+ )?;
281
+
282
+ tx.commit()
283
+ .context("Failed to commit migration transaction")?;
284
+
285
+ info!("Successfully applied migration: {}", migration_name);
286
+ Ok(())
287
+ }
288
+
289
+ // Delete all data for a file atomically
290
+ pub fn delete_file_data(&self, file_path: &str) -> Result<()> {
291
+ debug!("Deleting all data for file: {}", file_path);
292
+ let tx = self.transaction()
293
+ .context("Failed to start transaction for file deletion")?;
294
+
295
+ // Delete in order to respect foreign key constraints
296
+ tx.execute("DELETE FROM type_usage WHERE file_path = ?", [file_path])?;
297
+ tx.execute("DELETE FROM refs WHERE file_path = ?", [file_path])?;
298
+ tx.execute("DELETE FROM entities WHERE file_path = ?", [file_path])?;
299
+ tx.execute("DELETE FROM file_hashes WHERE file_path = ?", [file_path])?;
300
+
301
+ tx.commit()
302
+ .context("Failed to commit file deletion transaction")?;
303
+
304
+ debug!("Successfully deleted all data for file: {}", file_path);
305
+ Ok(())
306
+ }
307
+ }
308
+
309
+ #[cfg(test)]
310
+ mod tests {
311
+ use super::*;
312
+ use tempfile::tempdir;
313
+ use crate::schema_v2::SchemaV2;
314
+
315
+ #[test]
316
+ fn test_batch_entity_insertion() -> Result<()> {
317
+ let dir = tempdir()?;
318
+ let db_path = dir.path().join("test_batch.db");
319
+ let conn = Connection::open(&db_path)?;
320
+
321
+ // Initialize schema
322
+ SchemaV2::initialize(&conn)?;
323
+
324
+ let store = StoreV2WithTx::new(&db_path)?;
325
+
326
+ // Create test entities
327
+ let entities: Vec<Entity> = (0..10).map(|i| Entity {
328
+ id: 0,
329
+ kind: EntityKind::Function,
330
+ name: format!("test_function_{}", i),
331
+ signature: Some(format!("fn test_function_{}() -> Result<()>", i)),
332
+ visibility: Visibility::Public,
333
+ parent_id: None,
334
+ file_path: "/test.rs".to_string(),
335
+ line_number: (i * 10) as i64,
336
+ column_number: Some(0),
337
+ doc_comment: None,
338
+ attributes: None,
339
+ metadata: None,
340
+ created_at: Utc::now(),
341
+ updated_at: Utc::now(),
342
+ }).collect();
343
+
344
+ // Insert batch
345
+ let ids = store.insert_entities_batch(&entities)?;
346
+ assert_eq!(ids.len(), 10);
347
+
348
+ // Verify all entities were inserted
349
+ let count: i64 = store.conn.query_row(
350
+ "SELECT COUNT(*) FROM entities WHERE file_path = ?",
351
+ ["/test.rs"],
352
+ |row| row.get(0)
353
+ )?;
354
+
355
+ assert_eq!(count, 10);
356
+
357
+ Ok(())
358
+ }
359
+
360
+ #[test]
361
+ fn test_transaction_rollback() -> Result<()> {
362
+ let dir = tempdir()?;
363
+ let db_path = dir.path().join("test_rollback.db");
364
+ let conn = Connection::open(&db_path)?;
365
+
366
+ // Initialize schema
367
+ SchemaV2::initialize(&conn)?;
368
+
369
+ let store = StoreV2WithTx::new(&db_path)?;
370
+
371
+ // Start a transaction that will fail
372
+ let result = store.conn.unchecked_transaction().and_then(|mut tx| {
373
+ // Insert some data
374
+ tx.execute(
375
+ "INSERT INTO entities (kind, name, file_path, line_number) VALUES (?1, ?2, ?3, ?4)",
376
+ params!["function", "test_func", "/test.rs", 10i64]
377
+ )?;
378
+
379
+ // Simulate an error
380
+ Err(anyhow!("Simulated error"))
381
+ });
382
+
383
+ // Transaction should have rolled back
384
+ assert!(result.is_err());
385
+
386
+ // Verify no data was inserted
387
+ let count: i64 = store.conn.query_row(
388
+ "SELECT COUNT(*) FROM entities",
389
+ [],
390
+ |row| row.get(0)
391
+ )?;
392
+
393
+ assert_eq!(count, 0);
394
+
395
+ Ok(())
396
+ }
397
+ }
@@ -0,0 +1,228 @@
1
+ #[cfg(test)]
2
+ mod tests {
3
+ use super::*;
4
+ use tempfile::tempdir;
5
+ use std::path::PathBuf;
6
+
7
+ #[test]
8
+ fn test_complete_schema_migration() -> anyhow::Result<()> {
9
+ let dir = tempdir()?;
10
+ let db_path = dir.path().join("test_migration.db");
11
+
12
+ // Create a v1 database
13
+ let conn = rusqlite::Connection::open(&db_path)?;
14
+
15
+ // Initialize v1 schema
16
+ conn.execute_batch(
17
+ r#"
18
+ CREATE TABLE embeddings (
19
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
20
+ pattern TEXT NOT NULL UNIQUE,
21
+ embedding BLOB NOT NULL,
22
+ metadata TEXT NOT NULL,
23
+ created_at INTEGER NOT NULL,
24
+ file_hash TEXT NOT NULL
25
+ );
26
+
27
+ CREATE TABLE files (
28
+ path TEXT PRIMARY KEY,
29
+ hash TEXT NOT NULL,
30
+ last_indexed INTEGER NOT NULL,
31
+ patterns_count INTEGER DEFAULT 0
32
+ );
33
+ "#
34
+ )?;
35
+
36
+ // Insert some test data
37
+ let test_embedding = vec![0.1f32; 1536];
38
+ let embedding_bytes: Vec<u8> = test_embedding
39
+ .iter()
40
+ .flat_map(|&v| v.to_le_bytes().to_vec())
41
+ .collect();
42
+
43
+ let test_metadata = serde_json::json!({
44
+ "path": "/test.rs",
45
+ "pattern": "fn test_function() -> Result<()>",
46
+ "line_number": 10,
47
+ "file_hash": "abc123",
48
+ "indexed_at": 1700000000
49
+ });
50
+
51
+ conn.execute(
52
+ "INSERT INTO embeddings (pattern, embedding, metadata, created_at, file_hash) VALUES (?1, ?2, ?3, ?4, ?5)",
53
+ rusqlite::params![
54
+ "fn test_function() -> Result<()>",
55
+ embedding_bytes,
56
+ test_metadata.to_string(),
57
+ 1700000000i64,
58
+ "abc123"
59
+ ]
60
+ )?;
61
+
62
+ conn.execute(
63
+ "INSERT INTO files (path, hash, last_indexed, patterns_count) VALUES (?1, ?2, ?3, ?4)",
64
+ rusqlite::params!["/test.rs", "abc123", 1700000000i64, 1]
65
+ )?;
66
+
67
+ drop(conn);
68
+
69
+ // Now run migration
70
+ let migration_manager = crate::migration::MigrationManager::new(&db_path)?;
71
+ migration_manager.migrate_to_latest()?;
72
+
73
+ // Verify migration
74
+ assert!(migration_manager.validate_migration()?);
75
+ assert_eq!(migration_manager.current_version()?, 2);
76
+
77
+ // Check that data was migrated
78
+ let store = crate::store_v2::StoreV2::new(&db_path)?;
79
+ let entities = store.search_entities("test_function", 10)?;
80
+ assert!(!entities.is_empty());
81
+
82
+ let entity = &entities[0];
83
+ assert_eq!(entity.name, "test_function");
84
+ assert_eq!(entity.kind.as_str(), "function");
85
+
86
+ // Check embedding was migrated
87
+ let embedding = store.get_embedding(entity.id)?;
88
+ assert!(embedding.is_some());
89
+ assert_eq!(embedding.unwrap().len(), 1536);
90
+
91
+ Ok(())
92
+ }
93
+
94
+ #[test]
95
+ fn test_performance_lookups() -> anyhow::Result<()> {
96
+ let dir = tempdir()?;
97
+ let db_path = dir.path().join("test_perf.db");
98
+
99
+ // Initialize with v2 schema
100
+ let conn = rusqlite::Connection::open(&db_path)?;
101
+ crate::schema_v2::SchemaV2::initialize(&conn)?;
102
+ drop(conn);
103
+
104
+ let store = crate::store_v2::StoreV2::new(&db_path)?;
105
+
106
+ // Insert test entities
107
+ let start = std::time::Instant::now();
108
+ for i in 0..1000 {
109
+ let entity = crate::store_v2::Entity {
110
+ id: 0,
111
+ kind: crate::schema_v2::EntityKind::Function,
112
+ name: format!("function_{}", i),
113
+ signature: Some(format!("fn function_{}() -> Result<()>", i)),
114
+ visibility: crate::schema_v2::Visibility::Public,
115
+ parent_id: None,
116
+ file_path: format!("/src/file_{}.rs", i % 10),
117
+ line_number: i as i64,
118
+ column_number: Some(0),
119
+ doc_comment: None,
120
+ attributes: None,
121
+ metadata: None,
122
+ created_at: chrono::Utc::now(),
123
+ updated_at: chrono::Utc::now(),
124
+ };
125
+
126
+ store.insert_entity(&entity)?;
127
+ }
128
+ let insert_time = start.elapsed();
129
+ println!("Inserted 1000 entities in {:?}", insert_time);
130
+
131
+ // Test lookup performance
132
+ let start = std::time::Instant::now();
133
+ let entity = store.find_entities_by_name("function_500", 1)?;
134
+ let lookup_time = start.elapsed();
135
+ println!("Found entity by name in {:?}", lookup_time);
136
+ assert!(!entity.is_empty());
137
+
138
+ // Test type search performance
139
+ let start = std::time::Instant::now();
140
+ let functions = store.find_entities_by_kind(crate::schema_v2::EntityKind::Function, 100)?;
141
+ let search_time = start.elapsed();
142
+ println!("Found 100 functions in {:?}", search_time);
143
+ assert_eq!(functions.len(), 100);
144
+
145
+ // Verify performance targets
146
+ assert!(lookup_time.as_millis() < 10, "Name lookup should be < 10ms");
147
+ assert!(search_time.as_millis() < 10, "Type search should be < 10ms");
148
+
149
+ Ok(())
150
+ }
151
+
152
+ #[test]
153
+ fn test_reference_tracking() -> anyhow::Result<()> {
154
+ let dir = tempdir()?;
155
+ let db_path = dir.path().join("test_refs.db");
156
+
157
+ let conn = rusqlite::Connection::open(&db_path)?;
158
+ crate::schema_v2::SchemaV2::initialize(&conn)?;
159
+ drop(conn);
160
+
161
+ let store = crate::store_v2::StoreV2::new(&db_path)?;
162
+
163
+ // Create test entities
164
+ let mut caller = crate::store_v2::Entity {
165
+ id: 0,
166
+ kind: crate::schema_v2::EntityKind::Function,
167
+ name: "caller".to_string(),
168
+ signature: Some("fn caller()".to_string()),
169
+ visibility: crate::schema_v2::Visibility::Public,
170
+ parent_id: None,
171
+ file_path: "/src/caller.rs".to_string(),
172
+ line_number: 10,
173
+ column_number: Some(0),
174
+ doc_comment: None,
175
+ attributes: None,
176
+ metadata: None,
177
+ created_at: chrono::Utc::now(),
178
+ updated_at: chrono::Utc::now(),
179
+ };
180
+
181
+ let mut callee = crate::store_v2::Entity {
182
+ id: 0,
183
+ kind: crate::schema_v2::EntityKind::Function,
184
+ name: "callee".to_string(),
185
+ signature: Some("fn callee()".to_string()),
186
+ visibility: crate::schema_v2::Visibility::Public,
187
+ parent_id: None,
188
+ file_path: "/src/callee.rs".to_string(),
189
+ line_number: 20,
190
+ column_number: Some(0),
191
+ doc_comment: None,
192
+ attributes: None,
193
+ metadata: None,
194
+ created_at: chrono::Utc::now(),
195
+ updated_at: chrono::Utc::now(),
196
+ };
197
+
198
+ // Insert entities
199
+ let caller_id = store.insert_entity(&caller)?;
200
+ let callee_id = store.insert_entity(&callee)?;
201
+
202
+ // Create a reference
203
+ let reference = crate::store_v2::Reference {
204
+ id: 0,
205
+ source_entity_id: caller_id,
206
+ target_entity_id: callee_id,
207
+ ref_kind: crate::schema_v2::RefKind::Call,
208
+ file_path: "/src/caller.rs".to_string(),
209
+ line_number: 12,
210
+ column_number: Some(5),
211
+ context: Some("callee()".to_string()),
212
+ created_at: chrono::Utc::now(),
213
+ };
214
+
215
+ store.insert_reference(&reference)?;
216
+
217
+ // Test reference lookups
218
+ let refs_to_callee = store.find_references_to_entity(callee_id)?;
219
+ assert_eq!(refs_to_callee.len(), 1);
220
+ assert_eq!(refs_to_callee[0].source_entity_id, caller_id);
221
+
222
+ let refs_from_caller = store.find_references_from_entity(caller_id)?;
223
+ assert_eq!(refs_from_caller.len(), 1);
224
+ assert_eq!(refs_from_caller[0].target_entity_id, callee_id);
225
+
226
+ Ok(())
227
+ }
228
+ }