@hubspot/cli 8.18.0-beta.0 → 8.19.0-beta.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 (104) hide show
  1. package/commands/account/auth.js +2 -2
  2. package/commands/account/createOverride.js +2 -0
  3. package/commands/account/removeOverride.js +2 -0
  4. package/commands/app/secret/add.js +1 -1
  5. package/commands/app/secret/delete.js +1 -1
  6. package/commands/app/secret/list.js +1 -1
  7. package/commands/app/secret/update.js +1 -1
  8. package/commands/app/secret.js +1 -1
  9. package/commands/auth.js +3 -2
  10. package/commands/cms/function/create.js +5 -37
  11. package/commands/cms/function/deploy.js +8 -1
  12. package/commands/cms/function/list.js +4 -0
  13. package/commands/cms/function/logs.js +2 -0
  14. package/commands/cms/function/server.js +6 -0
  15. package/commands/cms/upload.js +6 -0
  16. package/commands/cms/watch.js +2 -0
  17. package/commands/cms/webpack/create.js +5 -32
  18. package/commands/customObject.js +2 -2
  19. package/commands/getStarted.js +4 -4
  20. package/commands/hubdb/list.js +2 -2
  21. package/commands/init.js +3 -2
  22. package/commands/mcp/setup.js +3 -2
  23. package/commands/project/dev/index.js +2 -2
  24. package/commands/project/logs.js +2 -2
  25. package/commands/project/upload.js +6 -2
  26. package/commands/project/watch.js +2 -2
  27. package/commands/sandbox/create.js +3 -3
  28. package/commands/sandbox/delete.js +1 -1
  29. package/commands/sandbox.js +1 -1
  30. package/lang/en.d.ts +26 -0
  31. package/lang/en.js +85 -43
  32. package/lib/accountAuth.js +12 -0
  33. package/lib/accountCredentials.d.ts +1 -0
  34. package/lib/accountCredentials.js +25 -0
  35. package/lib/app/logSystemTypes.d.ts +4 -0
  36. package/lib/app/logSystemTypes.js +17 -0
  37. package/lib/app/logs.d.ts +2 -4
  38. package/lib/app/logs.js +2 -17
  39. package/lib/app/migrate.js +3 -3
  40. package/lib/constants.d.ts +2 -0
  41. package/lib/constants.js +4 -0
  42. package/lib/crossPlatformSpawn/escape.d.ts +2 -0
  43. package/lib/crossPlatformSpawn/escape.js +38 -0
  44. package/lib/crossPlatformSpawn/index.d.ts +7 -0
  45. package/lib/crossPlatformSpawn/index.js +43 -0
  46. package/lib/crossPlatformSpawn/resolveCommand.d.ts +1 -0
  47. package/lib/crossPlatformSpawn/resolveCommand.js +69 -0
  48. package/lib/errorHandlers/suppressError.js +3 -3
  49. package/lib/feedback.js +2 -18
  50. package/lib/hints/hints.d.ts +9 -0
  51. package/lib/hints/hints.js +30 -0
  52. package/lib/hints/throttle.d.ts +4 -0
  53. package/lib/hints/throttle.js +9 -0
  54. package/lib/jsonOutput/projectUpload.d.ts +1 -0
  55. package/lib/jsonOutput/projectUpload.js +1 -0
  56. package/lib/mcp/promotion.js +15 -30
  57. package/lib/mcp/setup.d.ts +6 -1
  58. package/lib/mcp/setup.js +1 -1
  59. package/lib/middleware/deprecationWarningMiddleware.js +4 -9
  60. package/lib/projects/localDev/AppDevModeInterface.js +3 -3
  61. package/lib/projects/localDev/LocalDevLogger.js +5 -5
  62. package/lib/projects/localDev/helpers/project.js +3 -3
  63. package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
  64. package/lib/projects/projectInfo.js +4 -4
  65. package/lib/projects/projectProfiles.js +3 -3
  66. package/lib/projects/ui.js +3 -3
  67. package/lib/projects/upload.d.ts +3 -1
  68. package/lib/projects/upload.js +23 -6
  69. package/lib/projects/watch.js +4 -2
  70. package/lib/projects/workspaces.js +4 -4
  71. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  72. package/lib/prompts/selectPublicAppForMigrationPrompt.js +3 -3
  73. package/lib/serverlessSunset.d.ts +6 -0
  74. package/lib/serverlessSunset.js +32 -0
  75. package/lib/testUtils.d.ts +5 -1
  76. package/lib/testUtils.js +2 -2
  77. package/lib/ui/appLogs.js +4 -4
  78. package/lib/ui/formatting.d.ts +13 -0
  79. package/lib/ui/formatting.js +39 -0
  80. package/lib/ui/git.js +3 -3
  81. package/lib/ui/index.d.ts +9 -23
  82. package/lib/ui/index.js +36 -69
  83. package/lib/ui/logger.d.ts +1 -0
  84. package/lib/ui/logger.js +2 -1
  85. package/lib/ui/uiMessages.js +1 -1
  86. package/mcp-server/server.js +13 -5
  87. package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
  88. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  89. package/mcp-server/tools/cms/HsListTool.js +4 -1
  90. package/mcp-server/tools/index.js +0 -2
  91. package/mcp-server/tools/project/DocFetchTool.js +2 -6
  92. package/mcp-server/tools/project/DocsSearchTool.js +2 -7
  93. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +2 -7
  94. package/mcp-server/tools/project/GetApplicationInfoTool.js +2 -7
  95. package/mcp-server/tools/project/GetBuildLogsTool.js +2 -12
  96. package/mcp-server/tools/project/GetBuildStatusTool.js +2 -12
  97. package/mcp-server/tools/project/KnowledgeSearchTool.js +2 -5
  98. package/mcp-server/tools/project/SubmitFeedbackTool.js +2 -1
  99. package/mcp-server/utils/command.js +16 -5
  100. package/mcp-server/utils/errors.d.ts +1 -0
  101. package/mcp-server/utils/errors.js +9 -0
  102. package/package.json +9 -9
  103. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
  104. package/mcp-server/tools/cms/HsCreateFunctionTool.js +0 -100
