@hubspot/cli 7.9.0-beta.1 → 7.9.0-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 (105) hide show
  1. package/commands/__tests__/project.test.js +2 -0
  2. package/commands/account/createOverride.js +2 -12
  3. package/commands/account/removeOverride.js +2 -10
  4. package/commands/cms/theme/preview.js +1 -4
  5. package/commands/getStarted.js +7 -19
  6. package/commands/project/__tests__/deploy.test.js +4 -3
  7. package/commands/project/__tests__/updateDeps.test.d.ts +1 -0
  8. package/commands/project/__tests__/updateDeps.test.js +142 -0
  9. package/commands/project/create.js +0 -1
  10. package/commands/project/updateDeps.d.ts +6 -0
  11. package/commands/project/updateDeps.js +80 -0
  12. package/commands/project.js +2 -0
  13. package/commands/testAccount/create.js +1 -1
  14. package/lang/en.d.ts +30 -15
  15. package/lang/en.js +32 -18
  16. package/lib/__tests__/dependencyManagement.test.js +273 -1
  17. package/lib/__tests__/npm.test.js +1 -1
  18. package/lib/__tests__/sandboxSync.test.js +1 -1
  19. package/lib/__tests__/usageTracking.test.js +2 -2
  20. package/lib/commonOpts.js +2 -5
  21. package/lib/configMigrate.js +3 -3
  22. package/lib/dependencyManagement.d.ts +8 -2
  23. package/lib/dependencyManagement.js +75 -12
  24. package/lib/doctor/DiagnosticInfoBuilder.js +1 -1
  25. package/lib/doctor/Doctor.js +1 -1
  26. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +4 -2
  27. package/lib/doctor/__tests__/Doctor.test.js +1 -1
  28. package/lib/jsonLoader.d.ts +14 -0
  29. package/lib/jsonLoader.js +60 -0
  30. package/lib/middleware/__test__/requestMiddleware.test.js +1 -1
  31. package/lib/middleware/autoUpdateMiddleware.js +1 -1
  32. package/lib/middleware/commandTargetingUtils.js +1 -0
  33. package/lib/middleware/fireAlarmMiddleware.js +1 -1
  34. package/lib/middleware/notificationsMiddleware.js +1 -1
  35. package/lib/middleware/requestMiddleware.js +1 -1
  36. package/lib/npm.d.ts +3 -0
  37. package/lib/npm.js +7 -1
  38. package/lib/projects/__tests__/AppDevModeInterface.test.js +3 -0
  39. package/lib/projects/__tests__/platformVersion.test.js +5 -1
  40. package/lib/projects/create/__tests__/v2.test.js +20 -14
  41. package/lib/projects/create/v2.js +8 -13
  42. package/lib/projects/localDev/LocalDevLogger.js +2 -2
  43. package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +3 -3
  44. package/lib/projects/localDev/LocalDevWebsocketServer.js +1 -1
  45. package/lib/projects/platformVersion.js +1 -1
  46. package/lib/prompts/promptUtils.d.ts +8 -0
  47. package/lib/prompts/promptUtils.js +7 -1
  48. package/lib/prompts/selectProjectTemplatePrompt.js +4 -0
  49. package/lib/sandboxSync.js +1 -1
  50. package/lib/usageTracking.js +2 -2
  51. package/mcp-server/tools/cms/HsCreateFunctionTool.js +2 -2
  52. package/mcp-server/tools/cms/HsCreateModuleTool.js +2 -2
  53. package/mcp-server/tools/cms/HsCreateTemplateTool.js +2 -2
  54. package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -9
  55. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  56. package/mcp-server/tools/cms/HsListTool.js +1 -1
  57. package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +7 -4
  58. package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +7 -3
  59. package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +7 -4
  60. package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +5 -1
  61. package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +8 -3
  62. package/mcp-server/tools/cms/__tests__/HsListTool.test.js +8 -3
  63. package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +4 -1
  64. package/mcp-server/tools/project/AddFeatureToProjectTool.js +6 -5
  65. package/mcp-server/tools/project/CreateProjectTool.js +2 -2
  66. package/mcp-server/tools/project/DeployProjectTool.d.ts +4 -1
  67. package/mcp-server/tools/project/DeployProjectTool.js +4 -3
  68. package/mcp-server/tools/project/DocFetchTool.d.ts +4 -1
  69. package/mcp-server/tools/project/DocFetchTool.js +7 -6
  70. package/mcp-server/tools/project/DocsSearchTool.js +5 -5
  71. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +4 -1
  72. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +7 -5
  73. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +8 -2
  74. package/mcp-server/tools/project/GetApplicationInfoTool.js +7 -6
  75. package/mcp-server/tools/project/GetConfigValuesTool.js +4 -4
  76. package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +4 -1
  77. package/mcp-server/tools/project/GuidedWalkthroughTool.js +6 -14
  78. package/mcp-server/tools/project/UploadProjectTools.d.ts +4 -1
  79. package/mcp-server/tools/project/UploadProjectTools.js +4 -3
  80. package/mcp-server/tools/project/ValidateProjectTool.d.ts +4 -1
  81. package/mcp-server/tools/project/ValidateProjectTool.js +5 -4
  82. package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +6 -1
  83. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +7 -3
  84. package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +7 -2
  85. package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +8 -3
  86. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +6 -2
  87. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +8 -3
  88. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +9 -5
  89. package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +6 -2
  90. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +43 -13
  91. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +8 -2
  92. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +8 -2
  93. package/mcp-server/utils/__tests__/content.test.d.ts +1 -0
  94. package/mcp-server/utils/__tests__/content.test.js +166 -0
  95. package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +1 -0
  96. package/mcp-server/utils/__tests__/feedbackTracking.test.js +121 -0
  97. package/mcp-server/utils/content.d.ts +1 -1
  98. package/mcp-server/utils/content.js +8 -1
  99. package/mcp-server/utils/feedbackTracking.d.ts +1 -0
  100. package/mcp-server/utils/feedbackTracking.js +41 -0
  101. package/package.json +2 -2
  102. package/commands/project/__tests__/fixtures/exampleProject.json +0 -33
  103. package/lang/en.lyaml +0 -1508
  104. package/lib/lang.d.ts +0 -8
  105. package/lib/lang.js +0 -72
