@tanstack/cta-engine 0.14.3 → 0.14.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 (343) hide show
  1. package/dist/add-ons.js +5 -91
  2. package/dist/add-to-app.js +171 -0
  3. package/dist/config-file.js +34 -11
  4. package/dist/constants.js +0 -2
  5. package/dist/create-app.js +142 -451
  6. package/dist/custom-add-ons/add-on.js +175 -0
  7. package/dist/custom-add-ons/shared.js +116 -0
  8. package/dist/custom-add-ons/starter.js +84 -0
  9. package/dist/environment.js +67 -44
  10. package/dist/file-helpers.js +165 -0
  11. package/dist/frameworks.js +92 -0
  12. package/dist/index.js +18 -1
  13. package/dist/integrations/git.js +4 -0
  14. package/dist/integrations/shadcn.js +33 -0
  15. package/dist/options.js +9 -333
  16. package/dist/package-json.js +48 -0
  17. package/dist/package-manager.js +51 -6
  18. package/dist/registry.js +56 -0
  19. package/dist/special-steps/index.js +24 -0
  20. package/dist/special-steps/rimraf-node-modules.js +16 -0
  21. package/dist/template-file.js +112 -0
  22. package/dist/types/add-ons.d.ts +3 -8
  23. package/dist/types/add-to-app.d.ts +17 -0
  24. package/dist/types/config-file.d.ts +7 -4
  25. package/dist/types/constants.d.ts +0 -3
  26. package/dist/types/create-app.d.ts +1 -7
  27. package/dist/types/custom-add-ons/add-on.d.ts +69 -0
  28. package/dist/types/custom-add-ons/shared.d.ts +15 -0
  29. package/dist/types/custom-add-ons/starter.d.ts +7 -0
  30. package/dist/types/environment.d.ts +2 -1
  31. package/dist/types/file-helpers.d.ts +15 -0
  32. package/dist/types/frameworks.d.ts +7 -0
  33. package/dist/types/index.d.ts +21 -1
  34. package/dist/types/integrations/git.d.ts +2 -0
  35. package/dist/types/integrations/shadcn.d.ts +2 -0
  36. package/dist/types/options.d.ts +2 -6
  37. package/dist/types/package-json.d.ts +7 -0
  38. package/dist/types/package-manager.d.ts +18 -1
  39. package/dist/types/registry.d.ts +25 -0
  40. package/dist/types/special-steps/index.d.ts +2 -0
  41. package/dist/types/special-steps/rimraf-node-modules.d.ts +2 -0
  42. package/dist/types/template-file.d.ts +2 -0
  43. package/dist/types/types.d.ts +788 -85
  44. package/dist/types/utils.d.ts +5 -0
  45. package/dist/types.js +65 -1
  46. package/dist/utils.js +9 -0
  47. package/package.json +9 -12
  48. package/src/add-ons.ts +7 -123
  49. package/src/add-to-app.ts +276 -0
  50. package/src/config-file.ts +51 -20
  51. package/src/constants.ts +0 -5
  52. package/src/create-app.ts +180 -730
  53. package/src/custom-add-ons/add-on.ts +261 -0
  54. package/src/custom-add-ons/shared.ts +160 -0
  55. package/src/custom-add-ons/starter.ts +126 -0
  56. package/src/environment.ts +80 -45
  57. package/src/file-helpers.ts +235 -0
  58. package/src/frameworks.ts +134 -0
  59. package/src/index.ts +85 -1
  60. package/src/integrations/git.ts +7 -0
  61. package/src/integrations/shadcn.ts +54 -0
  62. package/src/options.ts +8 -409
  63. package/src/package-json.ts +69 -0
  64. package/src/package-manager.ts +80 -9
  65. package/src/registry.ts +92 -0
  66. package/src/special-steps/index.ts +36 -0
  67. package/src/special-steps/rimraf-node-modules.ts +25 -0
  68. package/src/template-file.ts +150 -0
  69. package/src/types.ts +175 -87
  70. package/src/utils.ts +17 -0
  71. package/tests/add-ons.test.ts +67 -0
  72. package/tests/add-to-app.test.ts +358 -0
  73. package/tests/config-file.test.ts +105 -0
  74. package/tests/create-app.test.ts +120 -0
  75. package/tests/custom-add-ons/add-on.test.ts +12 -0
  76. package/tests/custom-add-ons/shared.test.ts +253 -0
  77. package/tests/custom-add-ons/starter.test.ts +58 -0
  78. package/tests/environment.test.ts +115 -0
  79. package/tests/file-helper.test.ts +90 -0
  80. package/tests/frameworks.test.ts +95 -0
  81. package/tests/index.test.ts +9 -0
  82. package/tests/integrations/git.test.ts +20 -0
  83. package/tests/integrations/shadcn.test.ts +91 -0
  84. package/tests/options.test.ts +42 -0
  85. package/tests/package-json.test.ts +63 -0
  86. package/tests/package-manager.test.ts +154 -0
  87. package/tests/setupVitest.ts +6 -0
  88. package/tests/template-file.test.ts +178 -0
  89. package/tests/utils.test.ts +23 -0
  90. package/vitest.config.ts +21 -0
  91. package/dist/add.js +0 -125
  92. package/dist/cli.js +0 -132
  93. package/dist/custom-add-on.js +0 -254
  94. package/dist/file-helper.js +0 -18
  95. package/dist/mcp.js +0 -229
  96. package/dist/templates.js +0 -6
  97. package/dist/toolchain.js +0 -6
  98. package/dist/types/add.d.ts +0 -3
  99. package/dist/types/cli.d.ts +0 -7
  100. package/dist/types/custom-add-on.d.ts +0 -3
  101. package/dist/types/file-helper.d.ts +0 -2
  102. package/dist/types/mcp.d.ts +0 -7
  103. package/dist/types/templates.d.ts +0 -1
  104. package/dist/types/toolchain.d.ts +0 -3
  105. package/src/add.ts +0 -186
  106. package/src/cli.ts +0 -210
  107. package/src/custom-add-on.ts +0 -325
  108. package/src/file-helper.ts +0 -20
  109. package/src/mcp.ts +0 -302
  110. package/src/templates.ts +0 -7
  111. package/src/toolchain.ts +0 -7
  112. package/templates/react/add-on/clerk/README.md +0 -3
  113. package/templates/react/add-on/clerk/assets/_dot_env.local.append +0 -2
  114. package/templates/react/add-on/clerk/assets/src/integrations/clerk/header-user.tsx +0 -19
  115. package/templates/react/add-on/clerk/assets/src/integrations/clerk/provider.tsx +0 -18
  116. package/templates/react/add-on/clerk/assets/src/routes/demo.clerk.tsx +0 -20
  117. package/templates/react/add-on/clerk/info.json +0 -13
  118. package/templates/react/add-on/clerk/package.json +0 -5
  119. package/templates/react/add-on/convex/README.md +0 -4
  120. package/templates/react/add-on/convex/assets/_dot_cursorrules.append +0 -93
  121. package/templates/react/add-on/convex/assets/_dot_env.local.append +0 -3
  122. package/templates/react/add-on/convex/assets/convex/products.ts +0 -8
  123. package/templates/react/add-on/convex/assets/convex/schema.ts +0 -10
  124. package/templates/react/add-on/convex/assets/src/integrations/convex/provider.tsx +0 -20
  125. package/templates/react/add-on/convex/assets/src/routes/demo.convex.tsx +0 -33
  126. package/templates/react/add-on/convex/info.json +0 -13
  127. package/templates/react/add-on/convex/package.json +0 -6
  128. package/templates/react/add-on/form/assets/src/components/demo.FormComponents.tsx.ejs +0 -300
  129. package/templates/react/add-on/form/assets/src/hooks/demo.form-context.ts +0 -4
  130. package/templates/react/add-on/form/assets/src/hooks/demo.form.ts +0 -22
  131. package/templates/react/add-on/form/assets/src/routes/demo.form.address.tsx.ejs +0 -213
  132. package/templates/react/add-on/form/assets/src/routes/demo.form.simple.tsx.ejs +0 -77
  133. package/templates/react/add-on/form/info.json +0 -26
  134. package/templates/react/add-on/form/package.json +0 -6
  135. package/templates/react/add-on/module-federation/assets/module-federation.config.js.ejs +0 -31
  136. package/templates/react/add-on/module-federation/assets/src/demo-mf-component.tsx +0 -3
  137. package/templates/react/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +0 -11
  138. package/templates/react/add-on/module-federation/info.json +0 -7
  139. package/templates/react/add-on/module-federation/package.json +0 -5
  140. package/templates/react/add-on/netlify/README.md +0 -11
  141. package/templates/react/add-on/netlify/info.json +0 -7
  142. package/templates/react/add-on/sentry/assets/_dot_cursorrules.append +0 -22
  143. package/templates/react/add-on/sentry/assets/_dot_env.local.append +0 -11
  144. package/templates/react/add-on/sentry/assets/src/app/global-middleware.ts +0 -11
  145. package/templates/react/add-on/sentry/assets/src/routes/demo.sentry.testing.tsx +0 -489
  146. package/templates/react/add-on/sentry/info.json +0 -14
  147. package/templates/react/add-on/sentry/package.json +0 -5
  148. package/templates/react/add-on/shadcn/README.md +0 -7
  149. package/templates/react/add-on/shadcn/assets/_dot_cursorrules.append +0 -7
  150. package/templates/react/add-on/shadcn/assets/components.json +0 -21
  151. package/templates/react/add-on/shadcn/assets/src/lib/utils.ts +0 -6
  152. package/templates/react/add-on/shadcn/assets/src/styles.css +0 -138
  153. package/templates/react/add-on/shadcn/info.json +0 -7
  154. package/templates/react/add-on/shadcn/package.json +0 -9
  155. package/templates/react/add-on/start/assets/_dot_gitignore.append +0 -2
  156. package/templates/react/add-on/start/assets/app.config.ts.ejs +0 -32
  157. package/templates/react/add-on/start/assets/src/api.ts +0 -6
  158. package/templates/react/add-on/start/assets/src/client.tsx.ejs +0 -33
  159. package/templates/react/add-on/start/assets/src/router.tsx.ejs +0 -48
  160. package/templates/react/add-on/start/assets/src/routes/api.demo-names.ts +0 -11
  161. package/templates/react/add-on/start/assets/src/routes/demo.start.api-request.tsx.ejs +0 -33
  162. package/templates/react/add-on/start/assets/src/routes/demo.start.server-funcs.tsx +0 -50
  163. package/templates/react/add-on/start/assets/src/ssr.tsx.ejs +0 -30
  164. package/templates/react/add-on/start/info.json +0 -18
  165. package/templates/react/add-on/start/package.json +0 -13
  166. package/templates/react/add-on/store/assets/src/lib/demo-store.ts +0 -13
  167. package/templates/react/add-on/store/assets/src/routes/demo.store.tsx.ejs +0 -75
  168. package/templates/react/add-on/store/info.json +0 -13
  169. package/templates/react/add-on/store/package.json +0 -6
  170. package/templates/react/add-on/t3env/README.md +0 -16
  171. package/templates/react/add-on/t3env/assets/src/env.ts +0 -39
  172. package/templates/react/add-on/t3env/info.json +0 -10
  173. package/templates/react/add-on/t3env/package.json +0 -6
  174. package/templates/react/add-on/tRPC/assets/src/integrations/trpc/init.ts +0 -9
  175. package/templates/react/add-on/tRPC/assets/src/integrations/trpc/react.ts +0 -4
  176. package/templates/react/add-on/tRPC/assets/src/integrations/trpc/router.ts +0 -18
  177. package/templates/react/add-on/tRPC/assets/src/routes/api.trpc.$.tsx +0 -16
  178. package/templates/react/add-on/tRPC/info.json +0 -9
  179. package/templates/react/add-on/tRPC/package.json +0 -9
  180. package/templates/react/add-on/table/assets/src/data/demo-table-data.ts +0 -50
  181. package/templates/react/add-on/table/assets/src/routes/demo.table.tsx.ejs +0 -373
  182. package/templates/react/add-on/table/info.json +0 -13
  183. package/templates/react/add-on/table/package.json +0 -7
  184. package/templates/react/add-on/tanstack-query/assets/src/integrations/tanstack-query/layout.tsx +0 -5
  185. package/templates/react/add-on/tanstack-query/assets/src/integrations/tanstack-query/root-provider.tsx.ejs +0 -70
  186. package/templates/react/add-on/tanstack-query/assets/src/routes/demo.tanstack-query.tsx.ejs +0 -53
  187. package/templates/react/add-on/tanstack-query/info.json +0 -13
  188. package/templates/react/add-on/tanstack-query/package.json +0 -6
  189. package/templates/react/base/README.md.ejs +0 -558
  190. package/templates/react/base/_dot_gitignore +0 -5
  191. package/templates/react/base/_dot_vscode/settings.biome.json +0 -38
  192. package/templates/react/base/_dot_vscode/settings.json +0 -11
  193. package/templates/react/base/index.html.ejs +0 -20
  194. package/templates/react/base/package.biome.json +0 -10
  195. package/templates/react/base/package.eslintprettier.json +0 -11
  196. package/templates/react/base/package.json +0 -30
  197. package/templates/react/base/package.ts.json +0 -7
  198. package/templates/react/base/package.tw.json +0 -6
  199. package/templates/react/base/public/favicon.ico +0 -0
  200. package/templates/react/base/public/logo192.png +0 -0
  201. package/templates/react/base/public/logo512.png +0 -0
  202. package/templates/react/base/public/manifest.json +0 -25
  203. package/templates/react/base/public/robots.txt +0 -3
  204. package/templates/react/base/src/App.css +0 -38
  205. package/templates/react/base/src/App.test.tsx.ejs +0 -10
  206. package/templates/react/base/src/App.tsx.ejs +0 -74
  207. package/templates/react/base/src/components/Header.tsx.ejs +0 -27
  208. package/templates/react/base/src/logo.svg +0 -44
  209. package/templates/react/base/src/reportWebVitals.ts.ejs +0 -28
  210. package/templates/react/base/src/styles.css.ejs +0 -15
  211. package/templates/react/base/toolchain/.prettierignore +0 -3
  212. package/templates/react/base/toolchain/biome.json +0 -31
  213. package/templates/react/base/toolchain/eslint.config.js +0 -5
  214. package/templates/react/base/toolchain/prettier.config.js +0 -10
  215. package/templates/react/base/tsconfig.json.ejs +0 -29
  216. package/templates/react/base/vite.config.js.ejs +0 -23
  217. package/templates/react/code-router/src/main.tsx.ejs +0 -92
  218. package/templates/react/example/tanchat/README.md +0 -37
  219. package/templates/react/example/tanchat/assets/_dot_env.local.append +0 -2
  220. package/templates/react/example/tanchat/assets/public/example-guitar-flowers.jpg +0 -0
  221. package/templates/react/example/tanchat/assets/public/example-guitar-motherboard.jpg +0 -0
  222. package/templates/react/example/tanchat/assets/public/example-guitar-racing.jpg +0 -0
  223. package/templates/react/example/tanchat/assets/public/example-guitar-steamer-trunk.jpg +0 -0
  224. package/templates/react/example/tanchat/assets/public/example-guitar-superhero.jpg +0 -0
  225. package/templates/react/example/tanchat/assets/public/example-guitar-traveling.jpg +0 -0
  226. package/templates/react/example/tanchat/assets/public/example-guitar-video-games.jpg +0 -0
  227. package/templates/react/example/tanchat/assets/src/components/example-AIAssistant.tsx +0 -173
  228. package/templates/react/example/tanchat/assets/src/components/example-GuitarRecommendation.tsx +0 -47
  229. package/templates/react/example/tanchat/assets/src/data/example-guitars.ts +0 -83
  230. package/templates/react/example/tanchat/assets/src/demo.index.css +0 -220
  231. package/templates/react/example/tanchat/assets/src/integrations/tanchat/header-user.tsx +0 -5
  232. package/templates/react/example/tanchat/assets/src/routes/api.messages.ts +0 -24
  233. package/templates/react/example/tanchat/assets/src/routes/api.sse.ts +0 -23
  234. package/templates/react/example/tanchat/assets/src/routes/example.chat.tsx +0 -159
  235. package/templates/react/example/tanchat/assets/src/routes/example.guitars/$guitarId.tsx +0 -50
  236. package/templates/react/example/tanchat/assets/src/routes/example.guitars/index.tsx +0 -54
  237. package/templates/react/example/tanchat/assets/src/store/example-assistant.ts +0 -3
  238. package/templates/react/example/tanchat/assets/src/utils/demo.ai.ts +0 -62
  239. package/templates/react/example/tanchat/assets/src/utils/demo.sse.ts +0 -31
  240. package/templates/react/example/tanchat/assets/src/utils/demo.tools.ts +0 -47
  241. package/templates/react/example/tanchat/info.json +0 -19
  242. package/templates/react/example/tanchat/package.json +0 -16
  243. package/templates/react/file-router/package.fr.json +0 -5
  244. package/templates/react/file-router/src/main.tsx.ejs +0 -55
  245. package/templates/react/file-router/src/routes/__root.tsx.ejs +0 -82
  246. package/templates/solid/add-on/form/assets/src/routes/demo.form.tsx.ejs +0 -352
  247. package/templates/solid/add-on/form/info.json +0 -13
  248. package/templates/solid/add-on/form/package.json +0 -5
  249. package/templates/solid/add-on/module-federation/assets/module-federation.config.js.ejs +0 -27
  250. package/templates/solid/add-on/module-federation/assets/src/demo-mf-component.tsx +0 -3
  251. package/templates/solid/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +0 -9
  252. package/templates/solid/add-on/module-federation/info.json +0 -7
  253. package/templates/solid/add-on/module-federation/package.json +0 -5
  254. package/templates/solid/add-on/sentry/assets/_dot_cursorrules.append +0 -22
  255. package/templates/solid/add-on/sentry/assets/_dot_env.local.append +0 -2
  256. package/templates/solid/add-on/sentry/assets/src/routes/demo.sentry.bad-event-handler.tsx +0 -20
  257. package/templates/solid/add-on/sentry/info.json +0 -13
  258. package/templates/solid/add-on/sentry/package.json +0 -5
  259. package/templates/solid/add-on/solid-ui/README.md +0 -9
  260. package/templates/solid/add-on/solid-ui/assets/src/lib/utils.ts +0 -6
  261. package/templates/solid/add-on/solid-ui/assets/src/styles.css +0 -138
  262. package/templates/solid/add-on/solid-ui/assets/ui.config.json +0 -13
  263. package/templates/solid/add-on/solid-ui/info.json +0 -11
  264. package/templates/solid/add-on/solid-ui/package.json +0 -9
  265. package/templates/solid/add-on/start/assets/app.config.ts +0 -16
  266. package/templates/solid/add-on/start/assets/src/api.ts +0 -6
  267. package/templates/solid/add-on/start/assets/src/client.tsx +0 -7
  268. package/templates/solid/add-on/start/assets/src/router.tsx.ejs +0 -24
  269. package/templates/solid/add-on/start/assets/src/routes/demo.start.server-funcs.tsx +0 -49
  270. package/templates/solid/add-on/start/assets/src/ssr.tsx +0 -12
  271. package/templates/solid/add-on/start/info.json +0 -14
  272. package/templates/solid/add-on/start/package.json +0 -12
  273. package/templates/solid/add-on/store/assets/src/lib/demo-store.ts +0 -13
  274. package/templates/solid/add-on/store/assets/src/routes/demo.store.tsx.ejs +0 -77
  275. package/templates/solid/add-on/store/info.json +0 -13
  276. package/templates/solid/add-on/store/package.json +0 -6
  277. package/templates/solid/add-on/t3env/README.md +0 -16
  278. package/templates/solid/add-on/t3env/assets/src/env.ts +0 -39
  279. package/templates/solid/add-on/t3env/info.json +0 -10
  280. package/templates/solid/add-on/t3env/package.json +0 -6
  281. package/templates/solid/add-on/tanstack-query/assets/src/integrations/tanstack-query/header-user.tsx +0 -5
  282. package/templates/solid/add-on/tanstack-query/assets/src/integrations/tanstack-query/provider.tsx +0 -15
  283. package/templates/solid/add-on/tanstack-query/assets/src/routes/demo.tanstack-query.tsx +0 -30
  284. package/templates/solid/add-on/tanstack-query/info.json +0 -13
  285. package/templates/solid/add-on/tanstack-query/package.json +0 -6
  286. package/templates/solid/base/README.md.ejs +0 -215
  287. package/templates/solid/base/_dot_cursorrules.append +0 -35
  288. package/templates/solid/base/_dot_gitignore +0 -5
  289. package/templates/solid/base/_dot_vscode/settings.biome.json +0 -38
  290. package/templates/solid/base/_dot_vscode/settings.json +0 -11
  291. package/templates/solid/base/index.html.ejs +0 -20
  292. package/templates/solid/base/package.biome.json +0 -10
  293. package/templates/solid/base/package.eslintprettier.json +0 -11
  294. package/templates/solid/base/package.json +0 -23
  295. package/templates/solid/base/package.ts.json +0 -5
  296. package/templates/solid/base/package.tw.json +0 -6
  297. package/templates/solid/base/public/favicon.ico +0 -0
  298. package/templates/solid/base/public/logo192.png +0 -0
  299. package/templates/solid/base/public/logo512.png +0 -0
  300. package/templates/solid/base/public/manifest.json +0 -25
  301. package/templates/solid/base/public/robots.txt +0 -3
  302. package/templates/solid/base/src/App.css +0 -0
  303. package/templates/solid/base/src/App.tsx.ejs +0 -47
  304. package/templates/solid/base/src/components/Header.tsx.ejs +0 -26
  305. package/templates/solid/base/src/logo.svg +0 -120
  306. package/templates/solid/base/src/styles.css.ejs +0 -15
  307. package/templates/solid/base/toolchain/.prettierignore +0 -3
  308. package/templates/solid/base/toolchain/biome.json +0 -31
  309. package/templates/solid/base/toolchain/eslint.config.js +0 -5
  310. package/templates/solid/base/toolchain/prettier.config.js +0 -10
  311. package/templates/solid/base/tsconfig.json.ejs +0 -31
  312. package/templates/solid/base/vite.config.js.ejs +0 -22
  313. package/templates/solid/code-router/src/main.tsx.ejs +0 -71
  314. package/templates/solid/example/tanchat/README.md +0 -52
  315. package/templates/solid/example/tanchat/assets/ai-streaming-server/README.md +0 -110
  316. package/templates/solid/example/tanchat/assets/ai-streaming-server/_dot_env.example +0 -1
  317. package/templates/solid/example/tanchat/assets/ai-streaming-server/package.json +0 -26
  318. package/templates/solid/example/tanchat/assets/ai-streaming-server/src/index.ts +0 -102
  319. package/templates/solid/example/tanchat/assets/ai-streaming-server/tsconfig.json +0 -15
  320. package/templates/solid/example/tanchat/assets/src/components/demo.SettingsDialog.tsx +0 -149
  321. package/templates/solid/example/tanchat/assets/src/demo.index.css +0 -227
  322. package/templates/solid/example/tanchat/assets/src/lib/demo-store.ts +0 -13
  323. package/templates/solid/example/tanchat/assets/src/routes/example.chat.tsx +0 -435
  324. package/templates/solid/example/tanchat/assets/src/store/demo.hooks.ts +0 -17
  325. package/templates/solid/example/tanchat/assets/src/store/demo.store.ts +0 -133
  326. package/templates/solid/example/tanchat/info.json +0 -14
  327. package/templates/solid/example/tanchat/package.json +0 -7
  328. package/templates/solid/file-router/package.fr.json +0 -5
  329. package/templates/solid/file-router/src/main.tsx.ejs +0 -47
  330. package/templates/solid/file-router/src/routes/__root.tsx.ejs +0 -41
  331. package/templates/solid/file-router/src/routes/index.tsx +0 -43
  332. package/tests/cra.test.ts +0 -293
  333. package/tests/snapshots/cra/cr-js-npm.json +0 -33
  334. package/tests/snapshots/cra/cr-ts-npm.json +0 -34
  335. package/tests/snapshots/cra/cr-ts-start-npm.json +0 -38
  336. package/tests/snapshots/cra/fr-ts-npm.json +0 -34
  337. package/tests/snapshots/cra/fr-ts-tw-npm.json +0 -33
  338. package/tests/snapshots/cra/solid-cr-js-npm.json +0 -31
  339. package/tests/snapshots/cra/solid-cr-ts-npm.json +0 -32
  340. package/tests/snapshots/cra/solid-cr-ts-start-npm.json +0 -36
  341. package/tests/snapshots/cra/solid-fr-ts-npm.json +0 -33
  342. package/tests/snapshots/cra/solid-fr-ts-tw-npm.json +0 -32
  343. package/tests/test-utilities.ts +0 -87
