@useatlas/create 0.0.2 → 0.0.4

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 (296) 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 +9 -9
  7. package/templates/docker/bin/atlas.ts +108 -44
  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 +2 -39
  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 +37 -39
  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 +103 -0
  90. package/templates/docker/src/lib/plugins/registry.ts +12 -6
  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-sidecar.test.ts +5 -3
  101. package/templates/docker/src/lib/tools/__tests__/python-nsjail.test.ts +515 -0
  102. package/templates/docker/src/lib/tools/__tests__/python-sandbox.test.ts +397 -0
  103. package/templates/docker/src/lib/tools/__tests__/python-sidecar.test.ts +365 -0
  104. package/templates/docker/src/lib/tools/__tests__/python.test.ts +331 -0
  105. package/templates/docker/src/lib/tools/__tests__/registry-actions.test.ts +1 -13
  106. package/templates/docker/src/lib/tools/__tests__/registry.test.ts +38 -31
  107. package/templates/docker/src/lib/tools/__tests__/sql-audit.test.ts +2 -0
  108. package/templates/docker/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +2 -0
  109. package/templates/docker/src/lib/tools/__tests__/sql-ratelimit.test.ts +2 -0
  110. package/templates/docker/src/lib/tools/__tests__/sql.test.ts +5 -308
  111. package/templates/docker/src/lib/tools/explore-nsjail.ts +17 -12
  112. package/templates/docker/src/lib/tools/explore-sidecar.ts +25 -0
  113. package/templates/docker/src/lib/tools/explore.ts +28 -32
  114. package/templates/docker/src/lib/tools/python-nsjail.ts +396 -0
  115. package/templates/docker/src/lib/tools/python-sandbox.ts +476 -0
  116. package/templates/docker/src/lib/tools/python-sidecar.ts +150 -0
  117. package/templates/docker/src/lib/tools/python.ts +367 -0
  118. package/templates/docker/src/lib/tools/registry.ts +49 -22
  119. package/templates/docker/src/lib/tools/sql.ts +88 -88
  120. package/templates/docker/src/types/vercel-sandbox.d.ts +7 -0
  121. package/templates/docker/src/ui/components/admin/admin-layout.tsx +77 -8
  122. package/templates/docker/src/ui/components/admin/admin-sidebar.tsx +25 -17
  123. package/templates/docker/src/ui/components/admin/change-password-dialog.tsx +128 -0
  124. package/templates/docker/src/ui/components/admin/entity-detail.tsx +3 -3
  125. package/templates/docker/src/ui/components/admin/semantic-file-tree.tsx +159 -0
  126. package/templates/docker/src/ui/components/atlas-chat.tsx +64 -12
  127. package/templates/docker/src/ui/components/chart/result-chart.tsx +25 -15
  128. package/templates/docker/src/ui/components/chat/markdown.tsx +88 -42
  129. package/templates/docker/src/ui/components/chat/python-result-card.tsx +244 -0
  130. package/templates/docker/src/ui/components/chat/sql-block.tsx +39 -15
  131. package/templates/docker/src/ui/components/chat/sql-result-card.tsx +6 -1
  132. package/templates/docker/src/ui/components/chat/tool-part.tsx +12 -3
  133. package/templates/docker/src/ui/components/chat/typing-indicator.tsx +5 -2
  134. package/templates/docker/src/ui/components/conversations/conversation-item.tsx +25 -20
  135. package/templates/docker/src/ui/context.tsx +1 -1
  136. package/templates/docker/src/ui/hooks/use-conversations.ts +3 -3
  137. package/templates/docker/src/ui/hooks/use-dark-mode.ts +17 -10
  138. package/templates/docker/tsconfig.json +2 -2
  139. package/templates/nextjs-standalone/.env.example +1 -1
  140. package/templates/nextjs-standalone/bin/__tests__/plugin-cli.test.ts +9 -9
  141. package/templates/nextjs-standalone/bin/atlas.ts +108 -44
  142. package/templates/nextjs-standalone/data/demo-semantic/catalog.yml +51 -27
  143. package/templates/nextjs-standalone/data/demo-semantic/entities/accounts.yml +95 -103
  144. package/templates/nextjs-standalone/data/demo-semantic/entities/companies.yml +88 -152
  145. package/templates/nextjs-standalone/data/demo-semantic/entities/people.yml +82 -95
  146. package/templates/nextjs-standalone/data/demo-semantic/glossary.yml +104 -8
  147. package/templates/nextjs-standalone/data/demo-semantic/metrics/accounts.yml +62 -23
  148. package/templates/nextjs-standalone/data/demo-semantic/metrics/companies.yml +52 -78
  149. package/templates/nextjs-standalone/docs/deploy.md +2 -39
  150. package/templates/nextjs-standalone/package.json +11 -2
  151. package/templates/nextjs-standalone/scripts/migrate-auth.ts +25 -0
  152. package/templates/nextjs-standalone/scripts/seed-demo.ts +94 -0
  153. package/templates/nextjs-standalone/semantic/catalog.yml +62 -3
  154. package/templates/nextjs-standalone/semantic/entities/accounts.yml +162 -0
  155. package/templates/nextjs-standalone/semantic/entities/companies.yml +143 -0
  156. package/templates/nextjs-standalone/semantic/entities/people.yml +132 -0
  157. package/templates/nextjs-standalone/semantic/glossary.yml +116 -4
  158. package/templates/nextjs-standalone/semantic/metrics/accounts.yml +77 -0
  159. package/templates/nextjs-standalone/semantic/metrics/companies.yml +63 -0
  160. package/templates/nextjs-standalone/src/api/__tests__/admin.test.ts +7 -7
  161. package/templates/nextjs-standalone/src/api/__tests__/health-plugin.test.ts +7 -0
  162. package/templates/nextjs-standalone/src/api/__tests__/health.test.ts +30 -8
  163. package/templates/nextjs-standalone/src/api/routes/admin.ts +549 -8
  164. package/templates/nextjs-standalone/src/api/routes/chat.ts +5 -20
  165. package/templates/nextjs-standalone/src/api/routes/health.ts +39 -27
  166. package/templates/nextjs-standalone/src/api/routes/openapi.ts +1329 -74
  167. package/templates/nextjs-standalone/src/api/routes/query.ts +2 -1
  168. package/templates/nextjs-standalone/src/api/server.ts +27 -0
  169. package/templates/nextjs-standalone/src/app/api/[...route]/route.ts +2 -2
  170. package/templates/nextjs-standalone/src/app/globals.css +13 -12
  171. package/templates/nextjs-standalone/src/app/layout.tsx +9 -2
  172. package/templates/nextjs-standalone/src/components/ui/alert-dialog.tsx +196 -0
  173. package/templates/nextjs-standalone/src/components/ui/badge.tsx +48 -0
  174. package/templates/nextjs-standalone/src/components/ui/button.tsx +64 -0
  175. package/templates/nextjs-standalone/src/components/ui/card.tsx +92 -0
  176. package/templates/nextjs-standalone/src/components/ui/collapsible.tsx +33 -0
  177. package/templates/nextjs-standalone/src/components/ui/command.tsx +184 -0
  178. package/templates/nextjs-standalone/src/components/ui/dialog.tsx +158 -0
  179. package/templates/nextjs-standalone/src/components/ui/dropdown-menu.tsx +257 -0
  180. package/templates/nextjs-standalone/src/components/ui/input.tsx +21 -0
  181. package/templates/nextjs-standalone/src/components/ui/scroll-area.tsx +58 -0
  182. package/templates/nextjs-standalone/src/components/ui/select.tsx +190 -0
  183. package/templates/nextjs-standalone/src/components/ui/separator.tsx +28 -0
  184. package/templates/nextjs-standalone/src/components/ui/sheet.tsx +143 -0
  185. package/templates/nextjs-standalone/src/components/ui/sidebar.tsx +726 -0
  186. package/templates/nextjs-standalone/src/components/ui/skeleton.tsx +13 -0
  187. package/templates/nextjs-standalone/src/components/ui/table.tsx +116 -0
  188. package/templates/nextjs-standalone/src/components/ui/tabs.tsx +91 -0
  189. package/templates/nextjs-standalone/src/components/ui/toggle-group.tsx +83 -0
  190. package/templates/nextjs-standalone/src/components/ui/toggle.tsx +47 -0
  191. package/templates/nextjs-standalone/src/components/ui/tooltip.tsx +57 -0
  192. package/templates/nextjs-standalone/src/hooks/use-mobile.ts +19 -0
  193. package/templates/nextjs-standalone/src/lib/__tests__/agent-cache.test.ts +2 -0
  194. package/templates/nextjs-standalone/src/lib/__tests__/agent-dialect.test.ts +17 -0
  195. package/templates/nextjs-standalone/src/lib/__tests__/agent-health-annotations.test.ts +2 -0
  196. package/templates/nextjs-standalone/src/lib/__tests__/agent-integration.test.ts +2 -0
  197. package/templates/nextjs-standalone/src/lib/__tests__/config.test.ts +69 -19
  198. package/templates/nextjs-standalone/src/lib/__tests__/plugin-aware-validation.test.ts +321 -0
  199. package/templates/nextjs-standalone/src/lib/__tests__/providers.test.ts +32 -1
  200. package/templates/nextjs-standalone/src/lib/__tests__/startup-actions.test.ts +9 -0
  201. package/templates/nextjs-standalone/src/lib/__tests__/startup-first-run.test.ts +429 -0
  202. package/templates/nextjs-standalone/src/lib/__tests__/startup.test.ts +5 -0
  203. package/templates/nextjs-standalone/src/lib/agent-query.ts +5 -23
  204. package/templates/nextjs-standalone/src/lib/agent.ts +32 -112
  205. package/templates/nextjs-standalone/src/lib/auth/__tests__/migrate.test.ts +5 -3
  206. package/templates/nextjs-standalone/src/lib/auth/middleware.ts +30 -4
  207. package/templates/nextjs-standalone/src/lib/auth/migrate.ts +97 -0
  208. package/templates/nextjs-standalone/src/lib/auth/server.ts +12 -1
  209. package/templates/nextjs-standalone/src/lib/config.ts +37 -39
  210. package/templates/nextjs-standalone/src/lib/db/__tests__/connection.test.ts +89 -14
  211. package/templates/nextjs-standalone/src/lib/db/__tests__/registry-health.test.ts +1 -18
  212. package/templates/nextjs-standalone/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -19
  213. package/templates/nextjs-standalone/src/lib/db/__tests__/registry.test.ts +11 -208
  214. package/templates/nextjs-standalone/src/lib/db/connection.ts +87 -265
  215. package/templates/nextjs-standalone/src/lib/db/internal.ts +6 -1
  216. package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks-integration.test.ts +3 -1
  217. package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks.test.ts +2 -2
  218. package/templates/nextjs-standalone/src/lib/plugins/__tests__/migrate.test.ts +355 -1
  219. package/templates/nextjs-standalone/src/lib/plugins/__tests__/registry.test.ts +32 -5
  220. package/templates/nextjs-standalone/src/lib/plugins/__tests__/wiring.test.ts +228 -14
  221. package/templates/nextjs-standalone/src/lib/plugins/index.ts +4 -1
  222. package/templates/nextjs-standalone/src/lib/plugins/migrate.ts +103 -0
  223. package/templates/nextjs-standalone/src/lib/plugins/registry.ts +12 -6
  224. package/templates/nextjs-standalone/src/lib/plugins/wiring.ts +113 -4
  225. package/templates/nextjs-standalone/src/lib/providers.ts +6 -1
  226. package/templates/nextjs-standalone/src/lib/security.ts +24 -0
  227. package/templates/nextjs-standalone/src/lib/semantic.ts +2 -0
  228. package/templates/nextjs-standalone/src/lib/sidecar-types.ts +12 -1
  229. package/templates/nextjs-standalone/src/lib/startup.ts +71 -101
  230. package/templates/nextjs-standalone/src/lib/tools/__tests__/custom-validation.test.ts +2 -0
  231. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-nsjail.test.ts +32 -18
  232. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-plugin.test.ts +14 -14
  233. package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sidecar.test.ts +5 -3
  234. package/templates/nextjs-standalone/src/lib/tools/__tests__/python-nsjail.test.ts +515 -0
  235. package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sandbox.test.ts +397 -0
  236. package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sidecar.test.ts +365 -0
  237. package/templates/nextjs-standalone/src/lib/tools/__tests__/python.test.ts +331 -0
  238. package/templates/nextjs-standalone/src/lib/tools/__tests__/registry-actions.test.ts +1 -13
  239. package/templates/nextjs-standalone/src/lib/tools/__tests__/registry.test.ts +38 -31
  240. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-audit.test.ts +2 -0
  241. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +2 -0
  242. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-ratelimit.test.ts +2 -0
  243. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql.test.ts +5 -308
  244. package/templates/nextjs-standalone/src/lib/tools/explore-nsjail.ts +17 -12
  245. package/templates/nextjs-standalone/src/lib/tools/explore-sidecar.ts +25 -0
  246. package/templates/nextjs-standalone/src/lib/tools/explore.ts +28 -32
  247. package/templates/nextjs-standalone/src/lib/tools/python-nsjail.ts +396 -0
  248. package/templates/nextjs-standalone/src/lib/tools/python-sandbox.ts +476 -0
  249. package/templates/nextjs-standalone/src/lib/tools/python-sidecar.ts +150 -0
  250. package/templates/nextjs-standalone/src/lib/tools/python.ts +367 -0
  251. package/templates/nextjs-standalone/src/lib/tools/registry.ts +49 -22
  252. package/templates/nextjs-standalone/src/lib/tools/sql.ts +88 -88
  253. package/templates/nextjs-standalone/src/ui/components/admin/admin-layout.tsx +77 -8
  254. package/templates/nextjs-standalone/src/ui/components/admin/admin-sidebar.tsx +25 -17
  255. package/templates/nextjs-standalone/src/ui/components/admin/change-password-dialog.tsx +128 -0
  256. package/templates/nextjs-standalone/src/ui/components/admin/entity-detail.tsx +3 -3
  257. package/templates/nextjs-standalone/src/ui/components/admin/semantic-file-tree.tsx +159 -0
  258. package/templates/nextjs-standalone/src/ui/components/atlas-chat.tsx +64 -12
  259. package/templates/nextjs-standalone/src/ui/components/chart/result-chart.tsx +25 -15
  260. package/templates/nextjs-standalone/src/ui/components/chat/markdown.tsx +88 -42
  261. package/templates/nextjs-standalone/src/ui/components/chat/python-result-card.tsx +244 -0
  262. package/templates/nextjs-standalone/src/ui/components/chat/sql-block.tsx +39 -15
  263. package/templates/nextjs-standalone/src/ui/components/chat/sql-result-card.tsx +6 -1
  264. package/templates/nextjs-standalone/src/ui/components/chat/tool-part.tsx +12 -3
  265. package/templates/nextjs-standalone/src/ui/components/chat/typing-indicator.tsx +5 -2
  266. package/templates/nextjs-standalone/src/ui/components/conversations/conversation-item.tsx +25 -20
  267. package/templates/nextjs-standalone/src/ui/context.tsx +1 -1
  268. package/templates/nextjs-standalone/src/ui/hooks/use-conversations.ts +3 -3
  269. package/templates/nextjs-standalone/src/ui/hooks/use-dark-mode.ts +17 -10
  270. package/templates/nextjs-standalone/tsconfig.json +0 -1
  271. package/templates/nextjs-standalone/vercel.json +4 -1
  272. package/templates/docker/render.yaml +0 -34
  273. package/templates/docker/semantic/entities/.gitkeep +0 -0
  274. package/templates/docker/semantic/metrics/.gitkeep +0 -0
  275. package/templates/docker/src/lib/db/__tests__/duckdb.test.ts +0 -141
  276. package/templates/docker/src/lib/db/__tests__/salesforce.test.ts +0 -339
  277. package/templates/docker/src/lib/db/__tests__/snowflake.test.ts +0 -217
  278. package/templates/docker/src/lib/db/duckdb.ts +0 -122
  279. package/templates/docker/src/lib/db/salesforce.ts +0 -342
  280. package/templates/docker/src/lib/tools/__tests__/salesforce-tool.test.ts +0 -154
  281. package/templates/docker/src/lib/tools/__tests__/soql-validation.test.ts +0 -303
  282. package/templates/docker/src/lib/tools/__tests__/sql-duckdb.test.ts +0 -233
  283. package/templates/docker/src/lib/tools/salesforce.ts +0 -138
  284. package/templates/docker/src/lib/tools/soql-validation.ts +0 -172
  285. package/templates/nextjs-standalone/semantic/entities/.gitkeep +0 -0
  286. package/templates/nextjs-standalone/semantic/metrics/.gitkeep +0 -0
  287. package/templates/nextjs-standalone/src/lib/db/__tests__/duckdb.test.ts +0 -141
  288. package/templates/nextjs-standalone/src/lib/db/__tests__/salesforce.test.ts +0 -339
  289. package/templates/nextjs-standalone/src/lib/db/__tests__/snowflake.test.ts +0 -217
  290. package/templates/nextjs-standalone/src/lib/db/duckdb.ts +0 -122
  291. package/templates/nextjs-standalone/src/lib/db/salesforce.ts +0 -342
  292. package/templates/nextjs-standalone/src/lib/tools/__tests__/salesforce-tool.test.ts +0 -154
  293. package/templates/nextjs-standalone/src/lib/tools/__tests__/soql-validation.test.ts +0 -303
  294. package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-duckdb.test.ts +0 -233
  295. package/templates/nextjs-standalone/src/lib/tools/salesforce.ts +0 -138
  296. package/templates/nextjs-standalone/src/lib/tools/soql-validation.ts +0 -172
