bhooai-nexus 0.1.6 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +105 -294
  3. package/bin/nexus.js +5 -13
  4. package/docs/ARCHITECTURE.md +134 -121
  5. package/docs/CLI.md +147 -0
  6. package/docs/CONVENTIONS.md +193 -0
  7. package/docs/MULTI_APP.md +107 -0
  8. package/docs/STORAGE.md +118 -0
  9. package/package.json +62 -57
  10. package/packages/nexus-admin/package.json +7 -6
  11. package/packages/nexus-admin/src/App.tsx +51 -4860
  12. package/packages/nexus-admin/src/api.ts +65 -576
  13. package/packages/nexus-admin/src/components/components.tsx +51 -0
  14. package/packages/nexus-admin/src/index.css +75 -3632
  15. package/packages/nexus-admin/src/tabs/Ai.tsx +70 -0
  16. package/packages/nexus-admin/src/tabs/Apps.tsx +53 -0
  17. package/packages/nexus-admin/src/tabs/Config.tsx +31 -0
  18. package/packages/nexus-admin/src/tabs/Health.tsx +38 -0
  19. package/packages/nexus-admin/src/tabs/Logs.tsx +52 -0
  20. package/packages/nexus-admin/src/tabs/Overview.tsx +43 -0
  21. package/packages/nexus-admin/src/tabs/Payments.tsx +62 -0
  22. package/packages/nexus-admin/src/tabs/Users.tsx +45 -0
  23. package/packages/nexus-ads/package.json +22 -22
  24. package/packages/nexus-ai-client/package.json +22 -20
  25. package/packages/nexus-auth/package.json +24 -24
  26. package/packages/nexus-cache/package.json +23 -23
  27. package/packages/nexus-cli/package.json +17 -12
  28. package/packages/nexus-cli/src/commands/add.ts +274 -0
  29. package/packages/nexus-cli/src/commands/build.ts +91 -0
  30. package/packages/nexus-cli/src/commands/db.ts +241 -0
  31. package/packages/nexus-cli/src/commands/dev.ts +96 -184
  32. package/packages/nexus-cli/src/commands/doctor.ts +102 -184
  33. package/packages/nexus-cli/src/commands/init.ts +232 -955
  34. package/packages/nexus-cli/src/commands/maintenance-commands.ts +40 -0
  35. package/packages/nexus-cli/src/commands/plugin.ts +233 -0
  36. package/packages/nexus-cli/src/commands/queue.ts +145 -0
  37. package/packages/nexus-cli/src/commands/test.ts +34 -0
  38. package/packages/nexus-cli/src/devPanel.ts +440 -0
  39. package/packages/nexus-cli/src/devServiceManager.ts +183 -0
  40. package/packages/nexus-cli/src/dispatcher.ts +113 -0
  41. package/packages/nexus-cli/src/generators.ts +102 -0
  42. package/packages/nexus-cli/src/index.ts +32 -90
  43. package/packages/nexus-cli/src/make/generators.ts +431 -0
  44. package/packages/nexus-cli/src/ports.ts +85 -0
  45. package/packages/nexus-cli/src/prompts.ts +68 -0
  46. package/packages/nexus-cli/src/templating/render.ts +109 -0
  47. package/packages/nexus-cli/src/util.ts +74 -112
  48. package/packages/nexus-cli/templates/base/Dockerfile.ejs +68 -0
  49. package/packages/nexus-cli/templates/base/README.md.ejs +62 -0
  50. package/packages/nexus-cli/templates/base/apps/admin/index.html.ejs +12 -0
  51. package/packages/nexus-cli/templates/base/apps/admin/nginx.conf.ejs +16 -0
  52. package/packages/nexus-cli/templates/base/apps/admin/package.json.ejs +15 -0
  53. package/packages/nexus-cli/templates/base/apps/admin/src/main.tsx.ejs +7 -0
  54. package/packages/nexus-cli/templates/base/apps/admin/vite.config.ts.ejs +22 -0
  55. package/packages/nexus-cli/templates/base/apps/ai-server/main.py.ejs +30 -0
  56. package/packages/nexus-cli/templates/base/apps/ai-server/requirements.txt +4 -0
  57. package/packages/nexus-cli/templates/base/apps/backend/src/main.ts +14 -0
  58. package/packages/nexus-cli/templates/base/apps/backend/src/routes/index.ts.ejs +11 -0
  59. package/packages/nexus-cli/templates/base/apps/frontend/index.html.ejs +12 -0
  60. package/packages/nexus-cli/templates/base/apps/frontend/nginx.conf.ejs +33 -0
  61. package/packages/nexus-cli/templates/base/apps/frontend/package.json.ejs +11 -0
  62. package/packages/nexus-cli/templates/base/apps/frontend/src/main.tsx.ejs +16 -0
  63. package/packages/nexus-cli/templates/base/apps/frontend/vite.config.ts.ejs +22 -0
  64. package/packages/nexus-cli/templates/base/docker-compose.yml.ejs +93 -0
  65. package/packages/nexus-cli/templates/base/dockerignore +21 -0
  66. package/packages/nexus-cli/templates/base/gitignore +43 -0
  67. package/packages/nexus-cli/templates/base/nexus.config.ts.ejs +97 -0
  68. package/packages/nexus-cli/templates/base/package.json.ejs +41 -0
  69. package/packages/nexus-cli/templates/{tsconfig.json → base/tsconfig.json} +2 -3
  70. package/packages/nexus-core/package.json +28 -40
  71. package/packages/nexus-core/src/app/ErrorHandler.ts +65 -0
  72. package/packages/nexus-core/src/app/FormRequest.ts +43 -0
  73. package/packages/nexus-core/src/app/Job.ts +98 -0
  74. package/packages/nexus-core/src/app/Mailable.ts +114 -0
  75. package/packages/nexus-core/src/app/Resource.ts +37 -0
  76. package/packages/nexus-core/src/app/Seeder.ts +17 -0
  77. package/packages/nexus-core/src/app/ServiceProvider.ts +16 -0
  78. package/packages/nexus-core/src/app/Storage.ts +366 -0
  79. package/packages/nexus-core/src/app/adminModule.ts +365 -0
  80. package/packages/nexus-core/src/app/createNexusApp.ts +356 -0
  81. package/packages/nexus-core/src/app/defineRoutes.ts +48 -0
  82. package/packages/nexus-core/src/app/discover.ts +144 -0
  83. package/packages/nexus-core/src/app/errorPages/_base.html +121 -0
  84. package/packages/nexus-core/src/app/errorPages.ts +117 -0
  85. package/packages/nexus-core/src/app/events.ts +81 -0
  86. package/packages/nexus-core/src/app/index.ts +15 -0
  87. package/packages/nexus-core/src/app/maintenance.ts +80 -0
  88. package/packages/nexus-core/src/app/policies.ts +53 -0
  89. package/packages/nexus-core/src/config/defaults.ts +0 -20
  90. package/packages/nexus-core/src/config/schema.ts +1 -27
  91. package/packages/nexus-core/src/config/types.ts +3 -86
  92. package/packages/nexus-core/src/index.ts +2 -1
  93. package/packages/nexus-crypto/package.json +22 -20
  94. package/packages/nexus-data/package.json +26 -29
  95. package/packages/nexus-data/src/index.ts +0 -6
  96. package/packages/nexus-data/src/projects.ts +0 -66
  97. package/packages/nexus-email/package.json +24 -24
  98. package/packages/nexus-examples/examples/ai-chat/README.md +37 -0
  99. package/packages/nexus-examples/examples/ai-chat/apps/backend/src/routes/chat.ts +40 -0
  100. package/packages/nexus-examples/examples/ai-chat/apps/frontend/src/main.tsx +105 -0
  101. package/packages/nexus-examples/examples/blog-crud/README.md +45 -0
  102. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/graphql/post.graph.ts +99 -0
  103. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Author.ts +10 -0
  104. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Comment.ts +10 -0
  105. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Post.ts +13 -0
  106. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/routes/posts.ts +119 -0
  107. package/packages/nexus-examples/examples/blog-crud/apps/frontend/src/main.tsx +102 -0
  108. package/packages/nexus-examples/examples/chat/README.md +20 -0
  109. package/packages/nexus-examples/examples/chat/apps/backend/src/models/Message.ts +11 -0
  110. package/packages/nexus-examples/examples/chat/apps/backend/src/routes/chat.ts +17 -0
  111. package/packages/nexus-examples/examples/chat/apps/backend/src/ws/chat.room.ts +56 -0
  112. package/packages/nexus-examples/examples/chat/apps/frontend/src/main.tsx +97 -0
  113. package/packages/nexus-examples/examples/checkout/README.md +40 -0
  114. package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/mailables/OrderConfirmationMail.ts +27 -0
  115. package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/templates/order-confirmation.ejs +28 -0
  116. package/packages/nexus-examples/examples/checkout/apps/backend/src/models/Order.ts +14 -0
  117. package/packages/nexus-examples/examples/checkout/apps/backend/src/routes/checkout.ts +74 -0
  118. package/packages/nexus-examples/examples/checkout/apps/frontend/src/main.tsx +85 -0
  119. package/packages/nexus-examples/examples/dashboard/README.md +26 -0
  120. package/packages/nexus-examples/examples/dashboard/apps/backend/src/routes/metrics.ts +76 -0
  121. package/packages/nexus-examples/examples/dashboard/apps/frontend/src/main.tsx +100 -0
  122. package/packages/nexus-examples/examples/file-storage/README.md +48 -0
  123. package/packages/nexus-examples/examples/file-storage/apps/backend/src/routes/files.ts +86 -0
  124. package/packages/nexus-examples/examples/file-storage/apps/frontend/src/main.tsx +111 -0
  125. package/packages/nexus-examples/examples/livestream/README.md +34 -0
  126. package/packages/nexus-examples/examples/livestream/apps/backend/src/routes/list.ts +21 -0
  127. package/packages/nexus-examples/examples/livestream/apps/backend/src/ws/stream.room.ts +53 -0
  128. package/packages/nexus-examples/examples/livestream/apps/frontend/src/main.tsx +148 -0
  129. package/packages/nexus-examples/examples/multi-app/README.md +51 -0
  130. package/packages/nexus-examples/examples/multi-app/apps/backend-api/src/routes/users.ts +26 -0
  131. package/packages/nexus-examples/examples/multi-app/apps/backend-shop/src/routes/products.ts +27 -0
  132. package/packages/nexus-examples/examples/saas-starter/README.md +37 -0
  133. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/events/TeamCreated.ts +11 -0
  134. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/events/UserRegistered.ts +10 -0
  135. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/listeners/OnTeamCreated.ts +11 -0
  136. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/listeners/OnUserRegistered.ts +10 -0
  137. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/middleware/auth.ts +14 -0
  138. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/Membership.ts +20 -0
  139. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/Team.ts +10 -0
  140. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/User.ts +17 -0
  141. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/policies/TeamPolicy.ts +35 -0
  142. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/routes/projects.ts +52 -0
  143. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/routes/teams.ts +112 -0
  144. package/packages/nexus-examples/examples/saas-starter/apps/frontend/src/main.tsx +95 -0
  145. package/packages/nexus-examples/examples/video-call/README.md +30 -0
  146. package/packages/nexus-examples/examples/video-call/apps/backend/src/ws/signaling.room.ts +47 -0
  147. package/packages/nexus-examples/examples/video-call/apps/frontend/src/main.tsx +116 -0
  148. package/packages/nexus-examples/package.json +14 -0
  149. package/packages/nexus-examples/src/index.ts +99 -0
  150. package/packages/nexus-graphql/package.json +26 -26
  151. package/packages/nexus-payments/package.json +22 -22
  152. package/packages/nexus-plugins/package.json +22 -22
  153. package/packages/nexus-postcss/package.json +44 -41
  154. package/packages/nexus-realtime/package.json +28 -28
  155. package/packages/nexus-safe-goto/package.json +16 -0
  156. package/packages/nexus-safe-goto/src/index.tsx +173 -0
  157. package/packages/nexus-telemetry/package.json +22 -22
  158. package/src/index.ts +53 -0
  159. package/apps/admin/index.html +0 -12
  160. package/apps/admin/package.json +0 -23
  161. package/apps/admin/postcss.config.js +0 -5
  162. package/apps/admin/public/anime-girl.svg +0 -84
  163. package/apps/admin/public/bhooai-nexus-logo.png +0 -0
  164. package/apps/admin/public/bhooai-nexus-logo.svg +0 -135
  165. package/apps/admin/public/favicon.ico +0 -0
  166. package/apps/admin/src/main.tsx +0 -10
  167. package/apps/admin/src/vite-env.d.ts +0 -18
  168. package/apps/admin/tailwind.config.js +0 -10
  169. package/apps/admin/tsconfig.json +0 -17
  170. package/apps/admin/vite.config.ts +0 -68
  171. package/docs/IMPROVEMENTS.md +0 -105
  172. package/docs/api/admin.html +0 -651
  173. package/docs/api/ads.html +0 -314
  174. package/docs/api/ai-client.html +0 -336
  175. package/docs/api/auth.html +0 -697
  176. package/docs/api/cache.html +0 -331
  177. package/docs/api/cli.html +0 -612
  178. package/docs/api/cluster.html +0 -489
  179. package/docs/api/core.html +0 -796
  180. package/docs/api/crypto.html +0 -310
  181. package/docs/api/data.html +0 -811
  182. package/docs/api/email.html +0 -345
  183. package/docs/api/graphql.html +0 -697
  184. package/docs/api/http-endpoints.html +0 -221
  185. package/docs/api/node-agent.html +0 -155
  186. package/docs/api/payments.html +0 -558
  187. package/docs/api/plugins.html +0 -522
  188. package/docs/api/postcss.html +0 -241
  189. package/docs/api/realtime.html +0 -324
  190. package/docs/api/safe-goto.html +0 -215
  191. package/docs/api/supervisor.html +0 -312
  192. package/docs/api/telemetry.html +0 -264
  193. package/docs/api/websockets.html +0 -163
  194. package/docs/architecture.html +0 -211
  195. package/docs/assets/bhooai-nexus-cluster-link.postman_collection.json +0 -185
  196. package/docs/assets/bhooai-nexus-local.postman_environment.json +0 -47
  197. package/docs/assets/bhooai-nexus-logo.png +0 -0
  198. package/docs/assets/bhooai-nexus-logo.svg +0 -135
  199. package/docs/assets/docs.js +0 -368
  200. package/docs/assets/favicon.ico +0 -0
  201. package/docs/assets/favicon.zip +0 -0
  202. package/docs/assets/nav.js +0 -91
  203. package/docs/assets/playground.js +0 -283
  204. package/docs/assets/screenshots/01-collection.png +0 -0
  205. package/docs/assets/screenshots/02-step1-csrf.png +0 -0
  206. package/docs/assets/screenshots/03-step2-login.png +0 -0
  207. package/docs/assets/screenshots/04-step3-link.png +0 -0
  208. package/docs/assets/screenshots/05-error-fetch-failed.png +0 -0
  209. package/docs/assets/screenshots/06-error-agent-401.png +0 -0
  210. package/docs/assets/screenshots/07-error-401-csrf.png +0 -0
  211. package/docs/assets/screenshots/08-env-runner.png +0 -0
  212. package/docs/assets/screenshots/visual-flow.png +0 -0
  213. package/docs/assets/style.css +0 -1140
  214. package/docs/examples.html +0 -248
  215. package/docs/favicon.ico +0 -0
  216. package/docs/getting-started.html +0 -155
  217. package/docs/guides/guide-ai-chat.html +0 -202
  218. package/docs/guides/guide-auth.html +0 -328
  219. package/docs/guides/guide-cluster.html +0 -325
  220. package/docs/guides/guide-email.html +0 -234
  221. package/docs/guides/guide-empty-project.html +0 -279
  222. package/docs/guides/guide-frontend-styling.html +0 -235
  223. package/docs/guides/guide-graphql.html +0 -214
  224. package/docs/guides/guide-mongodb.html +0 -220
  225. package/docs/guides/guide-payments.html +0 -321
  226. package/docs/guides/guide-uploads.html +0 -170
  227. package/docs/guides/guide-websocket.html +0 -263
  228. package/docs/improvements.html +0 -146
  229. package/docs/index.html +0 -101
  230. package/docs/learn/01-foundation.html +0 -129
  231. package/docs/learn/02-security.html +0 -104
  232. package/docs/learn/03-data.html +0 -99
  233. package/docs/learn/04-graphql.html +0 -86
  234. package/docs/learn/05-realtime.html +0 -76
  235. package/docs/learn/06-payments-email-crypto.html +0 -93
  236. package/docs/learn/07-cache-ads.html +0 -85
  237. package/docs/learn/08-ai.html +0 -93
  238. package/docs/learn/09-plugins.html +0 -81
  239. package/docs/learn/10-cluster.html +0 -83
  240. package/docs/learn/11-cli.html +0 -183
  241. package/docs/learn/12-apps.html +0 -123
  242. package/docs/learn/13-tests.html +0 -79
  243. package/docs/learn/14-postman-testing.html +0 -580
  244. package/docs/learn/PLAN.md +0 -59
  245. package/docs/learn/index.html +0 -87
  246. package/docs/screenshots/README.md +0 -23
  247. package/docs/screenshots/ai-agents-playground.png +0 -0
  248. package/docs/screenshots/ai-agents-providers.png +0 -0
  249. package/docs/screenshots/ai-agents.png +0 -0
  250. package/docs/screenshots/appearance.png +0 -0
  251. package/docs/screenshots/cluster-master.png +0 -0
  252. package/docs/screenshots/cluster-nodes.png +0 -0
  253. package/docs/screenshots/cluster-slave.png +0 -0
  254. package/docs/screenshots/login.png +0 -0
  255. package/docs/screenshots/logs-ai-summary.png +0 -0
  256. package/docs/screenshots/monitoring.png +0 -0
  257. package/docs/screenshots/nexus-dev.png +0 -0
  258. package/docs/screenshots/nexus-init.png +0 -0
  259. package/docs/screenshots/notification.png +0 -0
  260. package/docs/screenshots/overview.png +0 -0
  261. package/docs/screenshots/search-bar.png +0 -0
  262. package/docs/screenshots/settings.png +0 -0
  263. package/docs/screenshots/themes.png +0 -0
  264. package/docs/troubleshooting.html +0 -400
  265. package/packages/nexus-admin/src/alertCenter.tsx +0 -150
  266. package/packages/nexus-admin/src/assets/bhooai-nexus-logo.svg +0 -25
  267. package/packages/nexus-admin/src/vite-env.d.ts +0 -19
  268. package/packages/nexus-cli/src/commands/cluster.ts +0 -133
  269. package/packages/nexus-cli/src/commands/node.ts +0 -106
  270. package/packages/nexus-cli/src/commands/pysetup.ts +0 -142
  271. package/packages/nexus-cli/src/commands/sync.ts +0 -116
  272. package/packages/nexus-cli/src/commands/uninstall.ts +0 -287
  273. package/packages/nexus-cli/src/config-sync.ts +0 -384
  274. package/packages/nexus-cli/src/dotenv.ts +0 -39
  275. package/packages/nexus-cli/src/supervisor.ts +0 -394
  276. package/packages/nexus-cli/src/wizard.ts +0 -149
  277. package/packages/nexus-cli/templates/Dockerfile +0 -60
  278. package/packages/nexus-cli/templates/README.md +0 -69
  279. package/packages/nexus-cli/templates/apps/admin/index.html +0 -12
  280. package/packages/nexus-cli/templates/apps/admin/package.json +0 -22
  281. package/packages/nexus-cli/templates/apps/admin/postcss.config.js +0 -3
  282. package/packages/nexus-cli/templates/apps/admin/src/main.tsx +0 -10
  283. package/packages/nexus-cli/templates/apps/admin/src/vite-env.d.ts +0 -18
  284. package/packages/nexus-cli/templates/apps/admin/tailwind.config.js +0 -9
  285. package/packages/nexus-cli/templates/apps/admin/tsconfig.json +0 -17
  286. package/packages/nexus-cli/templates/apps/admin/vite.config.ts +0 -64
  287. package/packages/nexus-cli/templates/apps/ai-server/main.py +0 -43
  288. package/packages/nexus-cli/templates/apps/ai-server/providers/__init__.py +0 -3
  289. package/packages/nexus-cli/templates/apps/ai-server/providers/base.py +0 -111
  290. package/packages/nexus-cli/templates/apps/ai-server/requirements.txt +0 -3
  291. package/packages/nexus-cli/templates/apps/ai-server/routers/__init__.py +0 -3
  292. package/packages/nexus-cli/templates/apps/ai-server/routers/chat.py +0 -47
  293. package/packages/nexus-cli/templates/apps/ai-server/routers/embeddings.py +0 -30
  294. package/packages/nexus-cli/templates/apps/ai-server/routers/lint.py +0 -167
  295. package/packages/nexus-cli/templates/apps/ai-server/routers/models.py +0 -23
  296. package/packages/nexus-cli/templates/apps/ai-server/routers/preflight.py +0 -169
  297. package/packages/nexus-cli/templates/apps/ai-server/settings.py +0 -48
  298. package/packages/nexus-cli/templates/apps/backend/package.json +0 -34
  299. package/packages/nexus-cli/templates/apps/backend/src/main.ts +0 -375
  300. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/adminRoutes.ts +0 -732
  301. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/clusterRoutes.ts +0 -391
  302. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/databaseRoutes.ts +0 -161
  303. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/lintProxy.ts +0 -89
  304. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/preflightProxy.ts +0 -242
  305. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/roleCatalog.ts +0 -78
  306. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/schemaRoutes.ts +0 -449
  307. package/packages/nexus-cli/templates/apps/backend/src/modules/ai/aiProxy.ts +0 -265
  308. package/packages/nexus-cli/templates/apps/backend/src/modules/auth/authRoutes.ts +0 -220
  309. package/packages/nexus-cli/templates/apps/backend/src/modules/payments/paymentRoutes.ts +0 -100
  310. package/packages/nexus-cli/templates/apps/backend/src/modules/payments/paymentStore.ts +0 -172
  311. package/packages/nexus-cli/templates/apps/backend/src/modules/requests/requestLog.ts +0 -175
  312. package/packages/nexus-cli/templates/apps/backend/src/modules/users/userGraph.ts +0 -83
  313. package/packages/nexus-cli/templates/apps/backend/src/modules/users/userModel.ts +0 -88
  314. package/packages/nexus-cli/templates/apps/backend/src/plugins/CronScheduler.ts +0 -69
  315. package/packages/nexus-cli/templates/apps/backend/src/plugins/loadPlugins.ts +0 -107
  316. package/packages/nexus-cli/templates/apps/backend/tsconfig.json +0 -14
  317. package/packages/nexus-cli/templates/apps/frontend/index.html +0 -12
  318. package/packages/nexus-cli/templates/apps/frontend/package.json +0 -20
  319. package/packages/nexus-cli/templates/apps/frontend/postcss.config.js +0 -3
  320. package/packages/nexus-cli/templates/apps/frontend/src/index.css +0 -44
  321. package/packages/nexus-cli/templates/apps/frontend/src/main.tsx +0 -65
  322. package/packages/nexus-cli/templates/apps/frontend/tailwind.config.js +0 -9
  323. package/packages/nexus-cli/templates/apps/frontend/vite.config.ts +0 -72
  324. package/packages/nexus-cli/templates/bin/nexus.js +0 -35
  325. package/packages/nexus-cli/templates/bin/serve-all.mjs +0 -45
  326. package/packages/nexus-cli/templates/dockerignore +0 -15
  327. package/packages/nexus-cli/templates/gitignore +0 -12
  328. package/packages/nexus-cli/templates/nexus.config.ts +0 -69
  329. package/packages/nexus-cli/templates/package.json +0 -47
  330. /package/packages/nexus-cli/templates/{uploads → base/apps/backend/storage}/.gitkeep +0 -0