@@ -85,7 +85,7 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
85
85
  else if (isSpecifiedError(err, {
86
86
  statusCode: 404,
87
87
  })) {
88
- uiCommandDisabledBanner('hs sandbox sync', 'https://app.hubspot.com/l/docs/guides/crm/project-cli-commands#developer-projects-cli-commands-beta');
88
+ uiCommandDisabledBanner('hs sandbox sync', 'https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/project-commands');
89
89
  }
90
90
  else {
91
91
  logError(err, new ApiErrorContext({
@@ -2,9 +2,9 @@ import { trackUsage } from '@hubspot/local-dev-lib/trackUsage';
2
2
  import { isTrackingAllowed, getAccountConfig, } from '@hubspot/local-dev-lib/config';
3
3
  import { API_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
4
4
  import { uiLogger } from './ui/logger.js';
5
- import packageJson from '../package.json' with { type: 'json' };
6
- const version = packageJson.version;
5
+ import { pkg } from './jsonLoader.js';
7
6
  import { debugError } from './errorHandlers/index.js';
7
+ const version = pkg.version;
8
8
  export const EventClass = {
9
9
  USAGE: 'USAGE',
10
10
  INTERACTION: 'INTERACTION',
@@ -80,10 +80,10 @@ export class HsCreateFunctionTool extends Tool {
80
80
  }
81
81
  try {
82
82
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
83
- return formatTextContents(stdout, stderr);
83
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
84
84
  }
85
85
  catch (error) {
86
- return formatTextContents(error instanceof Error ? error.message : `${error}`);
86
+ return formatTextContents(absoluteCurrentWorkingDirectory, error instanceof Error ? error.message : `${error}`);
87
87
  }
88
88
  }
89
89
  register() {
@@ -102,10 +102,10 @@ export class HsCreateModuleTool extends Tool {
102
102
  }
103
103
  try {
104
104
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
105
- return formatTextContents(stdout, stderr);
105
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
106
106
  }
107
107
  catch (error) {
108
- return formatTextContents(error instanceof Error ? error.message : `${error}`);
108
+ return formatTextContents(absoluteCurrentWorkingDirectory, error instanceof Error ? error.message : `${error}`);
109
109
  }
110
110
  }
111
111
  register() {
@@ -59,10 +59,10 @@ export class HsCreateTemplateTool extends Tool {
59
59
  }
60
60
  try {
61
61
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
62
- return formatTextContents(stdout, stderr);
62
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
63
63
  }
64
64
  catch (error) {
65
- return formatTextContents(error instanceof Error ? error.message : `${error}`);
65
+ return formatTextContents(absoluteCurrentWorkingDirectory, error instanceof Error ? error.message : `${error}`);
66
66
  }
67
67
  }
68
68
  register() {
@@ -52,18 +52,11 @@ export class HsFunctionLogsTool extends Tool {
52
52
  }
53
53
  try {
54
54
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
55
- return formatTextContents(stdout, stderr);
55
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
56
56
  }
57
57
  catch (error) {
58
58
  const errorMessage = error instanceof Error ? error.message : String(error);
59
- return {
60
- content: [
61
- {
62
- type: 'text',
63
- text: `Error executing hs logs command: ${errorMessage}`,
64
- },
65
- ],
66
- };
59
+ return formatTextContents(absoluteCurrentWorkingDirectory, `Error executing hs logs command: ${errorMessage}`);
67
60
  }
68
61
  }
69
62
  register() {
@@ -34,7 +34,7 @@ export class HsListFunctionsTool extends Tool {
34
34
  }
35
35
  try {
36
36
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
37
- return formatTextContents(stdout, stderr);
37
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
38
38
  }
39
39
  catch (error) {
40
40
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -34,7 +34,7 @@ export class HsListTool extends Tool {
34
34
  }
35
35
  try {
36
36
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
37
- return formatTextContents(stdout, stderr);
37
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
38
38
  }
39
39
  catch (error) {
40
40
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -2,13 +2,15 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { HsCreateFunctionTool } from '../HsCreateFunctionTool.js';
3
3
  import { runCommandInDir } from '../../../utils/project.js';
4
4
  import { addFlag } from '../../../utils/command.js';
5
- import { HTTP_METHODS } from '../../../../types/Cms.js';
5
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
6
6
  vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
7
7
  vi.mock('../../../utils/project');
8
8
  vi.mock('../../../utils/command');
9
9
  vi.mock('../../../utils/toolUsageTracking', () => ({
10
10
  trackToolUsage: vi.fn(),
11
11
  }));
12
+ vi.mock('../../../utils/feedbackTracking');
13
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
12
14
  const mockRunCommandInDir = runCommandInDir;
13
15
  const mockAddFlag = addFlag;
14
16
  describe('HsCreateFunctionTool', () => {
@@ -23,16 +25,17 @@ describe('HsCreateFunctionTool', () => {
23
25
  };
24
26
  mockRegisteredTool = {};
25
27
  mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
26
29
  tool = new HsCreateFunctionTool(mockMcpServer);
27
30
  });
28
31
  describe('register', () => {
29
32
  it('should register the tool with the MCP server', () => {
30
33
  const result = tool.register();
31
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-cms-function', {
34
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-cms-function', expect.objectContaining({
32
35
  title: 'Create HubSpot CMS Serverless Function',
33
- description: `Creates a new HubSpot CMS serverless function using the hs create function command. Functions can be created non-interactively by specifying functionsFolder, filename, and endpointPath. Supports all HTTP methods (${HTTP_METHODS.join(', ')}).`,
36
+ description: expect.stringContaining('Creates a new HubSpot CMS serverless function'),
34
37
  inputSchema: expect.any(Object),
35
- }, expect.any(Function));
38
+ }), expect.any(Function));
36
39
  expect(result).toBe(mockRegisteredTool);
37
40
  });
38
41
  });
@@ -2,12 +2,15 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { HsCreateModuleTool } from '../HsCreateModuleTool.js';
3
3
  import { runCommandInDir } from '../../../utils/project.js';
4
4
  import { addFlag } from '../../../utils/command.js';
5
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
5
6
  vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
6
7
  vi.mock('../../../utils/project');
7
8
  vi.mock('../../../utils/command');
8
9
  vi.mock('../../../utils/toolUsageTracking', () => ({
9
10
  trackToolUsage: vi.fn(),
10
11
  }));
12
+ vi.mock('../../../utils/feedbackTracking');
13
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
11
14
  const mockRunCommandInDir = runCommandInDir;
12
15
  const mockAddFlag = addFlag;
13
16
  describe('HsCreateModuleTool', () => {
@@ -22,16 +25,17 @@ describe('HsCreateModuleTool', () => {
22
25
  };
23
26
  mockRegisteredTool = {};
24
27
  mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
25
29
  tool = new HsCreateModuleTool(mockMcpServer);
26
30
  });
27
31
  describe('register', () => {
28
32
  it('should register the tool with the MCP server', () => {
29
33
  const result = tool.register();
30
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-cms-module', {
34
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-cms-module', expect.objectContaining({
31
35
  title: 'Create HubSpot CMS Module',
32
- description: 'Creates a new HubSpot CMS module using the hs create module command. Modules can be created non-interactively by specifying moduleLabel and other module options. You can create either HubL or React modules by setting the reactType parameter.',
36
+ description: expect.stringContaining('Creates a new HubSpot CMS module'),
33
37
  inputSchema: expect.any(Object),
34
- }, expect.any(Function));
38
+ }), expect.any(Function));
35
39
  expect(result).toBe(mockRegisteredTool);
36
40
  });
37
41
  });
