ai-first-cli 1.3.1 → 1.3.5

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 (532) hide show
  1. package/.ai-dev/index.db +0 -0
  2. package/BETA_EVALUATION_REPORT.md +151 -0
  3. package/CHANGELOG.md +178 -0
  4. package/PHASE1_USER_SIMULATION.md +56 -0
  5. package/PHASE2_USER_SIMULATION.md +81 -0
  6. package/PHASE3_USER_SIMULATION.md +176 -0
  7. package/README.es.md +18 -0
  8. package/README.md +80 -1
  9. package/ai/graph/knowledge-graph.json +10 -0
  10. package/ai-context/ai_context.md +130 -0
  11. package/{test-projects/react-app/.ai-dev → ai-context}/ai_rules.md +10 -5
  12. package/ai-context/architecture.md +136 -0
  13. package/ai-context/context/features/src.json +69 -0
  14. package/ai-context/context/features/test-projects.json +69 -0
  15. package/ai-context/context/flows/App.json +17 -0
  16. package/ai-context/context/flows/DashboardPage.json +14 -0
  17. package/ai-context/context/flows/LoginPage.json +14 -0
  18. package/ai-context/context/flows/admin.json +10 -0
  19. package/ai-context/context/flows/ai-first.json +9 -0
  20. package/ai-context/context/flows/androidresources.json +11 -0
  21. package/ai-context/context/flows/auth.json +13 -0
  22. package/ai-context/context/flows/authController.json +14 -0
  23. package/ai-context/context/flows/doctor.json +9 -0
  24. package/ai-context/context/flows/entrypoints.json +9 -0
  25. package/ai-context/context/flows/explore.json +9 -0
  26. package/ai-context/context/flows/fastapiAdapter.json +14 -0
  27. package/ai-context/context/flows/fastapiadapter.json +11 -0
  28. package/ai-context/context/flows/index.json +19 -0
  29. package/ai-context/context/flows/indexer.json +9 -0
  30. package/ai-context/context/flows/indexstate.json +9 -0
  31. package/ai-context/context/flows/init.json +22 -0
  32. package/ai-context/context/flows/main.json +18 -0
  33. package/ai-context/context/flows/mainactivity.json +9 -0
  34. package/ai-context/context/flows/models.json +15 -0
  35. package/ai-context/context/flows/posts.json +15 -0
  36. package/ai-context/context/flows/repoMapper.json +20 -0
  37. package/ai-context/context/flows/repomapper.json +11 -0
  38. package/ai-context/context/flows/routes.json +15 -0
  39. package/ai-context/context/flows/serializers.json +10 -0
  40. package/ai-context/context/flows/user.json +23 -0
  41. package/ai-context/context/flows/views.json +12 -0
  42. package/{test-projects/react-app/.ai-dev → ai-context}/conventions.md +3 -2
  43. package/ai-context/dependencies.json +3360 -0
  44. package/ai-context/entrypoints.md +45 -0
  45. package/ai-context/index-state.json +196 -0
  46. package/ai-context/modules.json +901 -0
  47. package/ai-context/project.json +33 -0
  48. package/ai-context/repo_map.json +8857 -0
  49. package/ai-context/repo_map.md +2002 -0
  50. package/{test-projects/flask-app/.ai-dev → ai-context}/schema.json +1 -1
  51. package/ai-context/summary.md +46 -0
  52. package/ai-context/symbols.json +82467 -0
  53. package/{test-projects/react-app/.ai-dev → ai-context}/tech_stack.md +15 -7
  54. package/ai-context-evaluation-report-1774223059505.md +206 -0
  55. package/dist/analyzers/architecture.d.ts.map +1 -1
  56. package/dist/analyzers/architecture.js +6 -0
  57. package/dist/analyzers/architecture.js.map +1 -1
  58. package/dist/analyzers/entrypoints.d.ts.map +1 -1
  59. package/dist/analyzers/entrypoints.js +105 -0
  60. package/dist/analyzers/entrypoints.js.map +1 -1
  61. package/dist/analyzers/symbols.d.ts.map +1 -1
  62. package/dist/analyzers/symbols.js +72 -1
  63. package/dist/analyzers/symbols.js.map +1 -1
  64. package/dist/analyzers/techStack.d.ts +8 -0
  65. package/dist/analyzers/techStack.d.ts.map +1 -1
  66. package/dist/analyzers/techStack.js +75 -0
  67. package/dist/analyzers/techStack.js.map +1 -1
  68. package/dist/scripts/ai-context-evaluator.js +367 -0
  69. package/package.json +1 -1
  70. package/quick-evaluation-report-1774396002305.md +64 -0
  71. package/quick-evaluator.ts +200 -0
  72. package/scripts/ai-context-evaluator.ts +440 -0
  73. package/src/analyzers/architecture.ts +8 -0
  74. package/src/analyzers/entrypoints.ts +115 -0
  75. package/src/analyzers/symbols.ts +77 -1
  76. package/src/analyzers/techStack.ts +93 -0
  77. package/tests/apex-parser.test.ts +193 -0
  78. package/tests/cli-commands-batch1.test.ts +808 -0
  79. package/tests/cli-commands-batch2.test.ts +1113 -0
  80. package/tests/cli-commands-batch3.test.ts +1128 -0
  81. package/tests/cli-index.test.ts +1007 -0
  82. package/tests/cli-init.test.ts +761 -0
  83. package/tests/salesforce-apex-classes.test.ts +713 -0
  84. package/tests/salesforce-apex-triggers.test.ts +871 -0
  85. package/tests/salesforce-custom-objects.test.ts +918 -0
  86. package/tests/salesforce-flows.test.ts +710 -0
  87. package/tests/salesforce-lwc.test.ts +963 -0
  88. package/tests/salesforce-sfdx-integration.test.ts +1125 -0
  89. package/ANALISIS_COMPLETO.md +0 -424
  90. package/ANALISIS_MEJORAS.md +0 -327
  91. package/CONTRIBUTING.md +0 -89
  92. package/FLOW.md +0 -129
  93. package/TEST_RESULTS.md +0 -198
  94. package/TEST_RESULTS_COMPARATIVE.md +0 -159
  95. package/TEST_RESULTS_COMPLETE.md +0 -127
  96. package/TEST_RESULTS_COMPREHENSIVE.md +0 -208
  97. package/install.sh +0 -188
  98. package/run-all-tests.sh +0 -184
  99. package/test-ai-context-understanding.sh +0 -21
  100. package/test-projects/django-app/.ai-dev/ai_context.md +0 -92
  101. package/test-projects/django-app/.ai-dev/ai_rules.md +0 -47
  102. package/test-projects/django-app/.ai-dev/architecture.md +0 -57
  103. package/test-projects/django-app/.ai-dev/cache.json +0 -169
  104. package/test-projects/django-app/.ai-dev/context/flows/views.json +0 -10
  105. package/test-projects/django-app/.ai-dev/conventions.md +0 -51
  106. package/test-projects/django-app/.ai-dev/dependencies.json +0 -312
  107. package/test-projects/django-app/.ai-dev/entrypoints.md +0 -4
  108. package/test-projects/django-app/.ai-dev/files.json +0 -209
  109. package/test-projects/django-app/.ai-dev/graph/knowledge-graph.json +0 -36
  110. package/test-projects/django-app/.ai-dev/graph/module-graph.json +0 -145
  111. package/test-projects/django-app/.ai-dev/graph/symbol-graph.json +0 -1488
  112. package/test-projects/django-app/.ai-dev/graph/symbol-references.json +0 -1
  113. package/test-projects/django-app/.ai-dev/index-state.json +0 -294
  114. package/test-projects/django-app/.ai-dev/modules.json +0 -35
  115. package/test-projects/django-app/.ai-dev/project.json +0 -11
  116. package/test-projects/django-app/.ai-dev/repo_map.json +0 -412
  117. package/test-projects/django-app/.ai-dev/repo_map.md +0 -105
  118. package/test-projects/django-app/.ai-dev/schema.json +0 -5
  119. package/test-projects/django-app/.ai-dev/summary.md +0 -15
  120. package/test-projects/django-app/.ai-dev/symbols.json +0 -1
  121. package/test-projects/django-app/.ai-dev/tech_stack.md +0 -32
  122. package/test-projects/django-app/README.md +0 -91
  123. package/test-projects/django-app/blog/__init__.py +0 -0
  124. package/test-projects/django-app/blog/admin.py +0 -31
  125. package/test-projects/django-app/blog/models.py +0 -55
  126. package/test-projects/django-app/blog/serializers.py +0 -69
  127. package/test-projects/django-app/blog/urls.py +0 -14
  128. package/test-projects/django-app/blog/views.py +0 -96
  129. package/test-projects/django-app/django_app/__init__.py +0 -0
  130. package/test-projects/django-app/django_app/settings.py +0 -90
  131. package/test-projects/django-app/django_app/urls.py +0 -11
  132. package/test-projects/django-app/django_app/wsgi.py +0 -9
  133. package/test-projects/django-app/manage.py +0 -23
  134. package/test-projects/django-app/requirements.txt +0 -3
  135. package/test-projects/django-app/users/__init__.py +0 -0
  136. package/test-projects/django-app/users/admin.py +0 -42
  137. package/test-projects/django-app/users/models.py +0 -54
  138. package/test-projects/django-app/users/serializers.py +0 -113
  139. package/test-projects/django-app/users/urls.py +0 -13
  140. package/test-projects/django-app/users/views.py +0 -135
  141. package/test-projects/express-api/.ai-dev/ai_context.md +0 -112
  142. package/test-projects/express-api/.ai-dev/ai_rules.md +0 -50
  143. package/test-projects/express-api/.ai-dev/architecture.md +0 -62
  144. package/test-projects/express-api/.ai-dev/context/features/controllers.json +0 -13
  145. package/test-projects/express-api/.ai-dev/context/features/services.json +0 -13
  146. package/test-projects/express-api/.ai-dev/context/flows/auth.json +0 -12
  147. package/test-projects/express-api/.ai-dev/context/flows/user.json +0 -13
  148. package/test-projects/express-api/.ai-dev/conventions.md +0 -51
  149. package/test-projects/express-api/.ai-dev/dependencies.json +0 -54
  150. package/test-projects/express-api/.ai-dev/entrypoints.md +0 -17
  151. package/test-projects/express-api/.ai-dev/modules.json +0 -30
  152. package/test-projects/express-api/.ai-dev/project.json +0 -15
  153. package/test-projects/express-api/.ai-dev/repo_map.json +0 -100
  154. package/test-projects/express-api/.ai-dev/repo_map.md +0 -36
  155. package/test-projects/express-api/.ai-dev/schema.json +0 -5
  156. package/test-projects/express-api/.ai-dev/summary.md +0 -14
  157. package/test-projects/express-api/.ai-dev/symbols.json +0 -7
  158. package/test-projects/express-api/.ai-dev/tech_stack.md +0 -38
  159. package/test-projects/express-api/.ai-dev/tools.json +0 -10
  160. package/test-projects/express-api/controllers/authController.js +0 -32
  161. package/test-projects/express-api/controllers/userController.js +0 -51
  162. package/test-projects/express-api/index.js +0 -30
  163. package/test-projects/express-api/middleware/authMiddleware.js +0 -30
  164. package/test-projects/express-api/models/userRepository.js +0 -25
  165. package/test-projects/express-api/package.json +0 -18
  166. package/test-projects/express-api/services/authService.js +0 -17
  167. package/test-projects/express-api/services/userService.js +0 -28
  168. package/test-projects/fastapi-app/.ai-dev/ai_context.md +0 -89
  169. package/test-projects/fastapi-app/.ai-dev/ai_rules.md +0 -47
  170. package/test-projects/fastapi-app/.ai-dev/architecture.md +0 -39
  171. package/test-projects/fastapi-app/.ai-dev/cache.json +0 -125
  172. package/test-projects/fastapi-app/.ai-dev/conventions.md +0 -51
  173. package/test-projects/fastapi-app/.ai-dev/dependencies.json +0 -244
  174. package/test-projects/fastapi-app/.ai-dev/entrypoints.md +0 -4
  175. package/test-projects/fastapi-app/.ai-dev/files.json +0 -154
  176. package/test-projects/fastapi-app/.ai-dev/graph/knowledge-graph.json +0 -15
  177. package/test-projects/fastapi-app/.ai-dev/graph/module-graph.json +0 -78
  178. package/test-projects/fastapi-app/.ai-dev/graph/symbol-graph.json +0 -1724
  179. package/test-projects/fastapi-app/.ai-dev/graph/symbol-references.json +0 -51
  180. package/test-projects/fastapi-app/.ai-dev/index-state.json +0 -217
  181. package/test-projects/fastapi-app/.ai-dev/modules.json +0 -16
  182. package/test-projects/fastapi-app/.ai-dev/project.json +0 -9
  183. package/test-projects/fastapi-app/.ai-dev/repo_map.json +0 -298
  184. package/test-projects/fastapi-app/.ai-dev/repo_map.md +0 -74
  185. package/test-projects/fastapi-app/.ai-dev/schema.json +0 -5
  186. package/test-projects/fastapi-app/.ai-dev/summary.md +0 -12
  187. package/test-projects/fastapi-app/.ai-dev/symbols.json +0 -1
  188. package/test-projects/fastapi-app/.ai-dev/tech_stack.md +0 -32
  189. package/test-projects/fastapi-app/.ai-dev/tools.json +0 -10
  190. package/test-projects/fastapi-app/README.md +0 -118
  191. package/test-projects/fastapi-app/app/database.py +0 -21
  192. package/test-projects/fastapi-app/app/dependencies.py +0 -107
  193. package/test-projects/fastapi-app/app/main.py +0 -47
  194. package/test-projects/fastapi-app/app/models.py +0 -149
  195. package/test-projects/fastapi-app/app/routers/auth.py +0 -117
  196. package/test-projects/fastapi-app/app/routers/posts.py +0 -272
  197. package/test-projects/fastapi-app/app/schemas.py +0 -191
  198. package/test-projects/fastapi-app/requirements.txt +0 -10
  199. package/test-projects/flask-app/.ai-dev/ai_context.md +0 -94
  200. package/test-projects/flask-app/.ai-dev/ai_rules.md +0 -47
  201. package/test-projects/flask-app/.ai-dev/architecture.md +0 -49
  202. package/test-projects/flask-app/.ai-dev/cache.json +0 -157
  203. package/test-projects/flask-app/.ai-dev/context/features/app.json +0 -25
  204. package/test-projects/flask-app/.ai-dev/context/flows/routes.json +0 -14
  205. package/test-projects/flask-app/.ai-dev/conventions.md +0 -51
  206. package/test-projects/flask-app/.ai-dev/dependencies.json +0 -298
  207. package/test-projects/flask-app/.ai-dev/entrypoints.md +0 -4
  208. package/test-projects/flask-app/.ai-dev/files.json +0 -194
  209. package/test-projects/flask-app/.ai-dev/graph/knowledge-graph.json +0 -60
  210. package/test-projects/flask-app/.ai-dev/graph/module-graph.json +0 -95
  211. package/test-projects/flask-app/.ai-dev/graph/symbol-graph.json +0 -1448
  212. package/test-projects/flask-app/.ai-dev/graph/symbol-references.json +0 -45
  213. package/test-projects/flask-app/.ai-dev/index-state.json +0 -273
  214. package/test-projects/flask-app/.ai-dev/modules.json +0 -21
  215. package/test-projects/flask-app/.ai-dev/project.json +0 -13
  216. package/test-projects/flask-app/.ai-dev/repo_map.json +0 -400
  217. package/test-projects/flask-app/.ai-dev/repo_map.md +0 -98
  218. package/test-projects/flask-app/.ai-dev/summary.md +0 -13
  219. package/test-projects/flask-app/.ai-dev/symbols.json +0 -1
  220. package/test-projects/flask-app/.ai-dev/tech_stack.md +0 -32
  221. package/test-projects/flask-app/.ai-dev/tools.json +0 -10
  222. package/test-projects/flask-app/README.md +0 -129
  223. package/test-projects/flask-app/app/__init__.py +0 -46
  224. package/test-projects/flask-app/app/api/__init__.py +0 -7
  225. package/test-projects/flask-app/app/api/routes.py +0 -122
  226. package/test-projects/flask-app/app/auth/__init__.py +0 -7
  227. package/test-projects/flask-app/app/auth/forms.py +0 -52
  228. package/test-projects/flask-app/app/auth/routes.py +0 -68
  229. package/test-projects/flask-app/app/blog/__init__.py +0 -7
  230. package/test-projects/flask-app/app/blog/forms.py +0 -35
  231. package/test-projects/flask-app/app/blog/routes.py +0 -140
  232. package/test-projects/flask-app/app/main/__init__.py +0 -7
  233. package/test-projects/flask-app/app/main/routes.py +0 -88
  234. package/test-projects/flask-app/app/models.py +0 -177
  235. package/test-projects/flask-app/config.py +0 -64
  236. package/test-projects/flask-app/requirements.txt +0 -10
  237. package/test-projects/laravel-app/.ai-dev/ai_context.md +0 -97
  238. package/test-projects/laravel-app/.ai-dev/ai_rules.md +0 -47
  239. package/test-projects/laravel-app/.ai-dev/architecture.md +0 -60
  240. package/test-projects/laravel-app/.ai-dev/cache.json +0 -161
  241. package/test-projects/laravel-app/.ai-dev/context/features/app.json +0 -21
  242. package/test-projects/laravel-app/.ai-dev/context/flows/.json +0 -9
  243. package/test-projects/laravel-app/.ai-dev/context/flows/category.json +0 -12
  244. package/test-projects/laravel-app/.ai-dev/context/flows/comment.json +0 -12
  245. package/test-projects/laravel-app/.ai-dev/context/flows/post.json +0 -12
  246. package/test-projects/laravel-app/.ai-dev/context/flows/unnamed.json +0 -9
  247. package/test-projects/laravel-app/.ai-dev/conventions.md +0 -51
  248. package/test-projects/laravel-app/.ai-dev/dependencies.json +0 -6
  249. package/test-projects/laravel-app/.ai-dev/entrypoints.md +0 -4
  250. package/test-projects/laravel-app/.ai-dev/files.json +0 -199
  251. package/test-projects/laravel-app/.ai-dev/graph/knowledge-graph.json +0 -98
  252. package/test-projects/laravel-app/.ai-dev/graph/module-graph.json +0 -30
  253. package/test-projects/laravel-app/.ai-dev/graph/symbol-graph.json +0 -5
  254. package/test-projects/laravel-app/.ai-dev/graph/symbol-references.json +0 -1
  255. package/test-projects/laravel-app/.ai-dev/index-state.json +0 -280
  256. package/test-projects/laravel-app/.ai-dev/modules.json +0 -29
  257. package/test-projects/laravel-app/.ai-dev/project.json +0 -17
  258. package/test-projects/laravel-app/.ai-dev/repo_map.json +0 -419
  259. package/test-projects/laravel-app/.ai-dev/repo_map.md +0 -106
  260. package/test-projects/laravel-app/.ai-dev/schema.json +0 -5
  261. package/test-projects/laravel-app/.ai-dev/summary.md +0 -15
  262. package/test-projects/laravel-app/.ai-dev/symbols.json +0 -1
  263. package/test-projects/laravel-app/.ai-dev/tech_stack.md +0 -34
  264. package/test-projects/laravel-app/.ai-dev/tools.json +0 -10
  265. package/test-projects/laravel-app/README.md +0 -107
  266. package/test-projects/laravel-app/app/Http/Controllers/Api/CategoryController.php +0 -88
  267. package/test-projects/laravel-app/app/Http/Controllers/Api/CommentController.php +0 -56
  268. package/test-projects/laravel-app/app/Http/Controllers/Api/PostController.php +0 -174
  269. package/test-projects/laravel-app/app/Http/Controllers/Controller.php +0 -12
  270. package/test-projects/laravel-app/app/Models/Category.php +0 -34
  271. package/test-projects/laravel-app/app/Models/Comment.php +0 -51
  272. package/test-projects/laravel-app/app/Models/Post.php +0 -108
  273. package/test-projects/laravel-app/app/Models/User.php +0 -85
  274. package/test-projects/laravel-app/bootstrap/app.php +0 -25
  275. package/test-projects/laravel-app/composer.json +0 -35
  276. package/test-projects/laravel-app/routes/api.php +0 -40
  277. package/test-projects/nestjs-backend/.ai-dev/ai_context.md +0 -111
  278. package/test-projects/nestjs-backend/.ai-dev/ai_rules.md +0 -52
  279. package/test-projects/nestjs-backend/.ai-dev/architecture.md +0 -49
  280. package/test-projects/nestjs-backend/.ai-dev/cache.json +0 -169
  281. package/test-projects/nestjs-backend/.ai-dev/context/features/src.json +0 -23
  282. package/test-projects/nestjs-backend/.ai-dev/context/flows/auth.controller.json +0 -14
  283. package/test-projects/nestjs-backend/.ai-dev/context/flows/auth.json +0 -10
  284. package/test-projects/nestjs-backend/.ai-dev/context/flows/users..json +0 -10
  285. package/test-projects/nestjs-backend/.ai-dev/context/flows/users.controller.json +0 -14
  286. package/test-projects/nestjs-backend/.ai-dev/context/flows/users.json +0 -10
  287. package/test-projects/nestjs-backend/.ai-dev/conventions.md +0 -52
  288. package/test-projects/nestjs-backend/.ai-dev/dependencies.json +0 -152
  289. package/test-projects/nestjs-backend/.ai-dev/entrypoints.md +0 -18
  290. package/test-projects/nestjs-backend/.ai-dev/files.json +0 -209
  291. package/test-projects/nestjs-backend/.ai-dev/graph/knowledge-graph.json +0 -132
  292. package/test-projects/nestjs-backend/.ai-dev/graph/module-graph.json +0 -29
  293. package/test-projects/nestjs-backend/.ai-dev/graph/symbol-graph.json +0 -304
  294. package/test-projects/nestjs-backend/.ai-dev/graph/symbol-references.json +0 -5
  295. package/test-projects/nestjs-backend/.ai-dev/index-state.json +0 -294
  296. package/test-projects/nestjs-backend/.ai-dev/modules.json +0 -19
  297. package/test-projects/nestjs-backend/.ai-dev/project.json +0 -18
  298. package/test-projects/nestjs-backend/.ai-dev/repo_map.json +0 -427
  299. package/test-projects/nestjs-backend/.ai-dev/repo_map.md +0 -104
  300. package/test-projects/nestjs-backend/.ai-dev/schema.json +0 -5
  301. package/test-projects/nestjs-backend/.ai-dev/summary.md +0 -13
  302. package/test-projects/nestjs-backend/.ai-dev/symbols.json +0 -1
  303. package/test-projects/nestjs-backend/.ai-dev/tech_stack.md +0 -38
  304. package/test-projects/nestjs-backend/.ai-dev/tools.json +0 -10
  305. package/test-projects/nestjs-backend/package.json +0 -22
  306. package/test-projects/nestjs-backend/src/app.module.ts +0 -8
  307. package/test-projects/nestjs-backend/src/auth/auth.controller.ts +0 -22
  308. package/test-projects/nestjs-backend/src/auth/auth.module.ts +0 -11
  309. package/test-projects/nestjs-backend/src/auth/auth.service.ts +0 -28
  310. package/test-projects/nestjs-backend/src/auth/dto/login.dto.ts +0 -4
  311. package/test-projects/nestjs-backend/src/auth/strategies/jwt.strategy.ts +0 -18
  312. package/test-projects/nestjs-backend/src/main.ts +0 -9
  313. package/test-projects/nestjs-backend/src/users/users.controller.ts +0 -32
  314. package/test-projects/nestjs-backend/src/users/users.module.ts +0 -10
  315. package/test-projects/nestjs-backend/src/users/users.service.ts +0 -42
  316. package/test-projects/nestjs-backend/tsconfig.json +0 -21
  317. package/test-projects/python-cli/.ai-dev/ai_context.md +0 -95
  318. package/test-projects/python-cli/.ai-dev/ai_rules.md +0 -47
  319. package/test-projects/python-cli/.ai-dev/architecture.md +0 -55
  320. package/test-projects/python-cli/.ai-dev/cache.json +0 -149
  321. package/test-projects/python-cli/.ai-dev/context/features/cli.json +0 -16
  322. package/test-projects/python-cli/.ai-dev/context/flows/list_.json +0 -9
  323. package/test-projects/python-cli/.ai-dev/context/flows/remove_.json +0 -9
  324. package/test-projects/python-cli/.ai-dev/conventions.md +0 -51
  325. package/test-projects/python-cli/.ai-dev/dependencies.json +0 -66
  326. package/test-projects/python-cli/.ai-dev/entrypoints.md +0 -4
  327. package/test-projects/python-cli/.ai-dev/files.json +0 -184
  328. package/test-projects/python-cli/.ai-dev/graph/knowledge-graph.json +0 -83
  329. package/test-projects/python-cli/.ai-dev/graph/module-graph.json +0 -31
  330. package/test-projects/python-cli/.ai-dev/graph/symbol-graph.json +0 -358
  331. package/test-projects/python-cli/.ai-dev/graph/symbol-references.json +0 -11
  332. package/test-projects/python-cli/.ai-dev/index-state.json +0 -259
  333. package/test-projects/python-cli/.ai-dev/modules.json +0 -21
  334. package/test-projects/python-cli/.ai-dev/project.json +0 -15
  335. package/test-projects/python-cli/.ai-dev/repo_map.json +0 -367
  336. package/test-projects/python-cli/.ai-dev/repo_map.md +0 -93
  337. package/test-projects/python-cli/.ai-dev/schema.json +0 -5
  338. package/test-projects/python-cli/.ai-dev/summary.md +0 -14
  339. package/test-projects/python-cli/.ai-dev/symbols.json +0 -1
  340. package/test-projects/python-cli/.ai-dev/tech_stack.md +0 -32
  341. package/test-projects/python-cli/.ai-dev/tools.json +0 -10
  342. package/test-projects/python-cli/__init__.py +0 -1
  343. package/test-projects/python-cli/cli/__init__.py +0 -1
  344. package/test-projects/python-cli/cli/add_command.py +0 -6
  345. package/test-projects/python-cli/cli/list_command.py +0 -7
  346. package/test-projects/python-cli/cli/remove_command.py +0 -6
  347. package/test-projects/python-cli/main.py +0 -34
  348. package/test-projects/python-cli/models/__init__.py +0 -2
  349. package/test-projects/python-cli/models/task.py +0 -19
  350. package/test-projects/python-cli/models/task_repository.py +0 -44
  351. package/test-projects/rails-app/.ai-dev/ai_context.md +0 -94
  352. package/test-projects/rails-app/.ai-dev/ai_rules.md +0 -47
  353. package/test-projects/rails-app/.ai-dev/architecture.md +0 -49
  354. package/test-projects/rails-app/.ai-dev/cache.json +0 -193
  355. package/test-projects/rails-app/.ai-dev/context/features/app.json +0 -24
  356. package/test-projects/rails-app/.ai-dev/context/features/config.json +0 -13
  357. package/test-projects/rails-app/.ai-dev/context/flows/application.json +0 -9
  358. package/test-projects/rails-app/.ai-dev/context/flows/application_.json +0 -9
  359. package/test-projects/rails-app/.ai-dev/context/flows/comments.json +0 -11
  360. package/test-projects/rails-app/.ai-dev/context/flows/comments_.json +0 -11
  361. package/test-projects/rails-app/.ai-dev/context/flows/posts.json +0 -11
  362. package/test-projects/rails-app/.ai-dev/context/flows/posts_.json +0 -11
  363. package/test-projects/rails-app/.ai-dev/context/flows/routes.json +0 -9
  364. package/test-projects/rails-app/.ai-dev/context/flows/users.json +0 -11
  365. package/test-projects/rails-app/.ai-dev/context/flows/users_.json +0 -11
  366. package/test-projects/rails-app/.ai-dev/conventions.md +0 -51
  367. package/test-projects/rails-app/.ai-dev/dependencies.json +0 -6
  368. package/test-projects/rails-app/.ai-dev/entrypoints.md +0 -4
  369. package/test-projects/rails-app/.ai-dev/files.json +0 -239
  370. package/test-projects/rails-app/.ai-dev/graph/knowledge-graph.json +0 -130
  371. package/test-projects/rails-app/.ai-dev/graph/module-graph.json +0 -27
  372. package/test-projects/rails-app/.ai-dev/graph/symbol-graph.json +0 -5
  373. package/test-projects/rails-app/.ai-dev/graph/symbol-references.json +0 -1
  374. package/test-projects/rails-app/.ai-dev/index-state.json +0 -336
  375. package/test-projects/rails-app/.ai-dev/modules.json +0 -26
  376. package/test-projects/rails-app/.ai-dev/project.json +0 -22
  377. package/test-projects/rails-app/.ai-dev/repo_map.json +0 -486
  378. package/test-projects/rails-app/.ai-dev/repo_map.md +0 -117
  379. package/test-projects/rails-app/.ai-dev/schema.json +0 -5
  380. package/test-projects/rails-app/.ai-dev/summary.md +0 -13
  381. package/test-projects/rails-app/.ai-dev/symbols.json +0 -1
  382. package/test-projects/rails-app/.ai-dev/tech_stack.md +0 -32
  383. package/test-projects/rails-app/.ai-dev/tools.json +0 -10
  384. package/test-projects/rails-app/Gemfile +0 -38
  385. package/test-projects/rails-app/README.md +0 -140
  386. package/test-projects/rails-app/Rakefile +0 -8
  387. package/test-projects/rails-app/app/controllers/api/comments_controller.rb +0 -75
  388. package/test-projects/rails-app/app/controllers/api/posts_controller.rb +0 -68
  389. package/test-projects/rails-app/app/controllers/api/users_controller.rb +0 -54
  390. package/test-projects/rails-app/app/controllers/application_controller.rb +0 -31
  391. package/test-projects/rails-app/app/models/comment.rb +0 -34
  392. package/test-projects/rails-app/app/models/post.rb +0 -36
  393. package/test-projects/rails-app/app/models/user.rb +0 -28
  394. package/test-projects/rails-app/app/services/post_service.rb +0 -92
  395. package/test-projects/rails-app/app/services/user_service.rb +0 -76
  396. package/test-projects/rails-app/config/application.rb +0 -27
  397. package/test-projects/rails-app/config/environment.rb +0 -7
  398. package/test-projects/rails-app/config/routes.rb +0 -15
  399. package/test-projects/react-app/.ai-dev/ai_context.md +0 -96
  400. package/test-projects/react-app/.ai-dev/architecture.md +0 -39
  401. package/test-projects/react-app/.ai-dev/cache.json +0 -153
  402. package/test-projects/react-app/.ai-dev/context/features/src.json +0 -18
  403. package/test-projects/react-app/.ai-dev/context/flows/UsersPage.json +0 -14
  404. package/test-projects/react-app/.ai-dev/context/flows/dashboard.json +0 -9
  405. package/test-projects/react-app/.ai-dev/context/flows/login.json +0 -9
  406. package/test-projects/react-app/.ai-dev/context/flows/users.json +0 -9
  407. package/test-projects/react-app/.ai-dev/dependencies.json +0 -128
  408. package/test-projects/react-app/.ai-dev/entrypoints.md +0 -4
  409. package/test-projects/react-app/.ai-dev/files.json +0 -189
  410. package/test-projects/react-app/.ai-dev/graph/knowledge-graph.json +0 -112
  411. package/test-projects/react-app/.ai-dev/graph/module-graph.json +0 -31
  412. package/test-projects/react-app/.ai-dev/graph/symbol-graph.json +0 -868
  413. package/test-projects/react-app/.ai-dev/graph/symbol-references.json +0 -31
  414. package/test-projects/react-app/.ai-dev/index-state.json +0 -266
  415. package/test-projects/react-app/.ai-dev/modules.json +0 -17
  416. package/test-projects/react-app/.ai-dev/project.json +0 -16
  417. package/test-projects/react-app/.ai-dev/repo_map.json +0 -391
  418. package/test-projects/react-app/.ai-dev/repo_map.md +0 -94
  419. package/test-projects/react-app/.ai-dev/schema.json +0 -5
  420. package/test-projects/react-app/.ai-dev/summary.md +0 -13
  421. package/test-projects/react-app/.ai-dev/symbols.json +0 -1
  422. package/test-projects/react-app/.ai-dev/tools.json +0 -10
  423. package/test-projects/react-app/package.json +0 -16
  424. package/test-projects/react-app/src/App.tsx +0 -21
  425. package/test-projects/react-app/src/context/AuthContext.tsx +0 -41
  426. package/test-projects/react-app/src/hooks/useAuth.ts +0 -10
  427. package/test-projects/react-app/src/main.tsx +0 -10
  428. package/test-projects/react-app/src/pages/DashboardPage.tsx +0 -17
  429. package/test-projects/react-app/src/pages/LoginPage.tsx +0 -41
  430. package/test-projects/react-app/src/pages/UsersPage.tsx +0 -36
  431. package/test-projects/react-app/src/services/userService.ts +0 -37
  432. package/test-projects/salesforce-cli/.ai-dev/ai_context.md +0 -89
  433. package/test-projects/salesforce-cli/.ai-dev/ai_rules.md +0 -47
  434. package/test-projects/salesforce-cli/.ai-dev/architecture.md +0 -39
  435. package/test-projects/salesforce-cli/.ai-dev/cache.json +0 -125
  436. package/test-projects/salesforce-cli/.ai-dev/context/features/force-app.json +0 -14
  437. package/test-projects/salesforce-cli/.ai-dev/context/flows/account.json +0 -9
  438. package/test-projects/salesforce-cli/.ai-dev/context/flows/opportunity.json +0 -9
  439. package/test-projects/salesforce-cli/.ai-dev/conventions.md +0 -51
  440. package/test-projects/salesforce-cli/.ai-dev/dependencies.json +0 -6
  441. package/test-projects/salesforce-cli/.ai-dev/entrypoints.md +0 -4
  442. package/test-projects/salesforce-cli/.ai-dev/files.json +0 -154
  443. package/test-projects/salesforce-cli/.ai-dev/graph/knowledge-graph.json +0 -64
  444. package/test-projects/salesforce-cli/.ai-dev/graph/module-graph.json +0 -13
  445. package/test-projects/salesforce-cli/.ai-dev/graph/symbol-graph.json +0 -148
  446. package/test-projects/salesforce-cli/.ai-dev/graph/symbol-references.json +0 -1
  447. package/test-projects/salesforce-cli/.ai-dev/index-state.json +0 -217
  448. package/test-projects/salesforce-cli/.ai-dev/modules.json +0 -12
  449. package/test-projects/salesforce-cli/.ai-dev/project.json +0 -14
  450. package/test-projects/salesforce-cli/.ai-dev/repo_map.json +0 -328
  451. package/test-projects/salesforce-cli/.ai-dev/repo_map.md +0 -80
  452. package/test-projects/salesforce-cli/.ai-dev/schema.json +0 -5
  453. package/test-projects/salesforce-cli/.ai-dev/summary.md +0 -13
  454. package/test-projects/salesforce-cli/.ai-dev/symbols.json +0 -1
  455. package/test-projects/salesforce-cli/.ai-dev/tech_stack.md +0 -31
  456. package/test-projects/salesforce-cli/.ai-dev/tools.json +0 -10
  457. package/test-projects/salesforce-cli/.forceignore +0 -27
  458. package/test-projects/salesforce-cli/force-app/main/default/classes/AccountController.cls +0 -24
  459. package/test-projects/salesforce-cli/force-app/main/default/classes/OpportunityController.cls +0 -25
  460. package/test-projects/salesforce-cli/force-app/main/default/objects/Project__c.object.xml +0 -45
  461. package/test-projects/salesforce-cli/force-app/main/default/triggers/AccountTrigger.trigger +0 -33
  462. package/test-projects/salesforce-cli/sfdx-project.json +0 -11
  463. package/test-projects/spring-boot-app/.ai-dev/ai_context.md +0 -91
  464. package/test-projects/spring-boot-app/.ai-dev/ai_rules.md +0 -48
  465. package/test-projects/spring-boot-app/.ai-dev/architecture.md +0 -39
  466. package/test-projects/spring-boot-app/.ai-dev/cache.json +0 -173
  467. package/test-projects/spring-boot-app/.ai-dev/context/features/src.json +0 -26
  468. package/test-projects/spring-boot-app/.ai-dev/context/flows/PostController.json +0 -19
  469. package/test-projects/spring-boot-app/.ai-dev/context/flows/UserController.json +0 -19
  470. package/test-projects/spring-boot-app/.ai-dev/context/flows/comment.json +0 -11
  471. package/test-projects/spring-boot-app/.ai-dev/context/flows/post.json +0 -14
  472. package/test-projects/spring-boot-app/.ai-dev/context/flows/user.json +0 -14
  473. package/test-projects/spring-boot-app/.ai-dev/conventions.md +0 -52
  474. package/test-projects/spring-boot-app/.ai-dev/dependencies.json +0 -326
  475. package/test-projects/spring-boot-app/.ai-dev/entrypoints.md +0 -4
  476. package/test-projects/spring-boot-app/.ai-dev/files.json +0 -214
  477. package/test-projects/spring-boot-app/.ai-dev/graph/knowledge-graph.json +0 -231
  478. package/test-projects/spring-boot-app/.ai-dev/graph/module-graph.json +0 -22
  479. package/test-projects/spring-boot-app/.ai-dev/graph/symbol-graph.json +0 -794
  480. package/test-projects/spring-boot-app/.ai-dev/graph/symbol-references.json +0 -70
  481. package/test-projects/spring-boot-app/.ai-dev/index-state.json +0 -301
  482. package/test-projects/spring-boot-app/.ai-dev/modules.json +0 -21
  483. package/test-projects/spring-boot-app/.ai-dev/project.json +0 -17
  484. package/test-projects/spring-boot-app/.ai-dev/repo_map.json +0 -461
  485. package/test-projects/spring-boot-app/.ai-dev/repo_map.md +0 -109
  486. package/test-projects/spring-boot-app/.ai-dev/schema.json +0 -5
  487. package/test-projects/spring-boot-app/.ai-dev/summary.md +0 -12
  488. package/test-projects/spring-boot-app/.ai-dev/symbols.json +0 -1
  489. package/test-projects/spring-boot-app/.ai-dev/tech_stack.md +0 -32
  490. package/test-projects/spring-boot-app/.ai-dev/tools.json +0 -10
  491. package/test-projects/spring-boot-app/.classpath +0 -57
  492. package/test-projects/spring-boot-app/.factorypath +0 -69
  493. package/test-projects/spring-boot-app/.project +0 -34
  494. package/test-projects/spring-boot-app/.settings/org.eclipse.core.resources.prefs +0 -4
  495. package/test-projects/spring-boot-app/.settings/org.eclipse.jdt.apt.core.prefs +0 -4
  496. package/test-projects/spring-boot-app/.settings/org.eclipse.jdt.core.prefs +0 -10
  497. package/test-projects/spring-boot-app/.settings/org.eclipse.m2e.core.prefs +0 -4
  498. package/test-projects/spring-boot-app/README.md +0 -122
  499. package/test-projects/spring-boot-app/pom.xml +0 -79
  500. package/test-projects/spring-boot-app/src/main/java/com/example/demo/DemoApplication.java +0 -12
  501. package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/CommentController.java +0 -89
  502. package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/PostController.java +0 -92
  503. package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/UserController.java +0 -84
  504. package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/Comment.java +0 -38
  505. package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/Post.java +0 -56
  506. package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/User.java +0 -44
  507. package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/CommentRepository.java +0 -21
  508. package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/PostRepository.java +0 -18
  509. package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/UserRepository.java +0 -15
  510. package/test-projects/spring-boot-app/src/main/java/com/example/demo/services/PostService.java +0 -83
  511. package/test-projects/spring-boot-app/src/main/java/com/example/demo/services/UserService.java +0 -62
  512. package/test-projects/spring-boot-app/src/main/resources/application.properties +0 -22
  513. package/test-projects/spring-boot-app/target/classes/com/example/demo/DemoApplication.class +0 -0
  514. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController$CommentCreateRequest.class +0 -0
  515. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController$CommentUpdateRequest.class +0 -0
  516. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController.class +0 -0
  517. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController$PostCreateRequest.class +0 -0
  518. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController$PostUpdateRequest.class +0 -0
  519. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController.class +0 -0
  520. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController$UserCreateRequest.class +0 -0
  521. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController$UserUpdateRequest.class +0 -0
  522. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController.class +0 -0
  523. package/test-projects/spring-boot-app/target/classes/com/example/demo/models/Comment.class +0 -0
  524. package/test-projects/spring-boot-app/target/classes/com/example/demo/models/Post.class +0 -0
  525. package/test-projects/spring-boot-app/target/classes/com/example/demo/models/User.class +0 -0
  526. package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/CommentRepository.class +0 -0
  527. package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/PostRepository.class +0 -0
  528. package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/UserRepository.class +0 -0
  529. package/test-projects/spring-boot-app/target/classes/com/example/demo/services/PostService.class +0 -0
  530. package/test-projects/spring-boot-app/target/classes/com/example/demo/services/UserService.class +0 -0
  531. package/tests/e2e/run-e2e.sh +0 -88
  532. /package/{test-projects/django-app/.ai-dev → ai-context}/tools.json +0 -0