@@ -1,170 +1,162 @@
1
1
  name: Accounts
2
2
  type: fact_table
3
3
  table: accounts
4
- grain: one row per account record
5
- description: Auto-profiled schema for accounts (80 rows). Contains 7 columns, linked to companies.
4
+ grain: one row per subscription account
5
+ description: |
6
+ Subscription accounts representing our billing relationship with each customer.
7
+ Each account belongs to one company and has a plan tier (Free, Starter, Pro,
8
+ Enterprise), a billing status (Active, Inactive, Suspended, Churned), and a
9
+ monthly_value representing MRR contribution. Contract dates track the lifecycle.
10
+ A company can have multiple accounts (e.g. separate subscriptions for different teams).
11
+
6
12
  dimensions:
7
13
  - name: id
8
14
  sql: id
9
15
  type: number
10
- description: Primary key
16
+ description: Primary key — unique account identifier
11
17
  primary_key: true
12
- unique_count: 80
13
- sample_values:
14
- - '1'
15
- - '2'
16
- - '3'
17
- - '4'
18
- - '5'
19
- - '6'
20
- - '7'
21
- - '8'
18
+
22
19
  - name: company_id
23
20
  sql: company_id
24
21
  type: number
25
- description: Foreign key to companies
26
- unique_count: 50
27
- sample_values:
28
- - '1'
29
- - '2'
30
- - '3'
31
- - '4'
32
- - '5'
33
- - '6'
34
- - '7'
35
- - '8'
22
+ description: Foreign key to companies — which customer owns this account
23
+
36
24
  - name: plan
