@hubspot/cli 7.7.19-experimental.3 → 7.7.20-experimental.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 (296) hide show
  1. package/api/__tests__/migrate.test.d.ts +1 -0
  2. package/api/__tests__/migrate.test.js +183 -0
  3. package/commands/__tests__/account.test.d.ts +1 -0
  4. package/commands/__tests__/account.test.js +74 -0
  5. package/commands/__tests__/auth.test.d.ts +1 -0
  6. package/commands/__tests__/auth.test.js +43 -0
  7. package/commands/__tests__/cms.test.d.ts +1 -0
  8. package/commands/__tests__/cms.test.js +49 -0
  9. package/commands/__tests__/config.test.d.ts +1 -0
  10. package/commands/__tests__/config.test.js +49 -0
  11. package/commands/__tests__/create.test.d.ts +1 -0
  12. package/commands/__tests__/create.test.js +38 -0
  13. package/commands/__tests__/customObject.test.d.ts +1 -0
  14. package/commands/__tests__/customObject.test.js +54 -0
  15. package/commands/__tests__/doctor.test.d.ts +1 -0
  16. package/commands/__tests__/doctor.test.js +139 -0
  17. package/commands/__tests__/feedback.test.d.ts +1 -0
  18. package/commands/__tests__/feedback.test.js +62 -0
  19. package/commands/__tests__/fetch.test.d.ts +1 -0
  20. package/commands/__tests__/fetch.test.js +56 -0
  21. package/commands/__tests__/filemanager.test.d.ts +1 -0
  22. package/commands/__tests__/filemanager.test.js +50 -0
  23. package/commands/__tests__/function.test.d.ts +1 -0
  24. package/commands/__tests__/function.test.js +51 -0
  25. package/commands/__tests__/getStarted.test.d.ts +1 -0
  26. package/commands/__tests__/getStarted.test.js +170 -0
  27. package/commands/__tests__/hubdb.test.d.ts +1 -0
  28. package/commands/__tests__/hubdb.test.js +55 -0
  29. package/commands/__tests__/init.test.d.ts +1 -0
  30. package/commands/__tests__/init.test.js +47 -0
  31. package/commands/__tests__/lint.test.d.ts +1 -0
  32. package/commands/__tests__/lint.test.js +38 -0
  33. package/commands/__tests__/list.test.d.ts +1 -0
  34. package/commands/__tests__/list.test.js +47 -0
  35. package/commands/__tests__/logs.test.d.ts +1 -0
  36. package/commands/__tests__/logs.test.js +70 -0
  37. package/commands/__tests__/mcp.test.d.ts +1 -0
  38. package/commands/__tests__/mcp.test.js +51 -0
  39. package/commands/__tests__/mv.test.d.ts +1 -0
  40. package/commands/__tests__/mv.test.js +84 -0
  41. package/commands/__tests__/open.test.d.ts +1 -0
  42. package/commands/__tests__/open.test.js +96 -0
  43. package/commands/__tests__/project.test.d.ts +1 -0
  44. package/commands/__tests__/project.test.js +100 -0
  45. package/commands/__tests__/remove.test.d.ts +1 -0
  46. package/commands/__tests__/remove.test.js +77 -0
  47. package/commands/__tests__/sandbox.test.d.ts +1 -0
  48. package/commands/__tests__/sandbox.test.js +49 -0
  49. package/commands/__tests__/secret.test.d.ts +1 -0
  50. package/commands/__tests__/secret.test.js +54 -0
  51. package/commands/__tests__/testAccount.test.d.ts +1 -0
  52. package/commands/__tests__/testAccount.test.js +60 -0
  53. package/commands/__tests__/theme.test.d.ts +1 -0
  54. package/commands/__tests__/theme.test.js +52 -0
  55. package/commands/account/__tests__/auth.test.d.ts +1 -0
  56. package/commands/account/__tests__/auth.test.js +31 -0
  57. package/commands/account/__tests__/clean.test.d.ts +1 -0
  58. package/commands/account/__tests__/clean.test.js +33 -0
  59. package/commands/account/__tests__/createOverride.test.d.ts +1 -0
  60. package/commands/account/__tests__/createOverride.test.js +37 -0
  61. package/commands/account/__tests__/info.test.d.ts +1 -0
  62. package/commands/account/__tests__/info.test.js +33 -0
  63. package/commands/account/__tests__/list.test.d.ts +1 -0
  64. package/commands/account/__tests__/list.test.js +33 -0
  65. package/commands/account/__tests__/remove.test.d.ts +1 -0
  66. package/commands/account/__tests__/remove.test.js +41 -0
  67. package/commands/account/__tests__/removeOverride.d.ts +1 -0
  68. package/commands/account/__tests__/removeOverride.js +30 -0
  69. package/commands/account/__tests__/rename.test.d.ts +1 -0
  70. package/commands/account/__tests__/rename.test.js +47 -0
  71. package/commands/account/__tests__/use.test.d.ts +1 -0
  72. package/commands/account/__tests__/use.test.js +37 -0
  73. package/commands/app/__tests__/migrate.test.d.ts +1 -0
  74. package/commands/app/__tests__/migrate.test.js +129 -0
  75. package/commands/app/secret/__tests__/add.test.d.ts +1 -0
  76. package/commands/app/secret/__tests__/add.test.js +33 -0
  77. package/commands/app/secret/__tests__/delete.test.d.ts +1 -0
  78. package/commands/app/secret/__tests__/delete.test.js +33 -0
  79. package/commands/app/secret/__tests__/list.test.d.ts +1 -0
  80. package/commands/app/secret/__tests__/list.test.js +30 -0
  81. package/commands/app/secret/__tests__/update.test.d.ts +1 -0
  82. package/commands/app/secret/__tests__/update.test.js +33 -0
  83. package/commands/app.js +1 -6
  84. package/commands/customObject/__tests__/create.test.d.ts +1 -0
  85. package/commands/customObject/__tests__/create.test.js +45 -0
  86. package/commands/customObject/__tests__/schema.test.d.ts +1 -0
  87. package/commands/customObject/__tests__/schema.test.js +58 -0
  88. package/commands/customObject/schema/__tests__/create.test.d.ts +1 -0
  89. package/commands/customObject/schema/__tests__/create.test.js +33 -0
  90. package/commands/customObject/schema/__tests__/delete.test.d.ts +1 -0
  91. package/commands/customObject/schema/__tests__/delete.test.js +47 -0
  92. package/commands/customObject/schema/__tests__/fetch-all.test.d.ts +1 -0
  93. package/commands/customObject/schema/__tests__/fetch-all.test.js +46 -0
  94. package/commands/customObject/schema/__tests__/fetch.test.d.ts +1 -0
  95. package/commands/customObject/schema/__tests__/fetch.test.js +50 -0
  96. package/commands/customObject/schema/__tests__/list.test.d.ts +1 -0
  97. package/commands/customObject/schema/__tests__/list.test.js +34 -0
  98. package/commands/customObject/schema/__tests__/update.test.d.ts +1 -0
  99. package/commands/customObject/schema/__tests__/update.test.js +45 -0
  100. package/commands/fetch.js +0 -1
  101. package/commands/filemanager/__tests__/fetch.test.d.ts +1 -0
  102. package/commands/filemanager/__tests__/fetch.test.js +37 -0
  103. package/commands/filemanager/__tests__/upload.test.d.ts +1 -0
  104. package/commands/filemanager/__tests__/upload.test.js +35 -0
  105. package/commands/hubdb/__tests__/clear.test.d.ts +1 -0
  106. package/commands/hubdb/__tests__/clear.test.js +33 -0
  107. package/commands/hubdb/__tests__/create.test.d.ts +1 -0
  108. package/commands/hubdb/__tests__/create.test.js +33 -0
  109. package/commands/hubdb/__tests__/delete.test.d.ts +1 -0
  110. package/commands/hubdb/__tests__/delete.test.js +33 -0
  111. package/commands/hubdb/__tests__/fetch.test.d.ts +1 -0
  112. package/commands/hubdb/__tests__/fetch.test.js +33 -0
  113. package/commands/hubdb/__tests__/list.test.d.ts +1 -0
  114. package/commands/hubdb/__tests__/list.test.js +101 -0
  115. package/commands/logs.js +0 -1
  116. package/commands/mcp/__tests__/setup.test.d.ts +1 -0
  117. package/commands/mcp/__tests__/setup.test.js +31 -0
  118. package/commands/mcp/__tests__/start.test.d.ts +1 -0
  119. package/commands/mcp/__tests__/start.test.js +32 -0
  120. package/commands/project/__tests__/add.test.d.ts +1 -0
  121. package/commands/project/__tests__/add.test.js +48 -0
  122. package/commands/project/__tests__/create.test.d.ts +1 -0
  123. package/commands/project/__tests__/create.test.js +45 -0
  124. package/commands/project/__tests__/deploy.test.d.ts +1 -0
  125. package/commands/project/__tests__/deploy.test.js +344 -0
  126. package/commands/project/__tests__/devUnifiedFlow.test.d.ts +1 -0
  127. package/commands/project/__tests__/devUnifiedFlow.test.js +419 -0
  128. package/commands/project/__tests__/download.test.d.ts +1 -0
  129. package/commands/project/__tests__/download.test.js +44 -0
  130. package/commands/project/__tests__/fixtures/exampleProject.json +33 -0
  131. package/commands/project/__tests__/installDeps.test.d.ts +1 -0
  132. package/commands/project/__tests__/installDeps.test.js +180 -0
  133. package/commands/project/__tests__/listBuilds.test.d.ts +1 -0
  134. package/commands/project/__tests__/listBuilds.test.js +43 -0
  135. package/commands/project/__tests__/logs.test.d.ts +1 -0
  136. package/commands/project/__tests__/logs.test.js +246 -0
  137. package/commands/project/__tests__/migrate.test.d.ts +1 -0
  138. package/commands/project/__tests__/migrate.test.js +116 -0
  139. package/commands/project/__tests__/migrateApp.test.d.ts +1 -0
  140. package/commands/project/__tests__/migrateApp.test.js +87 -0
  141. package/commands/project/__tests__/open.test.d.ts +1 -0
  142. package/commands/project/__tests__/open.test.js +44 -0
  143. package/commands/project/__tests__/profile.test.d.ts +1 -0
  144. package/commands/project/__tests__/profile.test.js +47 -0
  145. package/commands/project/__tests__/upload.test.d.ts +1 -0
  146. package/commands/project/__tests__/upload.test.js +48 -0
  147. package/commands/project/__tests__/watch.test.d.ts +1 -0
  148. package/commands/project/__tests__/watch.test.js +40 -0
  149. package/commands/project/dev/unifiedFlow.js +1 -1
  150. package/commands/sandbox/__tests__/create.test.d.ts +1 -0
  151. package/commands/sandbox/__tests__/create.test.js +36 -0
  152. package/commands/sandbox/__tests__/delete.test.d.ts +1 -0
  153. package/commands/sandbox/__tests__/delete.test.js +36 -0
  154. package/commands/secret/__tests__/addSecret.test.d.ts +1 -0
  155. package/commands/secret/__tests__/addSecret.test.js +34 -0
  156. package/commands/secret/__tests__/deleteSecret.test.d.ts +1 -0
  157. package/commands/secret/__tests__/deleteSecret.test.js +46 -0
  158. package/commands/secret/__tests__/listSecret.test.d.ts +1 -0
  159. package/commands/secret/__tests__/listSecret.test.js +34 -0
  160. package/commands/secret/__tests__/updateSecret.test.d.ts +1 -0
  161. package/commands/secret/__tests__/updateSecret.test.js +34 -0
  162. package/commands/testAccount/__tests__/create.test.d.ts +1 -0
  163. package/commands/testAccount/__tests__/create.test.js +38 -0
  164. package/commands/testAccount/__tests__/createConfig.test.d.ts +1 -0
  165. package/commands/testAccount/__tests__/createConfig.test.js +40 -0
  166. package/commands/testAccount/__tests__/delete.test.d.ts +1 -0
  167. package/commands/testAccount/__tests__/delete.test.js +36 -0
  168. package/commands/testAccount/create.js +24 -14
  169. package/commands/theme/__tests__/generate-selectors.test.d.ts +1 -0
  170. package/commands/theme/__tests__/generate-selectors.test.js +33 -0
  171. package/commands/theme/__tests__/marketplace-validate.test.d.ts +1 -0
  172. package/commands/theme/__tests__/marketplace-validate.test.js +41 -0
  173. package/commands/theme/__tests__/preview.test.d.ts +1 -0
  174. package/commands/theme/__tests__/preview.test.js +65 -0
  175. package/lang/en.d.ts +6 -65
  176. package/lang/en.js +6 -65
  177. package/lib/__tests__/accountTypes.test.d.ts +1 -0
  178. package/lib/__tests__/accountTypes.test.js +100 -0
  179. package/lib/__tests__/buildAccount.test.d.ts +1 -0
  180. package/lib/__tests__/buildAccount.test.js +231 -0
  181. package/lib/__tests__/commonOpts.test.d.ts +1 -0
  182. package/lib/__tests__/commonOpts.test.js +87 -0
  183. package/lib/__tests__/dependencyManagement.test.d.ts +1 -0
  184. package/lib/__tests__/dependencyManagement.test.js +180 -0
  185. package/lib/__tests__/developerTestAccounts.test.d.ts +1 -0
  186. package/lib/__tests__/developerTestAccounts.test.js +180 -0
  187. package/lib/__tests__/hasFeature.test.d.ts +1 -0
  188. package/lib/__tests__/hasFeature.test.js +37 -0
  189. package/lib/__tests__/npm.test.d.ts +1 -0
  190. package/lib/__tests__/npm.test.js +62 -0
  191. package/lib/__tests__/oauth.test.d.ts +1 -0
  192. package/lib/__tests__/oauth.test.js +113 -0
  193. package/lib/__tests__/parsing.test.d.ts +1 -0
  194. package/lib/__tests__/parsing.test.js +36 -0
  195. package/lib/__tests__/polling.test.d.ts +1 -0
  196. package/lib/__tests__/polling.test.js +78 -0
  197. package/lib/__tests__/process.test.d.ts +1 -0
  198. package/lib/__tests__/process.test.js +90 -0
  199. package/lib/__tests__/projectProfiles.test.d.ts +1 -0
  200. package/lib/__tests__/projectProfiles.test.js +134 -0
  201. package/lib/__tests__/sandboxSync.test.d.ts +1 -0
  202. package/lib/__tests__/sandboxSync.test.js +131 -0
  203. package/lib/__tests__/sandboxes.test.d.ts +1 -0
  204. package/lib/__tests__/sandboxes.test.js +148 -0
  205. package/lib/__tests__/serverlessLogs.test.d.ts +1 -0
  206. package/lib/__tests__/serverlessLogs.test.js +154 -0
  207. package/lib/__tests__/usageTracking.test.d.ts +1 -0
  208. package/lib/__tests__/usageTracking.test.js +171 -0
  209. package/lib/__tests__/validation.test.d.ts +1 -0
  210. package/lib/__tests__/validation.test.js +145 -0
  211. package/lib/__tests__/yargsUtils.test.d.ts +1 -0
  212. package/lib/__tests__/yargsUtils.test.js +74 -0
  213. package/lib/app/__tests__/migrate.test.d.ts +1 -0
  214. package/lib/app/__tests__/migrate.test.js +495 -0
  215. package/lib/app/__tests__/migrate_legacy.test.d.ts +1 -0
  216. package/lib/app/__tests__/migrate_legacy.test.js +136 -0
  217. package/lib/buildAccount.d.ts +1 -7
  218. package/lib/buildAccount.js +4 -54
  219. package/lib/doctor/Diagnosis.js +11 -11
  220. package/lib/doctor/Doctor.js +42 -42
  221. package/lib/doctor/__tests__/Diagnosis.test.d.ts +1 -0
  222. package/lib/doctor/__tests__/Diagnosis.test.js +87 -0
  223. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +1 -0
  224. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +172 -0
  225. package/lib/doctor/__tests__/Doctor.test.d.ts +1 -0
  226. package/lib/doctor/__tests__/Doctor.test.js +398 -0
  227. package/lib/mcp/setup.js +18 -2
  228. package/lib/middleware/__test__/configMiddleware.test.js +12 -12
  229. package/lib/middleware/__test__/gitMiddleware.test.js +4 -4
  230. package/lib/middleware/__test__/notificationsMiddleware.test.js +2 -2
  231. package/lib/middleware/__test__/requestMiddleware.test.js +2 -2
  232. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +7 -7
  233. package/lib/middleware/notificationsMiddleware.js +16 -13
  234. package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +1 -0
  235. package/lib/projects/__tests__/AppDevModeInterface.test.js +517 -0
  236. package/lib/projects/__tests__/LocalDevProcess.test.d.ts +1 -0
  237. package/lib/projects/__tests__/LocalDevProcess.test.js +314 -0
  238. package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +1 -0
  239. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +175 -0
  240. package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +1 -0
  241. package/lib/projects/__tests__/ProjectLogsManager.test.js +191 -0
  242. package/lib/projects/__tests__/buildAndDeploy.test.d.ts +1 -0
  243. package/lib/projects/__tests__/buildAndDeploy.test.js +25 -0
  244. package/lib/projects/__tests__/components.test.d.ts +1 -0
  245. package/lib/projects/__tests__/components.test.js +186 -0
  246. package/lib/projects/__tests__/projects.test.d.ts +1 -0
  247. package/lib/projects/__tests__/projects.test.js +89 -0
  248. package/lib/projects/__tests__/structure.test.d.ts +1 -0
  249. package/lib/projects/__tests__/structure.test.js +249 -0
  250. package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +1 -0
  251. package/lib/projects/add/__tests__/legacyAddComponent.test.js +206 -0
  252. package/lib/projects/add/__tests__/v3AddComponent.test.d.ts +1 -0
  253. package/lib/projects/add/__tests__/v3AddComponent.test.js +190 -0
  254. package/lib/projects/create/__tests__/legacy.test.d.ts +1 -0
  255. package/lib/projects/create/__tests__/legacy.test.js +126 -0
  256. package/lib/projects/create/__tests__/v3.test.d.ts +1 -0
  257. package/lib/projects/create/__tests__/v3.test.js +80 -0
  258. package/lib/projects/localDev/DevServerManager.js +0 -1
  259. package/lib/projects/localDev/helpers.d.ts +1 -1
  260. package/lib/projects/localDev/helpers.js +2 -2
  261. package/lib/projects/structure.d.ts +2 -2
  262. package/lib/projects/upload.d.ts +1 -2
  263. package/lib/projects/upload.js +0 -1
  264. package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +1 -0
  265. package/lib/prompts/__tests__/downloadProjectPrompt.test.js +30 -0
  266. package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +1 -0
  267. package/lib/prompts/__tests__/projectsLogsPrompt.test.js +42 -0
  268. package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +10 -9
  269. package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +43 -81
  270. package/lib/schema.js +5 -1
  271. package/lib/ui/SpinniesManager.js +0 -1
  272. package/lib/ui/supportHyperlinks.js +2 -2
  273. package/lib/ui/supportsColor.js +2 -2
  274. package/lib/utils/hasFlag.d.ts +1 -0
  275. package/lib/utils/hasFlag.js +15 -0
  276. package/lib/yargsUtils.d.ts +2 -1
  277. package/lib/yargsUtils.js +3 -13
  278. package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.d.ts +1 -0
  279. package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +152 -0
  280. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
  281. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +129 -0
  282. package/mcp-server/tools/project/__tests__/DeployProject.test.d.ts +1 -0
  283. package/mcp-server/tools/project/__tests__/DeployProject.test.js +120 -0
  284. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
  285. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +127 -0
  286. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
  287. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +108 -0
  288. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
  289. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +111 -0
  290. package/mcp-server/utils/__tests__/command.test.d.ts +1 -0
  291. package/mcp-server/utils/__tests__/command.test.js +47 -0
  292. package/mcp-server/utils/__tests__/project.test.d.ts +1 -0
  293. package/mcp-server/utils/__tests__/project.test.js +81 -0
  294. package/package.json +8 -8
  295. package/commands/app/install.d.ts +0 -8
  296. package/commands/app/install.js +0 -127