package/LICENSE CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,357 +1,168 @@
1
- # BhooAI Nexus
1
+ # BhooAI Nexus v2
2
2
 
3
- Build full-stack Node.js applications with one CLI and one configuration file. BhooAI Nexus includes an HTTP server, WebSockets, GraphQL federation, MongoDB data access, authentication, CSRF/CORS protection, payments, email, WebRTC, Python AI services, plugins, an admin console, and master/slave cluster orchestration.
3
+ A production-ready Node.js full-stack framework. One config file, one CLI, multi-app monorepo.
4
4
 
5
- ## Features
5
+ > v2 is a fresh workspace at `C:\server\PACKAGES\bhooai-nexus\` — reuses v1's packages, removes the
6
+ > cluster subsystem (Docker handles scaling), rewrites the CLI, and adds a Laravel-style
7
+ > convention layer on top.
6
8
 
7
- - Node.js HTTP server with trie routing, middleware, uploads, static files, security headers, CORS, CSRF, and rate limiting
8
- - MongoDB ODM with schemas, hooks, indexes, populate, and transactions
9
- - JWT access tokens, refresh tokens, sessions, Google OAuth, Facebook OAuth, and role-based access control
10
- - WebSockets, Redis adapters, WebRTC signaling, and mediasoup SFU integration
11
- - GraphQL subscriptions, federation composition, entity joins, `@provides`, and `@requires`
12
- - Razorpay, PayPal, PayU, Skrill, and Payoneer integrations
13
- - Email, certificate generation, Redis cache, Google Ads, and plugin extensions
14
- - Python FastAPI AI server with OpenAI-compatible chat, embeddings, Ollama, and SSE streaming
15
- - Admin console with configuration, environment, process, monitoring, database, AI, and cluster management
16
- - Master/slave cluster mesh with load balancing, node agents, request allocation, health checks, and upload path pinning
17
- - Tailwind CSS + `@bhooai/nexus-postcss` preset with PostCSS pipeline, design tokens, light/dark theme, and CSS playground
9
+ ## Quick start
18
10
 
19
- ## Requirements
20
-
21
- - Node.js `>=22`
22
- - npm, included with Node.js
23
- - MongoDB 6 or newer, running locally or reachable through `MONGODB_URI`
24
- - Redis 6 or newer, running locally or reachable through `REDIS_URL`
25
- - Python 3.13 or newer for the optional AI server
26
- - A virtual environment is recommended for Python dependencies
27
-
28
- The Python service dependencies are listed in [`apps/ai-server/requirements.txt`](apps/ai-server/requirements.txt): FastAPI, Uvicorn, HTTPX, pytest, and pytest-asyncio.
29
-
30
- MongoDB and Redis can be started with Docker, system services, or managed cloud providers. The AI server is optional when AI features are not used.
31
-
32
- ## Install
11
+ `nexus init` scaffolds the project **and installs its dependencies** in one step.
33
12
 
34
13
  ```bash
