@botonic/nx-plugin 2.23.0

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 (206) hide show
  1. package/CHANGELOG.md +420 -0
  2. package/README.md +279 -0
  3. package/executors.json +55 -0
  4. package/generators.json +61 -0
  5. package/migrations.json +40 -0
  6. package/package.json +54 -0
  7. package/src/cursor-commands/update-bot.md +114 -0
  8. package/src/cursor-commands/update-botonic.md +63 -0
  9. package/src/executors/build-node-app/executor.d.ts +5 -0
  10. package/src/executors/build-node-app/executor.js +65 -0
  11. package/src/executors/build-node-app/schema.d.js +16 -0
  12. package/src/executors/build-node-app/schema.json +25 -0
  13. package/src/executors/delete-bot/executor.d.ts +5 -0
  14. package/src/executors/delete-bot/executor.js +112 -0
  15. package/src/executors/delete-bot/schema.d.js +16 -0
  16. package/src/executors/delete-bot/schema.json +35 -0
  17. package/src/executors/deploy-local-runtime/executor.d.ts +5 -0
  18. package/src/executors/deploy-local-runtime/executor.js +144 -0
  19. package/src/executors/deploy-local-runtime/schema.d.js +16 -0
  20. package/src/executors/deploy-local-runtime/schema.json +34 -0
  21. package/src/executors/deploy-netlify-snapshot/executor.d.ts +8 -0
  22. package/src/executors/deploy-netlify-snapshot/executor.js +79 -0
  23. package/src/executors/deploy-netlify-snapshot/schema.d.js +16 -0
  24. package/src/executors/deploy-netlify-snapshot/schema.json +31 -0
  25. package/src/executors/deploy-to-hubtype/executor.d.ts +5 -0
  26. package/src/executors/deploy-to-hubtype/executor.js +308 -0
  27. package/src/executors/deploy-to-hubtype/schema.d.js +16 -0
  28. package/src/executors/deploy-to-hubtype/schema.json +31 -0
  29. package/src/executors/e2e-webchat/botonic-package-publish.spec.ts +84 -0
  30. package/src/executors/e2e-webchat/executor.d.ts +5 -0
  31. package/src/executors/e2e-webchat/executor.js +134 -0
  32. package/src/executors/e2e-webchat/schema.d.js +16 -0
  33. package/src/executors/e2e-webchat/schema.json +35 -0
  34. package/src/executors/integrate-provider/executor.d.ts +5 -0
  35. package/src/executors/integrate-provider/executor.js +155 -0
  36. package/src/executors/integrate-provider/schema.d.js +16 -0
  37. package/src/executors/integrate-provider/schema.json +30 -0
  38. package/src/executors/login-to-hubtype/executor.d.ts +5 -0
  39. package/src/executors/login-to-hubtype/executor.js +79 -0
  40. package/src/executors/login-to-hubtype/schema.d.js +16 -0
  41. package/src/executors/login-to-hubtype/schema.json +25 -0
  42. package/src/executors/logout-from-hubtype/executor.d.ts +3 -0
  43. package/src/executors/logout-from-hubtype/executor.js +54 -0
  44. package/src/executors/logout-from-hubtype/schema.d.js +16 -0
  45. package/src/executors/logout-from-hubtype/schema.json +9 -0
  46. package/src/executors/run-lambda/executor.d.ts +5 -0
  47. package/src/executors/run-lambda/executor.js +65 -0
  48. package/src/executors/run-lambda/schema.d.js +16 -0
  49. package/src/executors/run-lambda/schema.json +20 -0
  50. package/src/executors/serve-bot/executor.d.ts +5 -0
  51. package/src/executors/serve-bot/executor.js +330 -0
  52. package/src/executors/serve-bot/schema.d.js +16 -0
  53. package/src/executors/serve-bot/schema.json +40 -0
  54. package/src/generators/action/files/__name__.spec.ts.template +15 -0
  55. package/src/generators/action/files/__name__.ts.template +15 -0
  56. package/src/generators/action/generator.d.ts +4 -0
  57. package/src/generators/action/generator.js +112 -0
  58. package/src/generators/action/schema.d.ts +7 -0
  59. package/src/generators/action/schema.js +16 -0
  60. package/src/generators/action/schema.json +43 -0
  61. package/src/generators/bot-app/files/.eslintrc.json.template +18 -0
  62. package/src/generators/bot-app/files/README.md.template +148 -0
  63. package/src/generators/bot-app/files/src/client/custom-messages/index.ts.template +2 -0
  64. package/src/generators/bot-app/files/src/client/webchat/index.html.template +35 -0
  65. package/src/generators/bot-app/files/src/client/webchat/index.tsx.template +107 -0
  66. package/src/generators/bot-app/files/src/client/webchat/styles.css.template +17 -0
  67. package/src/generators/bot-app/files/src/client/webchat/webchat-tokens-overrides.css.template +2 -0
  68. package/src/generators/bot-app/files/src/client/webviews/app.tsx.template +8 -0
  69. package/src/generators/bot-app/files/src/client/webviews/index.html.template +32 -0
  70. package/src/generators/bot-app/files/src/client/webviews/index.tsx.template +18 -0
  71. package/src/generators/bot-app/files/src/server/bot/actions/index.ts.template +2 -0
  72. package/src/generators/bot-app/files/src/server/bot/actions/not-found.ts.template +13 -0
  73. package/src/generators/bot-app/files/src/server/bot/actions/welcome.ts.template +13 -0
  74. package/src/generators/bot-app/files/src/server/bot/index.ts.template +43 -0
  75. package/src/generators/bot-app/files/src/server/bot/plugins/ai-agents/index.ts.template +30 -0
  76. package/src/generators/bot-app/files/src/server/bot/plugins/flow-builder/index.ts.template +28 -0
  77. package/src/generators/bot-app/files/src/server/bot/plugins/index.ts.template +11 -0
  78. package/src/generators/bot-app/files/src/server/bot/routes.ts.template +23 -0
  79. package/src/generators/bot-app/files/src/server/bot/tools/index.ts.template +5 -0
  80. package/src/generators/bot-app/files/src/server/bot/tracking.ts.template +35 -0
  81. package/src/generators/bot-app/files/src/server/bot/types.ts.template +4 -0
  82. package/src/generators/bot-app/files/src/server/bot/utils.ts.template +9 -0
  83. package/src/generators/bot-app/files/src/server/lambda/handler.js.template +24 -0
  84. package/src/generators/bot-app/files/src/server/lambda/package.json +20 -0
  85. package/src/generators/bot-app/files/src/server/lambda/template.yaml.template +20 -0
  86. package/src/generators/bot-app/files/src/shared/constants.ts.template +12 -0
  87. package/src/generators/bot-app/files/vite/base-client.config.ts.template +14 -0
  88. package/src/generators/bot-app/files/vite/base.config.ts.template +20 -0
  89. package/src/generators/bot-app/files/vite/build.config.ts.template +65 -0
  90. package/src/generators/bot-app/files/vite/node.config.ts.template +41 -0
  91. package/src/generators/bot-app/files/vite/plugins/move-html.plugin.ts.template +36 -0
  92. package/src/generators/bot-app/files/vite/webchat.config.ts.template +58 -0
  93. package/src/generators/bot-app/files/vite/webviews.config.ts.template +57 -0
  94. package/src/generators/bot-app/files/vite.config.ts.template +36 -0
  95. package/src/generators/bot-app/generator.d.ts +4 -0
  96. package/src/generators/bot-app/generator.js +294 -0
  97. package/src/generators/bot-app/schema.d.ts +6 -0
  98. package/src/generators/bot-app/schema.js +16 -0
  99. package/src/generators/bot-app/schema.json +36 -0
  100. package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.d.ts +5 -0
  101. package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.js +92 -0
  102. package/src/generators/bot-app-migrations/migrate-fix-css-code-split/schema.json +15 -0
  103. package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.d.ts +5 -0
  104. package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.js +97 -0
  105. package/src/generators/bot-app-migrations/migrate-pnpm-compat/schema.json +15 -0
  106. package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.d.ts +5 -0
  107. package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.js +165 -0
  108. package/src/generators/bot-app-migrations/migrate-webchat-trigger/schema.json +15 -0
  109. package/src/generators/custom-message/files/__name__-output.ts.template +21 -0
  110. package/src/generators/custom-message/files/__name__.spec.tsx.template +27 -0
  111. package/src/generators/custom-message/files/__name__.tsx.template +18 -0
  112. package/src/generators/custom-message/generator.d.ts +4 -0
  113. package/src/generators/custom-message/generator.js +235 -0
  114. package/src/generators/custom-message/schema.d.ts +7 -0
  115. package/src/generators/custom-message/schema.js +16 -0
  116. package/src/generators/custom-message/schema.json +44 -0
  117. package/src/generators/preset/files/.cursor/commands/update-bot.md +5 -0
  118. package/src/generators/preset/files/.cursor/commands/update-botonic.md +5 -0
  119. package/src/generators/preset/files/.cursor/scripts/update-bot/discover-bots.sh +67 -0
  120. package/src/generators/preset/files/.cursor/scripts/update-bot/find-migration-guides.sh +70 -0
  121. package/src/generators/preset/files/.cursor/skills/botonic-action/SKILL.md +167 -0
  122. package/src/generators/preset/files/.cursor/skills/botonic-custom-message/SKILL.md +231 -0
  123. package/src/generators/preset/files/.cursor/skills/botonic-webview/SKILL.md +179 -0
  124. package/src/generators/preset/files/.env.prod.template +2 -0
  125. package/src/generators/preset/files/.env.template +2 -0
  126. package/src/generators/preset/files/.npmrc.template +1 -0
  127. package/src/generators/preset/files/README.md.template +174 -0
  128. package/src/generators/preset/files/nx.json +66 -0
  129. package/src/generators/preset/files/package.json +26 -0
  130. package/src/generators/preset/files/tsconfig.base.json +27 -0
  131. package/src/generators/preset/files/tsconfig.base.json.template +27 -0
  132. package/src/generators/preset/files/tsconfig.json +9 -0
  133. package/src/generators/preset/generator.d.ts +4 -0
  134. package/src/generators/preset/generator.js +127 -0
  135. package/src/generators/preset/schema.d.ts +6 -0
  136. package/src/generators/preset/schema.js +16 -0
  137. package/src/generators/preset/schema.json +50 -0
  138. package/src/generators/remove-custom-message/generator.d.ts +4 -0
  139. package/src/generators/remove-custom-message/generator.js +259 -0
  140. package/src/generators/remove-custom-message/schema.d.ts +6 -0
  141. package/src/generators/remove-custom-message/schema.js +16 -0
  142. package/src/generators/remove-custom-message/schema.json +39 -0
  143. package/src/generators/shared/bot-app-utils.d.ts +25 -0
  144. package/src/generators/shared/bot-app-utils.js +209 -0
  145. package/src/generators/webview/files/__name__.spec.tsx.template +20 -0
  146. package/src/generators/webview/files/__name__.tsx.template +19 -0
  147. package/src/generators/webview/generator.d.ts +4 -0
  148. package/src/generators/webview/generator.js +179 -0
  149. package/src/generators/webview/schema.d.ts +5 -0
  150. package/src/generators/webview/schema.js +16 -0
  151. package/src/generators/webview/schema.json +34 -0
  152. package/src/index.d.ts +7 -0
  153. package/src/index.js +56 -0
  154. package/src/lib/api-service.d.ts +110 -0
  155. package/src/lib/api-service.js +591 -0
  156. package/src/lib/bot-config.d.ts +30 -0
  157. package/src/lib/bot-config.js +203 -0
  158. package/src/lib/cloudflared-tunnel.d.ts +29 -0
  159. package/src/lib/cloudflared-tunnel.js +95 -0
  160. package/src/lib/constants.d.ts +13 -0
  161. package/src/lib/constants.js +60 -0
  162. package/src/lib/credentials-handler.d.ts +40 -0
  163. package/src/lib/credentials-handler.js +115 -0
  164. package/src/lib/index.d.ts +10 -0
  165. package/src/lib/index.js +47 -0
  166. package/src/lib/interfaces.d.ts +49 -0
  167. package/src/lib/interfaces.js +16 -0
  168. package/src/lib/util/executor-helpers.d.ts +97 -0
  169. package/src/lib/util/executor-helpers.js +574 -0
  170. package/src/lib/util/file-system.d.ts +8 -0
  171. package/src/lib/util/file-system.js +65 -0
  172. package/src/lib/util/sam-container-cleanup.d.ts +11 -0
  173. package/src/lib/util/sam-container-cleanup.js +55 -0
  174. package/src/lib/util/sam-template.d.ts +9 -0
  175. package/src/lib/util/sam-template.js +71 -0
  176. package/src/lib/util/system.d.ts +1 -0
  177. package/src/lib/util/system.js +30 -0
  178. package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.d.ts +2 -0
  179. package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.js +52 -0
  180. package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.md +23 -0
  181. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-bot.md +5 -0
  182. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-botonic.md +5 -0
  183. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/discover-bots.sh +67 -0
  184. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/find-migration-guides.sh +70 -0
  185. package/src/migrations/add-botonic-update-bots-skill/schema.json +5 -0
  186. package/src/migrations/add-lilara-registry/add-lilara-registry.migration.d.ts +2 -0
  187. package/src/migrations/add-lilara-registry/add-lilara-registry.migration.js +49 -0
  188. package/src/migrations/add-lilara-registry/schema.json +5 -0
  189. package/src/migrations/fix-css-code-split/fix-css-code-split.migration.md +45 -0
  190. package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.d.ts +2 -0
  191. package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.js +59 -0
  192. package/src/migrations/remove-codeartifact-registry/schema.json +5 -0
  193. package/src/migrations/sync-pending-bot-migrations/schema.json +5 -0
  194. package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.d.ts +2 -0
  195. package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.js +137 -0
  196. package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.md +19 -0
  197. package/src/migrations/update-cursor-commands-to-stubs/schema.json +5 -0
  198. package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.d.ts +2 -0
  199. package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.js +61 -0
  200. package/src/migrations/update-pnpm-workspace-scripts/schema.json +4 -0
  201. package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.d.ts +2 -0
  202. package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.js +47 -0
  203. package/src/migrations/utils/migration-utils.d.ts +109 -0
  204. package/src/migrations/utils/migration-utils.js +448 -0
  205. package/src/plugin.d.ts +15 -0
  206. package/src/plugin.js +246 -0