37
25
  sql: plan
38
26
  type: string
39
- unique_count: 4
40
- sample_values:
41
- - Enterprise
42
- - Free
43
- - Pro
44
- - Starter
27
+ description: |
28
+ Subscription tier. Determines pricing and feature access.
29
+ Free = $0, Starter = ~$49-89, Pro = ~$299-500, Enterprise = ~$5K-15K.
30
+ sample_values: [Enterprise, Pro, Starter, Free]
31
+
45
32
  - name: status
46
33
  sql: status
47
34
  type: string
48
- unique_count: 4
49
- sample_values:
50
- - Active
51
- - Churned
52
- - Inactive
53
- - Suspended
35
+ description: |
36
+ Current billing status. Active = paying, Inactive = paused,
37
+ Suspended = payment issue, Churned = cancelled.
38
+ sample_values: [Active, Churned, Inactive, Suspended]
39
+
54
40
  - name: monthly_value
55
41
  sql: monthly_value
56
42
  type: number
57
- unique_count: 41
58
- sample_values:
59
- - '0'
60
- - '49'
61
- - '59'
62
- - '69'
63
- - '79'
64
- - '89'
65
- - '299'
66
- - '350'
43
+ description: |
44
+ Monthly Recurring Revenue (MRR) from this account in dollars.
45
+ Free accounts have $0. This is the core revenue metric.
46
+
67
47
  - name: contract_start
