@hubspot/cli 8.5.0-beta.0 → 8.5.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.
- package/api/migrate.js +3 -3
- package/bin/cli.js +3 -0
- package/commands/app/migrate.js +4 -4
- package/commands/getStarted.js +2 -2
- package/commands/project/add.js +3 -3
- package/commands/project/create.js +10 -7
- package/commands/project/delete.js +2 -2
- package/commands/project/deploy.js +4 -3
- package/commands/project/dev/index.js +5 -4
- package/commands/project/info.js +2 -2
- package/commands/project/migrate.js +5 -5
- package/commands/project/profile/add.js +2 -2
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.js +3 -3
- package/commands/project/validate.js +2 -2
- package/commands/project/watch.js +2 -2
- package/commands/project.js +6 -3
- package/commands/testAccount/create.js +4 -4
- package/lang/en.d.ts +2 -0
- package/lang/en.js +6 -4
- package/lib/app/migrate.js +7 -0
- package/lib/doctor/Doctor.js +2 -2
- package/lib/getStartedV2Actions.js +2 -2
- package/lib/projects/ProjectLogsManager.js +6 -3
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v2.js +2 -2
- package/lib/projects/delete.js +2 -2
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/upload.js +4 -4
- package/lib/prompts/projectsLogsPrompt.js +3 -0
- package/lib/theme/cmsDevServerProcess.js +1 -1
- package/mcp-server/Tool.d.ts +15 -0
- package/mcp-server/Tool.js +53 -0
- package/mcp-server/server.js +5 -3
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -6
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +8 -6
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +8 -6
- package/mcp-server/tools/cms/HsListTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListTool.js +8 -6
- package/mcp-server/tools/index.d.ts +3 -2
- package/mcp-server/tools/index.js +22 -22
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +8 -6
- package/mcp-server/tools/project/CreateProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/CreateProjectTool.js +9 -7
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +20 -8
- package/mcp-server/tools/project/DeployProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/DeployProjectTool.js +4 -6
- package/mcp-server/tools/project/DocFetchTool.d.ts +4 -2
- package/mcp-server/tools/project/DocFetchTool.js +8 -6
- package/mcp-server/tools/project/DocsSearchTool.d.ts +9 -3
- package/mcp-server/tools/project/DocsSearchTool.js +32 -9
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +8 -6
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildLogsTool.js +8 -6
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildStatusTool.js +8 -6
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -2
- package/mcp-server/tools/project/GetConfigValuesTool.js +12 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +4 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -6
- package/mcp-server/tools/project/UploadProjectTools.d.ts +4 -2
- package/mcp-server/tools/project/UploadProjectTools.js +9 -7
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +8 -6
- package/mcp-server/tools/project/constants.d.ts +2 -2
- package/mcp-server/types.d.ts +0 -7
- package/mcp-server/types.js +1 -13
- package/mcp-server/utils/logger.d.ts +10 -0
- package/mcp-server/utils/logger.js +29 -0
- package/mcp-server/utils/toolUsageTracking.js +0 -2
- package/package.json +10 -10
- package/lib/projects/platformVersion.d.ts +0 -9
- package/lib/projects/platformVersion.js +0 -39
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
3
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
5
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
6
5
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
@@ -13,12 +12,11 @@ const inputSchema = { absoluteCurrentWorkingDirectory };
|
|
|
13
12
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
14
13
|
const toolName = 'get-apps-info';
|
|
15
14
|
export class GetApplicationInfoTool extends Tool {
|
|
16
|
-
constructor(mcpServer) {
|
|
17
|
-
super(mcpServer);
|
|
15
|
+
constructor(mcpServer, logger) {
|
|
16
|
+
super(mcpServer, logger, toolName);
|
|
18
17
|
}
|
|
19
18
|
async handler({ absoluteCurrentWorkingDirectory, }) {
|
|
20
19
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
21
|
-
await trackToolUsage(toolName);
|
|
22
20
|
try {
|
|
23
21
|
// Get account ID from CLI config
|
|
24
22
|
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
@@ -35,6 +33,10 @@ export class GetApplicationInfoTool extends Tool {
|
|
|
35
33
|
return formatTextContents(formattedResult);
|
|
36
34
|
}
|
|
37
35
|
catch (error) {
|
|
36
|
+
this.logger.debug(toolName, {
|
|
37
|
+
message: 'Handler caught error',
|
|
38
|
+
error: error instanceof Error ? error.message : String(error),
|
|
39
|
+
});
|
|
38
40
|
if (isHubSpotHttpError(error)) {
|
|
39
41
|
// Handle HubSpot-specific HTTP errors
|
|
40
42
|
return formatTextContents(error.toString());
|
|
@@ -51,6 +53,6 @@ export class GetApplicationInfoTool extends Tool {
|
|
|
51
53
|
readOnlyHint: true,
|
|
52
54
|
openWorldHint: true,
|
|
53
55
|
},
|
|
54
|
-
}, this.
|
|
56
|
+
}, input => this.wrappedHandler(input));
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
@@ -14,7 +16,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
14
16
|
}, z.core.$strip>;
|
|
15
17
|
export type GetBuildLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
16
18
|
export declare class GetBuildLogsTool extends Tool<GetBuildLogsInputSchema> {
|
|
17
|
-
constructor(mcpServer: McpServer);
|
|
19
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
18
20
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, logLevel, }: GetBuildLogsInputSchema): Promise<TextContentResponse>;
|
|
19
21
|
register(): RegisteredTool;
|
|
20
22
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
4
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
6
5
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
@@ -59,12 +58,11 @@ function formatLogs(logs) {
|
|
|
59
58
|
.join('\n');
|
|
60
59
|
}
|
|
61
60
|
export class GetBuildLogsTool extends Tool {
|
|
62
|
-
constructor(mcpServer) {
|
|
63
|
-
super(mcpServer);
|
|
61
|
+
constructor(mcpServer, logger) {
|
|
62
|
+
super(mcpServer, logger, TOOL_NAME);
|
|
64
63
|
}
|
|
65
64
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, logLevel, }) {
|
|
66
65
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
67
|
-
await trackToolUsage(TOOL_NAME);
|
|
68
66
|
try {
|
|
69
67
|
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
70
68
|
if (!accountId) {
|
|
@@ -96,6 +94,10 @@ export class GetBuildLogsTool extends Tool {
|
|
|
96
94
|
return formatTextContents(absoluteCurrentWorkingDirectory, output);
|
|
97
95
|
}
|
|
98
96
|
catch (error) {
|
|
97
|
+
this.logger.debug(TOOL_NAME, {
|
|
98
|
+
message: 'Handler caught error',
|
|
99
|
+
error: error instanceof Error ? error.message : String(error),
|
|
100
|
+
});
|
|
99
101
|
let errorMessage;
|
|
100
102
|
if (isHubSpotHttpError(error)) {
|
|
101
103
|
errorMessage = error.toString();
|
|
@@ -119,6 +121,6 @@ export class GetBuildLogsTool extends Tool {
|
|
|
119
121
|
openWorldHint: true,
|
|
120
122
|
idempotentHint: true,
|
|
121
123
|
},
|
|
122
|
-
}, this.
|
|
124
|
+
}, input => this.wrappedHandler(input));
|
|
123
125
|
}
|
|
124
126
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
@@ -9,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
9
11
|
}, z.core.$strip>;
|
|
10
12
|
export type GetBuildStatusInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
11
13
|
export declare class GetBuildStatusTool extends Tool<GetBuildStatusInputSchema> {
|
|
12
|
-
constructor(mcpServer: McpServer);
|
|
14
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
13
15
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, limit, }: GetBuildStatusInputSchema): Promise<TextContentResponse>;
|
|
14
16
|
register(): RegisteredTool;
|
|
15
17
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
4
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
6
5
|
import { fetchProjectBuilds, getBuildStatus, } from '@hubspot/local-dev-lib/api/projects';
|
|
@@ -104,12 +103,11 @@ function formatBuildDetails(build) {
|
|
|
104
103
|
return lines.join('\n');
|
|
105
104
|
}
|
|
106
105
|
export class GetBuildStatusTool extends Tool {
|
|
107
|
-
constructor(mcpServer) {
|
|
108
|
-
super(mcpServer);
|
|
106
|
+
constructor(mcpServer, logger) {
|
|
107
|
+
super(mcpServer, logger, TOOL_NAME);
|
|
109
108
|
}
|
|
110
109
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, limit, }) {
|
|
111
110
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
112
|
-
await trackToolUsage(TOOL_NAME);
|
|
113
111
|
try {
|
|
114
112
|
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
115
113
|
if (!accountId) {
|
|
@@ -137,6 +135,10 @@ export class GetBuildStatusTool extends Tool {
|
|
|
137
135
|
return formatTextContents(absoluteCurrentWorkingDirectory, output);
|
|
138
136
|
}
|
|
139
137
|
catch (error) {
|
|
138
|
+
this.logger.debug(TOOL_NAME, {
|
|
139
|
+
message: 'Handler caught error',
|
|
140
|
+
error: error instanceof Error ? error.message : String(error),
|
|
141
|
+
});
|
|
140
142
|
let errorMessage;
|
|
141
143
|
if (isHubSpotHttpError(error)) {
|
|
142
144
|
errorMessage = error.toString();
|
|
@@ -160,6 +162,6 @@ export class GetBuildStatusTool extends Tool {
|
|
|
160
162
|
openWorldHint: true,
|
|
161
163
|
idempotentHint: true,
|
|
162
164
|
},
|
|
163
|
-
}, this.
|
|
165
|
+
}, input => this.wrappedHandler(input));
|
|
164
166
|
}
|
|
165
167
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -8,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
8
10
|
}, z.core.$strip>;
|
|
9
11
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
10
12
|
export declare class GetConfigValuesTool extends Tool<InputSchemaType> {
|
|
11
|
-
constructor(mcpServer: McpServer);
|
|
13
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
12
14
|
handler({ platformVersion, featureType, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
|
|
13
15
|
register(): RegisteredTool;
|
|
14
16
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
5
5
|
import { getIntermediateRepresentationSchema } from '@hubspot/project-parsing-lib/schema';
|
|
6
6
|
import { mapToInternalType } from '@hubspot/project-parsing-lib/transform';
|
|
7
|
-
import {
|
|
7
|
+
import { isLegacyProject } from '@hubspot/project-parsing-lib/projects';
|
|
8
8
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
9
9
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
10
10
|
const inputSchema = {
|
|
@@ -22,13 +22,13 @@ const inputSchemaZodObject = z.object({
|
|
|
22
22
|
});
|
|
23
23
|
const toolName = 'get-feature-config-schema';
|
|
24
24
|
export class GetConfigValuesTool extends Tool {
|
|
25
|
-
constructor(mcpServer) {
|
|
26
|
-
super(mcpServer);
|
|
25
|
+
constructor(mcpServer, logger) {
|
|
26
|
+
super(mcpServer, logger, toolName);
|
|
27
27
|
}
|
|
28
28
|
async handler({ platformVersion, featureType, absoluteCurrentWorkingDirectory, }) {
|
|
29
29
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
30
30
|
try {
|
|
31
|
-
if (
|
|
31
|
+
if (isLegacyProject(platformVersion)) {
|
|
32
32
|
return formatTextContents(`Can only be used on projects with a minimum platformVersion of 2025.2`);
|
|
33
33
|
}
|
|
34
34
|
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
@@ -46,7 +46,12 @@ export class GetConfigValuesTool extends Tool {
|
|
|
46
46
|
return formatTextContents(JSON.stringify({ config: schema[internalComponentType] }));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
catch (error) {
|
|
49
|
+
catch (error) {
|
|
50
|
+
this.logger.debug(toolName, {
|
|
51
|
+
message: 'Handler caught error',
|
|
52
|
+
error: error instanceof Error ? error.message : String(error),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
50
55
|
return formatTextContents(`Unable to locate JSON schema for type ${featureType}`);
|
|
51
56
|
}
|
|
52
57
|
register() {
|
|
@@ -60,6 +65,6 @@ export class GetConfigValuesTool extends Tool {
|
|
|
60
65
|
readOnlyHint: true,
|
|
61
66
|
openWorldHint: false,
|
|
62
67
|
},
|
|
63
|
-
}, this.
|
|
68
|
+
}, input => this.wrappedHandler(input));
|
|
64
69
|
}
|
|
65
70
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -12,7 +14,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
12
14
|
}, z.core.$strip>;
|
|
13
15
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
14
16
|
export declare class GuidedWalkthroughTool extends Tool<InputSchemaType> {
|
|
15
|
-
constructor(mcpServer: McpServer);
|
|
17
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
16
18
|
handler({ command, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
|
|
17
19
|
register(): RegisteredTool;
|
|
18
20
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { execAsync } from '../../utils/command.js';
|
|
4
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
6
5
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
7
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
7
|
const nextCommands = {
|
|
@@ -24,12 +23,11 @@ const inputSchemaZodObject = z.object({
|
|
|
24
23
|
});
|
|
25
24
|
const toolName = 'guided-walkthrough-cli';
|
|
26
25
|
export class GuidedWalkthroughTool extends Tool {
|
|
27
|
-
constructor(mcpServer) {
|
|
28
|
-
super(mcpServer);
|
|
26
|
+
constructor(mcpServer, logger) {
|
|
27
|
+
super(mcpServer, logger, toolName);
|
|
29
28
|
}
|
|
30
29
|
async handler({ command, absoluteCurrentWorkingDirectory, }) {
|
|
31
30
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
32
|
-
await trackToolUsage(toolName);
|
|
33
31
|
if (command) {
|
|
34
32
|
const { stdout } = await execAsync(`${command} --help`);
|
|
35
33
|
return formatTextContents(`Display this help output for the user amd wait for them to acknowledge: ${stdout}. ${nextCommands[command] ? `Once they are ready, A good command to look at next is ${nextCommands[command]}` : ''}`);
|
|
@@ -45,6 +43,6 @@ export class GuidedWalkthroughTool extends Tool {
|
|
|
45
43
|
readOnlyHint: true,
|
|
46
44
|
openWorldHint: false,
|
|
47
45
|
},
|
|
48
|
-
}, this.
|
|
46
|
+
}, input => this.wrappedHandler(input));
|
|
49
47
|
}
|
|
50
48
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import {
|
|
3
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
4
|
+
import { TextContentResponse } from '../../types.js';
|
|
5
|
+
import { Tool } from '../../Tool.js';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
6
8
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -9,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
9
11
|
}, z.z.core.$strip>;
|
|
10
12
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
11
13
|
export declare class UploadProjectTools extends Tool<InputSchemaType> {
|
|
12
|
-
constructor(mcpServer: McpServer);
|
|
14
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
13
15
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, profile, uploadMessage, }: InputSchemaType): Promise<TextContentResponse>;
|
|
14
16
|
register(): RegisteredTool;
|
|
15
17
|
}
|
|
@@ -2,11 +2,10 @@ import path from 'path';
|
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
|
|
4
4
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
5
|
-
import { Tool } from '../../
|
|
5
|
+
import { Tool } from '../../Tool.js';
|
|
6
6
|
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
8
8
|
import { formatTextContent, formatTextContents } from '../../utils/content.js';
|
|
9
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
10
9
|
import { addFlag } from '../../utils/command.js';
|
|
11
10
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
12
11
|
const inputSchema = {
|
|
@@ -17,7 +16,7 @@ const inputSchema = {
|
|
|
17
16
|
.describe('A 1 sentence message that concisely describes the changes that are being uploaded.'),
|
|
18
17
|
profile: z
|
|
19
18
|
.optional(z.string())
|
|
20
|
-
.describe('
|
|
19
|
+
.describe('The profile to use for the upload. Only required for projects configured with profiles. If the project uses profiles and the user has not specified one, ask them rather than inferring from filenames in the directory. NEVER automatically choose a profile based on files you see. Profile files have the format: "hsprofile.<profile>.json".'),
|
|
21
20
|
};
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
22
|
const inputSchemaZodObject = z.object({
|
|
@@ -25,12 +24,11 @@ const inputSchemaZodObject = z.object({
|
|
|
25
24
|
});
|
|
26
25
|
const toolName = 'upload-project';
|
|
27
26
|
export class UploadProjectTools extends Tool {
|
|
28
|
-
constructor(mcpServer) {
|
|
29
|
-
super(mcpServer);
|
|
27
|
+
constructor(mcpServer, logger) {
|
|
28
|
+
super(mcpServer, logger, toolName);
|
|
30
29
|
}
|
|
31
30
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, profile, uploadMessage, }) {
|
|
32
31
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
33
|
-
await trackToolUsage(toolName);
|
|
34
32
|
let command = addFlag('hs project upload', 'force-create', true);
|
|
35
33
|
const content = [];
|
|
36
34
|
if (uploadMessage) {
|
|
@@ -49,6 +47,10 @@ export class UploadProjectTools extends Tool {
|
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
catch (e) {
|
|
50
|
+
this.logger.debug(toolName, {
|
|
51
|
+
message: 'Handler caught error checking for profiles',
|
|
52
|
+
error: e instanceof Error ? e.message : String(e),
|
|
53
|
+
});
|
|
52
54
|
// If any of these checks fail, the safest thing to do is to assume there are no profiles.
|
|
53
55
|
hasProfiles = false;
|
|
54
56
|
}
|
|
@@ -78,6 +80,6 @@ export class UploadProjectTools extends Tool {
|
|
|
78
80
|
idempotentHint: true,
|
|
79
81
|
openWorldHint: true,
|
|
80
82
|
},
|
|
81
|
-
}, this.
|
|
83
|
+
}, input => this.wrappedHandler(input));
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
@@ -7,7 +9,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
7
9
|
}, z.core.$strip>;
|
|
8
10
|
export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
9
11
|
export declare class ValidateProjectTool extends Tool<CreateProjectInputSchema> {
|
|
10
|
-
constructor(mcpServer: McpServer);
|
|
12
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
11
13
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema): Promise<TextContentResponse>;
|
|
12
14
|
register(): RegisteredTool;
|
|
13
15
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
4
4
|
import { runCommandInDir } from '../../utils/command.js';
|
|
5
5
|
import { formatTextContents } from '../../utils/content.js';
|
|
6
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
7
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
9
8
|
const inputSchema = {
|
|
@@ -14,17 +13,20 @@ const inputSchema = {
|
|
|
14
13
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
15
14
|
const toolName = 'validate-project';
|
|
16
15
|
export class ValidateProjectTool extends Tool {
|
|
17
|
-
constructor(mcpServer) {
|
|
18
|
-
super(mcpServer);
|
|
16
|
+
constructor(mcpServer, logger) {
|
|
17
|
+
super(mcpServer, logger, toolName);
|
|
19
18
|
}
|
|
20
19
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, }) {
|
|
21
20
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
22
|
-
await trackToolUsage(toolName);
|
|
23
21
|
try {
|
|
24
22
|
const { stdout, stderr } = await runCommandInDir(absoluteProjectPath, 'hs project validate');
|
|
25
23
|
return formatTextContents(stdout, stderr);
|
|
26
24
|
}
|
|
27
25
|
catch (error) {
|
|
26
|
+
this.logger.debug(toolName, {
|
|
27
|
+
message: 'Handler caught error',
|
|
28
|
+
error: error instanceof Error ? error.message : String(error),
|
|
29
|
+
});
|
|
28
30
|
return formatTextContents(getErrorMessage(error));
|
|
29
31
|
}
|
|
30
32
|
}
|
|
@@ -37,6 +39,6 @@ export class ValidateProjectTool extends Tool {
|
|
|
37
39
|
readOnlyHint: true,
|
|
38
40
|
openWorldHint: false,
|
|
39
41
|
},
|
|
40
|
-
}, this.
|
|
42
|
+
}, input => this.wrappedHandler(input));
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -8,11 +8,11 @@ export declare const features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
|
8
8
|
"workflow-action-tool": "workflow-action-tool";
|
|
9
9
|
page: "page";
|
|
10
10
|
webhooks: "webhooks";
|
|
11
|
-
"workflow-action": "workflow-action";
|
|
12
11
|
"app-function": "app-function";
|
|
13
|
-
"app-function-endpoint": "app-function-endpoint";
|
|
14
12
|
"app-object": "app-object";
|
|
15
13
|
scim: "scim";
|
|
14
|
+
"workflow-action": "workflow-action";
|
|
15
|
+
"app-function-endpoint": "app-function-endpoint";
|
|
16
16
|
}>>>;
|
|
17
17
|
export declare const docsSearchQuery: z.ZodString;
|
|
18
18
|
export declare const docUrl: z.ZodString;
|
package/mcp-server/types.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
export declare class Tool<InputSchema, ResponseType = TextContentResponse> {
|
|
3
|
-
protected mcpServer: McpServer;
|
|
4
|
-
constructor(mcpServer: McpServer);
|
|
5
|
-
register(): RegisteredTool;
|
|
6
|
-
handler(input: InputSchema): ResponseType | Promise<ResponseType>;
|
|
7
|
-
}
|
|
8
1
|
export type TextContent = {
|
|
9
2
|
type: 'text';
|
|
10
3
|
text: string;
|
package/mcp-server/types.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
mcpServer;
|
|
3
|
-
constructor(mcpServer) {
|
|
4
|
-
this.mcpServer = mcpServer;
|
|
5
|
-
}
|
|
6
|
-
register() {
|
|
7
|
-
throw new Error('Must implement register');
|
|
8
|
-
}
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
handler(input) {
|
|
11
|
-
throw new Error('Must implement handler');
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
export declare class McpLogger {
|
|
3
|
+
private mcpServer;
|
|
4
|
+
constructor(mcpServer: McpServer);
|
|
5
|
+
private log;
|
|
6
|
+
debug(logger: string, data: unknown): void;
|
|
7
|
+
info(logger: string, data: unknown): void;
|
|
8
|
+
warn(logger: string, data: unknown): void;
|
|
9
|
+
error(logger: string, data: unknown): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class McpLogger {
|
|
2
|
+
mcpServer;
|
|
3
|
+
constructor(mcpServer) {
|
|
4
|
+
this.mcpServer = mcpServer;
|
|
5
|
+
}
|
|
6
|
+
log(level, logger, data) {
|
|
7
|
+
try {
|
|
8
|
+
this.mcpServer.sendLoggingMessage({ level, logger, data });
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
// sendLoggingMessage can throw if no transport is connected or the
|
|
12
|
+
// client doesn't support logging. Write to stderr so failures surface
|
|
13
|
+
// somewhere without corrupting the stdio JSON-RPC stream.
|
|
14
|
+
process.stderr.write(`[McpLogger] Failed to send log message: ${error}\n`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
debug(logger, data) {
|
|
18
|
+
this.log('debug', logger, data);
|
|
19
|
+
}
|
|
20
|
+
info(logger, data) {
|
|
21
|
+
this.log('info', logger, data);
|
|
22
|
+
}
|
|
23
|
+
warn(logger, data) {
|
|
24
|
+
this.log('warning', logger, data);
|
|
25
|
+
}
|
|
26
|
+
error(logger, data) {
|
|
27
|
+
this.log('error', logger, data);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { trackUsage } from '@hubspot/local-dev-lib/trackUsage';
|
|
2
2
|
import { EventClass, getNodeVersionData, getPlatform, } from '../../lib/usageTracking.js';
|
|
3
3
|
import { getConfig, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
4
|
-
import { uiLogger } from '../../lib/ui/logger.js';
|
|
5
4
|
export async function trackToolUsage(toolName, meta) {
|
|
6
5
|
const config = getConfig();
|
|
7
6
|
if (config?.allowUsageTracking === false) {
|
|
@@ -17,7 +16,6 @@ export async function trackToolUsage(toolName, meta) {
|
|
|
17
16
|
};
|
|
18
17
|
const accountId = getConfigDefaultAccountIfExists()?.accountId || undefined;
|
|
19
18
|
try {
|
|
20
|
-
uiLogger.info('Tracking tool usage');
|
|
21
19
|
await trackUsage('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
|
|
22
20
|
}
|
|
23
21
|
catch (error) { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "8.5.0
|
|
3
|
+
"version": "8.5.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,25 +10,25 @@
|
|
|
10
10
|
"!**/__tests__/**"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@hubspot/local-dev-lib": "5.
|
|
14
|
-
"@hubspot/project-parsing-lib": "0.
|
|
13
|
+
"@hubspot/local-dev-lib": "5.4.0",
|
|
14
|
+
"@hubspot/project-parsing-lib": "0.16.0",
|
|
15
15
|
"@hubspot/serverless-dev-runtime": "7.0.7",
|
|
16
|
-
"@hubspot/ui-extensions-dev-server": "2.0.
|
|
16
|
+
"@hubspot/ui-extensions-dev-server": "2.0.5",
|
|
17
17
|
"@inquirer/prompts": "7.1.0",
|
|
18
|
-
"@modelcontextprotocol/sdk": "1.
|
|
18
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
19
19
|
"archiver": "7.0.1",
|
|
20
20
|
"chalk": "5.4.1",
|
|
21
21
|
"chokidar": "3.6.0",
|
|
22
22
|
"cli-cursor": "3.1.0",
|
|
23
23
|
"cli-progress": "3.12.0",
|
|
24
|
-
"express": "4.
|
|
24
|
+
"express": "4.22.1",
|
|
25
25
|
"findup-sync": "4.0.0",
|
|
26
26
|
"fs-extra": "8.1.0",
|
|
27
27
|
"ink": "6.6.0",
|
|
28
28
|
"ink-spinner": "5.0.0",
|
|
29
29
|
"ink-text-input": "6.0.0",
|
|
30
|
-
"js-yaml": "4.1.
|
|
31
|
-
"minimatch": "10.
|
|
30
|
+
"js-yaml": "4.1.1",
|
|
31
|
+
"minimatch": "10.2.5",
|
|
32
32
|
"moment": "2.30.1",
|
|
33
33
|
"open": "7.4.2",
|
|
34
34
|
"p-queue": "8.1.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
60
60
|
"@typescript-eslint/parser": "^8.11.0",
|
|
61
61
|
"@vitest/coverage-v8": "^2.1.9",
|
|
62
|
-
"axios": "1.
|
|
62
|
+
"axios": "1.15.2",
|
|
63
63
|
"eslint": "^8.56.0",
|
|
64
64
|
"eslint-plugin-import": "^2.31.0",
|
|
65
65
|
"husky": "^4.3.8",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"build": "tsx ./scripts/build.ts",
|
|
78
78
|
"build-docker": "docker image build --tag hs-cli-image . && docker image prune -f",
|
|
79
79
|
"circular-deps": "yarn madge --circular .",
|
|
80
|
-
"debug-mcp": "yarn build && npx @modelcontextprotocol/inspector node dist/mcp-server/server.js",
|
|
80
|
+
"debug-mcp": "yarn build && npx --yes @modelcontextprotocol/inspector node dist/mcp-server/server.js",
|
|
81
81
|
"hs": "yarn build && node ./dist/bin/hs",
|
|
82
82
|
"hs-debug": "yarn build && NODE_DEBUG=http* node --inspect-brk ./dist/bin/hs",
|
|
83
83
|
"hs-proxy": "yarn build && HTTPS_PROXY=http://localhost:8181 NODE_TLS_REJECT_UNAUTHORIZED=0 node ./dist/bin/hs",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used to surface warnings when users attempt to interact with new platform versions
|
|
3
|
-
* that were released after this version of the CLI was released.
|
|
4
|
-
*
|
|
5
|
-
* We are unable to reliably support versions of projects that are newer than any given CLI release
|
|
6
|
-
* */
|
|
7
|
-
export declare const LATEST_SUPPORTED_PLATFORM_VERSION = "2026.03";
|
|
8
|
-
export declare function isV2Project(platformVersion?: string | null): boolean;
|
|
9
|
-
export declare function isUnsupportedPlatformVersion(platformVersion?: string | null): boolean;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used to surface warnings when users attempt to interact with new platform versions
|
|
3
|
-
* that were released after this version of the CLI was released.
|
|
4
|
-
*
|
|
5
|
-
* We are unable to reliably support versions of projects that are newer than any given CLI release
|
|
6
|
-
* */
|
|
7
|
-
export const LATEST_SUPPORTED_PLATFORM_VERSION = '2026.03';
|
|
8
|
-
function parsePlatformVersion(platformVersion) {
|
|
9
|
-
const [year, minor] = platformVersion.split(/[.-]/);
|
|
10
|
-
return {
|
|
11
|
-
year: Number(year),
|
|
12
|
-
minor: Number(minor),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function isV2Project(platformVersion) {
|
|
16
|
-
if (!platformVersion || typeof platformVersion !== 'string') {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (platformVersion.toLowerCase() === 'unstable') {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
const { year, minor } = parsePlatformVersion(platformVersion);
|
|
23
|
-
return (year === 2025 && minor >= 2) || year > 2025;
|
|
24
|
-
}
|
|
25
|
-
export function isUnsupportedPlatformVersion(platformVersion) {
|
|
26
|
-
if (!platformVersion || typeof platformVersion !== 'string') {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
if (platformVersion.toLowerCase() === 'unstable') {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
const { year, minor } = parsePlatformVersion(platformVersion);
|
|
33
|
-
if (isNaN(year) || isNaN(minor)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
const { year: latestSupportedYear, minor: latestSupportedMinor } = parsePlatformVersion(LATEST_SUPPORTED_PLATFORM_VERSION);
|
|
37
|
-
return (year > latestSupportedYear ||
|
|
38
|
-
(year === latestSupportedYear && minor > latestSupportedMinor));
|
|
39
|
-
}
|