@hubspot/cli 7.10.0-beta.0 → 7.10.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/commands/account/__tests__/rename.test.js +35 -0
  2. package/commands/account/rename.d.ts +1 -1
  3. package/commands/account/rename.js +5 -2
  4. package/commands/config/set.js +1 -2
  5. package/commands/getStarted.js +8 -2
  6. package/commands/hubdb.d.ts +1 -1
  7. package/commands/project/dev/index.js +8 -1
  8. package/commands/project/listBuilds.js +7 -1
  9. package/commands/project/upload.js +7 -1
  10. package/commands/project/validate.js +7 -1
  11. package/commands/project/watch.js +7 -2
  12. package/commands/testAccount/__tests__/create.test.js +68 -0
  13. package/commands/testAccount/create.d.ts +8 -0
  14. package/commands/testAccount/create.js +133 -43
  15. package/commands/testAccount/importData.d.ts +1 -1
  16. package/lang/en.d.ts +3199 -3204
  17. package/lang/en.js +24 -3
  18. package/lib/constants.d.ts +1 -0
  19. package/lib/constants.js +6 -0
  20. package/lib/mcp/__tests__/setup.test.d.ts +1 -0
  21. package/lib/mcp/__tests__/setup.test.js +127 -0
  22. package/lib/mcp/setup.d.ts +4 -12
  23. package/lib/mcp/setup.js +34 -1
  24. package/lib/middleware/autoUpdateMiddleware.d.ts +3 -1
  25. package/lib/middleware/autoUpdateMiddleware.js +1 -0
  26. package/lib/projects/__tests__/components.test.js +148 -24
  27. package/lib/projects/__tests__/projects.test.js +13 -42
  28. package/lib/projects/components.js +76 -20
  29. package/lib/projects/config.js +5 -9
  30. package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +1 -0
  31. package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +153 -0
  32. package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +5 -0
  33. package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +76 -66
  34. package/mcp-server/tools/cms/HsCreateFunctionTool.js +6 -0
  35. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
  36. package/mcp-server/tools/cms/HsCreateModuleTool.js +6 -0
  37. package/mcp-server/tools/cms/HsCreateTemplateTool.js +6 -0
  38. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -4
  39. package/mcp-server/tools/cms/HsFunctionLogsTool.js +4 -0
  40. package/mcp-server/tools/cms/HsListFunctionsTool.js +4 -0
  41. package/mcp-server/tools/cms/HsListTool.js +4 -0
  42. package/mcp-server/tools/index.js +2 -0
  43. package/mcp-server/tools/project/AddFeatureToProjectTool.js +6 -0
  44. package/mcp-server/tools/project/CreateProjectTool.js +6 -0
  45. package/mcp-server/tools/project/CreateTestAccountTool.d.ts +41 -0
  46. package/mcp-server/tools/project/CreateTestAccountTool.js +150 -0
  47. package/mcp-server/tools/project/DeployProjectTool.js +6 -0
  48. package/mcp-server/tools/project/DocFetchTool.js +4 -0
  49. package/mcp-server/tools/project/DocsSearchTool.js +4 -0
  50. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +4 -0
  51. package/mcp-server/tools/project/GetApplicationInfoTool.js +4 -0
  52. package/mcp-server/tools/project/GetConfigValuesTool.js +4 -0
  53. package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -0
  54. package/mcp-server/tools/project/UploadProjectTools.js +6 -0
  55. package/mcp-server/tools/project/ValidateProjectTool.js +4 -0
  56. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +1 -0
  57. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +444 -0
  58. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +2 -2
  59. package/package.json +1 -1