35
- npm install bhooai-nexus
36
- npx nexus init my-app
14
+ # One-time: install the CLI (or use npx without installing)
15
+ npm install -g bhooai-nexus
16
+
17
+ # New project (zero prompts — opinionated defaults)
18
+ nexus init my-app
37
19
  cd my-app
38
- npm run doctor
39
20
  npm run dev
40
21
  ```
41
22
 
42
- Initialize the current directory with `npx nexus init .`. Use `npx nexus init . --skip-install` to defer dependency installation.
43
-
44
- ## Quick Start
23
+ Prefer `npx` over a global install? `nexus init` auto-installs deps either way:
45
24
 
46
25
  ```bash
47
- npm install bhooai-nexus
48
26
  npx nexus init my-app
49
27
  cd my-app
50
- npm run doctor
51
28
  npm run dev
52
29
  ```
53
30
 
54
- Default development services:
55
-
56
- | Service | Default port |
57
- | --- | ---: |
58
- | Backend API | `4000` |
59
- | Frontend | `3000` |
60
- | Admin console | `3300` |
61
- | Python AI server | `8000` |
62
- | Cluster load balancer | `8080` |
63
- | Node agent | `7575` |
64
-
65
- `nexus dev` automatically moves a configured port to the next available port, allowing master and slave projects to run side by side on one machine.
66
-
67
- ## Screenshots
68
-
69
- ### Admin login
70
-
71
- ![BhooAI Nexus admin login](docs/screenshots/login.png)
72
-
73
- ### Overview dashboard
74
-
75
- ![BhooAI Nexus overview dashboard](docs/screenshots/overview.png)
76
-
77
- ### Master cluster management
78
-
79
- ![BhooAI Nexus master cluster management](docs/screenshots/cluster-master.png)
80
-
81
- ### Slave node agent and roles
82
-
83
- ![BhooAI Nexus slave node agent](docs/screenshots/cluster-slave.png)
84
-
85
- ### Connected cluster nodes
86
-
87
- ![Connected cluster nodes](docs/screenshots/cluster-nodes.png)
88
-
89
- ### AI agents
90
-
91
- ![AI agents](docs/screenshots/ai-agents.png)
92
-
93
- ### AI providers
94
-
95
- ![AI agent providers](docs/screenshots/ai-agents-providers.png)
96
-
97
- ### AI playground
98
-
99
- ![AI playground](docs/screenshots/ai-agents-playground.png)
100
-
101
- ### Monitoring
102
-
103
- ![Monitoring dashboard](docs/screenshots/monitoring.png)
104
-
105
- ### Settings
106
-
107
- ![Settings](docs/screenshots/settings.png)
108
-
109
- ### Themes
110
-
111
- ![Theme selection](docs/screenshots/themes.png)
112
-
113
- ### Appearance
114
-
115
- ![Appearance settings](docs/screenshots/appearance.png)
116
-
117
- ### Search
118
-
119
- ![Admin search](docs/screenshots/search-bar.png)
120
-
121
- ### Notifications
122
-
123
- ![Notifications](docs/screenshots/notification.png)
124
-
125
- ### AI log summary
126
-
127
- ![AI log summary](docs/screenshots/logs-ai-summary.png)
128
-
129
- ### Nexus development services
130
-
131
- ![Nexus development services](docs/screenshots/nexus-dev.png)
132
-
133
- ### Nexus initialization
134
-
135
- ![Nexus initialization](docs/screenshots/nexus-init.png)
136
-
137
- ## Cluster Mesh
138
-
139
- BhooAI Nexus supports a central master and one or more slave nodes.
140
-
141
- Initialize a master:
142
-
143
31
  ```bash