68
48
  sql: contract_start
69
49
  type: date
70
- unique_count: 49
71
- sample_values:
72
- - Sat Jun 01 2019 00:00:00 GMT-0400 (Eastern Daylight Time)
73
- - Thu Aug 01 2019 00:00:00 GMT-0400 (Eastern Daylight Time)
74
- - Fri Nov 01 2019 00:00:00 GMT-0400 (Eastern Daylight Time)
75
- - Wed Jan 01 2020 00:00:00 GMT-0500 (Eastern Standard Time)
76
- - Sat Feb 01 2020 00:00:00 GMT-0500 (Eastern Standard Time)
77
- - Sun Mar 01 2020 00:00:00 GMT-0500 (Eastern Standard Time)
78
- - Wed Apr 01 2020 00:00:00 GMT-0400 (Eastern Daylight Time)
79
- - Fri May 01 2020 00:00:00 GMT-0400 (Eastern Daylight Time)
50
+ description: Date the subscription began
51
+
80
52
  - name: contract_end
81
53
  sql: contract_end
82
54
  type: date
83
- unique_count: 10
84
- null_count: 70
85
- sample_values:
86
- - Fri Jan 01 2021 00:00:00 GMT-0500 (Eastern Standard Time)
87
- - Sat May 01 2021 00:00:00 GMT-0400 (Eastern Daylight Time)
88
- - Wed Feb 01 2023 00:00:00 GMT-0500 (Eastern Standard Time)
89
- - Wed Mar 01 2023 00:00:00 GMT-0500 (Eastern Standard Time)
90
- - Sat Apr 01 2023 00:00:00 GMT-0400 (Eastern Daylight Time)
91
- - Mon May 01 2023 00:00:00 GMT-0400 (Eastern Daylight Time)
92
- - Thu Jun 01 2023 00:00:00 GMT-0400 (Eastern Daylight Time)
93
- - Tue Aug 01 2023 00:00:00 GMT-0400 (Eastern Daylight Time)
55
+ description: |
56
+ Date the subscription ended. NULL means the account is still under contract.
57
+ Set when an account churns or is terminated.
58
+
94
59
  - name: monthly_value_bucket
