@useatlas/create 0.0.1 → 0.0.3

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 (298) hide show
  1. package/README.md +4 -18
  2. package/index.ts +191 -31
  3. package/package.json +1 -1
  4. package/templates/docker/.env.example +3 -3
  5. package/templates/docker/Dockerfile.sidecar +28 -0
  6. package/templates/docker/bin/__tests__/plugin-cli.test.ts +11 -11
  7. package/templates/docker/bin/atlas.ts +120 -56
  8. package/templates/docker/data/demo-semantic/catalog.yml +51 -27
  9. package/templates/docker/data/demo-semantic/entities/accounts.yml +95 -103
  10. package/templates/docker/data/demo-semantic/entities/companies.yml +88 -152
  11. package/templates/docker/data/demo-semantic/entities/people.yml +82 -95
  12. package/templates/docker/data/demo-semantic/glossary.yml +104 -8
  13. package/templates/docker/data/demo-semantic/metrics/accounts.yml +62 -23
  14. package/templates/docker/data/demo-semantic/metrics/companies.yml +52 -78
  15. package/templates/docker/docker-compose.yml +1 -1
  16. package/templates/docker/docs/deploy.md +4 -41
  17. package/templates/docker/package.json +17 -1
  18. package/templates/docker/semantic/catalog.yml +62 -3
  19. package/templates/docker/semantic/entities/accounts.yml +162 -0
  20. package/templates/docker/semantic/entities/companies.yml +143 -0
  21. package/templates/docker/semantic/entities/people.yml +132 -0
  22. package/templates/docker/semantic/glossary.yml +116 -4
  23. package/templates/docker/semantic/metrics/accounts.yml +77 -0
  24. package/templates/docker/semantic/metrics/companies.yml +63 -0
  25. package/templates/docker/sidecar/Dockerfile +5 -6
  26. package/templates/docker/sidecar/railway.json +1 -2
  27. package/templates/docker/src/api/__tests__/admin.test.ts +7 -7
  28. package/templates/docker/src/api/__tests__/health-plugin.test.ts +7 -0
  29. package/templates/docker/src/api/__tests__/health.test.ts +30 -8
  30. package/templates/docker/src/api/routes/admin.ts +549 -8
  31. package/templates/docker/src/api/routes/chat.ts +5 -20
  32. package/templates/docker/src/api/routes/health.ts +39 -27
  33. package/templates/docker/src/api/routes/openapi.ts +1329 -74
  34. package/templates/docker/src/api/routes/query.ts +2 -1
  35. package/templates/docker/src/api/server.ts +27 -0
  36. package/templates/docker/src/app/api/[...route]/route.ts +2 -2
  37. package/templates/docker/src/app/globals.css +13 -12
  38. package/templates/docker/src/app/layout.tsx +9 -2
  39. package/templates/docker/src/components/ui/alert-dialog.tsx +196 -0
  40. package/templates/docker/src/components/ui/badge.tsx +48 -0
  41. package/templates/docker/src/components/ui/button.tsx +64 -0
  42. package/templates/docker/src/components/ui/card.tsx +92 -0
  43. package/templates/docker/src/components/ui/collapsible.tsx +33 -0
  44. package/templates/docker/src/components/ui/command.tsx +184 -0
  45. package/templates/docker/src/components/ui/dialog.tsx +158 -0
  46. package/templates/docker/src/components/ui/dropdown-menu.tsx +257 -0
  47. package/templates/docker/src/components/ui/input.tsx +21 -0
  48. package/templates/docker/src/components/ui/scroll-area.tsx +58 -0
  49. package/templates/docker/src/components/ui/select.tsx +190 -0
  50. package/templates/docker/src/components/ui/separator.tsx +28 -0
  51. package/templates/docker/src/components/ui/sheet.tsx +143 -0
  52. package/templates/docker/src/components/ui/sidebar.tsx +726 -0
  53. package/templates/docker/src/components/ui/skeleton.tsx +13 -0
  54. package/templates/docker/src/components/ui/table.tsx +116 -0
  55. package/templates/docker/src/components/ui/tabs.tsx +91 -0
  56. package/templates/docker/src/components/ui/toggle-group.tsx +83 -0
  57. package/templates/docker/src/components/ui/toggle.tsx +47 -0
  58. package/templates/docker/src/components/ui/tooltip.tsx +57 -0
  59. package/templates/docker/src/hooks/use-mobile.ts +19 -0
  60. package/templates/docker/src/lib/__tests__/agent-cache.test.ts +2 -0
  61. package/templates/docker/src/lib/__tests__/agent-dialect.test.ts +17 -0
  62. package/templates/docker/src/lib/__tests__/agent-health-annotations.test.ts +2 -0
  63. package/templates/docker/src/lib/__tests__/agent-integration.test.ts +2 -0
  64. package/templates/docker/src/lib/__tests__/config.test.ts +69 -19
  65. package/templates/docker/src/lib/__tests__/plugin-aware-validation.test.ts +321 -0
  66. package/templates/docker/src/lib/__tests__/providers.test.ts +32 -1
  67. package/templates/docker/src/lib/__tests__/startup-actions.test.ts +9 -0
  68. package/templates/docker/src/lib/__tests__/startup-first-run.test.ts +429 -0
  69. package/templates/docker/src/lib/__tests__/startup.test.ts +5 -0
  70. package/templates/docker/src/lib/agent-query.ts +5 -23
  71. package/templates/docker/src/lib/agent.ts +32 -112
  72. package/templates/docker/src/lib/auth/__tests__/migrate.test.ts +5 -3
  73. package/templates/docker/src/lib/auth/middleware.ts +30 -4
  74. package/templates/docker/src/lib/auth/migrate.ts +97 -0
  75. package/templates/docker/src/lib/auth/server.ts +12 -1
  76. package/templates/docker/src/lib/config.ts +38 -40
  77. package/templates/docker/src/lib/db/__tests__/connection.test.ts +89 -14
  78. package/templates/docker/src/lib/db/__tests__/registry-health.test.ts +1 -18
  79. package/templates/docker/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -19
  80. package/templates/docker/src/lib/db/__tests__/registry.test.ts +11 -208
  81. package/templates/docker/src/lib/db/connection.ts +87 -265
  82. package/templates/docker/src/lib/db/internal.ts +6 -1
  83. package/templates/docker/src/lib/plugins/__tests__/hooks-integration.test.ts +3 -1
  84. package/templates/docker/src/lib/plugins/__tests__/hooks.test.ts +2 -2
  85. package/templates/docker/src/lib/plugins/__tests__/migrate.test.ts +355 -1
  86. package/templates/docker/src/lib/plugins/__tests__/registry.test.ts +32 -5
  87. package/templates/docker/src/lib/plugins/__tests__/wiring.test.ts +228 -14
  88. package/templates/docker/src/lib/plugins/index.ts +4 -1
  89. package/templates/docker/src/lib/plugins/migrate.ts +104 -1
  90. package/templates/docker/src/lib/plugins/registry.ts +14 -8
  91. package/templates/docker/src/lib/plugins/wiring.ts +113 -4
  92. package/templates/docker/src/lib/providers.ts +6 -1
  93. package/templates/docker/src/lib/security.ts +24 -0
  94. package/templates/docker/src/lib/semantic.ts +2 -0
  95. package/templates/docker/src/lib/sidecar-types.ts +12 -1
  96. package/templates/docker/src/lib/startup.ts +71 -101
  97. package/templates/docker/src/lib/tools/__tests__/custom-validation.test.ts +2 -0
  98. package/templates/docker/src/lib/tools/__tests__/explore-nsjail.test.ts +32 -18
  99. package/templates/docker/src/lib/tools/__tests__/explore-plugin.test.ts +14 -14
  100. package/templates/docker/src/lib/tools/__tests__/explore-sdk-compat.test.ts +1 -1
  101. package/templates/docker/src/lib/tools/__tests__/explore-sidecar.test.ts +5 -3
  102. package/templates/docker/src/lib/tools/__tests__/python-nsjail.test.ts +515 -0
  103. package/templates/docker/src/lib/tools/__tests__/python-sandbox.test.ts +397 -0
  104. package/templates/docker/src/lib/tools/__tests__/python-sidecar.test.ts +365 -0
  105. package/templates/docker/src/lib/tools/__tests__/python.test.ts +331 -0
  106. package/templates/docker/src/lib/tools/__tests__/registry-actions.test.ts +1 -13
  107. package/templates/docker/src/lib/tools/__tests__/registry.test.ts +38 -31
  108. package/templates/docker/src/lib/tools/__tests__/sql-audit.test.ts +2 -0
  109. package/templates/docker/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +2 -0
  110. package/templates/docker/src/lib/tools/__tests__/sql-ratelimit.test.ts +2 -0
  111. package/templates/docker/src/lib/tools/__tests__/sql.test.ts +5 -308
  112. package/templates/docker/src/lib/tools/explore-nsjail.ts +17 -12
  113. package/templates/docker/src/lib/tools/explore-sidecar.ts +25 -0
  114. package/templates/docker/src/lib/tools/explore.ts +28 -32
  115. package/templates/docker/src/lib/tools/python-nsjail.ts +396 -0
  116. package/templates/docker/src/lib/tools/python-sandbox.ts +476 -0
  117. package/templates/docker/src/lib/tools/python-sidecar.ts +150 -0
  118. package/templates/docker/src/lib/tools/python.ts +367 -0
  119. package/templates/docker/src/lib/tools/registry.ts +49 -22
  120. package/templates/docker/src/lib/tools/sql.ts +88 -88
  121. package/templates/docker/src/types/vercel-sandbox.d.ts +7 -0
  122. package/templates/docker/src/ui/components/admin/admin-layout.tsx +77 -8
  123. package/templates/docker/src/ui/components/admin/admin-sidebar.tsx +25 -17
  124. package/templates/docker/src/ui/components/admin/change-password-dialog.tsx +128 -0
  125. package/templates/docker/src/ui/components/admin/entity-detail.tsx +3 -3
  126. package/templates/docker/src/ui/components/admin/semantic-file-tree.tsx +159 -0
  127. package/templates/docker/src/ui/components/atlas-chat.tsx +64 -12
  128. package/templates/docker/src/ui/components/chart/result-chart.tsx +25 -15
  129. package/templates/docker/src/ui/components/chat/markdown.tsx +88 -42
  130. package/templates/docker/src/ui/components/chat/python-result-card.tsx +244 -0
  131. package/templates/docker/src/ui/components/chat/sql-block.tsx +39 -15
  132. package/templates/docker/src/ui/components/chat/sql-result-card.tsx +6 -1
  133. package/templates/docker/src/ui/components/chat/tool-part.tsx +12 -3
  134. package/templates/docker/src/ui/components/chat/typing-indicator.tsx +5 -2
  135. package/templates/docker/src/ui/components/conversations/conversation-item.tsx +25 -20
  136. package/templates/docker/src/ui/context.tsx +1 -1
  137. package/templates/docker/src/ui/hooks/use-conversations.ts +3 -3
  138. package/templates/docker/src/ui/hooks/use-dark-mode.ts +17 -10
  139. package/templates/docker/tsconfig.json +2 -2
  140. package/templates/nextjs-standalone/.env.example +1 -1
  141. package/templates/nextjs-standalone/bin/__tests__/plugin-cli.test.ts +11 -11
  142. package/templates/nextjs-standalone/bin/atlas.ts +120 -56
  143. package/templates/nextjs-standalone/data/demo-semantic/catalog.yml +51 -27
  144. package/templates/nextjs-standalone/data/demo-semantic/entities/accounts.yml +95 -103
  145. package/templates/nextjs-standalone/data/demo-semantic/entities/companies.yml +88 -152
  146. package/templates/nextjs-standalone/data/demo-semantic/entities/people.yml +82 -95
  147. package/templates/nextjs-standalone/data/demo-semantic/glossary.yml +104 -8
  148. package/templates/nextjs-standalone/data/demo-semantic/metrics/accounts.yml +62 -23
  149. package/templates/nextjs-standalone/data/demo-semantic/metrics/companies.yml +52 -78
  150. package/templates/nextjs-standalone/docs/deploy.md +4 -41
  151. package/templates/nextjs-standalone/package.json +11 -2
  152. package/templates/nextjs-standalone/scripts/migrate-auth.ts +25 -0
  153. package/templates/nextjs-standalone/scripts/seed-demo.ts +94 -0
  154. package/templates/nextjs-standalone/semantic/catalog.yml +62 -3
  155. package/templates/nextjs-standalone/semantic/entities/accounts.yml +162 -0
  156. package/templates/nextjs-standalone/semantic/entities/companies.yml +143 -0
  157. package/templates/nextjs-standalone/semantic/entities/people.yml +132 -0
  158. package/templates/nextjs-standalone/semantic/glossary.yml +116 -4
  159. package/templates/nextjs-standalone/semantic/metrics/accounts.yml +77 -0
  160. package/templates/nextjs-standalone/semantic/metrics/companies.yml +63 -0
  161. package/templates/nextjs-standalone/src/api/__tests__/admin.test.ts +7 -7
  162. package/templates/nextjs-standalone/src/api/__tests__/health-plugin.test.ts +7 -0
  163. package/templates/nextjs-standalone/src/api/__tests__/health.test.ts +30 -8
  164. package/templates/nextjs-standalone/src/api/routes/admin.ts +549 -8
  165. package/templates/nextjs-standalone/src/api/routes/chat.ts +5 -20
  166. package/templates/nextjs-standalone/src/api/routes/health.ts +39 -27
  167. package/templates/nextjs-standalone/src/api/routes/openapi.ts +1329 -74
  168. package/templates/nextjs-standalone/src/api/routes/query.ts +2 -1
  169. package/templates/nextjs-standalone/src/api/server.ts +27 -0
  170. package/templates/nextjs-standalone/src/app/api/[...route]/route.ts +2 -2
  171. package/templates/nextjs-standalone/src/app/globals.css +13 -12
  172. package/templates/nextjs-standalone/src/app/layout.tsx +9 -2
  173. package/templates/nextjs-standalone/src/components/ui/alert-dialog.tsx +196 -0
  174. package/templates/nextjs-standalone/src/components/ui/badge.tsx +48 -0
  175. package/templates/nextjs-standalone/src/components/ui/button.tsx +64 -0
  176. package/templates/nextjs-standalone/src/components/ui/card.tsx +92 -0
  177. package/templates/nextjs-standalone/src/components/ui/collapsible.tsx +33 -0
  178. package/templates/nextjs-standalone/src/components/ui/command.tsx +184 -0
  179. package/templates/nextjs-standalone/src/components/ui/dialog.tsx +158 -0
  180. package/templates/nextjs-standalone/src/components/ui/dropdown-menu.tsx +257 -0
  181. package/templates/nextjs-standalone/src/components/ui/input.tsx +21 -0
  182. package/templates/nextjs-standalone/src/components/ui/scroll-area.tsx +58 -0
  183. package/templates/nextjs-standalone/src/components/ui/select.tsx +190 -0
  184. package/templates/nextjs-standalone/src/components/ui/separator.tsx +28 -0
  185. package/templates/nextjs-standalone/src/components/ui/sheet.tsx +143 -0
  186. package/templates/nextjs-standalone/src/components/ui/sidebar.tsx +726 -0
  187. package/templates/nextjs-standalone/src/components/ui/skeleton.tsx +13 -0
  188. package/templates/nextjs-standalone/src/components/ui/table.tsx +116 -0
  189. package/templates/nextjs-standalone/src/components/ui/tabs.tsx +91 -0
  190. package/templates/nextjs-standalone/src/components/ui/toggle-group.tsx +83 -0
  191. package/templates/nextjs-standalone/src/components/ui/toggle.tsx +47 -0
  192. package/templates/nextjs-standalone/src/components/ui/tooltip.tsx +57 -0
  193. package/templates/nextjs-standalone/src/hooks/use-mobile.ts +19 -0
  194. package/templates/nextjs-standalone/src/lib/__tests__/agent-cache.test.ts +2 -0
  195. package/templates/nextjs-standalone/src/lib/__tests__/agent-dialect.test.ts +17 -0
  196. package/templates/nextjs-standalone/src/lib/__tests__/agent-health-annotations.test.ts +2 -0
  197. package/templates/nextjs-standalone/src/lib/__tests__/agent-integration.test.ts +2 -0
  198. package/templates/nextjs-standalone/src/lib/__tests__/config.test.ts +69 -19
  199. package/templates/nextjs-standalone/src/lib/__tests__/plugin-aware-validation.test.ts +321 -0
  200. package/templates/nextjs-standalone/src/lib/__tests__/providers.test.ts +32 -1
  201. package/templates/nextjs-standalone/src/lib/__tests__/startup-actions.test.ts +9 -0
  202. package/templates/nextjs-standalone/src/lib/__tests__/startup-first-run.test.ts +429 -0
  203. package/templates/nextjs-standalone/src/lib/__tests__/startup.test.ts +5 -0
  204. package/templates/nextjs-standalone/src/lib/agent-query.ts +5 -23
  205. package/templates/nextjs-standalone/src/lib/agent.ts +32 -112
  206. package/templates/nextjs-standalone/src/lib/auth/__tests__/migrate.test.ts +5 -3
  207. package/templates/nextjs-standalone/src/lib/auth/middleware.ts +30 -4
  208. package/templates/nextjs-standalone/src/lib/auth/migrate.ts +97 -0
  209. package/templates/nextjs-standalone/src/lib/auth/server.ts +12 -1
  210. package/templates/nextjs-standalone/src/lib/config.ts +38 -40
  211. package/templates/nextjs-standalone/src/lib/db/__tests__/connection.test.ts +89 -14
  212. package/templates/nextjs-standalone/src/lib/db/__tests__/registry-health.test.ts +1 -18
  213. package/templates/nextjs-standalone/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -19
  214. package/templates/nextjs-standalone/src/lib/db/__tests__/registry.test.ts +11 -208
  215. package/templates/nextjs-standalone/src/lib/db/connection.ts +87 -265
  216. package/templates/nextjs-standalone/src/lib/db/internal.ts +6 -1
  217. package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks-integration.test.ts +3 -1
  218. package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks.test.ts +2 -2
  219. package/templates/nextjs-standalone/src/lib/plugins/__tests__/migrate.test.ts +355 -1
  220. package/templates/nextjs-standalone/src/lib/plugins/__tests__/registry.test.ts +32 -5
  221. package/templates/nextjs-standalone/src/lib/plugins/__tests__/wiring.test.ts +228 -14
  222. package/templates/nextjs-standalone/src/lib/plugins/index.ts +4 -1
  223. package/templates/nextjs-standalone/src/lib/plugins/migrate.ts +104 -1
  224. package/templates/nextjs-standalone/src/lib/plugins/registry.ts +14 -8
  225. package/templates/nextjs-standalone/src/lib/plugins/wiring.ts +113 -4
  226. package/templates/nextjs-standalone/src/lib/providers.ts +6 -1
  227. package/templates/nextjs-standalone/src/lib/security.ts +24 -0
  228. package/templates/nextjs-standalone/src/lib/semantic.ts +2 -0
  229. package/templates/nextjs-standalone/src/lib/sidecar-types.ts +12 -1
  230. package/templates/nextjs-standalone/src/lib/startup.ts +71 -101
  231. package/templates/nextjs-standalone/src/lib/tools/__tests__/custom-validation.test.ts +2 -0
  232. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-nsjail.test.ts +32 -18
  233. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-plugin.test.ts +14 -14
  234. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sdk-compat.test.ts +1 -1
  235. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sidecar.test.ts +5 -3
  236. package/templates/nextjs-standalone/src/lib/tools/__tests__/python-nsjail.test.ts +515 -0
  237. package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sandbox.test.ts +397 -0
  238. package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sidecar.test.ts +365 -0
  239. package/templates/nextjs-standalone/src/lib/tools/__tests__/python.test.ts +331 -0
  240. package/templates/nextjs-standalone/src/lib/tools/__tests__/registry-actions.test.ts +1 -13
  241. package/templates/nextjs-standalone/src/lib/tools/__tests__/registry.test.ts +38 -31
  242. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-audit.test.ts +2 -0
  243. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +2 -0
  244. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-ratelimit.test.ts +2 -0
  245. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql.test.ts +5 -308
  246. package/templates/nextjs-standalone/src/lib/tools/explore-nsjail.ts +17 -12
  247. package/templates/nextjs-standalone/src/lib/tools/explore-sidecar.ts +25 -0
  248. package/templates/nextjs-standalone/src/lib/tools/explore.ts +28 -32
  249. package/templates/nextjs-standalone/src/lib/tools/python-nsjail.ts +396 -0
  250. package/templates/nextjs-standalone/src/lib/tools/python-sandbox.ts +476 -0
  251. package/templates/nextjs-standalone/src/lib/tools/python-sidecar.ts +150 -0
  252. package/templates/nextjs-standalone/src/lib/tools/python.ts +367 -0
  253. package/templates/nextjs-standalone/src/lib/tools/registry.ts +49 -22
  254. package/templates/nextjs-standalone/src/lib/tools/sql.ts +88 -88
  255. package/templates/nextjs-standalone/src/ui/components/admin/admin-layout.tsx +77 -8
  256. package/templates/nextjs-standalone/src/ui/components/admin/admin-sidebar.tsx +25 -17
  257. package/templates/nextjs-standalone/src/ui/components/admin/change-password-dialog.tsx +128 -0
  258. package/templates/nextjs-standalone/src/ui/components/admin/entity-detail.tsx +3 -3
  259. package/templates/nextjs-standalone/src/ui/components/admin/semantic-file-tree.tsx +159 -0
  260. package/templates/nextjs-standalone/src/ui/components/atlas-chat.tsx +64 -12
  261. package/templates/nextjs-standalone/src/ui/components/chart/result-chart.tsx +25 -15
  262. package/templates/nextjs-standalone/src/ui/components/chat/markdown.tsx +88 -42
  263. package/templates/nextjs-standalone/src/ui/components/chat/python-result-card.tsx +244 -0
  264. package/templates/nextjs-standalone/src/ui/components/chat/sql-block.tsx +39 -15
  265. package/templates/nextjs-standalone/src/ui/components/chat/sql-result-card.tsx +6 -1
  266. package/templates/nextjs-standalone/src/ui/components/chat/tool-part.tsx +12 -3
  267. package/templates/nextjs-standalone/src/ui/components/chat/typing-indicator.tsx +5 -2
  268. package/templates/nextjs-standalone/src/ui/components/conversations/conversation-item.tsx +25 -20
  269. package/templates/nextjs-standalone/src/ui/context.tsx +1 -1
  270. package/templates/nextjs-standalone/src/ui/hooks/use-conversations.ts +3 -3
  271. package/templates/nextjs-standalone/src/ui/hooks/use-dark-mode.ts +17 -10
  272. package/templates/nextjs-standalone/tsconfig.json +0 -1
  273. package/templates/nextjs-standalone/vercel.json +4 -1
  274. package/templates/docker/render.yaml +0 -34
  275. package/templates/docker/semantic/entities/.gitkeep +0 -0
  276. package/templates/docker/semantic/metrics/.gitkeep +0 -0
  277. package/templates/docker/src/lib/db/__tests__/duckdb.test.ts +0 -141
  278. package/templates/docker/src/lib/db/__tests__/salesforce.test.ts +0 -339
  279. package/templates/docker/src/lib/db/__tests__/snowflake.test.ts +0 -217
  280. package/templates/docker/src/lib/db/duckdb.ts +0 -122
  281. package/templates/docker/src/lib/db/salesforce.ts +0 -342
  282. package/templates/docker/src/lib/tools/__tests__/salesforce-tool.test.ts +0 -154
  283. package/templates/docker/src/lib/tools/__tests__/soql-validation.test.ts +0 -303
  284. package/templates/docker/src/lib/tools/__tests__/sql-duckdb.test.ts +0 -233
  285. package/templates/docker/src/lib/tools/salesforce.ts +0 -138
  286. package/templates/docker/src/lib/tools/soql-validation.ts +0 -172
  287. package/templates/nextjs-standalone/semantic/entities/.gitkeep +0 -0
  288. package/templates/nextjs-standalone/semantic/metrics/.gitkeep +0 -0
  289. package/templates/nextjs-standalone/src/lib/db/__tests__/duckdb.test.ts +0 -141
  290. package/templates/nextjs-standalone/src/lib/db/__tests__/salesforce.test.ts +0 -339
  291. package/templates/nextjs-standalone/src/lib/db/__tests__/snowflake.test.ts +0 -217
  292. package/templates/nextjs-standalone/src/lib/db/duckdb.ts +0 -122
  293. package/templates/nextjs-standalone/src/lib/db/salesforce.ts +0 -342
  294. package/templates/nextjs-standalone/src/lib/tools/__tests__/salesforce-tool.test.ts +0 -154
  295. package/templates/nextjs-standalone/src/lib/tools/__tests__/soql-validation.test.ts +0 -303
  296. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-duckdb.test.ts +0 -233
  297. package/templates/nextjs-standalone/src/lib/tools/salesforce.ts +0 -138
  298. package/templates/nextjs-standalone/src/lib/tools/soql-validation.ts +0 -172
