bluera-knowledge 0.14.0 → 0.14.2

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 (659) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/dist/{chunk-AIS5S77C.js → chunk-X7E4RYJE.js} +51 -9
  4. package/dist/{chunk-AIS5S77C.js.map → chunk-X7E4RYJE.js.map} +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/workers/background-worker-cli.js +1 -1
  7. package/package.json +12 -1
  8. package/.claude/commands/code-review.md +0 -15
  9. package/.claude/commands/commit.md +0 -34
  10. package/.claude/council-cache/1a43ed5977b8f29afc79a9bf5c4082ee5ad8338c42ab991a4241a48f80c1e46d.json +0 -7
  11. package/.claude/hooks/post-edit-check.sh +0 -40
  12. package/.claude/rules/code-quality.md +0 -12
  13. package/.claude/rules/git.md +0 -5
  14. package/.claude/rules/versioning.md +0 -7
  15. package/.claude/settings.local.json.example +0 -45
  16. package/.claude/skills/atomic-commits/SKILL.md +0 -61
  17. package/.claude/skills/code-review-repo/skill.md +0 -62
  18. package/.editorconfig +0 -15
  19. package/.env.example +0 -21
  20. package/.github/workflows/auto-release.yml +0 -64
  21. package/.github/workflows/ci.yml +0 -168
  22. package/.github/workflows/release.yml +0 -74
  23. package/.github/workflows/update-marketplace.yml +0 -96
  24. package/.husky/pre-commit +0 -48
  25. package/.husky/pre-push +0 -39
  26. package/.mcp.json +0 -11
  27. package/.prettierrc +0 -9
  28. package/.versionrc.json +0 -24
  29. package/CLAUDE.md +0 -110
  30. package/CONTRIBUTING.md +0 -307
  31. package/NOTICE +0 -47
  32. package/SECURITY.md +0 -65
  33. package/bun.lock +0 -2036
  34. package/docs/claude-code-best-practices.md +0 -458
  35. package/docs/cli.md +0 -170
  36. package/docs/commands.md +0 -392
  37. package/docs/crawler-architecture.md +0 -89
  38. package/docs/mcp-integration.md +0 -130
  39. package/docs/token-efficiency.md +0 -91
  40. package/eslint-rules/require-skip-comment.js +0 -81
  41. package/eslint.config.js +0 -103
  42. package/knip.json +0 -43
  43. package/scripts/test-mcp-dev.js +0 -260
  44. package/scripts/validate-npm-release.sh +0 -314
  45. package/src/analysis/adapter-registry.test.ts +0 -211
  46. package/src/analysis/adapter-registry.ts +0 -155
  47. package/src/analysis/ast-parser.test.ts +0 -470
  48. package/src/analysis/ast-parser.ts +0 -198
  49. package/src/analysis/code-graph.test.ts +0 -718
  50. package/src/analysis/code-graph.ts +0 -249
  51. package/src/analysis/dependency-usage-analyzer.test.ts +0 -619
  52. package/src/analysis/dependency-usage-analyzer.ts +0 -433
  53. package/src/analysis/go-ast-parser.test.ts +0 -531
  54. package/src/analysis/go-ast-parser.ts +0 -471
  55. package/src/analysis/language-adapter.ts +0 -127
  56. package/src/analysis/parser-factory.test.ts +0 -210
  57. package/src/analysis/parser-factory.ts +0 -52
  58. package/src/analysis/python-ast-parser.test.ts +0 -210
  59. package/src/analysis/python-ast-parser.ts +0 -34
  60. package/src/analysis/repo-url-resolver.test.ts +0 -533
  61. package/src/analysis/repo-url-resolver.ts +0 -233
  62. package/src/analysis/rust-ast-parser.test.ts +0 -568
  63. package/src/analysis/rust-ast-parser.ts +0 -467
  64. package/src/analysis/tree-sitter-parser.test.ts +0 -297
  65. package/src/analysis/tree-sitter-parser.ts +0 -217
  66. package/src/analysis/zil/index.ts +0 -34
  67. package/src/analysis/zil/zil-adapter.test.ts +0 -187
  68. package/src/analysis/zil/zil-adapter.ts +0 -121
  69. package/src/analysis/zil/zil-lexer.test.ts +0 -222
  70. package/src/analysis/zil/zil-lexer.ts +0 -239
  71. package/src/analysis/zil/zil-parser.test.ts +0 -210
  72. package/src/analysis/zil/zil-parser.ts +0 -360
  73. package/src/analysis/zil/zil-special-forms.ts +0 -193
  74. package/src/cli/commands/crawl.test.ts +0 -1086
  75. package/src/cli/commands/crawl.ts +0 -220
  76. package/src/cli/commands/index-cmd.test.ts +0 -733
  77. package/src/cli/commands/index-cmd.ts +0 -128
  78. package/src/cli/commands/mcp.test.ts +0 -218
  79. package/src/cli/commands/mcp.ts +0 -18
  80. package/src/cli/commands/plugin-api.test.ts +0 -373
  81. package/src/cli/commands/plugin-api.ts +0 -82
  82. package/src/cli/commands/search.test.ts +0 -1047
  83. package/src/cli/commands/search.ts +0 -197
  84. package/src/cli/commands/serve.test.ts +0 -371
  85. package/src/cli/commands/serve.ts +0 -43
  86. package/src/cli/commands/setup.test.ts +0 -895
  87. package/src/cli/commands/setup.ts +0 -176
  88. package/src/cli/commands/store.test.ts +0 -1370
  89. package/src/cli/commands/store.ts +0 -229
  90. package/src/cli/commands/sync.test.ts +0 -54
  91. package/src/cli/commands/sync.ts +0 -313
  92. package/src/cli/index.ts +0 -8
  93. package/src/cli/program.ts +0 -59
  94. package/src/crawl/article-converter.test.ts +0 -576
  95. package/src/crawl/article-converter.ts +0 -142
  96. package/src/crawl/bridge.test.ts +0 -796
  97. package/src/crawl/bridge.ts +0 -349
  98. package/src/crawl/claude-client.test.ts +0 -902
  99. package/src/crawl/claude-client.ts +0 -261
  100. package/src/crawl/intelligent-crawler.test.ts +0 -1028
  101. package/src/crawl/intelligent-crawler.ts +0 -478
  102. package/src/crawl/markdown-utils.test.ts +0 -703
  103. package/src/crawl/markdown-utils.ts +0 -225
  104. package/src/crawl/schemas.ts +0 -114
  105. package/src/db/embeddings.test.ts +0 -79
  106. package/src/db/embeddings.ts +0 -78
  107. package/src/db/index.ts +0 -2
  108. package/src/db/lance.test.ts +0 -479
  109. package/src/db/lance.ts +0 -190
  110. package/src/defaults/repos.ts +0 -67
  111. package/src/index.ts +0 -124
  112. package/src/logging/index.ts +0 -25
  113. package/src/logging/logger.test.ts +0 -75
  114. package/src/logging/logger.ts +0 -145
  115. package/src/logging/payload.test.ts +0 -152
  116. package/src/logging/payload.ts +0 -119
  117. package/src/mcp/cache.test.ts +0 -202
  118. package/src/mcp/cache.ts +0 -103
  119. package/src/mcp/commands/index.ts +0 -24
  120. package/src/mcp/commands/job.commands.ts +0 -48
  121. package/src/mcp/commands/meta.commands.ts +0 -54
  122. package/src/mcp/commands/registry.ts +0 -180
  123. package/src/mcp/commands/store.commands.ts +0 -75
  124. package/src/mcp/commands/sync.commands.test.ts +0 -371
  125. package/src/mcp/commands/sync.commands.ts +0 -263
  126. package/src/mcp/commands/uninstall.commands.test.ts +0 -37
  127. package/src/mcp/commands/uninstall.commands.ts +0 -29
  128. package/src/mcp/handlers/execute.handler.test.ts +0 -179
  129. package/src/mcp/handlers/execute.handler.ts +0 -23
  130. package/src/mcp/handlers/index.ts +0 -39
  131. package/src/mcp/handlers/job.handler.test.ts +0 -189
  132. package/src/mcp/handlers/job.handler.ts +0 -118
  133. package/src/mcp/handlers/search.handler.test.ts +0 -324
  134. package/src/mcp/handlers/search.handler.ts +0 -287
  135. package/src/mcp/handlers/store.handler.test.ts +0 -408
  136. package/src/mcp/handlers/store.handler.ts +0 -318
  137. package/src/mcp/handlers/uninstall.handler.test.ts +0 -194
  138. package/src/mcp/handlers/uninstall.handler.ts +0 -142
  139. package/src/mcp/plugin-mcp-config.test.ts +0 -71
  140. package/src/mcp/schemas/index.test.ts +0 -356
  141. package/src/mcp/schemas/index.ts +0 -155
  142. package/src/mcp/server.test.ts +0 -91
  143. package/src/mcp/server.ts +0 -235
  144. package/src/mcp/types.ts +0 -41
  145. package/src/plugin/commands.test.ts +0 -925
  146. package/src/plugin/commands.ts +0 -311
  147. package/src/plugin/dependency-analyzer.test.ts +0 -380
  148. package/src/plugin/dependency-analyzer.ts +0 -210
  149. package/src/plugin/git-clone.test.ts +0 -387
  150. package/src/plugin/git-clone.ts +0 -57
  151. package/src/scripts/validate-npm-release.test.ts +0 -70
  152. package/src/server/app.test.ts +0 -752
  153. package/src/server/app.ts +0 -128
  154. package/src/server/index.test.ts +0 -475
  155. package/src/server/index.ts +0 -1
  156. package/src/services/chunking.service.test.ts +0 -363
  157. package/src/services/chunking.service.ts +0 -380
  158. package/src/services/code-graph.service.test.ts +0 -298
  159. package/src/services/code-graph.service.ts +0 -326
  160. package/src/services/code-unit.service.test.ts +0 -693
  161. package/src/services/code-unit.service.ts +0 -234
  162. package/src/services/config.service.test.ts +0 -146
  163. package/src/services/config.service.ts +0 -92
  164. package/src/services/gitignore.service.test.ts +0 -157
  165. package/src/services/gitignore.service.ts +0 -132
  166. package/src/services/index.service.test.ts +0 -2301
  167. package/src/services/index.service.ts +0 -442
  168. package/src/services/index.ts +0 -119
  169. package/src/services/job.service.test.ts +0 -531
  170. package/src/services/job.service.ts +0 -298
  171. package/src/services/project-root.service.test.ts +0 -504
  172. package/src/services/project-root.service.ts +0 -112
  173. package/src/services/search.service.test.ts +0 -2263
  174. package/src/services/search.service.ts +0 -1341
  175. package/src/services/services.test.ts +0 -108
  176. package/src/services/snippet.service.test.ts +0 -213
  177. package/src/services/snippet.service.ts +0 -193
  178. package/src/services/store-definition.service.test.ts +0 -440
  179. package/src/services/store-definition.service.ts +0 -198
  180. package/src/services/store.service.test.ts +0 -843
  181. package/src/services/store.service.ts +0 -363
  182. package/src/services/token.service.test.ts +0 -45
  183. package/src/services/token.service.ts +0 -33
  184. package/src/services/watch.service.test.ts +0 -600
  185. package/src/services/watch.service.ts +0 -84
  186. package/src/types/brands.test.ts +0 -47
  187. package/src/types/brands.ts +0 -32
  188. package/src/types/config.ts +0 -79
  189. package/src/types/document.ts +0 -54
  190. package/src/types/index.ts +0 -73
  191. package/src/types/job.ts +0 -61
  192. package/src/types/progress.ts +0 -9
  193. package/src/types/result.test.ts +0 -54
  194. package/src/types/result.ts +0 -41
  195. package/src/types/search.ts +0 -105
  196. package/src/types/store-definition.test.ts +0 -492
  197. package/src/types/store-definition.ts +0 -129
  198. package/src/types/store.test.ts +0 -69
  199. package/src/types/store.ts +0 -47
  200. package/src/utils/type-guards.test.ts +0 -351
  201. package/src/utils/type-guards.ts +0 -61
  202. package/src/workers/background-worker-cli.test.ts +0 -35
  203. package/src/workers/background-worker-cli.ts +0 -149
  204. package/src/workers/background-worker.test.ts +0 -222
  205. package/src/workers/background-worker.ts +0 -322
  206. package/src/workers/pid-file.test.ts +0 -167
  207. package/src/workers/pid-file.ts +0 -82
  208. package/src/workers/spawn-worker.test.ts +0 -194
  209. package/src/workers/spawn-worker.ts +0 -70
  210. package/tests/analysis/ast-parser.test.ts +0 -98
  211. package/tests/analysis/code-graph.test.ts +0 -60
  212. package/tests/fixtures/README.md +0 -114
  213. package/tests/fixtures/code-snippets/api/error-handling.ts +0 -256
  214. package/tests/fixtures/code-snippets/api/rest-controller.ts +0 -297
  215. package/tests/fixtures/code-snippets/auth/jwt-auth.ts +0 -197
  216. package/tests/fixtures/code-snippets/auth/oauth-flow.ts +0 -245
  217. package/tests/fixtures/code-snippets/database/repository-pattern.ts +0 -280
  218. package/tests/fixtures/corpus/VERSION.md +0 -25
  219. package/tests/fixtures/corpus/articles/jwt-authentication.md +0 -97
  220. package/tests/fixtures/corpus/articles/react-hooks-patterns.md +0 -127
  221. package/tests/fixtures/corpus/articles/typescript-generics.md +0 -111
  222. package/tests/fixtures/corpus/documentation/express-middleware.md +0 -71
  223. package/tests/fixtures/corpus/documentation/express-routing.md +0 -83
  224. package/tests/fixtures/corpus/documentation/node-streams.md +0 -78
  225. package/tests/fixtures/corpus/oss-repos/express/History.md +0 -3871
  226. package/tests/fixtures/corpus/oss-repos/express/LICENSE +0 -24
  227. package/tests/fixtures/corpus/oss-repos/express/README.md +0 -276
  228. package/tests/fixtures/corpus/oss-repos/express/SECURITY.md +0 -56
  229. package/tests/fixtures/corpus/oss-repos/express/benchmarks/Makefile +0 -17
  230. package/tests/fixtures/corpus/oss-repos/express/benchmarks/README.md +0 -34
  231. package/tests/fixtures/corpus/oss-repos/express/benchmarks/middleware.js +0 -20
  232. package/tests/fixtures/corpus/oss-repos/express/benchmarks/run +0 -18
  233. package/tests/fixtures/corpus/oss-repos/express/examples/README.md +0 -29
  234. package/tests/fixtures/corpus/oss-repos/express/examples/auth/index.js +0 -134
  235. package/tests/fixtures/corpus/oss-repos/express/examples/auth/views/foot.ejs +0 -2
  236. package/tests/fixtures/corpus/oss-repos/express/examples/auth/views/head.ejs +0 -20
  237. package/tests/fixtures/corpus/oss-repos/express/examples/auth/views/login.ejs +0 -21
  238. package/tests/fixtures/corpus/oss-repos/express/examples/content-negotiation/db.js +0 -9
  239. package/tests/fixtures/corpus/oss-repos/express/examples/content-negotiation/index.js +0 -46
  240. package/tests/fixtures/corpus/oss-repos/express/examples/content-negotiation/users.js +0 -19
  241. package/tests/fixtures/corpus/oss-repos/express/examples/cookie-sessions/index.js +0 -25
  242. package/tests/fixtures/corpus/oss-repos/express/examples/cookies/index.js +0 -53
  243. package/tests/fixtures/corpus/oss-repos/express/examples/downloads/files/CCTV/345/244/247/350/265/233/344/270/212/346/265/267/345/210/206/350/265/233/345/214/272.txt +0 -2
  244. package/tests/fixtures/corpus/oss-repos/express/examples/downloads/files/amazing.txt +0 -1
  245. package/tests/fixtures/corpus/oss-repos/express/examples/downloads/files/notes/groceries.txt +0 -3
  246. package/tests/fixtures/corpus/oss-repos/express/examples/downloads/index.js +0 -40
  247. package/tests/fixtures/corpus/oss-repos/express/examples/ejs/index.js +0 -57
  248. package/tests/fixtures/corpus/oss-repos/express/examples/ejs/public/stylesheets/style.css +0 -4
  249. package/tests/fixtures/corpus/oss-repos/express/examples/ejs/views/footer.html +0 -2
  250. package/tests/fixtures/corpus/oss-repos/express/examples/ejs/views/header.html +0 -9
  251. package/tests/fixtures/corpus/oss-repos/express/examples/ejs/views/users.html +0 -10
  252. package/tests/fixtures/corpus/oss-repos/express/examples/error/index.js +0 -53
  253. package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/index.js +0 -103
  254. package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/404.ejs +0 -3
  255. package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/500.ejs +0 -8
  256. package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/error_header.ejs +0 -10
  257. package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/footer.ejs +0 -2
  258. package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/index.ejs +0 -20
  259. package/tests/fixtures/corpus/oss-repos/express/examples/hello-world/index.js +0 -15
  260. package/tests/fixtures/corpus/oss-repos/express/examples/markdown/index.js +0 -44
  261. package/tests/fixtures/corpus/oss-repos/express/examples/markdown/views/index.md +0 -4
  262. package/tests/fixtures/corpus/oss-repos/express/examples/multi-router/controllers/api_v1.js +0 -15
  263. package/tests/fixtures/corpus/oss-repos/express/examples/multi-router/controllers/api_v2.js +0 -15
  264. package/tests/fixtures/corpus/oss-repos/express/examples/multi-router/index.js +0 -18
  265. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/main/index.js +0 -5
  266. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/pet/index.js +0 -31
  267. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/pet/views/edit.ejs +0 -17
  268. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/pet/views/show.ejs +0 -15
  269. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/index.js +0 -41
  270. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/views/edit.hbs +0 -27
  271. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/views/list.hbs +0 -18
  272. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/views/show.hbs +0 -31
  273. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user-pet/index.js +0 -22
  274. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/db.js +0 -16
  275. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/index.js +0 -95
  276. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/lib/boot.js +0 -83
  277. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/public/style.css +0 -14
  278. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/views/404.ejs +0 -13
  279. package/tests/fixtures/corpus/oss-repos/express/examples/mvc/views/5xx.ejs +0 -13
  280. package/tests/fixtures/corpus/oss-repos/express/examples/online/index.js +0 -61
  281. package/tests/fixtures/corpus/oss-repos/express/examples/params/index.js +0 -74
  282. package/tests/fixtures/corpus/oss-repos/express/examples/resource/index.js +0 -95
  283. package/tests/fixtures/corpus/oss-repos/express/examples/route-map/index.js +0 -75
  284. package/tests/fixtures/corpus/oss-repos/express/examples/route-middleware/index.js +0 -90
  285. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/index.js +0 -55
  286. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/post.js +0 -13
  287. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/public/style.css +0 -24
  288. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/site.js +0 -5
  289. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/user.js +0 -47
  290. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/footer.ejs +0 -2
  291. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/header.ejs +0 -9
  292. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/index.ejs +0 -10
  293. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/posts/index.ejs +0 -12
  294. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/users/edit.ejs +0 -23
  295. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/users/index.ejs +0 -14
  296. package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/users/view.ejs +0 -9
  297. package/tests/fixtures/corpus/oss-repos/express/examples/search/index.js +0 -61
  298. package/tests/fixtures/corpus/oss-repos/express/examples/search/public/client.js +0 -15
  299. package/tests/fixtures/corpus/oss-repos/express/examples/search/public/index.html +0 -21
  300. package/tests/fixtures/corpus/oss-repos/express/examples/session/index.js +0 -37
  301. package/tests/fixtures/corpus/oss-repos/express/examples/session/redis.js +0 -39
  302. package/tests/fixtures/corpus/oss-repos/express/examples/static-files/index.js +0 -43
  303. package/tests/fixtures/corpus/oss-repos/express/examples/static-files/public/css/style.css +0 -3
  304. package/tests/fixtures/corpus/oss-repos/express/examples/static-files/public/hello.txt +0 -1
  305. package/tests/fixtures/corpus/oss-repos/express/examples/static-files/public/js/app.js +0 -1
  306. package/tests/fixtures/corpus/oss-repos/express/examples/vhost/index.js +0 -53
  307. package/tests/fixtures/corpus/oss-repos/express/examples/view-constructor/github-view.js +0 -53
  308. package/tests/fixtures/corpus/oss-repos/express/examples/view-constructor/index.js +0 -48
  309. package/tests/fixtures/corpus/oss-repos/express/examples/view-locals/index.js +0 -155
  310. package/tests/fixtures/corpus/oss-repos/express/examples/view-locals/user.js +0 -36
  311. package/tests/fixtures/corpus/oss-repos/express/examples/view-locals/views/index.ejs +0 -20
  312. package/tests/fixtures/corpus/oss-repos/express/examples/web-service/index.js +0 -117
  313. package/tests/fixtures/corpus/oss-repos/express/index.js +0 -11
  314. package/tests/fixtures/corpus/oss-repos/express/lib/application.js +0 -631
  315. package/tests/fixtures/corpus/oss-repos/express/lib/express.js +0 -81
  316. package/tests/fixtures/corpus/oss-repos/express/lib/request.js +0 -514
  317. package/tests/fixtures/corpus/oss-repos/express/lib/response.js +0 -1053
  318. package/tests/fixtures/corpus/oss-repos/express/lib/utils.js +0 -271
  319. package/tests/fixtures/corpus/oss-repos/express/lib/view.js +0 -205
  320. package/tests/fixtures/corpus/oss-repos/express/package.json +0 -99
  321. package/tests/fixtures/corpus/oss-repos/express/test/Route.js +0 -274
  322. package/tests/fixtures/corpus/oss-repos/express/test/Router.js +0 -636
  323. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/auth.js +0 -117
  324. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/content-negotiation.js +0 -49
  325. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/cookie-sessions.js +0 -38
  326. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/cookies.js +0 -71
  327. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/downloads.js +0 -47
  328. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/ejs.js +0 -17
  329. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/error-pages.js +0 -99
  330. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/error.js +0 -29
  331. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/hello-world.js +0 -21
  332. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/markdown.js +0 -21
  333. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/multi-router.js +0 -44
  334. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/mvc.js +0 -132
  335. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/params.js +0 -44
  336. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/resource.js +0 -68
  337. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/route-map.js +0 -45
  338. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/route-separation.js +0 -97
  339. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/vhost.js +0 -46
  340. package/tests/fixtures/corpus/oss-repos/express/test/acceptance/web-service.js +0 -105
  341. package/tests/fixtures/corpus/oss-repos/express/test/app.all.js +0 -38
  342. package/tests/fixtures/corpus/oss-repos/express/test/app.engine.js +0 -83
  343. package/tests/fixtures/corpus/oss-repos/express/test/app.head.js +0 -66
  344. package/tests/fixtures/corpus/oss-repos/express/test/app.js +0 -120
  345. package/tests/fixtures/corpus/oss-repos/express/test/app.listen.js +0 -55
  346. package/tests/fixtures/corpus/oss-repos/express/test/app.locals.js +0 -26
  347. package/tests/fixtures/corpus/oss-repos/express/test/app.options.js +0 -116
  348. package/tests/fixtures/corpus/oss-repos/express/test/app.param.js +0 -323
  349. package/tests/fixtures/corpus/oss-repos/express/test/app.render.js +0 -374
  350. package/tests/fixtures/corpus/oss-repos/express/test/app.request.js +0 -143
  351. package/tests/fixtures/corpus/oss-repos/express/test/app.response.js +0 -143
  352. package/tests/fixtures/corpus/oss-repos/express/test/app.route.js +0 -197
  353. package/tests/fixtures/corpus/oss-repos/express/test/app.router.js +0 -1217
  354. package/tests/fixtures/corpus/oss-repos/express/test/app.routes.error.js +0 -62
  355. package/tests/fixtures/corpus/oss-repos/express/test/app.use.js +0 -542
  356. package/tests/fixtures/corpus/oss-repos/express/test/config.js +0 -207
  357. package/tests/fixtures/corpus/oss-repos/express/test/exports.js +0 -82
  358. package/tests/fixtures/corpus/oss-repos/express/test/express.json.js +0 -755
  359. package/tests/fixtures/corpus/oss-repos/express/test/express.raw.js +0 -513
  360. package/tests/fixtures/corpus/oss-repos/express/test/express.static.js +0 -815
  361. package/tests/fixtures/corpus/oss-repos/express/test/express.text.js +0 -566
  362. package/tests/fixtures/corpus/oss-repos/express/test/express.urlencoded.js +0 -828
  363. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/% of dogs.txt +0 -1
  364. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/.name +0 -1
  365. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/blog/index.html +0 -1
  366. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/blog/post/index.tmpl +0 -1
  367. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/broken.send +0 -0
  368. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/default_layout/name.tmpl +0 -1
  369. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/default_layout/user.tmpl +0 -1
  370. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/email.tmpl +0 -1
  371. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/empty.txt +0 -0
  372. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/local_layout/user.tmpl +0 -1
  373. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/name.tmpl +0 -1
  374. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/name.txt +0 -1
  375. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/nums.txt +0 -1
  376. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/pets/names.txt +0 -1
  377. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/snow /342/230/203/.gitkeep +0 -0
  378. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/todo.html +0 -1
  379. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/todo.txt +0 -1
  380. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/user.html +0 -1
  381. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/user.tmpl +0 -1
  382. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/users/index.html +0 -1
  383. package/tests/fixtures/corpus/oss-repos/express/test/fixtures/users/tobi.txt +0 -1
  384. package/tests/fixtures/corpus/oss-repos/express/test/middleware.basic.js +0 -42
  385. package/tests/fixtures/corpus/oss-repos/express/test/regression.js +0 -20
  386. package/tests/fixtures/corpus/oss-repos/express/test/req.accepts.js +0 -125
  387. package/tests/fixtures/corpus/oss-repos/express/test/req.acceptsCharsets.js +0 -50
  388. package/tests/fixtures/corpus/oss-repos/express/test/req.acceptsEncodings.js +0 -39
  389. package/tests/fixtures/corpus/oss-repos/express/test/req.acceptsLanguages.js +0 -57
  390. package/tests/fixtures/corpus/oss-repos/express/test/req.baseUrl.js +0 -88
  391. package/tests/fixtures/corpus/oss-repos/express/test/req.fresh.js +0 -70
  392. package/tests/fixtures/corpus/oss-repos/express/test/req.get.js +0 -60
  393. package/tests/fixtures/corpus/oss-repos/express/test/req.host.js +0 -156
  394. package/tests/fixtures/corpus/oss-repos/express/test/req.hostname.js +0 -188
  395. package/tests/fixtures/corpus/oss-repos/express/test/req.ip.js +0 -113
  396. package/tests/fixtures/corpus/oss-repos/express/test/req.ips.js +0 -71
  397. package/tests/fixtures/corpus/oss-repos/express/test/req.is.js +0 -169
  398. package/tests/fixtures/corpus/oss-repos/express/test/req.path.js +0 -20
  399. package/tests/fixtures/corpus/oss-repos/express/test/req.protocol.js +0 -113
  400. package/tests/fixtures/corpus/oss-repos/express/test/req.query.js +0 -106
  401. package/tests/fixtures/corpus/oss-repos/express/test/req.range.js +0 -104
  402. package/tests/fixtures/corpus/oss-repos/express/test/req.route.js +0 -28
  403. package/tests/fixtures/corpus/oss-repos/express/test/req.secure.js +0 -101
  404. package/tests/fixtures/corpus/oss-repos/express/test/req.signedCookies.js +0 -37
  405. package/tests/fixtures/corpus/oss-repos/express/test/req.stale.js +0 -50
  406. package/tests/fixtures/corpus/oss-repos/express/test/req.subdomains.js +0 -173
  407. package/tests/fixtures/corpus/oss-repos/express/test/req.xhr.js +0 -42
  408. package/tests/fixtures/corpus/oss-repos/express/test/res.append.js +0 -116
  409. package/tests/fixtures/corpus/oss-repos/express/test/res.attachment.js +0 -79
  410. package/tests/fixtures/corpus/oss-repos/express/test/res.clearCookie.js +0 -62
  411. package/tests/fixtures/corpus/oss-repos/express/test/res.cookie.js +0 -295
  412. package/tests/fixtures/corpus/oss-repos/express/test/res.download.js +0 -487
  413. package/tests/fixtures/corpus/oss-repos/express/test/res.format.js +0 -248
  414. package/tests/fixtures/corpus/oss-repos/express/test/res.get.js +0 -21
  415. package/tests/fixtures/corpus/oss-repos/express/test/res.json.js +0 -186
  416. package/tests/fixtures/corpus/oss-repos/express/test/res.jsonp.js +0 -344
  417. package/tests/fixtures/corpus/oss-repos/express/test/res.links.js +0 -65
  418. package/tests/fixtures/corpus/oss-repos/express/test/res.locals.js +0 -40
  419. package/tests/fixtures/corpus/oss-repos/express/test/res.location.js +0 -316
  420. package/tests/fixtures/corpus/oss-repos/express/test/res.redirect.js +0 -214
  421. package/tests/fixtures/corpus/oss-repos/express/test/res.render.js +0 -367
  422. package/tests/fixtures/corpus/oss-repos/express/test/res.send.js +0 -569
  423. package/tests/fixtures/corpus/oss-repos/express/test/res.sendFile.js +0 -913
  424. package/tests/fixtures/corpus/oss-repos/express/test/res.sendStatus.js +0 -44
  425. package/tests/fixtures/corpus/oss-repos/express/test/res.set.js +0 -124
  426. package/tests/fixtures/corpus/oss-repos/express/test/res.status.js +0 -206
  427. package/tests/fixtures/corpus/oss-repos/express/test/res.type.js +0 -46
  428. package/tests/fixtures/corpus/oss-repos/express/test/res.vary.js +0 -90
  429. package/tests/fixtures/corpus/oss-repos/express/test/support/env.js +0 -3
  430. package/tests/fixtures/corpus/oss-repos/express/test/support/tmpl.js +0 -36
  431. package/tests/fixtures/corpus/oss-repos/express/test/support/utils.js +0 -86
  432. package/tests/fixtures/corpus/oss-repos/express/test/utils.js +0 -83
  433. package/tests/fixtures/corpus/oss-repos/hono/.devcontainer/Dockerfile +0 -11
  434. package/tests/fixtures/corpus/oss-repos/hono/.devcontainer/devcontainer.json +0 -21
  435. package/tests/fixtures/corpus/oss-repos/hono/.devcontainer/docker-compose.yml +0 -18
  436. package/tests/fixtures/corpus/oss-repos/hono/.eslintignore +0 -1
  437. package/tests/fixtures/corpus/oss-repos/hono/.eslintrc.cjs +0 -9
  438. package/tests/fixtures/corpus/oss-repos/hono/.gitpod.yml +0 -9
  439. package/tests/fixtures/corpus/oss-repos/hono/.prettierrc +0 -9
  440. package/tests/fixtures/corpus/oss-repos/hono/.vitest.config/jsx-runtime-default.ts +0 -15
  441. package/tests/fixtures/corpus/oss-repos/hono/.vitest.config/jsx-runtime-dom.ts +0 -15
  442. package/tests/fixtures/corpus/oss-repos/hono/.vitest.config/setup-vitest.ts +0 -47
  443. package/tests/fixtures/corpus/oss-repos/hono/LICENSE +0 -21
  444. package/tests/fixtures/corpus/oss-repos/hono/README.md +0 -91
  445. package/tests/fixtures/corpus/oss-repos/hono/build.ts +0 -80
  446. package/tests/fixtures/corpus/oss-repos/hono/bun.lockb +0 -0
  447. package/tests/fixtures/corpus/oss-repos/hono/bunfig.toml +0 -7
  448. package/tests/fixtures/corpus/oss-repos/hono/codecov.yml +0 -13
  449. package/tests/fixtures/corpus/oss-repos/hono/docs/CODE_OF_CONDUCT.md +0 -128
  450. package/tests/fixtures/corpus/oss-repos/hono/docs/CONTRIBUTING.md +0 -62
  451. package/tests/fixtures/corpus/oss-repos/hono/docs/MIGRATION.md +0 -295
  452. package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-logo.png +0 -0
  453. package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-logo.pxm +0 -0
  454. package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-logo.svg +0 -6
  455. package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-title.png +0 -0
  456. package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-title.pxm +0 -0
  457. package/tests/fixtures/corpus/oss-repos/hono/jsr.json +0 -119
  458. package/tests/fixtures/corpus/oss-repos/hono/package.cjs.json +0 -3
  459. package/tests/fixtures/corpus/oss-repos/hono/package.json +0 -650
  460. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/handler.ts +0 -492
  461. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/index.ts +0 -13
  462. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/types.ts +0 -144
  463. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/conninfo.ts +0 -28
  464. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/index.ts +0 -9
  465. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/serve-static.ts +0 -35
  466. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/server.ts +0 -30
  467. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/ssg.ts +0 -27
  468. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/websocket.ts +0 -110
  469. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/handler.ts +0 -120
  470. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/index.ts +0 -7
  471. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/conninfo.ts +0 -7
  472. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/index.ts +0 -8
  473. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static-module.ts +0 -12
  474. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static.ts +0 -39
  475. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/utils.ts +0 -50
  476. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/websocket.ts +0 -50
  477. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/conninfo.ts +0 -17
  478. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/deno.d.ts +0 -28
  479. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/index.ts +0 -9
  480. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/serve-static.ts +0 -40
  481. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/ssg.ts +0 -27
  482. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/websocket.ts +0 -51
  483. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/lambda-edge/conninfo.ts +0 -15
  484. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/lambda-edge/handler.ts +0 -189
  485. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/lambda-edge/index.ts +0 -14
  486. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/netlify/handler.ts +0 -10
  487. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/netlify/index.ts +0 -6
  488. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/netlify/mod.ts +0 -1
  489. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/service-worker/handler.ts +0 -34
  490. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/service-worker/index.ts +0 -5
  491. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/service-worker/types.ts +0 -14
  492. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/vercel/conninfo.ts +0 -8
  493. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/vercel/handler.ts +0 -9
  494. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/vercel/index.ts +0 -7
  495. package/tests/fixtures/corpus/oss-repos/hono/src/client/client.ts +0 -214
  496. package/tests/fixtures/corpus/oss-repos/hono/src/client/index.ts +0 -14
  497. package/tests/fixtures/corpus/oss-repos/hono/src/client/types.ts +0 -182
  498. package/tests/fixtures/corpus/oss-repos/hono/src/client/utils.ts +0 -54
  499. package/tests/fixtures/corpus/oss-repos/hono/src/compose.ts +0 -94
  500. package/tests/fixtures/corpus/oss-repos/hono/src/context.ts +0 -917
  501. package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/accepts.ts +0 -84
  502. package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/index.ts +0 -6
  503. package/tests/fixtures/corpus/oss-repos/hono/src/helper/adapter/index.ts +0 -85
  504. package/tests/fixtures/corpus/oss-repos/hono/src/helper/conninfo/index.ts +0 -6
  505. package/tests/fixtures/corpus/oss-repos/hono/src/helper/conninfo/types.ts +0 -45
  506. package/tests/fixtures/corpus/oss-repos/hono/src/helper/cookie/index.ts +0 -130
  507. package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/common.ts +0 -243
  508. package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/index.ts +0 -220
  509. package/tests/fixtures/corpus/oss-repos/hono/src/helper/dev/index.ts +0 -79
  510. package/tests/fixtures/corpus/oss-repos/hono/src/helper/factory/index.ts +0 -246
  511. package/tests/fixtures/corpus/oss-repos/hono/src/helper/html/index.ts +0 -56
  512. package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/index.ts +0 -13
  513. package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/middleware.ts +0 -79
  514. package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/ssg.ts +0 -388
  515. package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/utils.ts +0 -71
  516. package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/index.ts +0 -9
  517. package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/sse.ts +0 -89
  518. package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/stream.ts +0 -36
  519. package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/text.ts +0 -15
  520. package/tests/fixtures/corpus/oss-repos/hono/src/helper/testing/index.ts +0 -26
  521. package/tests/fixtures/corpus/oss-repos/hono/src/helper/websocket/index.ts +0 -57
  522. package/tests/fixtures/corpus/oss-repos/hono/src/hono-base.ts +0 -523
  523. package/tests/fixtures/corpus/oss-repos/hono/src/hono.ts +0 -34
  524. package/tests/fixtures/corpus/oss-repos/hono/src/http-exception.ts +0 -78
  525. package/tests/fixtures/corpus/oss-repos/hono/src/index.ts +0 -51
  526. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/base.ts +0 -419
  527. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/children.ts +0 -20
  528. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/components.ts +0 -195
  529. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/constants.ts +0 -5
  530. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/context.ts +0 -50
  531. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/client.ts +0 -89
  532. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/components.ts +0 -39
  533. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/context.ts +0 -52
  534. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/css.ts +0 -246
  535. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/hooks/index.ts +0 -91
  536. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/index.ts +0 -159
  537. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/intrinsic-element/components.ts +0 -398
  538. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/jsx-dev-runtime.ts +0 -22
  539. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/jsx-runtime.ts +0 -7
  540. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/render.ts +0 -772
  541. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/server.ts +0 -70
  542. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/utils.ts +0 -7
  543. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/hooks/index.ts +0 -426
  544. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/index.ts +0 -114
  545. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/common.ts +0 -11
  546. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/components.ts +0 -196
  547. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-elements.ts +0 -924
  548. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/jsx-dev-runtime.ts +0 -26
  549. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/jsx-runtime.ts +0 -18
  550. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/streaming.ts +0 -184
  551. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/types.ts +0 -41
  552. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/utils.ts +0 -36
  553. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/basic-auth/index.ts +0 -128
  554. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/bearer-auth/index.ts +0 -159
  555. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/body-limit/index.ts +0 -115
  556. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/cache/index.ts +0 -127
  557. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/combine/index.ts +0 -153
  558. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/compress/index.ts +0 -79
  559. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/context-storage/index.ts +0 -55
  560. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/cors/index.ts +0 -141
  561. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/csrf/index.ts +0 -90
  562. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/etag/index.ts +0 -88
  563. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/ip-restriction/index.ts +0 -178
  564. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jsx-renderer/index.ts +0 -158
  565. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jwt/index.ts +0 -8
  566. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jwt/jwt.ts +0 -159
  567. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/logger/index.ts +0 -93
  568. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/method-override/index.ts +0 -146
  569. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/powered-by/index.ts +0 -13
  570. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/pretty-json/index.ts +0 -50
  571. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/request-id/index.ts +0 -8
  572. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/request-id/request-id.ts +0 -59
  573. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/secure-headers/index.ts +0 -8
  574. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/secure-headers/permissions-policy.ts +0 -86
  575. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/secure-headers/secure-headers.ts +0 -319
  576. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/serve-static/index.ts +0 -140
  577. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/timeout/index.ts +0 -58
  578. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/timing/index.ts +0 -7
  579. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/timing/timing.ts +0 -225
  580. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/trailing-slash/index.ts +0 -71
  581. package/tests/fixtures/corpus/oss-repos/hono/src/preset/quick.ts +0 -24
  582. package/tests/fixtures/corpus/oss-repos/hono/src/preset/tiny.ts +0 -20
  583. package/tests/fixtures/corpus/oss-repos/hono/src/request.ts +0 -403
  584. package/tests/fixtures/corpus/oss-repos/hono/src/router/linear-router/index.ts +0 -6
  585. package/tests/fixtures/corpus/oss-repos/hono/src/router/linear-router/router.ts +0 -132
  586. package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/index.ts +0 -6
  587. package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/router.ts +0 -54
  588. package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/index.ts +0 -6
  589. package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/node.ts +0 -159
  590. package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/router.ts +0 -274
  591. package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/trie.ts +0 -74
  592. package/tests/fixtures/corpus/oss-repos/hono/src/router/smart-router/index.ts +0 -6
  593. package/tests/fixtures/corpus/oss-repos/hono/src/router/smart-router/router.ts +0 -69
  594. package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/index.ts +0 -6
  595. package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/node.ts +0 -205
  596. package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/router.ts +0 -28
  597. package/tests/fixtures/corpus/oss-repos/hono/src/router.ts +0 -103
  598. package/tests/fixtures/corpus/oss-repos/hono/src/types.ts +0 -2006
  599. package/tests/fixtures/corpus/oss-repos/hono/src/utils/basic-auth.ts +0 -26
  600. package/tests/fixtures/corpus/oss-repos/hono/src/utils/body.ts +0 -225
  601. package/tests/fixtures/corpus/oss-repos/hono/src/utils/buffer.ts +0 -65
  602. package/tests/fixtures/corpus/oss-repos/hono/src/utils/color.ts +0 -26
  603. package/tests/fixtures/corpus/oss-repos/hono/src/utils/concurrent.ts +0 -55
  604. package/tests/fixtures/corpus/oss-repos/hono/src/utils/cookie.ts +0 -230
  605. package/tests/fixtures/corpus/oss-repos/hono/src/utils/crypto.ts +0 -65
  606. package/tests/fixtures/corpus/oss-repos/hono/src/utils/encode.ts +0 -34
  607. package/tests/fixtures/corpus/oss-repos/hono/src/utils/filepath.ts +0 -56
  608. package/tests/fixtures/corpus/oss-repos/hono/src/utils/handler.ts +0 -15
  609. package/tests/fixtures/corpus/oss-repos/hono/src/utils/html.ts +0 -182
  610. package/tests/fixtures/corpus/oss-repos/hono/src/utils/http-status.ts +0 -69
  611. package/tests/fixtures/corpus/oss-repos/hono/src/utils/ipaddr.ts +0 -113
  612. package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/index.ts +0 -7
  613. package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/jwa.ts +0 -23
  614. package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/jws.ts +0 -226
  615. package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/jwt.ts +0 -114
  616. package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/types.ts +0 -83
  617. package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/utf8.ts +0 -7
  618. package/tests/fixtures/corpus/oss-repos/hono/src/utils/mime.ts +0 -142
  619. package/tests/fixtures/corpus/oss-repos/hono/src/utils/stream.ts +0 -96
  620. package/tests/fixtures/corpus/oss-repos/hono/src/utils/types.ts +0 -102
  621. package/tests/fixtures/corpus/oss-repos/hono/src/utils/url.ts +0 -310
  622. package/tests/fixtures/corpus/oss-repos/hono/src/validator/index.ts +0 -7
  623. package/tests/fixtures/corpus/oss-repos/hono/src/validator/validator.ts +0 -151
  624. package/tests/fixtures/corpus/oss-repos/hono/tsconfig.build.json +0 -23
  625. package/tests/fixtures/corpus/oss-repos/hono/tsconfig.json +0 -28
  626. package/tests/fixtures/corpus/oss-repos/hono/vitest.config.ts +0 -34
  627. package/tests/fixtures/corpus/oss-repos/hono/yarn.lock +0 -6232
  628. package/tests/fixtures/documentation/api-reference.md +0 -412
  629. package/tests/fixtures/documentation/architecture.md +0 -214
  630. package/tests/fixtures/documentation/deployment-guide.md +0 -420
  631. package/tests/fixtures/github-readmes/express.md +0 -133
  632. package/tests/fixtures/github-readmes/nextjs.md +0 -106
  633. package/tests/fixtures/github-readmes/react.md +0 -74
  634. package/tests/fixtures/github-readmes/typescript.md +0 -93
  635. package/tests/fixtures/github-readmes/vite.md +0 -79
  636. package/tests/fixtures/queries/core.json +0 -125
  637. package/tests/fixtures/queries/extended.json +0 -427
  638. package/tests/fixtures/queries/generated/.gitkeep +0 -0
  639. package/tests/fixtures/test-server.ts +0 -268
  640. package/tests/helpers/performance-metrics.ts +0 -370
  641. package/tests/helpers/search-relevance.ts +0 -326
  642. package/tests/integration/cli-consistency.test.ts +0 -298
  643. package/tests/integration/cli.test.ts +0 -69
  644. package/tests/integration/e2e-workflow.test.ts +0 -614
  645. package/tests/integration/mcp.test.ts +0 -250
  646. package/tests/integration/python-bridge.test.ts +0 -193
  647. package/tests/integration/search-quality.test.ts +0 -720
  648. package/tests/integration/serve.test.ts +0 -260
  649. package/tests/integration/stress.test.ts +0 -326
  650. package/tests/mcp/server.test.ts +0 -15
  651. package/tests/scripts/schemas/evaluation.json +0 -44
  652. package/tests/scripts/schemas/query-generation.json +0 -21
  653. package/tests/services/code-unit.service.test.ts +0 -95
  654. package/tests/services/job.service.test.ts +0 -124
  655. package/tests/services/search.progressive-context.test.ts +0 -35
  656. package/tsconfig.json +0 -34
  657. package/tsup.config.ts +0 -15
  658. package/turndown-plugin-gfm.d.ts +0 -29
  659. package/vitest.config.ts +0 -90