95
60
  sql: |-
96
61
  CASE
97
- WHEN monthly_value < (SELECT PERCENTILE_CONT(0.33) WITHIN GROUP (ORDER BY monthly_value) FROM accounts) THEN 'Low'
98
- WHEN monthly_value < (SELECT PERCENTILE_CONT(0.66) WITHIN GROUP (ORDER BY monthly_value) FROM accounts) THEN 'Medium'
62
+ WHEN monthly_value = 0 THEN 'Free'
63
+ WHEN monthly_value < 100 THEN 'Low'
64
+ WHEN monthly_value < 1000 THEN 'Mid'
99
65
  ELSE 'High'
100
66
  END
101
67
  type: string
102
- description: monthly value bucketed into Low/Medium/High terciles
68
+ description: MRR tier bucket Free / Low / Mid / High
103
69
  virtual: true
104
- sample_values:
105
- - Low
106
- - Medium
107
- - High
70
+ sample_values: [Free, Low, Mid, High]
71
+
108
72
  - name: contract_start_year
109
73
  sql: EXTRACT(YEAR FROM contract_start)
110
74
  type: number
111
- description: Year extracted from contract_start
75
+ description: Year the contract started — useful for cohort analysis
112
76
  virtual: true
77
+
113
78
  - name: contract_start_month