@@ -0,0 +1,444 @@
1
+ import { CreateTestAccountTool, } from '../CreateTestAccountTool.js';
2
+ import { runCommandInDir } from '../../../utils/project.js';
3
+ import { addFlag } from '../../../utils/command.js';
4
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
5
+ import fs from 'fs';
6
+ vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
7
+ vi.mock('../../../utils/project');
8
+ vi.mock('../../../utils/command');
9
+ vi.mock('../../../utils/toolUsageTracking');
10
+ vi.mock('../../../utils/feedbackTracking');
11
+ vi.mock('fs');
12
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
13
+ const mockRunCommandInDir = runCommandInDir;
14
+ const mockAddFlag = addFlag;
15
+ const mockReadFileSync = fs.readFileSync;
16
+ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
17
+ let mockMcpServer;
18
+ let tool;
19
+ let mockRegisteredTool;
20
+ beforeEach(() => {
21
+ vi.clearAllMocks();
22
+ // @ts-expect-error Not mocking the whole server
23
+ mockMcpServer = {
24
+ registerTool: vi.fn(),
25
+ };
26
+ mockRegisteredTool = {};
27
+ mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
29
+ tool = new CreateTestAccountTool(mockMcpServer);
30
+ // Mock addFlag to simulate command building
31
+ mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
32
+ // Mock fs.readFileSync for config file tests
33
+ mockReadFileSync.mockReturnValue(JSON.stringify({
34
+ accountName: 'TestAccountFromConfig',
35
+ description: 'Test description',
36
+ marketingLevel: 'PROFESSIONAL',
37
+ }));
38
+ });
39
+ describe('register', () => {
40
+ it('should register tool with correct parameters', () => {
41
+ const result = tool.register();
42
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-test-account', expect.objectContaining({
43
+ title: 'Create HubSpot Test Account',
44
+ description: expect.stringContaining('Creates a HubSpot developer test account'),
45
+ inputSchema: expect.any(Object),
46
+ }), expect.any(Function));
47
+ expect(result).toBe(mockRegisteredTool);
48
+ });
49
+ it('should include all key information in description', () => {
50
+ tool.register();
51
+ const registerCall = mockMcpServer.registerTool.mock.calls[0];
52
+ const config = registerCall[1];
53
+ expect(config.description).toContain('test account');
54
+ expect(config.description).toContain('WORKFLOW');
55
+ expect(config.description).toContain('config file');
56
+ expect(config.description).toContain('ALL account details');
57
+ expect(config.description).toContain('non-interactive execution');
58
+ expect(config.description).toContain('FREE, STARTER, PROFESSIONAL, ENTERPRISE');
59
+ });
60
+ });
61
+ describe('handler', () => {
62
+ describe('config file approach', () => {
63
+ const baseInput = {
64
+ absoluteCurrentWorkingDirectory: '/test/workspace',
65
+ configPath: './test-account.json',
66
+ description: 'Test account',
67
+ marketingLevel: 'ENTERPRISE',
68
+ opsLevel: 'ENTERPRISE',
69
+ serviceLevel: 'ENTERPRISE',
70
+ salesLevel: 'ENTERPRISE',
71
+ contentLevel: 'ENTERPRISE',
72
+ };
73
+ it('should create test account with config path', async () => {
74
+ mockRunCommandInDir.mockResolvedValue({
75
+ stdout: 'Test account created successfully\nAccount ID: 12345678',
76
+ stderr: '',
77
+ });
78
+ const result = await tool.handler(baseInput);
79
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'config-path', './test-account.json');
80
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/workspace', 'hs test-account create --config-path "./test-account.json"');
81
+ expect(result).toEqual({
82
+ content: [
83
+ {
84
+ type: 'text',
85
+ text: 'Test account created successfully\nAccount ID: 12345678',
86
+ },
87
+ { type: 'text', text: '' },
88
+ ],
89
+ });
90
+ });
91
+ it('should handle absolute config path', async () => {
92
+ mockRunCommandInDir.mockResolvedValue({
93
+ stdout: 'Account created',
94
+ stderr: '',
95
+ });
96
+ const input = {
97
+ absoluteCurrentWorkingDirectory: '/test/workspace',
98
+ configPath: '/absolute/path/to/config.json',
99
+ description: 'Test account',
100
+ marketingLevel: 'ENTERPRISE',
101
+ opsLevel: 'ENTERPRISE',
102
+ serviceLevel: 'ENTERPRISE',
103
+ salesLevel: 'ENTERPRISE',
104
+ contentLevel: 'ENTERPRISE',
105
+ };
106
+ await tool.handler(input);
107
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'config-path', '/absolute/path/to/config.json');
108
+ expect(mockRunCommandInDir).toHaveBeenCalledWith('/test/workspace', 'hs test-account create --config-path "/absolute/path/to/config.json"');
109
+ });
110
+ it('should prioritize config path over flags', async () => {
111
+ mockRunCommandInDir.mockResolvedValue({
112
+ stdout: 'Account created',
113
+ stderr: '',
114
+ });
115
+ const input = {
116
+ absoluteCurrentWorkingDirectory: '/test/workspace',
117
+ configPath: './test-account.json',
118
+ name: 'FlagAccount',
119
+ description: 'This should be ignored',
120
+ marketingLevel: 'ENTERPRISE',
121
+ opsLevel: 'ENTERPRISE',
122
+ serviceLevel: 'ENTERPRISE',
123
+ salesLevel: 'ENTERPRISE',
124
+ contentLevel: 'ENTERPRISE',
125
+ };
126
+ await tool.handler(input);
127
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'config-path', './test-account.json');
128
+ // Should not call addFlag for name or description
129
+ expect(mockAddFlag).not.toHaveBeenCalledWith(expect.anything(), 'name', expect.anything());
130
+ });
131
+ it('should return helpful error when config file does not exist', async () => {
132
+ mockReadFileSync.mockImplementation(() => {
133
+ throw new Error("ENOENT: no such file or directory, open './missing-config.json'");
134
+ });
135
+ const input = {
136
+ absoluteCurrentWorkingDirectory: '/test/workspace',
137
+ configPath: './missing-config.json',
138
+ };
139
+ const result = await tool.handler(input);
140
+ expect(mockRunCommandInDir).not.toHaveBeenCalled();
141
+ expect(result).toEqual({
142
+ content: [
143
+ {
144
+ type: 'text',
145
+ text: expect.stringContaining('Failed to read or parse config file at "./missing-config.json"'),
146
+ },
147
+ ],
148
+ });
149
+ expect(result.content[0]).toHaveProperty('text', expect.stringContaining('Please ensure the file exists and contains valid JSON'));
150
+ });
151
+ it('should return helpful error when config file contains invalid JSON', async () => {
152
+ mockReadFileSync.mockReturnValue('{ invalid json }');
153
+ const input = {
154
+ absoluteCurrentWorkingDirectory: '/test/workspace',
155
+ configPath: './invalid-config.json',
156
+ };
157
+ const result = await tool.handler(input);
158
+ expect(mockRunCommandInDir).not.toHaveBeenCalled();
159
+ expect(result).toEqual({
160
+ content: [
161
+ {
162
+ type: 'text',
163
+ text: expect.stringContaining('Failed to read or parse config file at "./invalid-config.json"'),
164
+ },
165
+ ],
166
+ });
167
+ });
168
+ });
169
+ describe('flag-based approach', () => {
170
+ it('should create test account with name and all defaults', async () => {
171
+ mockRunCommandInDir.mockResolvedValue({
172
+ stdout: 'Test account created successfully',
173
+ stderr: '',
174
+ });
175
+ const input = {
176
+ absoluteCurrentWorkingDirectory: '/test/workspace',
177
+ name: 'MyTestAccount',
178
+ description: '',
179
+ marketingLevel: 'ENTERPRISE',
180
+ opsLevel: 'ENTERPRISE',
181
+ serviceLevel: 'ENTERPRISE',
182
+ salesLevel: 'ENTERPRISE',
183
+ contentLevel: 'ENTERPRISE',
184
+ };
185
+ await tool.handler(input);
186
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MyTestAccount');
187
+ });
188
+ it('should add all flags with defaults when only name is provided', async () => {
189
+ mockRunCommandInDir.mockResolvedValue({
190
+ stdout: 'Test account created successfully',
191
+ stderr: '',
192
+ });
193
+ const input = {
194
+ absoluteCurrentWorkingDirectory: '/test/workspace',
195
+ name: 'MyTestAccount',
196
+ };
197
+ await tool.handler(input);
198
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MyTestAccount');
199
+ // Implementation uses name as fallback for description, and adds all hub levels with ENTERPRISE defaults
200
+ expect(mockAddFlag).toHaveBeenCalledTimes(7);
201
+ expect(mockRunCommandInDir).toHaveBeenCalled();
202
+ });
203
+ it('should create test account with account name and description', async () => {
204
+ mockRunCommandInDir.mockResolvedValue({
205
+ stdout: 'Test account created',
206
+ stderr: '',
207
+ });
208
+ const input = {
209
+ absoluteCurrentWorkingDirectory: '/test/workspace',
210
+ name: 'MyTestAccount',
211
+ description: 'Test account for development',
212
+ marketingLevel: 'ENTERPRISE',
213
+ opsLevel: 'ENTERPRISE',
214
+ serviceLevel: 'ENTERPRISE',
215
+ salesLevel: 'ENTERPRISE',
216
+ contentLevel: 'ENTERPRISE',
217
+ };
218
+ await tool.handler(input);
219
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MyTestAccount');
220
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.stringContaining('name'), 'description', 'Test account for development');
221
+ });
222
+ it('should create test account with specific hub levels', async () => {
223
+ mockRunCommandInDir.mockResolvedValue({
224
+ stdout: 'Test account created',
225
+ stderr: '',
226
+ });
227
+ const input = {
228
+ absoluteCurrentWorkingDirectory: '/test/workspace',
229
+ name: 'MixedTierAccount',
230
+ description: 'Test account',
231
+ marketingLevel: 'PROFESSIONAL',
232
+ salesLevel: 'STARTER',
233
+ contentLevel: 'FREE',
234
+ serviceLevel: 'ENTERPRISE',
235
+ opsLevel: 'ENTERPRISE',
236
+ };
237
+ await tool.handler(input);
238
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MixedTierAccount');
239
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.stringContaining('name'), 'marketing-level', 'PROFESSIONAL');
240
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.stringContaining('marketing-level'), 'sales-level', 'STARTER');
241
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.stringContaining('sales-level'), 'content-level', 'FREE');
242
+ });
243
+ it('should create test account with all hub levels specified', async () => {
244
+ mockRunCommandInDir.mockResolvedValue({
245
+ stdout: 'Test account created',
246
+ stderr: '',
247
+ });
248
+ const input = {
249
+ absoluteCurrentWorkingDirectory: '/test/workspace',
250
+ name: 'AllHubsAccount',
251
+ description: 'Full configuration',
252
+ marketingLevel: 'ENTERPRISE',
253
+ opsLevel: 'PROFESSIONAL',
254
+ serviceLevel: 'STARTER',
255
+ salesLevel: 'ENTERPRISE',
256
+ contentLevel: 'PROFESSIONAL',
257
+ };
258
+ await tool.handler(input);
259
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'AllHubsAccount');
260
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'description', 'Full configuration');
261
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'marketing-level', 'ENTERPRISE');
262
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'ops-level', 'PROFESSIONAL');
263
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'service-level', 'STARTER');
264
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'sales-level', 'ENTERPRISE');
265
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'content-level', 'PROFESSIONAL');
266
+ });
267
+ });
268
+ describe('handler defaults', () => {
269
+ it('should use ENTERPRISE defaults for all hub levels when not specified', async () => {
270
+ mockRunCommandInDir.mockResolvedValue({
271
+ stdout: 'Test account created',
272
+ stderr: '',
273
+ });
274
+ const input = {
275
+ absoluteCurrentWorkingDirectory: '/test/workspace',
276
+ name: 'DefaultLevelsAccount',
277
+ description: '',
278
+ marketingLevel: 'ENTERPRISE',
279
+ opsLevel: 'ENTERPRISE',
280
+ serviceLevel: 'ENTERPRISE',
281
+ salesLevel: 'ENTERPRISE',
282
+ contentLevel: 'ENTERPRISE',
283
+ };
284
+ await tool.handler(input);
285
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'DefaultLevelsAccount');
286
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'marketing-level', 'ENTERPRISE');
287
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'ops-level', 'ENTERPRISE');
288
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'service-level', 'ENTERPRISE');
289
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'sales-level', 'ENTERPRISE');
290
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'content-level', 'ENTERPRISE');
291
+ });
292
+ it('should use name as fallback for description when description is empty', async () => {
293
+ mockRunCommandInDir.mockResolvedValue({
294
+ stdout: 'Test account created',
295
+ stderr: '',
296
+ });
297
+ const input = {
298
+ absoluteCurrentWorkingDirectory: '/test/workspace',
299
+ name: 'NoDescriptionAccount',
300
+ description: '',
301
+ marketingLevel: 'ENTERPRISE',
302
+ opsLevel: 'ENTERPRISE',
303
+ serviceLevel: 'ENTERPRISE',
304
+ salesLevel: 'ENTERPRISE',
305
+ contentLevel: 'ENTERPRISE',
306
+ };
307
+ await tool.handler(input);
308
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'NoDescriptionAccount');
309
+ // Implementation uses name as fallback for description
310
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'description', 'NoDescriptionAccount');
311
+ });
312
+ it('should use defaults for some hub levels while respecting explicit values', async () => {
313
+ mockRunCommandInDir.mockResolvedValue({
314
+ stdout: 'Test account created',
315
+ stderr: '',
316
+ });
317
+ const input = {
318
+ absoluteCurrentWorkingDirectory: '/test/workspace',
319
+ name: 'PartialLevelsAccount',
320
+ description: '',
321
+ marketingLevel: 'FREE',
322
+ salesLevel: 'STARTER',
323
+ opsLevel: 'ENTERPRISE',
324
+ serviceLevel: 'ENTERPRISE',
325
+ contentLevel: 'ENTERPRISE',
326
+ };
327
+ await tool.handler(input);
328
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'PartialLevelsAccount');
329
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'marketing-level', 'FREE');
330
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'sales-level', 'STARTER');
331
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'ops-level', 'ENTERPRISE');
332
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'service-level', 'ENTERPRISE');
333
+ expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'content-level', 'ENTERPRISE');
334
+ });
335
+ it('should add all hub level flags when defaults are applied', async () => {
336
+ mockRunCommandInDir.mockResolvedValue({
337
+ stdout: 'Test account created with defaults',
338
+ stderr: '',
339
+ });
340
+ const input = {
341
+ absoluteCurrentWorkingDirectory: '/test/workspace',
342
+ name: 'MinimalAccount',
343
+ description: '',
344
+ marketingLevel: 'ENTERPRISE',
345
+ opsLevel: 'ENTERPRISE',
346
+ serviceLevel: 'ENTERPRISE',
347
+ salesLevel: 'ENTERPRISE',
348
+ contentLevel: 'ENTERPRISE',
349
+ };
350
+ const result = await tool.handler(input);
351
+ expect(mockRunCommandInDir).toHaveBeenCalled();
352
+ expect(mockAddFlag).toHaveBeenCalledTimes(7);
353
+ expect(result.content[0]).toEqual({
354
+ type: 'text',
355
+ text: 'Test account created with defaults',
356
+ });
357
+ });
358
+ it('should use ENTERPRISE defaults when values are undefined', async () => {
359
+ mockRunCommandInDir.mockResolvedValue({
360
+ stdout: 'Test account created',
361
+ stderr: '',
362
+ });
363
+ const input = {
364
+ absoluteCurrentWorkingDirectory: '/test/workspace',
365
+ name: 'BypassedDefaultsAccount',
366
+ };
367
+ await tool.handler(input);
368
+ expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'BypassedDefaultsAccount');
369
+ expect(mockAddFlag).toHaveBeenCalledTimes(7);
370
+ });
371
+ });
372
+ describe('interactive mode', () => {
373
+ it('should ask for parameters when neither config nor name provided', async () => {
374
+ const input = {
375
+ absoluteCurrentWorkingDirectory: '/test/workspace',
376
+ description: 'Test account',
377
+ marketingLevel: 'ENTERPRISE',
378
+ opsLevel: 'ENTERPRISE',
379
+ serviceLevel: 'ENTERPRISE',
380
+ salesLevel: 'ENTERPRISE',
381
+ contentLevel: 'ENTERPRISE',
382
+ };
383
+ const result = await tool.handler(input);
384
+ // Should NOT run the command
385
+ expect(mockRunCommandInDir).not.toHaveBeenCalled();
386
+ // Should return a message asking for information
387
+ expect(result).toEqual({
388
+ content: [
389
+ {
390
+ type: 'text',
391
+ text: 'Ask the user for the account config JSON path or the name of the test account to create.',
392
+ },
393
+ ],
394
+ });
395
+ });
396
+ });
397
+ describe('error handling', () => {
398
+ it('should handle command output with stderr warnings', async () => {
399
+ mockRunCommandInDir.mockResolvedValue({
400
+ stdout: 'Test account created successfully',
401
+ stderr: 'Warning: Some non-critical warning message',
402
+ });
403
+ const input = {
404
+ absoluteCurrentWorkingDirectory: '/test/workspace',
405
+ configPath: './test-account.json',
406
+ description: 'Test account',
407
+ marketingLevel: 'ENTERPRISE',
408
+ opsLevel: 'ENTERPRISE',
409
+ serviceLevel: 'ENTERPRISE',
410
+ salesLevel: 'ENTERPRISE',
411
+ contentLevel: 'ENTERPRISE',
412
+ };
413
+ const result = await tool.handler(input);
414
+ expect(result).toEqual({
415
+ content: [
416
+ { type: 'text', text: 'Test account created successfully' },
417
+ {
418
+ type: 'text',
419
+ text: 'Warning: Some non-critical warning message',
420
+ },
421
+ ],
422
+ });
423
+ });
424
+ it('should handle command execution errors', async () => {
425
+ const error = new Error('Failed to create test account');
426
+ mockRunCommandInDir.mockRejectedValue(error);
427
+ const input = {
428
+ absoluteCurrentWorkingDirectory: '/test/workspace',
429
+ configPath: './test-account.json',
430
+ description: 'Test account',
431
+ marketingLevel: 'ENTERPRISE',
432
+ opsLevel: 'ENTERPRISE',
433
+ serviceLevel: 'ENTERPRISE',
434
+ salesLevel: 'ENTERPRISE',
435
+ contentLevel: 'ENTERPRISE',
436
+ };
437
+ const result = await tool.handler(input);
438
+ expect(result).toEqual({
439
+ content: [{ type: 'text', text: 'Failed to create test account' }],
440
+ });
441
+ });
442
+ });
443
+ });
444
+ });
@@ -31,11 +31,11 @@ describe('mcp-server/tools/project/DocsSearchTool', () => {
31
31
  describe('register', () => {
32
32
  it('should register tool with correct parameters and enhanced description', () => {
33
33
  const result = tool.register();
34
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('search-docs', {
34
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('search-docs', expect.objectContaining({
35
35
  title: 'Search HubSpot Developer Documentation',
36
36
  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.',
37
37
  inputSchema: expect.any(Object),
38
- }, expect.any(Function));
38
+ }), expect.any(Function));
39
39
  expect(result).toBe(mockRegisteredTool);
40
40
  });
41
41
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.10.0-beta.0",
3
+ "version": "7.10.0-beta.2",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",