@@ -2,13 +2,15 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { HsCreateTemplateTool } from '../HsCreateTemplateTool.js';
3
3
  import { runCommandInDir } from '../../../utils/project.js';
4
4
  import { addFlag } from '../../../utils/command.js';
5
- import { TEMPLATE_TYPES } from '../../../../types/Cms.js';
5
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
6
6
  vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
7
7
  vi.mock('../../../utils/project');
8
8
  vi.mock('../../../utils/command');
9
9
  vi.mock('../../../utils/toolUsageTracking', () => ({
10
10
  trackToolUsage: vi.fn(),
11
11
  }));
12
+ vi.mock('../../../utils/feedbackTracking');
13
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
12
14
  const mockRunCommandInDir = runCommandInDir;
13
15
  const mockAddFlag = addFlag;
14
16
  describe('HsCreateTemplateTool', () => {
@@ -23,16 +25,17 @@ describe('HsCreateTemplateTool', () => {
23
25
  };
24
26
  mockRegisteredTool = {};
25
27
  mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
26
29
  tool = new HsCreateTemplateTool(mockMcpServer);
27
30
  });
28
31
  describe('register', () => {
29
32
  it('should register the tool with the MCP server', () => {
30
33
  const result = tool.register();
31
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-cms-template', {
34
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('create-cms-template', expect.objectContaining({
32
35
  title: 'Create HubSpot CMS Template',
33
- description: `Creates a new HubSpot CMS template using the hs create template command. Templates can be created non-interactively by specifying templateType. Supports all template types including: ${TEMPLATE_TYPES.join(', ')}.`,
36
+ description: expect.stringContaining('Creates a new HubSpot CMS template'),
34
37
  inputSchema: expect.any(Object),
35
- }, expect.any(Function));
38
+ }), expect.any(Function));
36
39
  expect(result).toBe(mockRegisteredTool);
37
40
  });
38
41
  });