@@ -45,13 +45,17 @@ REQUIRED WORKFLOWS
45
45
  5. Debugging a failed build: start with \`get-build-status\` to surface
46
46
  error messages, and only reach for \`get-build-logs\` for deeper
47
47
  troubleshooting or warnings.
48
- 6. Reading serverless function logs: call \`list-cms-serverless-functions\`
49
- first to discover the endpoint path, then
50
- \`get-cms-serverless-function-logs\`.
48
+ 6. Reading serverless function logs (deprecated, CMS serverless functions
49
+ are being sunset: editing ends on November 17, 2026 and existing
50
+ functions stop running on February 1, 2027): call
51
+ \`list-cms-serverless-functions\` first to discover the endpoint path,
52
+ then \`get-cms-serverless-function-logs\`.
51
53
  7. Serverless functions come in two distinct kinds. CMS serverless
52
54
  functions are website endpoints served at \`/hs/serverless/<path>\`.
53
- Create them with \`create-cms-function\`, and manage them with
54
- \`list-cms-serverless-functions\` and
55
+ They can no longer be created and editing ends on November 17, 2026,
56
+ so build new serverless functions in a Developer Project instead with
57
+ \`add-feature-to-project\`.
58
+ Manage existing ones with \`list-cms-serverless-functions\` and
55
59
  \`get-cms-serverless-function-logs\`. App functions are serverless
56
60
  functions built inside a developer-platform app, either private
57
61
  (the \`app-function\` feature) or publicly accessible via an endpoint
@@ -63,6 +67,10 @@ REQUIRED WORKFLOWS
63
67
  9. Feedback: when you hit a bug, an error you cannot explain, a confusing
64
68
  result, or a request these tools cannot do, call \`submit-feedback\`
65
69
  with one short message. Then continue with the task.
70
+ 10. Long-running commands: never run \`hs project dev\`,
71
+ \`hs project watch\`, or \`hs cms watch\` from a shell, even if
72
+ asked. Ask the user to run it in a separate terminal window. To
73
+ watch a project, give them \`hs project dev --auto-upload\`.
66
74
 
67
75
  OUTPUT
68
76
  Tool results contain the relevant \`hs\` stdout/stderr or structured data.
@@ -91,7 +91,7 @@ export class HsFunctionLogsTool extends Tool {
91
91
  const normalizedEndpoint = resolvedEndpoint.startsWith('/')
92
92
  ? resolvedEndpoint.slice(1)
93
93
  : resolvedEndpoint;
94
- const command = new HubSpotCommand(`cms function logs ${normalizedEndpoint}`);
94
+ const command = new HubSpotCommand('cms function logs').addArg(normalizedEndpoint);
95
95
  if (latest) {
96
96
  command.addFlag('latest', latest);
97
97
  }
@@ -119,7 +119,7 @@ export class HsFunctionLogsTool extends Tool {
119
119
  register() {
120
120
  return this.mcpServer.registerTool(toolName, {
121
121
  title: 'Get HubSpot CMS serverless function logs for an endpoint',
122
- description: 'Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). 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.',
122
+ description: 'DEPRECATED: CMS serverless functions are being sunset: creating them has ended, editing ends on November 17, 2026, and existing functions stop running on February 1, 2027. Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). 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.',
123
123
  inputSchema,
124
124
  annotations: {
125
125
  readOnlyHint: true,
@@ -54,7 +54,7 @@ export class HsListFunctionsTool extends Tool {
54
54
  register() {
55
55
  return this.mcpServer.registerTool(toolName, {
56
56
  title: 'List HubSpot CMS Serverless Functions',
57
- description: 'Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
57
+ description: 'DEPRECATED: CMS serverless functions are being sunset: creating them has ended, editing ends on November 17, 2026, and existing functions stop running on February 1, 2027. Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
58
58
  inputSchema,
59
59
  annotations: {
60
60
  readOnlyHint: true,
@@ -25,7 +25,10 @@ export class HsListTool extends Tool {
25
25
  }
26
26
  async handler({ path, account, absoluteCurrentWorkingDirectory }, extra) {
27
27
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
28
- const command = new HubSpotCommand(path ? `cms list ${path}` : 'cms list');
28
+ const command = new HubSpotCommand('cms list');
29
+ if (path) {
30
+ command.addArg(path);
31
+ }
29
32
  if (account) {
30
33
  command.addFlag('account', account);
31
34
  }
@@ -15,7 +15,6 @@ import { GetBuildStatusTool } from './project/GetBuildStatusTool.js';
15
15
  import { HsListTool } from './cms/HsListTool.js';
16
16
  import { HsCreateModuleTool } from './cms/HsCreateModuleTool.js';
17
17
  import { HsCreateTemplateTool } from './cms/HsCreateTemplateTool.js';
18
- import { HsCreateFunctionTool } from './cms/HsCreateFunctionTool.js';
19
18
  import { HsListFunctionsTool } from './cms/HsListFunctionsTool.js';
20
19
  import { HsFunctionLogsTool } from './cms/HsFunctionLogsTool.js';
21
20
  import { CreateTestAccountTool } from './project/CreateTestAccountTool.js';
@@ -49,7 +48,6 @@ export function registerCmsTools(mcpServer, logger) {
49
48
  new HsListTool(mcpServer, logger).register(),
50
49
  new HsCreateModuleTool(mcpServer, logger).register(),
51
50
  new HsCreateTemplateTool(mcpServer, logger).register(),
52
- new HsCreateFunctionTool(mcpServer, logger).register(),
53
51
  new HsListFunctionsTool(mcpServer, logger).register(),
54
52
  new HsFunctionLogsTool(mcpServer, logger).register(),
55
53
  ];
@@ -1,11 +1,10 @@
1
1
  import z from 'zod';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { formatErrorTextContents, formatTextContents, } from '../../utils/content.js';
4
+ import { getToolErrorMessage } from '../../utils/errors.js';
4
5
  import { absoluteCurrentWorkingDirectory, docUrl } from './constants.js';
5
6
  import { http } from '@hubspot/local-dev-lib/http/unauthed';
6
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
7
7
  import { setupHubSpotConfig } from '../../utils/config.js';
8
- import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
9
8
  const offset = z
10
9
  .number()
11
10
  .int()
@@ -82,10 +81,7 @@ export class DocFetchTool extends Tool {
82
81
  message: 'Handler caught error',
83
82
  error: error instanceof Error ? error.message : String(error),
84
83
  });
85
- if (isHubSpotHttpError(error)) {
86
- return formatErrorTextContents(error.toString());
87
- }
88
- const errorMessage = `Error fetching documentation: ${getErrorMessage(error)}`;
84
+ const errorMessage = `Error fetching documentation: ${getToolErrorMessage(error)}`;
89
85
  return formatErrorTextContents(errorMessage);
90
86
  }
91
87
  }
@@ -2,11 +2,10 @@ import { http } from '@hubspot/local-dev-lib/http';
2
2
  import z from 'zod';
3
3
  import { Tool } from '../../Tool.js';
4
4
  import { formatTextContents } from '../../utils/content.js';
5
+ import { getToolErrorMessage } from '../../utils/errors.js';
5
6
  import { absoluteCurrentWorkingDirectory, account, docsSearchQuery, } from './constants.js';
6
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
7
7
  import { setupHubSpotConfig } from '../../utils/config.js';
8
8
  import { resolveAccountId } from './resolveAccount.js';
9
- import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
10
9
  const docsSearchLimit = z
11
10
  .number()
12
11
  .int()
@@ -80,11 +79,7 @@ export class DocsSearchTool extends Tool {
80
79
  message: 'Handler caught error',
81
80
  error: error instanceof Error ? error.message : String(error),
82
81
  });
83
- if (isHubSpotHttpError(error)) {
84
- // Handle different status codes
85
- return formatTextContents(error.toString());
86
- }
87
- const errorMessage = `Error searching documentation: ${getErrorMessage(error)}`;
82
+ const errorMessage = `Error searching documentation: ${getToolErrorMessage(error)}`;
88
83
  return formatTextContents(errorMessage);
89
84
  }
90
85
  }
@@ -2,11 +2,10 @@ import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { http } from '@hubspot/local-dev-lib/http';
4
4
  import { formatTextContents } from '../../utils/content.js';
5
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
5
+ import { getToolErrorMessage } from '../../utils/errors.js';
6
6
  import { absoluteCurrentWorkingDirectory, absoluteProjectPath, account, } from './constants.js';
7
7
  import { setupHubSpotConfig } from '../../utils/config.js';
8
8
  import { resolveAccountId } from './resolveAccount.js';
9
- import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
10
9
  import { elicitSelection } from '../../utils/elicitSelection.js';
11
10
  import { getApps } from './apps.js';
12
11
  const inputSchema = {
@@ -83,11 +82,7 @@ export class GetApiUsagePatternsByAppIdTool extends Tool {
83
82
  message: 'Handler caught error',
84
83
  error: error instanceof Error ? error.message : String(error),
85
84
  });
86
- if (isHubSpotHttpError(error)) {
87
- // Handle HubSpot-specific HTTP errors
88
- return formatTextContents(error.toString());
89
- }
90
- return formatTextContents(getErrorMessage(error));
85
+ return formatTextContents(getToolErrorMessage(error));
91
86
  }
92
87
  }
93
88
  register() {
@@ -1,11 +1,10 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { formatTextContents } from '../../utils/content.js';
4
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
4
+ import { getToolErrorMessage } from '../../utils/errors.js';
5
5
  import { absoluteCurrentWorkingDirectory, absoluteProjectPath, account, } from './constants.js';
6
6
  import { setupHubSpotConfig } from '../../utils/config.js';
7
7
  import { resolveAccountId } from './resolveAccount.js';
8
- import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
9
8
  import { getApps } from './apps.js';
10
9
  const inputSchema = {
11
10
  absoluteCurrentWorkingDirectory,
@@ -39,11 +38,7 @@ export class GetApplicationInfoTool extends Tool {
39
38
  message: 'Handler caught error',
40
39
  error: error instanceof Error ? error.message : String(error),
41
40
  });
42
- if (isHubSpotHttpError(error)) {
43
- // Handle HubSpot-specific HTTP errors
44
- return formatTextContents(error.toString());
45
- }
46
- return formatTextContents(getErrorMessage(error));
41
+ return formatTextContents(getToolErrorMessage(error));
47
42
  }
48
43
  }
49
44
  register() {
@@ -1,7 +1,7 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { formatTextContents } from '../../utils/content.js';
4
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
4
+ import { getToolErrorMessage } from '../../utils/errors.js';
5
5
  import { http } from '@hubspot/local-dev-lib/http';
6
6
  import { getProjectConfig } from '../../../lib/projects/config.js';
7
7
  import { absoluteCurrentWorkingDirectory, absoluteProjectPath, account, } from './constants.js';
@@ -104,17 +104,7 @@ export class GetBuildLogsTool extends Tool {
104
104
  message: 'Handler caught error',
105
105
  error: error instanceof Error ? error.message : String(error),
106
106
  });
107
- let errorMessage;
108
- if (isHubSpotHttpError(error)) {
109
- errorMessage = error.toString();
110
- }
111
- else if (error instanceof Error) {
112
- errorMessage = error.message;
113
- }
114
- else {
115
- errorMessage = String(error);
116
- }
117
- return formatTextContents(absoluteCurrentWorkingDirectory, errorMessage);
107
+ return formatTextContents(absoluteCurrentWorkingDirectory, getToolErrorMessage(error));
118
108
  }
119
109
  }
120
110
  register() {
@@ -1,7 +1,7 @@
1
1
  import { Tool } from '../../Tool.js';
2
2
  import { z } from 'zod';
3
3
  import { formatTextContents } from '../../utils/content.js';
4
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
4
+ import { getToolErrorMessage } from '../../utils/errors.js';
5
5
  import { fetchProjectBuilds, getBuildStatus, } from '@hubspot/local-dev-lib/api/projects';
6
6
  import { getProjectConfig } from '../../../lib/projects/config.js';
7
7
  import moment from 'moment';
@@ -145,17 +145,7 @@ export class GetBuildStatusTool extends Tool {
145
145
  message: 'Handler caught error',
146
146
  error: error instanceof Error ? error.message : String(error),
147
147
  });
148
- let errorMessage;
149
- if (isHubSpotHttpError(error)) {
150
- errorMessage = error.toString();
151
- }
152
- else if (error instanceof Error) {
153
- errorMessage = error.message;
154
- }
155
- else {
156
- errorMessage = String(error);
157
- }
158
- return formatTextContents(absoluteCurrentWorkingDirectory, errorMessage);
148
+ return formatTextContents(absoluteCurrentWorkingDirectory, getToolErrorMessage(error));
159
149
  }
160
150
  }
161
151
  register() {
@@ -2,8 +2,8 @@ import { http } from '@hubspot/local-dev-lib/http/unauthed';
2
2
  import z from 'zod';
3
3
  import { Tool } from '../../Tool.js';
4
4
  import { formatTextContents } from '../../utils/content.js';
5
+ import { getToolErrorMessage } from '../../utils/errors.js';
5
6
  import { absoluteCurrentWorkingDirectory, knowledgeSearchQuery, } from './constants.js';
6
- import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
7
7
  import { setupHubSpotConfig } from '../../utils/config.js';
8
8
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
9
9
  const knowledgeSearchLimit = z
@@ -61,10 +61,7 @@ export class KnowledgeSearchTool extends Tool {
61
61
  message: 'Handler caught error',
62
62
  error: getErrorMessage(error),
63
63
  });
64
- if (isHubSpotHttpError(error)) {
65
- return formatTextContents(error.toString());
66
- }
67
- const errorMessage = `Error searching the knowledge base: ${getErrorMessage(error)}`;
64
+ const errorMessage = `Error searching the knowledge base: ${getToolErrorMessage(error)}`;
68
65
  return formatTextContents(errorMessage);
69
66
  }
70
67
  }
@@ -1,6 +1,7 @@
1
1
  import z from 'zod';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { formatTextContents } from '../../utils/content.js';
4
+ import { getToolErrorMessage } from '../../utils/errors.js';
4
5
  import { setupHubSpotConfig } from '../../utils/config.js';
5
6
  import { absoluteCurrentWorkingDirectory, account } from './constants.js';
6
7
  import { resolveAccountId } from './resolveAccount.js';
@@ -53,7 +54,7 @@ export class SubmitFeedbackTool extends Tool {
53
54
  message: 'Handler caught error',
54
55
  error: getErrorMessage(error),
55
56
  });
56
- return formatTextContents(`Error sending feedback: ${getErrorMessage(error)}`);
57
+ return formatTextContents(`Error sending feedback: ${getToolErrorMessage(error)}`);
57
58
  }
58
59
  }
59
60
  register() {
@@ -1,7 +1,17 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs';
3
3
  import util from 'util';
4
- import { exec, spawn } from 'node:child_process';
4
+ import { exec } from 'node:child_process';
5
+ import { crossPlatformSpawn } from '../../lib/crossPlatformSpawn/index.js';
6
+ import { lib } from '../../lang/en.js';
7
+ function formatFlag({ name, value }) {
8
+ const flag = `--${name}`;
9
+ const values = (Array.isArray(value) ? value : [value]).map(String);
10
+ if (values.some(item => item.startsWith('-'))) {
11
+ return values.map(item => `${flag}=${item}`);
12
+ }
13
+ return [flag, ...values];
14
+ }
5
15
  export class HubSpotCommand {
6
16
  executable = 'hs';
7
17
  subcommandArgs;
@@ -13,6 +23,9 @@ export class HubSpotCommand {
13
23
  this.flags = [...flags];
14
24
  }
15
25
  addArg(value) {
26
+ if (value.startsWith('-')) {
27
+ throw new Error(lib.hubSpotCommand.argStartsWithDash(value));
28
+ }
16
29
  this.positionalArgs.push(value);
17
30
  return this;
18
31
  }
@@ -24,9 +37,7 @@ export class HubSpotCommand {
24
37
  return [
25
38
  ...this.subcommandArgs,
26
39
  ...this.positionalArgs,
27
- ...this.flags.flatMap(({ name, value }) => Array.isArray(value)
28
- ? [`--${name}`, ...value.map(String)]
29
- : [`--${name}`, String(value)]),
40
+ ...this.flags.flatMap(formatFlag),
30
41
  ];
31
42
  }
32
43
  }
@@ -64,7 +75,7 @@ export async function runCommandInDir(directory, command, onData) {
64
75
  return new Promise((resolve, reject) => {
65
76
  const stdoutChunks = [];
66
77
  const stderrChunks = [];
67
- const child = spawn(finalCommand.executable, finalCommand.args, {
78
+ const child = crossPlatformSpawn(finalCommand.executable, finalCommand.args, {
68
79
  cwd: resolvedDir,
69
80
  env: { ...process.env, INIT_CWD: resolvedDir },
70
81
  });
@@ -0,0 +1 @@
1
+ export declare function getToolErrorMessage(error: unknown): string;
@@ -0,0 +1,9 @@
1
+ import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
2
+ import { getErrorMessage } from '../../lib/errorHandlers/index.js';
3
+ import { getConfigCredentials } from '../../lib/accountCredentials.js';
4
+ export function getToolErrorMessage(error) {
5
+ const message = isHubSpotHttpError(error)
6
+ ? error.toString()
7
+ : getErrorMessage(error);
8
+ return getConfigCredentials().reduce((redactedMessage, credential) => redactedMessage.replaceAll(credential, '[redacted]'), message);
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "8.18.0-beta.0",
3
+ "version": "8.19.0-beta.0",
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",
@@ -10,11 +10,11 @@
10
10
  "!**/__tests__/**"
11
11
  ],
12
12
  "dependencies": {
13
- "@hubspot/local-dev-lib": "5.14.0",
13
+ "@hubspot/local-dev-lib": "5.14.1",
14
14
  "@hubspot/project-parsing-lib": "0.23.7",
15
15
  "@hubspot/ui-extensions-dev-server": "2.2.5",
16
16
  "@inquirer/prompts": "7.10.1",
17
- "@modelcontextprotocol/sdk": "1.32.1",
17
+ "@modelcontextprotocol/sdk": "1.32.2",
18
18
  "archiver": "7.0.1",
19
19
  "chalk": "5.6.2",
20
20
  "chokidar": "4.0.3",
@@ -30,13 +30,13 @@
30
30
  "moment": "2.31.0",
31
31
  "open": "7.4.2",
32
32
  "p-queue": "8.1.1",
33
- "react": "19.3.0",
34
- "semver": "7.8.5",
33
+ "react": "19.3.1",
34
+ "semver": "7.8.6",
35
35
  "strip-ansi": "7.2.0",
36
- "table": "6.9.0",
36
+ "table": "6.10.1",
37
37
  "tmp": "0.2.7",
38
38
  "update-notifier": "7.3.1",
39
- "ws": "8.22.0",
39
+ "ws": "8.22.2",
40
40
  "yargs": "17.7.3",
41
41
  "yargs-parser": "21.1.1",
42
42
  "zod": "^4.4.3"
@@ -58,7 +58,7 @@
58
58
  "@typescript-eslint/eslint-plugin": "^8.30.1",
59
59
  "@typescript-eslint/parser": "^8.11.0",
60
60
  "@vitest/coverage-v8": "^4.1.11",
61
- "axios": "1.20.0",
61
+ "axios": "1.21.1",
62
62
  "eslint": "^8.56.0",
63
63
  "eslint-plugin-import": "^2.31.0",
64
64
  "husky": "^4.3.8",
@@ -124,7 +124,7 @@
124
124
  "eslint-visitor-keys": "4.2.0",
125
125
  "@eslint-community/eslint-utils": "4.9.0",
126
126
  "@opentelemetry/core": "2.10.0",
127
- "axios": "1.20.0",
127
+ "axios": "1.21.1",
128
128
  "vite": "6.4.3"
129
129
  }
130
130
  }
@@ -1,26 +0,0 @@
1
- import { McpToolResponse } from '../../types.js';
2
- import { Tool, ToolExtra } from '../../Tool.js';
3
- import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
- import { McpLogger } from '../../utils/logger.js';
5
- import { z } from 'zod';
6
- declare const inputSchemaZodObject: z.ZodObject<{
7
- absoluteCurrentWorkingDirectory: z.ZodString;
8
- dest: z.ZodOptional<z.ZodString>;
9
- functionsFolder: z.ZodOptional<z.ZodString>;
10
- filename: z.ZodOptional<z.ZodString>;
11
- endpointMethod: z.ZodOptional<z.ZodEnum<{
12
- GET: "GET";
13
- DELETE: "DELETE";
14
- POST: "POST";
15
- PUT: "PUT";
16
- PATCH: "PATCH";
17
- }>>;
18
- endpointPath: z.ZodOptional<z.ZodString>;
19
- }, z.core.$strip>;
20
- export type HsCreateFunctionInputSchema = z.infer<typeof inputSchemaZodObject>;
21
- export declare class HsCreateFunctionTool extends Tool<HsCreateFunctionInputSchema> {
22
- constructor(mcpServer: McpServer, logger: McpLogger);
23
- handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
24
- register(): RegisteredTool;
25
- }
26
- export {};
@@ -1,100 +0,0 @@
1
- import { Tool } from '../../Tool.js';
2
- import { z } from 'zod';
3
- import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
4
- import { formatTextContents, formatTextContent } from '../../utils/content.js';
5
- import { HTTP_METHODS } from '../../../types/Cms.js';
6
- import { HubSpotCommand } from '../../utils/command.js';
7
- import { setupHubSpotConfig } from '../../utils/config.js';
8
- import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
9
- const inputSchema = {
10
- absoluteCurrentWorkingDirectory,
11
- dest: z
12
- .string()
13
- .describe('The destination path where the function should be created on the current computer.')
14
- .optional(),
15
- functionsFolder: z
16
- .string()
17
- .describe('Folder name for function creation. Required for non-interactive function creation. If the user has not specified the folder name, ask them to provide it.')
18
- .optional(),
19
- filename: z
20
- .string()
21
- .describe('Function filename. Required for non-interactive function creation. If the user has not specified the filename, ask them to provide it.')
22
- .optional(),
23
- endpointMethod: z
24
- .enum(HTTP_METHODS)
25
- .describe(`HTTP method for the function endpoint. Must be one of: ${HTTP_METHODS.join(', ')}. Defaults to GET.`)
26
- .optional(),
27
- endpointPath: z
28
- .string()
29
- .describe('API endpoint path for the function. Required for non-interactive function creation. If the user has not specified the endpoint path, ask them to provide it.')
30
- .optional(),
31
- };
32
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
- const inputSchemaZodObject = z.object({ ...inputSchema });
34
- const toolName = 'create-cms-function';
35
- export class HsCreateFunctionTool extends Tool {
36
- constructor(mcpServer, logger) {
37
- super(mcpServer, logger, toolName);
38
- }
39
- async handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }, extra) {
40
- setupHubSpotConfig(absoluteCurrentWorkingDirectory);
41
- const content = [];
42
- // Require functions folder
43
- if (!functionsFolder) {
44
- content.push(formatTextContent(`Ask the user to provide the folder name for the function.`));
45
- }
46
- // Require filename
47
- if (!filename) {
48
- content.push(formatTextContent(`Ask the user to provide the filename for the function.`));
49
- }
50
- // Require endpoint path
51
- if (!endpointPath) {
52
- content.push(formatTextContent(`Ask the user to provide the API endpoint path for the function.`));
53
- }
54
- // If we have missing required information, return the prompts
55
- if (content.length > 0) {
56
- return {
57
- content,
58
- };
59
- }
60
- // Build the command
61
- const command = new HubSpotCommand('cms function create');
62
- if (dest) {
63
- command.addArg(dest);
64
- }
65
- if (functionsFolder) {
66
- command.addFlag('functions-folder', functionsFolder);
67
- }
68
- if (filename) {
69
- command.addFlag('filename', filename);
70
- }
71
- command.addFlag('endpoint-method', endpointMethod ?? 'GET');
72
- if (endpointPath) {
73
- command.addFlag('endpoint-path', endpointPath);
74
- }
75
- try {
76
- const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
77
- return formatTextContents(stdout, stderr);
78
- }
79
- catch (error) {
80
- this.logger.debug(toolName, {
81
- message: 'Handler caught error',
82
- error: error instanceof Error ? error.message : String(error),
83
- });
84
- return formatTextContents(getErrorMessage(error));
85
- }
86
- }
87
- register() {
88
- return this.mcpServer.registerTool(toolName, {
89
- title: 'Create HubSpot CMS Serverless Function',
90
- description: `Creates a new HubSpot CMS serverless function using the hs cms function create command. This is for CMS/website projects, served at /hs/serverless/<path>. Do NOT use this for developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). For those, use add-feature-to-project. Functions can be created non-interactively by specifying functionsFolder, filename, and endpointPath. Supports all HTTP methods (${HTTP_METHODS.join(', ')}).`,
91
- inputSchema,
92
- annotations: {
93
- readOnlyHint: false,
94
- destructiveHint: false,
95
- idempotentHint: false,
96
- openWorldHint: false,
97
- },
98
- }, (input, extra) => this.wrappedHandler(input, extra));
99
- }
100
- }