@hubspot/cli 8.3.1-experimental.0 → 8.3.1-experimental.2
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/feedback.d.ts +10 -0
- package/api/feedback.js +9 -0
- package/bin/cli.js +19 -1
- package/commands/account/auth.js +2 -2
- package/commands/account/createOverride.js +2 -0
- package/commands/account/removeOverride.js +2 -0
- package/commands/app/secret/add.js +1 -1
- package/commands/app/secret/delete.js +1 -1
- package/commands/app/secret/list.js +1 -1
- package/commands/app/secret/update.js +1 -1
- package/commands/app/secret.js +1 -1
- package/commands/auth.js +3 -2
- package/commands/cms/function/create.js +5 -37
- package/commands/cms/function/deploy.js +8 -1
- package/commands/cms/function/list.js +4 -0
- package/commands/cms/function/logs.js +2 -0
- package/commands/cms/function/server.js +6 -0
- package/commands/cms/lighthouseScore.js +1 -1
- package/commands/cms/upload.js +6 -0
- package/commands/cms/watch.js +2 -0
- package/commands/cms/webpack/create.js +5 -32
- package/commands/customObject.js +2 -2
- package/commands/feedback.d.ts +6 -2
- package/commands/feedback.js +82 -8
- package/commands/getStarted.js +4 -4
- package/commands/hubdb/list.js +2 -2
- package/commands/init.js +3 -2
- package/commands/mcp/setup.d.ts +1 -0
- package/commands/mcp/setup.js +11 -3
- package/commands/project/dev/index.js +2 -2
- package/commands/project/download.d.ts +2 -0
- package/commands/project/download.js +56 -16
- package/commands/project/logs.js +2 -2
- package/commands/project/upload.js +6 -2
- package/commands/project/watch.js +2 -2
- package/commands/sandbox/create.js +3 -3
- package/commands/sandbox/delete.js +1 -1
- package/commands/sandbox.js +1 -1
- package/lang/en.d.ts +111 -6
- package/lang/en.js +275 -51
- package/lib/accountAuth.js +12 -0
- package/lib/accountCredentials.d.ts +1 -0
- package/lib/accountCredentials.js +25 -0
- package/lib/agentHelp.d.ts +17 -0
- package/lib/agentHelp.js +90 -0
- package/lib/app/logSystemTypes.d.ts +4 -0
- package/lib/app/logSystemTypes.js +17 -0
- package/lib/app/logs.d.ts +2 -4
- package/lib/app/logs.js +2 -17
- package/lib/app/migrate.js +5 -8
- package/lib/commonOpts.js +4 -0
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +6 -0
- package/lib/crossPlatformSpawn/escape.d.ts +2 -0
- package/lib/crossPlatformSpawn/escape.js +38 -0
- package/lib/crossPlatformSpawn/index.d.ts +7 -0
- package/lib/crossPlatformSpawn/index.js +43 -0
- package/lib/crossPlatformSpawn/resolveCommand.d.ts +1 -0
- package/lib/crossPlatformSpawn/resolveCommand.js +69 -0
- package/lib/errorHandlers/suppressError.js +3 -3
- package/lib/feedback.d.ts +3 -0
- package/lib/feedback.js +13 -0
- package/lib/jsonOutput/projectDownload.d.ts +1 -0
- package/lib/jsonOutput/projectDownload.js +1 -0
- package/lib/jsonOutput/projectUpload.d.ts +1 -0
- package/lib/jsonOutput/projectUpload.js +1 -0
- package/lib/mcp/clients.d.ts +2 -1
- package/lib/mcp/clients.js +7 -7
- package/lib/mcp/setup.d.ts +7 -2
- package/lib/mcp/setup.js +22 -37
- package/lib/mcp/skills.d.ts +8 -0
- package/lib/mcp/skills.js +64 -0
- package/lib/projects/archive.d.ts +8 -0
- package/lib/projects/archive.js +104 -0
- package/lib/projects/archiveDiff.d.ts +12 -0
- package/lib/projects/archiveDiff.js +68 -0
- package/lib/projects/config.js +1 -1
- package/lib/projects/download.d.ts +37 -0
- package/lib/projects/download.js +123 -0
- package/lib/projects/localDev/AppDevModeInterface.js +3 -3
- package/lib/projects/localDev/LocalDevLogger.js +5 -5
- package/lib/projects/localDev/LocalDevWatcher.js +2 -1
- package/lib/projects/localDev/helpers/project.js +3 -3
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
- package/lib/projects/projectInfo.js +4 -4
- package/lib/projects/projectProfiles.js +3 -3
- package/lib/projects/ui.js +3 -3
- package/lib/projects/upload.d.ts +3 -1
- package/lib/projects/upload.js +23 -6
- package/lib/projects/watch.js +4 -2
- package/lib/projects/workspaces.js +4 -4
- package/lib/prompts/importDataTestAccountSelectPrompt.js +1 -1
- package/lib/prompts/personalAccessKeyPrompt.js +2 -2
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +3 -3
- package/lib/serverlessSunset.d.ts +6 -0
- package/lib/serverlessSunset.js +32 -0
- package/lib/testUtils.d.ts +5 -1
- package/lib/testUtils.js +2 -2
- package/lib/ui/appLogs.js +4 -4
- package/lib/ui/formatting.d.ts +13 -0
- package/lib/ui/formatting.js +39 -0
- package/lib/ui/git.js +3 -3
- package/lib/ui/index.d.ts +9 -23
- package/lib/ui/index.js +36 -69
- package/lib/ui/uiMessages.js +1 -1
- package/lib/validation.js +16 -1
- package/lib/yargs/makeWrappedYargsHandler.d.ts +1 -0
- package/lib/yargs/makeWrappedYargsHandler.js +7 -0
- package/mcp-server/Tool.d.ts +1 -0
- package/mcp-server/Tool.js +4 -1
- package/mcp-server/server.js +16 -5
- package/mcp-server/skills/hubspot-fix-build/SKILL.md +61 -0
- package/mcp-server/skills/hubspot-new-app/SKILL.md +84 -0
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +4 -1
- package/mcp-server/tools/index.js +2 -2
- package/mcp-server/tools/project/DocFetchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocFetchTool.js +53 -12
- package/mcp-server/tools/project/DocsSearchTool.js +2 -7
- package/mcp-server/tools/project/FindProjectsTool.js +4 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +2 -7
- package/mcp-server/tools/project/GetApplicationInfoTool.js +2 -7
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +1 -1
- package/mcp-server/tools/project/GetBuildLogsTool.js +2 -12
- package/mcp-server/tools/project/GetBuildStatusTool.js +2 -12
- package/mcp-server/tools/project/KnowledgeSearchTool.js +2 -5
- package/mcp-server/tools/project/SubmitFeedbackTool.d.ts +25 -0
- package/mcp-server/tools/project/SubmitFeedbackTool.js +73 -0
- package/mcp-server/utils/command.js +16 -5
- package/mcp-server/utils/errors.d.ts +1 -0
- package/mcp-server/utils/errors.js +9 -0
- package/mcp-server/utils/feedbackTracking.js +3 -1
- package/package.json +12 -14
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +0 -100
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { Tool } from '../../Tool.js';
|
|
3
|
-
import { formatTextContents } from '../../utils/content.js';
|
|
3
|
+
import { formatErrorTextContents, formatTextContents, } from '../../utils/content.js';
|
|
4
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
4
5
|
import { absoluteCurrentWorkingDirectory, docUrl } from './constants.js';
|
|
5
6
|
import { http } from '@hubspot/local-dev-lib/http/unauthed';
|
|
6
|
-
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
|
-
|
|
8
|
+
const offset = z
|
|
9
|
+
.number()
|
|
10
|
+
.int()
|
|
11
|
+
.min(0)
|
|
12
|
+
.default(0)
|
|
13
|
+
.describe('The character position to start reading from. When more content is available, the response gives the offset for the next part.');
|
|
14
|
+
const maxCharacters = z
|
|
15
|
+
.number()
|
|
16
|
+
.int()
|
|
17
|
+
.min(1000)
|
|
18
|
+
.max(40000)
|
|
19
|
+
.default(20000)
|
|
20
|
+
.describe('The maximum number of characters to return.');
|
|
21
|
+
const fullDocument = z
|
|
22
|
+
.boolean()
|
|
23
|
+
.default(false)
|
|
24
|
+
.describe('Set to true to return the whole document with no character limit. This ignores offset and maxCharacters. Set this only when the user asks for the whole page.');
|
|
9
25
|
const inputSchema = {
|
|
10
26
|
docUrl,
|
|
11
27
|
absoluteCurrentWorkingDirectory,
|
|
28
|
+
offset,
|
|
29
|
+
maxCharacters,
|
|
30
|
+
fullDocument,
|
|
31
|
+
};
|
|
32
|
+
const outputSchema = {
|
|
33
|
+
text: z.string(),
|
|
34
|
+
offset: z.number(),
|
|
35
|
+
nextOffset: z.number().optional(),
|
|
36
|
+
totalCharacters: z.number(),
|
|
12
37
|
};
|
|
13
38
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
39
|
const inputSchemaZodObject = z.object({
|
|
@@ -19,7 +44,7 @@ export class DocFetchTool extends Tool {
|
|
|
19
44
|
constructor(mcpServer, logger) {
|
|
20
45
|
super(mcpServer, logger, toolName);
|
|
21
46
|
}
|
|
22
|
-
async handler({ docUrl, absoluteCurrentWorkingDirectory, }) {
|
|
47
|
+
async handler({ docUrl, absoluteCurrentWorkingDirectory, offset, maxCharacters, fullDocument, }) {
|
|
23
48
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
24
49
|
try {
|
|
25
50
|
// Append .md extension to the URL
|
|
@@ -29,27 +54,43 @@ export class DocFetchTool extends Tool {
|
|
|
29
54
|
});
|
|
30
55
|
const content = response.data;
|
|
31
56
|
if (!content || content.trim().length === 0) {
|
|
32
|
-
return
|
|
57
|
+
return formatErrorTextContents('Document is empty or contains no content.');
|
|
58
|
+
}
|
|
59
|
+
if (!fullDocument && offset >= content.length) {
|
|
60
|
+
return formatErrorTextContents(`Offset ${offset} is past the end of the document, which has ${content.length} characters.`);
|
|
33
61
|
}
|
|
34
|
-
|
|
62
|
+
const start = fullDocument ? 0 : offset;
|
|
63
|
+
const chunkEnd = fullDocument
|
|
64
|
+
? content.length
|
|
65
|
+
: Math.min(offset + maxCharacters, content.length);
|
|
66
|
+
const nextOffset = chunkEnd < content.length ? chunkEnd : undefined;
|
|
67
|
+
const text = content.slice(start, chunkEnd);
|
|
68
|
+
const result = await formatTextContents(text, nextOffset === undefined
|
|
69
|
+
? undefined
|
|
70
|
+
: `This is part of the document (characters ${start} to ${chunkEnd} of ${content.length}). More content is available. To read the next part, call ${toolName} again with the same arguments and offset set to ${nextOffset}.`);
|
|
71
|
+
result.structuredContent = {
|
|
72
|
+
text,
|
|
73
|
+
offset: start,
|
|
74
|
+
nextOffset,
|
|
75
|
+
totalCharacters: content.length,
|
|
76
|
+
};
|
|
77
|
+
return result;
|
|
35
78
|
}
|
|
36
79
|
catch (error) {
|
|
37
80
|
this.logger.debug(toolName, {
|
|
38
81
|
message: 'Handler caught error',
|
|
39
82
|
error: error instanceof Error ? error.message : String(error),
|
|
40
83
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
const errorMessage = `Error fetching documentation: ${getErrorMessage(error)}`;
|
|
45
|
-
return formatTextContents(errorMessage);
|
|
84
|
+
const errorMessage = `Error fetching documentation: ${getToolErrorMessage(error)}`;
|
|
85
|
+
return formatErrorTextContents(errorMessage);
|
|
46
86
|
}
|
|
47
87
|
}
|
|
48
88
|
register() {
|
|
49
89
|
return this.mcpServer.registerTool(toolName, {
|
|
50
90
|
title: 'Fetch HubSpot Developer Documentation (single file)',
|
|
51
|
-
description: 'Always use this immediately after `search-docs` and before creating a plan, writing code, or answering technical questions. This tool retrieves the
|
|
91
|
+
description: 'Always use this immediately after `search-docs` and before creating a plan, writing code, or answering technical questions. This tool retrieves the authoritative content of a HubSpot Developer Documentation page from its URL, ensuring responses are accurate, up-to-date, and grounded in the official docs. Long pages return in parts. The response says when more content is available and how to fetch the next part. Some pages include a "Supported products" section (a `<SupportedProducts .../>` tag) listing the products and subscription tiers a feature requires. Read it to tell the user whether a feature is available on their plan, stated plainly (for example "requires Content Hub Enterprise") rather than by quoting raw spec fields.',
|
|
52
92
|
inputSchema,
|
|
93
|
+
outputSchema,
|
|
53
94
|
annotations: {
|
|
54
95
|
readOnlyHint: true,
|
|
55
96
|
openWorldHint: true,
|
|
@@ -2,11 +2,10 @@ import { http } from '@hubspot/local-dev-lib/http';
|
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
import { Tool } from '../../Tool.js';
|
|
4
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
5
6
|
import { absoluteCurrentWorkingDirectory, account, docsSearchQuery, } from './constants.js';
|
|
6
|
-
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
8
|
import { resolveAccountId } from './resolveAccount.js';
|
|
9
|
-
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const docsSearchLimit = z
|
|
11
10
|
.number()
|
|
12
11
|
.int()
|
|
@@ -80,11 +79,7 @@ export class DocsSearchTool extends Tool {
|
|
|
80
79
|
message: 'Handler caught error',
|
|
81
80
|
error: error instanceof Error ? error.message : String(error),
|
|
82
81
|
});
|
|
83
|
-
|
|
84
|
-
// Handle different status codes
|
|
85
|
-
return formatTextContents(error.toString());
|
|
86
|
-
}
|
|
87
|
-
const errorMessage = `Error searching documentation: ${getErrorMessage(error)}`;
|
|
82
|
+
const errorMessage = `Error searching documentation: ${getToolErrorMessage(error)}`;
|
|
88
83
|
return formatTextContents(errorMessage);
|
|
89
84
|
}
|
|
90
85
|
}
|
|
@@ -30,7 +30,10 @@ export class FindProjectsTool extends Tool {
|
|
|
30
30
|
const selected = await elicitSelection(this.mcpServer, this.logger, {
|
|
31
31
|
message: 'Select the HubSpot project to use.',
|
|
32
32
|
title: 'HubSpot project',
|
|
33
|
-
options: projectDirs.map(dir => ({
|
|
33
|
+
options: projectDirs.map(dir => ({
|
|
34
|
+
value: dir,
|
|
35
|
+
label: path.relative(absoluteDirectory, dir) || '.',
|
|
36
|
+
})),
|
|
34
37
|
});
|
|
35
38
|
if (selected) {
|
|
36
39
|
return formatTextContents(`Selected project: ${selected}`);
|
|
@@ -2,11 +2,10 @@ import { Tool } from '../../Tool.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
4
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
|
-
import {
|
|
5
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
6
6
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, account, } from './constants.js';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
8
|
import { resolveAccountId } from './resolveAccount.js';
|
|
9
|
-
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
import { elicitSelection } from '../../utils/elicitSelection.js';
|
|
11
10
|
import { getApps } from './apps.js';
|
|
12
11
|
const inputSchema = {
|
|
@@ -83,11 +82,7 @@ export class GetApiUsagePatternsByAppIdTool extends Tool {
|
|
|
83
82
|
message: 'Handler caught error',
|
|
84
83
|
error: error instanceof Error ? error.message : String(error),
|
|
85
84
|
});
|
|
86
|
-
|
|
87
|
-
// Handle HubSpot-specific HTTP errors
|
|
88
|
-
return formatTextContents(error.toString());
|
|
89
|
-
}
|
|
90
|
-
return formatTextContents(getErrorMessage(error));
|
|
85
|
+
return formatTextContents(getToolErrorMessage(error));
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
register() {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, account, } from './constants.js';
|
|
6
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
7
7
|
import { resolveAccountId } from './resolveAccount.js';
|
|
8
|
-
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
9
8
|
import { getApps } from './apps.js';
|
|
10
9
|
const inputSchema = {
|
|
11
10
|
absoluteCurrentWorkingDirectory,
|
|
@@ -39,11 +38,7 @@ export class GetApplicationInfoTool extends Tool {
|
|
|
39
38
|
message: 'Handler caught error',
|
|
40
39
|
error: error instanceof Error ? error.message : String(error),
|
|
41
40
|
});
|
|
42
|
-
|
|
43
|
-
// Handle HubSpot-specific HTTP errors
|
|
44
|
-
return formatTextContents(error.toString());
|
|
45
|
-
}
|
|
46
|
-
return formatTextContents(getErrorMessage(error));
|
|
41
|
+
return formatTextContents(getToolErrorMessage(error));
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
44
|
register() {
|
|
@@ -10,9 +10,9 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
10
10
|
buildId: z.ZodNumber;
|
|
11
11
|
logLevel: z.ZodOptional<z.ZodEnum<{
|
|
12
12
|
ERROR: "ERROR";
|
|
13
|
+
ALL: "ALL";
|
|
13
14
|
WARN: "WARN";
|
|
14
15
|
INFO: "INFO";
|
|
15
|
-
ALL: "ALL";
|
|
16
16
|
}>>;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
export type GetBuildLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
5
5
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
6
6
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
7
7
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, account, } from './constants.js';
|
|
@@ -104,17 +104,7 @@ export class GetBuildLogsTool extends Tool {
|
|
|
104
104
|
message: 'Handler caught error',
|
|
105
105
|
error: error instanceof Error ? error.message : String(error),
|
|
106
106
|
});
|
|
107
|
-
|
|
108
|
-
if (isHubSpotHttpError(error)) {
|
|
109
|
-
errorMessage = error.toString();
|
|
110
|
-
}
|
|
111
|
-
else if (error instanceof Error) {
|
|
112
|
-
errorMessage = error.message;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
errorMessage = String(error);
|
|
116
|
-
}
|
|
117
|
-
return formatTextContents(absoluteCurrentWorkingDirectory, errorMessage);
|
|
107
|
+
return formatTextContents(absoluteCurrentWorkingDirectory, getToolErrorMessage(error));
|
|
118
108
|
}
|
|
119
109
|
}
|
|
120
110
|
register() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
5
5
|
import { fetchProjectBuilds, getBuildStatus, } from '@hubspot/local-dev-lib/api/projects';
|
|
6
6
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
7
7
|
import moment from 'moment';
|
|
@@ -145,17 +145,7 @@ export class GetBuildStatusTool extends Tool {
|
|
|
145
145
|
message: 'Handler caught error',
|
|
146
146
|
error: error instanceof Error ? error.message : String(error),
|
|
147
147
|
});
|
|
148
|
-
|
|
149
|
-
if (isHubSpotHttpError(error)) {
|
|
150
|
-
errorMessage = error.toString();
|
|
151
|
-
}
|
|
152
|
-
else if (error instanceof Error) {
|
|
153
|
-
errorMessage = error.message;
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
errorMessage = String(error);
|
|
157
|
-
}
|
|
158
|
-
return formatTextContents(absoluteCurrentWorkingDirectory, errorMessage);
|
|
148
|
+
return formatTextContents(absoluteCurrentWorkingDirectory, getToolErrorMessage(error));
|
|
159
149
|
}
|
|
160
150
|
}
|
|
161
151
|
register() {
|
|
@@ -2,8 +2,8 @@ import { http } from '@hubspot/local-dev-lib/http/unauthed';
|
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
import { Tool } from '../../Tool.js';
|
|
4
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
5
6
|
import { absoluteCurrentWorkingDirectory, knowledgeSearchQuery, } from './constants.js';
|
|
6
|
-
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
9
9
|
const knowledgeSearchLimit = z
|
|
@@ -61,10 +61,7 @@ export class KnowledgeSearchTool extends Tool {
|
|
|
61
61
|
message: 'Handler caught error',
|
|
62
62
|
error: getErrorMessage(error),
|
|
63
63
|
});
|
|
64
|
-
|
|
65
|
-
return formatTextContents(error.toString());
|
|
66
|
-
}
|
|
67
|
-
const errorMessage = `Error searching the knowledge base: ${getErrorMessage(error)}`;
|
|
64
|
+
const errorMessage = `Error searching the knowledge base: ${getToolErrorMessage(error)}`;
|
|
68
65
|
return formatTextContents(errorMessage);
|
|
69
66
|
}
|
|
70
67
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
4
|
+
import { McpToolResponse } from '../../types.js';
|
|
5
|
+
import { Tool } from '../../Tool.js';
|
|
6
|
+
declare const inputSchema: {
|
|
7
|
+
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
8
|
+
account: z.ZodOptional<z.ZodString>;
|
|
9
|
+
feedback: z.ZodString;
|
|
10
|
+
source: z.ZodEnum<{
|
|
11
|
+
user: "user";
|
|
12
|
+
agent: "agent";
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
type InputSchemaType = z.infer<z.ZodObject<typeof inputSchema>>;
|
|
16
|
+
export declare class SubmitFeedbackTool extends Tool<InputSchemaType> {
|
|
17
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
18
|
+
protected getTrackingMeta({ source, }: InputSchemaType): {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
protected getLoggableInput({ feedback, ...input }: InputSchemaType): unknown;
|
|
22
|
+
handler({ absoluteCurrentWorkingDirectory, account, feedback, source, }: InputSchemaType): Promise<McpToolResponse>;
|
|
23
|
+
register(): RegisteredTool;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
3
|
+
import { formatTextContents } from '../../utils/content.js';
|
|
4
|
+
import { getToolErrorMessage } from '../../utils/errors.js';
|
|
5
|
+
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
6
|
+
import { absoluteCurrentWorkingDirectory, account } from './constants.js';
|
|
7
|
+
import { resolveAccountId } from './resolveAccount.js';
|
|
8
|
+
import { containsAccountCredentials, submitFeedback, } from '../../../lib/feedback.js';
|
|
9
|
+
import { FEEDBACK_SOURCES } from '../../../api/feedback.js';
|
|
10
|
+
import { MAX_FEEDBACK_LENGTH } from '../../../lib/constants.js';
|
|
11
|
+
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
12
|
+
const inputSchema = {
|
|
13
|
+
absoluteCurrentWorkingDirectory,
|
|
14
|
+
account,
|
|
15
|
+
feedback: z
|
|
16
|
+
.string()
|
|
17
|
+
.trim()
|
|
18
|
+
.min(1)
|
|
19
|
+
.max(MAX_FEEDBACK_LENGTH)
|
|
20
|
+
.describe('One short message that describes the problem or the request. Keep it about the HubSpot CLI, these tools, or the developer platform. Do not include secrets, access keys, file contents, or personal data.'),
|
|
21
|
+
source: z
|
|
22
|
+
.enum(FEEDBACK_SOURCES)
|
|
23
|
+
.describe('Who the feedback is from. Use "user" when you pass on feedback that the user gave you, or "agent" when the feedback is your own.'),
|
|
24
|
+
};
|
|
25
|
+
const toolName = 'submit-feedback';
|
|
26
|
+
export class SubmitFeedbackTool extends Tool {
|
|
27
|
+
constructor(mcpServer, logger) {
|
|
28
|
+
super(mcpServer, logger, toolName);
|
|
29
|
+
}
|
|
30
|
+
getTrackingMeta({ source, }) {
|
|
31
|
+
return { mode: source };
|
|
32
|
+
}
|
|
33
|
+
getLoggableInput({ feedback, ...input }) {
|
|
34
|
+
return { ...input, feedbackLength: feedback.length };
|
|
35
|
+
}
|
|
36
|
+
async handler({ absoluteCurrentWorkingDirectory, account, feedback, source, }) {
|
|
37
|
+
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
38
|
+
try {
|
|
39
|
+
const resolved = await resolveAccountId(this.mcpServer, this.logger, {
|
|
40
|
+
toolName,
|
|
41
|
+
account,
|
|
42
|
+
});
|
|
43
|
+
if ('response' in resolved) {
|
|
44
|
+
return resolved.response;
|
|
45
|
+
}
|
|
46
|
+
if (containsAccountCredentials(feedback)) {
|
|
47
|
+
return formatTextContents('Feedback cannot contain an access key, token, or secret from your HubSpot config. Remove it, then try again.');
|
|
48
|
+
}
|
|
49
|
+
await submitFeedback(resolved.accountId, feedback, source);
|
|
50
|
+
return formatTextContents('Your feedback has been successfully submitted. Tell the user that you sent feedback, and show them the message.');
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.logger.debug(toolName, {
|
|
54
|
+
message: 'Handler caught error',
|
|
55
|
+
error: getErrorMessage(error),
|
|
56
|
+
});
|
|
57
|
+
return formatTextContents(`Error sending feedback: ${getToolErrorMessage(error)}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
register() {
|
|
61
|
+
return this.mcpServer.registerTool(toolName, {
|
|
62
|
+
title: 'Submit Feedback',
|
|
63
|
+
description: 'Sends feedback to HubSpot about the HubSpot CLI, these tools, or the HubSpot developer platform. Use it for bugs and errors you hit, things you wish you knew before you started, things that confused or frustrated the user, requests you could not complete, and tools or capabilities that would make future tasks easier. Send one short message, then continue with the task.',
|
|
64
|
+
inputSchema,
|
|
65
|
+
annotations: {
|
|
66
|
+
readOnlyHint: false,
|
|
67
|
+
destructiveHint: false,
|
|
68
|
+
idempotentHint: false,
|
|
69
|
+
openWorldHint: true,
|
|
70
|
+
},
|
|
71
|
+
}, (input, extra) => this.wrappedHandler(input, extra));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import util from 'util';
|
|
4
|
-
import { exec
|
|
4
|
+
import { exec } from 'node:child_process';
|
|
5
|
+
import { crossPlatformSpawn } from '../../lib/crossPlatformSpawn/index.js';
|
|
6
|
+
import { lib } from '../../lang/en.js';
|
|
7
|
+
function formatFlag({ name, value }) {
|
|
8
|
+
const flag = `--${name}`;
|
|
9
|
+
const values = (Array.isArray(value) ? value : [value]).map(String);
|
|
10
|
+
if (values.some(item => item.startsWith('-'))) {
|
|
11
|
+
return values.map(item => `${flag}=${item}`);
|
|
12
|
+
}
|
|
13
|
+
return [flag, ...values];
|
|
14
|
+
}
|
|
5
15
|
export class HubSpotCommand {
|
|
6
16
|
executable = 'hs';
|
|
7
17
|
subcommandArgs;
|
|
@@ -13,6 +23,9 @@ export class HubSpotCommand {
|
|
|
13
23
|
this.flags = [...flags];
|
|
14
24
|
}
|
|
15
25
|
addArg(value) {
|
|
26
|
+
if (value.startsWith('-')) {
|
|
27
|
+
throw new Error(lib.hubSpotCommand.argStartsWithDash(value));
|
|
28
|
+
}
|
|
16
29
|
this.positionalArgs.push(value);
|
|
17
30
|
return this;
|
|
18
31
|
}
|
|
@@ -24,9 +37,7 @@ export class HubSpotCommand {
|
|
|
24
37
|
return [
|
|
25
38
|
...this.subcommandArgs,
|
|
26
39
|
...this.positionalArgs,
|
|
27
|
-
...this.flags.flatMap(
|
|
28
|
-
? [`--${name}`, ...value.map(String)]
|
|
29
|
-
: [`--${name}`, String(value)]),
|
|
40
|
+
...this.flags.flatMap(formatFlag),
|
|
30
41
|
];
|
|
31
42
|
}
|
|
32
43
|
}
|
|
@@ -64,7 +75,7 @@ export async function runCommandInDir(directory, command, onData) {
|
|
|
64
75
|
return new Promise((resolve, reject) => {
|
|
65
76
|
const stdoutChunks = [];
|
|
66
77
|
const stderrChunks = [];
|
|
67
|
-
const child =
|
|
78
|
+
const child = crossPlatformSpawn(finalCommand.executable, finalCommand.args, {
|
|
68
79
|
cwd: resolvedDir,
|
|
69
80
|
env: { ...process.env, INIT_CWD: resolvedDir },
|
|
70
81
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getToolErrorMessage(error: unknown): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
2
|
+
import { getErrorMessage } from '../../lib/errorHandlers/index.js';
|
|
3
|
+
import { getConfigCredentials } from '../../lib/accountCredentials.js';
|
|
4
|
+
export function getToolErrorMessage(error) {
|
|
5
|
+
const message = isHubSpotHttpError(error)
|
|
6
|
+
? error.toString()
|
|
7
|
+
: getErrorMessage(error);
|
|
8
|
+
return getConfigCredentials().reduce((redactedMessage, credential) => redactedMessage.replaceAll(credential, '[redacted]'), message);
|
|
9
|
+
}
|
|
@@ -18,7 +18,9 @@ export async function mcpFeedbackRequest() {
|
|
|
18
18
|
IMPORTANT - FEEDBACK REQUEST FOR THIS RESPONSE ONLY:
|
|
19
19
|
This message appears only once. If you see this text in the tool output, you MUST include the following feedback request in your response to the user. If this text is NOT in the tool output, do NOT ask for feedback.
|
|
20
20
|
|
|
21
|
-
Say: "📝 **Before we continue, would you mind sharing feedback on your experience with the HubSpot Developer MCP?** Your input helps us improve
|
|
21
|
+
Say: "📝 **Before we continue, would you mind sharing feedback on your experience with the HubSpot Developer MCP?** Your input helps us improve. You can tell me and I will send it, or [use the feedback form](${FEEDBACK_URL})."
|
|
22
|
+
|
|
23
|
+
If the user shares feedback, send it with \`submit-feedback\` and set \`source\` to \`user\`.`;
|
|
22
24
|
}
|
|
23
25
|
catch (error) {
|
|
24
26
|
logger.error(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "8.3.1-experimental.
|
|
3
|
+
"version": "8.3.1-experimental.2",
|
|
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,18 +10,17 @@
|
|
|
10
10
|
"!**/__tests__/**"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@hubspot/local-dev-lib": "5.
|
|
14
|
-
"@hubspot/project-parsing-lib": "0.23.
|
|
15
|
-
"@hubspot/ui-extensions-dev-server": "2.2.
|
|
13
|
+
"@hubspot/local-dev-lib": "5.14.1",
|
|
14
|
+
"@hubspot/project-parsing-lib": "0.23.7",
|
|
15
|
+
"@hubspot/ui-extensions-dev-server": "2.2.5",
|
|
16
16
|
"@inquirer/prompts": "7.10.1",
|
|
17
|
-
"@modelcontextprotocol/sdk": "1.
|
|
17
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
18
18
|
"archiver": "7.0.1",
|
|
19
19
|
"chalk": "5.6.2",
|
|
20
|
-
"chokidar": "
|
|
20
|
+
"chokidar": "4.0.3",
|
|
21
21
|
"cli-cursor": "3.1.0",
|
|
22
22
|
"cli-progress": "3.12.0",
|
|
23
23
|
"express": "4.22.3",
|
|
24
|
-
"findup-sync": "4.0.0",
|
|
25
24
|
"fs-extra": "8.1.0",
|
|
26
25
|
"ink": "6.8.0",
|
|
27
26
|
"ink-spinner": "5.0.0",
|
|
@@ -31,13 +30,13 @@
|
|
|
31
30
|
"moment": "2.31.0",
|
|
32
31
|
"open": "7.4.2",
|
|
33
32
|
"p-queue": "8.1.1",
|
|
34
|
-
"react": "19.3.
|
|
35
|
-
"semver": "7.8.
|
|
33
|
+
"react": "19.3.1",
|
|
34
|
+
"semver": "7.8.6",
|
|
36
35
|
"strip-ansi": "7.2.0",
|
|
37
|
-
"table": "6.
|
|
36
|
+
"table": "6.10.1",
|
|
38
37
|
"tmp": "0.2.7",
|
|
39
38
|
"update-notifier": "7.3.1",
|
|
40
|
-
"ws": "8.22.
|
|
39
|
+
"ws": "8.22.1",
|
|
41
40
|
"yargs": "17.7.3",
|
|
42
41
|
"yargs-parser": "21.1.1",
|
|
43
42
|
"zod": "^4.4.3"
|
|
@@ -47,7 +46,6 @@
|
|
|
47
46
|
"@types/archiver": "^6.0.3",
|
|
48
47
|
"@types/cli-progress": "^3.11.6",
|
|
49
48
|
"@types/express": "^5.0.0",
|
|
50
|
-
"@types/findup-sync": "^4.0.5",
|
|
51
49
|
"@types/fs-extra": "^11.0.4",
|
|
52
50
|
"@types/js-yaml": "^4.0.9",
|
|
53
51
|
"@types/node": "^24.1.0",
|
|
@@ -60,7 +58,7 @@
|
|
|
60
58
|
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
61
59
|
"@typescript-eslint/parser": "^8.11.0",
|
|
62
60
|
"@vitest/coverage-v8": "^4.1.11",
|
|
63
|
-
"axios": "1.
|
|
61
|
+
"axios": "1.21.0",
|
|
64
62
|
"eslint": "^8.56.0",
|
|
65
63
|
"eslint-plugin-import": "^2.31.0",
|
|
66
64
|
"husky": "^4.3.8",
|
|
@@ -126,7 +124,7 @@
|
|
|
126
124
|
"eslint-visitor-keys": "4.2.0",
|
|
127
125
|
"@eslint-community/eslint-utils": "4.9.0",
|
|
128
126
|
"@opentelemetry/core": "2.10.0",
|
|
129
|
-
"axios": "1.
|
|
127
|
+
"axios": "1.21.0",
|
|
130
128
|
"vite": "6.4.3"
|
|
131
129
|
}
|
|
132
130
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { McpToolResponse } from '../../types.js';
|
|
2
|
-
import { Tool, ToolExtra } from '../../Tool.js';
|
|
3
|
-
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
-
import { McpLogger } from '../../utils/logger.js';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
declare const inputSchemaZodObject: z.ZodObject<{
|
|
7
|
-
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
8
|
-
dest: z.ZodOptional<z.ZodString>;
|
|
9
|
-
functionsFolder: z.ZodOptional<z.ZodString>;
|
|
10
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
11
|
-
endpointMethod: z.ZodOptional<z.ZodEnum<{
|
|
12
|
-
GET: "GET";
|
|
13
|
-
DELETE: "DELETE";
|
|
14
|
-
POST: "POST";
|
|
15
|
-
PUT: "PUT";
|
|
16
|
-
PATCH: "PATCH";
|
|
17
|
-
}>>;
|
|
18
|
-
endpointPath: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
export type HsCreateFunctionInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
21
|
-
export declare class HsCreateFunctionTool extends Tool<HsCreateFunctionInputSchema> {
|
|
22
|
-
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
23
|
-
handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
|
|
24
|
-
register(): RegisteredTool;
|
|
25
|
-
}
|
|
26
|
-
export {};
|