package/executors.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "executors": {
4
+ "run-lambda": {
5
+ "implementation": "./src/executors/run-lambda/executor",
6
+ "schema": "./src/executors/run-lambda/schema.json",
7
+ "description": "Run AWS SAM local lambda server"
8
+ },
9
+ "serve-bot": {
10
+ "implementation": "./src/executors/serve-bot/executor",
11
+ "schema": "./src/executors/serve-bot/schema.json",
12
+ "description": "Serve Botonic app with all processes (build, lambda, webchat, webviews) in parallel with labeled output"
13
+ },
14
+ "login-to-hubtype": {
15
+ "implementation": "./src/executors/login-to-hubtype/executor",
16
+ "schema": "./src/executors/login-to-hubtype/schema.json",
17
+ "description": "Login to Hubtype"
18
+ },
19
+ "logout-from-hubtype": {
20
+ "implementation": "./src/executors/logout-from-hubtype/executor",
21
+ "schema": "./src/executors/logout-from-hubtype/schema.json",
22
+ "description": "Logout from Hubtype"
23
+ },
24
+ "deploy-to-hubtype": {
25
+ "implementation": "./src/executors/deploy-to-hubtype/executor",
26
+ "schema": "./src/executors/deploy-to-hubtype/schema.json",
27
+ "description": "Deploy Botonic app to Hubtype"
28
+ },
29
+ "deploy-local-runtime": {
30
+ "implementation": "./src/executors/deploy-local-runtime/executor",
31
+ "schema": "./src/executors/deploy-local-runtime/schema.json",
32
+ "description": "Deploy Botonic app to Hubtype Local Runtime"
33
+ },
34
+ "integrate-provider": {
35
+ "implementation": "./src/executors/integrate-provider/executor",
36
+ "schema": "./src/executors/integrate-provider/schema.json",
37
+ "description": "Integrate provider"
38
+ },
39
+ "delete-bot": {
40
+ "implementation": "./src/executors/delete-bot/executor",
41
+ "schema": "./src/executors/delete-bot/schema.json",
42
+ "description": "Delete a bot from Hubtype"
43
+ },
44
+ "deploy-netlify-snapshot": {
45
+ "implementation": "./src/executors/deploy-netlify-snapshot/executor",
46
+ "schema": "./src/executors/deploy-netlify-snapshot/schema.json",
47
+ "description": "Deploy a static directory as a Netlify snapshot and return the deploy URL"
48
+ },
49
+ "e2e-webchat": {
50
+ "implementation": "./src/executors/e2e-webchat/executor",
51
+ "schema": "./src/executors/e2e-webchat/schema.json",
52
+ "description": "Deploy a static webchat page as a Netlify snapshot then run Playwright E2E tests against it"
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "generators": {
4
+ "bot-app": {
5
+ "factory": "./src/generators/bot-app/generator",
6
+ "schema": "./src/generators/bot-app/schema.json",
7
+ "description": "Create a new Botonic bot application"
8
+ },
9
+ "preset": {
10
+ "factory": "./src/generators/preset/generator",
11
+ "schema": "./src/generators/preset/schema.json",
12
+ "description": "Initialize a new workspace for Botonic development"
13
+ },
14
+ "custom-message": {
15
+ "factory": "./src/generators/custom-message/generator",
16
+ "schema": "./src/generators/custom-message/schema.json",
17
+ "description": "Create a custom message component for Botonic"
18
+ },
19
+ "remove-custom-message": {
20
+ "factory": "./src/generators/remove-custom-message/generator",
21
+ "schema": "./src/generators/remove-custom-message/schema.json",
22
+ "description": "Remove a custom message component from Botonic"
23
+ },
24
+ "action": {
25
+ "factory": "./src/generators/action/generator",
26
+ "schema": "./src/generators/action/schema.json",
27
+ "description": "Create a bot action for Botonic"
28
+ },
29
+ "webview": {
30
+ "factory": "./src/generators/webview/generator",
31
+ "schema": "./src/generators/webview/schema.json",
32
+ "description": "Create a webview component for Botonic"
33
+ },
34
+ "migrate-webchat-trigger": {
35
+ "factory": "./src/generators/bot-app-migrations/migrate-webchat-trigger/generator",
36
+ "schema": "./src/generators/bot-app-migrations/migrate-webchat-trigger/schema.json",
37
+ "description": "Migrate a bot app to use @botonic/webchat-react/trigger lazy-loading entry point",
38
+ "hidden": true,
39
+ "x-bot-app-migration": true,
40
+ "x-introduced-in": "2.18.0",
41
+ "x-migration-guide": "src/generators/bot-app-migrations/migrate-webchat-trigger/migrate-webchat-trigger.md"
42
+ },
43
+ "migrate-fix-css-code-split": {
44
+ "factory": "./src/generators/bot-app-migrations/migrate-fix-css-code-split/generator",
45
+ "schema": "./src/generators/bot-app-migrations/migrate-fix-css-code-split/schema.json",
46
+ "description": "Add cssCodeSplit: false to vite webchat and webviews configs",
47
+ "hidden": true,
48
+ "x-bot-app-migration": true,
49
+ "x-introduced-in": "2.18.0"
50
+ },
51
+ "migrate-pnpm-compat": {
52
+ "factory": "./src/generators/bot-app-migrations/migrate-pnpm-compat/generator",
53
+ "schema": "./src/generators/bot-app-migrations/migrate-pnpm-compat/schema.json",
54
+ "description": "Add **/node_modules/** to eslint ignorePatterns and update README npm refs to pnpm",
55
+ "hidden": true,
56
+ "x-bot-app-migration": true,
57
+ "x-introduced-in": "2.18.0",
58
+ "x-migration-guide": "src/generators/bot-app-migrations/migrate-pnpm-compat/migrate-pnpm-compat.md"
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "generators": {
3
+ "add-botonic-update-bots-skill": {
4
+ "version": "2.17.0",
5
+ "description": "Add /update-botonic and /update-bot Cursor commands for workspace and per-bot version migrations",
6
+ "cli": "nx",
7
+ "implementation": "./src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration"
8
+ },
9
+ "sync-pending-bot-migrations": {
10
+ "version": "2.17.0",
11
+ "description": "Write .botonic/pending-bot-migrations.json with bot-app generators pending for each bot",
12
+ "cli": "nx",
13
+ "implementation": "./src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration"
14
+ },
15
+ "update-pnpm-workspace-scripts": {
16
+ "version": "2.18.0",
17
+ "description": "Update find-migration-guides.sh to reference pnpm instead of npm",
18
+ "cli": "nx",
19
+ "implementation": "./src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration"
20
+ },
21
+ "update-cursor-commands-to-stubs": {
22
+ "version": "2.18.0",
23
+ "description": "Replace full-content .cursor/commands/*.md with stable stubs that reference the canonical source in node_modules",
24
+ "cli": "nx",
25
+ "implementation": "./src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration"
26
+ },
27
+ "add-lilara-registry": {
28
+ "version": "2.19.0",
29
+ "description": "(Legacy) Add @hubtype-lilara:registry for CodeArtifact; run remove-codeartifact-registry (2.23+) for public npm",
30
+ "cli": "nx",
31
+ "implementation": "./src/migrations/add-lilara-registry/add-lilara-registry.migration"
32
+ },
33
+ "remove-codeartifact-registry": {
34
+ "version": "2.23.0",
35
+ "description": "Remove CodeArtifact @botonic / @hubtype-lilara registry and auth lines from .npmrc (switch to public npm)",
36
+ "cli": "nx",
37
+ "implementation": "./src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration"
38
+ }
39
+ }
40
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@botonic/nx-plugin",
3
+ "version": "2.23.0",
4
+ "description": "Nx plugin for creating Botonic bot applications",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.d.ts",
10
+ "require": "./src/index.js"
11
+ },
12
+ "./generators.json": "./generators.json",
13
+ "./executors.json": "./executors.json",
14
+ "./migrations.json": "./migrations.json",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "generators": "./generators.json",
18
+ "executors": "./executors.json",
19
+ "ng-update": {
20
+ "migrations": "./migrations.json"
21
+ },
22
+ "engines": {
23
+ "node": ">=22.13.0"
24
+ },
25
+ "keywords": [
26
+ "nx",
27
+ "botonic",
28
+ "plugin",
29
+ "generator",
30
+ "chatbot",
31
+ "hubtype"
32
+ ],
33
+ "author": "Hubtype",
34
+ "license": "MIT",
35
+ "dependencies": {
36
+ "@nx/devkit": "^21.0.3",
37
+ "@nx/js": "^21.0.3",
38
+ "@nx/react": "^21.0.3",
39
+ "axios": "^1.6.0",
40
+ "enquirer": "^2.4.1",
41
+ "form-data": "^4.0.0",
42
+ "fs-extra": "^11.1.1",
43
+ "qs": "^6.11.0",
44
+ "yaml": "^2.6.1",
45
+ "zip-a-folder": "^1.1.0"
46
+ },
47
+ "peerDependencies": {
48
+ "nx": ">=21.0.0"
49
+ },
50
+ "devDependencies": {},
51
+ "publishConfig": {
52
+ "access": "public"
53
+ }
54
+ }
@@ -0,0 +1,114 @@
1
+ # Update Botonic Bot
2
+
3
+ ## Workflow: Apply Pending Bot Migrations
4
+
5
+ ### Step 0: Detect Package Manager
6
+
7
+ Check which package manager the workspace uses:
8
+
9
+ - If `pnpm-lock.yaml` exists → use `pnpm`
10
+ - Else → use `npm`
11
+
12
+ Use the detected package manager for all subsequent commands.
13
+
14
+ ### Step 1: Check Pending Migrations
15
+
16
+ Read `.botonic/pending-bot-migrations.json`.
17
+
18
+ If the file does not exist, tell user: "No pending bot migrations found. Run /update-botonic first to update the workspace."
19
+
20
+ If the `pending` array is empty, tell user: "All bot migrations are already applied."
21
+
22
+ ### Step 2: Discover Bots
23
+
24
+ Run `bash .cursor/scripts/update-bot/discover-bots.sh` from the workspace root.
25
+ Expected output: JSON list of bots with name, path, current version.
26
+
27
+ ### Step 3: Ask Which Bot
28
+
29
+ Present the bot list to the user. Ask which SINGLE bot to update.
30
+ **CRITICAL**: Never accept more than one bot. If user asks for multiple, explain why and ask them to pick one.
31
+
32
+ ### Step 4: Ask Target Version
33
+
34
+ Show the distinct `version` values from all pending migrations (sorted ascending, e.g. `2.16.0`, `2.17.0`, `2.18.0`).
35
+
36
+ Ask the user: "Which version would you like to update to?" (default: the latest version in the list).
37
+
38
+ Only apply migrations whose `version` ≤ the chosen target version.
39
+
40
+ ### Step 5: Find Pending Migrations for Selected Bot
41
+
42
+ Filter `.botonic/pending-bot-migrations.json` entries where ALL of:
43
+
44
+ - `appliedTo` does NOT include `<bot-name>`, AND
45
+ - `version` ≤ chosen target version
46
+
47
+ If none, report: "<bot-name> has no pending migrations up to v<target>. All up to date."
48
+
49
+ ### Step 6: Check Git State
50
+
51
+ Run `git status --porcelain`. If output is non-empty, STOP.
52
+ Tell user: "Please commit or stash changes before updating."
53
+
54
+ ### Step 7: Create Branch
55
+
56
+ `git checkout -b update/<bot-name>-pending-migrations`
57
+
58
+ ### Step 8: Apply Each Pending Generator
59
+
60
+ For each pending migration (in version order, filtered to `version` ≤ target):
61
+
62
+ 1. Run: `<package-manager> nx g <generator> --project=<bot-name>`
63
+ 2. If `migrationGuide` path exists, READ it. Follow verification checklist and manual steps.
64
+ 3. `git add -A && git commit -m "chore(<bot-name>): apply <generator-name>"`
65
+ 4. Mark bot as applied: update `.botonic/pending-bot-migrations.json` — add `<bot-name>` to the `appliedTo` array for this entry.
66
+ 5. `git add .botonic/pending-bot-migrations.json && git commit --amend --no-edit`
67
+
68
+ ### Step 9: Final Verification
69
+
70
+ - `nx build <bot-name>`
71
+ - Report: list all commits, any remaining manual steps from migration guides
72
+ - Suggest: `nx serve-bot <bot-name>` for manual testing
73
+
74
+ ## Examples
75
+
76
+ ### Example 1: Bot with two pending migrations
77
+
78
+ User says: "Update my-bot"
79
+
80
+ 1. Read pending-bot-migrations.json → 2 entries (v2.16.0, v2.17.0), my-bot not in appliedTo for either
81
+ 2. discover-bots.sh → my-bot on v2.15.0
82
+ 3. Ask target: "Available versions: 2.16.0, 2.17.0. Update to which? [default: 2.17.0]" → user picks 2.17.0
83
+ 4. Branch: update/my-bot-pending-migrations
84
+ 5. Run migrate-webchat-trigger (v2.16.0) → read guide → commit → mark applied
85
+ 6. Run migrate-fix-css-code-split (v2.17.0) → no guide → commit → mark applied
86
+ 7. Report: "Done. 2 generators applied to my-bot up to v2.17.0."
87
+
88
+ ### Example 2: Bot already up to date
89
+
90
+ User says: "Update customer-bot"
91
+
92
+ 1. Read pending-bot-migrations.json → customer-bot is in appliedTo for all entries
93
+ 2. Report: "customer-bot has no pending migrations. All up to date."
94
+
95
+ ### Example 3: Multiple bots requested (refuse)
96
+
97
+ User says: "Update all bots"
98
+ Response: "I update one bot at a time to ensure each migration is properly verified. Which bot would you like to start with? [list bots]"
99
+
100
+ ## Troubleshooting
101
+
102
+ ### Error: Generator reports "already up to date"
103
+
104
+ Cause: The bot code was already manually updated before running the generator.
105
+ Solution: The generator is idempotent and skipped correctly. Mark it as applied and continue.
106
+
107
+ ### Error: Build fails after generator
108
+
109
+ Cause: Custom bot code uses removed/changed APIs.
110
+ Solution:
111
+
112
+ 1. Read the migration guide "What it cannot handle" section
113
+ 2. Follow "Manual migration steps" for custom patterns
114
+ 3. Check TypeScript: `npx tsc --noEmit`
@@ -0,0 +1,63 @@
1
+ # Update Botonic Workspace
2
+
3
+ ## Workflow: Update Botonic to Latest Version
4
+
5
+ ### Step 0: Detect Package Manager
6
+
7
+ Check which package manager the workspace uses:
8
+
9
+ - If `pnpm-lock.yaml` exists → use `pnpm`
10
+ - Else → use `npm`
11
+
12
+ Use the detected package manager for all subsequent commands.
13
+
14
+ ### Step 1: Check Current State
15
+
16
+ Run `npm view @botonic/nx-plugin version` to get the latest available version.
17
+ Check `node_modules/@botonic/nx-plugin/package.json` for the currently installed version.
18
+
19
+ If already on latest, report "already up to date" and stop.
20
+
21
+ ### Step 2: Check Git State
22
+
23
+ Run `git status --porcelain`. If output is non-empty, STOP.
24
+ Tell user: "Please commit or stash changes before updating."
25
+
26
+ ### Step 3: Run Nx Migrate
27
+
28
+ ```
29
+ npx nx migrate @botonic/nx-plugin@latest
30
+ ```
31
+
32
+ This updates `package.json` and creates `migrations.json`.
33
+
34
+ If output says "no migrations to run" and `package.json` was already at the latest version, stop and report "already up to date".
35
+
36
+ ### Step 4: Install Dependencies
37
+
38
+ ```
39
+ <package-manager> install
40
+ ```
41
+
42
+ ### Step 5: Run Workspace Migrations
43
+
44
+ ```
45
+ <package-manager> nx migrate --run-migrations
46
+ ```
47
+
48
+ This runs workspace-level migrations and writes `.botonic/pending-bot-migrations.json` with any bot-app generators that need to be applied per bot.
49
+
50
+ ### Step 6: Commit
51
+
52
+ ```
53
+ git add -A && git commit -m "chore: update @botonic/nx-plugin to v<version>"
54
+ ```
55
+
56
+ ### Step 7: Report
57
+
58
+ Report:
59
+
60
+ - New version installed
61
+ - Any workspace changes applied
62
+ - How many bot-app generators are pending in `.botonic/pending-bot-migrations.json`
63
+ - Instruct user to run `/update-bot` to apply pending generators to each bot
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { BuildNodeAppExecutorSchema } from './schema';
3
+ export default function buildNodeAppExecutor(options: BuildNodeAppExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var executor_exports = {};
20
+ __export(executor_exports, {
21
+ default: () => buildNodeAppExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_exports);
24
+ var import_child_process = require("child_process");
25
+ var import_path = require("path");
26
+ var import_util = require("util");
27
+ async function buildNodeAppExecutor(options, context) {
28
+ if (!context.projectName) {
29
+ throw new Error("Project name is required");
30
+ }
31
+ const projectRoot = context.projectsConfigurations?.projects?.[context.projectName]?.root;
32
+ if (!projectRoot) {
33
+ throw new Error(`Could not find project root for ${context.projectName}`);
34
+ }
35
+ const configPath = options.configPath || "vite.config.ts";
36
+ const buildTarget = options.buildTarget || "node";
37
+ const watch = options.watch || false;
38
+ const fullConfigPath = (0, import_path.join)(context.root, projectRoot, configPath);
39
+ console.info(`\u{1F528} Building Node.js app...`);
40
+ console.info(`\u{1F4C1} Project: ${context.projectName}`);
41
+ console.info(`\u2699\uFE0F Config: ${fullConfigPath}`);
42
+ console.info(`\u{1F3AF} Target: ${buildTarget}`);
43
+ console.info(`\u{1F440} Watch mode: ${watch ? "enabled" : "disabled"}`);
44
+ try {
45
+ const watchFlag = watch ? "--watch" : "";
46
+ const command = `VITE_CJS_IGNORE_WARNING=true BUILD_TARGET=${buildTarget} vite build --config ${fullConfigPath} ${watchFlag}`.trim();
47
+ console.info(`\u{1F680} Running: ${command}`);
48
+ const { stdout, stderr } = await (0, import_util.promisify)(import_child_process.exec)(command, {
49
+ cwd: context.root
50
+ });
51
+ if (stdout) {
52
+ console.log(stdout);
53
+ }
54
+ if (stderr) {
55
+ console.error(stderr);
56
+ throw new Error(stderr);
57
+ }
58
+ console.info(`\u2705 Build completed successfully!`);
59
+ return { success: true };
60
+ } catch (error) {
61
+ const errorMessage = error instanceof Error ? error.message : String(error);
62
+ console.error(`\u274C Error building Node.js app:`, errorMessage);
63
+ return { success: false };
64
+ }
65
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var schema_d_exports = {};
16
+ module.exports = __toCommonJS(schema_d_exports);
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "BuildNodeApp executor",
5
+ "description": "Build Botonic app for Node.js target with optional watch mode",
6
+ "type": "object",
7
+ "properties": {
8
+ "configPath": {
9
+ "type": "string",
10
+ "description": "Path to the Vite config file",
11
+ "default": "vite.config.ts"
12
+ },
13
+ "watch": {
14
+ "type": "boolean",
15
+ "description": "Run in watch mode",
16
+ "default": false
17
+ },
18
+ "buildTarget": {
19
+ "type": "string",
20
+ "description": "Build target",
21
+ "default": "node"
22
+ }
23
+ },
24
+ "required": []
25
+ }
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { DeleteBotExecutorSchema } from './schema';
3
+ export default function deleteBotExecutor(options: DeleteBotExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var executor_exports = {};
20
+ __export(executor_exports, {
21
+ default: () => deleteBotExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_exports);
24
+ var import_enquirer = require("enquirer");
25
+ var import_path = require("path");
26
+ var import_api_service = require("../../lib/api-service");
27
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
28
+ async function deleteBotExecutor(options, context) {
29
+ if (!context.projectName) {
30
+ throw new Error("Project name is not defined in executor context");
31
+ }
32
+ try {
33
+ const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
34
+ const botonicApiService = new import_api_service.BotonicAPIService({
35
+ workspaceRoot: (0, import_path.resolve)(context.root),
36
+ environmentVariables,
37
+ targetEnvironment
38
+ });
39
+ if (!botonicApiService.oauth) {
40
+ if (options.email && options.password) {
41
+ await botonicApiService.login(options.email, options.password);
42
+ botonicApiService.saveAllCredentials();
43
+ } else {
44
+ await (0, import_executor_helpers.handleAuthentication)(botonicApiService);
45
+ }
46
+ }
47
+ await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
48
+ console.log(
49
+ `\u{1F5D1}\uFE0F Deleting bot from Hubtype... [${environmentVariables["VITE_HUBTYPE_API_URL"]}]
50
+ `
51
+ );
52
+ const botToDelete = await findBotToDelete(botonicApiService, options);
53
+ if (!botToDelete) {
54
+ console.log("\u274C No bot found to delete");
55
+ return { success: false };
56
+ }
57
+ if (!options.skipConfirmation) {
58
+ const response = await (0, import_enquirer.prompt)({
59
+ type: "confirm",
60
+ name: "confirm_delete",
61
+ message: `\u26A0\uFE0F Are you sure you want to delete bot "${botToDelete.name}" (ID: ${botToDelete.id})? This action cannot be undone.`
62
+ });
63
+ if (!response.confirm_delete) {
64
+ console.log("\u274C Deletion cancelled");
65
+ return { success: false };
66
+ }
67
+ }
68
+ console.log(
69
+ `\u{1F5D1}\uFE0F Deleting bot "${botToDelete.name}" (ID: ${botToDelete.id})...`
70
+ );
71
+ await botonicApiService.deleteBot(botToDelete.id);
72
+ console.log(`\u2705 Bot "${botToDelete.name}" deleted successfully!`);
73
+ return { success: true };
74
+ } catch (error) {
75
+ return (0, import_executor_helpers.handleExecutorError)(error, "Delete bot");
76
+ }
77
+ }
78
+ async function findBotToDelete(botonicApiService, options) {
79
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
80
+ if (options.botId) {
81
+ const bot = bots.find((b) => b.id === options.botId);
82
+ if (bot) {
83
+ return { id: bot.id, name: bot.name };
84
+ }
85
+ console.log(`\u274C Bot with ID "${options.botId}" not found`);
86
+ return null;
87
+ }
88
+ if (options.botName) {
89
+ const bot = bots.find((b) => b.name === options.botName);
90
+ if (bot) {
91
+ return { id: bot.id, name: bot.name };
92
+ }
93
+ console.log(`\u274C Bot with name "${options.botName}" not found`);
94
+ return null;
95
+ }
96
+ if (!bots.length) {
97
+ console.log("No bots available to delete");
98
+ return null;
99
+ }
100
+ const response = await (0, import_enquirer.prompt)({
101
+ type: "select",
102
+ name: "bot_to_delete",
103
+ message: "\u{1F5D1}\uFE0F Select a bot to delete:",
104
+ choices: bots.map((bot) => ({
105
+ name: bot.id,
106
+ message: `${bot.name} (ID: ${bot.id})`
107
+ }))
108
+ });
109
+ const selectedBotId = response.bot_to_delete;
110
+ const selectedBot = bots.find((bot) => bot.id === selectedBotId);
111
+ return selectedBot ? { id: selectedBot.id, name: selectedBot.name } : null;
112
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var schema_d_exports = {};
16
+ module.exports = __toCommonJS(schema_d_exports);