@hubspot/cli 8.0.7-experimental.0 → 8.0.8-experimental.1
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.
- package/commands/mcp/__tests__/start.test.js +1 -8
- package/commands/mcp/start.js +1 -0
- package/lang/en.d.ts +0 -7
- package/lang/en.js +1 -8
- package/lib/getStartedV2Actions.d.ts +0 -13
- package/lib/getStartedV2Actions.js +0 -53
- package/lib/mcp/__tests__/setup.test.js +0 -16
- package/lib/mcp/setup.d.ts +0 -1
- package/lib/mcp/setup.js +34 -109
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +1 -1
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +2 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +2 -2
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +1 -1
- package/mcp-server/tools/project/CreateProjectTool.js +1 -1
- package/mcp-server/tools/project/CreateTestAccountTool.js +1 -1
- package/mcp-server/tools/project/DeployProjectTool.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +1 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +1 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +2 -10
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +2 -2
- package/mcp-server/utils/__tests__/command.test.js +3 -233
- package/mcp-server/utils/__tests__/project.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/project.test.js +140 -0
- package/mcp-server/utils/command.d.ts +0 -5
- package/mcp-server/utils/command.js +0 -24
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +18 -0
- package/package.json +8 -2
- package/ui/components/getStarted/GetStartedFlow.js +2 -79
- package/ui/components/getStarted/reducer.d.ts +0 -20
- package/ui/components/getStarted/reducer.js +0 -36
- package/ui/components/getStarted/screens/ProjectSetupScreen.js +1 -2
- package/ui/lib/constants.d.ts +0 -1
- package/ui/lib/constants.js +0 -1
- package/ui/components/getStarted/screens/InstallationScreen.d.ts +0 -7
- package/ui/components/getStarted/screens/InstallationScreen.js +0 -16
|
@@ -7,20 +7,14 @@ import * as errorHandlers from '../../../lib/errorHandlers/index.js';
|
|
|
7
7
|
import * as usageTrackingLib from '../../../lib/usageTracking.js';
|
|
8
8
|
import * as processLib from '../../../lib/process.js';
|
|
9
9
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
10
|
-
|
|
11
|
-
const execAsyncMock = vi.fn();
|
|
10
|
+
import startCommand from '../start.js';
|
|
12
11
|
vi.mock('yargs');
|
|
13
12
|
vi.mock('../../../lib/commonOpts');
|
|
14
13
|
vi.mock('node:child_process');
|
|
15
|
-
vi.mock('node:util', () => ({
|
|
16
|
-
promisify: vi.fn(() => execAsyncMock),
|
|
17
|
-
}));
|
|
18
14
|
vi.mock('fs');
|
|
19
15
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
20
16
|
vi.mock('../../../lib/errorHandlers/index.js');
|
|
21
17
|
vi.mock('../../../lib/process.js');
|
|
22
|
-
// Import after mocks are set up
|
|
23
|
-
const startCommand = await import('../start.js').then(m => m.default);
|
|
24
18
|
const spawnSpy = vi.mocked(spawn);
|
|
25
19
|
const existsSyncSpy = vi.spyOn(fs, 'existsSync');
|
|
26
20
|
const trackCommandUsageSpy = vi.spyOn(usageTrackingLib, 'trackCommandUsage');
|
|
@@ -42,7 +36,6 @@ describe('commands/mcp/start', () => {
|
|
|
42
36
|
processExitSpy.mockImplementation(() => { });
|
|
43
37
|
// Mock config to prevent reading actual config file in CI
|
|
44
38
|
getConfigAccountIfExistsSpy.mockReturnValue(undefined);
|
|
45
|
-
execAsyncMock.mockClear();
|
|
46
39
|
});
|
|
47
40
|
describe('command', () => {
|
|
48
41
|
it('should have the correct command structure', () => {
|
package/commands/mcp/start.js
CHANGED
|
@@ -28,6 +28,7 @@ async function startMcpServer(aiAgent) {
|
|
|
28
28
|
uiLogger.debug(commands.mcp.start.startingServer);
|
|
29
29
|
uiLogger.debug(commands.mcp.start.stopInstructions);
|
|
30
30
|
const args = [serverPath];
|
|
31
|
+
// Start the server using ts-node
|
|
31
32
|
const child = spawn(`node`, args, {
|
|
32
33
|
stdio: 'inherit',
|
|
33
34
|
env: {
|
package/lang/en.d.ts
CHANGED
|
@@ -43,11 +43,6 @@ export declare const commands: {
|
|
|
43
43
|
checkOutConfig: (configPath: string) => string;
|
|
44
44
|
pressEnterToInstall: (accountName: string) => string;
|
|
45
45
|
pressKeyToExit: string;
|
|
46
|
-
installingApp: (appName: string, accountName: string) => string;
|
|
47
|
-
installInstructions: string;
|
|
48
|
-
browserFailedToOpen: (url: string) => string;
|
|
49
|
-
pollingTimeout: (minutes: number) => string;
|
|
50
|
-
pressEnterToContinueSetup: string;
|
|
51
46
|
prompts: {
|
|
52
47
|
selectOptionV2: string;
|
|
53
48
|
options: {
|
|
@@ -1295,8 +1290,6 @@ export declare const commands: {
|
|
|
1295
1290
|
prompts: {
|
|
1296
1291
|
targets: string;
|
|
1297
1292
|
targetsRequired: string;
|
|
1298
|
-
standaloneMode: string;
|
|
1299
|
-
cliVersion: string;
|
|
1300
1293
|
};
|
|
1301
1294
|
};
|
|
1302
1295
|
start: {
|
package/lang/en.js
CHANGED
|
@@ -51,11 +51,6 @@ export const commands = {
|
|
|
51
51
|
checkOutConfig: (configPath) => `Check out ${chalk.cyan(configPath)} for the full configuration.`,
|
|
52
52
|
pressEnterToInstall: (accountName) => `? Press ${chalk.bold('<enter>')} to continue installing and previewing this app in ${chalk.bold(accountName)}`,
|
|
53
53
|
pressKeyToExit: `Press any key to exit...`,
|
|
54
|
-
installingApp: (appName, accountName) => `Installing ${chalk.bold(appName)} in ${chalk.bold(accountName)}...`,
|
|
55
|
-
installInstructions: `We'll take you to your HubSpot account and walk you through installing your app.`,
|
|
56
|
-
browserFailedToOpen: (url) => `⚠️ Failed to open browser automatically. Please open this URL manually:\n${chalk.cyan(url)}`,
|
|
57
|
-
pollingTimeout: (minutes) => `⚠️ Installation polling timed out after ${minutes} minutes. The app may still be installing in the background.`,
|
|
58
|
-
pressEnterToContinueSetup: `Press ${chalk.bold('<enter>')} to continue with card setup...`,
|
|
59
54
|
prompts: {
|
|
60
55
|
selectOptionV2: 'Choose a component type to get started',
|
|
61
56
|
options: {
|
|
@@ -1311,8 +1306,6 @@ export const commands = {
|
|
|
1311
1306
|
prompts: {
|
|
1312
1307
|
targets: '[--client] Which tools would you like to add the HubSpot CLI MCP server to?',
|
|
1313
1308
|
targetsRequired: 'Must choose at least one app to configure.',
|
|
1314
|
-
standaloneMode: 'Do you want to run in standalone mode? (This will use npx @hubspot/cli instead of the installed hs command)',
|
|
1315
|
-
cliVersion: 'Specify a CLI version to pin (leave blank for latest):',
|
|
1316
1309
|
},
|
|
1317
1310
|
},
|
|
1318
1311
|
start: {
|
|
@@ -3083,7 +3076,7 @@ export const lib = {
|
|
|
3083
3076
|
updateSucceeded: (latestVersion) => `Successfully updated HubSpot CLI to version ${chalk.bold(latestVersion)}`,
|
|
3084
3077
|
notInstalledGlobally: 'Cannot auto-update the HubSpot CLI because NPM is not installed globally',
|
|
3085
3078
|
updateFailed: (latestVersion) => `Failed to update HubSpot CLI to version ${chalk.bold(latestVersion)}`,
|
|
3086
|
-
enableAutoUpdatesMessage: `The HubSpot CLI can automatically keep itself up to date.\n\nThis helps ensure compatibility with the HubSpot platform. You can change this later at any time.\n\nRun
|
|
3079
|
+
enableAutoUpdatesMessage: `The HubSpot CLI can automatically keep itself up to date.\n\nThis helps ensure compatibility with the HubSpot platform. You can change this later at any time.\n\nRun${uiCommandReference('hs config set --allow-auto-updates=true')}`,
|
|
3087
3080
|
},
|
|
3088
3081
|
},
|
|
3089
3082
|
projectProfiles: {
|
|
@@ -35,16 +35,3 @@ export declare function uploadAndDeployAction({ accountId, projectDest, }: {
|
|
|
35
35
|
projectDest: string;
|
|
36
36
|
}): Promise<UploadAndDeployResult>;
|
|
37
37
|
export declare function trackGetStartedUsage(params: Record<string, unknown>, accountId: number): Promise<void>;
|
|
38
|
-
export type PollAppInstallationOptions = {
|
|
39
|
-
accountId: number;
|
|
40
|
-
projectId: number;
|
|
41
|
-
appUid: string;
|
|
42
|
-
requiredScopes?: string[];
|
|
43
|
-
optionalScopes?: string[];
|
|
44
|
-
timeoutMs?: number;
|
|
45
|
-
intervalMs?: number;
|
|
46
|
-
onTimeout?: () => void;
|
|
47
|
-
};
|
|
48
|
-
export declare function pollAppInstallation({ accountId, projectId, appUid, requiredScopes, optionalScopes, timeoutMs, // 2 minutes
|
|
49
|
-
intervalMs, // 2 seconds
|
|
50
|
-
onTimeout, }: PollAppInstallationOptions): Promise<void>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fetchPublicAppsForPortal } from '@hubspot/local-dev-lib/api/appsDev';
|
|
4
|
-
import { fetchAppInstallationData } from '@hubspot/local-dev-lib/api/localDevAuth';
|
|
5
4
|
import { fetchProject } from '@hubspot/local-dev-lib/api/projects';
|
|
6
5
|
import { getConfigAccountEnvironment } from '@hubspot/local-dev-lib/config';
|
|
7
6
|
import { cloneGithubRepo } from '@hubspot/local-dev-lib/github';
|
|
@@ -145,55 +144,3 @@ export async function uploadAndDeployAction({ accountId, projectDest, }) {
|
|
|
145
144
|
export function trackGetStartedUsage(params, accountId) {
|
|
146
145
|
return trackCommandMetadataUsage('get-started', params, accountId);
|
|
147
146
|
}
|
|
148
|
-
export async function pollAppInstallation({ accountId, projectId, appUid, requiredScopes = [], optionalScopes = [], timeoutMs = 2 * 60 * 1000, // 2 minutes
|
|
149
|
-
intervalMs = 2000, // 2 seconds
|
|
150
|
-
onTimeout, }) {
|
|
151
|
-
return new Promise((resolve, reject) => {
|
|
152
|
-
let consecutiveErrors = 0;
|
|
153
|
-
const MAX_CONSECUTIVE_ERRORS = 5;
|
|
154
|
-
let pollInterval = null;
|
|
155
|
-
let pollTimeout = null;
|
|
156
|
-
const cleanup = () => {
|
|
157
|
-
if (pollInterval) {
|
|
158
|
-
clearTimeout(pollInterval);
|
|
159
|
-
pollInterval = null;
|
|
160
|
-
}
|
|
161
|
-
if (pollTimeout) {
|
|
162
|
-
clearTimeout(pollTimeout);
|
|
163
|
-
pollTimeout = null;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
pollTimeout = setTimeout(() => {
|
|
167
|
-
cleanup();
|
|
168
|
-
if (onTimeout) {
|
|
169
|
-
onTimeout();
|
|
170
|
-
}
|
|
171
|
-
resolve(); // Resolve instead of reject to allow continuing with timeout state
|
|
172
|
-
}, timeoutMs);
|
|
173
|
-
const poll = async () => {
|
|
174
|
-
try {
|
|
175
|
-
const { data } = await fetchAppInstallationData(accountId, projectId, appUid, requiredScopes, optionalScopes);
|
|
176
|
-
// Reset error counter on successful fetch
|
|
177
|
-
consecutiveErrors = 0;
|
|
178
|
-
if (data.isInstalledWithScopeGroups) {
|
|
179
|
-
cleanup();
|
|
180
|
-
resolve();
|
|
181
|
-
}
|
|
182
|
-
else if (pollInterval) {
|
|
183
|
-
pollInterval = setTimeout(poll, intervalMs);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
consecutiveErrors++;
|
|
188
|
-
if (consecutiveErrors >= MAX_CONSECUTIVE_ERRORS) {
|
|
189
|
-
cleanup();
|
|
190
|
-
reject(new Error(`Failed to check app installation status after ${MAX_CONSECUTIVE_ERRORS} consecutive errors`, { cause: error }));
|
|
191
|
-
}
|
|
192
|
-
else if (pollInterval !== null) {
|
|
193
|
-
pollInterval = setTimeout(poll, intervalMs);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
pollInterval = setTimeout(poll, 0);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
@@ -132,22 +132,6 @@ describe('lib/mcp/setup', () => {
|
|
|
132
132
|
});
|
|
133
133
|
expect(mockedLogError).toHaveBeenCalledWith(error);
|
|
134
134
|
});
|
|
135
|
-
it('should pass through environment variables in command', async () => {
|
|
136
|
-
const mockMcpCommandWithEnv = {
|
|
137
|
-
command: 'test-command',
|
|
138
|
-
args: ['--arg1'],
|
|
139
|
-
env: { HUBSPOT_MCP_STANDALONE: 'true' },
|
|
140
|
-
};
|
|
141
|
-
mockedExecAsync.mockResolvedValueOnce({
|
|
142
|
-
stdout: 'codex version 1.0.0',
|
|
143
|
-
stderr: '',
|
|
144
|
-
});
|
|
145
|
-
mockedExecAsync.mockResolvedValueOnce({ stdout: '', stderr: '' });
|
|
146
|
-
const result = await setupCodex(mockMcpCommandWithEnv);
|
|
147
|
-
expect(result).toBe(true);
|
|
148
|
-
// The HUBSPOT_MCP_STANDALONE env var is now passed in the command string using 'env'
|
|
149
|
-
expect(mockedExecAsync).toHaveBeenCalledWith('codex mcp add "HubSpotDev" -- env HUBSPOT_MCP_STANDALONE=true test-command --arg1 --ai-agent codex');
|
|
150
|
-
});
|
|
151
135
|
});
|
|
152
136
|
describe('setupGemini', () => {
|
|
153
137
|
const mockMcpCommand = {
|
package/lib/mcp/setup.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare const supportedTools: {
|
|
|
5
5
|
interface McpCommand {
|
|
6
6
|
command: string;
|
|
7
7
|
args: string[];
|
|
8
|
-
env?: Record<string, string>;
|
|
9
8
|
}
|
|
10
9
|
export declare function addMcpServerToConfig(targets: string[] | undefined): Promise<string[]>;
|
|
11
10
|
export declare function setupVsCode(mcpCommand?: McpCommand): Promise<boolean>;
|
package/lib/mcp/setup.js
CHANGED
|
@@ -47,56 +47,23 @@ export async function addMcpServerToConfig(targets) {
|
|
|
47
47
|
else {
|
|
48
48
|
derivedTargets = targets;
|
|
49
49
|
}
|
|
50
|
-
// Prompt for standalone mode
|
|
51
|
-
const { useStandaloneMode } = await promptUser({
|
|
52
|
-
name: 'useStandaloneMode',
|
|
53
|
-
type: 'confirm',
|
|
54
|
-
message: commands.mcp.setup.prompts.standaloneMode,
|
|
55
|
-
default: false,
|
|
56
|
-
});
|
|
57
|
-
const { cliVersion } = useStandaloneMode
|
|
58
|
-
? await promptUser({
|
|
59
|
-
name: 'cliVersion',
|
|
60
|
-
type: 'input',
|
|
61
|
-
message: commands.mcp.setup.prompts.cliVersion,
|
|
62
|
-
validate: (v) => !v || /^[\d]+\.[\d]+\.[\d]+([-+][\w.]+)?$/.test(v.trim())
|
|
63
|
-
? true
|
|
64
|
-
: 'Please enter a valid semver version (e.g. 8.0.1) or leave blank for latest.',
|
|
65
|
-
})
|
|
66
|
-
: { cliVersion: '' };
|
|
67
|
-
const cliPackage = cliVersion
|
|
68
|
-
? `@hubspot/cli@${cliVersion}`
|
|
69
|
-
: '@hubspot/cli';
|
|
70
|
-
const standaloneEnv = {
|
|
71
|
-
HUBSPOT_MCP_STANDALONE: 'true',
|
|
72
|
-
};
|
|
73
|
-
if (cliVersion) {
|
|
74
|
-
standaloneEnv.HUBSPOT_CLI_VERSION = cliVersion;
|
|
75
|
-
}
|
|
76
|
-
const mcpCommand = useStandaloneMode
|
|
77
|
-
? {
|
|
78
|
-
command: 'npx',
|
|
79
|
-
args: ['-y', '-p', cliPackage, 'hs', 'mcp', 'start'],
|
|
80
|
-
env: standaloneEnv,
|
|
81
|
-
}
|
|
82
|
-
: defaultMcpCommand;
|
|
83
50
|
if (derivedTargets.includes(claudeCode)) {
|
|
84
|
-
await runSetupFunction(
|
|
51
|
+
await runSetupFunction(setupClaudeCode);
|
|
85
52
|
}
|
|
86
53
|
if (derivedTargets.includes(cursor)) {
|
|
87
|
-
await runSetupFunction(
|
|
54
|
+
await runSetupFunction(setupCursor);
|
|
88
55
|
}
|
|
89
56
|
if (derivedTargets.includes(windsurf)) {
|
|
90
|
-
await runSetupFunction(
|
|
57
|
+
await runSetupFunction(setupWindsurf);
|
|
91
58
|
}
|
|
92
59
|
if (derivedTargets.includes(vscode)) {
|
|
93
|
-
await runSetupFunction(
|
|
60
|
+
await runSetupFunction(setupVsCode);
|
|
94
61
|
}
|
|
95
62
|
if (derivedTargets.includes(codex)) {
|
|
96
|
-
await runSetupFunction(
|
|
63
|
+
await runSetupFunction(setupCodex);
|
|
97
64
|
}
|
|
98
65
|
if (derivedTargets.includes(gemini)) {
|
|
99
|
-
await runSetupFunction(
|
|
66
|
+
await runSetupFunction(setupGemini);
|
|
100
67
|
}
|
|
101
68
|
uiLogger.info(commands.mcp.setup.success(derivedTargets));
|
|
102
69
|
return derivedTargets;
|
|
@@ -155,14 +122,9 @@ function setupMcpConfigFile(config) {
|
|
|
155
122
|
mcpConfig.mcpServers = {};
|
|
156
123
|
}
|
|
157
124
|
// Add or update HubSpot CLI MCP server
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
args: config.mcpCommand.args,
|
|
125
|
+
mcpConfig.mcpServers[mcpServerName] = {
|
|
126
|
+
...config.mcpCommand,
|
|
161
127
|
};
|
|
162
|
-
if (config.mcpCommand.env) {
|
|
163
|
-
serverConfig.env = config.mcpCommand.env;
|
|
164
|
-
}
|
|
165
|
-
mcpConfig.mcpServers[mcpServerName] = serverConfig;
|
|
166
128
|
// Write the updated config
|
|
167
129
|
fs.writeFileSync(config.configPath, JSON.stringify(mcpConfig, null, 2));
|
|
168
130
|
SpinniesManager.succeed('spinner', {
|
|
@@ -183,16 +145,10 @@ export async function setupVsCode(mcpCommand = defaultMcpCommand) {
|
|
|
183
145
|
SpinniesManager.add('vsCode', {
|
|
184
146
|
text: commands.mcp.setup.spinners.configuringVsCode,
|
|
185
147
|
});
|
|
186
|
-
const
|
|
187
|
-
const configObject = {
|
|
148
|
+
const mcpConfig = JSON.stringify({
|
|
188
149
|
name: mcpServerName,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
};
|
|
192
|
-
if (commandWithAgent.env) {
|
|
193
|
-
configObject.env = commandWithAgent.env;
|
|
194
|
-
}
|
|
195
|
-
const mcpConfig = JSON.stringify(configObject);
|
|
150
|
+
...buildCommandWithAgentString(mcpCommand, vscode),
|
|
151
|
+
});
|
|
196
152
|
await execAsync(`code --add-mcp ${JSON.stringify(mcpConfig)}`);
|
|
197
153
|
SpinniesManager.succeed('vsCode', {
|
|
198
154
|
text: commands.mcp.setup.spinners.configuredVsCode,
|
|
@@ -223,44 +179,30 @@ export async function setupClaudeCode(mcpCommand = defaultMcpCommand) {
|
|
|
223
179
|
try {
|
|
224
180
|
// Check if claude command is available
|
|
225
181
|
await execAsync('claude --version');
|
|
226
|
-
// Run claude mcp add command
|
|
227
|
-
const commandWithAgent = buildCommandWithAgentString(mcpCommand, claudeCode);
|
|
228
|
-
const configObject = {
|
|
229
|
-
type: 'stdio',
|
|
230
|
-
command: commandWithAgent.command,
|
|
231
|
-
args: commandWithAgent.args,
|
|
232
|
-
};
|
|
233
|
-
if (commandWithAgent.env) {
|
|
234
|
-
configObject.env = commandWithAgent.env;
|
|
235
|
-
}
|
|
236
|
-
const mcpConfig = JSON.stringify(configObject);
|
|
237
|
-
const { stdout } = await execAsync('claude mcp list');
|
|
238
|
-
if (stdout.includes(mcpServerName)) {
|
|
239
|
-
SpinniesManager.update('claudeCode', {
|
|
240
|
-
text: commands.mcp.setup.spinners.alreadyInstalled,
|
|
241
|
-
});
|
|
242
|
-
await execAsync(`claude mcp remove "${mcpServerName}" --scope user`);
|
|
243
|
-
}
|
|
244
|
-
await execAsync(`claude mcp add-json "${mcpServerName}" ${JSON.stringify(mcpConfig)} --scope user`);
|
|
245
|
-
SpinniesManager.succeed('claudeCode', {
|
|
246
|
-
text: commands.mcp.setup.spinners.configuredClaudeCode,
|
|
247
|
-
});
|
|
248
|
-
return true;
|
|
249
182
|
}
|
|
250
|
-
catch (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
SpinniesManager.fail('claudeCode', {
|
|
258
|
-
text: commands.mcp.setup.spinners.claudeCodeInstallFailed,
|
|
259
|
-
});
|
|
260
|
-
logError(error);
|
|
261
|
-
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
SpinniesManager.fail('claudeCode', {
|
|
185
|
+
text: commands.mcp.setup.spinners.claudeCodeNotFound,
|
|
186
|
+
});
|
|
262
187
|
return false;
|
|
263
188
|
}
|
|
189
|
+
// Run claude mcp add command
|
|
190
|
+
const mcpConfig = JSON.stringify({
|
|
191
|
+
type: 'stdio',
|
|
192
|
+
...buildCommandWithAgentString(mcpCommand, claudeCode),
|
|
193
|
+
});
|
|
194
|
+
const { stdout } = await execAsync('claude mcp list');
|
|
195
|
+
if (stdout.includes(mcpServerName)) {
|
|
196
|
+
SpinniesManager.update('claudeCode', {
|
|
197
|
+
text: commands.mcp.setup.spinners.alreadyInstalled,
|
|
198
|
+
});
|
|
199
|
+
await execAsync(`claude mcp remove "${mcpServerName}" --scope user`);
|
|
200
|
+
}
|
|
201
|
+
await execAsync(`claude mcp add-json "${mcpServerName}" ${JSON.stringify(mcpConfig)} --scope user`);
|
|
202
|
+
SpinniesManager.succeed('claudeCode', {
|
|
203
|
+
text: commands.mcp.setup.spinners.configuredClaudeCode,
|
|
204
|
+
});
|
|
205
|
+
return true;
|
|
264
206
|
}
|
|
265
207
|
catch (error) {
|
|
266
208
|
SpinniesManager.fail('claudeCode', {
|
|
@@ -306,8 +248,7 @@ export async function setupCodex(mcpCommand = defaultMcpCommand) {
|
|
|
306
248
|
return false;
|
|
307
249
|
}
|
|
308
250
|
const mcpCommandWithAgent = buildCommandWithAgentString(mcpCommand, codex);
|
|
309
|
-
|
|
310
|
-
await execAsync(`codex mcp add "${mcpServerName}" -- ${commandString}`);
|
|
251
|
+
await execAsync(`codex mcp add "${mcpServerName}" -- ${mcpCommandWithAgent.command} ${mcpCommandWithAgent.args.join(' ')}`);
|
|
311
252
|
SpinniesManager.succeed('codexSpinner', {
|
|
312
253
|
text: commands.mcp.setup.spinners.configuredCodex,
|
|
313
254
|
});
|
|
@@ -336,8 +277,7 @@ export async function setupGemini(mcpCommand = defaultMcpCommand) {
|
|
|
336
277
|
return false;
|
|
337
278
|
}
|
|
338
279
|
const mcpCommandWithAgent = buildCommandWithAgentString(mcpCommand, gemini);
|
|
339
|
-
|
|
340
|
-
await execAsync(`gemini mcp add -s user "${mcpServerName}" ${commandString}`);
|
|
280
|
+
await execAsync(`gemini mcp add -s user "${mcpServerName}" ${mcpCommandWithAgent.command} ${mcpCommandWithAgent.args.join(' ')}`);
|
|
341
281
|
SpinniesManager.succeed('geminiSpinner', {
|
|
342
282
|
text: commands.mcp.setup.spinners.configuredGemini,
|
|
343
283
|
});
|
|
@@ -356,18 +296,3 @@ function buildCommandWithAgentString(mcpCommand, agent) {
|
|
|
356
296
|
mcpCommandCopy.args.push('--ai-agent', agent);
|
|
357
297
|
return mcpCommandCopy;
|
|
358
298
|
}
|
|
359
|
-
function buildCommandStringWithEnv(mcpCommand) {
|
|
360
|
-
const parts = [];
|
|
361
|
-
// Only pass HUBSPOT_MCP_STANDALONE environment variable if it exists
|
|
362
|
-
if (mcpCommand.env?.HUBSPOT_MCP_STANDALONE) {
|
|
363
|
-
parts.push(`HUBSPOT_MCP_STANDALONE=${mcpCommand.env.HUBSPOT_MCP_STANDALONE};`);
|
|
364
|
-
}
|
|
365
|
-
// Only pass HUBSPOT_MCP_STANDALONE environment variable if it exists
|
|
366
|
-
if (mcpCommand.env?.HUBSPOT_CLI_VERSION) {
|
|
367
|
-
parts.push(`HUBSPOT_CLI_VERSION=${mcpCommand.env.HUBSPOT_CLI_VERSION};`);
|
|
368
|
-
}
|
|
369
|
-
// Add the command and args
|
|
370
|
-
parts.push(mcpCommand.command);
|
|
371
|
-
parts.push(...mcpCommand.args);
|
|
372
|
-
return parts.join(' ');
|
|
373
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../types.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
|
-
import { runCommandInDir } from '../../utils/
|
|
4
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
5
5
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
6
6
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
7
|
import { addFlag } from '../../utils/command.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../types.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
|
-
import { runCommandInDir } from '../../utils/
|
|
4
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
5
5
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
6
6
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
7
|
import { addFlag } from '../../utils/command.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../types.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
|
-
import { runCommandInDir } from '../../utils/
|
|
4
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
5
5
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
6
6
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
7
|
import { addFlag } from '../../utils/command.js';
|
|
@@ -2,7 +2,7 @@ import { Tool } from '../../types.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/
|
|
5
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
7
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -2,7 +2,7 @@ import { Tool } from '../../types.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/
|
|
5
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
7
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -2,7 +2,7 @@ import { Tool } from '../../types.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/
|
|
5
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
7
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsCreateFunctionTool } from '../HsCreateFunctionTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/project.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
+
vi.mock('../../../utils/project');
|
|
8
9
|
vi.mock('../../../utils/command');
|
|
9
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
10
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsCreateModuleTool } from '../HsCreateModuleTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/project.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/
|
|
8
|
+
vi.mock('../../../utils/project');
|
|
9
9
|
vi.mock('../../../utils/command');
|
|
10
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsCreateTemplateTool } from '../HsCreateTemplateTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/project.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/
|
|
8
|
+
vi.mock('../../../utils/project');
|
|
9
9
|
vi.mock('../../../utils/command');
|
|
10
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsFunctionLogsTool } from '../HsFunctionLogsTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/project.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/
|
|
8
|
+
vi.mock('../../../utils/project');
|
|
9
9
|
vi.mock('../../../utils/command');
|
|
10
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsListFunctionsTool } from '../HsListFunctionsTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/project.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/
|
|
8
|
+
vi.mock('../../../utils/project');
|
|
9
9
|
vi.mock('../../../utils/command');
|
|
10
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsListTool } from '../HsListTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/project.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/
|
|
8
|
+
vi.mock('../../../utils/project');
|
|
9
9
|
vi.mock('../../../utils/command');
|
|
10
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
8
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
9
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, EMPTY_PROJECT, PROJECT_WITH_APP, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, features } from './constants.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
8
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
9
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -3,7 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
4
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
5
5
|
import { addFlag } from '../../utils/command.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
7
7
|
import { ACCOUNT_LEVELS, ACCOUNT_LEVEL_CHOICES, } from '../../../lib/constants.js';
|
|
8
8
|
import { Tool } from '../../types.js';
|
|
9
9
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
@@ -2,7 +2,7 @@ import { Tool } from '../../types.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/
|
|
5
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
6
6
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
7
7
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -3,7 +3,7 @@ import z from 'zod';
|
|
|
3
3
|
import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
|
|
4
4
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
5
5
|
import { Tool } from '../../types.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
7
7
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
8
8
|
import { formatTextContent, formatTextContents } from '../../utils/content.js';
|
|
9
9
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../types.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
4
|
-
import { runCommandInDir } from '../../utils/
|
|
4
|
+
import { runCommandInDir } from '../../utils/project.js';
|
|
5
5
|
import { formatTextContents } from '../../utils/content.js';
|
|
6
6
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|