@hubspot/cli 7.5.3 → 7.5.4-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.
@@ -20,6 +20,10 @@ const describe = undefined;
20
20
  async function handler(args) {
21
21
  const { derivedAccountId, providedAccountId, profile } = args;
22
22
  const { projectConfig, projectDir } = await (0, config_2.getProjectConfig)();
23
+ if (!projectConfig) {
24
+ logger_1.uiLogger.error(en_1.commands.project.validate.mustBeRanWithinAProject);
25
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
26
+ }
23
27
  if (!(0, buildAndDeploy_1.useV3Api)(projectConfig?.platformVersion)) {
24
28
  logger_1.uiLogger.error(en_1.commands.project.validate.badVersion);
25
29
  process.exit(exitCodes_1.EXIT_CODES.ERROR);
package/lang/en.d.ts CHANGED
@@ -838,12 +838,10 @@ Global configuration replaces hubspot.config.yml, and you will be prompted to mi
838
838
  readonly claudeCodeInstallFailed: "Claude Code CLI not working - skipping configuration";
839
839
  readonly failedToConfigureClaudeDesktop: "Failed to configure Claude Desktop";
840
840
  readonly configuringCursor: "Configuring Cursor...";
841
- readonly noCursorMcpFile: (configFile: string) => string;
842
841
  readonly failedToConfigureCursor: "Failed to configure Cursor";
843
842
  readonly configuredCursor: "Configured Cursor";
844
843
  readonly alreadyInstalled: "HubSpot CLI mcp server already installed, reinstalling";
845
844
  readonly configuringWindsurf: "Configuring Cursor...";
846
- readonly noWindsurfFile: (configFile: string) => string;
847
845
  readonly failedToConfigureWindsurf: "Failed to configure Cursor";
848
846
  readonly configuredWindsurf: "Configured Windsurf";
849
847
  };
@@ -1371,6 +1369,7 @@ ${string}`;
1371
1369
  };
1372
1370
  readonly validate: {
1373
1371
  readonly describe: "Validate the project before uploading";
1372
+ readonly mustBeRanWithinAProject: "This command must be run from within a project directory.";
1374
1373
  readonly badVersion: "This command is only available for projects 2025.2 and later.";
1375
1374
  readonly examples: {
1376
1375
  readonly default: "Validate the project before uploading";
package/lang/en.js CHANGED
@@ -833,7 +833,7 @@ exports.commands = {
833
833
  client: 'Target applications to configure',
834
834
  docsSearch: 'Should the docs search mcp server be installed',
835
835
  },
836
- success: (derivedTargets) => `You can now use the HubSpot CLI tools in ${derivedTargets.join(', ')}. ${chalk_1.default.bold('You may need to restart these tools to apply the changes')}.`,
836
+ success: (derivedTargets) => `You can now use the HubSpot CLI MCP Server in ${derivedTargets.join(', ')}. ${chalk_1.default.bold('You may need to restart these tools to apply the changes')}.`,
837
837
  errors: {
838
838
  needsNode20: `This feature requires node >=20`,
839
839
  },
@@ -847,12 +847,10 @@ exports.commands = {
847
847
  claudeCodeInstallFailed: 'Claude Code CLI not working - skipping configuration',
848
848
  failedToConfigureClaudeDesktop: 'Failed to configure Claude Desktop',
849
849
  configuringCursor: 'Configuring Cursor...',
850
- noCursorMcpFile: (configFile) => `No ${configFile} file found - skipping Cursor configuration`,
851
850
  failedToConfigureCursor: 'Failed to configure Cursor',
852
851
  configuredCursor: 'Configured Cursor',
853
852
  alreadyInstalled: 'HubSpot CLI mcp server already installed, reinstalling',
854
853
  configuringWindsurf: 'Configuring Cursor...',
855
- noWindsurfFile: (configFile) => `No ${configFile} file found - skipping Windsurf configuration`,
856
854
  failedToConfigureWindsurf: 'Failed to configure Cursor',
857
855
  configuredWindsurf: 'Configured Windsurf',
858
856
  },
@@ -1369,6 +1367,7 @@ exports.commands = {
1369
1367
  },
1370
1368
  validate: {
1371
1369
  describe: 'Validate the project before uploading',
1370
+ mustBeRanWithinAProject: 'This command must be run from within a project directory.',
1372
1371
  badVersion: 'This command is only available for projects 2025.2 and later.',
1373
1372
  examples: {
1374
1373
  default: 'Validate the project before uploading',
@@ -8,5 +8,14 @@ export declare const supportedTools: ({
8
8
  name: "Windsurf";
9
9
  value: string;
10
10
  })[];
11
+ interface McpCommand {
12
+ command: string;
13
+ args: string[];
14
+ }
11
15
  export declare function addMintlifyMcpServer(installTargets: string[]): Promise<void>;
16
+ export declare function setupMintlify(derivedTargets?: string[]): Promise<boolean>;
12
17
  export declare function addMcpServerToConfig(targets: string[] | undefined): Promise<string[]>;
18
+ export declare function setupClaudeCode(mcpCommand?: McpCommand): Promise<boolean>;
19
+ export declare function setupCursor(mcpCommand?: McpCommand): boolean;
20
+ export declare function setupWindsurf(mcpCommand?: McpCommand): boolean;
21
+ export {};
package/lib/mcp/setup.js CHANGED
@@ -5,17 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.supportedTools = void 0;
7
7
  exports.addMintlifyMcpServer = addMintlifyMcpServer;
8
+ exports.setupMintlify = setupMintlify;
8
9
  exports.addMcpServerToConfig = addMcpServerToConfig;
10
+ exports.setupClaudeCode = setupClaudeCode;
11
+ exports.setupCursor = setupCursor;
12
+ exports.setupWindsurf = setupWindsurf;
9
13
  const logger_1 = require("../ui/logger");
10
14
  const en_1 = require("../../lang/en");
11
- const child_process_1 = require("child_process");
12
15
  const promptUtils_1 = require("../prompts/promptUtils");
13
16
  const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
14
17
  const errorHandlers_1 = require("../errorHandlers");
15
- const fs_1 = __importDefault(require("fs"));
16
18
  const command_1 = require("../../mcp-server/utils/command");
19
+ const child_process_1 = require("child_process");
17
20
  const path_1 = __importDefault(require("path"));
18
21
  const os_1 = __importDefault(require("os"));
22
+ const fs_extra_1 = __importDefault(require("fs-extra"));
19
23
  const mcpServerName = 'hubspot-cli-mcp';
20
24
  const claudeCode = 'claude';
21
25
  const windsurf = 'windsurf';
@@ -26,12 +30,14 @@ exports.supportedTools = [
26
30
  { name: en_1.commands.mcp.setup.cursor, value: cursor },
27
31
  { name: en_1.commands.mcp.setup.windsurf, value: windsurf },
28
32
  ];
29
- const hsCommand = 'hs';
30
- const mcpCommandArgs = ['mcp', 'start'];
33
+ const defaultMcpCommand = {
34
+ command: 'hs',
35
+ args: ['mcp', 'start'],
36
+ };
31
37
  async function addMintlifyMcpServer(installTargets) {
32
38
  await runSetupFunction(() => setupMintlify(installTargets));
33
39
  }
34
- async function setupMintlify(derivedTargets) {
40
+ async function setupMintlify(derivedTargets = supportedMintlifyClients) {
35
41
  logger_1.uiLogger.info(en_1.commands.mcp.setup.installingDocSearch);
36
42
  logger_1.uiLogger.log('');
37
43
  return new Promise(resolve => {
@@ -101,15 +107,10 @@ function setupMcpConfigFile(config) {
101
107
  SpinniesManager_1.default.add('spinner', {
102
108
  text: config.configuringMessage,
103
109
  });
104
- if (!fs_1.default.existsSync(config.configPath)) {
105
- SpinniesManager_1.default.fail('spinner', {
106
- text: config.configMissingMessage,
107
- });
108
- return false;
109
- }
110
+ fs_extra_1.default.ensureFileSync(config.configPath);
110
111
  let mcpConfig = {};
111
112
  try {
112
- const configContent = fs_1.default.readFileSync(config.configPath, 'utf8');
113
+ const configContent = fs_extra_1.default.readFileSync(config.configPath, 'utf8');
113
114
  mcpConfig = JSON.parse(configContent);
114
115
  }
115
116
  catch (error) {
@@ -125,11 +126,10 @@ function setupMcpConfigFile(config) {
125
126
  }
126
127
  // Add or update HubSpot CLI MCP server
127
128
  mcpConfig.mcpServers[mcpServerName] = {
128
- command: hsCommand,
129
- args: mcpCommandArgs,
129
+ ...config.mcpCommand,
130
130
  };
131
131
  // Write the updated config
132
- fs_1.default.writeFileSync(config.configPath, JSON.stringify(mcpConfig, null, 2));
132
+ fs_extra_1.default.writeFileSync(config.configPath, JSON.stringify(mcpConfig, null, 2));
133
133
  SpinniesManager_1.default.succeed('spinner', {
134
134
  text: config.configuredMessage,
135
135
  });
@@ -143,7 +143,7 @@ function setupMcpConfigFile(config) {
143
143
  return false;
144
144
  }
145
145
  }
146
- async function setupClaudeCode() {
146
+ async function setupClaudeCode(mcpCommand = defaultMcpCommand) {
147
147
  try {
148
148
  SpinniesManager_1.default.add('claudeCode', {
149
149
  text: en_1.commands.mcp.setup.spinners.configuringClaudeCode,
@@ -154,8 +154,7 @@ async function setupClaudeCode() {
154
154
  // Run claude mcp add command
155
155
  const mcpConfig = JSON.stringify({
156
156
  type: 'stdio',
157
- command: hsCommand,
158
- args: mcpCommandArgs,
157
+ ...mcpCommand,
159
158
  });
160
159
  const { stdout } = await (0, command_1.execAsync)('claude mcp list');
161
160
  if (stdout.includes(mcpServerName)) {
@@ -194,23 +193,23 @@ async function setupClaudeCode() {
194
193
  return false;
195
194
  }
196
195
  }
197
- function setupCursor() {
196
+ function setupCursor(mcpCommand = defaultMcpCommand) {
198
197
  const cursorConfigPath = path_1.default.join(os_1.default.homedir(), '.cursor', 'mcp.json');
199
198
  return setupMcpConfigFile({
200
199
  configPath: cursorConfigPath,
201
200
  configuringMessage: en_1.commands.mcp.setup.spinners.configuringCursor,
202
201
  configuredMessage: en_1.commands.mcp.setup.spinners.configuredCursor,
203
202
  failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureCursor,
204
- configMissingMessage: en_1.commands.mcp.setup.spinners.noCursorMcpFile(cursorConfigPath),
203
+ mcpCommand,
205
204
  });
206
205
  }
207
- function setupWindsurf() {
206
+ function setupWindsurf(mcpCommand = defaultMcpCommand) {
208
207
  const windsurfConfigPath = path_1.default.join(os_1.default.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
209
208
  return setupMcpConfigFile({
210
209
  configPath: windsurfConfigPath,
211
210
  configuringMessage: en_1.commands.mcp.setup.spinners.configuringWindsurf,
212
211
  configuredMessage: en_1.commands.mcp.setup.spinners.configuredWindsurf,
213
212
  failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureWindsurf,
214
- configMissingMessage: en_1.commands.mcp.setup.spinners.noWindsurfFile(windsurfConfigPath),
213
+ mcpCommand,
215
214
  });
216
215
  }
@@ -6,6 +6,7 @@ const CreateProjectTool_1 = require("./project/CreateProjectTool");
6
6
  const GuidedWalkthroughTool_1 = require("./project/GuidedWalkthroughTool");
7
7
  const DeployProject_1 = require("./project/DeployProject");
8
8
  const AddFeatureToProject_1 = require("./project/AddFeatureToProject");
9
+ const ValidateProjectTool_1 = require("./project/ValidateProjectTool");
9
10
  function registerProjectTools(mcpServer) {
10
11
  return [
11
12
  new UploadProjectTools_1.UploadProjectTools(mcpServer).register(),
@@ -13,5 +14,6 @@ function registerProjectTools(mcpServer) {
13
14
  new GuidedWalkthroughTool_1.GuidedWalkthroughTool(mcpServer).register(),
14
15
  new DeployProject_1.DeployProject(mcpServer).register(),
15
16
  new AddFeatureToProject_1.AddFeatureToProject(mcpServer).register(),
17
+ new ValidateProjectTool_1.ValidateProjectTool(mcpServer).register(),
16
18
  ];
17
19
  }
@@ -3,26 +3,26 @@ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.
3
3
  import { z } from 'zod';
4
4
  declare const inputSchemaZodObject: z.ZodObject<{
5
5
  absoluteCurrentWorkingDirectory: z.ZodString;
6
- name: z.ZodString;
6
+ name: z.ZodOptional<z.ZodString>;
7
7
  destination: z.ZodString;
8
8
  projectBase: z.ZodUnion<[z.ZodLiteral<"empty">, z.ZodLiteral<"app">]>;
9
9
  distribution: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"marketplace">, z.ZodLiteral<"private">]>>;
10
10
  auth: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"oauth">]>>>;
11
11
  features: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"card">, z.ZodLiteral<"settings">, z.ZodLiteral<"app-function">, z.ZodLiteral<"webhooks">]>, "many">>;
12
12
  }, "strip", z.ZodTypeAny, {
13
- name: string;
14
13
  projectBase: "app" | "empty";
15
14
  absoluteCurrentWorkingDirectory: string;
16
15
  destination: string;
17
16
  auth?: "oauth" | "static" | undefined;
17
+ name?: string | undefined;
18
18
  distribution?: "marketplace" | "private" | undefined;
19
19
  features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
20
20
  }, {
21
- name: string;
22
21
  projectBase: "app" | "empty";
23
22
  absoluteCurrentWorkingDirectory: string;
24
23
  destination: string;
25
24
  auth?: "oauth" | "static" | undefined;
25
+ name?: string | undefined;
26
26
  distribution?: "marketplace" | "private" | undefined;
27
27
  features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
28
28
  }>;
@@ -13,7 +13,8 @@ const inputSchema = {
13
13
  absoluteCurrentWorkingDirectory: constants_2.absoluteCurrentWorkingDirectory,
14
14
  name: zod_1.z
15
15
  .string()
16
- .describe('The name of the project to be created. This name is how your project will appear in HubSpot.'),
16
+ .describe('The name of the project to be created. This name is how your project will appear in HubSpot. If not specified by the user, do not choose for them. Changing this is potentially destructive.')
17
+ .optional(),
17
18
  destination: zod_1.z
18
19
  .string()
19
20
  .describe('Relative path to the directory the project will be created in. DO NOT use the current directory unless the user has explicitly stated to do so.'),
@@ -56,6 +57,9 @@ class CreateProjectTool extends types_1.Tool {
56
57
  if (name) {
57
58
  command = (0, command_1.addFlag)(command, 'name', name);
58
59
  }
60
+ else {
61
+ content.push((0, content_1.formatTextContent)(`Ask the user what they would like to name the project.`));
62
+ }
59
63
  if (destination) {
60
64
  command = (0, command_1.addFlag)(command, 'dest', destination);
61
65
  }
@@ -42,7 +42,7 @@ class DeployProject extends types_1.Tool {
42
42
  register() {
43
43
  return this.mcpServer.registerTool('deploy-hubspot-project', {
44
44
  title: 'Deploy a build of HubSpot Project',
45
- description: 'Takes a build number and a project name and deploys that build of the project',
45
+ description: 'Takes a build number and a project name and deploys that build of the project. DO NOT run this tool unless the user specifies they would like to deploy the project.',
46
46
  inputSchema,
47
47
  }, this.handler);
48
48
  }
@@ -27,7 +27,7 @@ class UploadProjectTools extends types_1.Tool {
27
27
  register() {
28
28
  return this.mcpServer.registerTool('upload-hubspot-project', {
29
29
  title: 'Upload HubSpot Project',
30
- description: 'Uploads the HubSpot project in current working directory. If the project does not exist, it will be created. MUST be ran from within the project directory.',
30
+ description: 'Uploads the HubSpot project in current working directory. If the project does not exist, it will be created. MUST be ran from within the project directory. DO NOT run this tool unless the user specifies they would like to upload the project, it is potentially destructive',
31
31
  inputSchema,
32
32
  }, this.handler);
33
33
  }
@@ -0,0 +1,17 @@
1
+ import { TextContentResponse, Tool } from '../../types';
2
+ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { z } from 'zod';
4
+ declare const inputSchemaZodObject: z.ZodObject<{
5
+ absoluteProjectPath: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ absoluteProjectPath: string;
8
+ }, {
9
+ absoluteProjectPath: string;
10
+ }>;
11
+ export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
12
+ export declare class ValidateProjectTool extends Tool<CreateProjectInputSchema> {
13
+ constructor(mcpServer: McpServer);
14
+ handler({ absoluteProjectPath, }: CreateProjectInputSchema): Promise<TextContentResponse>;
15
+ register(): RegisteredTool;
16
+ }
17
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidateProjectTool = void 0;
4
+ const types_1 = require("../../types");
5
+ const zod_1 = require("zod");
6
+ const constants_1 = require("./constants");
7
+ const project_1 = require("../../utils/project");
8
+ const content_1 = require("../../utils/content");
9
+ const inputSchema = {
10
+ absoluteProjectPath: constants_1.absoluteProjectPath,
11
+ };
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ const inputSchemaZodObject = zod_1.z.object({ ...inputSchema });
14
+ class ValidateProjectTool extends types_1.Tool {
15
+ constructor(mcpServer) {
16
+ super(mcpServer);
17
+ }
18
+ async handler({ absoluteProjectPath, }) {
19
+ try {
20
+ const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, 'hs project validate');
21
+ return (0, content_1.formatTextContents)(stdout, stderr);
22
+ }
23
+ catch (error) {
24
+ return (0, content_1.formatTextContents)(error instanceof Error ? error.message : `${error}`);
25
+ }
26
+ }
27
+ register() {
28
+ return this.mcpServer.registerTool('validate-hubspot-project', {
29
+ title: 'Validate HubSpot Project',
30
+ description: 'Validates the HubSpot project and its configuration files. This tool does not need to be ran before uploading the project',
31
+ inputSchema,
32
+ }, this.handler);
33
+ }
34
+ }
35
+ exports.ValidateProjectTool = ValidateProjectTool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.5.3",
3
+ "version": "7.5.4-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",
@@ -66,22 +66,23 @@
66
66
  },
67
67
  "scripts": {
68
68
  "build": "ts-node ./scripts/build.ts",
69
+ "build-docker": "docker image build --tag hs-cli-image . && docker image prune -f",
70
+ "circular-deps": "yarn madge --circular .",
69
71
  "debug-mcp": "yarn build && npx @modelcontextprotocol/inspector node dist/mcp-server/server.js",
72
+ "hs": "yarn build && node ./dist/bin/hs",
73
+ "hs-debug": "yarn build && NODE_DEBUG=http* node --inspect-brk ./dist/bin/hs",
70
74
  "lint": "echo 'Linting is disabled for Blazar'",
71
75
  "lint:local": "eslint . && prettier --list-different './**/*.{ts,js,json}'",
72
76
  "list-all-commands": "yarn ts-node ./scripts/get-all-commands.ts",
73
77
  "local-link": "yarn ts-node ./scripts/linking.ts",
78
+ "mcp-local": "yarn ts-node ./scripts/mcp-local.ts",
74
79
  "prettier:write": "prettier --write './**/*.{ts,js,json}'",
80
+ "release": "yarn ts-node ./scripts/release.ts release",
75
81
  "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
76
82
  "test-cli": "yarn build && yarn --cwd 'acceptance-tests' test-ci",
77
83
  "test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",
78
- "test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
79
84
  "test-cli-latest": "yarn build && yarn build-docker && docker container run -it --rm --name=hs-cli-container hs-cli-image yarn --cwd 'acceptance-tests' test-latest",
80
- "build-docker": "docker image build --tag hs-cli-image . && docker image prune -f",
81
- "circular-deps": "yarn madge --circular .",
82
- "release": "yarn ts-node ./scripts/release.ts release",
83
- "hs": "yarn build && node ./dist/bin/hs",
84
- "hs-debug": "yarn build && NODE_DEBUG=http* node --inspect-brk ./dist/bin/hs",
85
+ "test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
85
86
  "update-ldl": "yarn add --exact @hubspot/local-dev-lib@latest",
86
87
  "view-unreleased-changes": "node ./scripts/unreleasedChanges.js"
87
88
  },