@@ -1,1370 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach, type MockInstance } from 'vitest';
2
- import { createStoreCommand } from './store.js';
3
- import { createServices, destroyServices } from '../../services/index.js';
4
- import type { GlobalOptions } from '../program.js';
5
- import type { FileStore, RepoStore, WebStore } from '../../types/store.js';
6
- import { createStoreId } from '../../types/brands.js';
7
-
8
- vi.mock('../../services/index.js', () => ({
9
- createServices: vi.fn(),
10
- destroyServices: vi.fn().mockResolvedValue(undefined),
11
- }));
12
-
13
- interface MockStoreService {
14
- list: MockInstance;
15
- getByIdOrName: MockInstance;
16
- create: MockInstance;
17
- delete: MockInstance;
18
- }
19
-
20
- interface MockLanceService {
21
- deleteStore: MockInstance;
22
- }
23
-
24
- interface MockCodeGraphService {
25
- deleteGraph: MockInstance;
26
- }
27
-
28
- interface MockConfigService {
29
- resolveDataDir: MockInstance;
30
- }
31
-
32
- interface MockServices {
33
- store: MockStoreService;
34
- lance: MockLanceService;
35
- codeGraph: MockCodeGraphService;
36
- config: MockConfigService;
37
- }
38
-
39
- describe('store command execution', () => {
40
- let mockServices: MockServices;
41
- let consoleLogSpy: MockInstance;
42
- let consoleErrorSpy: MockInstance;
43
- let processExitSpy: MockInstance;
44
- let getOptions: () => GlobalOptions;
45
-
46
- beforeEach(() => {
47
- vi.clearAllMocks();
48
-
49
- mockServices = {
50
- store: {
51
- list: vi.fn(),
52
- getByIdOrName: vi.fn(),
53
- create: vi.fn(),
54
- delete: vi.fn(),
55
- },
56
- lance: {
57
- deleteStore: vi.fn().mockResolvedValue(undefined),
58
- },
59
- codeGraph: {
60
- deleteGraph: vi.fn().mockResolvedValue(undefined),
61
- },
62
- config: {
63
- resolveDataDir: vi.fn().mockReturnValue('/tmp/test-data'),
64
- },
65
- };
66
-
67
- vi.mocked(createServices).mockResolvedValue(mockServices);
68
-
69
- consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
70
- consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
71
- processExitSpy = vi.spyOn(process, 'exit').mockImplementation((code) => {
72
- throw new Error(`process.exit: ${code}`);
73
- });
74
-
75
- getOptions = () => ({
76
- config: undefined,
77
- dataDir: '/tmp/test',
78
- quiet: false,
79
- format: undefined,
80
- });
81
- });
82
-
83
- afterEach(() => {
84
- vi.restoreAllMocks();
85
- });
86
-
87
- describe('list subcommand', () => {
88
- it('lists all stores in normal mode', async () => {
89
- const mockStores: Array<FileStore | RepoStore | WebStore> = [
90
- {
91
- id: createStoreId('store-1'),
92
- name: 'file-store',
93
- type: 'file',
94
- path: '/path/to/files',
95
- createdAt: new Date(),
96
- updatedAt: new Date(),
97
- },
98
- {
99
- id: createStoreId('store-2'),
100
- name: 'repo-store',
101
- type: 'repo',
102
- path: '/path/to/repo',
103
- createdAt: new Date(),
104
- updatedAt: new Date(),
105
- },
106
- {
107
- id: createStoreId('store-3'),
108
- name: 'web-store',
109
- type: 'web',
110
- url: 'https://example.com',
111
- depth: 2,
112
- createdAt: new Date(),
113
- updatedAt: new Date(),
114
- },
115
- ];
116
-
117
- mockServices.store.list.mockResolvedValue(mockStores);
118
-
119
- const command = createStoreCommand(getOptions);
120
- const listCommand = command.commands.find((c) => c.name() === 'list');
121
- const actionHandler = listCommand?._actionHandler;
122
-
123
- await actionHandler!([]);
124
-
125
- expect(mockServices.store.list).toHaveBeenCalledWith(undefined);
126
- expect(consoleLogSpy).toHaveBeenCalledWith('\nStores:\n');
127
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('file-store (file)'));
128
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('repo-store (repo)'));
129
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('web-store (web)'));
130
- });
131
-
132
- it('lists stores filtered by type', async () => {
133
- const mockStores: FileStore[] = [
134
- {
135
- id: createStoreId('store-1'),
136
- name: 'file-store',
137
- type: 'file',
138
- path: '/path/to/files',
139
- createdAt: new Date(),
140
- updatedAt: new Date(),
141
- },
142
- ];
143
-
144
- mockServices.store.list.mockResolvedValue(mockStores);
145
-
146
- const command = createStoreCommand(getOptions);
147
- const listCommand = command.commands.find((c) => c.name() === 'list');
148
- const actionHandler = listCommand?._actionHandler;
149
-
150
- listCommand.parseOptions(['--type', 'file']);
151
- await actionHandler!([]);
152
-
153
- expect(mockServices.store.list).toHaveBeenCalledWith('file');
154
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('file-store (file)'));
155
- });
156
-
157
- it('shows message when no stores found', async () => {
158
- mockServices.store.list.mockResolvedValue([]);
159
-
160
- const command = createStoreCommand(getOptions);
161
- const listCommand = command.commands.find((c) => c.name() === 'list');
162
- const actionHandler = listCommand?._actionHandler;
163
-
164
- await actionHandler!([]);
165
-
166
- expect(consoleLogSpy).toHaveBeenCalledWith('No stores found.');
167
- });
168
-
169
- it('outputs JSON when format is json', async () => {
170
- const mockStores: FileStore[] = [
171
- {
172
- id: createStoreId('store-1'),
173
- name: 'file-store',
174
- type: 'file',
175
- path: '/path/to/files',
176
- createdAt: new Date(),
177
- updatedAt: new Date(),
178
- },
179
- ];
180
-
181
- mockServices.store.list.mockResolvedValue(mockStores);
182
-
183
- getOptions = () => ({
184
- config: undefined,
185
- dataDir: '/tmp/test',
186
- quiet: false,
187
- format: 'json',
188
- });
189
-
190
- const command = createStoreCommand(getOptions);
191
- const listCommand = command.commands.find((c) => c.name() === 'list');
192
- const actionHandler = listCommand?._actionHandler;
193
-
194
- await actionHandler!([]);
195
-
196
- const jsonOutput = consoleLogSpy.mock.calls[0][0];
197
- expect(jsonOutput).toContain('"name": "file-store"');
198
- expect(jsonOutput).toContain('"type": "file"');
199
- });
200
-
201
- it('outputs store names only in quiet mode', async () => {
202
- const mockStores: Array<FileStore | RepoStore> = [
203
- {
204
- id: createStoreId('store-1'),
205
- name: 'store1',
206
- type: 'file',
207
- path: '/path/to/files',
208
- createdAt: new Date(),
209
- updatedAt: new Date(),
210
- },
211
- {
212
- id: createStoreId('store-2'),
213
- name: 'store2',
214
- type: 'repo',
215
- path: '/path/to/repo',
216
- createdAt: new Date(),
217
- updatedAt: new Date(),
218
- },
219
- ];
220
-
221
- mockServices.store.list.mockResolvedValue(mockStores);
222
-
223
- getOptions = () => ({
224
- config: undefined,
225
- dataDir: '/tmp/test',
226
- quiet: true,
227
- format: undefined,
228
- });
229
-
230
- const command = createStoreCommand(getOptions);
231
- const listCommand = command.commands.find((c) => c.name() === 'list');
232
- const actionHandler = listCommand?._actionHandler;
233
-
234
- await actionHandler!([]);
235
-
236
- expect(consoleLogSpy).toHaveBeenCalledWith('store1');
237
- expect(consoleLogSpy).toHaveBeenCalledWith('store2');
238
- });
239
- });
240
-
241
- describe('create subcommand', () => {
242
- it('creates a file store successfully', async () => {
243
- const mockStore: FileStore = {
244
- id: createStoreId('new-store-1'),
245
- name: 'my-files',
246
- type: 'file',
247
- path: '/path/to/files',
248
- description: 'My file store',
249
- createdAt: new Date(),
250
- updatedAt: new Date(),
251
- };
252
-
253
- mockServices.store.create.mockResolvedValue({
254
- success: true,
255
- data: mockStore,
256
- });
257
-
258
- const command = createStoreCommand(getOptions);
259
- const createCommand = command.commands.find((c) => c.name() === 'create');
260
- const actionHandler = createCommand?._actionHandler;
261
-
262
- createCommand.parseOptions([
263
- '--type',
264
- 'file',
265
- '--source',
266
- '/path/to/files',
267
- '--description',
268
- 'My file store',
269
- ]);
270
- await actionHandler!(['my-files']);
271
-
272
- expect(mockServices.store.create).toHaveBeenCalledWith({
273
- name: 'my-files',
274
- type: 'file',
275
- path: '/path/to/files',
276
- url: undefined,
277
- description: 'My file store',
278
- tags: undefined,
279
- });
280
- expect(consoleLogSpy).toHaveBeenCalledWith(
281
- expect.stringContaining('Created store: my-files')
282
- );
283
- expect(processExitSpy).not.toHaveBeenCalled();
284
- });
285
-
286
- it('creates a repo store successfully', async () => {
287
- const mockStore: RepoStore = {
288
- id: createStoreId('new-store-2'),
289
- name: 'my-repo',
290
- type: 'repo',
291
- path: '/path/to/repo',
292
- createdAt: new Date(),
293
- updatedAt: new Date(),
294
- };
295
-
296
- mockServices.store.create.mockResolvedValue({
297
- success: true,
298
- data: mockStore,
299
- });
300
-
301
- const command = createStoreCommand(getOptions);
302
- const createCommand = command.commands.find((c) => c.name() === 'create');
303
- const actionHandler = createCommand?._actionHandler;
304
-
305
- createCommand.parseOptions(['--type', 'repo', '--source', '/path/to/repo']);
306
- await actionHandler!(['my-repo']);
307
-
308
- expect(mockServices.store.create).toHaveBeenCalledWith({
309
- name: 'my-repo',
310
- type: 'repo',
311
- path: '/path/to/repo',
312
- url: undefined,
313
- description: undefined,
314
- tags: undefined,
315
- });
316
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Created store: my-repo'));
317
- });
318
-
319
- it('creates a web store successfully', async () => {
320
- const mockStore: WebStore = {
321
- id: createStoreId('new-store-3'),
322
- name: 'my-docs',
323
- type: 'web',
324
- url: 'https://docs.example.com',
325
- depth: 2,
326
- createdAt: new Date(),
327
- updatedAt: new Date(),
328
- };
329
-
330
- mockServices.store.create.mockResolvedValue({
331
- success: true,
332
- data: mockStore,
333
- });
334
-
335
- const command = createStoreCommand(getOptions);
336
- const createCommand = command.commands.find((c) => c.name() === 'create');
337
- const actionHandler = createCommand?._actionHandler;
338
-
339
- createCommand.parseOptions(['--type', 'web', '--source', 'https://docs.example.com']);
340
- await actionHandler!(['my-docs']);
341
-
342
- expect(mockServices.store.create).toHaveBeenCalledWith({
343
- name: 'my-docs',
344
- type: 'web',
345
- path: undefined,
346
- url: 'https://docs.example.com',
347
- description: undefined,
348
- tags: undefined,
349
- });
350
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Created store: my-docs'));
351
- });
352
-
353
- it('creates store with tags', async () => {
354
- const mockStore: FileStore = {
355
- id: createStoreId('new-store-4'),
356
- name: 'tagged-store',
357
- type: 'file',
358
- path: '/path/to/files',
359
- tags: ['typescript', 'react', 'frontend'],
360
- createdAt: new Date(),
361
- updatedAt: new Date(),
362
- };
363
-
364
- mockServices.store.create.mockResolvedValue({
365
- success: true,
366
- data: mockStore,
367
- });
368
-
369
- const command = createStoreCommand(getOptions);
370
- const createCommand = command.commands.find((c) => c.name() === 'create');
371
- const actionHandler = createCommand?._actionHandler;
372
-
373
- createCommand.parseOptions([
374
- '--type',
375
- 'file',
376
- '--source',
377
- '/path/to/files',
378
- '--tags',
379
- 'typescript, react, frontend',
380
- ]);
381
- await actionHandler!(['tagged-store']);
382
-
383
- expect(mockServices.store.create).toHaveBeenCalledWith({
384
- name: 'tagged-store',
385
- type: 'file',
386
- path: '/path/to/files',
387
- url: undefined,
388
- description: undefined,
389
- tags: ['typescript', 'react', 'frontend'],
390
- });
391
- });
392
-
393
- it('creates repo store with branch option', async () => {
394
- const mockStore: RepoStore = {
395
- id: createStoreId('new-store-6'),
396
- name: 'branched-repo',
397
- type: 'repo',
398
- path: '/path/to/cloned/repo',
399
- url: 'https://github.com/user/repo',
400
- branch: 'develop',
401
- createdAt: new Date(),
402
- updatedAt: new Date(),
403
- };
404
-
405
- mockServices.store.create.mockResolvedValue({
406
- success: true,
407
- data: mockStore,
408
- });
409
-
410
- const command = createStoreCommand(getOptions);
411
- const createCommand = command.commands.find((c) => c.name() === 'create');
412
- const actionHandler = createCommand?._actionHandler;
413
-
414
- createCommand.parseOptions([
415
- '--type',
416
- 'repo',
417
- '--source',
418
- 'https://github.com/user/repo',
419
- '--branch',
420
- 'develop',
421
- ]);
422
- await actionHandler!(['branched-repo']);
423
-
424
- expect(mockServices.store.create).toHaveBeenCalledWith({
425
- name: 'branched-repo',
426
- type: 'repo',
427
- path: undefined,
428
- url: 'https://github.com/user/repo',
429
- branch: 'develop',
430
- description: undefined,
431
- tags: undefined,
432
- });
433
- expect(consoleLogSpy).toHaveBeenCalledWith(
434
- expect.stringContaining('Created store: branched-repo')
435
- );
436
- });
437
-
438
- it('outputs JSON when format is json', async () => {
439
- const mockStore: FileStore = {
440
- id: createStoreId('new-store-5'),
441
- name: 'json-store',
442
- type: 'file',
443
- path: '/path/to/files',
444
- createdAt: new Date(),
445
- updatedAt: new Date(),
446
- };
447
-
448
- mockServices.store.create.mockResolvedValue({
449
- success: true,
450
- data: mockStore,
451
- });
452
-
453
- getOptions = () => ({
454
- config: undefined,
455
- dataDir: '/tmp/test',
456
- quiet: false,
457
- format: 'json',
458
- });
459
-
460
- const command = createStoreCommand(getOptions);
461
- const createCommand = command.commands.find((c) => c.name() === 'create');
462
- const actionHandler = createCommand?._actionHandler;
463
-
464
- createCommand.parseOptions(['--type', 'file', '--source', '/path/to/files']);
465
- await actionHandler!(['json-store']);
466
-
467
- const jsonOutput = consoleLogSpy.mock.calls[0][0];
468
- expect(jsonOutput).toContain('"name": "json-store"');
469
- expect(jsonOutput).toContain('"type": "file"');
470
- });
471
-
472
- it('exits with code 1 when creation fails', async () => {
473
- mockServices.store.create.mockResolvedValue({
474
- success: false,
475
- error: {
476
- message: 'Store already exists',
477
- },
478
- });
479
-
480
- const command = createStoreCommand(getOptions);
481
- const createCommand = command.commands.find((c) => c.name() === 'create');
482
- const actionHandler = createCommand?._actionHandler;
483
-
484
- createCommand.parseOptions(['--type', 'file', '--source', '/path/to/files']);
485
- await actionHandler!(['duplicate-store']);
486
-
487
- expect(consoleErrorSpy).toHaveBeenCalledWith('Error: Store already exists');
488
- expect(process.exitCode).toBe(1);
489
- // Reset for other tests
490
- process.exitCode = undefined;
491
- });
492
- });
493
-
494
- describe('info subcommand', () => {
495
- it('displays file store info in normal mode', async () => {
496
- const mockStore: FileStore = {
497
- id: createStoreId('store-1'),
498
- name: 'my-store',
499
- type: 'file',
500
- path: '/path/to/files',
501
- description: 'My file store',
502
- createdAt: new Date('2024-01-01T00:00:00Z'),
503
- updatedAt: new Date('2024-01-02T00:00:00Z'),
504
- };
505
-
506
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
507
-
508
- const command = createStoreCommand(getOptions);
509
- const infoCommand = command.commands.find((c) => c.name() === 'info');
510
- const actionHandler = infoCommand?._actionHandler;
511
-
512
- await actionHandler!(['my-store']);
513
-
514
- expect(mockServices.store.getByIdOrName).toHaveBeenCalledWith('my-store');
515
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Store: my-store'));
516
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Type: file'));
517
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Path: /path/to/files'));
518
- expect(consoleLogSpy).toHaveBeenCalledWith(
519
- expect.stringContaining('Description: My file store')
520
- );
521
- expect(consoleLogSpy).toHaveBeenCalledWith(
522
- expect.stringContaining('Created: 2024-01-01T00:00:00.000Z')
523
- );
524
- expect(consoleLogSpy).toHaveBeenCalledWith(
525
- expect.stringContaining('Updated: 2024-01-02T00:00:00.000Z')
526
- );
527
- });
528
-
529
- it('displays repo store info with URL', async () => {
530
- const mockStore: RepoStore = {
531
- id: createStoreId('store-2'),
532
- name: 'my-repo',
533
- type: 'repo',
534
- path: '/path/to/repo',
535
- url: 'https://github.com/user/repo.git',
536
- branch: 'main',
537
- createdAt: new Date('2024-01-01T00:00:00Z'),
538
- updatedAt: new Date('2024-01-02T00:00:00Z'),
539
- };
540
-
541
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
542
-
543
- const command = createStoreCommand(getOptions);
544
- const infoCommand = command.commands.find((c) => c.name() === 'info');
545
- const actionHandler = infoCommand?._actionHandler;
546
-
547
- await actionHandler!(['my-repo']);
548
-
549
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Store: my-repo'));
550
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Type: repo'));
551
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Path: /path/to/repo'));
552
- expect(consoleLogSpy).toHaveBeenCalledWith(
553
- expect.stringContaining('URL: https://github.com/user/repo.git')
554
- );
555
- });
556
-
557
- it('displays web store info', async () => {
558
- const mockStore: WebStore = {
559
- id: createStoreId('store-3'),
560
- name: 'my-docs',
561
- type: 'web',
562
- url: 'https://docs.example.com',
563
- depth: 3,
564
- maxPages: 100,
565
- createdAt: new Date('2024-01-01T00:00:00Z'),
566
- updatedAt: new Date('2024-01-02T00:00:00Z'),
567
- };
568
-
569
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
570
-
571
- const command = createStoreCommand(getOptions);
572
- const infoCommand = command.commands.find((c) => c.name() === 'info');
573
- const actionHandler = infoCommand?._actionHandler;
574
-
575
- await actionHandler!(['my-docs']);
576
-
577
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Store: my-docs'));
578
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Type: web'));
579
- expect(consoleLogSpy).toHaveBeenCalledWith(
580
- expect.stringContaining('URL: https://docs.example.com')
581
- );
582
- });
583
-
584
- it('outputs JSON when format is json', async () => {
585
- const mockStore: FileStore = {
586
- id: createStoreId('store-1'),
587
- name: 'my-store',
588
- type: 'file',
589
- path: '/path/to/files',
590
- createdAt: new Date(),
591
- updatedAt: new Date(),
592
- };
593
-
594
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
595
-
596
- getOptions = () => ({
597
- config: undefined,
598
- dataDir: '/tmp/test',
599
- quiet: false,
600
- format: 'json',
601
- });
602
-
603
- const command = createStoreCommand(getOptions);
604
- const infoCommand = command.commands.find((c) => c.name() === 'info');
605
- const actionHandler = infoCommand?._actionHandler;
606
-
607
- await actionHandler!(['my-store']);
608
-
609
- const jsonOutput = consoleLogSpy.mock.calls[0][0];
610
- expect(jsonOutput).toContain('"name": "my-store"');
611
- expect(jsonOutput).toContain('"type": "file"');
612
- });
613
-
614
- it('exits with code 3 when store not found', async () => {
615
- mockServices.store.getByIdOrName.mockResolvedValue(undefined);
616
-
617
- const command = createStoreCommand(getOptions);
618
- const infoCommand = command.commands.find((c) => c.name() === 'info');
619
- const actionHandler = infoCommand?._actionHandler;
620
-
621
- await actionHandler!(['nonexistent']);
622
-
623
- expect(consoleErrorSpy).toHaveBeenCalledWith('Error: Store not found: nonexistent');
624
- expect(process.exitCode).toBe(3);
625
- // Reset for other tests
626
- process.exitCode = undefined;
627
- });
628
-
629
- it('can lookup store by ID', async () => {
630
- const storeId = 'store-123';
631
- const mockStore: FileStore = {
632
- id: createStoreId(storeId),
633
- name: 'my-store',
634
- type: 'file',
635
- path: '/path/to/files',
636
- createdAt: new Date(),
637
- updatedAt: new Date(),
638
- };
639
-
640
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
641
-
642
- const command = createStoreCommand(getOptions);
643
- const infoCommand = command.commands.find((c) => c.name() === 'info');
644
- const actionHandler = infoCommand?._actionHandler;
645
-
646
- await actionHandler!([storeId]);
647
-
648
- expect(mockServices.store.getByIdOrName).toHaveBeenCalledWith(storeId);
649
- expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Store: my-store'));
650
- });
651
- });
652
-
653
- describe('delete subcommand', () => {
654
- it('deletes store with --force flag', async () => {
655
- const mockStore: FileStore = {
656
- id: createStoreId('store-1'),
657
- name: 'delete-me',
658
- type: 'file',
659
- path: '/path/to/files',
660
- createdAt: new Date(),
661
- updatedAt: new Date(),
662
- };
663
-
664
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
665
- mockServices.store.delete.mockResolvedValue({
666
- success: true,
667
- });
668
-
669
- const command = createStoreCommand(getOptions);
670
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
671
- const actionHandler = deleteCommand?._actionHandler;
672
-
673
- deleteCommand.parseOptions(['--force']);
674
- await actionHandler!(['delete-me']);
675
-
676
- expect(mockServices.store.getByIdOrName).toHaveBeenCalledWith('delete-me');
677
- expect(mockServices.store.delete).toHaveBeenCalledWith(mockStore.id);
678
- expect(consoleLogSpy).toHaveBeenCalledWith('Deleted store: delete-me');
679
- expect(processExitSpy).not.toHaveBeenCalled();
680
- });
681
-
682
- it('deletes store with -y flag', async () => {
683
- const mockStore: FileStore = {
684
- id: createStoreId('store-1'),
685
- name: 'delete-me',
686
- type: 'file',
687
- path: '/path/to/files',
688
- createdAt: new Date(),
689
- updatedAt: new Date(),
690
- };
691
-
692
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
693
- mockServices.store.delete.mockResolvedValue({
694
- success: true,
695
- });
696
-
697
- const command = createStoreCommand(getOptions);
698
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
699
- const actionHandler = deleteCommand?._actionHandler;
700
-
701
- deleteCommand.parseOptions(['--yes']);
702
- await actionHandler!(['delete-me']);
703
-
704
- expect(mockServices.store.delete).toHaveBeenCalledWith(mockStore.id);
705
- expect(consoleLogSpy).toHaveBeenCalledWith('Deleted store: delete-me');
706
- });
707
-
708
- it('exits with code 3 when store not found', async () => {
709
- mockServices.store.getByIdOrName.mockResolvedValue(undefined);
710
-
711
- const command = createStoreCommand(getOptions);
712
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
713
- const actionHandler = deleteCommand?._actionHandler;
714
-
715
- deleteCommand.parseOptions(['--force']);
716
- await actionHandler!(['nonexistent']);
717
-
718
- expect(consoleErrorSpy).toHaveBeenCalledWith('Error: Store not found: nonexistent');
719
- expect(process.exitCode).toBe(3);
720
- expect(mockServices.store.delete).not.toHaveBeenCalled();
721
- // Reset for other tests
722
- process.exitCode = undefined;
723
- });
724
-
725
- it('exits with code 1 when deletion fails', async () => {
726
- const mockStore: FileStore = {
727
- id: createStoreId('store-1'),
728
- name: 'locked-store',
729
- type: 'file',
730
- path: '/path/to/files',
731
- createdAt: new Date(),
732
- updatedAt: new Date(),
733
- };
734
-
735
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
736
- mockServices.store.delete.mockResolvedValue({
737
- success: false,
738
- error: {
739
- message: 'Store is locked',
740
- },
741
- });
742
-
743
- const command = createStoreCommand(getOptions);
744
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
745
- const actionHandler = deleteCommand?._actionHandler;
746
-
747
- deleteCommand.parseOptions(['--force']);
748
- await actionHandler!(['locked-store']);
749
-
750
- expect(consoleErrorSpy).toHaveBeenCalledWith('Error: Store is locked');
751
- expect(process.exitCode).toBe(1);
752
- // Reset for other tests
753
- process.exitCode = undefined;
754
- });
755
-
756
- it('exits with code 1 when force not provided in non-TTY mode', async () => {
757
- const mockStore: FileStore = {
758
- id: createStoreId('store-1'),
759
- name: 'my-store',
760
- type: 'file',
761
- path: '/path/to/files',
762
- createdAt: new Date(),
763
- updatedAt: new Date(),
764
- };
765
-
766
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
767
-
768
- // Mock process.stdin.isTTY to be false
769
- const originalIsTTY = process.stdin.isTTY;
770
- Object.defineProperty(process.stdin, 'isTTY', {
771
- value: false,
772
- configurable: true,
773
- });
774
-
775
- const command = createStoreCommand(getOptions);
776
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
777
- const actionHandler = deleteCommand?._actionHandler;
778
-
779
- await actionHandler!(['my-store']);
780
-
781
- expect(consoleErrorSpy).toHaveBeenCalledWith(
782
- 'Error: Use --force or -y to delete without confirmation in non-interactive mode'
783
- );
784
- expect(process.exitCode).toBe(1);
785
- expect(mockServices.store.delete).not.toHaveBeenCalled();
786
-
787
- // Restore original value
788
- Object.defineProperty(process.stdin, 'isTTY', {
789
- value: originalIsTTY,
790
- configurable: true,
791
- });
792
- // Reset for other tests
793
- process.exitCode = undefined;
794
- });
795
-
796
- it('prompts for confirmation in TTY mode when user confirms', async () => {
797
- const mockStore: FileStore = {
798
- id: createStoreId('store-1'),
799
- name: 'my-store',
800
- type: 'file',
801
- path: '/path/to/files',
802
- createdAt: new Date(),
803
- updatedAt: new Date(),
804
- };
805
-
806
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
807
- mockServices.store.delete.mockResolvedValue({
808
- success: true,
809
- });
810
-
811
- // Mock process.stdin.isTTY to be true
812
- const originalIsTTY = process.stdin.isTTY;
813
- Object.defineProperty(process.stdin, 'isTTY', {
814
- value: true,
815
- configurable: true,
816
- });
817
-
818
- // Mock readline to simulate user typing 'y'
819
- const mockReadline = {
820
- question: vi.fn((prompt: string, callback: (answer: string) => void) => {
821
- callback('y');
822
- }),
823
- close: vi.fn(),
824
- };
825
-
826
- vi.doMock('node:readline', () => ({
827
- createInterface: vi.fn(() => mockReadline),
828
- }));
829
-
830
- const command = createStoreCommand(getOptions);
831
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
832
- const actionHandler = deleteCommand?._actionHandler;
833
-
834
- await actionHandler!(['my-store']);
835
-
836
- expect(mockServices.store.delete).toHaveBeenCalledWith(mockStore.id);
837
- expect(consoleLogSpy).toHaveBeenCalledWith('Deleted store: my-store');
838
-
839
- // Restore original value
840
- Object.defineProperty(process.stdin, 'isTTY', {
841
- value: originalIsTTY,
842
- configurable: true,
843
- });
844
- });
845
-
846
- it('cancels deletion when user declines in TTY mode', async () => {
847
- const mockStore: FileStore = {
848
- id: createStoreId('store-1'),
849
- name: 'my-store',
850
- type: 'file',
851
- path: '/path/to/files',
852
- createdAt: new Date(),
853
- updatedAt: new Date(),
854
- };
855
-
856
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
857
-
858
- // Mock process.stdin.isTTY to be true
859
- const originalIsTTY = process.stdin.isTTY;
860
- Object.defineProperty(process.stdin, 'isTTY', {
861
- value: true,
862
- configurable: true,
863
- });
864
-
865
- // Mock readline to simulate user typing 'n'
866
- const mockReadline = {
867
- question: vi.fn((prompt: string, callback: (answer: string) => void) => {
868
- callback('n');
869
- }),
870
- close: vi.fn(),
871
- };
872
-
873
- vi.doMock('node:readline', () => ({
874
- createInterface: vi.fn(() => mockReadline),
875
- }));
876
-
877
- const command = createStoreCommand(getOptions);
878
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
879
- const actionHandler = deleteCommand?._actionHandler;
880
-
881
- await actionHandler!(['my-store']);
882
-
883
- expect(consoleLogSpy).toHaveBeenCalledWith('Cancelled.');
884
- // exitCode stays 0 (undefined) for user-initiated cancellation - not an error
885
- expect(process.exitCode).toBeUndefined();
886
- expect(mockServices.store.delete).not.toHaveBeenCalled();
887
-
888
- // Restore original value
889
- Object.defineProperty(process.stdin, 'isTTY', {
890
- value: originalIsTTY,
891
- configurable: true,
892
- });
893
- });
894
- });
895
-
896
- describe('command structure', () => {
897
- it('creates store command with all subcommands', () => {
898
- const command = createStoreCommand(getOptions);
899
-
900
- expect(command.name()).toBe('store');
901
- expect(command.commands.length).toBe(4);
902
- expect(command.commands.map((c) => c.name())).toEqual(['list', 'create', 'info', 'delete']);
903
- });
904
-
905
- it('list subcommand has type option', () => {
906
- const command = createStoreCommand(getOptions);
907
- const listCommand = command.commands.find((c) => c.name() === 'list');
908
- const typeOption = listCommand?.options.find((o) => o.long === '--type');
909
-
910
- expect(typeOption).toBeDefined();
911
- });
912
-
913
- it('create subcommand has required options', () => {
914
- const command = createStoreCommand(getOptions);
915
- const createCommand = command.commands.find((c) => c.name() === 'create');
916
-
917
- const typeOption = createCommand?.options.find((o) => o.long === '--type');
918
- const sourceOption = createCommand?.options.find((o) => o.long === '--source');
919
- const descriptionOption = createCommand?.options.find((o) => o.long === '--description');
920
- const tagsOption = createCommand?.options.find((o) => o.long === '--tags');
921
-
922
- expect(typeOption).toBeDefined();
923
- expect(typeOption?.mandatory).toBe(true);
924
- expect(sourceOption).toBeDefined();
925
- expect(sourceOption?.mandatory).toBe(true);
926
- expect(descriptionOption).toBeDefined();
927
- expect(descriptionOption?.mandatory).toBe(false);
928
- expect(tagsOption).toBeDefined();
929
- expect(tagsOption?.mandatory).toBe(false);
930
- });
931
-
932
- it('create subcommand has --branch option for repo type', () => {
933
- const command = createStoreCommand(getOptions);
934
- const createCommand = command.commands.find((c) => c.name() === 'create');
935
- const branchOption = createCommand?.options.find((o) => o.long === '--branch');
936
-
937
- expect(branchOption).toBeDefined();
938
- expect(branchOption?.mandatory).toBe(false);
939
- });
940
-
941
- it('delete subcommand has force and yes options', () => {
942
- const command = createStoreCommand(getOptions);
943
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
944
-
945
- const forceOption = deleteCommand?.options.find((o) => o.long === '--force');
946
- const yesOption = deleteCommand?.options.find((o) => o.long === '--yes');
947
-
948
- expect(forceOption).toBeDefined();
949
- expect(yesOption).toBeDefined();
950
- });
951
- });
952
-
953
- describe('tags parsing', () => {
954
- it('parses comma-separated tags correctly', async () => {
955
- const mockStore: FileStore = {
956
- id: createStoreId('store-1'),
957
- name: 'tagged-store',
958
- type: 'file',
959
- path: '/path/to/files',
960
- tags: ['tag1', 'tag2', 'tag3'],
961
- createdAt: new Date(),
962
- updatedAt: new Date(),
963
- };
964
-
965
- mockServices.store.create.mockResolvedValue({
966
- success: true,
967
- data: mockStore,
968
- });
969
-
970
- const command = createStoreCommand(getOptions);
971
- const createCommand = command.commands.find((c) => c.name() === 'create');
972
- const actionHandler = createCommand?._actionHandler;
973
-
974
- createCommand.parseOptions([
975
- '--type',
976
- 'file',
977
- '--source',
978
- '/path/to/files',
979
- '--tags',
980
- 'tag1, tag2, tag3',
981
- ]);
982
- await actionHandler!(['tagged-store']);
983
-
984
- expect(mockServices.store.create).toHaveBeenCalledWith(
985
- expect.objectContaining({
986
- tags: ['tag1', 'tag2', 'tag3'],
987
- })
988
- );
989
- });
990
-
991
- it('handles tags with extra whitespace', async () => {
992
- const mockStore: FileStore = {
993
- id: createStoreId('store-1'),
994
- name: 'tagged-store',
995
- type: 'file',
996
- path: '/path/to/files',
997
- tags: ['tag1', 'tag2'],
998
- createdAt: new Date(),
999
- updatedAt: new Date(),
1000
- };
1001
-
1002
- mockServices.store.create.mockResolvedValue({
1003
- success: true,
1004
- data: mockStore,
1005
- });
1006
-
1007
- const command = createStoreCommand(getOptions);
1008
- const createCommand = command.commands.find((c) => c.name() === 'create');
1009
- const actionHandler = createCommand?._actionHandler;
1010
-
1011
- createCommand.parseOptions([
1012
- '--type',
1013
- 'file',
1014
- '--source',
1015
- '/path/to/files',
1016
- '--tags',
1017
- ' tag1 , tag2 ',
1018
- ]);
1019
- await actionHandler!(['tagged-store']);
1020
-
1021
- expect(mockServices.store.create).toHaveBeenCalledWith(
1022
- expect.objectContaining({
1023
- tags: ['tag1', 'tag2'],
1024
- })
1025
- );
1026
- });
1027
- });
1028
-
1029
- describe('source routing for store types', () => {
1030
- it('routes source to path for file stores', async () => {
1031
- const mockStore: FileStore = {
1032
- id: createStoreId('store-1'),
1033
- name: 'file-store',
1034
- type: 'file',
1035
- path: '/local/path',
1036
- createdAt: new Date(),
1037
- updatedAt: new Date(),
1038
- };
1039
-
1040
- mockServices.store.create.mockResolvedValue({
1041
- success: true,
1042
- data: mockStore,
1043
- });
1044
-
1045
- const command = createStoreCommand(getOptions);
1046
- const createCommand = command.commands.find((c) => c.name() === 'create');
1047
- const actionHandler = createCommand?._actionHandler;
1048
-
1049
- createCommand.parseOptions(['--type', 'file', '--source', '/local/path']);
1050
- await actionHandler!(['file-store']);
1051
-
1052
- expect(mockServices.store.create).toHaveBeenCalledWith({
1053
- name: 'file-store',
1054
- type: 'file',
1055
- path: '/local/path',
1056
- url: undefined,
1057
- description: undefined,
1058
- tags: undefined,
1059
- });
1060
- });
1061
-
1062
- it('routes source to path for repo stores with local path', async () => {
1063
- const mockStore: RepoStore = {
1064
- id: createStoreId('store-2'),
1065
- name: 'repo-store',
1066
- type: 'repo',
1067
- path: '/repo/path',
1068
- createdAt: new Date(),
1069
- updatedAt: new Date(),
1070
- };
1071
-
1072
- mockServices.store.create.mockResolvedValue({
1073
- success: true,
1074
- data: mockStore,
1075
- });
1076
-
1077
- const command = createStoreCommand(getOptions);
1078
- const createCommand = command.commands.find((c) => c.name() === 'create');
1079
- const actionHandler = createCommand?._actionHandler;
1080
-
1081
- createCommand.parseOptions(['--type', 'repo', '--source', '/repo/path']);
1082
- await actionHandler!(['repo-store']);
1083
-
1084
- expect(mockServices.store.create).toHaveBeenCalledWith({
1085
- name: 'repo-store',
1086
- type: 'repo',
1087
- path: '/repo/path',
1088
- url: undefined,
1089
- description: undefined,
1090
- tags: undefined,
1091
- });
1092
- });
1093
-
1094
- it('routes URL source to url for repo stores (Bug #1 fix)', async () => {
1095
- const mockStore: RepoStore = {
1096
- id: createStoreId('store-2'),
1097
- name: 'repo-url-store',
1098
- type: 'repo',
1099
- path: '/cloned/repo/path',
1100
- url: 'https://github.com/user/repo',
1101
- createdAt: new Date(),
1102
- updatedAt: new Date(),
1103
- };
1104
-
1105
- mockServices.store.create.mockResolvedValue({
1106
- success: true,
1107
- data: mockStore,
1108
- });
1109
-
1110
- const command = createStoreCommand(getOptions);
1111
- const createCommand = command.commands.find((c) => c.name() === 'create');
1112
- const actionHandler = createCommand?._actionHandler;
1113
-
1114
- createCommand.parseOptions(['--type', 'repo', '--source', 'https://github.com/user/repo']);
1115
- await actionHandler!(['repo-url-store']);
1116
-
1117
- // URL should be routed to 'url' parameter, not 'path'
1118
- expect(mockServices.store.create).toHaveBeenCalledWith({
1119
- name: 'repo-url-store',
1120
- type: 'repo',
1121
- path: undefined,
1122
- url: 'https://github.com/user/repo',
1123
- description: undefined,
1124
- tags: undefined,
1125
- });
1126
- });
1127
-
1128
- it('routes http:// URL source to url for repo stores', async () => {
1129
- const mockStore: RepoStore = {
1130
- id: createStoreId('store-2'),
1131
- name: 'repo-http-store',
1132
- type: 'repo',
1133
- path: '/cloned/repo/path',
1134
- url: 'http://internal-git.example.com/repo',
1135
- createdAt: new Date(),
1136
- updatedAt: new Date(),
1137
- };
1138
-
1139
- mockServices.store.create.mockResolvedValue({
1140
- success: true,
1141
- data: mockStore,
1142
- });
1143
-
1144
- const command = createStoreCommand(getOptions);
1145
- const createCommand = command.commands.find((c) => c.name() === 'create');
1146
- const actionHandler = createCommand?._actionHandler;
1147
-
1148
- createCommand.parseOptions([
1149
- '--type',
1150
- 'repo',
1151
- '--source',
1152
- 'http://internal-git.example.com/repo',
1153
- ]);
1154
- await actionHandler!(['repo-http-store']);
1155
-
1156
- expect(mockServices.store.create).toHaveBeenCalledWith({
1157
- name: 'repo-http-store',
1158
- type: 'repo',
1159
- path: undefined,
1160
- url: 'http://internal-git.example.com/repo',
1161
- description: undefined,
1162
- tags: undefined,
1163
- });
1164
- });
1165
-
1166
- it('routes source to url for web stores', async () => {
1167
- const mockStore: WebStore = {
1168
- id: createStoreId('store-3'),
1169
- name: 'web-store',
1170
- type: 'web',
1171
- url: 'https://example.com',
1172
- depth: 2,
1173
- createdAt: new Date(),
1174
- updatedAt: new Date(),
1175
- };
1176
-
1177
- mockServices.store.create.mockResolvedValue({
1178
- success: true,
1179
- data: mockStore,
1180
- });
1181
-
1182
- const command = createStoreCommand(getOptions);
1183
- const createCommand = command.commands.find((c) => c.name() === 'create');
1184
- const actionHandler = createCommand?._actionHandler;
1185
-
1186
- createCommand.parseOptions(['--type', 'web', '--source', 'https://example.com']);
1187
- await actionHandler!(['web-store']);
1188
-
1189
- expect(mockServices.store.create).toHaveBeenCalledWith({
1190
- name: 'web-store',
1191
- type: 'web',
1192
- path: undefined,
1193
- url: 'https://example.com',
1194
- description: undefined,
1195
- tags: undefined,
1196
- });
1197
- });
1198
- });
1199
-
1200
- describe('destroyServices cleanup on error paths', () => {
1201
- it('calls destroyServices when store info returns store not found', async () => {
1202
- mockServices.store.getByIdOrName.mockResolvedValue(undefined);
1203
-
1204
- const command = createStoreCommand(getOptions);
1205
- const infoCommand = command.commands.find((c) => c.name() === 'info');
1206
- const actionHandler = infoCommand?._actionHandler;
1207
-
1208
- await actionHandler!(['nonexistent']);
1209
-
1210
- // destroyServices should be called before setting exitCode
1211
- expect(destroyServices).toHaveBeenCalledWith(mockServices);
1212
- expect(process.exitCode).toBe(3);
1213
- process.exitCode = undefined;
1214
- });
1215
-
1216
- it('calls destroyServices when store delete returns store not found', async () => {
1217
- mockServices.store.getByIdOrName.mockResolvedValue(undefined);
1218
-
1219
- const command = createStoreCommand(getOptions);
1220
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
1221
- const actionHandler = deleteCommand?._actionHandler;
1222
-
1223
- deleteCommand.parseOptions(['--force']);
1224
- await actionHandler!(['nonexistent']);
1225
-
1226
- // destroyServices should be called before setting exitCode
1227
- expect(destroyServices).toHaveBeenCalledWith(mockServices);
1228
- expect(process.exitCode).toBe(3);
1229
- process.exitCode = undefined;
1230
- });
1231
-
1232
- it('calls destroyServices when delete requires --force in non-TTY mode', async () => {
1233
- const mockStore: FileStore = {
1234
- id: createStoreId('store-1'),
1235
- name: 'my-store',
1236
- type: 'file',
1237
- path: '/path/to/files',
1238
- createdAt: new Date(),
1239
- updatedAt: new Date(),
1240
- };
1241
-
1242
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
1243
-
1244
- // Mock non-TTY mode
1245
- const originalIsTTY = process.stdin.isTTY;
1246
- Object.defineProperty(process.stdin, 'isTTY', {
1247
- value: false,
1248
- configurable: true,
1249
- });
1250
-
1251
- const command = createStoreCommand(getOptions);
1252
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
1253
- const actionHandler = deleteCommand?._actionHandler;
1254
-
1255
- await actionHandler!(['my-store']);
1256
-
1257
- // destroyServices should be called before setting exitCode
1258
- expect(destroyServices).toHaveBeenCalledWith(mockServices);
1259
- expect(process.exitCode).toBe(1);
1260
-
1261
- // Restore
1262
- Object.defineProperty(process.stdin, 'isTTY', {
1263
- value: originalIsTTY,
1264
- configurable: true,
1265
- });
1266
- process.exitCode = undefined;
1267
- });
1268
-
1269
- it('calls destroyServices when deletion fails', async () => {
1270
- const mockStore: FileStore = {
1271
- id: createStoreId('store-1'),
1272
- name: 'locked-store',
1273
- type: 'file',
1274
- path: '/path/to/files',
1275
- createdAt: new Date(),
1276
- updatedAt: new Date(),
1277
- };
1278
-
1279
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
1280
- mockServices.store.delete.mockResolvedValue({
1281
- success: false,
1282
- error: {
1283
- message: 'Store is locked',
1284
- },
1285
- });
1286
-
1287
- const command = createStoreCommand(getOptions);
1288
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
1289
- const actionHandler = deleteCommand?._actionHandler;
1290
-
1291
- deleteCommand.parseOptions(['--force']);
1292
- await actionHandler!(['locked-store']);
1293
-
1294
- // destroyServices should be called before setting exitCode
1295
- expect(destroyServices).toHaveBeenCalledWith(mockServices);
1296
- expect(process.exitCode).toBe(1);
1297
- process.exitCode = undefined;
1298
- });
1299
-
1300
- it('calls destroyServices when user cancels delete in TTY mode', async () => {
1301
- const mockStore: FileStore = {
1302
- id: createStoreId('store-1'),
1303
- name: 'my-store',
1304
- type: 'file',
1305
- path: '/path/to/files',
1306
- createdAt: new Date(),
1307
- updatedAt: new Date(),
1308
- };
1309
-
1310
- mockServices.store.getByIdOrName.mockResolvedValue(mockStore);
1311
-
1312
- // Mock TTY mode
1313
- const originalIsTTY = process.stdin.isTTY;
1314
- Object.defineProperty(process.stdin, 'isTTY', {
1315
- value: true,
1316
- configurable: true,
1317
- });
1318
-
1319
- // Mock readline to simulate user typing 'n'
1320
- const mockReadline = {
1321
- question: vi.fn((prompt: string, callback: (answer: string) => void) => {
1322
- callback('n');
1323
- }),
1324
- close: vi.fn(),
1325
- };
1326
-
1327
- vi.doMock('node:readline', () => ({
1328
- createInterface: vi.fn(() => mockReadline),
1329
- }));
1330
-
1331
- const command = createStoreCommand(getOptions);
1332
- const deleteCommand = command.commands.find((c) => c.name() === 'delete');
1333
- const actionHandler = deleteCommand?._actionHandler;
1334
-
1335
- await actionHandler!(['my-store']);
1336
-
1337
- // destroyServices should be called even for user cancellation
1338
- expect(destroyServices).toHaveBeenCalledWith(mockServices);
1339
- // exitCode stays undefined (0) for user-initiated cancellation
1340
- expect(process.exitCode).toBeUndefined();
1341
-
1342
- // Restore
1343
- Object.defineProperty(process.stdin, 'isTTY', {
1344
- value: originalIsTTY,
1345
- configurable: true,
1346
- });
1347
- });
1348
-
1349
- it('calls destroyServices when create fails', async () => {
1350
- mockServices.store.create.mockResolvedValue({
1351
- success: false,
1352
- error: {
1353
- message: 'Store already exists',
1354
- },
1355
- });
1356
-
1357
- const command = createStoreCommand(getOptions);
1358
- const createCommand = command.commands.find((c) => c.name() === 'create');
1359
- const actionHandler = createCommand?._actionHandler;
1360
-
1361
- createCommand.parseOptions(['--type', 'file', '--source', '/path/to/files']);
1362
- await actionHandler!(['duplicate-store']);
1363
-
1364
- // destroyServices should be called before setting exitCode
1365
- expect(destroyServices).toHaveBeenCalledWith(mockServices);
1366
- expect(process.exitCode).toBe(1);
1367
- process.exitCode = undefined;
1368
- });
1369
- });
1370
- });