@hubspot/cli 7.7.17-experimental.0 → 7.7.18-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.
@@ -37,6 +37,7 @@ function setupBuilder(yargs) {
37
37
  })
38
38
  .option('add-docs-search', {
39
39
  type: 'boolean',
40
+ hidden: true,
40
41
  });
41
42
  return yargs;
42
43
  }
@@ -1,3 +1,6 @@
1
1
  import { CommonArgs, YargsCommandModule } from '../../types/Yargs';
2
- declare const mcpStartCommand: YargsCommandModule<unknown, CommonArgs>;
2
+ interface McpStartArgs extends CommonArgs {
3
+ aiAgent: string;
4
+ }
5
+ declare const mcpStartCommand: YargsCommandModule<unknown, McpStartArgs>;
3
6
  export default mcpStartCommand;
@@ -24,9 +24,9 @@ async function handler(args) {
24
24
  process.exit(exitCodes_1.EXIT_CODES.ERROR);
25
25
  }
26
26
  (0, usageTracking_1.trackCommandUsage)('mcp-start', {}, args.derivedAccountId);
27
- await startMcpServer();
27
+ await startMcpServer(args.aiAgent);
28
28
  }
29
- async function startMcpServer() {
29
+ async function startMcpServer(aiAgent) {
30
30
  try {
31
31
  const serverPath = path_1.default.join(__dirname, '..', '..', 'mcp-server', 'server.js');
32
32
  // Check if server file exists
@@ -36,11 +36,13 @@ async function startMcpServer() {
36
36
  }
37
37
  logger_1.uiLogger.info(en_1.commands.mcp.start.startingServer);
38
38
  logger_1.uiLogger.info(en_1.commands.mcp.start.stopInstructions);
39
+ const args = [serverPath];
39
40
  // Start the server using ts-node
40
- const child = (0, child_process_1.spawn)('node', [serverPath], {
41
+ const child = (0, child_process_1.spawn)(`node`, args, {
41
42
  stdio: 'inherit',
42
43
  env: {
43
44
  ...process.env,
45
+ HUBSPOT_MCP_AI_AGENT: aiAgent || 'unknown',
44
46
  },
45
47
  });
46
48
  // Handle server process events
@@ -63,6 +65,11 @@ async function startMcpServer() {
63
65
  }
64
66
  }
65
67
  function startBuilder(yargs) {
68
+ yargs
69
+ .option('ai-agent', {
70
+ type: 'string',
71
+ })
72
+ .demandOption('ai-agent');
66
73
  return yargs;
67
74
  }
68
75
  const builder = (0, yargsUtils_1.makeYargsBuilder)(startBuilder, command, describe, {
package/lib/mcp/setup.js CHANGED
@@ -157,7 +157,7 @@ async function setupClaudeCode(mcpCommand = defaultMcpCommand) {
157
157
  // Run claude mcp add command
158
158
  const mcpConfig = JSON.stringify({
159
159
  type: 'stdio',
160
- ...mcpCommand,
160
+ ...buildCommandWithAgentString(mcpCommand, claudeCode),
161
161
  });
162
162
  const { stdout } = await (0, command_1.execAsync)('claude mcp list');
163
163
  if (stdout.includes(mcpServerName)) {
@@ -203,7 +203,7 @@ function setupCursor(mcpCommand = defaultMcpCommand) {
203
203
  configuringMessage: en_1.commands.mcp.setup.spinners.configuringCursor,
204
204
  configuredMessage: en_1.commands.mcp.setup.spinners.configuredCursor,
205
205
  failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureCursor,
206
- mcpCommand,
206
+ mcpCommand: buildCommandWithAgentString(mcpCommand, cursor),
207
207
  });
208
208
  }
209
209
  function setupWindsurf(mcpCommand = defaultMcpCommand) {
@@ -213,6 +213,11 @@ function setupWindsurf(mcpCommand = defaultMcpCommand) {
213
213
  configuringMessage: en_1.commands.mcp.setup.spinners.configuringWindsurf,
214
214
  configuredMessage: en_1.commands.mcp.setup.spinners.configuredWindsurf,
215
215
  failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureWindsurf,
216
- mcpCommand,
216
+ mcpCommand: buildCommandWithAgentString(mcpCommand, windsurf),
217
217
  });
218
218
  }
219
+ function buildCommandWithAgentString(mcpCommand, agent) {
220
+ const mcpCommandCopy = structuredClone(mcpCommand);
221
+ mcpCommandCopy.args.push('--ai-agent', agent);
222
+ return mcpCommandCopy;
223
+ }
@@ -13,9 +13,9 @@ type Meta = {
13
13
  file?: boolean;
14
14
  successful?: boolean;
15
15
  };
16
- export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
17
- export declare function trackHelpUsage(command: string): Promise<void>;
18
- export declare function trackConvertFieldsUsage(command: string): Promise<void>;
19
- export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): Promise<void>;
20
- export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
16
+ export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): void;
17
+ export declare function trackHelpUsage(command: string): void;
18
+ export declare function trackConvertFieldsUsage(command: string): void;
19
+ export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): void;
20
+ export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): void;
21
21
  export {};
@@ -33,7 +33,7 @@ function getPlatform() {
33
33
  return process.platform;
34
34
  }
35
35
  }