114
79
  sql: TO_CHAR(contract_start, 'YYYY-MM')
115
80
  type: string
116
- description: Year-month extracted from contract_start
81
+ description: Year-month the contract started
117
82
  virtual: true
118
- - name: contract_end_year
119
- sql: EXTRACT(YEAR FROM contract_end)
120
- type: number
121
- description: Year extracted from contract_end
122
- virtual: true
123
- - name: contract_end_month
124
- sql: TO_CHAR(contract_end, 'YYYY-MM')
125
- type: string
126
- description: Year-month extracted from contract_end
83
+
84
+ - name: is_churned
85
+ sql: CASE WHEN status = 'Churned' THEN true ELSE false END
86
+ type: boolean
87
+ description: Whether this account has churned
127
88
  virtual: true
89
+
128
90
  measures:
129
91
  - name: account_count
130
92
  sql: id
131
93
  type: count_distinct
132
- - name: total_monthly_value
94
+ description: Number of unique accounts
95
+
96
+ - name: total_mrr
133
97
  sql: monthly_value
134
98
  type: sum
135
- description: Sum of monthly value
136
- - name: avg_monthly_value
99
+ description: Total Monthly Recurring Revenue
100
+
101
+ - name: avg_mrr
137
102
  sql: monthly_value
138
103
  type: avg
139
- description: Average monthly value
104
+ description: Average MRR per account
105
+
140
106
  joins:
141
107
  - target_entity: Companies
142
108
  relationship: many_to_one
143
109
  join_columns:
144
110
  from: company_id
145
111
  to: id
146
- description: Each account belongs to one company
112
+ description: Each account belongs to one company (customer)
113
+
147
114
  use_cases:
148
- - Use for segmentation analysis by plan, status
149
- - Use for aggregation and trends on monthly_value
150
- - Use for time-series analysis using contract_start, contract_end
151
- - Join with companies for cross-entity analysis
115
+ - MRR analysis total, by plan, by status, over time
116
+ - Churn analysis churned vs active accounts, churn rate by plan
117
+ - Revenue segmentation which plans drive the most revenue
118
+ - Contract lifecycle average duration, upcoming renewals
119
+ - Cross-entity joins to companies for firmographic revenue analysis
120
+
152
121
  query_patterns:
153
- - description: Accounts by plan
122
+ - name: mrr_by_plan
123
+ description: Total MRR and account count by plan tier
154
124
  sql: |-
155
- SELECT plan, COUNT(*) as count
125
+ SELECT plan,
126
+ SUM(monthly_value) AS total_mrr,
127
+ COUNT(*) AS account_count,
128
+ AVG(monthly_value) AS avg_mrr
156
129
  FROM accounts
130
+ WHERE status = 'Active'
157
131
  GROUP BY plan
158
- ORDER BY count DESC
159
- - description: Accounts by status
132
+ ORDER BY total_mrr DESC
133
+
134
+ - name: churn_rate_by_plan
135
+ description: Churn rate by plan type
160
136
  sql: |-
161
- SELECT status, COUNT(*) as count
137
+ SELECT plan,
138
+ COUNT(*) FILTER (WHERE status = 'Churned') AS churned,
139
+ COUNT(*) AS total,
140
+ ROUND(100.0 * COUNT(*) FILTER (WHERE status = 'Churned') / COUNT(*), 1) AS churn_pct
141
+ FROM accounts
142
+ GROUP BY plan
143
+ ORDER BY churn_pct DESC
144
+
145
+ - name: accounts_by_status
146
+ description: Account distribution by billing status
147
+ sql: |-
148
+ SELECT status, COUNT(*) AS count
162
149
  FROM accounts
163
150
  GROUP BY status
164
151
  ORDER BY count DESC
165
- - description: Total monthly_value by plan
152
+
153
+ - name: mrr_by_contract_year
154
+ description: MRR cohort analysis by contract start year
166
155
  sql: |-
167
- SELECT plan, SUM(monthly_value) as total_monthly_value, COUNT(*) as count
156
+ SELECT EXTRACT(YEAR FROM contract_start) AS cohort_year,
157
+ SUM(monthly_value) AS total_mrr,
158
+ COUNT(*) AS accounts
168
159
  FROM accounts
169
- GROUP BY plan
170
- ORDER BY total_monthly_value DESC
160
+ WHERE status = 'Active'
161
+ GROUP BY cohort_year
162
+ ORDER BY cohort_year
@@ -1,207 +1,143 @@
1
1
  name: Companies
2
- type: fact_table
2
+ type: dimension_table
3
3
  table: companies
