@hubspot/cli 8.2.0-experimental.2 → 8.2.1-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 (147) hide show
  1. package/commands/account/clean.js +1 -1
  2. package/commands/account/list.js +1 -1
  3. package/commands/account/remove.js +1 -1
  4. package/commands/account/rename.js +1 -1
  5. package/commands/account/use.js +1 -1
  6. package/commands/api.d.ts +4 -1
  7. package/commands/api.js +11 -14
  8. package/commands/config/set.js +24 -5
  9. package/commands/customObject/createSchema.js +2 -3
  10. package/commands/customObject/updateSchema.js +2 -3
  11. package/commands/getStarted.js +1 -0
  12. package/commands/hubdb/list.d.ts +1 -1
  13. package/commands/hubdb/list.js +7 -8
  14. package/commands/mcp/setup.d.ts +2 -0
  15. package/commands/mcp/setup.js +29 -1
  16. package/commands/project/appInstallStatus.d.ts +2 -1
  17. package/commands/project/appInstallStatus.js +21 -19
  18. package/commands/project/create.js +0 -1
  19. package/commands/project/deploy.d.ts +2 -1
  20. package/commands/project/deploy.js +31 -14
  21. package/commands/project/dev/index.js +18 -64
  22. package/commands/project/dev/unifiedFlow.js +3 -1
  23. package/commands/project/info.d.ts +2 -1
  24. package/commands/project/info.js +8 -6
  25. package/commands/project/installApp.d.ts +2 -1
  26. package/commands/project/installApp.js +26 -27
  27. package/commands/project/list.js +1 -1
  28. package/commands/project/listBuilds.d.ts +1 -1
  29. package/commands/project/listBuilds.js +8 -6
  30. package/commands/project/logs.js +2 -4
  31. package/commands/project/profile/add.d.ts +2 -1
  32. package/commands/project/profile/add.js +22 -1
  33. package/commands/project/profile/delete.d.ts +1 -1
  34. package/commands/project/release/create.d.ts +2 -1
  35. package/commands/project/release/create.js +68 -69
  36. package/commands/project/release/info.d.ts +2 -1
  37. package/commands/project/release/info.js +7 -6
  38. package/commands/project/release/list.d.ts +2 -1
  39. package/commands/project/release/list.js +15 -7
  40. package/commands/project/upload.d.ts +4 -1
  41. package/commands/project/upload.js +48 -21
  42. package/commands/project/validate.d.ts +1 -1
  43. package/commands/project/watch.js +3 -2
  44. package/commands/project.js +2 -2
  45. package/commands/sandbox/delete.js +2 -3
  46. package/commands/testAccount/create.d.ts +2 -1
  47. package/commands/testAccount/create.js +7 -7
  48. package/commands/testAccount/importData.d.ts +1 -1
  49. package/lang/en.d.ts +61 -33
  50. package/lang/en.js +77 -48
  51. package/lib/app/urls.js +2 -3
  52. package/lib/commonOpts.js +6 -1
  53. package/lib/configOptions.d.ts +10 -10
  54. package/lib/configOptions.js +10 -11
  55. package/lib/constants.d.ts +2 -0
  56. package/lib/constants.js +2 -0
  57. package/lib/dependencyManagement.js +7 -7
  58. package/lib/getStartedV2Actions.js +2 -1
  59. package/lib/importData.js +3 -4
  60. package/lib/jsonOutput.d.ts +109 -0
  61. package/lib/jsonOutput.js +94 -0
  62. package/lib/links.js +6 -5
  63. package/lib/mcp/clients.d.ts +1 -1
  64. package/lib/mcp/clients.js +8 -1
  65. package/lib/mcp/setup.d.ts +9 -4
  66. package/lib/mcp/setup.js +115 -35
  67. package/lib/npm/npmCli.d.ts +1 -0
  68. package/lib/npm/npmCli.js +13 -0
  69. package/lib/projects/builds.d.ts +2 -0
  70. package/lib/projects/builds.js +22 -0
  71. package/lib/projects/create/v2.js +1 -0
  72. package/lib/projects/installApp.d.ts +1 -1
  73. package/lib/projects/installApp.js +8 -3
  74. package/lib/projects/localDev/DevSessionManager.d.ts +2 -2
  75. package/lib/projects/localDev/DevSessionManager.js +4 -30
  76. package/lib/projects/localDev/LocalDevProcess.js +7 -5
  77. package/lib/projects/localDev/helpers/account.d.ts +0 -7
  78. package/lib/projects/localDev/helpers/account.js +1 -80
  79. package/lib/projects/localDev/helpers/project.js +3 -2
  80. package/lib/projects/release.d.ts +4 -0
  81. package/lib/projects/release.js +90 -0
  82. package/lib/projects/ui.d.ts +1 -0
  83. package/lib/projects/ui.js +14 -0
  84. package/lib/projects/upload.d.ts +10 -2
  85. package/lib/projects/upload.js +14 -7
  86. package/lib/projects/urls.d.ts +0 -1
  87. package/lib/projects/urls.js +6 -13
  88. package/lib/yargs/makeWrappedYargsHandler.d.ts +5 -1
  89. package/lib/yargs/makeWrappedYargsHandler.js +123 -65
  90. package/mcp-server/Tool.d.ts +8 -3
  91. package/mcp-server/Tool.js +58 -32
  92. package/mcp-server/server.js +10 -6
  93. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +2 -2
  94. package/mcp-server/tools/cms/HsCreateFunctionTool.js +10 -17
  95. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
  96. package/mcp-server/tools/cms/HsCreateModuleTool.js +12 -18
  97. package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +2 -2
  98. package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -10
  99. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +2 -2
  100. package/mcp-server/tools/cms/HsFunctionLogsTool.js +9 -9
  101. package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +2 -2
  102. package/mcp-server/tools/cms/HsListFunctionsTool.js +7 -7
  103. package/mcp-server/tools/cms/HsListTool.d.ts +2 -2
  104. package/mcp-server/tools/cms/HsListTool.js +6 -10
  105. package/mcp-server/tools/index.js +2 -0
  106. package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +3 -2
  107. package/mcp-server/tools/project/AddFeatureToProjectTool.js +8 -9
  108. package/mcp-server/tools/project/AuthAccountTool.d.ts +18 -0
  109. package/mcp-server/tools/project/AuthAccountTool.js +78 -0
  110. package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -2
  111. package/mcp-server/tools/project/CreateProjectTool.js +13 -12
  112. package/mcp-server/tools/project/CreateTestAccountTool.d.ts +2 -2
  113. package/mcp-server/tools/project/CreateTestAccountTool.js +14 -15
  114. package/mcp-server/tools/project/DeployProjectTool.d.ts +2 -2
  115. package/mcp-server/tools/project/DeployProjectTool.js +10 -10
  116. package/mcp-server/tools/project/DocFetchTool.js +1 -1
  117. package/mcp-server/tools/project/DocsSearchTool.js +8 -7
  118. package/mcp-server/tools/project/FindProjectsTool.js +1 -1
  119. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +2 -1
  120. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +9 -8
  121. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +2 -1
  122. package/mcp-server/tools/project/GetApplicationInfoTool.js +12 -9
  123. package/mcp-server/tools/project/GetBuildLogsTool.js +11 -7
  124. package/mcp-server/tools/project/GetBuildStatusTool.js +11 -7
  125. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +2 -1
  126. package/mcp-server/tools/project/GetConfigValuesTool.js +9 -7
  127. package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -1
  128. package/mcp-server/tools/project/UploadProjectTools.d.ts +2 -2
  129. package/mcp-server/tools/project/UploadProjectTools.js +9 -8
  130. package/mcp-server/tools/project/ValidateProjectTool.d.ts +2 -2
  131. package/mcp-server/tools/project/ValidateProjectTool.js +5 -4
  132. package/mcp-server/tools/project/constants.d.ts +1 -0
  133. package/mcp-server/tools/project/constants.js +2 -1
  134. package/mcp-server/utils/command.d.ts +25 -2
  135. package/mcp-server/utils/command.js +67 -17
  136. package/mcp-server/utils/config.js +5 -0
  137. package/mcp-server/utils/logger.d.ts +3 -0
  138. package/mcp-server/utils/logger.js +30 -0
  139. package/mcp-server/utils/toolUsageTracking.js +18 -3
  140. package/package.json +11 -9
  141. package/types/Yargs.d.ts +3 -1
  142. package/commands/project/dev/deprecatedFlow.d.ts +0 -11
  143. package/commands/project/dev/deprecatedFlow.js +0 -180
  144. package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +0 -43
  145. package/lib/projects/localDev/DevServerManager_DEPRECATED.js +0 -128
  146. package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +0 -64
  147. package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +0 -394