36
- async function trackCommandUsage(command, meta = {}, accountId) {
36
+ function trackCommandUsage(command, meta = {}, accountId) {
37
37
  if (!(0, config_1.isTrackingAllowed)()) {
38
38
  return;
39
39
  }
@@ -46,88 +46,47 @@ async function trackCommandUsage(command, meta = {}, accountId) {
46
46
  ? accountConfig.authType
47
47
  : auth_1.API_KEY_AUTH_METHOD.value;
48
48
  }
49
- setImmediate(async () => {
50
- const usageTrackingEvent = {
51
- action: 'cli-command',
52
- os: getPlatform(),
53
- ...getNodeVersionData(),
54
- version: package_json_1.version,
55
- command,
56
- authType,
57
- ...meta,
58
- };
59
- try {
60
- await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
61
- logger_1.logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
62
- }
63
- catch (e) {
64
- (0, errorHandlers_1.debugError)(e);
65
- }
49
+ trackCliInteraction({
50
+ action: 'cli-command',
51
+ command,
52
+ authType,
53
+ ...meta,
54
+ accountId,
66
55
  });
67
56
  }
68
- async function trackHelpUsage(command) {
57
+ function trackHelpUsage(command) {
69
58
  if (!(0, config_1.isTrackingAllowed)()) {
70
59
  return;
71
60
  }
72
- try {
73
- if (command) {
74
- logger_1.logger.debug('Tracking help usage of "%s" sub-command', command);
75
- }
76
- else {
77
- logger_1.logger.debug('Tracking help usage of main command');
78
- }
79
- await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, {
80
- action: 'cli-help',
81
- os: getPlatform(),
82
- ...getNodeVersionData(),
83
- version: package_json_1.version,
84
- command,
85
- });
61
+ if (command) {
62
+ logger_1.logger.debug('Tracking help usage of "%s" sub-command', command);
86
63
  }
87
- catch (e) {
88
- (0, errorHandlers_1.debugError)(e);
64
+ else {
65
+ logger_1.logger.debug('Tracking help usage of main command');
89
66
  }
67
+ trackCliInteraction({
68
+ action: 'cli-help',
69
+ command,
70
+ });
90
71
  }
91
- async function trackConvertFieldsUsage(command) {
92
- if (!(0, config_1.isTrackingAllowed)()) {
93
- return;
94
- }
95
- try {
96
- logger_1.logger.debug('Attempting to track usage of "%s" command', command);
97
- await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, {
98
- action: 'cli-process-fields',
99
- os: getPlatform(),
100
- ...getNodeVersionData(),
101
- version: package_json_1.version,
102
- command,
103
- });
104
- }
105
- catch (e) {
106
- (0, errorHandlers_1.debugError)(e);
107
- }
72
+ function trackConvertFieldsUsage(command) {
73
+ trackCliInteraction({
74
+ action: 'cli-process-fields',
75
+ command,
76
+ });
108
77
  }
109
- async function trackAuthAction(command, authType, step, accountId) {
110
- if (!(0, config_1.isTrackingAllowed)()) {
111
- return;
112
- }
113
- const usageTrackingEvent = {
78
+ function trackAuthAction(command, authType, step, accountId) {
79
+ trackCliInteraction({
114
80
  action: 'cli-auth',
115
- os: getPlatform(),
116
- ...getNodeVersionData(),
117
- version: package_json_1.version,
118
81
  command,
119
82
  authType,
120
- step,
121
- };
122
- try {
123
- await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
124
- logger_1.logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
125
- }
126
- catch (e) {
127
- (0, errorHandlers_1.debugError)(e);
128
- }
83
+ accountId,
84
+ meta: {
85
+ step,
86
+ },
87
+ });
129
88
  }
130
- async function trackCommandMetadataUsage(command, meta = {}, accountId) {
89
+ function trackCommandMetadataUsage(command, meta = {}, accountId) {
131
90
  if (!(0, config_1.isTrackingAllowed)()) {
132
91
  return;
133
92
  }
@@ -140,9 +99,21 @@ async function trackCommandMetadataUsage(command, meta = {}, accountId) {
140
99
  ? accountConfig.authType
141
100
  : auth_1.API_KEY_AUTH_METHOD.value;
142
101
  }
143
- setImmediate(async () => {
102
+ trackCliInteraction({
103
+ action: 'cli-command-metadata',
104
+ command,
105
+ authType,
106
+ accountId,
107
+ meta,
108
+ });
109
+ }
110
+ function trackCliInteraction({ action, accountId, command, authType, meta = {}, }) {
111
+ try {
112
+ if (!(0, config_1.isTrackingAllowed)()) {
113
+ return;
114
+ }
144
115
  const usageTrackingEvent = {
145
- action: 'cli-command-metadata',
116
+ action,
146
117
  os: getPlatform(),
147
118
  ...getNodeVersionData(),
148
119
  version: package_json_1.version,
@@ -150,12 +121,33 @@ async function trackCommandMetadataUsage(command, meta = {}, accountId) {
150
121
  authType,
151
122
  ...meta,
152
123
  };
153
- try {
154
- await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
155
- logger_1.logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
124
+ logger_1.logger.debug('LFFFFFGGGGGG');
125
+ logger_1.logger.debug(process.env);
126
+ if (process.env.HUBSPOT_MCP_AI_AGENT) {
127
+ setImmediate(async () => {
128
+ try {
129
+ await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, {
130
+ ...usageTrackingEvent,
131
+ action: 'cli-mcp-server',
132
+ type: process.env.HUBSPOT_MCP_AI_AGENT,
133
+ }, accountId);
134
+ }
135
+ catch (error) {
136
+ (0, errorHandlers_1.debugError)(error);
137
+ }
138
+ });
156
139
  }
157
- catch (e) {
158
- (0, errorHandlers_1.debugError)(e);
159
- }
160
- });
140
+ setImmediate(async () => {
141
+ try {
142
+ await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
143
+ }
144
+ catch (error) {
145
+ (0, errorHandlers_1.debugError)(error);
146
+ }
147
+ });
148
+ logger_1.logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
149
+ }
150
+ catch (e) {
151
+ (0, errorHandlers_1.debugError)(e);
152
+ }
161
153
  }
@@ -21,7 +21,7 @@ class UploadProjectTools extends types_1.Tool {
21
21
  super(mcpServer);
22
22
  }
23
23
  async handler({ absoluteProjectPath, }) {
24
- const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project upload --force-create`);
24
+ const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project upload --force-create --debug`);
25
25
  return (0, content_1.formatTextContents)(stdout, stderr);
26
26
  }
27
27
  register() {
@@ -13,5 +13,8 @@ async function runCommandInDir(directory, command) {
13
13
  }
14
14
  return (0, command_1.execAsync)(command, {
15
15
  cwd: path_1.default.resolve(directory),
16
+ env: {
17
+ ...process.env,
18
+ },
16
19
  });
17
20
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.7.17-experimental.0",
3
+ "version": "7.7.18-experimental.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",
7
7
  "dependencies": {
8
8
  "@hubspot/local-dev-lib": "3.12.0",
9
- "@hubspot/project-parsing-lib": "0.5.2-beta.0",
9
+ "@hubspot/project-parsing-lib": "0.5.1",
10
10
  "@hubspot/serverless-dev-runtime": "7.0.6",
11
11
  "@hubspot/theme-preview-dev-server": "0.0.10",
12
12
  "@hubspot/ui-extensions-dev-server": "0.9.2",