4
- grain: one row per company record
5
- description: Auto-profiled schema for companies (50 rows). Contains 8 columns.
4
+ grain: one row per customer company
5
+ description: |
6
+ Customer companies (our B2B clients). Contains firmographic data including
7
+ industry vertical, headcount, founding year, HQ country, annual revenue,
8
+ and valuation. Each company can have multiple accounts (subscriptions)
9
+ and multiple people (contacts). This is the central dimension table for
10
+ customer-level analysis.
11
+
6
12
  dimensions:
7
13
  - name: id
8
14
  sql: id
9
15
  type: number
10
- description: Primary key
16
+ description: Primary key — unique company identifier
11
17
  primary_key: true
12
- unique_count: 50
13
- sample_values:
14
- - '1'
15
- - '2'
16
- - '3'
17
- - '4'
18
- - '5'
19
- - '6'
20
- - '7'
21
- - '8'
18
+
22
19
  - name: name
23
20
  sql: name
24
21
  type: string
25
- unique_count: 50
26
- sample_values:
27
- - Acme Corp
28
- - AdTech Global
29
- - AutoForge
30
- - BioGenix
31
- - BrightMinds
32
- - CartFlow
33
- - CastMedia
34
- - CleanJoule
22
+ description: Company name
23
+ sample_values: [Acme Corp, DataFlow Inc, CloudSync, RetailHub]
24
+
35
25
  - name: industry
36
26
  sql: industry
37
27
  type: string
38
- unique_count: 8
39
- sample_values:
40
- - Education
41
- - Energy
42
- - Finance
43
- - Healthcare
44
- - Manufacturing
45
- - Media
46
- - Retail
47
- - Technology
28
+ description: Business sector / vertical
29
+ sample_values: [Education, Energy, Finance, Healthcare, Manufacturing, Media, Retail, Technology]
30
+
48
31
  - name: employee_count
49
32
  sql: employee_count
50
33
  type: number
51
- unique_count: 46
52
- sample_values:
53
- - '50'
54
- - '55'
55
- - '60'
56
- - '65'
57
- - '70'
58
- - '75'
59
- - '80'
60
- - '85'
34
+ description: Total headcount at the company
35
+
61
36
  - name: founded_year
62
37
  sql: founded_year
63
38
  type: number
64
- unique_count: 19
65
- sample_values:
66
- - '2004'
67
- - '2005'
68
- - '2006'
69
- - '2007'
70
- - '2008'
71
- - '2009'
72
- - '2010'
73
- - '2011'
39
+ description: Year the company was founded
40
+
74
41
  - name: country
75
42
  sql: country
76
43
  type: string
77
- unique_count: 10
78
- sample_values:
79
- - AU
80
- - BR
81
- - CA
82
- - DE
83
- - FR
84
- - IN
85
- - JP
86
- - SG
44
+ description: ISO 2-letter code for company HQ location
45
+ sample_values: [AU, BR, CA, DE, FR, IN, JP, SG, UK, US]
46
+
87
47
  - name: revenue
88
48
  sql: revenue
89
49
  type: number
