@hubspot/cli 8.0.10-experimental.5 → 8.0.10-experimental.7

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 (368) hide show
  1. package/commands/getStarted.js +1 -1
  2. package/lang/en.js +1 -1
  3. package/lib/app/migrate.js +10 -5
  4. package/lib/getStartedV2Actions.js +1 -1
  5. package/lib/projects/components.js +3 -2
  6. package/lib/projects/create/v2.js +1 -1
  7. package/lib/ui/SpinniesManager.js +2 -0
  8. package/package.json +6 -2
  9. package/api/__tests__/migrate.test.d.ts +0 -1
  10. package/api/__tests__/migrate.test.js +0 -199
  11. package/commands/__tests__/account.test.d.ts +0 -1
  12. package/commands/__tests__/account.test.js +0 -69
  13. package/commands/__tests__/auth.test.d.ts +0 -1
  14. package/commands/__tests__/auth.test.js +0 -43
  15. package/commands/__tests__/cms.test.d.ts +0 -1
  16. package/commands/__tests__/cms.test.js +0 -87
  17. package/commands/__tests__/config.test.d.ts +0 -1
  18. package/commands/__tests__/config.test.js +0 -44
  19. package/commands/__tests__/customObject.test.d.ts +0 -1
  20. package/commands/__tests__/customObject.test.js +0 -68
  21. package/commands/__tests__/doctor.test.d.ts +0 -1
  22. package/commands/__tests__/doctor.test.js +0 -132
  23. package/commands/__tests__/feedback.test.d.ts +0 -1
  24. package/commands/__tests__/feedback.test.js +0 -24
  25. package/commands/__tests__/filemanager.test.d.ts +0 -1
  26. package/commands/__tests__/filemanager.test.js +0 -45
  27. package/commands/__tests__/getStarted.test.d.ts +0 -1
  28. package/commands/__tests__/getStarted.test.js +0 -173
  29. package/commands/__tests__/hubdb.test.d.ts +0 -1
  30. package/commands/__tests__/hubdb.test.js +0 -50
  31. package/commands/__tests__/init.test.d.ts +0 -1
  32. package/commands/__tests__/init.test.js +0 -42
  33. package/commands/__tests__/mcp.test.d.ts +0 -1
  34. package/commands/__tests__/mcp.test.js +0 -46
  35. package/commands/__tests__/open.test.d.ts +0 -1
  36. package/commands/__tests__/open.test.js +0 -58
  37. package/commands/__tests__/project.test.d.ts +0 -1
  38. package/commands/__tests__/project.test.js +0 -125
  39. package/commands/__tests__/sandbox.test.d.ts +0 -1
  40. package/commands/__tests__/sandbox.test.js +0 -44
  41. package/commands/__tests__/secret.test.d.ts +0 -1
  42. package/commands/__tests__/secret.test.js +0 -49
  43. package/commands/__tests__/testAccount.test.d.ts +0 -1
  44. package/commands/__tests__/testAccount.test.js +0 -57
  45. package/commands/__tests__/upgrade.test.d.ts +0 -1
  46. package/commands/__tests__/upgrade.test.js +0 -309
  47. package/commands/account/__tests__/auth.test.d.ts +0 -1
  48. package/commands/account/__tests__/auth.test.js +0 -206
  49. package/commands/account/__tests__/clean.test.d.ts +0 -1
  50. package/commands/account/__tests__/clean.test.js +0 -28
  51. package/commands/account/__tests__/createOverride.test.d.ts +0 -1
  52. package/commands/account/__tests__/createOverride.test.js +0 -32
  53. package/commands/account/__tests__/info.test.d.ts +0 -1
  54. package/commands/account/__tests__/info.test.js +0 -28
  55. package/commands/account/__tests__/list.test.d.ts +0 -1
  56. package/commands/account/__tests__/list.test.js +0 -153
  57. package/commands/account/__tests__/remove.test.d.ts +0 -1
  58. package/commands/account/__tests__/remove.test.js +0 -36
  59. package/commands/account/__tests__/removeOverride.d.ts +0 -1
  60. package/commands/account/__tests__/removeOverride.js +0 -25
  61. package/commands/account/__tests__/rename.test.d.ts +0 -1
  62. package/commands/account/__tests__/rename.test.js +0 -82
  63. package/commands/account/__tests__/use.test.d.ts +0 -1
  64. package/commands/account/__tests__/use.test.js +0 -170
  65. package/commands/app/__tests__/migrate.test.d.ts +0 -1
  66. package/commands/app/__tests__/migrate.test.js +0 -111
  67. package/commands/app/secret/__tests__/add.test.d.ts +0 -1
  68. package/commands/app/secret/__tests__/add.test.js +0 -140
  69. package/commands/app/secret/__tests__/delete.test.d.ts +0 -1
  70. package/commands/app/secret/__tests__/delete.test.js +0 -28
  71. package/commands/app/secret/__tests__/list.test.d.ts +0 -1
  72. package/commands/app/secret/__tests__/list.test.js +0 -25
  73. package/commands/app/secret/__tests__/update.test.d.ts +0 -1
  74. package/commands/app/secret/__tests__/update.test.js +0 -28
  75. package/commands/cms/__tests__/delete.test.d.ts +0 -1
  76. package/commands/cms/__tests__/delete.test.js +0 -39
  77. package/commands/cms/__tests__/fetch.test.d.ts +0 -1
  78. package/commands/cms/__tests__/fetch.test.js +0 -156
  79. package/commands/cms/__tests__/function.test.d.ts +0 -1
  80. package/commands/cms/__tests__/function.test.js +0 -50
  81. package/commands/cms/__tests__/lint.test.d.ts +0 -1
  82. package/commands/cms/__tests__/lint.test.js +0 -33
  83. package/commands/cms/__tests__/list.test.d.ts +0 -1
  84. package/commands/cms/__tests__/list.test.js +0 -42
  85. package/commands/cms/__tests__/module.test.d.ts +0 -1
  86. package/commands/cms/__tests__/module.test.js +0 -45
  87. package/commands/cms/__tests__/mv.test.d.ts +0 -1
  88. package/commands/cms/__tests__/mv.test.js +0 -46
  89. package/commands/cms/__tests__/theme.test.d.ts +0 -1
  90. package/commands/cms/__tests__/theme.test.js +0 -54
  91. package/commands/cms/__tests__/upload.test.d.ts +0 -1
  92. package/commands/cms/__tests__/upload.test.js +0 -312
  93. package/commands/cms/__tests__/watch.test.d.ts +0 -1
  94. package/commands/cms/__tests__/watch.test.js +0 -204
  95. package/commands/cms/function/__tests__/logs.test.d.ts +0 -1
  96. package/commands/cms/function/__tests__/logs.test.js +0 -70
  97. package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +0 -1
  98. package/commands/cms/theme/__tests__/generate-selectors.test.js +0 -28
  99. package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +0 -1
  100. package/commands/cms/theme/__tests__/marketplace-validate.test.js +0 -36
  101. package/commands/cms/theme/__tests__/preview.test.d.ts +0 -1
  102. package/commands/cms/theme/__tests__/preview.test.js +0 -54
  103. package/commands/customObject/__tests__/create.test.d.ts +0 -1
  104. package/commands/customObject/__tests__/create.test.js +0 -40
  105. package/commands/customObject/__tests__/createSchema.test.d.ts +0 -1
  106. package/commands/customObject/__tests__/createSchema.test.js +0 -28
  107. package/commands/customObject/__tests__/deleteSchema.test.d.ts +0 -1
  108. package/commands/customObject/__tests__/deleteSchema.test.js +0 -42
  109. package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +0 -1
  110. package/commands/customObject/__tests__/fetch-all-schemas.test.js +0 -41
  111. package/commands/customObject/__tests__/fetchSchema.test.d.ts +0 -1
  112. package/commands/customObject/__tests__/fetchSchema.test.js +0 -45
  113. package/commands/customObject/__tests__/listSchemas.test.d.ts +0 -1
  114. package/commands/customObject/__tests__/listSchemas.test.js +0 -29
  115. package/commands/customObject/__tests__/updateSchema.test.d.ts +0 -1
  116. package/commands/customObject/__tests__/updateSchema.test.js +0 -40
  117. package/commands/filemanager/__tests__/fetch.test.d.ts +0 -1
  118. package/commands/filemanager/__tests__/fetch.test.js +0 -32
  119. package/commands/filemanager/__tests__/upload.test.d.ts +0 -1
  120. package/commands/filemanager/__tests__/upload.test.js +0 -191
  121. package/commands/hubdb/__tests__/clear.test.d.ts +0 -1
  122. package/commands/hubdb/__tests__/clear.test.js +0 -28
  123. package/commands/hubdb/__tests__/create.test.d.ts +0 -1
  124. package/commands/hubdb/__tests__/create.test.js +0 -28
  125. package/commands/hubdb/__tests__/delete.test.d.ts +0 -1
  126. package/commands/hubdb/__tests__/delete.test.js +0 -28
  127. package/commands/hubdb/__tests__/fetch.test.d.ts +0 -1
  128. package/commands/hubdb/__tests__/fetch.test.js +0 -28
  129. package/commands/hubdb/__tests__/list.test.d.ts +0 -1
  130. package/commands/hubdb/__tests__/list.test.js +0 -88
  131. package/commands/mcp/__tests__/setup.test.d.ts +0 -1
  132. package/commands/mcp/__tests__/setup.test.js +0 -26
  133. package/commands/mcp/__tests__/start.test.d.ts +0 -1
  134. package/commands/mcp/__tests__/start.test.js +0 -144
  135. package/commands/project/__tests__/add.test.d.ts +0 -1
  136. package/commands/project/__tests__/add.test.js +0 -107
  137. package/commands/project/__tests__/create.test.d.ts +0 -1
  138. package/commands/project/__tests__/create.test.js +0 -97
  139. package/commands/project/__tests__/deploy.test.d.ts +0 -1
  140. package/commands/project/__tests__/deploy.test.js +0 -307
  141. package/commands/project/__tests__/dev.test.d.ts +0 -1
  142. package/commands/project/__tests__/dev.test.js +0 -273
  143. package/commands/project/__tests__/devUnifiedFlow.test.d.ts +0 -1
  144. package/commands/project/__tests__/devUnifiedFlow.test.js +0 -434
  145. package/commands/project/__tests__/download.test.d.ts +0 -1
  146. package/commands/project/__tests__/download.test.js +0 -39
  147. package/commands/project/__tests__/installDeps.test.d.ts +0 -1
  148. package/commands/project/__tests__/installDeps.test.js +0 -140
  149. package/commands/project/__tests__/lint.test.d.ts +0 -1
  150. package/commands/project/__tests__/lint.test.js +0 -704
  151. package/commands/project/__tests__/list.test.d.ts +0 -1
  152. package/commands/project/__tests__/list.test.js +0 -31
  153. package/commands/project/__tests__/listBuilds.test.d.ts +0 -1
  154. package/commands/project/__tests__/listBuilds.test.js +0 -38
  155. package/commands/project/__tests__/logs.test.d.ts +0 -1
  156. package/commands/project/__tests__/logs.test.js +0 -202
  157. package/commands/project/__tests__/migrate.test.d.ts +0 -1
  158. package/commands/project/__tests__/migrate.test.js +0 -106
  159. package/commands/project/__tests__/open.test.d.ts +0 -1
  160. package/commands/project/__tests__/open.test.js +0 -39
  161. package/commands/project/__tests__/profile.test.d.ts +0 -1
  162. package/commands/project/__tests__/profile.test.js +0 -42
  163. package/commands/project/__tests__/updateDeps.test.d.ts +0 -1
  164. package/commands/project/__tests__/updateDeps.test.js +0 -140
  165. package/commands/project/__tests__/upload.test.d.ts +0 -1
  166. package/commands/project/__tests__/upload.test.js +0 -234
  167. package/commands/project/__tests__/validate.test.d.ts +0 -1
  168. package/commands/project/__tests__/validate.test.js +0 -381
  169. package/commands/project/__tests__/watch.test.d.ts +0 -1
  170. package/commands/project/__tests__/watch.test.js +0 -35
  171. package/commands/sandbox/__tests__/create.test.d.ts +0 -1
  172. package/commands/sandbox/__tests__/create.test.js +0 -198
  173. package/commands/sandbox/__tests__/delete.test.d.ts +0 -1
  174. package/commands/sandbox/__tests__/delete.test.js +0 -31
  175. package/commands/secret/__tests__/addSecret.test.d.ts +0 -1
  176. package/commands/secret/__tests__/addSecret.test.js +0 -162
  177. package/commands/secret/__tests__/deleteSecret.test.d.ts +0 -1
  178. package/commands/secret/__tests__/deleteSecret.test.js +0 -41
  179. package/commands/secret/__tests__/listSecret.test.d.ts +0 -1
  180. package/commands/secret/__tests__/listSecret.test.js +0 -29
  181. package/commands/secret/__tests__/updateSecret.test.d.ts +0 -1
  182. package/commands/secret/__tests__/updateSecret.test.js +0 -29
  183. package/commands/testAccount/__tests__/create.test.d.ts +0 -1
  184. package/commands/testAccount/__tests__/create.test.js +0 -106
  185. package/commands/testAccount/__tests__/createConfig.test.d.ts +0 -1
  186. package/commands/testAccount/__tests__/createConfig.test.js +0 -32
  187. package/commands/testAccount/__tests__/delete.test.d.ts +0 -1
  188. package/commands/testAccount/__tests__/delete.test.js +0 -29
  189. package/commands/testAccount/__tests__/importData.test.d.ts +0 -1
  190. package/commands/testAccount/__tests__/importData.test.js +0 -92
  191. package/lib/__tests__/CLIWebSocketServer.test.d.ts +0 -1
  192. package/lib/__tests__/CLIWebSocketServer.test.js +0 -252
  193. package/lib/__tests__/accountAuth.test.d.ts +0 -1
  194. package/lib/__tests__/accountAuth.test.js +0 -258
  195. package/lib/__tests__/accountTypes.test.d.ts +0 -1
  196. package/lib/__tests__/accountTypes.test.js +0 -98
  197. package/lib/__tests__/buildAccount.test.d.ts +0 -1
  198. package/lib/__tests__/buildAccount.test.js +0 -211
  199. package/lib/__tests__/cliUpgradeUtils.test.d.ts +0 -1
  200. package/lib/__tests__/cliUpgradeUtils.test.js +0 -131
  201. package/lib/__tests__/commandSuggestion.test.d.ts +0 -1
  202. package/lib/__tests__/commandSuggestion.test.js +0 -121
  203. package/lib/__tests__/commonOpts.test.d.ts +0 -1
  204. package/lib/__tests__/commonOpts.test.js +0 -80
  205. package/lib/__tests__/dependencyManagement.test.d.ts +0 -1
  206. package/lib/__tests__/dependencyManagement.test.js +0 -1067
  207. package/lib/__tests__/developerTestAccounts.test.d.ts +0 -1
  208. package/lib/__tests__/developerTestAccounts.test.js +0 -156
  209. package/lib/__tests__/hasFeature.test.d.ts +0 -1
  210. package/lib/__tests__/hasFeature.test.js +0 -167
  211. package/lib/__tests__/http.test.d.ts +0 -1
  212. package/lib/__tests__/http.test.js +0 -40
  213. package/lib/__tests__/importData.test.d.ts +0 -1
  214. package/lib/__tests__/importData.test.js +0 -98
  215. package/lib/__tests__/npmCli.test.d.ts +0 -1
  216. package/lib/__tests__/npmCli.test.js +0 -84
  217. package/lib/__tests__/oauth.test.d.ts +0 -1
  218. package/lib/__tests__/oauth.test.js +0 -109
  219. package/lib/__tests__/parsing.test.d.ts +0 -1
  220. package/lib/__tests__/parsing.test.js +0 -34
  221. package/lib/__tests__/polling.test.d.ts +0 -1
  222. package/lib/__tests__/polling.test.js +0 -76
  223. package/lib/__tests__/process.test.d.ts +0 -1
  224. package/lib/__tests__/process.test.js +0 -89
  225. package/lib/__tests__/sandboxes.test.d.ts +0 -1
  226. package/lib/__tests__/sandboxes.test.js +0 -128
  227. package/lib/__tests__/serverlessLogs.test.d.ts +0 -1
  228. package/lib/__tests__/serverlessLogs.test.js +0 -163
  229. package/lib/__tests__/usageTracking.test.d.ts +0 -1
  230. package/lib/__tests__/usageTracking.test.js +0 -197
  231. package/lib/__tests__/validation.test.d.ts +0 -1
  232. package/lib/__tests__/validation.test.js +0 -143
  233. package/lib/__tests__/yargsUtils.test.d.ts +0 -1
  234. package/lib/__tests__/yargsUtils.test.js +0 -124
  235. package/lib/app/__tests__/migrate.test.d.ts +0 -1
  236. package/lib/app/__tests__/migrate.test.js +0 -638
  237. package/lib/doctor/__tests__/Diagnosis.test.d.ts +0 -1
  238. package/lib/doctor/__tests__/Diagnosis.test.js +0 -84
  239. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +0 -1
  240. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +0 -177
  241. package/lib/doctor/__tests__/Doctor.test.d.ts +0 -1
  242. package/lib/doctor/__tests__/Doctor.test.js +0 -560
  243. package/lib/errorHandlers/__tests__/index.test.d.ts +0 -1
  244. package/lib/errorHandlers/__tests__/index.test.js +0 -278
  245. package/lib/mcp/__tests__/setup.test.d.ts +0 -1
  246. package/lib/mcp/__tests__/setup.test.js +0 -523
  247. package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +0 -1
  248. package/lib/middleware/__tests__/commandTargetingUtils.test.js +0 -99
  249. package/lib/middleware/__tests__/configMiddleware.test.d.ts +0 -1
  250. package/lib/middleware/__tests__/configMiddleware.test.js +0 -118
  251. package/lib/middleware/__tests__/gitMiddleware.test.d.ts +0 -1
  252. package/lib/middleware/__tests__/gitMiddleware.test.js +0 -43
  253. package/lib/middleware/__tests__/requestMiddleware.test.d.ts +0 -1
  254. package/lib/middleware/__tests__/requestMiddleware.test.js +0 -15
  255. package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +0 -1
  256. package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +0 -44
  257. package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +0 -1
  258. package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -39
  259. package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +0 -1
  260. package/lib/projects/__tests__/AppDevModeInterface.test.js +0 -541
  261. package/lib/projects/__tests__/DevServerManager.test.d.ts +0 -1
  262. package/lib/projects/__tests__/DevServerManager.test.js +0 -185
  263. package/lib/projects/__tests__/DevSessionManager.test.d.ts +0 -1
  264. package/lib/projects/__tests__/DevSessionManager.test.js +0 -250
  265. package/lib/projects/__tests__/LocalDevProcess.test.d.ts +0 -1
  266. package/lib/projects/__tests__/LocalDevProcess.test.js +0 -481
  267. package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +0 -1
  268. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -231
  269. package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +0 -1
  270. package/lib/projects/__tests__/ProjectLogsManager.test.js +0 -302
  271. package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +0 -1
  272. package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -160
  273. package/lib/projects/__tests__/components.test.d.ts +0 -1
  274. package/lib/projects/__tests__/components.test.js +0 -440
  275. package/lib/projects/__tests__/deploy.test.d.ts +0 -1
  276. package/lib/projects/__tests__/deploy.test.js +0 -231
  277. package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +0 -1
  278. package/lib/projects/__tests__/localDevProjectHelpers.test.js +0 -120
  279. package/lib/projects/__tests__/platformVersion.test.d.ts +0 -1
  280. package/lib/projects/__tests__/platformVersion.test.js +0 -63
  281. package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +0 -1
  282. package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +0 -328
  283. package/lib/projects/__tests__/projectProfiles.test.d.ts +0 -1
  284. package/lib/projects/__tests__/projectProfiles.test.js +0 -441
  285. package/lib/projects/__tests__/projects.test.d.ts +0 -1
  286. package/lib/projects/__tests__/projects.test.js +0 -58
  287. package/lib/projects/__tests__/structure.test.d.ts +0 -1
  288. package/lib/projects/__tests__/structure.test.js +0 -210
  289. package/lib/projects/__tests__/uieLinting.test.d.ts +0 -1
  290. package/lib/projects/__tests__/uieLinting.test.js +0 -631
  291. package/lib/projects/__tests__/upload.test.d.ts +0 -1
  292. package/lib/projects/__tests__/upload.test.js +0 -183
  293. package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +0 -1
  294. package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -245
  295. package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +0 -1
  296. package/lib/projects/add/__tests__/v2AddComponent.test.js +0 -343
  297. package/lib/projects/create/__tests__/legacy.test.d.ts +0 -1
  298. package/lib/projects/create/__tests__/legacy.test.js +0 -72
  299. package/lib/projects/create/__tests__/v2.test.d.ts +0 -1
  300. package/lib/projects/create/__tests__/v2.test.js +0 -257
  301. package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +0 -1
  302. package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +0 -157
  303. package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +0 -1
  304. package/lib/prompts/__tests__/createFunctionPrompt.test.js +0 -129
  305. package/lib/prompts/__tests__/createModulePrompt.test.d.ts +0 -1
  306. package/lib/prompts/__tests__/createModulePrompt.test.js +0 -187
  307. package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +0 -1
  308. package/lib/prompts/__tests__/createTemplatePrompt.test.js +0 -102
  309. package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +0 -1
  310. package/lib/prompts/__tests__/downloadProjectPrompt.test.js +0 -31
  311. package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +0 -1
  312. package/lib/prompts/__tests__/projectAddPrompt.test.js +0 -143
  313. package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +0 -1
  314. package/lib/prompts/__tests__/projectsLogsPrompt.test.js +0 -37
  315. package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +0 -1
  316. package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +0 -160
  317. package/lib/theme/__tests__/migrate.test.d.ts +0 -1
  318. package/lib/theme/__tests__/migrate.test.js +0 -247
  319. package/lib/ui/__tests__/SpinniesManager.test.d.ts +0 -1
  320. package/lib/ui/__tests__/SpinniesManager.test.js +0 -488
  321. package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +0 -1
  322. package/lib/ui/__tests__/removeAnsiCodes.test.js +0 -84
  323. package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +0 -1
  324. package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +0 -254
  325. package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +0 -1
  326. package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +0 -227
  327. package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +0 -1
  328. package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +0 -208
  329. package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +0 -1
  330. package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +0 -186
  331. package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +0 -1
  332. package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +0 -124
  333. package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +0 -1
  334. package/mcp-server/tools/cms/__tests__/HsListTool.test.js +0 -124
  335. package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +0 -1
  336. package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +0 -157
  337. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +0 -1
  338. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -131
  339. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +0 -1
  340. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +0 -461
  341. package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +0 -1
  342. package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +0 -125
  343. package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +0 -1
  344. package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -125
  345. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +0 -1
  346. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +0 -210
  347. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +0 -1
  348. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -146
  349. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +0 -1
  350. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +0 -124
  351. package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +0 -1
  352. package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +0 -307
  353. package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +0 -1
  354. package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +0 -242
  355. package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +0 -1
  356. package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +0 -209
  357. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +0 -1
  358. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +0 -158
  359. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +0 -1
  360. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +0 -187
  361. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +0 -1
  362. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +0 -118
  363. package/mcp-server/utils/__tests__/command.test.d.ts +0 -1
  364. package/mcp-server/utils/__tests__/command.test.js +0 -275
  365. package/mcp-server/utils/__tests__/content.test.d.ts +0 -1
  366. package/mcp-server/utils/__tests__/content.test.js +0 -164
  367. package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +0 -1
  368. package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -69