@@ -1,10 +1,33 @@
1
- import { describe, expect, it, beforeEach, afterEach, spyOn } from "bun:test";
1
+ import { describe, expect, it, beforeEach, afterEach, spyOn, mock } from "bun:test";
2
2
  import * as fs from "fs";
3
3
 
4
4
  // ---------------------------------------------------------------------------
5
5
  // Mocks
6
6
  // ---------------------------------------------------------------------------
7
7
 
8
+ // Mock structured logger — must be before explore-nsjail import
9
+ let logWarnCalls: unknown[][] = [];
10
+ let logErrorCalls: unknown[][] = [];
11
+
12
+ const mockLogger = {
13
+ info: () => {},
14
+ warn: (...args: unknown[]) => { logWarnCalls.push(args); },
15
+ error: (...args: unknown[]) => { logErrorCalls.push(args); },
16
+ debug: () => {},
17
+ fatal: () => {},
18
+ trace: () => {},
19
+ child: () => mockLogger,
20
+ level: "info",
21
+ };
22
+
23
+ mock.module("@atlas/api/lib/logger", () => ({
24
+ createLogger: () => mockLogger,
25
+ getLogger: () => mockLogger,
26
+ withRequestContext: (_ctx: unknown, fn: () => unknown) => fn(),
27
+ getRequestContext: () => undefined,
28
+ redactPaths: [],
29
+ }));
30
+
8
31
  // Track Bun.spawn calls
