@hubspot/cli 8.6.0 → 8.7.0-beta.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/releases.d.ts +36 -0
- package/api/releases.js +41 -0
- package/bin/cli.js +3 -3
- package/commands/account/auth.js +2 -2
- package/commands/account/clean.js +2 -2
- package/commands/account/createOverride.js +2 -2
- package/commands/account/info.js +2 -2
- package/commands/account/link.js +2 -2
- package/commands/account/list.js +2 -2
- package/commands/account/remove.js +2 -2
- package/commands/account/removeOverride.js +2 -2
- package/commands/account/rename.js +2 -2
- package/commands/account/unlink.js +2 -2
- package/commands/account/use.js +2 -2
- package/commands/api.js +2 -2
- package/commands/app/migrate.js +2 -2
- package/commands/app/secret/add.js +2 -2
- package/commands/app/secret/delete.js +2 -2
- package/commands/app/secret/list.js +2 -2
- package/commands/app/secret/update.js +2 -2
- package/commands/auth.js +2 -2
- package/commands/cms/app/create.js +2 -2
- package/commands/cms/convertFields.js +2 -2
- package/commands/cms/delete.js +2 -2
- package/commands/cms/fetch.js +2 -2
- package/commands/cms/function/create.js +2 -2
- package/commands/cms/function/deploy.js +2 -2
- package/commands/cms/function/list.js +2 -2
- package/commands/cms/function/logs.js +2 -2
- package/commands/cms/function/server.js +2 -2
- package/commands/cms/getReactModule.js +2 -2
- package/commands/cms/lighthouseScore.js +2 -2
- package/commands/cms/lint.js +2 -2
- package/commands/cms/list.js +2 -2
- package/commands/cms/module/create.js +8 -2
- package/commands/cms/module/marketplace-validate.js +2 -2
- package/commands/cms/mv.js +2 -2
- package/commands/cms/template/create.js +2 -2
- package/commands/cms/theme/create.js +2 -2
- package/commands/cms/theme/generate-selectors.js +2 -2
- package/commands/cms/theme/marketplace-validate.js +2 -2
- package/commands/cms/theme/preview.js +2 -2
- package/commands/cms/upload.js +2 -2
- package/commands/cms/watch.js +2 -2
- package/commands/cms/webpack/create.js +2 -2
- package/commands/completion.js +2 -2
- package/commands/config/migrate.js +2 -2
- package/commands/config/set.js +2 -2
- package/commands/customObject/create.js +2 -2
- package/commands/customObject/createSchema.js +2 -2
- package/commands/customObject/deleteSchema.js +2 -2
- package/commands/customObject/fetchAllSchemas.js +2 -2
- package/commands/customObject/fetchSchema.js +2 -2
- package/commands/customObject/listSchemas.js +2 -2
- package/commands/customObject/updateSchema.js +2 -2
- package/commands/doctor.js +2 -2
- package/commands/feedback.js +2 -2
- package/commands/filemanager/fetch.js +2 -2
- package/commands/filemanager/upload.js +2 -2
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +2 -2
- package/commands/hubdb/create.js +2 -2
- package/commands/hubdb/delete.js +2 -2
- package/commands/hubdb/fetch.js +2 -2
- package/commands/hubdb/list.js +2 -2
- package/commands/init.js +2 -2
- package/commands/mcp/setup.js +2 -2
- package/commands/mcp/start.js +2 -2
- package/commands/open.js +2 -2
- package/commands/project/add.js +2 -2
- package/commands/project/appInstallStatus.d.ts +2 -2
- package/commands/project/appInstallStatus.js +3 -2
- package/commands/project/create.js +2 -2
- package/commands/project/delete.js +2 -2
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/index.js +2 -2
- package/commands/project/download.js +2 -2
- package/commands/project/info.d.ts +2 -2
- package/commands/project/info.js +3 -2
- package/commands/project/installDeps.js +2 -2
- package/commands/project/lint.js +7 -5
- package/commands/project/list.d.ts +2 -2
- package/commands/project/list.js +3 -2
- package/commands/project/listBuilds.js +2 -2
- package/commands/project/logs.js +2 -2
- package/commands/project/migrate.js +2 -2
- package/commands/project/open.js +2 -2
- package/commands/project/profile/add.js +2 -2
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/release/create.d.ts +7 -0
- package/commands/project/release/create.js +159 -0
- package/commands/project/release/info.d.ts +6 -0
- package/commands/project/release/info.js +147 -0
- package/commands/project/release/list.d.ts +6 -0
- package/commands/project/release/list.js +111 -0
- package/commands/project/release.d.ts +3 -0
- package/commands/project/release.js +20 -0
- package/commands/project/updateDeps.js +2 -2
- package/commands/project/upload.d.ts +3 -0
- package/commands/project/upload.js +77 -9
- package/commands/project/validate.js +2 -2
- package/commands/project/watch.js +2 -2
- package/commands/project.js +2 -0
- package/commands/sandbox/create.js +2 -2
- package/commands/sandbox/delete.js +2 -2
- package/commands/secret/addSecret.js +2 -2
- package/commands/secret/deleteSecret.js +2 -2
- package/commands/secret/listSecret.js +2 -2
- package/commands/secret/updateSecret.js +2 -2
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/createConfig.js +2 -2
- package/commands/testAccount/delete.js +2 -2
- package/commands/testAccount/importData.js +2 -2
- package/commands/upgrade.js +2 -2
- package/lang/en.d.ts +92 -0
- package/lang/en.js +92 -0
- package/lib/api/usageTracking.d.ts +29 -0
- package/lib/api/usageTracking.js +28 -0
- package/lib/commonOpts.js +0 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +1 -0
- package/lib/projects/localDev/helpers/project.js +1 -1
- package/lib/projects/npmAuditOnUpload.d.ts +10 -0
- package/lib/projects/npmAuditOnUpload.js +73 -0
- package/lib/projects/pollProjectBuildAndDeploy.d.ts +5 -1
- package/lib/projects/pollProjectBuildAndDeploy.js +3 -2
- package/lib/projects/preview.d.ts +7 -0
- package/lib/projects/preview.js +48 -0
- package/lib/projects/uieLinting.d.ts +4 -0
- package/lib/projects/uieLinting.js +36 -1
- package/lib/projects/upload.d.ts +3 -1
- package/lib/projects/upload.js +26 -6
- package/lib/projects/validateLintConfigOnUpload.d.ts +9 -0
- package/lib/projects/validateLintConfigOnUpload.js +45 -0
- package/lib/projects/workspaces.d.ts +11 -1
- package/lib/projects/workspaces.js +27 -12
- package/lib/usageTracking.d.ts +7 -17
- package/lib/usageTracking.js +43 -29
- package/lib/yargs/makeWrappedYargsHandler.d.ts +3 -0
- package/lib/yargs/{makeYargsHandlerWithUsageTracking.js → makeWrappedYargsHandler.js} +29 -3
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +2 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +4 -5
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +2 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -3
- package/mcp-server/tools/cms/HsListFunctionsTool.js +2 -3
- package/mcp-server/tools/cms/HsListTool.js +2 -2
- package/mcp-server/utils/toolUsageTracking.js +10 -6
- package/package.json +4 -4
- package/lib/yargs/makeYargsHandlerWithUsageTracking.d.ts +0 -3
package/lib/usageTracking.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getConfigAccountById, getConfig } from '@hubspot/local-dev-lib/config';
|
|
1
|
+
import { getConfig, getConfigAccountById, getConfigFilePath, getGlobalConfigFilePath, } from '@hubspot/local-dev-lib/config';
|
|
3
2
|
import { API_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
|
|
4
3
|
import { uiLogger } from './ui/logger.js';
|
|
5
4
|
import { pkg } from './jsonLoader.js';
|
|
6
5
|
import { debugError } from './errorHandlers/index.js';
|
|
7
6
|
import { isUsageTrackingDisableFlagSet } from './middleware/usageTrackingMiddleware.js';
|
|
7
|
+
import { sendUsageEvent, } from './api/usageTracking.js';
|
|
8
8
|
const version = pkg.version;
|
|
9
9
|
const usageTrackingDiabled = 'Usage tracking is disabled via the --disable-usage-tracking flag, not sending usage events';
|
|
10
10
|
export const EventClass = {
|
|
@@ -13,13 +13,13 @@ export const EventClass = {
|
|
|
13
13
|
VIEW: 'VIEW',
|
|
14
14
|
ACTIVATION: 'ACTIVATION',
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
function getNodeVersionData() {
|
|
17
17
|
return {
|
|
18
18
|
nodeVersion: process.version,
|
|
19
19
|
nodeMajorVersion: (process.version || '').split('.')[0],
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
function getPlatform() {
|
|
23
23
|
switch (process.platform) {
|
|
24
24
|
case 'darwin':
|
|
25
25
|
return 'macos';
|
|
@@ -29,6 +29,34 @@ export function getPlatform() {
|
|
|
29
29
|
return process.platform;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
function getConfigType() {
|
|
33
|
+
try {
|
|
34
|
+
return getConfigFilePath() === getGlobalConfigFilePath()
|
|
35
|
+
? 'global'
|
|
36
|
+
: 'local';
|
|
37
|
+
}
|
|
38
|
+
catch (_e) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function getExecutionSource() {
|
|
43
|
+
if (process.env.HUBSPOT_MCP_AI_AGENT) {
|
|
44
|
+
return 'mcp';
|
|
45
|
+
}
|
|
46
|
+
if (process.env.CI) {
|
|
47
|
+
return 'ci';
|
|
48
|
+
}
|
|
49
|
+
return 'user';
|
|
50
|
+
}
|
|
51
|
+
export function getExecutionEnvironmentMeta() {
|
|
52
|
+
return {
|
|
53
|
+
os: getPlatform(),
|
|
54
|
+
...getNodeVersionData(),
|
|
55
|
+
version,
|
|
56
|
+
configType: getConfigType(),
|
|
57
|
+
executionSource: getExecutionSource(),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
32
60
|
export async function trackCommandUsage(command, meta = {}, accountId) {
|
|
33
61
|
if (isUsageTrackingDisableFlagSet()) {
|
|
34
62
|
uiLogger.debug(usageTrackingDiabled);
|
|
@@ -130,39 +158,25 @@ async function trackCliInteraction({ action, accountId, command, authType, meta
|
|
|
130
158
|
if (config?.allowUsageTracking === false) {
|
|
131
159
|
return;
|
|
132
160
|
}
|
|
161
|
+
if (isUsageTrackingDisableFlagSet()) {
|
|
162
|
+
uiLogger.debug(usageTrackingDiabled);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
133
165
|
const usageTrackingEvent = {
|
|
134
166
|
action,
|
|
135
|
-
os: getPlatform(),
|
|
136
|
-
...getNodeVersionData(),
|
|
137
|
-
version,
|
|
138
167
|
command,
|
|
139
168
|
authType,
|
|
169
|
+
...getExecutionEnvironmentMeta(),
|
|
140
170
|
...meta,
|
|
141
171
|
};
|
|
142
|
-
if (process.env.HUBSPOT_MCP_AI_AGENT) {
|
|
143
|
-
try {
|
|
144
|
-
await trackUsage('cli-interaction', EventClass.INTERACTION, {
|
|
145
|
-
...usageTrackingEvent,
|
|
146
|
-
action: 'cli-mcp-server',
|
|
147
|
-
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
148
|
-
}, accountId);
|
|
149
|
-
uiLogger.debug('Sent AI usage tracking command event:', {
|
|
150
|
-
...usageTrackingEvent,
|
|
151
|
-
action: 'cli-mcp-server',
|
|
152
|
-
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
debugError(error);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (isUsageTrackingDisableFlagSet()) {
|
|
160
|
-
uiLogger.debug(usageTrackingDiabled);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
172
|
try {
|
|
164
173
|
uiLogger.debug('Sent usage tracking command event:', usageTrackingEvent);
|
|
165
|
-
|
|
174
|
+
await sendUsageEvent({
|
|
175
|
+
eventName: 'cli-interaction',
|
|
176
|
+
eventClass: EventClass.INTERACTION,
|
|
177
|
+
meta: usageTrackingEvent,
|
|
178
|
+
accountId,
|
|
179
|
+
});
|
|
166
180
|
}
|
|
167
181
|
catch (error) {
|
|
168
182
|
debugError(error);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { CommonArgs } from '../../types/Yargs.js';
|
|
3
|
+
export declare function makeWrappedYargsHandler<T extends CommonArgs>(trackingName: string, handler: (args: ArgumentsCamelCase<T>) => Promise<void>): (args: ArgumentsCamelCase<T>) => Promise<void>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
1
3
|
import { getConfig } from '@hubspot/local-dev-lib/config';
|
|
2
4
|
import { getStateValue, setStateValue, } from '@hubspot/local-dev-lib/config/state';
|
|
3
5
|
import { STATE_FLAGS } from '@hubspot/local-dev-lib/constants/config';
|
|
6
|
+
import { logger as ldlLogger } from '@hubspot/local-dev-lib/logger';
|
|
4
7
|
import { trackCommandUsage as _trackCommandUsage } from '../usageTracking.js';
|
|
5
8
|
import { pkg } from '../jsonLoader.js';
|
|
6
9
|
import { uiLogger } from '../ui/logger.js';
|
|
@@ -8,6 +11,7 @@ import { lib } from '../../lang/en.js';
|
|
|
8
11
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
9
12
|
import { isPromptExitError } from '../errors/PromptExitError.js';
|
|
10
13
|
import { debugError } from '../errorHandlers/index.js';
|
|
14
|
+
const HANDLER_LOG_DIR = path.join(os.homedir(), '.hscli', 'logs');
|
|
11
15
|
function logUsageTrackingMessage(isJsonOutput) {
|
|
12
16
|
if (isJsonOutput) {
|
|
13
17
|
return;
|
|
@@ -28,8 +32,9 @@ function logUsageTrackingMessage(isJsonOutput) {
|
|
|
28
32
|
return;
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
|
-
export function
|
|
35
|
+
export function makeWrappedYargsHandler(trackingName, handler) {
|
|
32
36
|
return async (args) => {
|
|
37
|
+
const startTime = Date.now();
|
|
33
38
|
const meta = {};
|
|
34
39
|
let trackingFired = false;
|
|
35
40
|
const trackingArgs = args;
|
|
@@ -45,6 +50,7 @@ export function makeYargsHandlerWithUsageTracking(trackingName, handler) {
|
|
|
45
50
|
try {
|
|
46
51
|
const { accountId: overrideAccountId, ...trackingMeta } = meta;
|
|
47
52
|
trackingMeta.successful = successful;
|
|
53
|
+
trackingMeta.executionTime = Date.now() - startTime;
|
|
48
54
|
await _trackCommandUsage(trackingName, trackingMeta, overrideAccountId ?? args.derivedAccountId);
|
|
49
55
|
}
|
|
50
56
|
catch (_e) { }
|
|
@@ -68,12 +74,31 @@ export function makeYargsHandlerWithUsageTracking(trackingName, handler) {
|
|
|
68
74
|
process.removeListener('SIGINT', onSigint);
|
|
69
75
|
process.removeListener('SIGINT', onForcedExit);
|
|
70
76
|
};
|
|
77
|
+
const jsonArgs = args;
|
|
78
|
+
const isJsonOutput = Boolean(jsonArgs.json || jsonArgs.formatOutputAsJson);
|
|
79
|
+
const writeFailureLogFile = () => {
|
|
80
|
+
// Skip in JSON output modes so the side effect + stderr message don't
|
|
81
|
+
// interfere with structured output consumers.
|
|
82
|
+
if (isJsonOutput) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const savedPath = ldlLogger.writeBufferedLogsToFile({
|
|
86
|
+
dir: HANDLER_LOG_DIR,
|
|
87
|
+
filenamePrefix: trackingName,
|
|
88
|
+
});
|
|
89
|
+
if (savedPath) {
|
|
90
|
+
uiLogger.log('');
|
|
91
|
+
uiLogger.error(lib.handlerLogFile.saved(savedPath));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
71
94
|
trackingArgs.exit = async (code) => {
|
|
72
95
|
await trackCommandUsageAndRemoveListeners(code !== EXIT_CODES.ERROR);
|
|
96
|
+
if (code === EXIT_CODES.ERROR) {
|
|
97
|
+
writeFailureLogFile();
|
|
98
|
+
}
|
|
73
99
|
return process.exit(code);
|
|
74
100
|
};
|
|
75
|
-
|
|
76
|
-
logUsageTrackingMessage(Boolean(jsonArgs.json || jsonArgs.formatOutputAsJson));
|
|
101
|
+
logUsageTrackingMessage(isJsonOutput);
|
|
77
102
|
try {
|
|
78
103
|
await handler(trackingArgs);
|
|
79
104
|
}
|
|
@@ -87,6 +112,7 @@ export function makeYargsHandlerWithUsageTracking(trackingName, handler) {
|
|
|
87
112
|
}
|
|
88
113
|
else {
|
|
89
114
|
debugError(e);
|
|
115
|
+
writeFailureLogFile();
|
|
90
116
|
return process.exit(EXIT_CODES.ERROR);
|
|
91
117
|
}
|
|
92
118
|
}
|
|
@@ -59,7 +59,7 @@ export class HsCreateFunctionTool extends Tool {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
// Build the command
|
|
62
|
-
let command = 'hs
|
|
62
|
+
let command = 'hs cms function create';
|
|
63
63
|
if (dest) {
|
|
64
64
|
command += ` "${dest}"`;
|
|
65
65
|
}
|
|
@@ -94,7 +94,7 @@ export class HsCreateFunctionTool extends Tool {
|
|
|
94
94
|
register() {
|
|
95
95
|
return this.mcpServer.registerTool(toolName, {
|
|
96
96
|
title: 'Create HubSpot CMS Serverless Function',
|
|
97
|
-
description: `Creates a new HubSpot CMS serverless function using the hs
|
|
97
|
+
description: `Creates a new HubSpot CMS serverless function using the hs cms function create command. Functions can be created non-interactively by specifying functionsFolder, filename, and endpointPath. Supports all HTTP methods (${HTTP_METHODS.join(', ')}).`,
|
|
98
98
|
inputSchema,
|
|
99
99
|
annotations: {
|
|
100
100
|
readOnlyHint: false,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
|
-
import { runCommandInDir } from '../../utils/command.js';
|
|
5
|
-
import {
|
|
6
|
-
import { addFlag } from '../../utils/command.js';
|
|
4
|
+
import { addFlag, runCommandInDir } from '../../utils/command.js';
|
|
5
|
+
import { formatTextContent, formatTextContents } from '../../utils/content.js';
|
|
7
6
|
import { CONTENT_TYPES } from '../../../types/Cms.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
@@ -75,7 +74,7 @@ export class HsCreateModuleTool extends Tool {
|
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
76
|
// Build the command
|
|
78
|
-
let command = 'hs
|
|
77
|
+
let command = 'hs cms module create';
|
|
79
78
|
if (userSuppliedName) {
|
|
80
79
|
command += ` "${userSuppliedName}"`;
|
|
81
80
|
}
|
|
@@ -116,7 +115,7 @@ export class HsCreateModuleTool extends Tool {
|
|
|
116
115
|
register() {
|
|
117
116
|
return this.mcpServer.registerTool(toolName, {
|
|
118
117
|
title: 'Create HubSpot CMS Module',
|
|
119
|
-
description: 'Creates a new HubSpot CMS module using the hs
|
|
118
|
+
description: 'Creates a new HubSpot CMS module using the hs cms module create command. Modules can be created non-interactively by specifying moduleLabel and other module options. You can create either HubL or React modules by setting the reactType parameter.',
|
|
120
119
|
inputSchema,
|
|
121
120
|
annotations: {
|
|
122
121
|
readOnlyHint: false,
|
|
@@ -47,7 +47,7 @@ export class HsCreateTemplateTool extends Tool {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
// Build the command
|
|
50
|
-
let command = 'hs
|
|
50
|
+
let command = 'hs cms template create';
|
|
51
51
|
if (userSuppliedName) {
|
|
52
52
|
command += ` "${userSuppliedName}"`;
|
|
53
53
|
}
|
|
@@ -73,7 +73,7 @@ export class HsCreateTemplateTool extends Tool {
|
|
|
73
73
|
register() {
|
|
74
74
|
return this.mcpServer.registerTool(toolName, {
|
|
75
75
|
title: 'Create HubSpot CMS Template',
|
|
76
|
-
description: `Creates a new HubSpot CMS template using the hs
|
|
76
|
+
description: `Creates a new HubSpot CMS template using the hs cms template create command. Templates can be created non-interactively by specifying templateType. Supports all template types including: ${TEMPLATE_TYPES.join(', ')}.`,
|
|
77
77
|
inputSchema,
|
|
78
78
|
annotations: {
|
|
79
79
|
readOnlyHint: false,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { addFlag } from '../../utils/command.js';
|
|
3
|
+
import { addFlag, runCommandInDir } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/command.js';
|
|
6
5
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
7
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
@@ -38,7 +37,7 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
38
37
|
const normalizedEndpoint = endpoint.startsWith('/')
|
|
39
38
|
? endpoint.slice(1)
|
|
40
39
|
: endpoint;
|
|
41
|
-
let command = `hs logs ${normalizedEndpoint}`;
|
|
40
|
+
let command = `hs cms function logs ${normalizedEndpoint}`;
|
|
42
41
|
if (latest) {
|
|
43
42
|
command = addFlag(command, 'latest', latest);
|
|
44
43
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { addFlag } from '../../utils/command.js';
|
|
3
|
+
import { addFlag, runCommandInDir } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/command.js';
|
|
6
5
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
7
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
@@ -26,7 +25,7 @@ export class HsListFunctionsTool extends Tool {
|
|
|
26
25
|
}
|
|
27
26
|
async handler({ account, json, absoluteCurrentWorkingDirectory, }) {
|
|
28
27
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
29
|
-
let command = 'hs function list';
|
|
28
|
+
let command = 'hs cms function list';
|
|
30
29
|
if (json) {
|
|
31
30
|
command += ' --json';
|
|
32
31
|
}
|
|
@@ -26,7 +26,7 @@ export class HsListTool extends Tool {
|
|
|
26
26
|
}
|
|
27
27
|
async handler({ path, account, absoluteCurrentWorkingDirectory, }) {
|
|
28
28
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
29
|
-
let command = 'hs list';
|
|
29
|
+
let command = 'hs cms list';
|
|
30
30
|
if (path) {
|
|
31
31
|
command += ` ${path}`;
|
|
32
32
|
}
|
|
@@ -46,7 +46,7 @@ export class HsListTool extends Tool {
|
|
|
46
46
|
content: [
|
|
47
47
|
{
|
|
48
48
|
type: 'text',
|
|
49
|
-
text: `Error executing hs list command: ${getErrorMessage(error)}`,
|
|
49
|
+
text: `Error executing hs cms list command: ${getErrorMessage(error)}`,
|
|
50
50
|
},
|
|
51
51
|
],
|
|
52
52
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EventClass, getNodeVersionData, getPlatform, } from '../../lib/usageTracking.js';
|
|
1
|
+
import { EventClass, getExecutionEnvironmentMeta, } from '../../lib/usageTracking.js';
|
|
3
2
|
import { getConfig, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
3
|
+
import { sendUsageEvent } from '../../lib/api/usageTracking.js';
|
|
4
4
|
export async function trackToolUsage(toolName, meta) {
|
|
5
5
|
const config = getConfig();
|
|
6
6
|
if (config?.allowUsageTracking === false) {
|
|
@@ -8,15 +8,19 @@ export async function trackToolUsage(toolName, meta) {
|
|
|
8
8
|
}
|
|
9
9
|
const usageTrackingEvent = {
|
|
10
10
|
action: 'cli-mcp-tool-invocation',
|
|
11
|
-
os: getPlatform(),
|
|
12
|
-
...getNodeVersionData(),
|
|
13
11
|
command: toolName,
|
|
14
12
|
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
13
|
+
...getExecutionEnvironmentMeta(),
|
|
15
14
|
...meta,
|
|
16
15
|
};
|
|
17
16
|
const accountId = getConfigDefaultAccountIfExists()?.accountId || undefined;
|
|
18
17
|
try {
|
|
19
|
-
await
|
|
18
|
+
await sendUsageEvent({
|
|
19
|
+
eventName: 'cli-interaction',
|
|
20
|
+
eventClass: EventClass.INTERACTION,
|
|
21
|
+
meta: usageTrackingEvent,
|
|
22
|
+
accountId,
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
|
-
catch (
|
|
25
|
+
catch (_error) { }
|
|
22
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0-beta.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,10 +10,10 @@
|
|
|
10
10
|
"!**/__tests__/**"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@hubspot/local-dev-lib": "5.
|
|
13
|
+
"@hubspot/local-dev-lib": "5.7.1",
|
|
14
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.7",
|
|
17
17
|
"@inquirer/prompts": "7.1.0",
|
|
18
18
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
19
19
|
"archiver": "7.0.1",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"table": "6.9.0",
|
|
38
38
|
"tmp": "0.2.4",
|
|
39
39
|
"update-notifier": "7.3.1",
|
|
40
|
-
"ws": "
|
|
40
|
+
"ws": "8.20.0",
|
|
41
41
|
"yargs": "17.7.2",
|
|
42
42
|
"yargs-parser": "21.1.1"
|
|
43
43
|
},
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { CommonArgs } from '../../types/Yargs.js';
|
|
3
|
-
export declare function makeYargsHandlerWithUsageTracking<T extends CommonArgs>(trackingName: string, handler: (args: ArgumentsCamelCase<T>) => Promise<void>): (args: ArgumentsCamelCase<T>) => Promise<void>;
|