@@ -2,12 +2,15 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { HsFunctionLogsTool } from '../HsFunctionLogsTool.js';
3
3
  import { runCommandInDir } from '../../../utils/project.js';
4
4
  import { addFlag } from '../../../utils/command.js';
5
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
5
6
  vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
6
7
  vi.mock('../../../utils/project');
7
8
  vi.mock('../../../utils/command');
8
9
  vi.mock('../../../utils/toolUsageTracking', () => ({
9
10
  trackToolUsage: vi.fn(),
10
11
  }));
12
+ vi.mock('../../../utils/feedbackTracking');
13
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
11
14
  const mockRunCommandInDir = runCommandInDir;
12
15
  const mockAddFlag = addFlag;
13
16
  describe('HsFunctionLogsTool', () => {
@@ -22,6 +25,7 @@ describe('HsFunctionLogsTool', () => {
22
25
  };
23
26
  mockRegisteredTool = {};
24
27
  mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
25
29
  tool = new HsFunctionLogsTool(mockMcpServer);
26
30
  });
27
31
  describe('register', () => {
@@ -29,7 +33,7 @@ describe('HsFunctionLogsTool', () => {
29
33
  const result = tool.register();
30
34
  expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-cms-serverless-function-logs', expect.objectContaining({
31
35
  title: 'Get HubSpot CMS serverless function logs for an endpoint',
32
- description: 'Retrieve logs for HubSpot CMS serverless functions. Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
36
+ description: expect.stringContaining('Retrieve logs for HubSpot CMS serverless functions'),
33
37
  inputSchema: expect.any(Object),
34
38
  }), expect.any(Function));
35
39
  expect(result).toBe(mockRegisteredTool);
@@ -2,12 +2,15 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { HsListFunctionsTool } from '../HsListFunctionsTool.js';
3
3
  import { runCommandInDir } from '../../../utils/project.js';
4
4
  import { addFlag } from '../../../utils/command.js';
5
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
5
6
  vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
6
7
  vi.mock('../../../utils/project');
7
8
  vi.mock('../../../utils/command');
8
9
  vi.mock('../../../utils/toolUsageTracking', () => ({
9
10
  trackToolUsage: vi.fn(),
10
11
  }));
12
+ vi.mock('../../../utils/feedbackTracking');
13
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
11
14
  const mockRunCommandInDir = runCommandInDir;
12
15
  const mockAddFlag = addFlag;
13
16
  describe('HsListFunctionsTool', () => {
@@ -22,16 +25,18 @@ describe('HsListFunctionsTool', () => {
22
25
  };
23
26
  mockRegisteredTool = {};
24
27
  mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
25
29
  tool = new HsListFunctionsTool(mockMcpServer);
26
30
  });
27
31
  describe('register', () => {
28
32
  it('should register the tool with the MCP server', () => {
29
33
  const result = tool.register();
30
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('list-cms-serverless-functions', {
34
+ // First assertion - verify original description
35
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('list-cms-serverless-functions', expect.objectContaining({
31
36
  title: 'List HubSpot CMS Serverless Functions',
32
- description: 'Get a list of all serverless functions deployed in a HubSpot portal/account. Shows function routes, HTTP methods, secrets, and timestamps.',
37
+ description: expect.stringContaining('Get a list of all serverless functions deployed in a HubSpot portal/account'),
33
38
  inputSchema: expect.any(Object),
34
- }, expect.any(Function));
39
+ }), expect.any(Function));
35
40
  expect(result).toBe(mockRegisteredTool);
36
41
  });
37
42
  });
@@ -2,12 +2,15 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { HsListTool } from '../HsListTool.js';
3
3
  import { runCommandInDir } from '../../../utils/project.js';
4
4
  import { addFlag } from '../../../utils/command.js';
5
+ import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
5
6
  vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
6
7
  vi.mock('../../../utils/project');
7
8
  vi.mock('../../../utils/command');
8
9
  vi.mock('../../../utils/toolUsageTracking', () => ({
9
10
  trackToolUsage: vi.fn(),
10
11
  }));
12
+ vi.mock('../../../utils/feedbackTracking');
13
+ const mockMcpFeedbackRequest = mcpFeedbackRequest;
11
14
  const mockRunCommandInDir = runCommandInDir;
12
15
  const mockAddFlag = addFlag;
13
16
  describe('HsListTool', () => {
@@ -22,16 +25,18 @@ describe('HsListTool', () => {
22
25
  };
23
26
  mockRegisteredTool = {};
24
27
  mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
28
+ mockMcpFeedbackRequest.mockResolvedValue('');
25
29
  tool = new HsListTool(mockMcpServer);
26
30
  });
27
31
  describe('register', () => {
28
32
  it('should register the tool with the MCP server', () => {
29
33
  const result = tool.register();
30
- expect(mockMcpServer.registerTool).toHaveBeenCalledWith('list-cms-remote-contents', {
34
+ // First assertion - verify original description
35
+ expect(mockMcpServer.registerTool).toHaveBeenCalledWith('list-cms-remote-contents', expect.objectContaining({
31
36
  title: 'List HubSpot CMS Directory Contents',
32
- description: 'List remote contents of a HubSpot CMS directory.',
37
+ description: expect.stringContaining('List remote contents of a HubSpot CMS directory'),
33
38
  inputSchema: expect.any(Object),
34
- }, expect.any(Function));
39
+ }), expect.any(Function));
35
40
  expect(result).toBe(mockRegisteredTool);
36
41
  });
37
42
  });
@@ -3,18 +3,21 @@ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.
3
3
  import { z } from 'zod';
4
4
  declare const inputSchemaZodObject: z.ZodObject<{
5
5
  absoluteProjectPath: z.ZodString;
6
+ absoluteCurrentWorkingDirectory: z.ZodString;
6
7
  addApp: z.ZodBoolean;
7
8
  distribution: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"marketplace">, z.ZodLiteral<"private">]>>;
8
9
  auth: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"oauth">]>>;
9
10
  features: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"card">, z.ZodLiteral<"settings">, z.ZodLiteral<"app-function">, z.ZodLiteral<"webhooks">, z.ZodLiteral<"workflow-action">, z.ZodLiteral<"workflow-action-tool">, z.ZodLiteral<"app-object">, z.ZodLiteral<"app-event">, z.ZodLiteral<"scim">, z.ZodLiteral<"page">]>, "many">>;
10
11
  }, "strip", z.ZodTypeAny, {
11
12
  absoluteProjectPath: string;
13
+ absoluteCurrentWorkingDirectory: string;
12
14
  addApp: boolean;
13
15
  auth?: "oauth" | "static" | undefined;
14
16
  distribution?: "marketplace" | "private" | undefined;
15
17
  features?: ("card" | "settings" | "page" | "app-event" | "workflow-action-tool" | "workflow-action" | "app-function" | "webhooks" | "app-object" | "scim")[] | undefined;
16
18
  }, {
17
19
  absoluteProjectPath: string;
20
+ absoluteCurrentWorkingDirectory: string;
18
21
  addApp: boolean;
19
22
  auth?: "oauth" | "static" | undefined;
20
23
  distribution?: "marketplace" | "private" | undefined;
@@ -23,7 +26,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
23
26
  export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
24
27
  export declare class AddFeatureToProjectTool extends Tool<AddFeatureInputSchema> {
25
28
  constructor(mcpServer: McpServer);
26
- handler({ absoluteProjectPath, distribution, auth, features, addApp, }: AddFeatureInputSchema): Promise<TextContentResponse>;
29
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema): Promise<TextContentResponse>;
27
30
  register(): RegisteredTool;
28
31
  }
29
32
  export {};
@@ -2,12 +2,13 @@ import { Tool } from '../../types.js';
2
2
  import { z } from 'zod';
3
3
  import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../lib/constants.js';
4
4
  import { addFlag } from '../../utils/command.js';
5
- import { absoluteProjectPath, features } from './constants.js';
5
+ import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
6
6
  import { runCommandInDir } from '../../utils/project.js';
7
7
  import { formatTextContents, formatTextContent } from '../../utils/content.js';
8
8
  import { trackToolUsage } from '../../utils/toolUsageTracking.js';
9
9
  const inputSchema = {
10
10
  absoluteProjectPath,
11
+ absoluteCurrentWorkingDirectory,
11
12
  addApp: z
12
13
  .boolean()
13
14
  .describe('Should an app be added? If there is no app in the project, an app must be added to add a feature'),
@@ -34,7 +35,7 @@ export class AddFeatureToProjectTool extends Tool {
34
35
  constructor(mcpServer) {
35
36
  super(mcpServer);
36
37
  }
37
- async handler({ absoluteProjectPath, distribution, auth, features, addApp, }) {
38
+ async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }) {
38
39
  try {
39
40
  await trackToolUsage(toolName);
40
41
  let command = `hs project add`;
@@ -59,16 +60,16 @@ export class AddFeatureToProjectTool extends Tool {
59
60
  // If features isn't provided, pass an empty array to bypass the prompt
60
61
  command = addFlag(command, 'features', features || []);
61
62
  const { stdout, stderr } = await runCommandInDir(absoluteProjectPath, command);
62
- return formatTextContents(stdout, stderr);
63
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
63
64
  }
64
65
  catch (error) {
65
- return formatTextContents(error instanceof Error ? error.message : `${error}`);
66
+ return formatTextContents(absoluteCurrentWorkingDirectory, error instanceof Error ? error.message : `${error}`);
66
67
  }
67
68
  }
68
69
  register() {
69
70
  return this.mcpServer.registerTool(toolName, {
70
71
  title: 'Add feature to HubSpot Project',
71
- description: `Adds a feature to an existing HubSpot project.
72
+ description: `Adds a feature to an existing HubSpot project.
72
73
  Only works for projects with platformVersion '2025.2' and beyond`,
73
74
  inputSchema,
74
75
  }, this.handler);
@@ -77,10 +77,10 @@ export class CreateProjectTool extends Tool {
77
77
  command = addFlag(command, 'features', features || []);
78
78
  try {
79
79
  const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
80
- return formatTextContents(stdout, stderr);
80
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
81
81
  }
82
82
  catch (error) {
83
- return formatTextContents(error instanceof Error ? error.message : `${error}`);
83
+ return formatTextContents(absoluteCurrentWorkingDirectory, error instanceof Error ? error.message : `${error}`);
84
84
  }
85
85
  }
86
86
  register() {
@@ -3,18 +3,21 @@ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.
3
3
  import { z } from 'zod';
4
4
  declare const inputSchemaZodObject: z.ZodObject<{
5
5
  absoluteProjectPath: z.ZodString;
6
+ absoluteCurrentWorkingDirectory: z.ZodString;
6
7
  buildNumber: z.ZodOptional<z.ZodNumber>;
7
8
  }, "strip", z.ZodTypeAny, {
8
9
  absoluteProjectPath: string;
10
+ absoluteCurrentWorkingDirectory: string;
9
11
  buildNumber?: number | undefined;
10
12
  }, {
11
13
  absoluteProjectPath: string;
14
+ absoluteCurrentWorkingDirectory: string;
12
15
  buildNumber?: number | undefined;
13
16
  }>;
14
17
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
15
18
  export declare class DeployProjectTool extends Tool<InputSchemaType> {
16
19
  constructor(mcpServer: McpServer);
17
- handler({ absoluteProjectPath, buildNumber, }: InputSchemaType): Promise<TextContentResponse>;
20
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }: InputSchemaType): Promise<TextContentResponse>;
18
21
  register(): RegisteredTool;
19
22
  }
20
23
  export {};
@@ -1,12 +1,13 @@
1
1
  import { Tool } from '../../types.js';
2
2
  import { z } from 'zod';
3
3
  import { addFlag } from '../../utils/command.js';
4
- import { absoluteProjectPath } from './constants.js';
4
+ import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
5
5
  import { runCommandInDir } from '../../utils/project.js';
6
6
  import { formatTextContents, formatTextContent } from '../../utils/content.js';
7
7
  import { trackToolUsage } from '../../utils/toolUsageTracking.js';
8
8
  const inputSchema = {
9
9
  absoluteProjectPath,
10
+ absoluteCurrentWorkingDirectory,
10
11
  buildNumber: z
11
12
  .optional(z.number())
12
13
  .describe('The build number to be deployed. This can be found in the project details page using `hs project open`. If no build number is specified, the most recent build is deployed'),
@@ -20,7 +21,7 @@ export class DeployProjectTool extends Tool {
20
21
  constructor(mcpServer) {
21
22
  super(mcpServer);
22
23
  }
23
- async handler({ absoluteProjectPath, buildNumber, }) {
24
+ async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }) {
24
25
  await trackToolUsage(toolName);
25
26
  let command = `hs project deploy`;
26
27
  const content = [];
@@ -37,7 +38,7 @@ export class DeployProjectTool extends Tool {
37
38
  };
38
39
  }
39
40
  const { stdout, stderr } = await runCommandInDir(absoluteProjectPath, command);
40
- return formatTextContents(stdout, stderr);
41
+ return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
41
42
  }
42
43
  register() {
43
44
  return this.mcpServer.registerTool(toolName, {
@@ -3,15 +3,18 @@ import z from 'zod';
3
3
  import { TextContentResponse, Tool } from '../../types.js';
4
4
  declare const inputSchemaZodObject: z.ZodObject<{
5
5
  docUrl: z.ZodString;
6
+ absoluteCurrentWorkingDirectory: z.ZodString;
6
7
  }, "strip", z.ZodTypeAny, {
8
+ absoluteCurrentWorkingDirectory: string;
7
9
  docUrl: string;
8
10
  }, {
11
+ absoluteCurrentWorkingDirectory: string;
9
12
  docUrl: string;
10
13
  }>;
11
14
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
12
15
  export declare class DocFetchTool extends Tool<InputSchemaType> {
13
16
  constructor(mcpServer: McpServer);
14
- handler({ docUrl }: InputSchemaType): Promise<TextContentResponse>;
17
+ handler({ docUrl, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
15
18
  register(): RegisteredTool;
16
19
  }
17
20
  export {};
@@ -2,11 +2,12 @@ import z from 'zod';
2
2
  import { Tool } from '../../types.js';
3
3
  import { formatTextContents } from '../../utils/content.js';
4
4
  import { trackToolUsage } from '../../utils/toolUsageTracking.js';
5
- import { docUrl } from './constants.js';
5
+ import { absoluteCurrentWorkingDirectory, docUrl } from './constants.js';
6
6
  import { http } from '@hubspot/local-dev-lib/http/unauthed';
7
7
  import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
8
8
  const inputSchema = {
9
9
  docUrl,
10
+ absoluteCurrentWorkingDirectory,
10
11
  };
11
12
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
13
  const inputSchemaZodObject = z.object({
@@ -17,7 +18,7 @@ export class DocFetchTool extends Tool {
17
18
  constructor(mcpServer) {
18
19
  super(mcpServer);
19
20
  }
20
- async handler({ docUrl }) {
21
+ async handler({ docUrl, absoluteCurrentWorkingDirectory, }) {
21
22
  await trackToolUsage(toolName);
22
23
  try {
23
24
  // Append .md extension to the URL
@@ -27,16 +28,16 @@ export class DocFetchTool extends Tool {
27
28
  });
28
29
  const content = response.data;
29
30
  if (!content || content.trim().length === 0) {
30
- return formatTextContents('Document is empty or contains no content.');
31
+ return formatTextContents(absoluteCurrentWorkingDirectory, 'Document is empty or contains no content.');
31
32
  }
32
- return formatTextContents(content);
33
+ return formatTextContents(absoluteCurrentWorkingDirectory, content);
33
34
  }
34
35
  catch (error) {
35
36
  if (isHubSpotHttpError(error)) {
36
- return formatTextContents(error.toString());
37
+ return formatTextContents(absoluteCurrentWorkingDirectory, error.toString());
37
38
  }
38
39
  const errorMessage = `Error fetching documentation: ${error instanceof Error ? error.message : String(error)}`;
39
- return formatTextContents(errorMessage);
40
+ return formatTextContents(absoluteCurrentWorkingDirectory, errorMessage);
40
41
  }
41
42
  }
42
43
  register() {
@@ -24,7 +24,7 @@ export class DocsSearchTool extends Tool {
24
24
  const accountId = getAccountIdFromCliConfig(absoluteCurrentWorkingDirectory);
25
25
  if (!accountId) {
26
26
  const authErrorMessage = `No account ID found. Please run \`hs account auth\` to configure an account, or set a default account with \`hs account use <account>\``;
27
- return formatTextContents(authErrorMessage);
27
+ return formatTextContents(absoluteCurrentWorkingDirectory, authErrorMessage);
28
28
  }
29
29
  try {
30
30
  const response = await http.post(accountId, {
@@ -35,21 +35,21 @@ export class DocsSearchTool extends Tool {
35
35
  });
36
36
  const results = response.data.results;
37
37
  if (!results || results.length === 0) {
38
- return formatTextContents('No documentation found for your query.');
38
+ return formatTextContents(absoluteCurrentWorkingDirectory, 'No documentation found for your query.');
39
39
  }
40
40
  const formattedResults = results
41
41
  .map(result => `**${result.title}**\n${result.description}\nURL: ${result.url}\nScore: ${result.score}\n\n${result.content}\n---\n`)
42
42
  .join('\n');
43
43
  const successMessage = `Found ${results.length} documentation results:\n\n${formattedResults}`;
44
- return formatTextContents(successMessage);
44
+ return formatTextContents(absoluteCurrentWorkingDirectory, successMessage);
45
45
  }
46
46
  catch (error) {
47
47
  if (isHubSpotHttpError(error)) {
48
48
  // Handle different status codes
49
- return formatTextContents(error.toString());
49
+ return formatTextContents(absoluteCurrentWorkingDirectory, error.toString());
50
50
  }
51
51
  const errorMessage = `Error searching documentation: ${error instanceof Error ? error.message : String(error)}`;
52
- return formatTextContents(errorMessage);
52
+ return formatTextContents(absoluteCurrentWorkingDirectory, errorMessage);
53
53
  }
54
54
  }
55
55
  register() {
@@ -2,22 +2,25 @@ import { TextContentResponse, Tool } from '../../types.js';
2
2
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { z } from 'zod';
4
4
  declare const inputSchemaZodObject: z.ZodObject<{
5
+ absoluteCurrentWorkingDirectory: z.ZodString;
5
6
  appId: z.ZodString;
6
7
  startDate: z.ZodOptional<z.ZodString>;
7
8
  endDate: z.ZodOptional<z.ZodString>;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  appId: string;
11
+ absoluteCurrentWorkingDirectory: string;
10
12
  startDate?: string | undefined;
11
13
  endDate?: string | undefined;
12
14
  }, {
13
15
  appId: string;
16
+ absoluteCurrentWorkingDirectory: string;
14
17
  startDate?: string | undefined;
15
18
  endDate?: string | undefined;
16
19
  }>;
17
20
  export type GetApiUsagePatternsByAppIdInputSchema = z.infer<typeof inputSchemaZodObject>;
18
21
  export declare class GetApiUsagePatternsByAppIdTool extends Tool<GetApiUsagePatternsByAppIdInputSchema> {
19
22
  constructor(mcpServer: McpServer);
20
- handler({ appId, startDate, endDate, }: GetApiUsagePatternsByAppIdInputSchema): Promise<TextContentResponse>;
23
+ handler({ absoluteCurrentWorkingDirectory, appId, startDate, endDate, }: GetApiUsagePatternsByAppIdInputSchema): Promise<TextContentResponse>;
21
24
  register(): RegisteredTool;
22
25
  }
23
26
  export {};