@@ -1,125 +0,0 @@
1
- import { DocFetchTool } from '../DocFetchTool.js';
2
- import { http } from '@hubspot/local-dev-lib/http/unauthed';
3
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
4
- import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
5
- import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
6
- vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
7
- vi.mock('@hubspot/local-dev-lib/http/unauthed');
8
- vi.mock('@hubspot/local-dev-lib/errors/index');
9
- vi.mock('@hubspot/local-dev-lib/config');
10
- vi.mock('../../../utils/toolUsageTracking');
11
- vi.mock('../../../utils/feedbackTracking');
12
- const mockMcpFeedbackRequest = mcpFeedbackRequest;
13
- const mockTrackToolUsage = trackToolUsage;
14
- const mockHttp = http;
15
- const mockIsHubSpotHttpError = vi.mocked(isHubSpotHttpError);
16
- describe('mcp-server/tools/project/DocFetchTool', () => {
17
- let mockMcpServer;
18
- let tool;
19
- let mockRegisteredTool;
20
- beforeEach(() => {
21
- // @ts-expect-error Not mocking whole server
22
- mockMcpServer = {
23
- registerTool: vi.fn(),
24
- };
25
- mockRegisteredTool = {};
26
- mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
27
- mockMcpFeedbackRequest.mockResolvedValue('');
28
- mockTrackToolUsage.mockResolvedValue(undefined);
29
- tool = new DocFetchTool(mockMcpServer);
30
- });
31
- describe('register', () => {
32
- it('should register tool with correct parameters', () => {
33
- const result = tool.register();
34
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('fetch-doc', expect.objectContaining({
35
- title: 'Fetch HubSpot Developer Documentation (single file)',
36
- description: expect.stringContaining('Always use this immediately after `search-docs`'),
37
- inputSchema: expect.any(Object),
38
- }), expect.any(Function));
39
- expect(result).toBe(mockRegisteredTool);
40
- });
41
- });
42
- describe('handler', () => {
43
- const mockInput = {
44
- absoluteCurrentWorkingDirectory: '/test/dir',
45
- docUrl: 'https://example.com/docs/test-doc',
46
- };
47
- it('should successfully fetch and return markdown content', async () => {
48
- const mockContent = '# Test Document\n\nThis is a test markdown document.';
49
- // @ts-expect-error - Mocking axios response structure
50
- mockHttp.get.mockResolvedValue({
51
- data: mockContent,
52
- });
53
- const result = await tool.handler(mockInput);
54
- expect(mockHttp.get).toHaveBeenCalledWith({
55
- url: 'https://example.com/docs/test-doc.md',
56
- });
57
- expect(result).toEqual({
58
- content: [
59
- {
60
- type: 'text',
61
- text: mockContent,
62
- },
63
- ],
64
- });
65
- });
66
- it('should handle HubSpot HTTP errors', async () => {
67
- const mockError = {
68
- toString: () => 'HubSpotHttpError: \n- message: The request was not found.\n- status: 404\n- statusText: Not Found\n- method: get\n- code: ERR_BAD_REQUEST\n- derivedContext: {\n "request": "https://example.com/docs/test-doc.md"\n}',
69
- };
70
- mockHttp.get.mockRejectedValue(mockError);
71
- mockIsHubSpotHttpError.mockReturnValue(true);
72
- const result = await tool.handler(mockInput);
73
- expect(result).toEqual({
74
- content: [
75
- {
76
- type: 'text',
77
- text: 'HubSpotHttpError: \n- message: The request was not found.\n- status: 404\n- statusText: Not Found\n- method: get\n- code: ERR_BAD_REQUEST\n- derivedContext: {\n "request": "https://example.com/docs/test-doc.md"\n}',
78
- },
79
- ],
80
- });
81
- });
82
- it('should handle empty content', async () => {
83
- // @ts-expect-error - Mocking axios response structure
84
- mockHttp.get.mockResolvedValue({
85
- data: ' ',
86
- });
87
- const result = await tool.handler(mockInput);
88
- expect(result).toEqual({
89
- content: [
90
- {
91
- type: 'text',
92
- text: 'Document is empty or contains no content.',
93
- },
94
- ],
95
- });
96
- });
97
- it('should handle generic errors', async () => {
98
- const mockError = new Error('Network error');
99
- mockHttp.get.mockRejectedValue(mockError);
100
- mockIsHubSpotHttpError.mockReturnValue(false);
101
- const result = await tool.handler(mockInput);
102
- expect(result).toEqual({
103
- content: [
104
- {
105
- type: 'text',
106
- text: 'Error fetching documentation: Network error',
107
- },
108
- ],
109
- });
110
- });
111
- it('should handle non-Error rejections', async () => {
112
- mockHttp.get.mockRejectedValue('String error');
113
- mockIsHubSpotHttpError.mockReturnValue(false);
114
- const result = await tool.handler(mockInput);
115
- expect(result).toEqual({
116
- content: [
117
- {
118
- type: 'text',
119
- text: 'Error fetching documentation: String error',
120
- },
121
- ],
122
- });
123
- });
124
- });
125
- });
@@ -1,210 +0,0 @@
1
- import { DocsSearchTool } from '../DocsSearchTool.js';
2
- import { http } from '@hubspot/local-dev-lib/http';
3
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
4
- import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
5
- import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
6
- import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
7
- vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
8
- vi.mock('@hubspot/local-dev-lib/http');
9
- vi.mock('@hubspot/local-dev-lib/errors/index');
10
- vi.mock('@hubspot/local-dev-lib/config');
11
- vi.mock('../../../utils/toolUsageTracking');
12
- vi.mock('../../../utils/feedbackTracking');
13
- const mockTrackToolUsage = trackToolUsage;
14
- const mockMcpFeedbackRequest = mcpFeedbackRequest;
15
- const mockHttp = http;
16
- const mockIsHubSpotHttpError = vi.mocked(isHubSpotHttpError);
17
- const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
18
- describe('mcp-server/tools/project/DocsSearchTool', () => {
19
- let mockMcpServer;
20
- let tool;
21
- let mockRegisteredTool;
22
- beforeEach(() => {
23
- // @ts-expect-error Not mocking whole server
24
- mockMcpServer = {
25
- registerTool: vi.fn(),
26
- };
27
- mockRegisteredTool = {};
28
- mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
29
- mockMcpFeedbackRequest.mockResolvedValue('');
30
- mockTrackToolUsage.mockResolvedValue(undefined);
31
- tool = new DocsSearchTool(mockMcpServer);
32
- });
33
- describe('register', () => {
34
- it('should register tool with correct parameters and enhanced description', () => {
35
- const result = tool.register();
36
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('search-docs', expect.objectContaining({
37
- title: 'Search HubSpot Developer Documentation',
38
- description: 'Use this first whenever you need details about HubSpot APIs, SDKs, integrations, or developer platform features. This searches the official HubSpot Developer Documentation and returns the most relevant pages, each with a URL for use in `fetch-doc`. Always follow this with a fetch to get the full, authoritative content before making plans or writing answers.',
39
- inputSchema: expect.any(Object),
40
- }), expect.any(Function));
41
- expect(result).toBe(mockRegisteredTool);
42
- });
43
- });
44
- describe('handler', () => {
45
- const mockInput = {
46
- docsSearchQuery: 'test query',
47
- absoluteCurrentWorkingDirectory: '/foo',
48
- };
49
- it('should return auth error message when no account ID is found', async () => {
50
- mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
51
- const result = await tool.handler(mockInput);
52
- expect(result).toEqual({
53
- content: [
54
- {
55
- type: 'text',
56
- text: 'No account ID found. Please run `hs account auth` to configure an account, or set a default account with `hs account use <account>`',
57
- },
58
- ],
59
- });
60
- });
61
- it('should return successful results when docs are found', async () => {
62
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
63
- accountId: 12345,
64
- });
65
- const mockResponse = {
66
- results: [
67
- {
68
- title: 'Test Doc 1',
69
- content: 'Test content 1',
70
- description: 'Test description 1',
71
- url: 'https://example.com/doc1',
72
- score: 0.9,
73
- },
74
- {
75
- title: 'Test Doc 2',
76
- content: 'Test content 2',
77
- description: 'Test description 2',
78
- url: 'https://example.com/doc2',
79
- score: 0.8,
80
- },
81
- ],
82
- };
83
- // @ts-expect-error - Mocking axios response structure
84
- mockHttp.post.mockResolvedValue({
85
- data: mockResponse,
86
- });
87
- const result = await tool.handler(mockInput);
88
- expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
89
- expect(mockHttp.post).toHaveBeenCalledWith(12345, {
90
- url: 'dev/docs/llms/v1/docs-search',
91
- data: {
92
- query: 'test query',
93
- },
94
- });
95
- expect(result).toEqual({
96
- content: [
97
- {
98
- type: 'text',
99
- text: expect.stringContaining('Found 2 documentation results:'),
100
- },
101
- ],
102
- });
103
- const resultText = result.content[0].text;
104
- expect(resultText).toContain('**Test Doc 1**');
105
- expect(resultText).toContain('Test description 1');
106
- expect(resultText).toContain('https://example.com/doc1');
107
- expect(resultText).toContain('Score: 0.9');
108
- expect(resultText).toContain('Test content 1');
109
- expect(resultText).toContain('**Test Doc 2**');
110
- expect(resultText).toContain('Test description 2');
111
- expect(resultText).toContain('https://example.com/doc2');
112
- expect(resultText).toContain('Score: 0.8');
113
- expect(resultText).toContain('Test content 2');
114
- });
115
- it('should return no results message when no documentation is found', async () => {
116
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
117
- accountId: 12345,
118
- });
119
- const mockResponse = {
120
- results: [],
121
- };
122
- // @ts-expect-error - Mocking axios response structure
123
- mockHttp.post.mockResolvedValue({
124
- data: mockResponse,
125
- });
126
- const result = await tool.handler(mockInput);
127
- expect(result).toEqual({
128
- content: [
129
- {
130
- type: 'text',
131
- text: 'No documentation found for your query.',
132
- },
133
- ],
134
- });
135
- });
136
- it('should return no results message when results is null', async () => {
137
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
138
- accountId: 12345,
139
- });
140
- const mockResponse = {
141
- results: null,
142
- };
143
- // @ts-expect-error - Mocking axios response structure
144
- mockHttp.post.mockResolvedValue({
145
- data: mockResponse,
146
- });
147
- const result = await tool.handler(mockInput);
148
- expect(result).toEqual({
149
- content: [
150
- {
151
- type: 'text',
152
- text: 'No documentation found for your query.',
153
- },
154
- ],
155
- });
156
- });
157
- it('should handle HubSpot HTTP errors', async () => {
158
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
159
- accountId: 12345,
160
- });
161
- const mockError = {
162
- toString: () => 'HubSpot API Error: 404 Not Found',
163
- };
164
- mockHttp.post.mockRejectedValue(mockError);
165
- mockIsHubSpotHttpError.mockReturnValue(true);
166
- const result = await tool.handler(mockInput);
167
- expect(result).toEqual({
168
- content: [
169
- {
170
- type: 'text',
171
- text: 'HubSpot API Error: 404 Not Found',
172
- },
173
- ],
174
- });
175
- });
176
- it('should handle generic errors', async () => {
177
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
178
- accountId: 12345,
179
- });
180
- const mockError = new Error('Network error');
181
- mockHttp.post.mockRejectedValue(mockError);
182
- mockIsHubSpotHttpError.mockReturnValue(false);
183
- const result = await tool.handler(mockInput);
184
- expect(result).toEqual({
185
- content: [
186
- {
187
- type: 'text',
188
- text: 'Error searching documentation: Network error',
189
- },
190
- ],
191
- });
192
- });
193
- it('should handle non-Error rejections', async () => {
194
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
195
- accountId: 12345,
196
- });
197
- mockHttp.post.mockRejectedValue('String error');
198
- mockIsHubSpotHttpError.mockReturnValue(false);
199
- const result = await tool.handler(mockInput);
200
- expect(result).toEqual({
201
- content: [
202
- {
203
- type: 'text',
204
- text: 'Error searching documentation: String error',
205
- },
206
- ],
207
- });
208
- });
209
- });
210
- });
@@ -1,146 +0,0 @@
1
- import { GetApiUsagePatternsByAppIdTool } from '../GetApiUsagePatternsByAppIdTool.js';
2
- import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
3
- import { http } from '@hubspot/local-dev-lib/http';
4
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
5
- import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
6
- import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
7
- vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
8
- vi.mock('../../../utils/toolUsageTracking');
9
- vi.mock('@hubspot/local-dev-lib/http');
10
- vi.mock('@hubspot/local-dev-lib/errors/index');
11
- vi.mock('@hubspot/local-dev-lib/config');
12
- vi.mock('../../../utils/feedbackTracking');
13
- const mockTrackToolUsage = trackToolUsage;
14
- const mockMcpFeedbackRequest = mcpFeedbackRequest;
15
- const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
16
- const mockHttp = http;
17
- const mockIsHubSpotHttpError = isHubSpotHttpError;
18
- describe('mcp-server/tools/project/GetApiUsagePatternsByAppIdTool', () => {
19
- let mockMcpServer;
20
- let tool;
21
- let mockRegisteredTool;
22
- beforeEach(() => {
23
- // @ts-expect-error Not mocking the whole thing
24
- mockMcpServer = {
25
- registerTool: vi.fn(),
26
- };
27
- mockRegisteredTool = {};
28
- mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
29
- mockMcpFeedbackRequest.mockResolvedValue('');
30
- mockTrackToolUsage.mockResolvedValue(undefined);
31
- tool = new GetApiUsagePatternsByAppIdTool(mockMcpServer);
32
- });
33
- describe('register', () => {
34
- it('should register tool with correct parameters', () => {
35
- const result = tool.register();
36
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-api-usage-patterns-by-app-id', expect.objectContaining({
37
- title: 'Get API Usage Patterns by App ID',
38
- description: expect.stringContaining('Retrieves detailed API usage pattern analytics for a specific HubSpot app'),
39
- inputSchema: expect.objectContaining({
40
- appId: expect.objectContaining({
41
- describe: expect.any(Function),
42
- }),
43
- startDate: expect.objectContaining({
44
- optional: expect.any(Function),
45
- }),
46
- endDate: expect.objectContaining({
47
- optional: expect.any(Function),
48
- }),
49
- }),
50
- }), expect.any(Function));
51
- expect(result).toBe(mockRegisteredTool);
52
- });
53
- });
54
- describe('handler', () => {
55
- const input = {
56
- absoluteCurrentWorkingDirectory: '/test/dir',
57
- appId: '12345',
58
- startDate: '2025-01-01',
59
- endDate: '2025-12-31',
60
- };
61
- beforeEach(() => {
62
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
63
- accountId: 123456789,
64
- });
65
- mockIsHubSpotHttpError.mockReturnValue(false);
66
- });
67
- it('should return API usage patterns successfully', async () => {
68
- const mockResponse = {
69
- data: {
70
- patternSummaries: {
71
- additionalProp1: {
72
- portalPercentage: 25.5,
73
- numOfPortals: 150,
74
- },
75
- additionalProp2: {
76
- portalPercentage: 18.2,
77
- numOfPortals: 89,
78
- },
79
- additionalProp3: {
80
- portalPercentage: 32.1,
81
- numOfPortals: 201,
82
- },
83
- },
84
- },
85
- status: 200,
86
- statusText: 'OK',
87
- headers: {},
88
- config: { headers: {} },
89
- };
90
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
- mockHttp.get.mockResolvedValue(mockResponse);
92
- const result = await tool.handler(input);
93
- expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalledWith();
94
- expect(mockHttp.get).toHaveBeenCalledWith(123456789, {
95
- url: 'app/feature/utilization/public/v3/insights/app/12345/usage-patterns',
96
- params: {
97
- startDate: '2025-01-01',
98
- endDate: '2025-12-31',
99
- },
100
- });
101
- expect(result).toEqual({
102
- content: [
103
- {
104
- type: 'text',
105
- text: JSON.stringify(mockResponse.data, null, 2),
106
- },
107
- ],
108
- });
109
- });
110
- it('should return error when account ID cannot be determined', async () => {
111
- mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
112
- const result = await tool.handler(input);
113
- expect(result).toEqual({
114
- content: [
115
- {
116
- type: 'text',
117
- text: 'No account ID found. Please run `hs account auth` to configure an account, or set a default account with `hs account use <account>`',
118
- },
119
- ],
120
- });
121
- expect(mockHttp.get).not.toHaveBeenCalled();
122
- });
123
- it('should handle empty usage patterns response', async () => {
124
- const mockResponse = {
125
- data: {
126
- patternSummaries: {},
127
- },
128
- status: 200,
129
- statusText: 'OK',
130
- headers: {},
131
- config: { headers: {} },
132
- };
133
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
134
- mockHttp.get.mockResolvedValue(mockResponse);
135
- const result = await tool.handler(input);
136
- expect(result).toEqual({
137
- content: [
138
- {
139
- type: 'text',
140
- text: JSON.stringify(mockResponse.data, null, 2),
141
- },
142
- ],
143
- });
144
- });
145
- });
146
- });
@@ -1,124 +0,0 @@
1
- import { GetApplicationInfoTool } from '../GetApplicationInfoTool.js';
2
- import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
3
- import { http } from '@hubspot/local-dev-lib/http';
4
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
5
- import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
6
- import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
7
- vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
8
- vi.mock('../../../utils/toolUsageTracking');
9
- vi.mock('@hubspot/local-dev-lib/http');
10
- vi.mock('@hubspot/local-dev-lib/errors/index');
11
- vi.mock('@hubspot/local-dev-lib/config');
12
- vi.mock('../../../utils/feedbackTracking');
13
- vi.mock('../../../utils/config');
14
- const mockTrackToolUsage = trackToolUsage;
15
- const mockMcpFeedbackRequest = mcpFeedbackRequest;
16
- const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
17
- const mockHttp = http;
18
- const mockIsHubSpotHttpError = isHubSpotHttpError;
19
- describe('mcp-server/tools/project/GetApplicationInfoTool', () => {
20
- let mockMcpServer;
21
- let tool;
22
- let mockRegisteredTool;
23
- beforeEach(() => {
24
- // @ts-expect-error Not mocking the whole thing
25
- mockMcpServer = {
26
- registerTool: vi.fn(),
27
- };
28
- mockRegisteredTool = {};
29
- mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
30
- mockMcpFeedbackRequest.mockResolvedValue('');
31
- mockTrackToolUsage.mockResolvedValue(undefined);
32
- tool = new GetApplicationInfoTool(mockMcpServer);
33
- });
34
- describe('register', () => {
35
- it('should register tool with correct parameters', () => {
36
- const result = tool.register();
37
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-apps-info', expect.objectContaining({
38
- title: 'Get Apps Information',
39
- description: expect.stringContaining('Retrieves a list of all HubSpot apps available in the current account'),
40
- inputSchema: expect.any(Object),
41
- }), expect.any(Function));
42
- expect(result).toBe(mockRegisteredTool);
43
- });
44
- });
45
- describe('handler', () => {
46
- const input = { absoluteCurrentWorkingDirectory: '/test/dir' };
47
- beforeEach(() => {
48
- mockGetConfigDefaultAccountIfExists.mockReturnValue({
49
- accountId: 123456789,
50
- });
51
- mockIsHubSpotHttpError.mockReturnValue(false);
52
- });
53
- it('should return application information successfully', async () => {
54
- const mockResponse = {
55
- data: {
56
- applications: [
57
- {
58
- appId: 12345,
59
- appName: 'Test App 1',
60
- },
61
- {
62
- appId: 67890,
63
- appName: 'Test App 2',
64
- },
65
- ],
66
- },
67
- status: 200,
68
- statusText: 'OK',
69
- headers: {},
70
- config: { headers: {} },
71
- };
72
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
- mockHttp.get.mockResolvedValue(mockResponse);
74
- const result = await tool.handler(input);
75
- expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalledWith();
76
- expect(mockHttp.get).toHaveBeenCalledWith(123456789, {
77
- url: 'app/feature/utilization/public/v3/insights/apps',
78
- });
79
- expect(result).toEqual({
80
- content: [
81
- {
82
- type: 'text',
83
- text: JSON.stringify(mockResponse.data, null, 2),
84
- },
85
- ],
86
- });
87
- });
88
- it('should return error when account ID cannot be determined', async () => {
89
- mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
90
- const result = await tool.handler(input);
91
- expect(result).toEqual({
92
- content: [
93
- {
94
- type: 'text',
95
- text: 'No account ID found. Please run `hs account auth` to configure an account, or set a default account with `hs account use <account>`',
96
- },
97
- ],
98
- });
99
- expect(mockHttp.get).not.toHaveBeenCalled();
100
- });
101
- it('should handle empty applications response', async () => {
102
- const mockResponse = {
103
- data: {
104
- applications: [],
105
- },
106
- status: 200,
107
- statusText: 'OK',
108
- headers: {},
109
- config: { headers: {} },
110
- };
111
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
- mockHttp.get.mockResolvedValue(mockResponse);
113
- const result = await tool.handler(input);
114
- expect(result).toEqual({
115
- content: [
116
- {
117
- type: 'text',
118
- text: JSON.stringify(mockResponse.data, null, 2),
119
- },
120
- ],
121
- });
122
- });
123
- });
124
- });