@hubspot/cli 8.18.0 → 8.19.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/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/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/getStarted.js +4 -4
- package/commands/hubdb/list.js +2 -2
- package/commands/init.js +3 -2
- package/commands/mcp/setup.js +3 -2
- package/commands/project/dev/index.js +2 -2
- 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 +26 -0
- package/lang/en.js +85 -43
- package/lib/accountAuth.js +12 -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 +3 -3
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +4 -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/hints/hints.d.ts +9 -0
- package/lib/hints/hints.js +30 -0
- package/lib/hints/throttle.d.ts +4 -0
- package/lib/hints/throttle.js +9 -0
- package/lib/jsonOutput/projectUpload.d.ts +1 -0
- package/lib/jsonOutput/projectUpload.js +1 -0
- package/lib/mcp/promotion.js +15 -30
- package/lib/mcp/setup.d.ts +6 -1
- package/lib/mcp/setup.js +1 -1
- package/lib/middleware/deprecationWarningMiddleware.js +4 -9
- package/lib/projects/localDev/AppDevModeInterface.js +3 -3
- package/lib/projects/localDev/LocalDevLogger.js +5 -5
- 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/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/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/logger.d.ts +1 -0
- package/lib/ui/logger.js +2 -1
- package/lib/ui/uiMessages.js +1 -1
- package/mcp-server/server.js +13 -5
- 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 +0 -2
- package/mcp-server/utils/command.js +16 -5
- package/package.json +9 -9
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +0 -100
|
@@ -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,7 +15,6 @@ 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';
|
|
@@ -49,7 +48,6 @@ export function registerCmsTools(mcpServer, logger) {
|
|
|
49
48
|
new HsListTool(mcpServer, logger).register(),
|
|
50
49
|
new HsCreateModuleTool(mcpServer, logger).register(),
|
|
51
50
|
new HsCreateTemplateTool(mcpServer, logger).register(),
|
|
52
|
-
new HsCreateFunctionTool(mcpServer, logger).register(),
|
|
53
51
|
new HsListFunctionsTool(mcpServer, logger).register(),
|
|
54
52
|
new HsFunctionLogsTool(mcpServer, logger).register(),
|
|
55
53
|
];
|
|
@@ -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
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.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,11 +10,11 @@
|
|
|
10
10
|
"!**/__tests__/**"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@hubspot/local-dev-lib": "5.14.
|
|
13
|
+
"@hubspot/local-dev-lib": "5.14.1",
|
|
14
14
|
"@hubspot/project-parsing-lib": "0.23.7",
|
|
15
15
|
"@hubspot/ui-extensions-dev-server": "2.2.5",
|
|
16
16
|
"@inquirer/prompts": "7.10.1",
|
|
17
|
-
"@modelcontextprotocol/sdk": "1.32.
|
|
17
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
18
18
|
"archiver": "7.0.1",
|
|
19
19
|
"chalk": "5.6.2",
|
|
20
20
|
"chokidar": "4.0.3",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"moment": "2.31.0",
|
|
31
31
|
"open": "7.4.2",
|
|
32
32
|
"p-queue": "8.1.1",
|
|
33
|
-
"react": "19.3.
|
|
34
|
-
"semver": "7.8.
|
|
33
|
+
"react": "19.3.1",
|
|
34
|
+
"semver": "7.8.6",
|
|
35
35
|
"strip-ansi": "7.2.0",
|
|
36
|
-
"table": "6.
|
|
36
|
+
"table": "6.10.1",
|
|
37
37
|
"tmp": "0.2.7",
|
|
38
38
|
"update-notifier": "7.3.1",
|
|
39
|
-
"ws": "8.22.
|
|
39
|
+
"ws": "8.22.2",
|
|
40
40
|
"yargs": "17.7.3",
|
|
41
41
|
"yargs-parser": "21.1.1",
|
|
42
42
|
"zod": "^4.4.3"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
59
59
|
"@typescript-eslint/parser": "^8.11.0",
|
|
60
60
|
"@vitest/coverage-v8": "^4.1.11",
|
|
61
|
-
"axios": "1.
|
|
61
|
+
"axios": "1.21.1",
|
|
62
62
|
"eslint": "^8.56.0",
|
|
63
63
|
"eslint-plugin-import": "^2.31.0",
|
|
64
64
|
"husky": "^4.3.8",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"eslint-visitor-keys": "4.2.0",
|
|
125
125
|
"@eslint-community/eslint-utils": "4.9.0",
|
|
126
126
|
"@opentelemetry/core": "2.10.0",
|
|
127
|
-
"axios": "1.
|
|
127
|
+
"axios": "1.21.1",
|
|
128
128
|
"vite": "6.4.3"
|
|
129
129
|
}
|
|
130
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 {};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Tool } from '../../Tool.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
|
-
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
5
|
-
import { HTTP_METHODS } from '../../../types/Cms.js';
|
|
6
|
-
import { HubSpotCommand } from '../../utils/command.js';
|
|
7
|
-
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
|
-
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
9
|
-
const inputSchema = {
|
|
10
|
-
absoluteCurrentWorkingDirectory,
|
|
11
|
-
dest: z
|
|
12
|
-
.string()
|
|
13
|
-
.describe('The destination path where the function should be created on the current computer.')
|
|
14
|
-
.optional(),
|
|
15
|
-
functionsFolder: z
|
|
16
|
-
.string()
|
|
17
|
-
.describe('Folder name for function creation. Required for non-interactive function creation. If the user has not specified the folder name, ask them to provide it.')
|
|
18
|
-
.optional(),
|
|
19
|
-
filename: z
|
|
20
|
-
.string()
|
|
21
|
-
.describe('Function filename. Required for non-interactive function creation. If the user has not specified the filename, ask them to provide it.')
|
|
22
|
-
.optional(),
|
|
23
|
-
endpointMethod: z
|
|
24
|
-
.enum(HTTP_METHODS)
|
|
25
|
-
.describe(`HTTP method for the function endpoint. Must be one of: ${HTTP_METHODS.join(', ')}. Defaults to GET.`)
|
|
26
|
-
.optional(),
|
|
27
|
-
endpointPath: z
|
|
28
|
-
.string()
|
|
29
|
-
.describe('API endpoint path for the function. Required for non-interactive function creation. If the user has not specified the endpoint path, ask them to provide it.')
|
|
30
|
-
.optional(),
|
|
31
|
-
};
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
-
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
34
|
-
const toolName = 'create-cms-function';
|
|
35
|
-
export class HsCreateFunctionTool extends Tool {
|
|
36
|
-
constructor(mcpServer, logger) {
|
|
37
|
-
super(mcpServer, logger, toolName);
|
|
38
|
-
}
|
|
39
|
-
async handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }, extra) {
|
|
40
|
-
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
41
|
-
const content = [];
|
|
42
|
-
// Require functions folder
|
|
43
|
-
if (!functionsFolder) {
|
|
44
|
-
content.push(formatTextContent(`Ask the user to provide the folder name for the function.`));
|
|
45
|
-
}
|
|
46
|
-
// Require filename
|
|
47
|
-
if (!filename) {
|
|
48
|
-
content.push(formatTextContent(`Ask the user to provide the filename for the function.`));
|
|
49
|
-
}
|
|
50
|
-
// Require endpoint path
|
|
51
|
-
if (!endpointPath) {
|
|
52
|
-
content.push(formatTextContent(`Ask the user to provide the API endpoint path for the function.`));
|
|
53
|
-
}
|
|
54
|
-
// If we have missing required information, return the prompts
|
|
55
|
-
if (content.length > 0) {
|
|
56
|
-
return {
|
|
57
|
-
content,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// Build the command
|
|
61
|
-
const command = new HubSpotCommand('cms function create');
|
|
62
|
-
if (dest) {
|
|
63
|
-
command.addArg(dest);
|
|
64
|
-
}
|
|
65
|
-
if (functionsFolder) {
|
|
66
|
-
command.addFlag('functions-folder', functionsFolder);
|
|
67
|
-
}
|
|
68
|
-
if (filename) {
|
|
69
|
-
command.addFlag('filename', filename);
|
|
70
|
-
}
|
|
71
|
-
command.addFlag('endpoint-method', endpointMethod ?? 'GET');
|
|
72
|
-
if (endpointPath) {
|
|
73
|
-
command.addFlag('endpoint-path', endpointPath);
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
|
|
77
|
-
return formatTextContents(stdout, stderr);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
this.logger.debug(toolName, {
|
|
81
|
-
message: 'Handler caught error',
|
|
82
|
-
error: error instanceof Error ? error.message : String(error),
|
|
83
|
-
});
|
|
84
|
-
return formatTextContents(getErrorMessage(error));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
register() {
|
|
88
|
-
return this.mcpServer.registerTool(toolName, {
|
|
89
|
-
title: 'Create HubSpot CMS Serverless Function',
|
|
90
|
-
description: `Creates a new HubSpot CMS serverless function using the hs cms function create command. This is for CMS/website projects, served at /hs/serverless/<path>. Do NOT use this for developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). For those, use add-feature-to-project. Functions can be created non-interactively by specifying functionsFolder, filename, and endpointPath. Supports all HTTP methods (${HTTP_METHODS.join(', ')}).`,
|
|
91
|
-
inputSchema,
|
|
92
|
-
annotations: {
|
|
93
|
-
readOnlyHint: false,
|
|
94
|
-
destructiveHint: false,
|
|
95
|
-
idempotentHint: false,
|
|
96
|
-
openWorldHint: false,
|
|
97
|
-
},
|
|
98
|
-
}, (input, extra) => this.wrappedHandler(input, extra));
|
|
99
|
-
}
|
|
100
|
-
}
|