9
32
  let spawnCalls: { args: unknown[]; options: unknown }[] = [];
10
33
  let spawnResult: {
@@ -50,7 +73,8 @@ const callbacks = {
50
73
  },
51
74
  };
52
75
 
53
- import { isNsjailAvailable, createNsjailBackend, testNsjailCapabilities } from "@atlas/api/lib/tools/explore-nsjail";
76
+ const { isNsjailAvailable, createNsjailBackend, testNsjailCapabilities } =
77
+ await import("@atlas/api/lib/tools/explore-nsjail");
54
78
 
55
79
  // ---------------------------------------------------------------------------
56
80
  // Helpers
@@ -145,6 +169,8 @@ describe("exec", () => {
145
169
  spawnCalls = [];
146
170
  invalidateCalled = false;
147
171
  markFailedCalled = false;
172
+ logWarnCalls = [];
173
+ logErrorCalls = [];
148
174
  setSpawnResult("", "", 0);
149
175
  });
150
176
 
@@ -311,8 +337,6 @@ describe("exec", () => {
311
337
  new Set(["/usr/local/bin/nsjail", SEMANTIC_ROOT]),
312
338
  );
313
339
 
314
- const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
315
-
316
340
  const backend = await createNsjailBackend(SEMANTIC_ROOT, callbacks);
317
341
  await backend.exec("ls");
318
342
 
@@ -320,7 +344,6 @@ describe("exec", () => {
320
344
  const tIndex = args.indexOf("-t");
321
345
  expect(args[tIndex + 1]).toBe("10"); // default
322
346
 
323
- warnSpy.mockRestore();
324
347
  spy.mockRestore();
325
348
  });
326
349
 
@@ -331,8 +354,6 @@ describe("exec", () => {
331
354
  new Set(["/usr/local/bin/nsjail", SEMANTIC_ROOT]),
332
355
  );
333
356
 
334
- const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
335
-
336
357
  const backend = await createNsjailBackend(SEMANTIC_ROOT, callbacks);
337
358
  await backend.exec("ls");
338
359
 
@@ -340,7 +361,6 @@ describe("exec", () => {
340
361
  const tIndex = args.indexOf("-t");
341
362
  expect(args[tIndex + 1]).toBe("10"); // default
342
363
 
343
- warnSpy.mockRestore();
344
364
  spy.mockRestore();
345
365
  });
346
366
 
@@ -351,8 +371,6 @@ describe("exec", () => {
351
371
  new Set(["/usr/local/bin/nsjail", SEMANTIC_ROOT]),
352
372
  );
353
373
 
354
- const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
355
-
356
374
  const backend = await createNsjailBackend(SEMANTIC_ROOT, callbacks);
357
375
  await backend.exec("ls");
358
376
 
@@ -360,7 +378,6 @@ describe("exec", () => {
360
378
  const memIndex = args.indexOf("--rlimit_as");
361
379
  expect(args[memIndex + 1]).toBe("256"); // default
362
380
 
363
- warnSpy.mockRestore();
364
381
  spy.mockRestore();
365
382
  });
366
383
 
@@ -371,7 +388,6 @@ describe("exec", () => {
371
388
  );
372
389
 
373
390
  setSpawnResult("", "nsjail setup failure", 109);
374
- const errorSpy = spyOn(console, "error").mockImplementation(() => {});
375
391
 
376
392
  const backend = await createNsjailBackend(SEMANTIC_ROOT, callbacks);
377
393
  const result = await backend.exec("ls");
@@ -379,7 +395,6 @@ describe("exec", () => {
379
395
  expect(result.exitCode).toBe(109);
380
396
  expect(markFailedCalled).toBe(true);
381
397
 
382
- errorSpy.mockRestore();
383
398
  spy.mockRestore();
384
399
  });
385
400
 
@@ -391,17 +406,16 @@ describe("exec", () => {
391
406
 
392
407
  // Exit code 137 = 128 + 9 (SIGKILL)
393
408
  setSpawnResult("", "", 137);
394
- const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
395
409
 
396
410
  const backend = await createNsjailBackend(SEMANTIC_ROOT, callbacks);
397
411
  const result = await backend.exec("sleep 999");
398
412
 
399
413
  expect(result.exitCode).toBe(137);
400
- expect(warnSpy).toHaveBeenCalled();
401
- const warnMsg = warnSpy.mock.calls[0]?.[0] as string;
402
- expect(warnMsg).toContain("signal 9");
414
+ // log.warn({ signal, command }, "nsjail child killed by signal")
415
+ expect(logWarnCalls.length).toBeGreaterThanOrEqual(1);
416
+ const warnObj = logWarnCalls[0][0] as { signal: number };
417
+ expect(warnObj.signal).toBe(9);
403
418
 
404
- warnSpy.mockRestore();
405
419
  spy.mockRestore();
406
420
  });
407
421
  });
@@ -67,7 +67,7 @@ mock.module("@atlas/api/lib/plugins/hooks", () => ({
67
67
 
68
68
  let mockSandboxPlugins: Array<{
69
69
  id: string;
70
- type: string;
70
+ types: string[];
71
71
  version: string;
72
72
  sandbox: {
73
73
  create(root: string): Promise<ExploreBackend> | ExploreBackend;
@@ -146,7 +146,7 @@ describe("explore sandbox plugin integration", () => {
146
146
  mockSandboxPlugins = [
147
147
  {
148
148
  id: "plugin-a",
149
- type: "sandbox",
149
+ types: ["sandbox"],
150
150
  version: "1.0.0",
151
151
  sandbox: { create: async () => backend },
152
152
  },
@@ -165,7 +165,7 @@ describe("explore sandbox plugin integration", () => {
165
165
  mockSandboxPlugins = [
166
166
  {
167
167
  id: "low-priority",
168
- type: "sandbox",
168
+ types: ["sandbox"],
169
169
  version: "1.0.0",
170
170
  sandbox: {
171
171
  create: async () => makeMockBackend("low"),
@@ -174,7 +174,7 @@ describe("explore sandbox plugin integration", () => {
174
174
  },
175
175
  {
176
176
  id: "high-priority",
177
- type: "sandbox",
177
+ types: ["sandbox"],
178
178
  version: "1.0.0",
179
179
  sandbox: {
180
180
  create: async () => makeMockBackend("high"),
@@ -196,7 +196,7 @@ describe("explore sandbox plugin integration", () => {
196
196
  mockSandboxPlugins = [
197
197
  {
198
198
  id: "broken-plugin",
199
- type: "sandbox",
199
+ types: ["sandbox"],
200
200
  version: "1.0.0",
201
201
  sandbox: {
202
202
  create: async () => { throw new Error("init failed"); },
@@ -205,7 +205,7 @@ describe("explore sandbox plugin integration", () => {
205
205
  },
206
206
  {
207
207
  id: "working-plugin",
208
- type: "sandbox",
208
+ types: ["sandbox"],
209
209
  version: "1.0.0",
210
210
  sandbox: {
211
211
  create: async () => makeMockBackend("working"),
@@ -228,7 +228,7 @@ describe("explore sandbox plugin integration", () => {
228
228
  mockSandboxPlugins = [
229
229
  {
230
230
  id: "broken-1",
231
- type: "sandbox",
231
+ types: ["sandbox"],
232
232
  version: "1.0.0",
233
233
  sandbox: {
234
234
  create: async () => { throw new Error("fail 1"); },
@@ -236,7 +236,7 @@ describe("explore sandbox plugin integration", () => {
236
236
  },
237
237
  {
238
238
  id: "broken-2",
239
- type: "sandbox",
239
+ types: ["sandbox"],
240
240
  version: "1.0.0",
241
241
  sandbox: {
242
242
  create: async () => { throw new Error("fail 2"); },
@@ -255,7 +255,7 @@ describe("explore sandbox plugin integration", () => {
255
255
  mockSandboxPlugins = [
256
256
  {
257
257
  id: "my-sandbox",
258
- type: "sandbox",
258
+ types: ["sandbox"],
259
259
  version: "2.0.0",
260
260
  sandbox: { create: async () => makeMockBackend("my-sandbox") },
261
261
  },
@@ -274,7 +274,7 @@ describe("explore sandbox plugin integration", () => {
274
274
  mockSandboxPlugins = [
275
275
  {
276
276
  id: "test-plugin",
277
- type: "sandbox",
277
+ types: ["sandbox"],
278
278
  version: "1.0.0",
279
279
  sandbox: { create: async () => makeMockBackend("test") },
280
280
  },
@@ -297,7 +297,7 @@ describe("explore sandbox plugin integration", () => {
297
297
  mockSandboxPlugins = [
298
298
  {
299
299
  id: "clearable-plugin",
300
- type: "sandbox",
300
+ types: ["sandbox"],
301
301
  version: "1.0.0",
302
302
  sandbox: { create: async () => makeMockBackend("clearable") },
303
303
  },
@@ -321,7 +321,7 @@ describe("explore sandbox plugin integration", () => {
321
321
  mockSandboxPlugins = [
322
322
  {
323
323
  id: "should-be-skipped",
324
- type: "sandbox",
324
+ types: ["sandbox"],
325
325
  version: "1.0.0",
326
326
  sandbox: { create: async () => makeMockBackend("skipped") },
327
327
  },
@@ -343,7 +343,7 @@ describe("explore sandbox plugin integration", () => {
343
343
  mockSandboxPlugins = [
344
344
  {
345
345
  id: "explicit-low",
346
- type: "sandbox",
346
+ types: ["sandbox"],
347
347
  version: "1.0.0",
348
348
  sandbox: {
349
349
  create: async () => makeMockBackend("explicit-low"),
@@ -352,7 +352,7 @@ describe("explore sandbox plugin integration", () => {
352
352
  },
353
353
  {
354
354
  id: "default-priority",
355
- type: "sandbox",
355
+ types: ["sandbox"],
356
356
  version: "1.0.0",
357
357
  sandbox: {
358
358
  // No priority — defaults to 60 (SANDBOX_DEFAULT_PRIORITY)
@@ -7,7 +7,7 @@
7
7
  * assertions will fail at compile time.
8
8
  *
9
9
  * Both types are defined in this file to avoid a cross-package import
10
- * (@atlas/api does not depend on @atlas/plugin-sdk by design).
10
+ * (@atlas/api does not depend on @useatlas/plugin-sdk by design).
11
11
  */
12
12
  import { describe, test, expect } from "bun:test";
13
13
  import type { ExecResult, ExploreBackend } from "../explore";
@@ -70,10 +70,12 @@ describe("sidecar exec", () => {
70
70
  expect(result.stderr).toBe("");
71
71
  expect(result.exitCode).toBe(0);
72
72
 
73
- expect(fetchCalls).toHaveLength(1);
74
- expect(fetchCalls[0].url).toBe("http://localhost:8080/exec");
73
+ // Filter out the health check call made during createSidecarBackend init
74
+ const execCalls = fetchCalls.filter((c) => c.url.endsWith("/exec"));
75
+ expect(execCalls).toHaveLength(1);
76
+ expect(execCalls[0].url).toBe("http://localhost:8080/exec");
75
77
 
76
- const body = JSON.parse(fetchCalls[0].options.body as string);
78
+ const body = JSON.parse(execCalls[0].options.body as string);
77
79
  expect(body.command).toBe("ls");
78
80
  expect(body.timeout).toBe(10_000);
79
81
  });