@@ -0,0 +1,808 @@
1
+ import { describe, it, expect, beforeAll, afterAll } from "vitest";
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import os from "os";
5
+ import { spawn } from "child_process";
6
+
7
+ const PROJECT_ROOT = process.cwd();
8
+ const CLI_PATH = path.join(PROJECT_ROOT, "dist/commands/ai-first.js");
9
+ const EXPRESS_API_PATH = path.join(PROJECT_ROOT, "test-projects/express-api");
10
+
11
+ function createTempProjectDir(files: Record<string, string>): string {
12
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "cli-batch1-test-"));
13
+ for (const [filePath, content] of Object.entries(files)) {
14
+ const fullPath = path.join(tempDir, filePath);
15
+ const dir = path.dirname(fullPath);
16
+ if (!fs.existsSync(dir)) {
17
+ fs.mkdirSync(dir, { recursive: true });
18
+ }
19
+ fs.writeFileSync(fullPath, content);
20
+ }
21
+ return tempDir;
22
+ }
23
+
24
+ async function runCLICommand(
25
+ command: string,
26
+ args: string[],
27
+ cwd: string = process.cwd(),
28
+ timeoutMs: number = 60000
29
+ ): Promise<{ stdout: string; stderr: string; exitCode: number }> {
30
+ return new Promise((resolve) => {
31
+ const child = spawn("node", [CLI_PATH, command, ...args], {
32
+ cwd,
33
+ stdio: "pipe",
34
+ });
35
+
36
+ let stdout = "";
37
+ let stderr = "";
38
+
39
+ child.stdout?.on("data", (data) => {
40
+ stdout += data.toString();
41
+ });
42
+
43
+ child.stderr?.on("data", (data) => {
44
+ stderr += data.toString();
45
+ });
46
+
47
+ child.on("close", (code) => {
48
+ resolve({
49
+ stdout,
50
+ stderr,
51
+ exitCode: code ?? 0,
52
+ });
53
+ });
54
+
55
+ child.on("error", (err) => {
56
+ stderr += err.message;
57
+ resolve({ stdout, stderr, exitCode: 1 });
58
+ });
59
+
60
+ setTimeout(() => {
61
+ child.kill();
62
+ resolve({ stdout, stderr, exitCode: 124 });
63
+ }, timeoutMs);
64
+ });
65
+ }
66
+
67
+ async function runIndexCommand(
68
+ args: string[],
69
+ cwd: string = process.cwd()
70
+ ): Promise<{ stdout: string; stderr: string; exitCode: number }> {
71
+ return runCLICommand("index", args, cwd, 120000);
72
+ }
73
+
74
+ describe("CLI Commands Batch 1 - watch, context, summarize, query", () => {
75
+ const tempDirs: string[] = [];
76
+
77
+ beforeAll(() => {
78
+ if (!fs.existsSync(CLI_PATH)) {
79
+ throw new Error(`CLI not found at ${CLI_PATH}. Run 'npm run build' first.`);
80
+ }
81
+ });
82
+
83
+ afterAll(() => {
84
+ for (const dir of tempDirs) {
85
+ fs.rmSync(dir, { recursive: true, force: true });
86
+ }
87
+ });
88
+
89
+ describe("Watch Command", () => {
90
+ it("should show watch help with --help flag", async () => {
91
+ const result = await runCLICommand("watch", ["--help"], process.cwd());
92
+ expect(result.exitCode).toBe(0);
93
+ expect(result.stdout).toContain("ai-first watch");
94
+ expect(result.stdout).toContain("--root");
95
+ expect(result.stdout).toContain("--output");
96
+ expect(result.stdout).toContain("--debounce");
97
+ });
98
+
99
+ it("should start watch mode and initialize indexer", async () => {
100
+ const testProject = createTempProjectDir({
101
+ "index.js": "const app = require('./app');",
102
+ "package.json": '{"name": "watch-test"}',
103
+ "src/main.ts": "export const main = () => {};",
104
+ });
105
+ tempDirs.push(testProject);
106
+
107
+ const watchPromise = runCLICommand("watch", [], testProject, 5000);
108
+ await new Promise((resolve) => setTimeout(resolve, 2000));
109
+ const result = await watchPromise;
110
+ expect(result.exitCode).toBe(1);
111
+ const output = result.stdout + result.stderr;
112
+ expect(output.includes("incremental indexer") || output.includes("watch")).toBe(true);
113
+ });
114
+
115
+ it("should accept --debounce flag", async () => {
116
+ const testProject = createTempProjectDir({
117
+ "index.js": "const app = require('./app');",
118
+ "package.json": '{"name": "watch-test"}',
119
+ });
120
+ tempDirs.push(testProject);
121
+
122
+ const watchPromise = runCLICommand("watch", ["--debounce", "500"], testProject, 3000);
123
+ await new Promise((resolve) => setTimeout(resolve, 1500));
124
+ const result = await watchPromise;
125
+ expect(result.exitCode).toBe(1);
126
+ });
127
+
128
+ it("should handle --root flag", async () => {
129
+ const testProject = createTempProjectDir({
130
+ "index.js": "const app = require('./app');",
131
+ "package.json": '{"name": "watch-root-test"}',
132
+ });
133
+ tempDirs.push(testProject);
134
+
135
+ const watchPromise = runCLICommand("watch", ["--root", testProject], testProject, 3000);
136
+ await new Promise((resolve) => setTimeout(resolve, 1500));
137
+ const result = await watchPromise;
138
+ expect(result.exitCode).toBe(1);
139
+ });
140
+
141
+ it("should handle --output flag", async () => {
142
+ const testProject = createTempProjectDir({
143
+ "index.js": "const app = require('./app');",
144
+ "package.json": '{"name": "watch-output-test"}',
145
+ });
146
+ tempDirs.push(testProject);
147
+
148
+ const customOutput = path.join(testProject, "custom", "index.db");
149
+ const watchPromise = runCLICommand("watch", ["--output", customOutput], testProject, 3000);
150
+ await new Promise((resolve) => setTimeout(resolve, 1500));
151
+ const result = await watchPromise;
152
+ expect(result.exitCode).toBe(1);
153
+ });
154
+ });
155
+
156
+ describe("Context Command", () => {
157
+ describe("Help and Options", () => {
158
+ it("should show context help with --help flag", async () => {
159
+ const result = await runCLICommand("context", ["--help"], process.cwd());
160
+ expect(result.exitCode).toBe(0);
161
+ expect(result.stdout).toContain("ai-first context");
162
+ expect(result.stdout).toContain("--root");
163
+ expect(result.stdout).toContain("--output");
164
+ expect(result.stdout).toContain("--depth");
165
+ expect(result.stdout).toContain("--format");
166
+ });
167
+
168
+ it("should list all context options in help", async () => {
169
+ const result = await runCLICommand("context", ["--help"], process.cwd());
170
+ expect(result.stdout).toContain("--max-symbols");
171
+ expect(result.stdout).toContain("--save");
172
+ expect(result.stdout).toContain("json");
173
+ expect(result.stdout).toContain("markdown");
174
+ expect(result.stdout).toContain("text");
175
+ });
176
+ });
177
+
178
+ describe("Generate AI Context (without symbol)", () => {
179
+ it("should generate AI context without symbol argument", async () => {
180
+ const testProject = createTempProjectDir({
181
+ "index.js": "const app = require('./app');",
182
+ "package.json": '{"name": "context-test"}',
183
+ "src/main.ts": "export const main = () => {};",
184
+ });
185
+ tempDirs.push(testProject);
186
+
187
+ const result = await runCLICommand("context", [], testProject);
188
+ expect(result.exitCode).toBe(0);
189
+ expect(result.stdout).toMatch(/Generating AI context|AI Context generated/);
190
+ });
191
+
192
+ it("should create ai-context directory with context files", async () => {
193
+ const testProject = createTempProjectDir({
194
+ "index.js": "const app = require('./app');",
195
+ "package.json": '{"name": "context-files-test"}',
196
+ });
197
+ tempDirs.push(testProject);
198
+
199
+ await runCLICommand("context", [], testProject);
200
+
201
+ const aiContextDir = path.join(testProject, "ai-context");
202
+ expect(fs.existsSync(aiContextDir)).toBe(true);
203
+ });
204
+
205
+ it("should handle --root flag", async () => {
206
+ const testProject = createTempProjectDir({
207
+ "index.js": "const app = require('./app');",
208
+ "package.json": '{"name": "context-root-test"}',
209
+ });
210
+ tempDirs.push(testProject);
211
+
212
+ const result = await runCLICommand("context", ["--root", testProject], testProject);
213
+ expect(result.exitCode).toBe(0);
214
+ });
215
+
216
+ it("should handle --output flag", async () => {
217
+ const testProject = createTempProjectDir({
218
+ "index.js": "const app = require('./app');",
219
+ "package.json": '{"name": "context-output-test"}',
220
+ });
221
+ tempDirs.push(testProject);
222
+
223
+ const customOutput = path.join(testProject, "custom-context");
224
+
225
+ const result = await runCLICommand("context", ["--output", customOutput], testProject);
226
+ expect(result.exitCode).toBe(0);
227
+ expect(fs.existsSync(customOutput)).toBe(true);
228
+ });
229
+ });
230
+
231
+ describe("Symbol-specific Context", () => {
232
+ it("should require index to be created before symbol context", async () => {
233
+ const testProject = createTempProjectDir({
234
+ "index.js": "const app = require('./app');",
235
+ "package.json": '{"name": "symbol-context-test"}',
236
+ "src/main.ts": "export const main = () => {};",
237
+ });
238
+ tempDirs.push(testProject);
239
+
240
+ await runIndexCommand([], testProject);
241
+
242
+ const result = await runCLICommand("context", ["main", "--root", testProject], testProject);
243
+ expect(result.stdout.length).toBeGreaterThan(0);
244
+ });
245
+
246
+ it("should accept --depth flag for symbol context", async () => {
247
+ const testProject = createTempProjectDir({
248
+ "index.js": "const app = require('./app');",
249
+ "package.json": '{"name": "depth-test"}',
250
+ "src/main.ts": "export function main() { return 1; }",
251
+ });
252
+ tempDirs.push(testProject);
253
+
254
+ await runIndexCommand([], testProject);
255
+
256
+ const result = await runCLICommand("context", ["main", "--depth", "2"], testProject);
257
+ expect(result.stdout.length).toBeGreaterThan(0);
258
+ });
259
+
260
+ it("should accept --max-symbols flag", async () => {
261
+ const testProject = createTempProjectDir({
262
+ "index.js": "const app = require('./app');",
263
+ "package.json": '{"name": "max-symbols-test"}',
264
+ "src/main.ts": "export const main = () => {};",
265
+ });
266
+ tempDirs.push(testProject);
267
+
268
+ await runIndexCommand([], testProject);
269
+
270
+ const result = await runCLICommand("context", ["main", "--max-symbols", "10"], testProject);
271
+ expect(result.stdout.length).toBeGreaterThan(0);
272
+ });
273
+
274
+ it("should accept --format json flag", async () => {
275
+ const testProject = createTempProjectDir({
276
+ "index.js": "const app = require('./app');",
277
+ "package.json": '{"name": "format-json-test"}',
278
+ "src/main.ts": "export const main = () => {};",
279
+ });
280
+ tempDirs.push(testProject);
281
+
282
+ await runIndexCommand([], testProject);
283
+
284
+ const result = await runCLICommand("context", ["main", "--format", "json"], testProject);
285
+ expect(result.stdout.length).toBeGreaterThan(0);
286
+ });
287
+
288
+ it("should accept --format markdown flag", async () => {
289
+ const testProject = createTempProjectDir({
290
+ "index.js": "const app = require('./app');",
291
+ "package.json": '{"name": "format-md-test"}',
292
+ "src/main.ts": "export const main = () => {};",
293
+ });
294
+ tempDirs.push(testProject);
295
+
296
+ await runIndexCommand([], testProject);
297
+
298
+ const result = await runCLICommand("context", ["main", "--format", "markdown"], testProject);
299
+ expect(result.stdout.length).toBeGreaterThan(0);
300
+ });
301
+
302
+ it("should accept --save flag", async () => {
303
+ const testProject = createTempProjectDir({
304
+ "index.js": "const app = require('./app');",
305
+ "package.json": '{"name": "save-flag-test"}',
306
+ "src/main.ts": "export const main = () => {};",
307
+ });
308
+ tempDirs.push(testProject);
309
+
310
+ await runIndexCommand([], testProject);
311
+
312
+ const result = await runCLICommand("context", ["main", "--save"], testProject);
313
+ expect(result.stdout.length).toBeGreaterThan(0);
314
+ });
315
+ });
316
+
317
+ describe("Error Handling", () => {
318
+ it("should handle non-existent root gracefully", async () => {
319
+ const nonExistent = path.join(os.tmpdir(), "non-existent-context");
320
+
321
+ const result = await runCLICommand("context", ["--root", nonExistent]);
322
+ expect(result.exitCode).toBeGreaterThanOrEqual(0);
323
+ });
324
+
325
+ it("should handle empty project directory", async () => {
326
+ const emptyProject = fs.mkdtempSync(path.join(os.tmpdir(), "empty-context-"));
327
+ tempDirs.push(emptyProject);
328
+
329
+ const result = await runCLICommand("context", [], emptyProject);
330
+ expect(result.exitCode).toBeGreaterThanOrEqual(0);
331
+ });
332
+ });
333
+ });
334
+
335
+ describe("Summarize Command", () => {
336
+ describe("Help and Options", () => {
337
+ it("should show summarize help with --help flag", async () => {
338
+ const result = await runCLICommand("summarize", ["--help"], process.cwd());
339
+ expect(result.exitCode).toBe(0);
340
+ expect(result.stdout).toContain("ai-first summarize");
341
+ expect(result.stdout).toContain("--root");
342
+ expect(result.stdout).toContain("--output");
343
+ });
344
+
345
+ it("should document output path in help", async () => {
346
+ const result = await runCLICommand("summarize", ["--help"], process.cwd());
347
+ expect(result.stdout).toContain("hierarchy.json");
348
+ expect(result.stdout).toContain("Output:");
349
+ });
350
+ });
351
+
352
+ describe("Generate Summary", () => {
353
+ it("should generate hierarchical summary successfully", async () => {
354
+ const testProject = createTempProjectDir({
355
+ "index.js": "const app = require('./app');",
356
+ "package.json": '{"name": "summarize-test"}',
357
+ "src/main.ts": "export const main = () => {};",
358
+ "src/utils.ts": "export const helper = () => {};",
359
+ });
360
+ tempDirs.push(testProject);
361
+
362
+ const result = await runCLICommand("summarize", [], testProject);
363
+ expect(result.exitCode).toBe(0);
364
+ expect(result.stdout).toMatch(/Hierarchy generated|Summary/);
365
+ });
366
+
367
+ it("should create hierarchy.json file", async () => {
368
+ const testProject = createTempProjectDir({
369
+ "index.js": "const app = require('./app');",
370
+ "package.json": '{"name": "hierarchy-test"}',
371
+ });
372
+ tempDirs.push(testProject);
373
+
374
+ await runCLICommand("summarize", [], testProject);
375
+
376
+ expect(fs.existsSync(path.join(testProject, "ai-context"))).toBe(true);
377
+ });
378
+
379
+ it("should handle --root flag", async () => {
380
+ const testProject = createTempProjectDir({
381
+ "index.js": "const app = require('./app');",
382
+ "package.json": '{"name": "summarize-root-test"}',
383
+ });
384
+ tempDirs.push(testProject);
385
+
386
+ const result = await runCLICommand("summarize", ["--root", testProject], testProject);
387
+ expect(result.exitCode).toBe(0);
388
+ });
389
+
390
+ it("should handle -r short flag", async () => {
391
+ const testProject = createTempProjectDir({
392
+ "index.js": "const app = require('./app');",
393
+ "package.json": '{"name": "summarize-r-test"}',
394
+ });
395
+ tempDirs.push(testProject);
396
+
397
+ const result = await runCLICommand("summarize", ["-r", testProject], testProject);
398
+ expect(result.exitCode).toBe(0);
399
+ });
400
+
401
+ it("should handle --output flag", async () => {
402
+ const testProject = createTempProjectDir({
403
+ "index.js": "const app = require('./app');",
404
+ "package.json": '{"name": "summarize-output-test"}',
405
+ });
406
+ tempDirs.push(testProject);
407
+
408
+ const customOutput = path.join(testProject, "custom-hierarchy.json");
409
+
410
+ const result = await runCLICommand("summarize", ["--output", customOutput], testProject);
411
+ expect(result.exitCode).toBe(0);
412
+ expect(fs.existsSync(customOutput)).toBe(true);
413
+ });
414
+
415
+ it("should handle -o short flag", async () => {
416
+ const testProject = createTempProjectDir({
417
+ "index.js": "const app = require('./app');",
418
+ "package.json": '{"name": "summarize-o-test"}',
419
+ });
420
+ tempDirs.push(testProject);
421
+
422
+ const customOutput = path.join(testProject, "hierarchy.json");
423
+
424
+ const result = await runCLICommand("summarize", ["-o", customOutput], testProject);
425
+ expect(result.exitCode).toBe(0);
426
+ });
427
+ });
428
+
429
+ describe("Content Validation", () => {
430
+ it("should include repository summary in output", async () => {
431
+ const testProject = createTempProjectDir({
432
+ "index.js": "const app = require('./app');",
433
+ "package.json": '{"name": "summary-content-test"}',
434
+ "src/main.ts": "export const main = () => {};",
435
+ });
436
+ tempDirs.push(testProject);
437
+
438
+ const result = await runCLICommand("summarize", [], testProject);
439
+ expect(result.exitCode).toBe(0);
440
+ expect(result.stdout).toMatch(/Repository|Folders|Files|Summary/i);
441
+ });
442
+
443
+ it("should count folders correctly", async () => {
444
+ const testProject = createTempProjectDir({
445
+ "index.js": "const app = require('./app');",
446
+ "package.json": '{"name": "folder-count-test"}',
447
+ "src/api/routes.ts": "export const routes = [];",
448
+ "src/services/user.ts": "export const userService = {};",
449
+ "src/utils/helper.ts": "export const helper = () => {};",
450
+ });
451
+ tempDirs.push(testProject);
452
+
453
+ const result = await runCLICommand("summarize", [], testProject);
454
+ expect(result.exitCode).toBe(0);
455
+ expect(result.stdout).toContain("Folders:");
456
+ });
457
+
458
+ it("should count files correctly", async () => {
459
+ const testProject = createTempProjectDir({
460
+ "package.json": '{"name": "file-count-test"}',
461
+ "src/index.ts": "export const index = 1;",
462
+ "src/app.ts": "export const app = 1;",
463
+ "src/config.ts": "export const config = 1;",
464
+ });
465
+ tempDirs.push(testProject);
466
+
467
+ const result = await runCLICommand("summarize", [], testProject);
468
+ expect(result.exitCode).toBe(0);
469
+ expect(result.stdout).toContain("Files:");
470
+ });
471
+ });
472
+
473
+ describe("Multi-Language Projects", () => {
474
+ it("should handle TypeScript project", async () => {
475
+ const tsProject = createTempProjectDir({
476
+ "package.json": '{"name": "ts-summarize"}',
477
+ "tsconfig.json": '{"compilerOptions": {}}',
478
+ "src/index.ts": "export const main = (): void => {};",
479
+ "src/app.ts": "export class App {}",
480
+ });
481
+ tempDirs.push(tsProject);
482
+
483
+ const result = await runCLICommand("summarize", [], tsProject);
484
+ expect(result.exitCode).toBe(0);
485
+ });
486
+
487
+ it("should handle Python project", async () => {
488
+ const pyProject = createTempProjectDir({
489
+ "main.py": "def main(): pass",
490
+ "requirements.txt": "flask==2.0.0",
491
+ "src/utils.py": "def helper(): pass",
492
+ });
493
+ tempDirs.push(pyProject);
494
+
495
+ const result = await runCLICommand("summarize", [], pyProject);
496
+ expect(result.exitCode).toBe(0);
497
+ });
498
+
499
+ it("should handle mixed language project", async () => {
500
+ const mixedProject = createTempProjectDir({
501
+ "package.json": '{"name": "mixed-summarize"}',
502
+ "index.js": "const express = require('express');",
503
+ "src/main.ts": "export const app = {};",
504
+ "src/utils.py": "def helper(): pass",
505
+ });
506
+ tempDirs.push(mixedProject);
507
+
508
+ const result = await runCLICommand("summarize", [], mixedProject);
509
+ expect(result.exitCode).toBe(0);
510
+ });
511
+ });
512
+
513
+ describe("Error Handling", () => {
514
+ it("should handle non-existent root gracefully", async () => {
515
+ const nonExistent = path.join(os.tmpdir(), "non-existent-summarize");
516
+
517
+ const result = await runCLICommand("summarize", ["--root", nonExistent]);
518
+ expect(result.exitCode).toBeGreaterThanOrEqual(0);
519
+ });
520
+
521
+ it("should handle empty project directory", async () => {
522
+ const emptyProject = fs.mkdtempSync(path.join(os.tmpdir(), "empty-summarize-"));
523
+ tempDirs.push(emptyProject);
524
+
525
+ const result = await runCLICommand("summarize", [], emptyProject);
526
+ expect(result.exitCode).toBeGreaterThanOrEqual(0);
527
+ });
528
+ });
529
+ });
530
+
531
+ describe("Query Command", () => {
532
+ async function createIndexedProject(): Promise<string> {
533
+ const testProject = createTempProjectDir({
534
+ "index.js": "const app = require('./app');",
535
+ "package.json": '{"name": "query-test"}',
536
+ "src/main.ts": "export class MyClass { myMethod() { return 1; } } export const myFunc = () => {};",
537
+ "src/utils.ts": "export const helper = () => {}; import { MyClass } from './main';",
538
+ "src/api/routes.ts": "export const routes = []; import express from 'express';",
539
+ });
540
+ tempDirs.push(testProject);
541
+
542
+ const indexResult = await runIndexCommand([], testProject);
543
+ expect(indexResult.exitCode).toBe(0);
544
+
545
+ return testProject;
546
+ }
547
+
548
+ describe("Help and Options", () => {
549
+ it("should show query help without subcommand", async () => {
550
+ const result = await runCLICommand("query", [], process.cwd());
551
+ expect(result.stdout.includes("query") || result.exitCode !== 0).toBe(true);
552
+ });
553
+
554
+ it("should show error when no index exists", async () => {
555
+ const result = await runCLICommand("query", ["stats"], process.cwd());
556
+ expect(result.exitCode).toBeGreaterThanOrEqual(1);
557
+ });
558
+
559
+ it("should accept --root flag with indexed project", async () => {
560
+ const testProject = await createIndexedProject();
561
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
562
+ expect(result.stdout.length).toBeGreaterThan(0);
563
+ });
564
+ });
565
+
566
+ describe("symbol Subcommand", () => {
567
+ it("should find symbols by name", async () => {
568
+ const testProject = await createIndexedProject();
569
+
570
+ const result = await runCLICommand("query", ["symbol", "MyClass", "--root", testProject], testProject);
571
+ expect(result.stdout.length).toBeGreaterThan(0);
572
+ });
573
+
574
+ it("should require symbol name argument", async () => {
575
+ const testProject = await createIndexedProject();
576
+
577
+ const result = await runCLICommand("query", ["symbol"], testProject);
578
+ expect(result.exitCode === 1 || result.stdout.includes("provide")).toBe(true);
579
+ });
580
+
581
+ it("should handle --root flag", async () => {
582
+ const testProject = await createIndexedProject();
583
+
584
+ const result = await runCLICommand("query", ["symbol", "func", "--root", testProject], testProject);
585
+ expect(result.stdout.length).toBeGreaterThan(0);
586
+ });
587
+
588
+ it("should handle -r short flag", async () => {
589
+ const testProject = await createIndexedProject();
590
+
591
+ const result = await runCLICommand("query", ["symbol", "helper", "-r", testProject], testProject);
592
+ expect(result.stdout.length).toBeGreaterThan(0);
593
+ });
594
+
595
+ it("should show results for existing symbol", async () => {
596
+ const testProject = await createIndexedProject();
597
+
598
+ const result = await runCLICommand("query", ["symbol", "NonExistentSymbol12345", "--root", testProject], testProject);
599
+ expect(result.stdout.length).toBeGreaterThan(0);
600
+ });
601
+ });
602
+
603
+ describe("files Subcommand", () => {
604
+ it("should list all indexed files", async () => {
605
+ const testProject = await createIndexedProject();
606
+
607
+ const result = await runCLICommand("query", ["files", "--root", testProject], testProject);
608
+ expect(result.stdout.length).toBeGreaterThan(0);
609
+ expect(result.stdout).toMatch(/Indexed files|files/);
610
+ });
611
+
612
+ it("should show file paths and languages", async () => {
613
+ const testProject = await createIndexedProject();
614
+
615
+ const result = await runCLICommand("query", ["files", "--root", testProject], testProject);
616
+ expect(result.stdout).toMatch(/File|path|\.ts|\.js|language/i);
617
+ });
618
+
619
+ it("should handle --root flag", async () => {
620
+ const testProject = await createIndexedProject();
621
+
622
+ const result = await runCLICommand("query", ["files"], testProject);
623
+ expect(result.stdout.length).toBeGreaterThan(0);
624
+ });
625
+ });
626
+
627
+ describe("stats Subcommand", () => {
628
+ it("should show index statistics", async () => {
629
+ const testProject = await createIndexedProject();
630
+
631
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
632
+ expect(result.stdout).toMatch(/Statistics|Stats|Files:/);
633
+ });
634
+
635
+ it("should show file count", async () => {
636
+ const testProject = await createIndexedProject();
637
+
638
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
639
+ expect(result.stdout).toContain("Files:");
640
+ });
641
+
642
+ it("should show symbol count", async () => {
643
+ const testProject = await createIndexedProject();
644
+
645
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
646
+ expect(result.stdout).toContain("Symbols:");
647
+ });
648
+
649
+ it("should show import count", async () => {
650
+ const testProject = await createIndexedProject();
651
+
652
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
653
+ expect(result.stdout).toContain("Imports:");
654
+ });
655
+
656
+ it("should show language breakdown", async () => {
657
+ const testProject = await createIndexedProject();
658
+
659
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
660
+ expect(result.stdout).toMatch(/Language|TypeScript|JavaScript/i);
661
+ });
662
+
663
+ it("should show symbol types breakdown", async () => {
664
+ const testProject = await createIndexedProject();
665
+
666
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
667
+ expect(result.stdout).toMatch(/Symbol Types|Type/);
668
+ });
669
+
670
+ it("should handle --root flag", async () => {
671
+ const testProject = await createIndexedProject();
672
+
673
+ const result = await runCLICommand("query", ["stats"], testProject);
674
+ expect(result.stdout.length).toBeGreaterThan(0);
675
+ });
676
+ });
677
+
678
+ describe("imports Subcommand", () => {
679
+ it("should find imports for a file", async () => {
680
+ const testProject = await createIndexedProject();
681
+
682
+ const result = await runCLICommand("query", ["imports", "main.ts", "--root", testProject], testProject);
683
+ expect(result.stdout.length).toBeGreaterThan(0);
684
+ });
685
+
686
+ it("should require file name argument", async () => {
687
+ const testProject = await createIndexedProject();
688
+
689
+ const result = await runCLICommand("query", ["imports"], testProject);
690
+ expect(result.exitCode === 1 || result.stdout.includes("provide")).toBe(true);
691
+ });
692
+
693
+ it("should handle --root flag", async () => {
694
+ const testProject = await createIndexedProject();
695
+
696
+ const result = await runCLICommand("query", ["imports", "utils.ts", "--root", testProject], testProject);
697
+ expect(result.stdout.length).toBeGreaterThan(0);
698
+ });
699
+ });
700
+
701
+ describe("exports Subcommand", () => {
702
+ it("should find exports for a file", async () => {
703
+ const testProject = await createIndexedProject();
704
+
705
+ const result = await runCLICommand("query", ["exports", "main.ts", "--root", testProject], testProject);
706
+ expect(result.stdout.length).toBeGreaterThan(0);
707
+ });
708
+
709
+ it("should require file name argument", async () => {
710
+ const testProject = await createIndexedProject();
711
+
712
+ const result = await runCLICommand("query", ["exports"], testProject);
713
+ expect(result.exitCode === 1 || result.stdout.includes("provide")).toBe(true);
714
+ });
715
+
716
+ it("should handle file with exports", async () => {
717
+ const testProject = await createIndexedProject();
718
+
719
+ const result = await runCLICommand("query", ["exports", "index.js", "--root", testProject], testProject);
720
+ expect(result.stdout.length).toBeGreaterThan(0);
721
+ });
722
+ });
723
+
724
+ describe("dependents Subcommand", () => {
725
+ it("should find files that depend on a file", async () => {
726
+ const testProject = await createIndexedProject();
727
+
728
+ const result = await runCLICommand("query", ["dependents", "main.ts", "--root", testProject], testProject);
729
+ expect(result.stdout.length).toBeGreaterThan(0);
730
+ });
731
+
732
+ it("should require file name argument", async () => {
733
+ const testProject = await createIndexedProject();
734
+
735
+ const result = await runCLICommand("query", ["dependents"], testProject);
736
+ expect(result.exitCode === 1 || result.stdout.includes("provide")).toBe(true);
737
+ });
738
+
739
+ it("should handle --root flag", async () => {
740
+ const testProject = await createIndexedProject();
741
+
742
+ const result = await runCLICommand("query", ["dependents", "utils.ts", "--root", testProject], testProject);
743
+ expect(result.stdout.length).toBeGreaterThan(0);
744
+ });
745
+ });
746
+
747
+ describe("Error Handling", () => {
748
+ it("should error when index does not exist", async () => {
749
+ const testProject = createTempProjectDir({
750
+ "index.js": "const app = require('./app');",
751
+ "package.json": '{"name": "no-index-test"}',
752
+ });
753
+ tempDirs.push(testProject);
754
+
755
+ const result = await runCLICommand("query", ["stats", "--root", testProject], testProject);
756
+ expect(result.stdout.length).toBeGreaterThan(0);
757
+ });
758
+
759
+ it("should error on unknown subcommand", async () => {
760
+ const testProject = await createIndexedProject();
761
+
762
+ const result = await runCLICommand("query", ["unknownsubcommand", "--root", testProject], testProject);
763
+ expect(result.exitCode).toBeGreaterThanOrEqual(0);
764
+ });
765
+
766
+ it("should handle non-existent root gracefully", async () => {
767
+ const nonExistent = path.join(os.tmpdir(), "non-existent-query");
768
+
769
+ const result = await runCLICommand("query", ["stats", "--root", nonExistent]);
770
+ expect(result.stdout.length).toBeGreaterThan(0);
771
+ });
772
+
773
+ it("should handle custom --db path", async () => {
774
+ const testProject = await createIndexedProject();
775
+ const customDb = path.join(testProject, "custom-index.db");
776
+
777
+ const result = await runCLICommand("query", ["stats", "--db", customDb], testProject);
778
+ expect(result.stdout.length).toBeGreaterThan(0);
779
+ });
780
+ });
781
+
782
+ describe("Real Project Integration", () => {
783
+ it("should query express-api project successfully", async () => {
784
+ const indexResult = await runIndexCommand([], EXPRESS_API_PATH);
785
+ expect(indexResult.exitCode).toBe(0);
786
+
787
+ const result = await runCLICommand("query", ["stats"], EXPRESS_API_PATH);
788
+ expect(result.exitCode).toBe(0);
789
+ expect(result.stdout).toContain("Files:");
790
+ expect(result.stdout).toContain("Symbols:");
791
+ });
792
+
793
+ it("should query files from express-api project", async () => {
794
+ await runIndexCommand([], EXPRESS_API_PATH);
795
+
796
+ const result = await runCLICommand("query", ["files"], EXPRESS_API_PATH);
797
+ expect(result.stdout.length).toBeGreaterThan(0);
798
+ });
799
+
800
+ it("should find symbols in express-api project", async () => {
801
+ await runIndexCommand([], EXPRESS_API_PATH);
802
+
803
+ const result = await runCLICommand("query", ["symbol", "app", "--root", EXPRESS_API_PATH], EXPRESS_API_PATH);
804
+ expect(result.stdout.length).toBeGreaterThan(0);
805
+ });
806
+ });
807
+ });
808
+ });