144
- npx nexus init master --as=root
32
+ # Wizard with example picker
33
+ nexus init my-app --interactive
34
+ # or, named example:
35
+ nexus init my-app --example chat
145
36
  ```
146
37
 
147
- Initialize a slave with a built-in role:
38
+ Skip dependency install for CI/offline use:
148
39
 
149
40
  ```bash
150
- npx nexus init slave-1 --as=node --role=backend --port=7575
151
- npx nexus init slave-2 --as=node --role=files --port=7576
41
+ nexus init my-app --no-install
152
42
  ```
153
43
 
154
- Supported node roles are `backend`, `files`, `database`, and `ai`.
155
-
156
- After `npm run dev`, a node project automatically starts its node agent. The agent exposes the control API and advertises the node's development backend without starting a duplicate backend process.
157
-
158
- The master load balancer listens on port `8080` and distributes traffic across ready backend nodes. Authentication routes are pinned to the master:
44
+ ## Architecture at a glance
159
45
 
160
- - `/auth/*`
161
- - `/csrf-token`
162
-
163
- Use the same `NEXUS_AUTH_JWT_SECRET` on all nodes so slaves can verify master-issued access tokens.
164
-
165
- ### Upload path allocation
166
-
167
- The master admin console includes **Cluster → Path routing**. Pin URL prefixes to specific nodes:
168
-
169
- ```text
170
- /uploads/images -> slave-1
171
- /uploads/files -> slave-2
172
46
  ```
173
-
174
- Path pins use longest-prefix matching. A pinned request is sent only to its configured node. If the pinned node is unavailable, the load balancer returns `503 pinned_node_down` instead of silently sending the request to another node.
175
-
176
- When no slave nodes are linked, the load balancer fails open to the master's own backend if `cluster.failOpenSingleNode` is enabled. This keeps a cluster-enabled master usable as a single-node installation.
177
-
178
- Upload endpoints accept both `/uploads` and sub-paths such as `/uploads/images`. The upload directory is created automatically on the node that handles the request.
179
-
180
- ## Admin Console
181
-
182
- Open the admin console at `http://localhost:3300` during development. The console provides overview, processes, logs, configuration, environment, plugins, users, monitoring, payments, databases, schema, AI, and cluster management.
183
-
184
- The Cluster tab includes connected-node cards with request allocation percentage, CPU, memory, freshness, service health, test, enable, restart, and unlink controls. Slave mode includes role selection, node-agent status, pairing tokens, node IDs, and copyable serve/link commands. Master mode includes path-prefix routing for uploads and other services.
185
-
186
- ## Configuration
187
-
188
- Edit `nexus.config.ts`. Configuration precedence is:
189
-
190
- ```text
191
- code defaults < nexus.config.ts < nexus.runtime.json < NEXUS_* environment variables < CLI flags
47
+ ┌──────────────── Multi-app monorepo ─────────────────┐
48
+ │ apps/backend/ ← Node.js, auto-discovery │
49
+ │ apps/backend-shop/ ← add via `nexus add backend` │
50
+ │ apps/frontend/ ← Vite + React │
51
+ │ apps/frontend-shop/ ← add via `nexus add frontend` │
52
+ │ apps/admin/ ← wraps @bhooai/nexus-admin │
53
+ │ apps/ai-server/ ← FastAPI (optional) │
54
+ │ .nexus-ports.json ← stable port registry │
55
+ │ nexus.config.ts │
56
+ │ docker-compose.yml │
57
+ └──────────────────────────────────────────────────────┘
192
58
  ```
193
59
 
194
- Admin changes are written to the gitignored `nexus.runtime.json` file. Store secrets in the project `.env` file:
60
+ Each backend follows a Laravel-style convention under `src/`:
195
61
 
196
- ```env
197
- MONGODB_URI=mongodb://localhost:27017/my-app
198
- REDIS_URL=redis://localhost:6379
199
- NEXUS_AUTH_JWT_SECRET=replace-with-a-long-random-secret
62
+ ```
63
+ src/
64
+ ├── main.ts # 20-line createNexusApp()
65
+ ├── routes/ # HTTP endpoints (auto-discovered)
66
+ ├── graphql/ # *.graph.ts (federation)
67
+ ├── ws/ # *.room.ts (WebSocket rooms)
68
+ ├── mail/templates/ # *.ejs
69
+ ├── mail/mailables/ # classes
70
+ ├── errors/pages/ # 404.html / 500.html / ...
71
+ ├── errors/Handler.ts
72
+ ├── models/ services/ repositories/ controllers/
73
+ ├── middleware/ validators/ jobs/ listeners/ events/
74
+ ├── policies/ resources/ requests/ helpers/ config/
75
+ ├── database/{seeds,migrations}/ providers/ plugins/ types/ constants/
200
76
  ```
201
77
 
202
- Common port overrides include `NEXUS_SERVER_PORT`, `NEXUS_FRONTEND_PORT`, `NEXUS_ADMIN_PORT`, `NEXUS_CLUSTER_LBPORT`, `NEXUS_CLUSTER_NODEAGENTPORT`, and `AI_PORT`.
203
-
204
- ## CSS Pipeline
205
-
206
- Every scaffolded frontend and admin app ships with Tailwind CSS and the framework-owned `@bhooai/nexus-postcss` preset. The preset loads six PostCSS plugins in one curated pipeline:
207
-
208
- 1. `postcss-import` — `@import` resolution
209
- 2. `postcss-nested` (or `postcss-nesting` with `nestingMode: 'modern'`) — CSS nesting
210
- 3. `tailwindcss` — base/components/utilities + content scanning
211
- 4. `postcss-preset-env` (stage 2) — future CSS features today
212
- 5. `autoprefixer` — vendor prefixes
213
- 6. `cssnano` — minification (production only)
78
+ ## CLI
214
79
 
215
- ### PostCSS preset options
80
+ ```
81
+ Project init · dev · build · test · doctor · sync · uninstall · down · up
82
+ Multi-app add backend <name>
83
+ add frontend <name> [--for <backend>]
84
+ add route <name> --app <backend>
85
+ add module <payments|ai|admin|uploads|graphql-subgraph>
216
86
 
217
- ```js
218
- import { createPreset } from '@bhooai/nexus-postcss';
219
- import forms from '@tailwindcss/forms';
220
- import typography from '@tailwindcss/typography';
87
+ Data db:seed · db:migrate · db:rollback
88
+ Queue queue:work · queue:retry
89
+ Plugins plugin new · install · remove · list
221
90
 
222
- export default createPreset({
223
- tailwindPlugins: [forms, typography], // Tailwind plugins
224
- nestingMode: 'modern', // spec-compliant CSS nesting
225
- logical: true, // RTL/LTR direction-aware CSS
226
- sourcemap: true, // inline source maps
227
- engine: 'lightningcss', // ~100x faster (experimental)
228
- });
91
+ Generators (make:*) — 21 total:
92
+ route · controller · model · service · repository · middleware · validator ·
93
+ job · event · listener · policy · resource · request · mail · room · subgraph ·
94
+ seeder · migration · provider · plugin
229
95
  ```
230
96
 
231
- ### Design tokens
97
+ ## Examples
98
+
99
+ 10 examples ship in `packages/nexus-examples/` and are overlayable via `nexus init --example`:
232
100
 
233
- Two token stylesheets ship with the preset:
101
+ | Example | Demos |
102
+ |---|---|
103
+ | `empty` | bare scaffold |
104
+ | `chat` | realtime rooms, presence, typing |
105
+ | `video-call` | WebRTC signaling, 1:1 RTCPeerConnection |
106
+ | `checkout` | payments + mailables + HMAC webhook verify |
107
+ | `livestream` | broadcaster/viewer roles, streaming |
108
+ | `ai-chat` | streaming LLM via SSE |
109
+ | `saas-starter` | auth + teams + projects + policies + events |
110
+ | `blog-crud` | ODM models, GraphQL federation subgraph |
111
+ | `dashboard` | admin-metrics demo, CSS-only viz |
112
+ | `file-storage` | local + S3 storage, signed private URLs |
113
+ | `multi-app` | two backends, two frontends, one admin |
234
114
 
235
- - `@bhooai/nexus-postcss/theme.css` — 22 `--nexus-*` dark theme tokens + 15 `--admin-*` aliases
236
- - `@bhooai/nexus-postcss/theme-light-dark.css` — dual-theme variant using CSS `light-dark()` for automatic light/dark switching
115
+ ## Storage
237
116
 
238
- ```css
239
- @import '@bhooai/nexus-postcss/theme.css';
117
+ Per-backend `storage/` folder with `local` + `s3` drivers shipped:
240
118
 
241
- :root {
242
- --nexus-accent: #ff6b6b; /* retheme any token */
243
- }
119
+ ```ts
120
+ import { storage } from 'bhooai-nexus';
121
+ await storage.disk('uploads').put('avatars', file);
122
+ const url = await storage.disk('private').signedUrl('invoices/1.pdf');
244
123
  ```
