@hubspot/cli 7.8.12-experimental.0 → 7.9.0-beta.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 (451) hide show
  1. package/bin/cli.js +31 -25
  2. package/commands/__tests__/auth.test.js +5 -0
  3. package/commands/__tests__/cms.test.js +44 -1
  4. package/commands/__tests__/customObject.test.js +22 -1
  5. package/commands/__tests__/doctor.test.js +16 -16
  6. package/commands/__tests__/project.test.js +2 -0
  7. package/commands/account/auth.js +1 -0
  8. package/commands/account/clean.js +18 -27
  9. package/commands/account/createOverride.js +13 -31
  10. package/commands/account/info.js +20 -31
  11. package/commands/account/list.js +16 -22
  12. package/commands/account/remove.js +12 -20
  13. package/commands/account/removeOverride.js +11 -21
  14. package/commands/account/rename.js +6 -9
  15. package/commands/account/use.js +12 -26
  16. package/commands/account.js +2 -2
  17. package/commands/app/__tests__/migrate.test.js +5 -5
  18. package/commands/app/migrate.js +13 -18
  19. package/commands/app.js +1 -6
  20. package/commands/auth.d.ts +1 -0
  21. package/commands/auth.js +17 -7
  22. package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
  23. package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
  24. package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
  25. package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
  26. package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
  27. package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
  28. package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
  29. package/commands/cms/app/create.d.ts +9 -0
  30. package/commands/cms/app/create.js +82 -0
  31. package/commands/cms/app.d.ts +3 -0
  32. package/commands/cms/app.js +17 -0
  33. package/commands/cms/convertFields.js +7 -9
  34. package/commands/cms/delete.d.ts +6 -0
  35. package/commands/cms/delete.js +43 -0
  36. package/commands/cms/fetch.d.ts +12 -0
  37. package/commands/cms/fetch.js +79 -0
  38. package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
  39. package/commands/cms/function/create.d.ts +12 -0
  40. package/commands/cms/function/create.js +84 -0
  41. package/commands/cms/function/deploy.d.ts +6 -0
  42. package/commands/cms/function/deploy.js +89 -0
  43. package/commands/cms/function/list.d.ts +6 -0
  44. package/commands/cms/function/list.js +60 -0
  45. package/commands/cms/function/logs.d.ts +10 -0
  46. package/commands/cms/function/logs.js +135 -0
  47. package/commands/cms/function/server.d.ts +10 -0
  48. package/commands/cms/function/server.js +69 -0
  49. package/commands/cms/function.d.ts +3 -0
  50. package/commands/cms/function.js +27 -0
  51. package/commands/cms/getReactModule.js +9 -14
  52. package/commands/cms/lighthouseScore.js +33 -36
  53. package/commands/cms/lint.d.ts +6 -0
  54. package/commands/cms/lint.js +83 -0
  55. package/commands/cms/list.d.ts +6 -0
  56. package/commands/cms/list.js +96 -0
  57. package/commands/cms/module/create.d.ts +11 -0
  58. package/commands/cms/module/create.js +84 -0
  59. package/commands/cms/module/marketplace-validate.d.ts +6 -0
  60. package/commands/cms/module/marketplace-validate.js +45 -0
  61. package/commands/cms/module.d.ts +3 -0
  62. package/commands/cms/module.js +17 -0
  63. package/commands/cms/mv.d.ts +7 -0
  64. package/commands/cms/mv.js +60 -0
  65. package/commands/cms/template/create.d.ts +9 -0
  66. package/commands/cms/template/create.js +72 -0
  67. package/commands/cms/template.d.ts +3 -0
  68. package/commands/cms/template.js +17 -0
  69. package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
  70. package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
  71. package/commands/cms/theme/create.d.ts +6 -0
  72. package/commands/cms/theme/create.js +58 -0
  73. package/commands/cms/theme/generate-selectors.d.ts +6 -0
  74. package/commands/cms/theme/generate-selectors.js +171 -0
  75. package/commands/cms/theme/marketplace-validate.d.ts +6 -0
  76. package/commands/cms/theme/marketplace-validate.js +46 -0
  77. package/commands/cms/theme/preview.d.ts +12 -0
  78. package/commands/cms/theme/preview.js +224 -0
  79. package/commands/cms/theme.d.ts +3 -0
  80. package/commands/cms/theme.js +25 -0
  81. package/commands/cms/upload.d.ts +12 -0
  82. package/commands/cms/upload.js +212 -0
  83. package/commands/cms/watch.d.ts +14 -0
  84. package/commands/cms/watch.js +138 -0
  85. package/commands/cms/webpack/create.d.ts +6 -0
  86. package/commands/cms/webpack/create.js +58 -0
  87. package/commands/cms/webpack.d.ts +3 -0
  88. package/commands/cms/webpack.js +17 -0
  89. package/commands/cms.js +28 -2
  90. package/commands/completion.js +3 -3
  91. package/commands/config/set.d.ts +1 -1
  92. package/commands/config/set.js +64 -36
  93. package/commands/config.js +2 -2
  94. package/commands/create.js +6 -4
  95. package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
  96. package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
  97. package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
  98. package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
  99. package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
  100. package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
  101. package/commands/customObject/create.js +10 -12
  102. package/commands/customObject/createSchema.d.ts +6 -0
  103. package/commands/customObject/createSchema.js +56 -0
  104. package/commands/customObject/deleteSchema.d.ts +7 -0
  105. package/commands/customObject/deleteSchema.js +69 -0
  106. package/commands/customObject/fetchAllSchemas.d.ts +6 -0
  107. package/commands/customObject/fetchAllSchemas.js +57 -0
  108. package/commands/customObject/fetchSchema.d.ts +7 -0
  109. package/commands/customObject/fetchSchema.js +67 -0
  110. package/commands/customObject/listSchemas.d.ts +4 -0
  111. package/commands/customObject/listSchemas.js +35 -0
  112. package/commands/customObject/schema/create.d.ts +4 -6
  113. package/commands/customObject/schema/create.js +13 -38
  114. package/commands/customObject/schema/delete.d.ts +4 -7
  115. package/commands/customObject/schema/delete.js +15 -50
  116. package/commands/customObject/schema/fetch-all.d.ts +4 -6
  117. package/commands/customObject/schema/fetch-all.js +14 -40
  118. package/commands/customObject/schema/fetch.d.ts +4 -7
  119. package/commands/customObject/schema/fetch.js +14 -49
  120. package/commands/customObject/schema/list.d.ts +4 -4
  121. package/commands/customObject/schema/list.js +10 -19
  122. package/commands/customObject/schema/update.d.ts +4 -7
  123. package/commands/customObject/schema/update.js +15 -50
  124. package/commands/customObject/schema.js +5 -3
  125. package/commands/customObject/updateSchema.d.ts +7 -0
  126. package/commands/customObject/updateSchema.js +71 -0
  127. package/commands/customObject.js +22 -8
  128. package/commands/doctor.js +8 -11
  129. package/commands/feedback.js +7 -12
  130. package/commands/fetch.d.ts +4 -12
  131. package/commands/fetch.js +20 -47
  132. package/commands/filemanager/fetch.js +7 -7
  133. package/commands/filemanager/upload.js +15 -34
  134. package/commands/filemanager.js +2 -2
  135. package/commands/function/deploy.d.ts +4 -6
  136. package/commands/function/deploy.js +14 -89
  137. package/commands/function/list.d.ts +4 -6
  138. package/commands/function/list.js +14 -40
  139. package/commands/function/server.d.ts +4 -10
  140. package/commands/function/server.js +22 -31
  141. package/commands/function.d.ts +2 -4
  142. package/commands/function.js +25 -14
  143. package/commands/getStarted.js +2 -2
  144. package/commands/hubdb/clear.js +7 -15
  145. package/commands/hubdb/create.js +9 -15
  146. package/commands/hubdb/delete.js +8 -15
  147. package/commands/hubdb/fetch.js +6 -9
  148. package/commands/hubdb.d.ts +1 -1
  149. package/commands/hubdb.js +2 -2
  150. package/commands/init.js +2 -3
  151. package/commands/lint.d.ts +4 -6
  152. package/commands/lint.js +13 -65
  153. package/commands/list.d.ts +4 -6
  154. package/commands/list.js +14 -81
  155. package/commands/logs.d.ts +4 -10
  156. package/commands/logs.js +25 -94
  157. package/commands/module/marketplace-validate.d.ts +4 -6
  158. package/commands/module/marketplace-validate.js +15 -27
  159. package/commands/module.d.ts +2 -2
  160. package/commands/module.js +17 -15
  161. package/commands/mv.d.ts +4 -7
  162. package/commands/mv.js +14 -51
  163. package/commands/open.js +5 -5
  164. package/commands/project/__tests__/add.test.js +15 -13
  165. package/commands/project/__tests__/deploy.test.js +3 -4
  166. package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
  167. package/commands/project/__tests__/installDeps.test.js +8 -8
  168. package/commands/project/__tests__/list.test.js +31 -0
  169. package/commands/project/__tests__/logs.test.js +1 -1
  170. package/commands/project/__tests__/migrate.test.js +6 -5
  171. package/commands/project/__tests__/migrateApp.test.js +2 -5
  172. package/commands/project/__tests__/validate.test.js +98 -0
  173. package/commands/project/add.d.ts +2 -2
  174. package/commands/project/add.js +6 -5
  175. package/commands/project/cloneApp.js +14 -19
  176. package/commands/project/create.js +1 -2
  177. package/commands/project/deploy.js +3 -3
  178. package/commands/project/dev/deprecatedFlow.js +9 -18
  179. package/commands/project/dev/index.js +19 -17
  180. package/commands/project/dev/unifiedFlow.js +11 -4
  181. package/commands/project/download.js +15 -15
  182. package/commands/project/installDeps.d.ts +2 -2
  183. package/commands/project/installDeps.js +9 -8
  184. package/commands/project/list.d.ts +4 -0
  185. package/commands/project/list.js +62 -0
  186. package/commands/project/listBuilds.js +11 -20
  187. package/commands/project/logs.js +21 -24
  188. package/commands/project/migrate.js +5 -2
  189. package/commands/project/migrateApp.js +9 -15
  190. package/commands/project/open.js +6 -13
  191. package/commands/project/upload.d.ts +2 -2
  192. package/commands/project/upload.js +17 -26
  193. package/commands/project/validate.js +6 -6
  194. package/commands/project/watch.js +13 -22
  195. package/commands/project.js +4 -2
  196. package/commands/remove.d.ts +4 -6
  197. package/commands/remove.js +12 -24
  198. package/commands/sandbox/__tests__/create.test.js +5 -5
  199. package/commands/sandbox/create.js +22 -32
  200. package/commands/sandbox/delete.js +38 -63
  201. package/commands/sandbox.js +2 -2
  202. package/commands/secret/addSecret.js +7 -17
  203. package/commands/secret/deleteSecret.js +10 -20
  204. package/commands/secret/listSecret.js +8 -10
  205. package/commands/secret/updateSecret.js +9 -17
  206. package/commands/secret.js +2 -2
  207. package/commands/testAccount/__tests__/delete.test.js +2 -4
  208. package/commands/testAccount/create.js +2 -5
  209. package/commands/testAccount/delete.d.ts +4 -3
  210. package/commands/testAccount/delete.js +155 -14
  211. package/commands/theme/generate-selectors.d.ts +4 -6
  212. package/commands/theme/generate-selectors.js +14 -152
  213. package/commands/theme/marketplace-validate.d.ts +4 -6
  214. package/commands/theme/marketplace-validate.js +14 -25
  215. package/commands/theme/preview.d.ts +4 -12
  216. package/commands/theme/preview.js +18 -183
  217. package/commands/theme.d.ts +2 -2
  218. package/commands/theme.js +19 -13
  219. package/commands/upload.d.ts +4 -12
  220. package/commands/upload.js +19 -169
  221. package/commands/watch.d.ts +4 -14
  222. package/commands/watch.js +23 -88
  223. package/lang/en.d.ts +863 -542
  224. package/lang/en.js +912 -595
  225. package/lang/en.lyaml +4 -4
  226. package/lib/__tests__/buildAccount.test.js +4 -3
  227. package/lib/__tests__/commonOpts.test.js +1 -1
  228. package/lib/__tests__/dependencyManagement.test.js +1 -1
  229. package/lib/__tests__/developerTestAccounts.test.js +3 -3
  230. package/lib/__tests__/npm.test.js +1 -1
  231. package/lib/__tests__/oauth.test.js +4 -4
  232. package/lib/__tests__/process.test.js +10 -5
  233. package/lib/__tests__/sandboxSync.test.js +8 -8
  234. package/lib/__tests__/sandboxes.test.js +8 -8
  235. package/lib/__tests__/serverlessLogs.test.js +1 -1
  236. package/lib/__tests__/usageTracking.test.js +5 -5
  237. package/lib/__tests__/validation.test.js +2 -1
  238. package/lib/__tests__/yargsUtils.test.js +83 -9
  239. package/lib/app/__tests__/migrate.test.js +5 -5
  240. package/lib/app/__tests__/migrate_legacy.test.js +1 -1
  241. package/lib/app/migrate.js +1 -1
  242. package/lib/app/migrate_legacy.js +20 -24
  243. package/lib/buildAccount.d.ts +2 -2
  244. package/lib/buildAccount.js +32 -64
  245. package/lib/commonOpts.d.ts +1 -1
  246. package/lib/commonOpts.js +25 -22
  247. package/lib/configMigrate.js +88 -9
  248. package/lib/configOptions.js +7 -0
  249. package/lib/constants.d.ts +15 -1
  250. package/lib/constants.js +19 -1
  251. package/lib/dependencyManagement.js +9 -27
  252. package/lib/developerTestAccounts.js +9 -23
  253. package/lib/doctor/Diagnosis.js +11 -23
  254. package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
  255. package/lib/doctor/Doctor.js +42 -90
  256. package/lib/doctor/__tests__/Doctor.test.js +4 -4
  257. package/lib/errorHandlers/index.js +12 -20
  258. package/lib/errorHandlers/suppressError.js +11 -18
  259. package/lib/generateSelectors.js +1 -1
  260. package/lib/lang.js +6 -5
  261. package/lib/links.js +4 -4
  262. package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
  263. package/lib/middleware/__test__/configMiddleware.test.js +11 -11
  264. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
  265. package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
  266. package/lib/middleware/autoUpdateMiddleware.js +12 -2
  267. package/lib/middleware/commandTargetingUtils.d.ts +8 -0
  268. package/lib/middleware/commandTargetingUtils.js +74 -0
  269. package/lib/middleware/configMiddleware.d.ts +1 -1
  270. package/lib/middleware/configMiddleware.js +21 -81
  271. package/lib/middleware/gitMiddleware.js +5 -1
  272. package/lib/middleware/notificationsMiddleware.js +5 -11
  273. package/lib/middleware/yargsChecksMiddleware.js +6 -9
  274. package/lib/npm.js +2 -2
  275. package/lib/oauth.js +5 -5
  276. package/lib/process.js +5 -4
  277. package/lib/projectProfiles.d.ts +1 -1
  278. package/lib/projectProfiles.js +2 -10
  279. package/lib/projects/__tests__/AppDevModeInterface.test.js +101 -135
  280. package/lib/projects/__tests__/DevServerManager.test.js +183 -0
  281. package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
  282. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +76 -45
  283. package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
  284. package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
  285. package/lib/projects/__tests__/deploy.test.js +9 -9
  286. package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
  287. package/lib/projects/__tests__/platformVersion.test.js +8 -8
  288. package/lib/projects/__tests__/projects.test.js +12 -12
  289. package/lib/projects/__tests__/structure.test.js +3 -3
  290. package/lib/projects/__tests__/upload.test.d.ts +1 -0
  291. package/lib/projects/__tests__/upload.test.js +82 -0
  292. package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
  293. package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
  294. package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +39 -39
  295. package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
  296. package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
  297. package/lib/projects/create/__tests__/legacy.test.js +5 -5
  298. package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
  299. package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +3 -3
  300. package/lib/projects/create/index.js +4 -4
  301. package/lib/projects/create/legacy.js +2 -2
  302. package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
  303. package/lib/projects/create/{v3.js → v2.js} +5 -5
  304. package/lib/projects/deploy.d.ts +1 -1
  305. package/lib/projects/deploy.js +2 -2
  306. package/lib/projects/localDev/AppDevModeInterface.d.ts +11 -3
  307. package/lib/projects/localDev/AppDevModeInterface.js +128 -115
  308. package/lib/projects/localDev/DevServerManager.d.ts +10 -29
  309. package/lib/projects/localDev/DevServerManager.js +20 -76
  310. package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
  311. package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
  312. package/lib/projects/localDev/LocalDevLogger.js +10 -11
  313. package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +10 -11
  314. package/lib/projects/localDev/LocalDevProcess.js +3 -2
  315. package/lib/projects/localDev/LocalDevState.d.ts +3 -0
  316. package/lib/projects/localDev/LocalDevState.js +9 -0
  317. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -1
  318. package/lib/projects/localDev/LocalDevWebsocketServer.js +46 -16
  319. package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
  320. package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
  321. package/lib/projects/localDev/helpers/account.d.ts +1 -1
  322. package/lib/projects/localDev/helpers/account.js +2 -2
  323. package/lib/projects/localDev/helpers/process.d.ts +1 -0
  324. package/lib/projects/localDev/helpers/process.js +15 -0
  325. package/lib/projects/localDev/helpers/project.d.ts +1 -0
  326. package/lib/projects/localDev/helpers/project.js +39 -3
  327. package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
  328. package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
  329. package/lib/projects/platformVersion.d.ts +1 -1
  330. package/lib/projects/platformVersion.js +1 -1
  331. package/lib/projects/structure.d.ts +2 -2
  332. package/lib/projects/structure.js +6 -6
  333. package/lib/projects/upload.d.ts +2 -3
  334. package/lib/projects/upload.js +17 -9
  335. package/lib/projects/urls.d.ts +0 -1
  336. package/lib/projects/urls.js +0 -3
  337. package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
  338. package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
  339. package/lib/prompts/accountNamePrompt.js +14 -19
  340. package/lib/prompts/accountsPrompt.js +2 -2
  341. package/lib/prompts/cmsFieldPrompt.js +2 -2
  342. package/lib/prompts/createApiSamplePrompt.js +5 -5
  343. package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
  344. package/lib/prompts/createFunctionPrompt.js +14 -14
  345. package/lib/prompts/createModulePrompt.js +9 -9
  346. package/lib/prompts/createTemplatePrompt.js +2 -2
  347. package/lib/prompts/downloadProjectPrompt.js +5 -8
  348. package/lib/prompts/installAppPrompt.d.ts +1 -6
  349. package/lib/prompts/installAppPrompt.js +1 -6
  350. package/lib/prompts/personalAccessKeyPrompt.js +3 -3
  351. package/lib/prompts/previewPrompt.js +6 -6
  352. package/lib/prompts/projectAddPrompt.d.ts +2 -2
  353. package/lib/prompts/projectAddPrompt.js +7 -1
  354. package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
  355. package/lib/prompts/projectNamePrompt.js +4 -8
  356. package/lib/prompts/projectsLogsPrompt.js +2 -4
  357. package/lib/prompts/promptUtils.js +27 -9
  358. package/lib/prompts/sandboxesPrompt.js +7 -7
  359. package/lib/prompts/secretPrompt.js +3 -3
  360. package/lib/prompts/selectAppPrompt.js +3 -3
  361. package/lib/prompts/selectHubDBTablePrompt.js +9 -13
  362. package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
  363. package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
  364. package/lib/prompts/uploadPrompt.js +5 -5
  365. package/lib/sandboxSync.js +24 -41
  366. package/lib/sandboxes.js +19 -47
  367. package/lib/schema.js +3 -3
  368. package/lib/serverlessLogs.js +11 -13
  369. package/lib/theme/__tests__/migrate.test.js +6 -6
  370. package/lib/theme/migrate.js +2 -2
  371. package/lib/ui/SpinniesManager.d.ts +2 -0
  372. package/lib/ui/SpinniesManager.js +7 -0
  373. package/lib/ui/boxen.js +1 -2
  374. package/lib/ui/git.js +13 -10
  375. package/lib/ui/index.d.ts +6 -0
  376. package/lib/ui/index.js +55 -38
  377. package/lib/ui/serverlessFunctionLogs.js +9 -7
  378. package/lib/ui/uiMessages.d.ts +73 -0
  379. package/lib/ui/uiMessages.js +76 -0
  380. package/lib/usageTracking.js +7 -7
  381. package/lib/validation.js +20 -23
  382. package/lib/yargsUtils.d.ts +1 -1
  383. package/lib/yargsUtils.js +12 -5
  384. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
  385. package/mcp-server/tools/index.js +4 -0
  386. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
  387. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
  388. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
  389. package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
  390. package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
  391. package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
  392. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
  393. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
  394. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
  395. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
  396. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
  397. package/mcp-server/utils/toolUsageTracking.js +2 -2
  398. package/package.json +8 -7
  399. package/types/Cms.d.ts +6 -6
  400. package/types/Yargs.d.ts +1 -1
  401. package/commands/app/__tests__/install.test.js +0 -47
  402. package/commands/app/install.d.ts +0 -8
  403. package/commands/app/install.js +0 -122
  404. package/lib/middleware/__test__/utils.test.js +0 -51
  405. package/lib/middleware/utils.d.ts +0 -8
  406. package/lib/middleware/utils.js +0 -14
  407. package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
  408. package/lib/projects/localDev/DevServerManagerV2.js +0 -81
  409. /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
  410. /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
  411. /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
  412. /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
  413. /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
  414. /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
  415. /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
  416. /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
  417. /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
  418. /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
  419. /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
  420. /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
  421. /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
  422. /package/commands/{app/__tests__/install.test.d.ts → customObject/__tests__/deleteSchema.test.d.ts} +0 -0
  423. /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
  424. /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
  425. /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
  426. /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
  427. /package/commands/{customObject/schema/__tests__/update.test.d.ts → project/__tests__/list.test.d.ts} +0 -0
  428. /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
  429. /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
  430. /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
  431. /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
  432. /package/{commands/create → lib/cmsAssets}/app.js +0 -0
  433. /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
  434. /package/{commands/create → lib/cmsAssets}/function.js +0 -0
  435. /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
  436. /package/{commands/create → lib/cmsAssets}/index.js +0 -0
  437. /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
  438. /package/{commands/create → lib/cmsAssets}/module.js +0 -0
  439. /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
  440. /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
  441. /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
  442. /package/{commands/create → lib/cmsAssets}/template.js +0 -0
  443. /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
  444. /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
  445. /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
  446. /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
  447. /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
  448. /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
  449. /package/lib/{projects/add/__tests__/v3AddComponent.test.d.ts → middleware/__test__/commandTargetingUtils.test.d.ts} +0 -0
  450. /package/lib/projects/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
  451. /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lib/ui/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import chalk from 'chalk';