90
- unique_count: 50
91
- sample_values:
92
- - '2000000'
93
- - '2500000'
94
- - '3500000'
95
- - '4000000'
96
- - '5000000'
97
- - '6000000'
98
- - '6500000'
99
- - '7000000'
50
+ description: Annual revenue in dollars (the company's own revenue, not what they pay us)
51
+
100
52
  - name: valuation
101
53
  sql: valuation
102
54
  type: number
103
- unique_count: 46
104
- sample_values:
105
- - '16000000'
106
- - '20000000'
107
- - '25000000'
108
- - '28000000'
109
- - '30000000'
110
- - '32000000'
111
- - '35000000'
112
- - '40000000'
113
- - name: employee_count_bucket
55
+ description: Company valuation in dollars
56
+
57
+ - name: company_size
114
58
  sql: |-
115
59
  CASE
116
- WHEN employee_count < (SELECT PERCENTILE_CONT(0.33) WITHIN GROUP (ORDER BY employee_count) FROM companies) THEN 'Low'
117
- WHEN employee_count < (SELECT PERCENTILE_CONT(0.66) WITHIN GROUP (ORDER BY employee_count) FROM companies) THEN 'Medium'
118
- ELSE 'High'
60
+ WHEN employee_count < 100 THEN 'Small'
61
+ WHEN employee_count < 300 THEN 'Mid-Market'
62
+ ELSE 'Enterprise'
119
63
  END
120
64
  type: string
121
- description: employee count bucketed into Low/Medium/High terciles
65
+ description: Company size segment based on headcount
122
66
  virtual: true
123
- sample_values:
124
- - Low
125
- - Medium
126
- - High
127
- - name: founded_year_bucket
67
+ sample_values: [Small, Mid-Market, Enterprise]
68
+
69
+ - name: revenue_tier
128
70
  sql: |-
129
71
  CASE
130
- WHEN founded_year < (SELECT PERCENTILE_CONT(0.33) WITHIN GROUP (ORDER BY founded_year) FROM companies) THEN 'Low'
131
- WHEN founded_year < (SELECT PERCENTILE_CONT(0.66) WITHIN GROUP (ORDER BY founded_year) FROM companies) THEN 'Medium'
132
- ELSE 'High'
72
+ WHEN revenue < 10000000 THEN 'Under $10M'
73
+ WHEN revenue < 50000000 THEN '$10M-$50M'
74
+ WHEN revenue < 100000000 THEN '$50M-$100M'
75
+ ELSE '$100M+'
133
76
  END
134
77
  type: string
135
- description: founded year bucketed into Low/Medium/High terciles
78
+ description: Revenue tier for segmentation
136
79
  virtual: true
137
- sample_values:
138
- - Low
139
- - Medium
140
- - High
141
- - name: revenue_bucket
142
- sql: |-
143
- CASE
144
- WHEN revenue < (SELECT PERCENTILE_CONT(0.33) WITHIN GROUP (ORDER BY revenue) FROM companies) THEN 'Low'
145
- WHEN revenue < (SELECT PERCENTILE_CONT(0.66) WITHIN GROUP (ORDER BY revenue) FROM companies) THEN 'Medium'
146
- ELSE 'High'
147
- END
148
- type: string
149
- description: revenue bucketed into Low/Medium/High terciles
150
- virtual: true
151
- sample_values:
152
- - Low
153
- - Medium
154
- - High
155
- - name: valuation_bucket
156
- sql: |-
157
- CASE
158
- WHEN valuation < (SELECT PERCENTILE_CONT(0.33) WITHIN GROUP (ORDER BY valuation) FROM companies) THEN 'Low'
159
- WHEN valuation < (SELECT PERCENTILE_CONT(0.66) WITHIN GROUP (ORDER BY valuation) FROM companies) THEN 'Medium'
160
- ELSE 'High'
161
- END
162
- type: string
163
- description: valuation bucketed into Low/Medium/High terciles
164
- virtual: true
165
- sample_values:
166
- - Low
167
- - Medium
168
- - High
80
+ sample_values: [Under $10M, $10M-$50M, $50M-$100M, $100M+]
81
+
169
82
  measures:
170
83
  - name: company_count
171
84
  sql: id
172
85
  type: count_distinct
173
- - name: total_employee_count
174
- sql: employee_count
175
- type: sum
176
- description: Sum of employee count
86
+ description: Number of unique companies
87
+
177
88
  - name: avg_employee_count
178
89
  sql: employee_count
179
90
  type: avg
180
- description: Average employee count
181
- - name: total_founded_year
182
- sql: founded_year
183
- type: sum
184
- description: Sum of founded year
185
- - name: avg_founded_year
186
- sql: founded_year
187
- type: avg
188
- description: Average founded year
91
+ description: Average headcount per company
92
+
189
93
  - name: total_revenue
190
94
  sql: revenue
191
95
  type: sum
192
- description: Sum of revenue
96
+ description: Combined annual revenue of all companies
97
+
193
98
  - name: avg_revenue
194
99
  sql: revenue
195
100
  type: avg
196
- description: Average revenue
197
- - name: total_valuation
198
- sql: valuation
199
- type: sum
200
- description: Sum of valuation
101
+ description: Average annual revenue per company
102
+
201
103
  - name: avg_valuation
202
104
  sql: valuation
203
105
  type: avg
204
- description: Average valuation
106
+ description: Average company valuation
107
+
205
108
  use_cases:
206
- - Use for aggregation and trends on employee_count, founded_year, revenue, valuation
207
- - Avoid for row-level accounts/people queries use those entities directly
109
+ - Customer segmentation by industry, country, company size
110
+ - Revenue and valuation analysis across the customer base
111
+ - Firmographic profiling for ICP (ideal customer profile) analysis
112
+ - Join to accounts for revenue-per-company analysis
113
+ - Join to people for stakeholder density per company
114
+
115
+ query_patterns:
116
+ - name: companies_by_industry
117
+ description: Customer count and avg revenue by industry
118
+ sql: |-
119
+ SELECT industry,
120
+ COUNT(*) AS company_count,
121
+ AVG(revenue) AS avg_revenue,
122
+ AVG(employee_count) AS avg_headcount
123
+ FROM companies
124
+ GROUP BY industry
125
+ ORDER BY company_count DESC
126
+
127
+ - name: companies_by_country
128
+ description: Customer distribution by country
129
+ sql: |-
130
+ SELECT country,
131
+ COUNT(*) AS company_count,
132
+ SUM(revenue) AS total_revenue
133
+ FROM companies
134
+ GROUP BY country
135
+ ORDER BY company_count DESC
136
+
137
+ - name: top_companies_by_revenue
138
+ description: Largest customers by annual revenue
139
+ sql: |-
140
+ SELECT name, industry, country, revenue, employee_count
141
+ FROM companies
142
+ ORDER BY revenue DESC
143
+ LIMIT 10