245
124
 
246
- See the [PostCSS API reference](docs/api/postcss.html) and the [Frontend Styling guide](docs/guides/guide-frontend-styling.html) for full documentation, including a live CSS playground.
125
+ UUID filenames + `YYYY/MM` sharding. EXIF-stripped. sharp-driven image transforms.
247
126
 
248
- ## Uninstall
127
+ ## Importing the framework
249
128
 
250
- Preview changes:
129
+ `bhooai-nexus` is the umbrella package — one import surfaces the whole API:
251
130
 
252
- ```bash
253
- npx nexus uninstall --dry-run
131
+ ```ts
132
+ import { createNexusApp, storage, model, Schema, AiClient, defineRoutes } from 'bhooai-nexus';
254
133
  ```
255
134
 
256
- Remove the project database and registration while keeping files:
135
+ Prefer narrower imports for smaller bundles? Use the sub-path exports
136
+ (`bhooai-nexus/core`, `bhooai-nexus/data`, `bhooai-nexus/ai-client`, …) or the
137
+ scoped packages (`@bhooai/nexus-core`, `@bhooai/nexus-data`, …) directly.
257
138
 
258
- ```bash
259
- npx nexus uninstall
260
- ```
139
+ ## Maintenance mode
261
140
 
262
- Remove the database, registration, and project directory:
263
-
264
- ```bash
265
- npx nexus uninstall --purge
266
141
  ```
267
-
268
- Skip confirmations or keep the database:
269
-
270
- ```bash
271
- npx nexus uninstall --purge --force
272
- npx nexus uninstall --keep-db
142
+ nexus down --message "Quick upgrade"
143
+ nexus up
273
144
  ```
274
145
 
275
- Uninstall does not remove the framework package, MongoDB's `nexus_projects` database, or other projects.
276
-
277
- ## Project Layout
278
-
279
- ```text
280
- packages/ 17 framework packages (@bhooai/nexus-*)
281
- apps/backend/ Node.js backend
282
- apps/frontend/ React + Vite frontend
283
- apps/admin/ React + Vite admin host
284
- apps/ai-server/ Python FastAPI AI service
285
- bin/ CLI entry point
286
- contracts/ Node-to-Python API contracts
287
- plugins/ Project plugins
288
- tests/ Cross-service tests
289
- docs/ Architecture, guides, API reference, and screenshots
290
- ```
146
+ All requests return 503 + Retry-After except `/health`.
291
147
 
292
- ### Framework packages
293
-
294
- | Package | Description |
295
- | --- | --- |
296
- | `@bhooai/nexus-core` | HTTP server, trie router, config stack, DI container |
297
- | `@bhooai/nexus-auth` | CSRF, CORS, security headers, rate limit, JWT, OAuth2, sessions, RBAC |
298
- | `@bhooai/nexus-data` | Custom ODM on the native mongodb driver |
299
- | `@bhooai/nexus-graphql` | Federation, supergraph, subscriptions — no Apollo |
300
- | `@bhooai/nexus-realtime` | WebSocket rooms, WebRTC signaling, mediasoup SFU |
301
- | `@bhooai/nexus-payments` | Razorpay, PayPal, PayU, Skrill, Payoneer + webhooks |
302
- | `@bhooai/nexus-email` | SMTP, templates, Redis-backed outbound queue |
303
- | `@bhooai/nexus-crypto` | RSA/ECDSA keys, X.509 certs, CSRs, HTTPS/mTLS |
304
- | `@bhooai/nexus-cache` | Redis cache-aside, rate limiter, pub/sub |
305
- | `@bhooai/nexus-ads` | Google Ads client with GAQL query builder |
306
- | `@bhooai/nexus-plugins` | In-process + sandboxed worker-thread plugins |
307
- | `@bhooai/nexus-ai-client` | Node client for the Python AI server — SSE, retries, timeouts |
308
- | `@bhooai/nexus-cluster` | Node agent, mesh registry, load balancer, autoscaler |
309
- | `@bhooai/nexus-telemetry` | Structured logger, metrics, trace/request-ID propagation |
310
- | `@bhooai/nexus-safe-goto` | Safe external-link dialog — anti tab-nabbing/phishing |
311
- | `@bhooai/nexus-postcss` | PostCSS preset — Tailwind, nesting, preset-env, autoprefixer, cssnano |
312
- | `@bhooai/nexus-cli` | init wizard, doctor, dev supervisor |
313
-
314
- ## Testing
148
+ ## Tests
315
149
 
316
150
  ```bash