@@ -1,5 +1,6 @@
1
1
  import { Argv } from 'yargs';
2
- export declare function hasFlag(flag: string, argv?: string[]): boolean;
2
+ import { hasFlag } from './utils/hasFlag';
3
+ export { hasFlag };
3
4
  export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>, command: string | string[], describe?: string, options?: {
4
5
  useGlobalOptions?: boolean;
5
6
  useAccountOptions?: boolean;
package/lib/yargsUtils.js CHANGED
@@ -1,20 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.hasFlag = hasFlag;
3
+ exports.hasFlag = void 0;
7
4
  exports.makeYargsBuilder = makeYargsBuilder;
8
- const process_1 = __importDefault(require("process"));
9
5
  const commonOpts_1 = require("./commonOpts");
10
- // See https://github.com/sindresorhus/has-flag/blob/main/index.js (License: https://github.com/sindresorhus/has-flag/blob/main/license)
11
- function hasFlag(flag, argv = process_1.default.argv) {
12
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
13
- const position = argv.indexOf(prefix + flag);
14
- const terminatorPosition = argv.indexOf('--');
15
- return (position !== -1 &&
16
- (terminatorPosition === -1 || position < terminatorPosition));
17
- }
6
+ const hasFlag_1 = require("./utils/hasFlag");
7
+ Object.defineProperty(exports, "hasFlag", { enumerable: true, get: function () { return hasFlag_1.hasFlag; } });
18
8
  function makeYargsBuilder(callback, command, describe, options = {}) {
19
9
  return async function (yargs) {
20
10
  if (options.useGlobalOptions) {
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AddFeatureToProject_1 = require("../AddFeatureToProject");
4
+ const project_1 = require("../../../utils/project");
5
+ const command_1 = require("../../../utils/command");
6
+ const constants_1 = require("../../../../lib/constants");
7
+ vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
8
+ vi.mock('../../../utils/project');
9
+ vi.mock('../../../utils/command');
10
+ vi.mock('../../../../lib/constants');
11
+ const mockRunCommandInDir = project_1.runCommandInDir;
12
+ const mockAddFlag = command_1.addFlag;
13
+ describe('mcp-server/tools/project/AddFeatureToProject', () => {
14
+ let mockMcpServer;
15
+ let tool;
16
+ let mockRegisteredTool;
17
+ beforeEach(() => {
18
+ vi.clearAllMocks();
19
+ // @ts-expect-error Not mocking the whole server
20
+ mockMcpServer = {
21
+ registerTool: vi.fn(),
22
+ };
23
+ mockRegisteredTool = {};
24
+ mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
25
+ tool = new AddFeatureToProject_1.AddFeatureToProject(mockMcpServer);
26
+ // Mock addFlag to simulate command building
27
+ mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
28
+ });
29
+ describe('register', () => {
30
+ it('should register tool with correct parameters', () => {
31
+ const result = tool.register();
32
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('add-feature-to-hubspot-project', {
33
+ title: 'Add feature to HubSpot Project',
34
+ description: 'Adds a feature to an existing HubSpot project',
35
+ inputSchema: expect.any(Object),
36
+ }, tool.handler);
37
+ expect(result).toBe(mockRegisteredTool);
38
+ });
39
+ });
40
+ describe('handler', () => {
41
+ const baseInput = {
42
+ absoluteProjectPath: '/test/project',
43
+ addApp: false,
44
+ };
45
+ it('should handle successful command execution without app', async () => {
46
+ mockRunCommandInDir.mockResolvedValue({
47
+ stdout: 'Feature added successfully',
48
+ stderr: '',
49
+ });
50
+ const result = await tool.handler(baseInput);
51
+ expect(mockAddFlag).toHaveBeenCalledWith('hs project add', 'features', []);
52
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/project', expect.any(String));
53
+ expect(result).toEqual({
54
+ content: [
55
+ { type: 'text', text: 'Feature added successfully' },
56
+ { type: 'text', text: '' },
57
+ ],
58
+ });
59
+ });
60
+ it('should handle successful command execution with features', async () => {
61
+ mockRunCommandInDir.mockResolvedValue({
62
+ stdout: 'Features added successfully',
63
+ stderr: '',
64
+ });
65
+ const input = {
66
+ ...baseInput,
67
+ features: ['card', 'settings'],
68
+ };
69
+ await tool.handler(input);
70
+ expect(mockAddFlag).toHaveBeenCalledWith('hs project add', 'features', [
71
+ 'card',
72
+ 'settings',
73
+ ]);
74
+ });
75
+ it('should prompt for distribution and auth when adding app without both', async () => {
76
+ const input = {
77
+ ...baseInput,
78
+ addApp: true,
79
+ };
80
+ const result = await tool.handler(input);
81
+ expect(result.content).toEqual([
82
+ {
83
+ type: 'text',
84
+ text: expect.stringContaining('Ask the user how they would you like to distribute the application'),
85
+ },
86
+ {
87
+ type: 'text',
88
+ text: expect.stringContaining('Ask the user which auth type they would like to use'),
89
+ },
90
+ ]);
91
+ });
92
+ it('should prompt for auth when adding app without auth', async () => {
93
+ const input = {
94
+ ...baseInput,
95
+ addApp: true,
96
+ distribution: constants_1.APP_DISTRIBUTION_TYPES.PRIVATE,
97
+ };
98
+ const result = await tool.handler(input);
99
+ expect(result.content).toEqual([
100
+ {
101
+ type: 'text',
102
+ text: expect.stringContaining('Ask the user which auth type they would like to use'),
103
+ },
104
+ ]);
105
+ });
106
+ it('should add distribution and auth flags when provided', async () => {
107
+ mockRunCommandInDir.mockResolvedValue({
108
+ stdout: 'App feature added',
109
+ stderr: '',
110
+ });
111
+ const input = {
112
+ ...baseInput,
113
+ addApp: true,
114
+ distribution: constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE,
115
+ auth: constants_1.APP_AUTH_TYPES.OAUTH,
116
+ features: ['webhooks'],
117
+ };
118
+ await tool.handler(input);
119
+ expect(mockAddFlag).toHaveBeenCalledWith('hs project add', 'distribution', constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE);
120
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'auth', constants_1.APP_AUTH_TYPES.OAUTH);
121
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'features', [
122
+ 'webhooks',
123
+ ]);
124
+ });
125
+ it('should handle command execution error', async () => {
126
+ const error = new Error('Command failed');
127
+ mockRunCommandInDir.mockRejectedValue(error);
128
+ const result = await tool.handler(baseInput);
129
+ expect(result).toEqual({
130
+ content: [{ type: 'text', text: 'Command failed' }],
131
+ });
132
+ });
133
+ it('should handle non-Error rejection', async () => {
134
+ mockRunCommandInDir.mockRejectedValue('String error');
135
+ const result = await tool.handler(baseInput);
136
+ expect(result).toEqual({
137
+ content: [{ type: 'text', text: 'String error' }],
138
+ });
139
+ });
140
+ it('should handle stderr in results', async () => {
141
+ mockRunCommandInDir.mockResolvedValue({
142
+ stdout: 'Success with warnings',
143
+ stderr: 'Warning: something happened',
144
+ });
145
+ const result = await tool.handler(baseInput);
146
+ expect(result.content).toEqual([
147
+ { type: 'text', text: 'Success with warnings' },
148
+ { type: 'text', text: 'Warning: something happened' },
149
+ ]);
150
+ });
151
+ });
152
+ });
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const CreateProjectTool_1 = require("../CreateProjectTool");
4
+ const project_1 = require("../../../utils/project");
5
+ const command_1 = require("../../../utils/command");
6
+ const constants_1 = require("../../../../lib/constants");
7
+ const v3_1 = require("../../../../lib/projects/create/v3");
8
+ vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
9
+ vi.mock('../../../utils/project');
10
+ vi.mock('../../../utils/command');
11
+ vi.mock('../../../../lib/constants');
12
+ vi.mock('../../../../lib/projects/create/v3');
13
+ const mockRunCommandInDir = project_1.runCommandInDir;
14
+ const mockAddFlag = command_1.addFlag;
15
+ describe('mcp-server/tools/project/CreateProjectTool', () => {
16
+ let mockMcpServer;
17
+ let tool;
18
+ let mockRegisteredTool;
19
+ beforeEach(() => {
20
+ vi.clearAllMocks();
21
+ // @ts-expect-error Not mocking the whole thing
22
+ mockMcpServer = {
23
+ registerTool: vi.fn(),
24
+ };
25
+ mockRegisteredTool = {};
26
+ mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
27
+ tool = new CreateProjectTool_1.CreateProjectTool(mockMcpServer);
28
+ // Mock addFlag to simulate command building
29
+ mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
30
+ });
31
+ describe('register', () => {
32
+ it('should register tool with correct parameters', () => {
33
+ const result = tool.register();
34
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-hubspot-project', {
35
+ title: 'Create HubSpot Project',
36
+ description: 'Creates a HubSpot project with the provided name and outputs it in the provided destination',
37
+ inputSchema: expect.any(Object),
38
+ }, tool.handler);
39
+ expect(result).toBe(mockRegisteredTool);
40
+ });
41
+ });
42
+ describe('handler', () => {
43
+ const baseInput = {
44
+ absoluteCurrentWorkingDirectory: '/test/workspace',
45
+ name: 'test-project',
46
+ destination: './test-dest',
47
+ projectBase: v3_1.EMPTY_PROJECT,
48
+ };
49
+ it('should handle successful command execution', async () => {
50
+ mockRunCommandInDir.mockResolvedValue({
51
+ stdout: 'Project created successfully',
52
+ stderr: '',
53
+ });
54
+ const result = await tool.handler(baseInput);
55
+ expect(mockAddFlag).toHaveBeenCalledWith('hs project create', 'platform-version', '2025.2');
56
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'name', 'test-project');
57
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'dest', './test-dest');
58
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'project-base', v3_1.EMPTY_PROJECT);
59
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/workspace', expect.any(String));
60
+ expect(result).toEqual({
61
+ content: [
62
+ { type: 'text', text: 'Project created successfully' },
63
+ { type: 'text', text: '' },
64
+ ],
65
+ });
66
+ });
67
+ it('should handle command execution error', async () => {
68
+ const error = new Error('Command failed');
69
+ mockRunCommandInDir.mockRejectedValue(error);
70
+ const result = await tool.handler(baseInput);
71
+ expect(result).toEqual({
72
+ content: [{ type: 'text', text: 'Command failed' }],
73
+ });
74
+ });
75
+ it('should prompt for distribution and auth when creating app project without both', async () => {
76
+ const input = {
77
+ ...baseInput,
78
+ projectBase: v3_1.PROJECT_WITH_APP,
79
+ };
80
+ const result = await tool.handler(input);
81
+ expect(result.content).toEqual([
82
+ {
83
+ type: 'text',
84
+ text: expect.stringContaining('Ask the user how they would you like to distribute the application?'),
85
+ },
86
+ {
87
+ type: 'text',
88
+ text: expect.stringContaining('Ask the user which auth type they would like to use?'),
89
+ },
90
+ ]);
91
+ });
92
+ it('should prompt for auth when creating app project without auth', async () => {
93
+ const input = {
94
+ ...baseInput,
95
+ projectBase: v3_1.PROJECT_WITH_APP,
96
+ distribution: constants_1.APP_DISTRIBUTION_TYPES.PRIVATE,
97
+ };
98
+ const result = await tool.handler(input);
99
+ expect(result.content).toEqual([
100
+ {
101
+ type: 'text',
102
+ text: expect.stringContaining('Ask the user which auth type they would like to use?'),
103
+ },
104
+ ]);
105
+ });
106
+ it('should add features flag when features are provided', async () => {
107
+ mockRunCommandInDir.mockResolvedValue({
108
+ stdout: 'Project created',
109
+ stderr: '',
110
+ });
111
+ const input = {
112
+ ...baseInput,
113
+ features: ['card', 'settings'],
114
+ };
115
+ await tool.handler(input);
116
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'features', [
117
+ 'card',
118
+ 'settings',
119
+ ]);
120
+ });
121
+ it('should handle non-Error rejection', async () => {
122
+ mockRunCommandInDir.mockRejectedValue('String error');
123
+ const result = await tool.handler(baseInput);
124
+ expect(result).toEqual({
125
+ content: [{ type: 'text', text: 'String error' }],
126
+ });
127
+ });
128
+ });
129
+ });
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const DeployProject_1 = require("../DeployProject");
4
+ const project_1 = require("../../../utils/project");
5
+ const command_1 = require("../../../utils/command");
6
+ vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
7
+ vi.mock('../../../utils/project');
8
+ vi.mock('../../../utils/command');
9
+ const mockRunCommandInDir = project_1.runCommandInDir;
10
+ const mockAddFlag = command_1.addFlag;
11
+ describe('mcp-server/tools/project/DeployProject', () => {
12
+ let mockMcpServer;
13
+ let tool;
14
+ let mockRegisteredTool;
15
+ beforeEach(() => {
16
+ vi.clearAllMocks();
17
+ // @ts-expect-error Not mocking the whole server
18
+ mockMcpServer = {
19
+ registerTool: vi.fn(),
20
+ };
21
+ mockRegisteredTool = {};
22
+ mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
23
+ tool = new DeployProject_1.DeployProject(mockMcpServer);
24
+ // Mock addFlag to simulate command building
25
+ mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
26
+ });
27
+ describe('register', () => {
28
+ it('should register tool with correct parameters', () => {
29
+ const result = tool.register();
30
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('deploy-hubspot-project', {
31
+ title: 'Deploy a build of HubSpot Project',
32
+ description: expect.stringContaining('Takes a build number and a project name and deploys that build of the project'),
33
+ inputSchema: expect.any(Object),
34
+ }, tool.handler);
35
+ expect(result).toBe(mockRegisteredTool);
36
+ });
37
+ });
38
+ describe('handler', () => {
39
+ const baseInput = {
40
+ absoluteProjectPath: '/test/project',
41
+ };
42
+ it('should deploy project with specified build number', async () => {
43
+ mockRunCommandInDir.mockResolvedValue({
44
+ stdout: 'Project deployed successfully',
45
+ stderr: '',
46
+ });
47
+ const input = {
48
+ ...baseInput,
49
+ buildNumber: 123,
50
+ };
51
+ const result = await tool.handler(input);
52
+ expect(mockAddFlag).toHaveBeenCalledWith('hs project deploy', 'build', 123);
53
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/project', expect.stringContaining('--build "123"'));
54
+ expect(result).toEqual({
55
+ content: [
56
+ { type: 'text', text: 'Project deployed successfully' },
57
+ { type: 'text', text: '' },
58
+ ],
59
+ });
60
+ });
61
+ it('should prompt for build number when not provided', async () => {
62
+ mockRunCommandInDir.mockResolvedValue({
63
+ stdout: 'Build 1: Created 2023-01-01\nBuild 2: Created 2023-01-02',
64
+ stderr: '',
65
+ });
66
+ const result = await tool.handler(baseInput);
67
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/project', 'hs project list-builds --limit 100');
68
+ expect(result.content).toEqual([
69
+ {
70
+ type: 'text',
71
+ text: expect.stringContaining('Ask the user which build number they would like to deploy?'),
72
+ },
73
+ ]);
74
+ expect(result.content[0].text).toContain('Build 1: Created 2023-01-01');
75
+ });
76
+ it('should handle deployment with stderr', async () => {
77
+ mockRunCommandInDir.mockResolvedValue({
78
+ stdout: 'Deployed successfully',
79
+ stderr: 'Warning: deprecated feature used',
80
+ });
81
+ const input = {
82
+ ...baseInput,
83
+ buildNumber: 456,
84
+ };
85
+ const result = await tool.handler(input);
86
+ expect(result.content).toEqual([
87
+ { type: 'text', text: 'Deployed successfully' },
88
+ { type: 'text', text: 'Warning: deprecated feature used' },
89
+ ]);
90
+ });
91
+ it('should handle errors during list-builds command', async () => {
92
+ const error = new Error('Failed to list builds');
93
+ mockRunCommandInDir.mockRejectedValue(error);
94
+ // The error would be thrown and caught by the calling code
95
+ await expect(tool.handler(baseInput)).rejects.toThrow('Failed to list builds');
96
+ });
97
+ it('should handle errors during deploy command', async () => {
98
+ const error = new Error('Deployment failed');
99
+ mockRunCommandInDir.mockRejectedValue(error);
100
+ const input = {
101
+ ...baseInput,
102
+ buildNumber: 789,
103
+ };
104
+ await expect(tool.handler(input)).rejects.toThrow('Deployment failed');
105
+ });
106
+ it('should prompt for build when buildNumber is 0 (falsy)', async () => {
107
+ mockRunCommandInDir.mockResolvedValue({
108
+ stdout: 'Build 0: Initial build\nBuild 1: Latest build',
109
+ stderr: '',
110
+ });
111
+ const input = {
112
+ ...baseInput,
113
+ buildNumber: 0, // This is falsy, so it will prompt
114
+ };
115
+ const result = await tool.handler(input);
116
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/project', 'hs project list-builds --limit 100');
117
+ expect(result.content[0].text).toContain('Ask the user which build number they would like to deploy?');
118
+ });
119
+ });
120
+ });
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GuidedWalkthroughTool_1 = require("../GuidedWalkthroughTool");
4
+ const command_1 = require("../../../utils/command");
5
+ vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
6
+ vi.mock('../../../utils/command');
7
+ const mockExecAsync = command_1.execAsync;
8
+ describe('mcp-server/tools/project/GuidedWalkthroughTool', () => {
9
+ let mockMcpServer;
10
+ let tool;
11
+ let mockRegisteredTool;
12
+ beforeEach(() => {
13
+ vi.clearAllMocks();
14
+ // @ts-expect-error Not mocking whole server
15
+ mockMcpServer = {
16
+ registerTool: vi.fn(),
17
+ };
18
+ mockRegisteredTool = {};
19
+ mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
20
+ tool = new GuidedWalkthroughTool_1.GuidedWalkthroughTool(mockMcpServer);
21
+ });
22
+ describe('register', () => {
23
+ it('should register tool with correct parameters', () => {
24
+ const result = tool.register();
25
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('guided-walkthrough-hubspot-cli', {
26
+ title: 'Guided walkthrough of the CLI',
27
+ description: 'Give the user a guided walkthrough of the HubSpot CLI.',
28
+ inputSchema: expect.any(Object),
29
+ }, tool.handler);
30
+ expect(result).toBe(mockRegisteredTool);
31
+ });
32
+ });
33
+ describe('handler', () => {
34
+ it('should show help for hs init command', async () => {
35
+ const helpOutput = 'Usage: hs init [options]\nInitialize HubSpot CLI';
36
+ mockExecAsync.mockResolvedValue({
37
+ stdout: helpOutput,
38
+ stderr: '',
39
+ });
40
+ const result = await tool.handler({ command: 'hs init' });
41
+ expect(mockExecAsync).toHaveBeenCalledWith('hs init --help');
42
+ expect(result.content).toHaveLength(1);
43
+ expect(result.content[0].text).toContain(helpOutput);
44
+ expect(result.content[0].text).toContain('hs auth');
45
+ });
46
+ it('should show help for hs auth command', async () => {
47
+ const helpOutput = 'Usage: hs auth [options]\nAuthenticate with HubSpot';
48
+ mockExecAsync.mockResolvedValue({
49
+ stdout: helpOutput,
50
+ stderr: '',
51
+ });
52
+ const result = await tool.handler({ command: 'hs auth' });
53
+ expect(mockExecAsync).toHaveBeenCalledWith('hs auth --help');
54
+ expect(result.content[0].text).toContain(helpOutput);
55
+ expect(result.content[0].text).toContain('hs project create');
56
+ });
57
+ it('should show help for hs project create command', async () => {
58
+ const helpOutput = 'Usage: hs project create [options]\nCreate a new project';
59
+ mockExecAsync.mockResolvedValue({
60
+ stdout: helpOutput,
61
+ stderr: '',
62
+ });
63
+ const result = await tool.handler({ command: 'hs project create' });
64
+ expect(mockExecAsync).toHaveBeenCalledWith('hs project create --help');
65
+ expect(result.content[0].text).toContain(helpOutput);
66
+ expect(result.content[0].text).toContain('hs project upload');
67
+ });
68
+ it('should show help for hs project upload command', async () => {
69
+ const helpOutput = 'Usage: hs project upload [options]\nUpload project to HubSpot';
70
+ mockExecAsync.mockResolvedValue({
71
+ stdout: helpOutput,
72
+ stderr: '',
73
+ });
74
+ const result = await tool.handler({ command: 'hs project upload' });
75
+ expect(mockExecAsync).toHaveBeenCalledWith('hs project upload --help');
76
+ expect(result.content[0].text).toContain(helpOutput);
77
+ expect(result.content[0].text).toContain('hs project dev');
78
+ });
79
+ it('should handle command without next step', async () => {
80
+ const helpOutput = 'Usage: hs project dev [options]\nStart development server';
81
+ mockExecAsync.mockResolvedValue({
82
+ stdout: helpOutput,
83
+ stderr: '',
84
+ });
85
+ // Test with a command that doesn't have a next command
86
+ const result = await tool.handler({ command: 'hs project upload' });
87
+ expect(result.content[0].text).toContain(helpOutput);
88
+ expect(result.content[0].text).toContain('hs project dev');
89
+ });
90
+ it('should handle no command provided', async () => {
91
+ const result = await tool.handler({});
92
+ expect(mockExecAsync).not.toHaveBeenCalled();
93
+ expect(result.content).toEqual([
94
+ {
95
+ type: 'text',
96
+ text: 'Is there another command you would like to learn more about?',
97
+ },
98
+ ]);
99
+ });
100
+ it('should handle undefined command', async () => {
101
+ const result = await tool.handler({ command: undefined });
102
+ expect(mockExecAsync).not.toHaveBeenCalled();
103
+ expect(result.content).toEqual([
104
+ {
105
+ type: 'text',
106
+ text: 'Is there another command you would like to learn more about?',
107
+ },
108
+ ]);
109
+ });
110
+ it('should handle execAsync errors', async () => {
111
+ const error = new Error('Command not found');
112
+ mockExecAsync.mockRejectedValue(error);
113
+ await expect(tool.handler({ command: 'hs init' })).rejects.toThrow('Command not found');
114
+ });
115
+ it('should format help text with proper instructions', async () => {
116
+ const helpOutput = 'Usage: hs init\nOptions:\n --help Show help';
117
+ mockExecAsync.mockResolvedValue({
118
+ stdout: helpOutput,
119
+ stderr: '',
120
+ });
121
+ const result = await tool.handler({ command: 'hs init' });
122
+ expect(result.content[0].text).toContain('Display this help output for the user amd wait for them to acknowledge:');
123
+ expect(result.content[0].text).toContain(helpOutput);
124
+ expect(result.content[0].text).toContain('Once they are ready, A good command to look at next is hs auth');
125
+ });
126
+ });
127
+ });