2
- import { getAccountConfig } from '@hubspot/local-dev-lib/config';
3
- import { logger } from '@hubspot/local-dev-lib/logger';
2
+ import { getAccountConfig, configFileExists, } from '@hubspot/local-dev-lib/config';
3
+ import { uiLogger } from './logger.js';
4
4
  import { supportsHyperlinkModule } from './supportHyperlinks.js';
5
5
  import { supportsColor } from './supportsColor.js';
6
- import { i18n } from '../lang.js';
6
+ import { uiMessages } from './uiMessages.js';
7
7
  import { HUBSPOT_ACCOUNT_TYPE_STRINGS } from '@hubspot/local-dev-lib/constants/config';
8
8
  export const UI_COLORS = {
9
9
  SORBET: '#FF8F59',
@@ -11,7 +11,7 @@ export const UI_COLORS = {
11
11
  MARIGOLD_DARK: '#dbae60',
12
12
  };
13
13
  export function uiLine() {
14
- logger.log('-'.repeat(50));
14
+ uiLogger.log('-'.repeat(50));
15
15
  }
16
16
  export function getTerminalUISupport() {
17
17
  return {
@@ -50,10 +50,10 @@ export function uiAccountDescription(accountId, bold = true) {
50
50
  }
51
51
  export function uiInfoSection(title, logContent) {
52
52
  uiLine();
53
- logger.log(chalk.bold(title));
54
- logger.log('');
53
+ uiLogger.log(chalk.bold(title));
54
+ uiLogger.log('');
55
55
  logContent();
56
- logger.log('');
56
+ uiLogger.log('');
57
57
  uiLine();
58
58
  }
59
59
  export function uiCommandReference(command, withQuotes = true) {
@@ -63,66 +63,83 @@ export function uiCommandReference(command, withQuotes = true) {
63
63
  ? chalk.hex(UI_COLORS.MARIGOLD_DARK)(commandReference)
64
64
  : commandReference);
65
65
  }
66
+ export function uiAuthCommandReference({ accountId, qa, } = {}) {
67
+ const userIsUsingGlobalConfig = configFileExists(true);
68
+ let command = 'hs auth';
69
+ if (userIsUsingGlobalConfig) {
70
+ command = 'hs account auth';
71
+ }
72
+ return uiCommandReference(`${command}${accountId ? ` --account=${accountId}` : ''}${qa ? ' --qa' : ''}`);
73
+ }
66
74
  export function uiFeatureHighlight(features, title) {
67
- uiInfoSection(title ? title : i18n(`lib.ui.featureHighlight.defaultTitle`), () => {
75
+ uiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
68
76
  features.forEach(feature => {
69
- const featureKey = `lib.ui.featureHighlight.featureKeys.${feature}`;
70
- const message = i18n(`${featureKey}.message`, {
71
- command: uiCommandReference(i18n(`${featureKey}.command`)),
72
- link: uiLink(i18n(`${featureKey}.linkText`), i18n(`${featureKey}.url`)),
73
- });
74
- logger.log(` - ${message}`);
77
+ const featureConfig = uiMessages.featureHighlight.featureKeys[feature];
78
+ if (!featureConfig) {
79
+ uiLogger.debug(`Feature config not found for: ${feature}`);
80
+ return;
81
+ }
82
+ let message;
83
+ if ('linkText' in featureConfig && 'url' in featureConfig) {
84
+ // linkText + url (for sampleProjects)
85
+ message = featureConfig.message(uiLink(featureConfig.linkText, featureConfig.url));
86
+ }
87
+ else if ('command' in featureConfig && 'message' in featureConfig) {
88
+ // Command + Message function (most cases)
89
+ message = featureConfig.message(uiCommandReference(featureConfig.command));
90
+ }
91
+ else {
92
+ // Message only (for projectCommandTip)
93
+ message = featureConfig.message;
94
+ }
95
+ uiLogger.log(` - ${message}`);
75
96
  });
76
97
  });
77
98
  }
78
99
  export function uiBetaTag(message, log = true) {
79
- const tag = i18n(`lib.ui.betaTag`);
100
+ const tag = uiMessages.betaTag;
80
101
  const result = `${tag} ${message}`;
81
102
  if (log) {
82
- logger.log(result);
103
+ uiLogger.log(result);
83
104
  return;
84
105
  }
85
106
  return result;
86
107
  }
87
108
  export function uiDeprecatedTag(message, log = true) {
88
- const tag = i18n(`lib.ui.deprecatedTag`);
109
+ const tag = uiMessages.deprecatedTag;
89
110
  const result = `${tag} ${message}`;
90
111
  if (log) {
91
- logger.log(result);
112
+ uiLogger.log(result);
92
113
  return;
93
114
  }
94
115
  return result;
95
116
  }
96
117
  export function uiCommandDisabledBanner(command, url, message) {
97
118
  const tag = message ||
98
- i18n(`lib.ui.disabledMessage`, {
99
- command: uiCommandReference(command),
100
- url: url ? uiLink(i18n(`lib.ui.disabledUrlText`), url) : '',
101
- npmCommand: uiCommandReference('npm i -g @hubspot/cli@latest'),
102
- });
103
- logger.log();
119
+ `The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('See all HubSpot CLI commands here.', url) : ''}`;
120
+ uiLogger.log('');
104
121
  uiLine();
105
- logger.error(tag);
122
+ uiLogger.error(tag);
106
123
  uiLine();
107
- logger.log();
124
+ uiLogger.log('');
108
125
  }
109
126
  export function uiDeprecatedDescription(message, command, url) {
110
- const tag = i18n(`lib.ui.deprecatedDescription`, {
111
- message,
112
- command: uiCommandReference(command),
113
- url: url ? uiLink(i18n(`lib.ui.deprecatedUrlText`), url) : '',
114
- });
127
+ const tag = message || uiMessages.disabledMessage(command, url);
115
128
  return uiDeprecatedTag(tag);
116
129
  }
130
+ export function uiCommandRenamedDescription(describe, newCommand) {
131
+ return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedMessage(newCommand)}`, false);
132
+ }
117
133
  export function uiDeprecatedMessage(command, url, message) {
118
- const tag = message ||
119
- i18n(`lib.ui.deprecatedMessage`, {
120
- command: uiCommandReference(command),
121
- url: url ? uiLink(i18n(`lib.ui.deprecatedUrlText`), url) : '',
122
- });
123
- logger.log();
134
+ const tag = uiMessages.deprecatedDescription(message || '', command, url);
135
+ uiLogger.log('');
124
136
  uiDeprecatedTag(tag);
125
- logger.log();
137
+ uiLogger.log('');
138
+ }
139
+ export function uiCommandRelocatedMessage(newCommand) {
140
+ uiLogger.log('');
141
+ uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand));
142
+ uiLogger.log('');
126
143
  }
127
144
  export function indent(level) {
128
145
  const indentation = ' ';
@@ -1,7 +1,8 @@
1
1
  import moment from 'moment';
2
2
  import chalk from 'chalk';
3
- import { logger, Styles } from '@hubspot/local-dev-lib/logger';
4
- import { i18n } from '../lang.js';
3
+ import { Styles } from '@hubspot/local-dev-lib/logger';
4
+ import { uiLogger } from './logger.js';
5
+ import { lib } from '../../lang/en.js';
5
6
  const SEPARATOR = ' - ';
6
7
  const LOG_STATUS_COLORS = {
7
8
  SUCCESS: Styles.success,
@@ -56,9 +57,7 @@ function processLog(log, options) {
56
57
  return logHandler[log.status](log, options);
57
58
  }
58
59
  catch (e) {
59
- logger.error(i18n(`lib.ui.serverlessFunctionLogs.unableToProcessLog`, {
60
- log: JSON.stringify(log),
61
- }));
60
+ uiLogger.error(lib.ui.serverlessFunctionLogs.unableToProcessLog(JSON.stringify(log)));
62
61
  }
63
62
  }
64
63
  function isLogsResponse(logsResp) {
@@ -70,7 +69,7 @@ function isLogsResponse(logsResp) {
70
69
  function processLogs(logsResp, options) {
71
70
  const isLogsResp = isLogsResponse(logsResp);
72
71
  if (!logsResp || (isLogsResp && logsResp.results.length === 0)) {
73
- return i18n(`lib.ui.serverlessFunctionLogs.noLogsFound`);
72
+ return lib.ui.serverlessFunctionLogs.noLogsFound;
74
73
  }
75
74
  else if (isLogsResp) {
76
75
  return logsResp
@@ -82,5 +81,8 @@ function processLogs(logsResp, options) {
82
81
  return processLog(logsResp, options);
83
82
  }
84
83
  export function outputLogs(logsResp, options) {
85
- logger.log(processLogs(logsResp, options));
84
+ const result = processLogs(logsResp, options);
85
+ if (result) {
86
+ uiLogger.log(result);
87
+ }
86
88
  }
@@ -0,0 +1,73 @@
1
+ export declare const uiMessages: {
2
+ betaTag: string;
3
+ deprecatedTag: string;
4
+ deprecatedDescription: (message: string, command: string, url?: string) => string;
5
+ disabledMessage: (command: string, url?: string) => string;
6
+ disabledUrlText: string;
7
+ commandRenamedMessage: (newCommand: string) => string;
8
+ featureHighlight: {
9
+ defaultTitle: string;
10
+ featureKeys: {
11
+ accountOption: {
12
+ command: string;
13
+ message: (command: string) => string;
14
+ };
15
+ accountsListCommand: {
16
+ command: string;
17
+ message: (command: string) => string;
18
+ };
19
+ accountsUseCommand: {
20
+ command: string;
21
+ message: (command: string) => string;
22
+ };
23
+ authCommand: {
24
+ command: string;
25
+ message: (command: string) => string;
26
+ };
27
+ feedbackCommand: {
28
+ command: string;
29
+ message: (command: string) => string;
30
+ };
31
+ getStartedCommand: {
32
+ command: string;
33
+ message: (command: string) => string;
34
+ };
35
+ helpCommand: {
36
+ command: string;
37
+ message: (command: string) => string;
38
+ };
39
+ projectCreateCommand: {
40
+ command: string;
41
+ message: (command: string) => string;
42
+ };
43
+ projectDeployCommand: {
44
+ command: string;
45
+ message: (command: string) => string;
46
+ };
47
+ projectHelpCommand: {
48
+ command: string;
49
+ message: (command: string) => string;
50
+ };
51
+ projectUploadCommand: {
52
+ command: string;
53
+ message: (command: string) => string;
54
+ };
55
+ projectDevCommand: {
56
+ command: string;
57
+ message: (command: string) => string;
58
+ };
59
+ projectInstallDepsCommand: {
60
+ command: string;
61
+ message: (command: string) => string;
62
+ };
63
+ projectCommandTip: {
64
+ message: string;
65
+ };
66
+ sampleProjects: {
67
+ linkText: string;
68
+ url: string;
69
+ message: (link: string) => string;
70
+ };
71
+ };
72
+ };
73
+ };
@@ -0,0 +1,76 @@
1
+ // UI messages for the UI module - separate file to avoid circular imports with lang/en.ts
2
+ // This contains the same strings that would be in lib.ui.* from lang/en.ts
3
+ import { uiCommandReference, uiLink } from './index.js';
4
+ export const uiMessages = {
5
+ betaTag: '[BETA]',
6
+ deprecatedTag: '[DEPRECATED]',
7
+ deprecatedDescription: (message, command, url) => `${message}. The ${uiCommandReference(command)} command is deprecated and will be disabled soon. ${url ? uiLink('Learn more', url) : ''}`,
8
+ disabledMessage: (command, url) => `The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('Learn more', url) : ''}`,
9
+ disabledUrlText: 'See all HubSpot CLI commands here.',
10
+ commandRenamedMessage: (newCommand) => `This command has been deprecated. Please use ${uiCommandReference(newCommand)} instead.`,
11
+ featureHighlight: {
12
+ defaultTitle: "What's next?",
13
+ featureKeys: {
14
+ accountOption: {
15
+ command: '--account',
16
+ message: (command) => `Use the ${command} option with any command to override the default account`,
17
+ },
18
+ accountsListCommand: {
19
+ command: 'hs accounts list',
20
+ message: (command) => `${command} - See a list of configured HubSpot accounts`,
21
+ },
22
+ accountsUseCommand: {
23
+ command: 'hs accounts use',
24
+ message: (command) => `${command} - Set the Hubspot account that the CLI will target by default`,
25
+ },
26
+ authCommand: {
27
+ command: 'hs auth',
28
+ message: (command) => `${command} - Connect the CLI to additional HubSpot accounts`,
29
+ },
30
+ feedbackCommand: {
31
+ command: 'hs feedback',
32
+ message: (command) => `${command} - Report a bug or leave feedback`,
33
+ },
34
+ getStartedCommand: {
35
+ command: 'hs get-started',
36
+ message: (command) => `${command} - Get started with HubSpot development`,
37
+ },
38
+ helpCommand: {
39
+ command: 'hs help',
40
+ message: (command) => `${command} - See a list of available commands`,
41
+ },
42
+ projectCreateCommand: {
43
+ command: 'hs project create',
44
+ message: (command) => `${command} - Create a new project`,
45
+ },
46
+ projectDeployCommand: {
47
+ command: 'hs project deploy',
48
+ message: (command) => `Ready to take your project live? Run ${command}`,
49
+ },
50
+ projectHelpCommand: {
51
+ command: 'hs project --help',
52
+ message: (command) => `${command} - Learn more about available project commands`,
53
+ },
54
+ projectUploadCommand: {
55
+ command: 'hs project upload',
56
+ message: (command) => `${command} - Upload your project to HubSpot and trigger builds`,
57
+ },
58
+ projectDevCommand: {
59
+ command: 'hs project dev',
60
+ message: (command) => `${command} - Set up a test environment and start local development`,
61
+ },
62
+ projectInstallDepsCommand: {
63
+ command: 'hs project install-deps',
64
+ message: (command) => `${command} - Install all project dependencies`,
65
+ },
66
+ projectCommandTip: {
67
+ message: 'Tip: All project commands must be run from within a project directory',
68
+ },
69
+ sampleProjects: {
70
+ linkText: "HubSpot's sample projects",
71
+ url: 'https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next',
72
+ message: (link) => `See ${link}`,
73
+ },
74
+ },
75
+ },
76
+ };
@@ -1,7 +1,7 @@
1
1
  import { trackUsage } from '@hubspot/local-dev-lib/trackUsage';
2
2
  import { isTrackingAllowed, getAccountConfig, } from '@hubspot/local-dev-lib/config';
3
3
  import { API_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
4
- import { logger } from '@hubspot/local-dev-lib/logger';
4
+ import { uiLogger } from './ui/logger.js';
5
5
  import packageJson from '../package.json' with { type: 'json' };
6
6
  const version = packageJson.version;
7
7
  import { debugError } from './errorHandlers/index.js';
@@ -31,7 +31,7 @@ export async function trackCommandUsage(command, meta = {}, accountId) {
31
31
  if (!isTrackingAllowed()) {
32
32
  return;
33
33
  }
34
- logger.debug('Attempting to track usage of "%s" command', command);
34
+ uiLogger.debug(`Attempting to track usage of "${command}" command`);
35
35
  let authType = 'unknown';
36
36
  if (accountId) {
37
37
  const accountConfig = getAccountConfig(accountId);
@@ -53,10 +53,10 @@ export async function trackHelpUsage(command) {
53
53
  return;
54
54
  }
55
55
  if (command) {
56
- logger.debug('Tracking help usage of "%s" sub-command', command);
56
+ uiLogger.debug(`Tracking help usage of "${command}" sub-command`);
57
57
  }
58
58
  else {
59
- logger.debug('Tracking help usage of main command');
59
+ uiLogger.debug('Tracking help usage of main command');
60
60
  }
61
61
  return trackCliInteraction({
62
62
  action: 'cli-help',
@@ -84,7 +84,7 @@ export async function trackCommandMetadataUsage(command, meta = {}, accountId) {
84
84
  if (!isTrackingAllowed()) {
85
85
  return;
86
86
  }
87
- logger.debug('Attempting to track metadata usage of "%s" command', command);
87
+ uiLogger.debug(`Attempting to track metadata usage of "${command}" command`);
88
88
  let authType = 'unknown';
89
89
  if (accountId) {
90
90
  const accountConfig = getAccountConfig(accountId);
@@ -122,7 +122,7 @@ async function trackCliInteraction({ action, accountId, command, authType, meta
122
122
  action: 'cli-mcp-server',
123
123
  type: process.env.HUBSPOT_MCP_AI_AGENT,
124
124
  }, accountId);
125
- logger.debug('Sent AI usage tracking command event: %o', {
125
+ uiLogger.debug('Sent AI usage tracking command event:', {
126
126
  ...usageTrackingEvent,
127
127
  action: 'cli-mcp-server',
128
128
  type: process.env.HUBSPOT_MCP_AI_AGENT,
@@ -133,7 +133,7 @@ async function trackCliInteraction({ action, accountId, command, authType, meta
133
133
  }
134
134
  }
135
135
  try {
136
- logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
136
+ uiLogger.debug('Sent usage tracking command event:', usageTrackingEvent);
137
137
  return trackUsage('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
138
138
  }
139
139
  catch (error) {
package/lib/validation.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
- import { logger } from '@hubspot/local-dev-lib/logger';
3
+ import { uiLogger } from '../lib/ui/logger.js';
4
4
  import { CMS_PUBLISH_MODE } from '@hubspot/local-dev-lib/constants/files';
5
5
  import { API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
6
6
  import { commaSeparatedValues } from '@hubspot/local-dev-lib/text';
@@ -10,43 +10,43 @@ import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personal
10
10
  import { getAbsoluteFilePath, getCwd, getExt, } from '@hubspot/local-dev-lib/path';
11
11
  import { getCmsPublishMode } from './commonOpts.js';
12
12
  import { logError } from './errorHandlers/index.js';
13
+ import { lib } from '../lang/en.js';
13
14
  export async function validateAccount(options) {
14
15
  const { derivedAccountId, userProvidedAccount } = options;
15
16
  const accountId = getAccountId(derivedAccountId);
16
17
  if (!accountId) {
17
18
  if (userProvidedAccount) {
18
- logger.error(`The account "${userProvidedAccount}" could not be found in the config`);
19
+ uiLogger.error(lib.validation.accountNotFoundInConfig(userProvidedAccount));
19
20
  }
20
21
  else {
21
- logger.error('An account needs to be supplied either via "--account" or through setting a "defaultPortal"');
22
+ uiLogger.error(lib.validation.accountRequired);
22
23
  }
23
24
  return false;
24
25
  }
25
26
  if (userProvidedAccount && loadConfigFromEnvironment()) {
26
- throw new Error('Cannot specify an account when environment variables are supplied. Please unset the environment variables or do not use the "--account" flag.');
27
+ throw new Error(lib.validation.userProvidedAccount);
27
28
  }
28
29
  const accountConfig = getAccountConfig(accountId);
29
30
  if (!accountConfig) {
30
- logger.error(`The account ${accountId} has not been configured`);
31
+ uiLogger.error(lib.validation.accountNotConfigured(accountId));
31
32
  return false;
32
33
  }
33
34
  const { authType, auth, apiKey, personalAccessKey } = accountConfig;
34
35
  if (typeof authType === 'string' && authType !== authType.toLowerCase()) {
35
- logger.error(`Invalid "authType" value "${authType}" for account "${accountId}" in config file: ${getConfigPath()}. Valid values are ${commaSeparatedValues([
36
+ uiLogger.error(lib.validation.invalidAuthType(authType, accountId, getConfigPath() || '', commaSeparatedValues([
36
37
  PERSONAL_ACCESS_KEY_AUTH_METHOD,
37
38
  OAUTH_AUTH_METHOD,
38
39
  API_KEY_AUTH_METHOD,
39
- ].map(method => method.value))}.`);
40
+ ].map(method => method.value))));
40
41
  }
41
42
  if (authType === 'oauth2') {
42
43
  if (typeof auth !== 'object') {
43
- logger.error(`The OAuth2 auth configuration for account ${accountId} is missing`);
44
+ uiLogger.error(lib.validation.oauth2ConfigMissing(accountId));
44
45
  return false;
45
46
  }
46
47
  const { clientId, clientSecret, tokenInfo } = auth;
47
48
  if (!clientId || !clientSecret || !tokenInfo || !tokenInfo.refreshToken) {
48
- logger.error(`The OAuth2 configuration for account ${accountId} is incorrect`);
49
- logger.error('Run "hs auth --type=oauth2" to reauthenticate');
49
+ uiLogger.error(lib.validation.oauth2ConfigIncorrect(accountId));
50
50
  return false;
51
51
  }
52
52
  const oauth = getOauthManager(accountId, accountConfig);
@@ -56,7 +56,7 @@ export async function validateAccount(options) {
56
56
  accessToken = await oauth.accessToken();
57
57
  }
58
58
  if (!accessToken) {
59
- logger.error(`The OAuth2 access token could not be found for accountId ${accountId}`);
59
+ uiLogger.error(lib.validation.oauth2AccessTokenNotFound(accountId));
60
60
  return false;
61
61
  }
62
62
  }
@@ -67,13 +67,13 @@ export async function validateAccount(options) {
67
67
  }
68
68
  else if (authType === 'personalaccesskey') {
69
69
  if (!personalAccessKey) {
70
- logger.error(`The account "${accountId}" is configured to use a access key for authentication and is missing a "personalAccessKey" in the configuration file`);
70
+ uiLogger.error(lib.validation.personalAccessKeyMissing(accountId));
71
71
  return false;
72
72
  }
73
73
  try {
74
74
  const accessToken = await accessTokenForPersonalAccessKey(accountId);
75
75
  if (!accessToken) {
76
- logger.error(`An OAuth2 access token for account "${accountId} could not be retrieved using the "personalAccessKey" provided`);
76
+ uiLogger.error(lib.validation.personalAccessKeyTokenRetrievalFailed(accountId));
77
77
  return false;
78
78
  }
79
79
  }
@@ -83,7 +83,7 @@ export async function validateAccount(options) {
83
83
  }
84
84
  }
85
85
  else if (!apiKey) {
86
- logger.error(`The accountId ${accountId} is missing authentication configuration`);
86
+ uiLogger.error(lib.validation.authConfigurationMissing(accountId));
87
87
  return false;
88
88
  }
89
89
  return true;
@@ -93,15 +93,12 @@ export function validateCmsPublishMode(options) {
93
93
  if (CMS_PUBLISH_MODE[cmsPublishMode]) {
94
94
  return true;
95
95
  }
96
- const modesMessage = `Available CMS publish modes are: ${Object.values(CMS_PUBLISH_MODE).join(', ')}.`;
96
+ const modesMessage = lib.validation.availableCMSModes(Object.values(CMS_PUBLISH_MODE).join(', '));
97
97
  if (cmsPublishMode != null) {
98
- logger.error([
99
- `The CMS publish mode "${cmsPublishMode}" is invalid.`,
100
- modesMessage,
101
- ].join(' '));
98
+ uiLogger.error(lib.validation.invalidCmsPublishMode(cmsPublishMode, modesMessage));
102
99
  }
103
100
  else {
104
- logger.error(['The CMS publish mode option is missing.', modesMessage].join(' '));
101
+ uiLogger.error(lib.validation.missingCmsPublishMode(modesMessage));
105
102
  }
106
103
  return false;
107
104
  }
@@ -124,11 +121,11 @@ export function fileExists(_path) {
124
121
  export function checkAndConvertToJson(_path) {
125
122
  const filePath = getAbsoluteFilePath(_path);
126
123
  if (!fileExists(filePath)) {
127
- logger.error(`The path "${_path}" is not a path to a file`);
124
+ uiLogger.error(lib.validation.pathNotFile(_path));
128
125
  return null;
129
126
  }
130
127
  if (getExt(_path) !== 'json') {
131
- logger.error(`The file "${_path}" must be a valid JSON file`);
128
+ uiLogger.error(lib.validation.fileNotJson(_path));
132
129
  return null;
133
130
  }
134
131
  let result;
@@ -136,7 +133,7 @@ export function checkAndConvertToJson(_path) {
136
133
  result = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
137
134
  }
138
135
  catch (e) {
139
- logger.error(`The file "${_path}" contains invalid JSON`);
136
+ uiLogger.error(lib.validation.fileInvalidJson(_path));
140
137
  result = null;
141
138
  }
142
139
  return result;
@@ -13,4 +13,4 @@ export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>,
13
13
  };
14
14
  useJSONOutputOptions?: boolean;
15
15
  }): (yargs: Argv) => Promise<Argv<T>>;
16
- export declare function getExclusiveConflicts(options: string[]): Record<string, string[]>;
16
+ export declare function strictEnforceBoolean(rawArgs: string[], booleanOptions: string[]): boolean;
package/lib/yargsUtils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { addCustomHelpOutput, addTestingOptions, addAccountOptions, addConfigOptions, addGlobalOptions, addUseEnvironmentOptions, addCmsPublishModeOptions, addJSONOutputOptions, } from './commonOpts.js';
2
2
  import { hasFlag } from './utils/hasFlag.js';
3
+ import { commands } from '../lang/en.js';
3
4
  // Re-export for backwards compatibility
4
5
  export { hasFlag };
5
6
  export function makeYargsBuilder(callback, command, describe, options = {}) {
@@ -34,9 +35,15 @@ export function makeYargsBuilder(callback, command, describe, options = {}) {
34
35
  return result;
35
36
  };
36
37
  }
37
- export function getExclusiveConflicts(options) {
38
- return options.reduce((acc, curr) => {
39
- acc[curr] = options.filter(s => s !== curr);
40
- return acc;
41
- }, {});
38
+ export function strictEnforceBoolean(rawArgs, booleanOptions) {
39
+ for (const option of booleanOptions) {
40
+ const argIndex = rawArgs.findIndex(arg => arg.startsWith(`--${option}=`));
41
+ if (argIndex !== -1) {
42
+ const value = rawArgs[argIndex].split('=')[1];
43
+ if (value && !['true', 'false'].includes(value.toLowerCase())) {
44
+ throw new Error(commands.config.subcommands.set.errors.invalidBoolean(option, value));
45
+ }
46
+ }
47
+ }
48
+ return true;
42
49
  }
@@ -13,20 +13,20 @@ declare const inputSchemaZodObject: z.ZodObject<{
13
13
  }, "strip", z.ZodTypeAny, {
14
14
  absoluteCurrentWorkingDirectory: string;
15
15
  dest?: string | undefined;
16
- global?: boolean | undefined;
17
16
  moduleLabel?: string | undefined;
18
17
  reactType?: boolean | undefined;
19
- contentTypes?: string | undefined;
18
+ global?: boolean | undefined;
20
19
  availableForNewContent?: boolean | undefined;
20
+ contentTypes?: string | undefined;
21
21
  userSuppliedName?: string | undefined;
22
22
  }, {
23
23
  absoluteCurrentWorkingDirectory: string;
24
24
  dest?: string | undefined;
25
- global?: boolean | undefined;
26
25
  moduleLabel?: string | undefined;
27
26
  reactType?: boolean | undefined;
28
- contentTypes?: string | undefined;
27
+ global?: boolean | undefined;
29
28
  availableForNewContent?: boolean | undefined;
29
+ contentTypes?: string | undefined;
30
30
  userSuppliedName?: string | undefined;
31
31
  }>;
32
32
  export type HsCreateModuleInputSchema = z.infer<typeof inputSchemaZodObject>;
@@ -7,6 +7,8 @@ import { ValidateProjectTool } from './project/ValidateProjectTool.js';
7
7
  import { GetConfigValuesTool } from './project/GetConfigValuesTool.js';
8
8
  import { DocsSearchTool } from './project/DocsSearchTool.js';
9
9
  import { DocFetchTool } from './project/DocFetchTool.js';
10
+ import { GetApiUsagePatternsByAppIdTool } from './project/GetApiUsagePatternsByAppIdTool.js';
11
+ import { GetApplicationInfoTool } from './project/GetApplicationInfoTool.js';
10
12
  import { HsListTool } from './cms/HsListTool.js';
11
13
  import { HsCreateModuleTool } from './cms/HsCreateModuleTool.js';
12
14
  import { HsCreateTemplateTool } from './cms/HsCreateTemplateTool.js';
@@ -24,6 +26,8 @@ export function registerProjectTools(mcpServer) {
24
26
  new GetConfigValuesTool(mcpServer).register(),
25
27
  new DocsSearchTool(mcpServer).register(),
26
28
  new DocFetchTool(mcpServer).register(),
29
+ new GetApiUsagePatternsByAppIdTool(mcpServer).register(),
30
+ new GetApplicationInfoTool(mcpServer).register(),
27
31
  ];
28
32
  }
29
33
  export function registerCmsTools(mcpServer) {
@@ -0,0 +1,23 @@
1
+ import { TextContentResponse, Tool } from '../../types.js';
2
+ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { z } from 'zod';
4
+ declare const inputSchemaZodObject: z.ZodObject<{
5
+ appId: z.ZodString;
6
+ startDate: z.ZodOptional<z.ZodString>;
7
+ endDate: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ appId: string;
10
+ startDate?: string | undefined;
11
+ endDate?: string | undefined;
12
+ }, {
13
+ appId: string;
14
+ startDate?: string | undefined;
15
+ endDate?: string | undefined;
16
+ }>;
17
+ export type GetApiUsagePatternsByAppIdInputSchema = z.infer<typeof inputSchemaZodObject>;
18
+ export declare class GetApiUsagePatternsByAppIdTool extends Tool<GetApiUsagePatternsByAppIdInputSchema> {
19
+ constructor(mcpServer: McpServer);
20
+ handler({ appId, startDate, endDate, }: GetApiUsagePatternsByAppIdInputSchema): Promise<TextContentResponse>;
21
+ register(): RegisteredTool;
22
+ }
23
+ export {};