317
151
  npx vitest run
318
- cd apps/ai-server
319
- python -m pip install -r requirements.txt
320
- pytest
321
- ```
322
-
323
- Run Playwright end-to-end tests from the framework root:
324
-
325
- ```bash
326
- npx playwright test --config=playwright.config.ts
327
152
  ```
328
153
 
329
- ## Docker
330
-
331
- ```powershell
332
- .\docker.ps1 build
333
- .\docker.ps1 run
334
- .\docker.ps1 logs
335
- .\docker.ps1 stop
336
- ```
337
-
338
- Development endpoints are frontend `http://localhost:3000`, admin `http://localhost:3300`, and backend `http://localhost:4000/health`.
339
-
340
- ## Documentation
341
-
342
- - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — architecture and data flow
343
- - [`docs/IMPROVEMENTS.md`](docs/IMPROVEMENTS.md) — improvement history and next steps
344
- - [`docs/troubleshooting.html`](docs/troubleshooting.html) — common errors and fixes
345
- - [`docs/api/postcss.html`](docs/api/postcss.html) — PostCSS preset API reference + CSS playground
346
- - [`docs/guides/guide-frontend-styling.html`](docs/guides/guide-frontend-styling.html) — frontend styling guide with live preview
347
- - [`docs/screenshots/README.md`](docs/screenshots/README.md) — screenshot catalog
348
- - [`apps/ai-server/README.md`](apps/ai-server/README.md) — Python AI service
349
- - Package documentation under `packages/nexus-*/README.md`
154
+ Current suite covers: app factory, event bus, policies, generators name normalization,
155
+ EJS templating. 27 tests, all green.
350
156
 
