@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
package/lib/ui/index.js
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { getConfigAccountIfExists, globalConfigFileExists, } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { uiLogger } from './logger.js';
|
|
4
|
-
import { supportsHyperlinkModule } from './supportHyperlinks.js';
|
|
5
|
-
import { isColorEnabled } from './supportsColor.js';
|
|
6
4
|
import { uiMessages } from './uiMessages.js';
|
|
5
|
+
import { uiCommandReference, uiLink } from './formatting.js';
|
|
7
6
|
import { HUBSPOT_ACCOUNT_TYPE_STRINGS } from '@hubspot/local-dev-lib/constants/config';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
MARIGOLD: '#f5c26b',
|
|
11
|
-
MARIGOLD_DARK: '#dbae60',
|
|
12
|
-
};
|
|
13
|
-
export function uiLine() {
|
|
7
|
+
export { getTerminalUISupport, UI_COLORS, uiCommandReference, uiLink, } from './formatting.js';
|
|
8
|
+
export function logUiLine() {
|
|
14
9
|
uiLogger.log('-'.repeat(50));
|
|
15
10
|
}
|
|
16
|
-
export function getTerminalUISupport() {
|
|
17
|
-
return {
|
|
18
|
-
hyperlinks: supportsHyperlinkModule.stdout,
|
|
19
|
-
color: isColorEnabled(),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function uiLink(linkText, url) {
|
|
23
|
-
const terminalUISupport = getTerminalUISupport();
|
|
24
|
-
const encodedUrl = encodeURI(url);
|
|
25
|
-
if (terminalUISupport.hyperlinks) {
|
|
26
|
-
const CLOSE_SEQUENCE = '\u001B]8;;\u0007';
|
|
27
|
-
const result = [
|
|
28
|
-
'\u001B]8;;',
|
|
29
|
-
encodedUrl,
|
|
30
|
-
'\u0007',
|
|
31
|
-
linkText,
|
|
32
|
-
CLOSE_SEQUENCE,
|
|
33
|
-
].join('');
|
|
34
|
-
return terminalUISupport.color ? chalk.cyan(result) : result;
|
|
35
|
-
}
|
|
36
|
-
return terminalUISupport.color
|
|
37
|
-
? `${linkText}: ${chalk.reset.cyan(encodedUrl)}`
|
|
38
|
-
: `${linkText}: ${encodedUrl}`;
|
|
39
|
-
}
|
|
40
11
|
export function uiAccountDescription(accountId, bold = true) {
|
|
41
12
|
const account = accountId ? getConfigAccountIfExists(accountId) : undefined;
|
|
42
13
|
let message;
|
|
@@ -51,20 +22,13 @@ export function uiAccountDescription(accountId, bold = true) {
|
|
|
51
22
|
}
|
|
52
23
|
return bold ? chalk.bold(message) : message;
|
|
53
24
|
}
|
|
54
|
-
export function
|
|
55
|
-
|
|
25
|
+
export function logUiInfoSection(title, logContent) {
|
|
26
|
+
logUiLine();
|
|
56
27
|
uiLogger.log(chalk.bold(title));
|
|
57
28
|
uiLogger.log('');
|
|
58
29
|
logContent();
|
|
59
30
|
uiLogger.log('');
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
export function uiCommandReference(command, withQuotes = true) {
|
|
63
|
-
const terminalUISupport = getTerminalUISupport();
|
|
64
|
-
const commandReference = withQuotes ? `\`${command}\`` : command;
|
|
65
|
-
return chalk.bold(terminalUISupport.color
|
|
66
|
-
? chalk.hex(UI_COLORS.MARIGOLD_DARK)(commandReference)
|
|
67
|
-
: commandReference);
|
|
31
|
+
logUiLine();
|
|
68
32
|
}
|
|
69
33
|
export function uiAuthCommandReference({ accountId, qa, } = {}) {
|
|
70
34
|
const userIsUsingGlobalConfig = globalConfigFileExists();
|
|
@@ -74,8 +38,8 @@ export function uiAuthCommandReference({ accountId, qa, } = {}) {
|
|
|
74
38
|
}
|
|
75
39
|
return uiCommandReference(`${command}${accountId ? ` --account=${accountId}` : ''}${qa ? ' --qa' : ''}`);
|
|
76
40
|
}
|
|
77
|
-
export function
|
|
78
|
-
|
|
41
|
+
export function logUiFeatureHighlight(features, title) {
|
|
42
|
+
logUiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
|
|
79
43
|
features.forEach(feature => {
|
|
80
44
|
const featureConfig = uiMessages.featureHighlight.featureKeys[feature];
|
|
81
45
|
if (!featureConfig) {
|
|
@@ -99,59 +63,62 @@ export function uiFeatureHighlight(features, title) {
|
|
|
99
63
|
});
|
|
100
64
|
});
|
|
101
65
|
}
|
|
102
|
-
export function uiBetaTag(message
|
|
66
|
+
// export function uiBetaTag(message: string): string {
|
|
67
|
+
// const terminalUISupport = getTerminalUISupport();
|
|
68
|
+
// const tag = i18n(`lib.ui.betaTag`);
|
|
69
|
+
// return `${
|
|
70
|
+
// terminalUISupport.color ? chalk.hex(UI_COLORS.SORBET)(tag) : tag
|
|
71
|
+
// } ${message}`;
|
|
72
|
+
// }
|
|
73
|
+
// Replace this with the above code once we've upgraded to yargs 18.0.0
|
|
74
|
+
export function uiBetaTag(message) {
|
|
103
75
|
const tag = uiMessages.betaTag;
|
|
104
|
-
|
|
105
|
-
if (log) {
|
|
106
|
-
uiLogger.log(result);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
return result;
|
|
76
|
+
return `${tag} ${message}`;
|
|
110
77
|
}
|
|
111
|
-
export function uiDeprecatedTag(message
|
|
78
|
+
// export function uiDeprecatedTag(message: string): string {
|
|
79
|
+
// const terminalUISupport = getTerminalUISupport();
|
|
80
|
+
// const tag = i18n(`lib.ui.deprecatedTag`);
|
|
81
|
+
// return `${terminalUISupport.color ? chalk.yellow(tag) : tag} ${message}`;
|
|
82
|
+
// }
|
|
83
|
+
// Replace this with the above code once we've upgraded to yargs 18.0.0
|
|
84
|
+
export function uiDeprecatedTag(message) {
|
|
112
85
|
const tag = uiMessages.deprecatedTag;
|
|
113
|
-
|
|
114
|
-
if (log) {
|
|
115
|
-
uiLogger.log(result);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
return result;
|
|
86
|
+
return `${tag} ${message}`;
|
|
119
87
|
}
|
|
120
88
|
export function uiCommandDisabledBanner(command, url, message) {
|
|
121
89
|
const tag = message ||
|
|
122
90
|
`The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('See all HubSpot CLI commands here.', url) : ''}`;
|
|
123
91
|
uiLogger.log('');
|
|
124
|
-
|
|
92
|
+
logUiLine();
|
|
125
93
|
uiLogger.error(tag);
|
|
126
|
-
|
|
94
|
+
logUiLine();
|
|
127
95
|
uiLogger.log('');
|
|
128
96
|
}
|
|
129
|
-
export function
|
|
97
|
+
export function logUiDeprecatedDescription(message, command, url) {
|
|
130
98
|
const tag = message || uiMessages.disabledMessage(command, url);
|
|
131
|
-
|
|
99
|
+
uiLogger.log(uiDeprecatedTag(tag));
|
|
132
100
|
}
|
|
133
101
|
// export function uiCommandRenamedDescription(
|
|
134
102
|
// describe: string | false | undefined,
|
|
135
103
|
// newCommand: string
|
|
136
104
|
// ): string | undefined {
|
|
137
105
|
// return uiDeprecatedTag(
|
|
138
|
-
// `${describe} ${uiMessages.commandRenamedMessage(newCommand)}
|
|
139
|
-
// false
|
|
106
|
+
// `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`
|
|
140
107
|
// );
|
|
141
108
|
// }
|
|
142
109
|
// Replace this with the above code once we've upgraded to yargs 18.0.0
|
|
143
110
|
export function uiCommandRenamedDescription(describe, newCommand) {
|
|
144
|
-
return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}
|
|
111
|
+
return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`);
|
|
145
112
|
}
|
|
146
|
-
export function
|
|
113
|
+
export function logUiDeprecatedMessage(command, url, message) {
|
|
147
114
|
const tag = uiMessages.deprecatedDescription(message || '', command, url);
|
|
148
115
|
uiLogger.log('');
|
|
149
|
-
uiDeprecatedTag(tag);
|
|
116
|
+
uiLogger.log(uiDeprecatedTag(tag));
|
|
150
117
|
uiLogger.log('');
|
|
151
118
|
}
|
|
152
|
-
export function
|
|
119
|
+
export function logUiCommandRelocatedMessage(newCommand) {
|
|
153
120
|
uiLogger.log('');
|
|
154
|
-
uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand));
|
|
121
|
+
uiLogger.log(uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand)));
|
|
155
122
|
uiLogger.log('');
|
|
156
123
|
}
|
|
157
124
|
export function indent(level) {
|
package/lib/ui/uiMessages.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// UI messages for the UI module - separate file to avoid circular imports with lang/en.ts
|
|
2
2
|
// This contains the same strings that would be in lib.ui.* from lang/en.ts
|
|
3
|
-
import { uiCommandReference, uiLink } from './
|
|
3
|
+
import { uiCommandReference, uiLink } from './formatting.js';
|
|
4
4
|
export const uiMessages = {
|
|
5
5
|
betaTag: '[BETA]',
|
|
6
6
|
deprecatedTag: '[DEPRECATED]',
|
package/lib/validation.js
CHANGED
|
@@ -2,11 +2,12 @@ import * as fs from 'fs';
|
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { uiLogger } from '../lib/ui/logger.js';
|
|
4
4
|
import { CMS_PUBLISH_MODE } from '@hubspot/local-dev-lib/constants/files';
|
|
5
|
-
import { API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
|
|
5
|
+
import { ACCESS_TOKEN_AUTH_METHOD, API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
|
|
6
6
|
import { commaSeparatedValues } from '@hubspot/local-dev-lib/text';
|
|
7
7
|
import { getConfigFilePath, getConfigAccountById, } from '@hubspot/local-dev-lib/config';
|
|
8
8
|
import { getOauthManager } from '@hubspot/local-dev-lib/oauth';
|
|
9
9
|
import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
10
|
+
import { accessTokenForInjectedAccessToken } from '@hubspot/local-dev-lib/accessToken';
|
|
10
11
|
import { getAbsoluteFilePath, getCwd, getExt, } from '@hubspot/local-dev-lib/path';
|
|
11
12
|
import { ENVIRONMENT_VARIABLES } from '@hubspot/local-dev-lib/constants/config';
|
|
12
13
|
import { getCmsPublishMode } from './commonOpts.js';
|
|
@@ -39,6 +40,7 @@ export async function validateAccount(options) {
|
|
|
39
40
|
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
40
41
|
OAUTH_AUTH_METHOD,
|
|
41
42
|
API_KEY_AUTH_METHOD,
|
|
43
|
+
ACCESS_TOKEN_AUTH_METHOD,
|
|
42
44
|
].map(method => method.value))));
|
|
43
45
|
}
|
|
44
46
|
if (authType === 'oauth2') {
|
|
@@ -84,6 +86,19 @@ export async function validateAccount(options) {
|
|
|
84
86
|
return false;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
else if (authType === ACCESS_TOKEN_AUTH_METHOD.value) {
|
|
90
|
+
if (!accountConfig.auth.tokenInfo.accessToken) {
|
|
91
|
+
uiLogger.error(lib.validation.accessTokenMissing(accountId));
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
accessTokenForInjectedAccessToken(accountId);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
logError(e);
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
87
102
|
else if (!accountConfig.apiKey) {
|
|
88
103
|
uiLogger.error(lib.validation.authConfigurationMissing(accountId));
|
|
89
104
|
return false;
|
|
@@ -4,4 +4,5 @@ import { CommonArgs } from '../../types/Yargs.js';
|
|
|
4
4
|
export type WrappedHandlerOptions = {
|
|
5
5
|
jsonOutputSchema?: z.ZodType;
|
|
6
6
|
};
|
|
7
|
+
export declare function getJsonOutputSchema(trackingName: string): z.ZodType | undefined;
|
|
7
8
|
export declare function makeWrappedYargsHandler<T extends CommonArgs>(trackingName: string, handler: (args: ArgumentsCamelCase<T>) => Promise<void>, options?: WrappedHandlerOptions): (args: ArgumentsCamelCase<T>) => Promise<void>;
|
|
@@ -14,6 +14,10 @@ import { isPromptExitError } from '../errors/PromptExitError.js';
|
|
|
14
14
|
import { debugError } from '../errorHandlers/index.js';
|
|
15
15
|
import { MAX_LOG_FILES } from '../constants.js';
|
|
16
16
|
const HANDLER_LOG_DIR = path.join(os.homedir(), '.hscli', 'logs', 'cli');
|
|
17
|
+
const jsonOutputSchemas = new Map();
|
|
18
|
+
export function getJsonOutputSchema(trackingName) {
|
|
19
|
+
return jsonOutputSchemas.get(trackingName);
|
|
20
|
+
}
|
|
17
21
|
function logUsageTrackingMessage(isJsonOutput) {
|
|
18
22
|
if (isJsonOutput) {
|
|
19
23
|
return;
|
|
@@ -119,6 +123,9 @@ function createLogFileWriter(trackingName, isJsonOutput) {
|
|
|
119
123
|
return { writeLogFile, writeFailureLogFile };
|
|
120
124
|
}
|
|
121
125
|
export function makeWrappedYargsHandler(trackingName, handler, options) {
|
|
126
|
+
if (options?.jsonOutputSchema) {
|
|
127
|
+
jsonOutputSchemas.set(trackingName, options.jsonOutputSchema);
|
|
128
|
+
}
|
|
122
129
|
return async (args) => {
|
|
123
130
|
const wrappedHandlerArgs = args;
|
|
124
131
|
const isJsonOutput = Boolean(wrappedHandlerArgs.json || wrappedHandlerArgs.formatOutputAsJson);
|
package/mcp-server/Tool.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class Tool<InputSchema> {
|
|
|
16
16
|
protected getTrackingMeta(_input: InputSchema): {
|
|
17
17
|
[key: string]: string;
|
|
18
18
|
} | undefined;
|
|
19
|
+
protected getLoggableInput(input: InputSchema): unknown;
|
|
19
20
|
protected elicit(params: {
|
|
20
21
|
message: string;
|
|
21
22
|
fields: Record<string, PrimitiveSchemaDefinition>;
|
package/mcp-server/Tool.js
CHANGED
|
@@ -45,6 +45,9 @@ export class Tool {
|
|
|
45
45
|
getTrackingMeta(_input) {
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
|
+
getLoggableInput(input) {
|
|
49
|
+
return input;
|
|
50
|
+
}
|
|
48
51
|
elicit(params) {
|
|
49
52
|
return requestElicitation(this.mcpServer, params, this.logger);
|
|
50
53
|
}
|
|
@@ -57,7 +60,7 @@ export class Tool {
|
|
|
57
60
|
// Desktop, Inspector, etc.) will display these logs.
|
|
58
61
|
this.logger.debug(this.toolName, {
|
|
59
62
|
message: 'Tool invoked',
|
|
60
|
-
args: input,
|
|
63
|
+
args: this.getLoggableInput(input),
|
|
61
64
|
});
|
|
62
65
|
await trackToolUsage(this.toolName, this.getTrackingMeta(input));
|
|
63
66
|
const result = await this.handler(input, extra);
|
package/mcp-server/server.js
CHANGED
|
@@ -45,13 +45,17 @@ REQUIRED WORKFLOWS
|
|
|
45
45
|
5. Debugging a failed build: start with \`get-build-status\` to surface
|
|
46
46
|
error messages, and only reach for \`get-build-logs\` for deeper
|
|
47
47
|
troubleshooting or warnings.
|
|
48
|
-
6. Reading serverless function logs
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
6. Reading serverless function logs (deprecated, CMS serverless functions
|
|
49
|
+
are being sunset: editing ends on November 17, 2026 and existing
|
|
50
|
+
functions stop running on February 1, 2027): call
|
|
51
|
+
\`list-cms-serverless-functions\` first to discover the endpoint path,
|
|
52
|
+
then \`get-cms-serverless-function-logs\`.
|
|
51
53
|
7. Serverless functions come in two distinct kinds. CMS serverless
|
|
52
54
|
functions are website endpoints served at \`/hs/serverless/<path>\`.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
They can no longer be created and editing ends on November 17, 2026,
|
|
56
|
+
so build new serverless functions in a Developer Project instead with
|
|
57
|
+
\`add-feature-to-project\`.
|
|
58
|
+
Manage existing ones with \`list-cms-serverless-functions\` and
|
|
55
59
|
\`get-cms-serverless-function-logs\`. App functions are serverless
|
|
56
60
|
functions built inside a developer-platform app, either private
|
|
57
61
|
(the \`app-function\` feature) or publicly accessible via an endpoint
|
|
@@ -60,6 +64,13 @@ REQUIRED WORKFLOWS
|
|
|
60
64
|
functions.
|
|
61
65
|
8. App analytics: call \`get-apps-info\` to discover \`appId\` values
|
|
62
66
|
before \`get-api-usage-patterns-by-app-id\`.
|
|
67
|
+
9. Feedback: when you hit a bug, an error you cannot explain, a confusing
|
|
68
|
+
result, or a request these tools cannot do, call \`submit-feedback\`
|
|
69
|
+
with one short message. Then continue with the task.
|
|
70
|
+
10. Long-running commands: never run \`hs project dev\`,
|
|
71
|
+
\`hs project watch\`, or \`hs cms watch\` from a shell, even if
|
|
72
|
+
asked. Ask the user to run it in a separate terminal window. To
|
|
73
|
+
watch a project, give them \`hs project dev --auto-upload\`.
|
|
63
74
|
|
|
64
75
|
OUTPUT
|
|
65
76
|
Tool results contain the relevant \`hs\` stdout/stderr or structured data.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hubspot-fix-build
|
|
3
|
+
description: Diagnose and fix a failed HubSpot project build with the HubSpot CLI MCP tools. Use when a HubSpot project build failed, an `hs project upload` or `upload-project` failed, or a project deploy is blocked by a build error. Do not use it for other builds, such as npm, CI, or local compiler builds. Also use when `upload-project` returns a build failure. The skill finds the cause, fixes the project files, and asks before it uploads again.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
allowed-tools: Read, Grep, Glob
|
|
6
|
+
argument-hint: '[project-path] [build-id]'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Fix a failed HubSpot project build
|
|
10
|
+
|
|
11
|
+
Use this skill to find why a build failed and to fix it. Work from the error text. Do not guess a cause.
|
|
12
|
+
|
|
13
|
+
The tools in this skill come from the HubSpot CLI MCP server, which `hs mcp setup` adds as `HubSpotDev`. If more than one server has a tool with the same name, use the one from `HubSpotDev`.
|
|
14
|
+
|
|
15
|
+
## Task
|
|
16
|
+
|
|
17
|
+
When this skill is invoked:
|
|
18
|
+
|
|
19
|
+
### 1. Locate the project
|
|
20
|
+
|
|
21
|
+
`get-build-status` and `get-build-logs` need the project path, even when you have a build ID. Find the project before you look at any build.
|
|
22
|
+
|
|
23
|
+
1. If the user passed a project path as an argument, use it.
|
|
24
|
+
2. Otherwise call `find-projects`. If it finds several projects, ask the user which one to use.
|
|
25
|
+
3. If the user passed a build ID, keep it for step 2. A build ID does not tell you which project it belongs to.
|
|
26
|
+
|
|
27
|
+
### 2. Find the failed build
|
|
28
|
+
|
|
29
|
+
1. Call `get-build-status` with no `buildId`. It shows the recent builds.
|
|
30
|
+
2. If the user named a build, use that build. Otherwise use the latest build with a failure status.
|
|
31
|
+
3. Call `get-build-status` again with that `buildId`. Read `buildErrorMessage` and the failed subbuilds.
|
|
32
|
+
|
|
33
|
+
If the latest build succeeded, tell the user. Ask which build they mean.
|
|
34
|
+
|
|
35
|
+
### 3. Read the logs only if needed
|
|
36
|
+
|
|
37
|
+
The status output often has enough detail. Call `get-build-logs` in these cases:
|
|
38
|
+
|
|
39
|
+
- The error message is vague or empty.
|
|
40
|
+
- The user asks about warnings.
|
|
41
|
+
- The subbuild failure does not name a file or a field.
|
|
42
|
+
|
|
43
|
+
Start with `logLevel` set to `ERROR`. Use `WARN` for warnings. Use `ALL` as the last choice.
|
|
44
|
+
|
|
45
|
+
### 4. Fix the cause
|
|
46
|
+
|
|
47
|
+
1. Name the cause to the user in one or two sentences. Quote the error text.
|
|
48
|
+
2. If the error points to a `*-hsmeta.json` file, read `platformVersion` in `hsproject.json`. Call `get-feature-config-schema` with that version and the `type` field from the file. Fix the file with values the schema allows.
|
|
49
|
+
3. For other errors, fix the named file.
|
|
50
|
+
4. Do not change `distribution` or `auth` in `app-hsmeta.json` to clear an error. These values cannot change after the first upload. Tell the user and ask what they want to do.
|
|
51
|
+
5. If you cannot find the cause, show the error text to the user without changes. Say which files and logs you read.
|
|
52
|
+
|
|
53
|
+
### 5. Validate
|
|
54
|
+
|
|
55
|
+
Call `validate-project`. Fix each error and call it again. Repeat until it passes.
|
|
56
|
+
|
|
57
|
+
### 6. Ask before you upload
|
|
58
|
+
|
|
59
|
+
Say what you changed. Ask the user whether to upload again. If they say yes, call `upload-project`. If the project uses profiles, ask the user which profile to use. Never choose a profile yourself.
|
|
60
|
+
|
|
61
|
+
After the upload, call `get-build-status` to read the status of the new build. If it fails again, go back to step 2. If the same error repeats after two fixes, stop and show the user the error and what you tried.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hubspot-new-app
|
|
3
|
+
description: Plan and create a HubSpot developer-platform app project with the HubSpot CLI MCP tools. Use when the user wants to build, start, or scaffold a HubSpot developer-platform app project (an `hsproject.json` project). Also use when the user wants to add features such as cards, webhooks, workflow actions, or app functions to a project. Also use when the user has only a rough idea and needs help to choose features, distribution, and auth type. The skill ends with a local project that passes validation. It does not upload or deploy.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
allowed-tools: Read, Grep, Glob
|
|
6
|
+
argument-hint: '[app-idea]'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Plan and create a HubSpot app project
|
|
10
|
+
|
|
11
|
+
Use this skill to turn an idea into a local HubSpot project that passes validation. The first upload fixes two choices: distribution and auth type. A wrong choice means a new project, so plan before you scaffold.
|
|
12
|
+
|
|
13
|
+
Never choose distribution, auth type, project name, or destination for the user. Ask.
|
|
14
|
+
|
|
15
|
+
The tools in this skill come from the HubSpot CLI MCP server, which `hs mcp setup` adds as `HubSpotDev`. If more than one server has a tool with the same name, use the one from `HubSpotDev`.
|
|
16
|
+
|
|
17
|
+
## Task
|
|
18
|
+
|
|
19
|
+
When this skill is invoked:
|
|
20
|
+
|
|
21
|
+
### 1. Find the starting point
|
|
22
|
+
|
|
23
|
+
1. If the user wants to add features to an existing project, call `find-projects` on the working directory, then skip to step 4 and use `add-feature-to-project`. If the user wants a new app, do not call `find-projects`. If you cannot tell which one the user wants, ask.
|
|
24
|
+
2. If any tool reports "No account ID found", or no account is authenticated, call `auth-account`. Tell the user that a browser tab opens and that they must click "Connect to CLI". Then retry the blocked step.
|
|
25
|
+
3. If the user wants a safe place to test, offer `create-test-account`. Follow that tool's own workflow: look for a test account config file, show it to the user, and ask before you use it. If there is no file, ask for the account name and the tier for each hub.
|
|
26
|
+
|
|
27
|
+
### 2. Plan
|
|
28
|
+
|
|
29
|
+
If the user already stated what the app does, the features, the distribution, and the auth type, skip this step.
|
|
30
|
+
|
|
31
|
+
1. If the user passed an app idea as an argument (for example `/hubspot-new-app a card that shows open tickets`), use it. Otherwise ask one question: what must the app do for its users?
|
|
32
|
+
2. Call `search-docs` for that goal. Call `fetch-doc` on the best results. Choose features from the docs. The valid feature values are:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
card, settings, app-function, app-function-endpoint, webhooks,
|
|
36
|
+
workflow-action, workflow-action-tool, app-object, app-event,
|
|
37
|
+
scim, page, crm-bulk-action
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. Keep these features apart:
|
|
41
|
+
- `app-function` is a private serverless function inside the app.
|
|
42
|
+
- `app-function-endpoint` is an app serverless function with a public endpoint.
|
|
43
|
+
- `workflow-action-tool` is an agent tool.
|
|
44
|
+
- Do not confuse any of them with a CMS serverless function. That is a different product.
|
|
45
|
+
4. If a fetched doc has a "Supported products" section, tell the user the required product and tier in plain words. For example: "This feature requires Content Hub Enterprise." Do this before you scaffold. If no fetched doc has that section, do not state a tier.
|
|
46
|
+
5. Ask for the distribution:
|
|
47
|
+
- `private`: the app is not listed on the HubSpot marketplace.
|
|
48
|
+
- `marketplace`: the app is listed on the HubSpot marketplace.
|
|
49
|
+
6. Ask for the auth type. `oauth` works for both distributions. `static` works only with `private` distribution.
|
|
50
|
+
7. Ask for the project name. Ask for the destination directory. The destination becomes the project folder itself, so use the exact path that the user gives. Do not use the current directory unless the user says so.
|
|
51
|
+
8. After the user answers, show the full plan: name, destination, project base (`app` or `empty`), distribution, auth type, and features.
|
|
52
|
+
9. Ask "Create this project?" Say that distribution and auth type cannot change after the first upload. Wait for a yes in a separate reply. Answers to your questions are not a yes. Do not call `create-project` or `add-feature-to-project` before the yes.
|
|
53
|
+
|
|
54
|
+
### 3. Create a new project
|
|
55
|
+
|
|
56
|
+
Call `create-project` with every value from the plan:
|
|
57
|
+
|
|
58
|
+
- `name`, `destination`
|
|
59
|
+
- `projectBase`: `app` for a project with an app, `empty` for a project without one
|
|
60
|
+
- `distribution` and `auth` (for base `app` only)
|
|
61
|
+
- `features`
|
|
62
|
+
|
|
63
|
+
If the tool answers with a question, ask the user. Do not guess a value.
|
|
64
|
+
|
|
65
|
+
### 4. Add features to an existing project
|
|
66
|
+
|
|
67
|
+
Call `add-feature-to-project` with `absoluteProjectPath` and `features`.
|
|
68
|
+
|
|
69
|
+
- If the project has no app, set `addApp` to `true`. A project needs an app before it can hold a feature.
|
|
70
|
+
- When `addApp` is `true`, pass `distribution` and `auth`. Ask the user for them, as in step 2. Otherwise omit them.
|
|
71
|
+
|
|
72
|
+
### 5. Configure and validate
|
|
73
|
+
|
|
74
|
+
1. Open `hsproject.json` and read `platformVersion`.
|
|
75
|
+
2. Before you edit any `*-hsmeta.json` file, call `get-feature-config-schema` with that `platformVersion` and the `type` field from the file. Use only the values the schema allows.
|
|
76
|
+
3. Edit the file.
|
|
77
|
+
4. If a feature reads or writes CRM data, add the scopes it needs to `requiredScopes` in `app-hsmeta.json`. The schema does not list scope names, so find the exact names with `search-docs` and `fetch-doc`.
|
|
78
|
+
5. Call `validate-project`. Fix each error and call it again. Repeat until it passes. If you cannot fix an error, show the error text to the user without changes.
|
|
79
|
+
|
|
80
|
+
### 6. Finish
|
|
81
|
+
|
|
82
|
+
Tell the user which files you created and which features the project has. Tell them that the project is ready to upload, and that the first upload makes distribution and auth type permanent.
|
|
83
|
+
|
|
84
|
+
Do not call `upload-project` in this skill. Stop here. If the user asks to upload later, treat it as a new request. If that build fails, use the `hubspot-fix-build` skill.
|
|
@@ -91,7 +91,7 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
91
91
|
const normalizedEndpoint = resolvedEndpoint.startsWith('/')
|
|
92
92
|
? resolvedEndpoint.slice(1)
|
|
93
93
|
: resolvedEndpoint;
|
|
94
|
-
const command = new HubSpotCommand(
|
|
94
|
+
const command = new HubSpotCommand('cms function logs').addArg(normalizedEndpoint);
|
|
95
95
|
if (latest) {
|
|
96
96
|
command.addFlag('latest', latest);
|
|
97
97
|
}
|
|
@@ -119,7 +119,7 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
119
119
|
register() {
|
|
120
120
|
return this.mcpServer.registerTool(toolName, {
|
|
121
121
|
title: 'Get HubSpot CMS serverless function logs for an endpoint',
|
|
122
|
-
description: 'Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
|
|
122
|
+
description: 'DEPRECATED: CMS serverless functions are being sunset: creating them has ended, editing ends on November 17, 2026, and existing functions stop running on February 1, 2027. Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
|
|
123
123
|
inputSchema,
|
|
124
124
|
annotations: {
|
|
125
125
|
readOnlyHint: true,
|
|
@@ -54,7 +54,7 @@ export class HsListFunctionsTool extends Tool {
|
|
|
54
54
|
register() {
|
|
55
55
|
return this.mcpServer.registerTool(toolName, {
|
|
56
56
|
title: 'List HubSpot CMS Serverless Functions',
|
|
57
|
-
description: 'Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
|
|
57
|
+
description: 'DEPRECATED: CMS serverless functions are being sunset: creating them has ended, editing ends on November 17, 2026, and existing functions stop running on February 1, 2027. Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
|
|
58
58
|
inputSchema,
|
|
59
59
|
annotations: {
|
|
60
60
|
readOnlyHint: true,
|
|
@@ -25,7 +25,10 @@ export class HsListTool extends Tool {
|
|
|
25
25
|
}
|
|
26
26
|
async handler({ path, account, absoluteCurrentWorkingDirectory }, extra) {
|
|
27
27
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
28
|
-
const command = new HubSpotCommand(
|
|
28
|
+
const command = new HubSpotCommand('cms list');
|
|
29
|
+
if (path) {
|
|
30
|
+
command.addArg(path);
|
|
31
|
+
}
|
|
29
32
|
if (account) {
|
|
30
33
|
command.addFlag('account', account);
|
|
31
34
|
}
|
|
@@ -15,12 +15,12 @@ import { GetBuildStatusTool } from './project/GetBuildStatusTool.js';
|
|
|
15
15
|
import { HsListTool } from './cms/HsListTool.js';
|
|
16
16
|
import { HsCreateModuleTool } from './cms/HsCreateModuleTool.js';
|
|
17
17
|
import { HsCreateTemplateTool } from './cms/HsCreateTemplateTool.js';
|
|
18
|
-
import { HsCreateFunctionTool } from './cms/HsCreateFunctionTool.js';
|
|
19
18
|
import { HsListFunctionsTool } from './cms/HsListFunctionsTool.js';
|
|
20
19
|
import { HsFunctionLogsTool } from './cms/HsFunctionLogsTool.js';
|
|
21
20
|
import { CreateTestAccountTool } from './project/CreateTestAccountTool.js';
|
|
22
21
|
import { FindProjectsTool } from './project/FindProjectsTool.js';
|
|
23
22
|
import { AuthAccountTool } from './project/AuthAccountTool.js';
|
|
23
|
+
import { SubmitFeedbackTool } from './project/SubmitFeedbackTool.js';
|
|
24
24
|
export function registerProjectTools(mcpServer, logger) {
|
|
25
25
|
return [
|
|
26
26
|
new UploadProjectTools(mcpServer, logger).register(),
|
|
@@ -40,6 +40,7 @@ export function registerProjectTools(mcpServer, logger) {
|
|
|
40
40
|
new GetBuildStatusTool(mcpServer, logger).register(),
|
|
41
41
|
new FindProjectsTool(mcpServer, logger).register(),
|
|
42
42
|
new AuthAccountTool(mcpServer, logger).register(),
|
|
43
|
+
new SubmitFeedbackTool(mcpServer, logger).register(),
|
|
43
44
|
];
|
|
44
45
|
}
|
|
45
46
|
export function registerCmsTools(mcpServer, logger) {
|
|
@@ -47,7 +48,6 @@ export function registerCmsTools(mcpServer, logger) {
|
|
|
47
48
|
new HsListTool(mcpServer, logger).register(),
|
|
48
49
|
new HsCreateModuleTool(mcpServer, logger).register(),
|
|
49
50
|
new HsCreateTemplateTool(mcpServer, logger).register(),
|
|
50
|
-
new HsCreateFunctionTool(mcpServer, logger).register(),
|
|
51
51
|
new HsListFunctionsTool(mcpServer, logger).register(),
|
|
52
52
|
new HsFunctionLogsTool(mcpServer, logger).register(),
|
|
53
53
|
];
|
|
@@ -6,11 +6,14 @@ import { Tool } from '../../Tool.js';
|
|
|
6
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
7
7
|
docUrl: z.ZodString;
|
|
8
8
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
9
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
maxCharacters: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
fullDocument: z.ZodDefault<z.ZodBoolean>;
|
|
9
12
|
}, z.z.core.$strip>;
|
|
10
13
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
11
14
|
export declare class DocFetchTool extends Tool<InputSchemaType> {
|
|
12
15
|
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
13
|
-
handler({ docUrl, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<McpToolResponse>;
|
|
16
|
+
handler({ docUrl, absoluteCurrentWorkingDirectory, offset, maxCharacters, fullDocument, }: InputSchemaType): Promise<McpToolResponse>;
|
|
14
17
|
register(): RegisteredTool;
|
|
15
18
|
}
|
|
16
19
|
export {};
|