@@ -17,22 +17,26 @@ WHEN TO USE THIS SERVER
17
17
  via \`search-docs\` + \`fetch-doc\` rather than from prior knowledge.
18
18
 
19
19
  REQUIRED WORKFLOWS
20
- 1. Documentation lookup: always call \`search-docs\` first, then
20
+ 1. Authentication: call \`auth-account\` when the user wants to connect a
21
+ HubSpot account, when any tool reports "No account ID found", or when
22
+ there are no authenticated accounts. The tool opens a browser tab for
23
+ the user to authorize — no Personal Access Key is required up front.
24
+ 2. Documentation lookup: always call \`search-docs\` first, then
21
25
  \`fetch-doc\` on the most relevant result(s) before planning, writing
22
26
  code, or answering platform/API questions. Do not answer from memory.
23
- 2. Locating a HubSpot project: when the current working directory is not
27
+ 3. Locating a HubSpot project: when the current working directory is not
24
28
  a HubSpot project (no \`hsproject.json\`) or you need to determine
25
29
  whether a directory contains one, call \`find-projects\` before
26
30
  running any tool that requires a project path.
27
- 3. Editing \`*-hsmeta.json\`: call \`get-feature-config-schema\` for that
31
+ 4. Editing \`*-hsmeta.json\`: call \`get-feature-config-schema\` for that
28
32
  feature type first to learn the allowed fields and values.
29
- 4. Debugging a failed build: start with \`get-build-status\` to surface
33
+ 5. Debugging a failed build: start with \`get-build-status\` to surface
30
34
  error messages, and only reach for \`get-build-logs\` for deeper
31
35
  troubleshooting or warnings.
32
- 5. Reading serverless function logs: call \`list-cms-serverless-functions\`
36
+ 6. Reading serverless function logs: call \`list-cms-serverless-functions\`
33
37
  first to discover the endpoint path, then
34
38
  \`get-cms-serverless-function-logs\`.
35
- 6. App analytics: call \`get-apps-info\` to discover \`appId\` values
39
+ 7. App analytics: call \`get-apps-info\` to discover \`appId\` values
36
40
  before \`get-api-usage-patterns-by-app-id\`.
37
41
 
38
42
  OUTPUT
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -20,7 +20,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
20
20
  export type HsCreateFunctionInputSchema = z.infer<typeof inputSchemaZodObject>;
21
21
  export declare class HsCreateFunctionTool extends Tool<HsCreateFunctionInputSchema> {
22
22
  constructor(mcpServer: McpServer, logger: McpLogger);
23
- handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema): Promise<TextContentResponse>;
23
+ handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
24
24
  register(): RegisteredTool;
25
25
  }
26
26
  export {};
@@ -1,10 +1,9 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
4
- import { runCommandInDir } from '../../utils/command.js';
5
4
  import { formatTextContents, formatTextContent } from '../../utils/content.js';
6
- import { addFlag } from '../../utils/command.js';
7
5
  import { HTTP_METHODS } from '../../../types/Cms.js';
6
+ import { HubSpotCommand } from '../../utils/command.js';
8
7
  import { setupHubSpotConfig } from '../../utils/config.js';
9
8
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
10
9
  const inputSchema = {
@@ -37,7 +36,7 @@ export class HsCreateFunctionTool extends Tool {
37
36
  constructor(mcpServer, logger) {
38
37
  super(mcpServer, logger, toolName);
39
38
  }
40
- async handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }) {
39
+ async handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }, extra) {
41
40
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
42
41
  const content = [];
43
42
  // Require functions folder
@@ -59,28 +58,22 @@ export class HsCreateFunctionTool extends Tool {
59
58
  };
60
59
  }
61
60
  // Build the command
62
- let command = 'hs cms function create';
61
+ const command = new HubSpotCommand('cms function create');
63
62
  if (dest) {
64
- command += ` "${dest}"`;
63
+ command.addArg(dest);
65
64
  }
66
- // Add function-specific flags
67
65
  if (functionsFolder) {
68
- command = addFlag(command, 'functions-folder', functionsFolder);
66
+ command.addFlag('functions-folder', functionsFolder);
69
67
  }
70
68
  if (filename) {
71
- command = addFlag(command, 'filename', filename);
72
- }
73
- if (endpointMethod) {
74
- command = addFlag(command, 'endpoint-method', endpointMethod);
75
- }
76
- else {
77
- command = addFlag(command, 'endpoint-method', 'GET');
69
+ command.addFlag('filename', filename);
78
70
  }
71
+ command.addFlag('endpoint-method', endpointMethod ?? 'GET');
79
72
  if (endpointPath) {
80
- command = addFlag(command, 'endpoint-path', endpointPath);
73
+ command.addFlag('endpoint-path', endpointPath);
81
74
  }
82
75
  try {
83
- const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
76
+ const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
84
77
  return formatTextContents(stdout, stderr);
85
78
  }
86
79
  catch (error) {
@@ -102,6 +95,6 @@ export class HsCreateFunctionTool extends Tool {
102
95
  idempotentHint: false,
103
96
  openWorldHint: false,
104
97
  },
105
- }, input => this.wrappedHandler(input));
98
+ }, (input, extra) => this.wrappedHandler(input, extra));
106
99
  }
107
100
  }
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -16,7 +16,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
16
16
  export type HsCreateModuleInputSchema = z.infer<typeof inputSchemaZodObject>;
17
17
  export declare class HsCreateModuleTool extends Tool<HsCreateModuleInputSchema> {
18
18
  constructor(mcpServer: McpServer, logger: McpLogger);
19
- handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }: HsCreateModuleInputSchema): Promise<TextContentResponse>;
19
+ handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }: HsCreateModuleInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
20
20
  register(): RegisteredTool;
21
21
  }
22
22
  export {};
@@ -1,9 +1,9 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
4
- import { addFlag, runCommandInDir } from '../../utils/command.js';
5
4
  import { formatTextContent, formatTextContents } from '../../utils/content.js';
6
5
  import { CONTENT_TYPES } from '../../../types/Cms.js';
6
+ import { HubSpotCommand } from '../../utils/command.js';
7
7
  import { setupHubSpotConfig } from '../../utils/config.js';
8
8
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
9
9
  const inputSchema = {
@@ -52,7 +52,7 @@ export class HsCreateModuleTool extends Tool {
52
52
  constructor(mcpServer, logger) {
53
53
  super(mcpServer, logger, toolName);
54
54
  }
55
- async handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }) {
55
+ async handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }, extra) {
56
56
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
57
57
  const content = [];
58
58
  // Always require a name
@@ -74,34 +74,28 @@ export class HsCreateModuleTool extends Tool {
74
74
  };
75
75
  }
76
76
  // Build the command
77
- let command = 'hs cms module create';
77
+ const command = new HubSpotCommand('cms module create');
78
78
  if (userSuppliedName) {
79
- command += ` "${userSuppliedName}"`;
79
+ command.addArg(userSuppliedName);
80
80
  }
81
81
  if (dest) {
82
- command += ` "${dest}"`;
82
+ command.addArg(dest);
83
83
  }
84
- // Add module-specific flags
85
84
  if (moduleLabel) {
86
- command = addFlag(command, 'module-label', moduleLabel);
85
+ command.addFlag('module-label', moduleLabel);
87
86
  }
88
87
  if (reactType !== undefined) {
89
- command = addFlag(command, 'react-type', reactType);
90
- }
91
- if (contentTypes) {
92
- command = addFlag(command, 'content-types', contentTypes);
93
- }
94
- else {
95
- command = addFlag(command, 'content-types', 'ANY');
88
+ command.addFlag('react-type', reactType);
96
89
  }
90
+ command.addFlag('content-types', contentTypes ?? 'ANY');
97
91
  if (global !== undefined) {
98
- command = addFlag(command, 'global', global);
92
+ command.addFlag('global', global);
99
93
  }
100
94
  if (availableForNewContent !== undefined) {
101
- command = addFlag(command, 'available-for-new-content', availableForNewContent);
95
+ command.addFlag('available-for-new-content', availableForNewContent);
102
96
  }
103
97
  try {
104
- const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
98
+ const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
105
99
  return formatTextContents(stdout, stderr);
106
100
  }
107
101
  catch (error) {
@@ -123,6 +117,6 @@ export class HsCreateModuleTool extends Tool {
123
117
  idempotentHint: false,
124
118
  openWorldHint: false,
125
119
  },
126
- }, input => this.wrappedHandler(input));
120
+ }, (input, extra) => this.wrappedHandler(input, extra));
127
121
  }
128
122
  }
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -21,7 +21,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
21
21
  export type HsCreateTemplateInputSchema = z.infer<typeof inputSchemaZodObject>;
22
22
  export declare class HsCreateTemplateTool extends Tool<HsCreateTemplateInputSchema> {
23
23
  constructor(mcpServer: McpServer, logger: McpLogger);
24
- handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }: HsCreateTemplateInputSchema): Promise<TextContentResponse>;
24
+ handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }: HsCreateTemplateInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
25
25
  register(): RegisteredTool;
26
26
  }
27
27
  export {};
@@ -1,10 +1,9 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
4
- import { runCommandInDir } from '../../utils/command.js';
5
4
  import { formatTextContents, formatTextContent } from '../../utils/content.js';
6
- import { addFlag } from '../../utils/command.js';
7
5
  import { TEMPLATE_TYPES } from '../../../types/Cms.js';
6
+ import { HubSpotCommand } from '../../utils/command.js';
8
7
  import { setupHubSpotConfig } from '../../utils/config.js';
9
8
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
10
9
  const inputSchema = {
@@ -29,7 +28,7 @@ export class HsCreateTemplateTool extends Tool {
29
28
  constructor(mcpServer, logger) {
30
29
  super(mcpServer, logger, toolName);
31
30
  }
32
- async handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }) {
31
+ async handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }, extra) {
33
32
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
34
33
  const content = [];
35
34
  // Always require a name
@@ -47,19 +46,18 @@ export class HsCreateTemplateTool extends Tool {
47
46
  };
48
47
  }
49
48
  // Build the command
50
- let command = 'hs cms template create';
49
+ const command = new HubSpotCommand('cms template create');
51
50
  if (userSuppliedName) {
52
- command += ` "${userSuppliedName}"`;
51
+ command.addArg(userSuppliedName);
53
52
  }
54
53
  if (dest) {
55
- command += ` "${dest}"`;
54
+ command.addArg(dest);
56
55
  }
57
- // Add template type flag
58
56
  if (templateType) {
59
- command = addFlag(command, 'template-type', templateType);
57
+ command.addFlag('template-type', templateType);
60
58
  }
61
59
  try {
62
- const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
60
+ const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
63
61
  return formatTextContents(stdout, stderr);
64
62
  }
65
63
  catch (error) {
@@ -81,6 +79,6 @@ export class HsCreateTemplateTool extends Tool {
81
79
  idempotentHint: false,
82
80
  openWorldHint: false,
83
81
  },
84
- }, input => this.wrappedHandler(input));
82
+ }, (input, extra) => this.wrappedHandler(input, extra));
85
83
  }
86
84
  }
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -14,7 +14,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
14
14
  export type HsFunctionLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
15
15
  export declare class HsFunctionLogsTool extends Tool<HsFunctionLogsInputSchema> {
16
16
  constructor(mcpServer: McpServer, logger: McpLogger);
17
- handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }: HsFunctionLogsInputSchema): Promise<TextContentResponse>;
17
+ handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }: HsFunctionLogsInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
18
18
  register(): RegisteredTool;
19
19
  }
20
20
  export {};
@@ -1,6 +1,6 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
- import { addFlag, runCommandInDir } from '../../utils/command.js';
3
+ import { HubSpotCommand } from '../../utils/command.js';
4
4
  import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
5
5
  import { formatTextContents } from '../../utils/content.js';
6
6
  import { setupHubSpotConfig } from '../../utils/config.js';
@@ -31,27 +31,27 @@ export class HsFunctionLogsTool extends Tool {
31
31
  constructor(mcpServer, logger) {
32
32
  super(mcpServer, logger, toolName);
33
33
  }
34
- async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }) {
34
+ async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }, extra) {
35
35
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
36
36
  // Ensure endpoint doesn't start with '/'
37
37
  const normalizedEndpoint = endpoint.startsWith('/')
38
38
  ? endpoint.slice(1)
39
39
  : endpoint;
40
- let command = `hs cms function logs ${normalizedEndpoint}`;
40
+ const command = new HubSpotCommand(`cms function logs ${normalizedEndpoint}`);
41
41
  if (latest) {
42
- command = addFlag(command, 'latest', latest);
42
+ command.addFlag('latest', latest);
43
43
  }
44
44
  if (compact) {
45
- command = addFlag(command, 'compact', compact);
45
+ command.addFlag('compact', compact);
46
46
  }
47
47
  if (limit) {
48
- command = addFlag(command, 'limit', limit);
48
+ command.addFlag('limit', limit);
49
49
  }
50
50
  if (account) {
51
- command = addFlag(command, 'account', account);
51
+ command.addFlag('account', account);
52
52
  }
53
53
  try {
54
- const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
54
+ const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
55
55
  return formatTextContents(stdout, stderr);
56
56
  }
57
57
  catch (error) {
@@ -71,6 +71,6 @@ export class HsFunctionLogsTool extends Tool {
71
71
  readOnlyHint: true,
72
72
  openWorldHint: true,
73
73
  },
74
- }, input => this.wrappedHandler(input));
74
+ }, (input, extra) => this.wrappedHandler(input, extra));
75
75
  }
76
76
  }
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -11,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
11
11
  export type HsListFunctionsInputSchema = z.infer<typeof inputSchemaZodObject>;
12
12
  export declare class HsListFunctionsTool extends Tool<HsListFunctionsInputSchema> {
13
13
  constructor(mcpServer: McpServer, logger: McpLogger);
14
- handler({ account, json, absoluteCurrentWorkingDirectory, }: HsListFunctionsInputSchema): Promise<TextContentResponse>;
14
+ handler({ account, json, absoluteCurrentWorkingDirectory, }: HsListFunctionsInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
15
15
  register(): RegisteredTool;
16
16
  }
17
17
  export {};
@@ -1,6 +1,6 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
- import { addFlag, runCommandInDir } from '../../utils/command.js';
3
+ import { HubSpotCommand } from '../../utils/command.js';
4
4
  import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
5
5
  import { formatTextContents } from '../../utils/content.js';
6
6
  import { setupHubSpotConfig } from '../../utils/config.js';
@@ -23,17 +23,17 @@ export class HsListFunctionsTool extends Tool {
23
23
  constructor(mcpServer, logger) {
24
24
  super(mcpServer, logger, toolName);
25
25
  }
26
- async handler({ account, json, absoluteCurrentWorkingDirectory, }) {
26
+ async handler({ account, json, absoluteCurrentWorkingDirectory, }, extra) {
27
27
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
28
- let command = 'hs cms function list';
28
+ const command = new HubSpotCommand('cms function list');
29
29
  if (json) {
30
- command += ' --json';
30
+ command.addFlag('json', true);
31
31
  }
32
32
  if (account) {
33
- command = addFlag(command, 'account', account);
33
+ command.addFlag('account', account);
34
34
  }
35
35
  try {
36
- const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
36
+ const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
37
37
  return formatTextContents(stdout, stderr);
38
38
  }
39
39
  catch (error) {
@@ -60,6 +60,6 @@ export class HsListFunctionsTool extends Tool {
60
60
  readOnlyHint: true,
61
61
  openWorldHint: true,
62
62
  },
63
- }, input => this.wrappedHandler(input));
63
+ }, (input, extra) => this.wrappedHandler(input, extra));
64
64
  }
65
65
  }
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -11,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
11
11
  export type HsListInputSchema = z.infer<typeof inputSchemaZodObject>;
12
12
  export declare class HsListTool extends Tool<HsListInputSchema> {
13
13
  constructor(mcpServer: McpServer, logger: McpLogger);
14
- handler({ path, account, absoluteCurrentWorkingDirectory, }: HsListInputSchema): Promise<TextContentResponse>;
14
+ handler({ path, account, absoluteCurrentWorkingDirectory }: HsListInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
15
15
  register(): RegisteredTool;
16
16
  }
17
17
  export {};
@@ -1,8 +1,7 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
- import { addFlag } from '../../utils/command.js';
3
+ import { HubSpotCommand } from '../../utils/command.js';
4
4
  import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
5
- import { runCommandInDir } from '../../utils/command.js';
6
5
  import { formatTextContents } from '../../utils/content.js';
7
6
  import { setupHubSpotConfig } from '../../utils/config.js';
8
7
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
@@ -24,17 +23,14 @@ export class HsListTool extends Tool {
24
23
  constructor(mcpServer, logger) {
25
24
  super(mcpServer, logger, toolName);
26
25
  }
27
- async handler({ path, account, absoluteCurrentWorkingDirectory, }) {
26
+ async handler({ path, account, absoluteCurrentWorkingDirectory }, extra) {
28
27
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
29
- let command = 'hs cms list';
30
- if (path) {
31
- command += ` ${path}`;
32
- }
28
+ const command = new HubSpotCommand(path ? `cms list ${path}` : 'cms list');
33
29
  if (account) {
34
- command = addFlag(command, 'account', account);
30
+ command.addFlag('account', account);
35
31
  }
36
32
  try {
37
- const { stdout, stderr } = await runCommandInDir(absoluteCurrentWorkingDirectory, command);
33
+ const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
38
34
  return formatTextContents(stdout, stderr);
39
35
  }
40
36
  catch (error) {
@@ -61,6 +57,6 @@ export class HsListTool extends Tool {
61
57
  readOnlyHint: true,
62
58
  openWorldHint: true,
63
59
  },
64
- }, input => this.wrappedHandler(input));
60
+ }, (input, extra) => this.wrappedHandler(input, extra));
65
61
  }
66
62
  }
@@ -19,6 +19,7 @@ import { HsListFunctionsTool } from './cms/HsListFunctionsTool.js';
19
19
  import { HsFunctionLogsTool } from './cms/HsFunctionLogsTool.js';
20
20
  import { CreateTestAccountTool } from './project/CreateTestAccountTool.js';
21
21
  import { FindProjectsTool } from './project/FindProjectsTool.js';
22
+ import { AuthAccountTool } from './project/AuthAccountTool.js';
22
23
  export function registerProjectTools(mcpServer, logger) {
23
24
  return [
24
25
  new UploadProjectTools(mcpServer, logger).register(),
@@ -36,6 +37,7 @@ export function registerProjectTools(mcpServer, logger) {
36
37
  new GetBuildLogsTool(mcpServer, logger).register(),
37
38
  new GetBuildStatusTool(mcpServer, logger).register(),
38
39
  new FindProjectsTool(mcpServer, logger).register(),
40
+ new AuthAccountTool(mcpServer, logger).register(),
39
41
  ];
40
42
  }
41
43
  export function registerCmsTools(mcpServer, logger) {
@@ -1,5 +1,5 @@
1
1
  import { TextContentResponse } from '../../types.js';
2
- import { Tool } from '../../Tool.js';
2
+ import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
@@ -20,6 +20,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
20
20
  settings: "settings";
21
21
  "app-event": "app-event";
22
22
  "workflow-action-tool": "workflow-action-tool";
23
+ "crm-bulk-action": "crm-bulk-action";
23
24
  page: "page";
24
25
  webhooks: "webhooks";
25
26
  "app-function": "app-function";
@@ -32,7 +33,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
32
33
  export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
33
34
  export declare class AddFeatureToProjectTool extends Tool<AddFeatureInputSchema> {
34
35
  constructor(mcpServer: McpServer, logger: McpLogger);
35
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema): Promise<TextContentResponse>;
36
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
36
37
  register(): RegisteredTool;
37
38
  }
38
39
  export {};
@@ -1,9 +1,8 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../lib/constants.js';
4
- import { addFlag } from '../../utils/command.js';
4
+ import { HubSpotCommand } from '../../utils/command.js';
5
5
  import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
6
- import { runCommandInDir } from '../../utils/command.js';
7
6
  import { formatTextContents, formatTextContent } from '../../utils/content.js';
8
7
  import { setupHubSpotConfig } from '../../utils/config.js';
9
8
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
@@ -32,19 +31,19 @@ export class AddFeatureToProjectTool extends Tool {
32
31
  constructor(mcpServer, logger) {
33
32
  super(mcpServer, logger, toolName);
34
33
  }
35
- async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }) {
34
+ async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }, extra) {
36
35
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
37
36
  try {
38
- let command = `hs project add`;
37
+ const command = new HubSpotCommand('project add');
39
38
  const content = [];
40
39
  if (distribution) {
41
- command = addFlag(command, 'distribution', distribution);
40
+ command.addFlag('distribution', distribution);
42
41
  }
43
42
  else if (addApp) {
44
43
  content.push(formatTextContent(`Ask the user how they would you like to distribute the app. Options are ${APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${APP_DISTRIBUTION_TYPES.PRIVATE}`));
45
44
  }
46
45
  if (auth) {
47
- command = addFlag(command, 'auth', auth);
46
+ command.addFlag('auth', auth);
48
47
  }
49
48
  else if (addApp) {
50
49
  content.push(formatTextContent(`Ask the user which auth type they would like to use. Options are ${APP_AUTH_TYPES.STATIC} and ${APP_AUTH_TYPES.OAUTH}`));
@@ -55,8 +54,8 @@ export class AddFeatureToProjectTool extends Tool {
55
54
  };
56
55
  }
57
56
  // If features isn't provided, pass an empty array to bypass the prompt
58
- command = addFlag(command, 'features', features || []);
59
- const { stdout, stderr } = await runCommandInDir(absoluteProjectPath, command);
57
+ command.addFlag('features', features || []);
58
+ const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
60
59
  return formatTextContents(stdout, stderr);
61
60
  }
62
61
  catch (error) {
@@ -79,6 +78,6 @@ export class AddFeatureToProjectTool extends Tool {
79
78
  idempotentHint: false,
80
79
  openWorldHint: false,
81
80
  },
82
- }, input => this.wrappedHandler(input));
81
+ }, (input, extra) => this.wrappedHandler(input, extra));
83
82
  }
84
83
  }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { McpLogger } from '../../utils/logger.js';
4
+ import { Tool, ToolExtra } from '../../Tool.js';
5
+ import { TextContentResponse } from '../../types.js';
6
+ declare const inputSchemaZodObject: z.ZodObject<{
7
+ absoluteCurrentWorkingDirectory: z.ZodString;
8
+ accountId: z.ZodOptional<z.ZodNumber>;
9
+ name: z.ZodOptional<z.ZodString>;
10
+ setAsDefault: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strip>;
12
+ export type AuthAccountInputSchema = z.infer<typeof inputSchemaZodObject>;
13
+ export declare class AuthAccountTool extends Tool<AuthAccountInputSchema> {
14
+ constructor(mcpServer: McpServer, logger: McpLogger);
15
+ handler({ absoluteCurrentWorkingDirectory, accountId, name, setAsDefault, }: AuthAccountInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
16
+ register(): RegisteredTool;
17
+ }
18
+ export {};