351
- ## Design Principles
157
+ ## Status
352
158
 
353
- BhooAI Nexus avoids Apollo, Express, and Mongoose where direct control is required. The HTTP server, trie router, ODM, federation layer, plugin sandbox, and PostCSS preset are implemented in the workspace. Established libraries are used for standards and infrastructure, including GraphQL.js, MongoDB, Redis, WebSockets, Nodemailer, Jose, mediasoup, Tailwind CSS, and Lightning CSS.
159
+ - P0–P12 shipped (skeleton, app factory, abstractions, storage, CLI, plugins, db, queue,
160
+ generators, port registry, examples, docker, admin strip + Apps tab)
161
+ - Admin rebuilt as a fresh Apps-tab-first SPA with live backend endpoints
162
+ (registry, health, request logs, config, users, payments, AI proxy)
163
+ - `bhooai-nexus` is the publishable main package — umbrella import + auto-installing init
164
+ - v1's test suite has 97 pre-existing tsc errors (unrelated to v2 src; tracked separately)
354
165
 
355
166
  ## License
356
167
 
357
- BhooAI Nexus is released under the [MIT License](LICENSE).
168
+ MIT
package/bin/nexus.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * BhooAI Nexus CLI entry.
3
+ * BhooAI Nexus v2 CLI entry.
4
4
  *