@@ -1,52 +0,0 @@
1
- # TanStack Chat Application
2
-
3
- Am example chat application built with TanStack Start, TanStack Store, and Claude AI.
4
-
5
- ## Sidecar service
6
-
7
- This applicaton requires a sidecar microservice to be running. The server is located in the `ai-streaming-service` directory.
8
-
9
- In that directory you should edit the `.env.local` file to add your Anthropic API key:
10
-
11
- ```env
12
- ANTHROPIC_API_KEY=your_anthropic_api_key
13
- ```
14
-
15
- Then run the server:
16
-
17
- ```bash
18
- cd ai-streaming-service
19
- npm install
20
- npm run dev
21
- ```
22
-
23
- ## ✨ Features
24
-
25
- ### AI Capabilities
26
-
27
- - 🤖 Powered by Claude 3.5 Sonnet
28
- - 📝 Rich markdown formatting with syntax highlighting
29
- - 🎯 Customizable system prompts for tailored AI behavior
30
- - 🔄 Real-time message updates and streaming responses (coming soon)
31
-
32
- ### User Experience
33
-
34
- - 🎨 Modern UI with Tailwind CSS and Lucide icons
35
- - 🔍 Conversation management and history
36
- - 🔐 Secure API key management
37
- - 📋 Markdown rendering with code highlighting
38
-
39
- ### Technical Features
40
-
41
- - 📦 Centralized state management with TanStack Store
42
- - 🔌 Extensible architecture for multiple AI providers
43
- - 🛠️ TypeScript for type safety
44
-
45
- ## Architecture
46
-
47
- ### Tech Stack
48
-
49
- - **Routing**: TanStack Router
50
- - **State Management**: TanStack Store
51
- - **Styling**: Tailwind CSS
52
- - **AI Integration**: Anthropic's Claude API
@@ -1,110 +0,0 @@
1
- # AI Streaming Server
2
-
3
- An Express server with TypeScript that provides a streaming API endpoint for Anthropic's Claude AI model.
4
-
5
- ## Setup
6
-
7
- 1. Clone the repository
8
- 2. Install dependencies:
9
- ```bash
10
- npm install
11
- ```
12
- 3. Copy `.env.example` to `.env` and add your Anthropic API key:
13
- ```bash
14
- cp .env.example .env
15
- ```
16
- 4. Edit `.env` and replace `your_api_key_here` with your actual Anthropic API key
17
-
18
- ## Development
19
-
20
- Run in development mode with auto-reload:
21
-
22
- ```bash
23
- npm run dev
24
- ```
25
-
26
- Type checking:
27
-
28
- ```bash
29
- npm run typecheck
30
- ```
31
-
32
- ## Production
33
-
34
- Build the TypeScript code:
35
-
36
- ```bash
37
- npm run build
38
- ```
39
-
40
- Run in production mode:
41
-
42
- ```bash
43
- npm start
44
- ```
45
-
46
- ## API Usage
47
-
48
- ### POST /api/chat
49
-
50
- Endpoint that accepts chat messages and returns a streaming response from Claude.
51
-
52
- #### Request Body
53
-
54
- ```typescript
55
- interface ChatMessage {
56
- role: "user" | "assistant";
57
- content: string;
58
- }
59
-
60
- interface ChatRequest {
61
- messages: ChatMessage[];
62
- }
63
- ```
64
-
65
- Example request:
66
-
67
- ```json
68
- {
69
- "messages": [{ "role": "user", "content": "Hello, how are you?" }]
70
- }
71
- ```
72
-
73
- #### Response
74
-
75
- The endpoint returns a Server-Sent Events (SSE) stream. Each event contains a chunk of the response from Claude.
76
-
77
- Example usage with JavaScript/TypeScript:
78
-
79
- ```typescript
80
- const response = await fetch("http://localhost:3000/api/chat", {
81
- method: "POST",
82
- headers: {
83
- "Content-Type": "application/json",
84
- },
85
- body: JSON.stringify({
86
- messages: [{ role: "user", content: "Hello, how are you?" }],
87
- }),
88
- });
89
-
90
- const reader = response.body!.getReader();
91
- const decoder = new TextDecoder();
92
-
93
- while (true) {
94
- const { value, done } = await reader.read();
95
- if (done) break;
96
-
97
- const chunk = decoder.decode(value);
98
- const lines = chunk.split("\n");
99
-
100
- for (const line of lines) {
101
- if (line.startsWith("data: ")) {
102
- const data = JSON.parse(line.slice(6));
103
- if (data === "[DONE]") break;
104
-
105
- // Handle the streaming response chunk
106
- console.log(data);
107
- }
108
- }
109
- }
110
- ```
@@ -1 +0,0 @@
1
- ANTHROPIC_API_KEY=your_api_key_here
@@ -1,26 +0,0 @@
1
- {
2
- "name": "ai-streaming-server",
3
- "version": "1.0.0",
4
- "description": "Express server for streaming Anthropic AI chat responses",
5
- "main": "dist/index.js",
6
- "type": "module",
7
- "scripts": {
8
- "build": "tsc",
9
- "start": "node dist/index.js",
10
- "dev": "tsx watch src/index.ts",
11
- "typecheck": "tsc --noEmit"
12
- },
13
- "dependencies": {
14
- "@anthropic-ai/sdk": "^0.18.0",
15
- "cors": "^2.8.5",
16
- "dotenv": "^16.4.5",
17
- "express": "^4.18.3"
18
- },
19
- "devDependencies": {
20
- "@types/cors": "^2.8.17",
21
- "@types/express": "^4.17.21",
22
- "@types/node": "^20.11.24",
23
- "tsx": "^4.7.1",
24
- "typescript": "^5.3.3"
25
- }
26
- }
@@ -1,102 +0,0 @@
1
- import express, { Request, Response } from 'express'
2
- import cors from 'cors'
3
- import dotenv from 'dotenv'
4
- import Anthropic from '@anthropic-ai/sdk'
5
-
6
- // Load environment variables
7
- dotenv.config()
8
-
9
- const app = express()
10
- const port = process.env.PORT || 8080
11
-
12
- // Middleware
13
- app.use(cors())
14
- app.use(express.json())
15
-
16
- // Initialize Anthropic client
17
- const anthropic = new Anthropic({
18
- apiKey: process.env.ANTHROPIC_API_KEY,
19
- })
20
-
21
- // Define types for the request body
22
- interface ChatMessage {
23
- role: 'user' | 'assistant'
24
- content: string
25
- }
26
-
27
- interface ChatRequest {
28
- messages: ChatMessage[]
29
- }
30
-
31
- // Streaming chat endpoint
32
- app.post(
33
- '/api/chat',
34
- async (req: Request<{}, {}, ChatRequest>, res: Response) => {
35
- try {
36
- const { messages } = req.body
37
-
38
- if (!messages || !Array.isArray(messages)) {
39
- return res.status(400).json({ error: 'Messages array is required' })
40
- }
41
-
42
- // Validate message format
43
- const isValidMessages = messages.every(
44
- (msg): msg is ChatMessage =>
45
- typeof msg === 'object' &&
46
- (msg.role === 'user' || msg.role === 'assistant') &&
47
- typeof msg.content === 'string',
48
- )
49
-
50
- if (!isValidMessages) {
51
- return res.status(400).json({
52
- error:
53
- "Invalid message format. Each message must have 'role' and 'content'",
54
- })
55
- }
56
-
57
- // Set up SSE headers
58
- res.setHeader('Content-Type', 'text/event-stream')
59
- res.setHeader('Cache-Control', 'no-cache')
60
- res.setHeader('Connection', 'keep-alive')
61
-
62
- // Create the message stream
63
- const stream = await anthropic.messages.create({
64
- messages: messages.map((msg) => ({
65
- role: msg.role,
66
- content: msg.content,
67
- })),
68
- model: 'claude-3-opus-20240229',
69
- max_tokens: 4096,
70
- stream: true,
71
- })
72
-
73
- // Stream the response
74
- for await (const chunk of stream) {
75
- if (chunk.type === 'content_block_delta') {
76
- res.write(`data: ${JSON.stringify(chunk)}\n\n`)
77
- }
78
- }
79
-
80
- // End the stream
81
- res.write('data: [DONE]\n\n')
82
- res.end()
83
- } catch (error) {
84
- console.error('Error:', error)
85
- // If headers haven't been sent yet, send error response
86
- if (!res.headersSent) {
87
- res.status(500).json({ error: 'Internal server error' })
88
- } else {
89
- // If streaming has started, send error event
90
- const errorMessage =
91
- error instanceof Error ? error.message : 'Unknown error'
92
- res.write(`data: ${JSON.stringify({ error: errorMessage })}\n\n`)
93
- res.end()
94
- }
95
- }
96
- },
97
- )
98
-
99
- // Start the server
100
- app.listen(port, () => {
101
- console.log(`Server is running on port ${port}`)
102
- })
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "esModuleInterop": true,
7
- "strict": true,
8
- "skipLibCheck": true,
9
- "outDir": "dist",
10
- "rootDir": "src",
11
- "sourceMap": true
12
- },
13
- "include": ["src/**/*"],
14
- "exclude": ["node_modules", "dist"]
15
- }
@@ -1,149 +0,0 @@
1
- import { PlusCircle, Trash2 } from 'lucide-solid'
2
- import { useAppActions, useAppState } from '../store/demo.hooks'
3
- import { createSignal } from 'solid-js'
4
-
5
- interface SettingsDialogProps {
6
- isOpen: boolean
7
- onClose: () => void
8
- }
9
-
10
- export function SettingsDialog(props: SettingsDialogProps) {
11
- const [promptForm, setPromptForm] = createSignal({ name: '', content: '' })
12
- const [isAddingPrompt, setIsAddingPrompt] = createSignal(false)
13
- const state = useAppState()
14
- const actions = useAppActions();
15
-
16
- const handleAddPrompt = () => {
17
- if (!promptForm.name.trim() || !promptForm().content.trim()) return
18
- actions.createPrompt(promptForm().name, promptForm().content)
19
- setPromptForm({ name: '', content: '' })
20
- setIsAddingPrompt(false)
21
- }
22
-
23
- const handleClose = () => {
24
- props.onClose()
25
- setIsAddingPrompt(false)
26
- setPromptForm({ name: '', content: '' })
27
- }
28
-
29
- if (!props.isOpen) return null
30
-
31
- return (
32
- <div class="fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center" onClick={(e) => {
33
- if (e.target === e.currentTarget) handleClose()
34
- }}>
35
- <div class="bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto" onClick={e => e.stopPropagation()}>
36
- <div class="p-6">
37
- <div class="flex items-center justify-between mb-4">
38
- <h2 class="text-2xl font-semibold text-white">Settings</h2>
39
- <button
40
- onClick={handleClose}
41
- class="text-gray-400 hover:text-white focus:outline-none"
42
- >
43
- <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
44
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width={2} d="M6 18L18 6M6 6l12 12" />
45
- </svg>
46
- </button>
47
- </div>
48
-
49
- <div class="space-y-6">
50
- {/* Prompts Management */}
51
- <div class="space-y-2">
52
- <div class="flex items-center justify-between mb-4">
53
- <label class="block text-sm font-medium text-white">
54
- System Prompts
55
- </label>
56
- <button
57
- onClick={() => setIsAddingPrompt(true)}
58
- class="flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-white bg-gradient-to-r from-orange-500 to-red-600 rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-orange-500"
59
- >
60
- <PlusCircle class="w-4 h-4" />
61
- Add Prompt
62
- </button>
63
- </div>
64
-
65
- {isAddingPrompt() && (
66
- <div class="space-y-3 mb-4 p-3 bg-gray-700/50 rounded-lg">
67
- <input
68
- type="text"
69
- value={promptForm().name}
70
- onChange={(e) => setPromptForm(prev => ({ ...prev, name: e.target.value }))}
71
- placeholder="Prompt name..."
72
- class="w-full px-3 py-2 text-sm text-white bg-gray-700 rounded-lg border border-gray-600 focus:border-orange-500 focus:ring-1 focus:ring-orange-500"
73
- />
74
- <textarea
75
- value={promptForm().content}
76
- onChange={(e) => setPromptForm(prev => ({ ...prev, content: e.target.value }))}
77
- placeholder="Enter prompt content..."
78
- class="w-full h-32 px-3 py-2 text-sm text-white bg-gray-700 rounded-lg border border-gray-600 focus:border-orange-500 focus:ring-1 focus:ring-orange-500"
79
- />
80
- <div class="flex justify-end gap-2">
81
- <button
82
- onClick={() => setIsAddingPrompt(false)}
83
- class="px-3 py-1.5 text-sm font-medium text-gray-300 hover:text-white focus:outline-none"
84
- >
85
- Cancel
86
- </button>
87
- <button
88
- onClick={handleAddPrompt}
89
- class="px-3 py-1.5 text-sm font-medium text-white bg-gradient-to-r from-orange-500 to-red-600 rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-orange-500"
90
- >
91
- Save Prompt
92
- </button>
93
- </div>
94
- </div>
95
- )}
96
-
97
- <div class="space-y-2">
98
- {state().prompts.map((prompt) => (
99
- <div class="flex items-center justify-between p-3 bg-gray-700/50 rounded-lg">
100
- <div class="flex-1 min-w-0 mr-4">
101
- <h4 class="text-sm font-medium text-white truncate">{prompt.name}</h4>
102
- <p class="text-xs text-gray-400 truncate">{prompt.content}</p>
103
- </div>
104
- <div class="flex items-center gap-2">
105
- <label class="relative inline-flex items-center cursor-pointer">
106
- <input
107
- type="checkbox"
108
- class="sr-only peer"
109
- checked={prompt.is_active}
110
- onChange={() => actions.setPromptActive(prompt.id, !prompt.is_active)}
111
- />
112
- <div class="w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-orange-500"></div>
113
- </label>
114
- <button
115
- onClick={() => actions.deletePrompt(prompt.id)}
116
- class="p-1 text-gray-400 hover:text-red-500"
117
- >
118
- <Trash2 class="w-4 h-4" />
119
- </button>
120
- </div>
121
- </div>
122
- ))}
123
- </div>
124
- <p class="text-xs text-gray-400">
125
- Create and manage custom system prompts. Only one prompt can be active at a time.
126
- </p>
127
- </div>
128
-
129
- </div>
130
-
131
- <div class="mt-6 flex justify-end gap-3">
132
- <button
133
- onClick={handleClose}
134
- class="px-4 py-2 text-sm font-medium text-gray-300 hover:text-white focus:outline-none"
135
- >
136
- Cancel
137
- </button>
138
- <button
139
- onClick={handleClose}
140
- class="px-4 py-2 text-sm font-medium text-white bg-gradient-to-r from-orange-500 to-red-600 rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-orange-500"
141
- >
142
- Close
143
- </button>
144
- </div>
145
- </div>
146
- </div>
147
- </div>
148
- )
149
- }
@@ -1,227 +0,0 @@
1
- @import "tailwindcss";
2
- @import "highlight.js/styles/github-dark.css";
3
-
4
- /* Custom scrollbar styles */
5
- ::-webkit-scrollbar {
6
- width: 8px;
7
- }
8
-
9
- ::-webkit-scrollbar-track {
10
- background: transparent;
11
- }
12
-
13
- ::-webkit-scrollbar-thumb {
14
- background-color: rgba(156, 163, 175, 0.5);
15
- border-radius: 4px;
16
- }
17
-
18
- ::-webkit-scrollbar-thumb:hover {
19
- background-color: rgba(156, 163, 175, 0.7);
20
- }
21
-
22
- /* Smooth transitions for dark mode */
23
- html {
24
- transition: background-color 0.3s ease;
25
- }
26
-
27
- /* Markdown content styles */
28
- .prose {
29
- max-width: none;
30
- color: #e5e7eb; /* text-gray-200 */
31
- }
32
-
33
- /* .prose p {
34
- margin-top: 1.25em;
35
- margin-bottom: 1.25em;
36
- } */
37
-
38
- .prose code {
39
- color: #e5e7eb;
40
- background-color: rgba(31, 41, 55, 0.5);
41
- padding: 0.2em 0.4em;
42
- border-radius: 0.375rem;
43
- font-size: 0.875em;
44
- }
45
-
46
- .prose pre {
47
- background-color: rgba(31, 41, 55, 0.5);
48
- border-radius: 0.5rem;
49
- padding: 1rem;
50
- margin: 1.25em 0;
51
- overflow-x: auto;
52
- }
53
-
54
- .prose pre code {
55
- background-color: transparent;
56
- padding: 0;
57
- border-radius: 0;
58
- color: inherit;
59
- }
60
-
61
- .prose h1,
62
- .prose h2,
63
- .prose h3,
64
- .prose h4 {
65
- color: #f9fafb; /* text-gray-50 */
66
- /* margin-top: 2em; */
67
- /* margin-bottom: 1em; */
68
- }
69
-
70
- .prose ul,
71
- .prose ol {
72
- margin-top: 1.25em;
73
- margin-bottom: 1.25em;
74
- padding-left: 1.625em;
75
- }
76
-
77
- .prose li {
78
- margin-top: 0.5em;
79
- margin-bottom: 0.5em;
80
- }
81
-
82
- .prose blockquote {
83
- border-left-color: #f97316; /* orange-500 */
84
- background-color: rgba(249, 115, 22, 0.1);
85
- padding: 1em;
86
- margin: 1.25em 0;
87
- border-radius: 0.5rem;
88
- }
89
-
90
- .prose hr {
91
- border-color: rgba(249, 115, 22, 0.2);
92
- margin: 2em 0;
93
- }
94
-
95
- .prose a {
96
- color: #f97316; /* orange-500 */
97
- text-decoration: underline;
98
- text-decoration-thickness: 0.1em;
99
- text-underline-offset: 0.2em;
100
- }
101
-
102
- .prose a:hover {
103
- color: #fb923c; /* orange-400 */
104
- }
105
-
106
- .prose table {
107
- width: 100%;
108
- border-collapse: collapse;
109
- margin: 1.25em 0;
110
- }
111
-
112
- .prose th,
113
- .prose td {
114
- padding: 0.75em;
115
- border: 1px solid rgba(249, 115, 22, 0.2);
116
- }
117
-
118
- .prose th {
119
- background-color: rgba(249, 115, 22, 0.1);
120
- font-weight: 600;
121
- }
122
-
123
- /* Message transition animations */
124
- .message-enter {
125
- opacity: 0;
126
- transform: translateY(10px);
127
- }
128
-
129
- .message-enter-active {
130
- opacity: 1;
131
- transform: translateY(0);
132
- transition:
133
- opacity 300ms,
134
- transform 300ms;
135
- }
136
-
137
- .message-exit {
138
- opacity: 1;
139
- }
140
-
141
- .message-exit-active {
142
- opacity: 0;
143
- transition: opacity 300ms;
144
- }
145
-
146
- /* Add/update these styles to match AI formatting capabilities */
147
- .prose h1 {
148
- font-size: 2em;
149
- /* margin-top: 1em; */
150
- margin-bottom: 0.5em;
151
- }
152
-
153
- .prose h2 {
154
- font-size: 1.5em;
155
- margin-top: 1em;
156
- margin-bottom: 0.5em;
157
- }
158
-
159
- .prose h3 {
160
- font-size: 1.25em;
161
- margin-top: 1em;
162
- margin-bottom: 0.5em;
163
- }
164
-
165
- .prose ul {
166
- list-style-type: disc;
167
- padding-left: 1.5em;
168
- }
169
-
170
- .prose ol {
171
- list-style-type: decimal;
172
- padding-left: 1.5em;
173
- }
174
-
175
- .prose table {
176
- width: 100%;
177
- border-collapse: collapse;
178
- margin: 1em 0;
179
- }
180
-
181
- .prose th,
182
- .prose td {
183
- border: 1px solid rgba(249, 115, 22, 0.2);
184
- padding: 0.5em;
185
- }
186
-
187
- .prose th {
188
- background-color: rgba(249, 115, 22, 0.1);
189
- }
190
-
191
- .prose strong {
192
- color: #f9fafb; /* text-gray-50 */
193
- font-weight: 600;
194
- }
195
-
196
- .prose em {
197
- font-style: italic;
198
- }
199
-
200
- .prose blockquote {
201
- border-left: 4px solid #f97316; /* orange-500 */
202
- padding-left: 1em;
203
- margin: 1em 0;
204
- color: #d1d5db; /* text-gray-300 */
205
- }
206
-
207
- /* Ensure code blocks match the AI's formatting */
208
- .prose code {
209
- color: #e5e7eb;
210
- background-color: rgba(31, 41, 55, 0.5);
211
- padding: 0.2em 0.4em;
212
- border-radius: 0.375rem;
213
- font-size: 0.875em;
214
- }
215
-
216
- .prose pre {
217
- background-color: rgba(31, 41, 55, 0.5);
218
- border-radius: 0.5rem;
219
- padding: 1rem;
220
- margin: 1em 0;
221
- }
222
-
223
- .prose pre code {
224
- background-color: transparent;
225
- padding: 0;
226
- border-radius: 0;
227
- }
@@ -1,13 +0,0 @@
1
- import { Derived, Store } from '@tanstack/store'
2
-
3
- export const store = new Store({
4
- firstName: 'Jane',
5
- lastName: 'Smith',
6
- })
7
-
8
- export const fullName = new Derived({
9
- fn: () => `${store.state.firstName} ${store.state.lastName}`,
10
- deps: [store],
11
- })
12
-
13
- fullName.mount()