5
- * Thin ESM shim: loads the compiled `@bhooai/nexus-cli` dist if present,
6
- * otherwise runs the TypeScript source via tsx's programmatic API (which
7
- * rewrites .js import specifiers to .ts). This keeps the framework usable
8
- * with `node bin/nexus.js ...` and no build step.
5
+ * Thin ESM shim: loads compiled `packages/nexus-cli/dist/index.js` if
6
+ * present, otherwise runs the TypeScript source via tsx (which rewrites .js
7
+ * import specifiers to .ts). Keeps `node bin/nexus.js ...` working with
8
+ * no build step.
9
9
  */
10
10
  import { pathToFileURL } from 'node:url';
11
11
  import { existsSync } from 'node:fs';
@@ -20,13 +20,8 @@ async function main() {
20
20
  const { tsImport } = await import('tsx/esm/api');
21
21
  let mod;
22
22
  if (existsSync(srcEntry)) {
23
- // Prefer source in the monorepo and in the published package so the CLI
24
- // does not depend on a stale or omitted build artifact.
25
23
  mod = await tsImport(pathToFileURL(srcEntry).href, import.meta.url);
26
24
  } else if (existsSync(distEntry)) {
27
- // Workspace packages export TypeScript sources with `.js` specifiers.
28
- // Keep tsx in the chain even when the CLI dist exists so Node can resolve
29
- // those source imports during development and after partial builds.
30
25
  mod = await tsImport(pathToFileURL(distEntry).href, import.meta.url);
31
26
  } else {
32
27
  mod = await tsImport(pathToFileURL(srcEntry).href, import.meta.url);
@@ -36,9 +31,6 @@ async function main() {
36
31
  await mod.run(cmd, rest);
37
32
  }
38
33
 
39
- /** True when a rejected promise was the user pressing Ctrl+C during an
40
- * interactive prompt (node:readline/promises rejects the open question with an
41
- * AbortError). A cancelled wizard is not a failure — no error dump. */
42
34
  function isUserCancel(err) {
43
35
  if (!err) return false;
44
36
  if (err.name === 'AbortError') return true;