@hubspot/cli 8.1.0 → 8.2.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/commands/cms/__tests__/watch.test.js +0 -8
- package/commands/cms/function/logs.js +1 -0
- package/commands/cms/theme/preview.js +9 -64
- package/commands/cms/watch.d.ts +0 -1
- package/commands/cms/watch.js +2 -8
- package/commands/feedback.js +1 -1
- package/commands/mcp/__tests__/start.test.js +8 -1
- package/commands/mcp/setup.js +1 -9
- package/commands/mcp/start.js +0 -1
- package/commands/project/__tests__/create.test.js +1 -1
- package/commands/project/create.js +2 -2
- package/commands/project/watch.js +15 -2
- package/lang/en.d.ts +17 -6
- package/lang/en.js +18 -7
- package/lib/__tests__/commandSuggestion.test.js +2 -0
- package/lib/__tests__/serverlessLogs.test.js +79 -64
- package/lib/commandSuggestion.js +1 -7
- package/lib/constants.d.ts +1 -1
- package/lib/constants.js +1 -1
- package/lib/generateSelectors.js +1 -2
- package/lib/getStartedV2Actions.d.ts +13 -0
- package/lib/getStartedV2Actions.js +53 -0
- package/lib/mcp/__tests__/setup.test.js +357 -28
- package/lib/mcp/setup.d.ts +1 -0
- package/lib/mcp/setup.js +77 -30
- package/lib/projects/create/__tests__/legacy.test.js +6 -24
- package/lib/projects/create/index.js +1 -4
- package/lib/projects/create/legacy.js +3 -8
- package/lib/projects/create/v2.js +1 -9
- package/lib/projects/ensureProjectExists.js +1 -2
- package/lib/projects/pollProjectBuildAndDeploy.js +90 -85
- package/lib/projects/upload.d.ts +1 -0
- package/lib/projects/upload.js +37 -46
- package/lib/projects/watch.d.ts +2 -1
- package/lib/projects/watch.js +32 -24
- package/lib/serverlessLogs.js +50 -44
- package/lib/theme/cmsDevServerProcess.d.ts +12 -0
- package/lib/theme/cmsDevServerProcess.js +148 -0
- package/lib/theme/cmsDevServerRunner.d.ts +14 -0
- package/lib/theme/cmsDevServerRunner.js +90 -0
- package/lib/usageTracking.js +8 -5
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +1 -1
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -2
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +1 -2
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +1 -2
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +1 -2
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +1 -2
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +1 -2
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +20 -3
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +7 -11
- package/mcp-server/tools/project/CreateProjectTool.d.ts +24 -4
- package/mcp-server/tools/project/CreateProjectTool.js +6 -11
- package/mcp-server/tools/project/CreateTestAccountTool.js +1 -1
- package/mcp-server/tools/project/DeployProjectTool.js +1 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +5 -8
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +2 -2
- package/mcp-server/tools/project/GetBuildLogsTool.js +6 -7
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +1 -1
- package/mcp-server/tools/project/GetBuildStatusTool.js +3 -4
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +6 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -6
- package/mcp-server/tools/project/UploadProjectTools.js +1 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +1 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +1 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +1 -2
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +1 -2
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -32
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +10 -2
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +2 -2
- package/mcp-server/tools/project/constants.d.ts +12 -1
- package/mcp-server/tools/project/constants.js +12 -16
- package/mcp-server/utils/__tests__/command.test.js +233 -3
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +9 -64
- package/mcp-server/utils/command.d.ts +5 -0
- package/mcp-server/utils/command.js +24 -0
- package/mcp-server/utils/feedbackTracking.js +2 -17
- package/package.json +4 -5
- package/ui/components/getStarted/GetStartedFlow.js +79 -2
- package/ui/components/getStarted/reducer.d.ts +20 -0
- package/ui/components/getStarted/reducer.js +36 -0
- package/ui/components/getStarted/screens/InstallationScreen.d.ts +7 -0
- package/ui/components/getStarted/screens/InstallationScreen.js +16 -0
- package/ui/components/getStarted/screens/ProjectSetupScreen.js +2 -1
- package/ui/lib/constants.d.ts +1 -0
- package/ui/lib/constants.js +1 -0
- package/mcp-server/utils/__tests__/project.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/project.test.js +0 -140
- package/mcp-server/utils/project.d.ts +0 -5
- package/mcp-server/utils/project.js +0 -18
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { HsListTool } from '../HsListTool.js';
|
|
3
|
-
import { runCommandInDir } from '../../../utils/
|
|
3
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
4
4
|
import { addFlag } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/project');
|
|
9
8
|
vi.mock('../../../utils/command');
|
|
10
9
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
10
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -5,9 +5,26 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
5
5
|
absoluteProjectPath: z.ZodString;
|
|
6
6
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
7
7
|
addApp: z.ZodBoolean;
|
|
8
|
-
distribution: z.ZodOptional<z.
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
distribution: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
marketplace: "marketplace";
|
|
10
|
+
private: "private";
|
|
11
|
+
}>>;
|
|
12
|
+
auth: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
oauth: "oauth";
|
|
14
|
+
static: "static";
|
|
15
|
+
}>>;
|
|
16
|
+
features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
17
|
+
card: "card";
|
|
18
|
+
settings: "settings";
|
|
19
|
+
"app-event": "app-event";
|
|
20
|
+
"workflow-action-tool": "workflow-action-tool";
|
|
21
|
+
page: "page";
|
|
22
|
+
webhooks: "webhooks";
|
|
23
|
+
"workflow-action": "workflow-action";
|
|
24
|
+
"app-function": "app-function";
|
|
25
|
+
"app-object": "app-object";
|
|
26
|
+
scim: "scim";
|
|
27
|
+
}>>>;
|
|
11
28
|
}, z.core.$strip>;
|
|
12
29
|
export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
13
30
|
export declare class AddFeatureToProjectTool extends Tool<AddFeatureInputSchema> {
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
8
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
9
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -15,17 +15,13 @@ const inputSchema = {
|
|
|
15
15
|
.boolean()
|
|
16
16
|
.describe('Should an app be added? If there is no app in the project, an app must be added to add a feature'),
|
|
17
17
|
distribution: z
|
|
18
|
-
.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]))
|
|
22
|
-
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Private is used if you do not wish to distribute your app on the HubSpot marketplace. '),
|
|
18
|
+
.enum([APP_DISTRIBUTION_TYPES.MARKETPLACE, APP_DISTRIBUTION_TYPES.PRIVATE])
|
|
19
|
+
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Private is used if you do not wish to distribute your app on the HubSpot marketplace. ')
|
|
20
|
+
.optional(),
|
|
23
21
|
auth: z
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
]))
|
|
28
|
-
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Static uses a static non changing authentication token, and is only available for private distribution. '),
|
|
22
|
+
.enum([APP_AUTH_TYPES.STATIC, APP_AUTH_TYPES.OAUTH])
|
|
23
|
+
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Static uses a static non changing authentication token, and is only available for private distribution. ')
|
|
24
|
+
.optional(),
|
|
29
25
|
features,
|
|
30
26
|
};
|
|
31
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -5,10 +5,30 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
5
5
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
6
6
|
name: z.ZodOptional<z.ZodString>;
|
|
7
7
|
destination: z.ZodString;
|
|
8
|
-
projectBase: z.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
projectBase: z.ZodEnum<{
|
|
9
|
+
app: "app";
|
|
10
|
+
empty: "empty";
|
|
11
|
+
}>;
|
|
12
|
+
distribution: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
marketplace: "marketplace";
|
|
14
|
+
private: "private";
|
|
15
|
+
}>>;
|
|
16
|
+
auth: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
oauth: "oauth";
|
|
18
|
+
static: "static";
|
|
19
|
+
}>>;
|
|
20
|
+
features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
21
|
+
card: "card";
|
|
22
|
+
settings: "settings";
|
|
23
|
+
"app-event": "app-event";
|
|
24
|
+
"workflow-action-tool": "workflow-action-tool";
|
|
25
|
+
page: "page";
|
|
26
|
+
webhooks: "webhooks";
|
|
27
|
+
"workflow-action": "workflow-action";
|
|
28
|
+
"app-function": "app-function";
|
|
29
|
+
"app-object": "app-object";
|
|
30
|
+
scim: "scim";
|
|
31
|
+
}>>>;
|
|
12
32
|
}, z.core.$strip>;
|
|
13
33
|
export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
14
34
|
export declare class CreateProjectTool extends Tool<CreateProjectInputSchema> {
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, EMPTY_PROJECT, PROJECT_WITH_APP, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, features } from './constants.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
8
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
9
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -18,19 +18,14 @@ const inputSchema = {
|
|
|
18
18
|
.string()
|
|
19
19
|
.describe('DO NOT use the current directory unless the user has explicitly stated to do so. Relative path to the directory the project will be created in.'),
|
|
20
20
|
projectBase: z
|
|
21
|
-
.
|
|
21
|
+
.enum([EMPTY_PROJECT, PROJECT_WITH_APP])
|
|
22
22
|
.describe('Empty will create an empty project, and app will create a project with an app inside of it.'),
|
|
23
23
|
distribution: z
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
]))
|
|
28
|
-
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Private is used if you do not wish to distribute your app on the HubSpot marketplace. '),
|
|
24
|
+
.enum([APP_DISTRIBUTION_TYPES.MARKETPLACE, APP_DISTRIBUTION_TYPES.PRIVATE])
|
|
25
|
+
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Private is used if you do not wish to distribute your app on the HubSpot marketplace. ')
|
|
26
|
+
.optional(),
|
|
29
27
|
auth: z
|
|
30
|
-
.
|
|
31
|
-
z.literal(APP_AUTH_TYPES.STATIC),
|
|
32
|
-
z.literal(APP_AUTH_TYPES.OAUTH),
|
|
33
|
-
]))
|
|
28
|
+
.enum([APP_AUTH_TYPES.STATIC, APP_AUTH_TYPES.OAUTH])
|
|
34
29
|
.describe('If not specified by the user, DO NOT choose for them. This cannot be changed after a project is uploaded. Static uses a static non changing authentication token, and is only available for private distribution. ')
|
|
35
30
|
.optional(),
|
|
36
31
|
features,
|
|
@@ -3,7 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
4
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
5
5
|
import { addFlag } from '../../utils/command.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { ACCOUNT_LEVELS, ACCOUNT_LEVEL_CHOICES, } from '../../../lib/constants.js';
|
|
8
8
|
import { Tool } from '../../types.js';
|
|
9
9
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
@@ -2,7 +2,7 @@ import { Tool } from '../../types.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
5
|
-
import { runCommandInDir } from '../../utils/
|
|
5
|
+
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
7
7
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -12,18 +12,15 @@ const inputSchema = {
|
|
|
12
12
|
absoluteCurrentWorkingDirectory,
|
|
13
13
|
appId: z
|
|
14
14
|
.string()
|
|
15
|
-
.
|
|
16
|
-
.describe('The numeric app ID as a string (e.g., "3003909"). Use get-apps-info to find available app IDs.'),
|
|
15
|
+
.describe('The numeric app ID as a string (e.g., "3003909"). Must contain only digits. Use get-apps-info to find available app IDs.'),
|
|
17
16
|
startDate: z
|
|
18
17
|
.string()
|
|
19
|
-
.
|
|
20
|
-
.optional()
|
|
21
|
-
.describe('Start date for the usage patterns query in ISO 8601 format (e.g., 2025-01-01).'),
|
|
18
|
+
.describe('Start date for the usage patterns query in YYYY-MM-DD format (e.g., 2025-01-01).')
|
|
19
|
+
.optional(),
|
|
22
20
|
endDate: z
|
|
23
21
|
.string()
|
|
24
|
-
.
|
|
25
|
-
.optional()
|
|
26
|
-
.describe('End date for the usage patterns query in ISO 8601 format (e.g., 2025-12-31).'),
|
|
22
|
+
.describe('End date for the usage patterns query in YYYY-MM-DD format (e.g., 2025-12-31).')
|
|
23
|
+
.optional(),
|
|
27
24
|
};
|
|
28
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
26
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
@@ -5,12 +5,12 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
5
5
|
absoluteProjectPath: z.ZodString;
|
|
6
6
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
7
7
|
buildId: z.ZodNumber;
|
|
8
|
-
logLevel: z.
|
|
8
|
+
logLevel: z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
ERROR: "ERROR";
|
|
10
10
|
WARN: "WARN";
|
|
11
11
|
INFO: "INFO";
|
|
12
12
|
ALL: "ALL";
|
|
13
|
-
}
|
|
13
|
+
}>>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
export type GetBuildLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
16
16
|
export declare class GetBuildLogsTool extends Tool<GetBuildLogsInputSchema> {
|
|
@@ -18,9 +18,8 @@ const inputSchema = {
|
|
|
18
18
|
.describe('Build ID to fetch logs for. Use get-build-status to find recent build IDs.'),
|
|
19
19
|
logLevel: z
|
|
20
20
|
.enum(['ERROR', 'WARN', 'INFO', 'ALL'])
|
|
21
|
-
.
|
|
22
|
-
.
|
|
23
|
-
.describe('Filter logs by level. ERROR: Show only errors, WARN: Show only warnings, INFO: Show only info, ALL: Show all logs.'),
|
|
21
|
+
.describe('Filter logs by level. ERROR: Show only errors, WARN: Show only warnings, INFO: Show only info, ALL: Show all logs. Defaults to ALL if not specified.')
|
|
22
|
+
.optional(),
|
|
24
23
|
};
|
|
25
24
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
25
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
@@ -85,14 +84,14 @@ export class GetBuildLogsTool extends Tool {
|
|
|
85
84
|
if (allLogs.length === 0) {
|
|
86
85
|
return formatTextContents(absoluteCurrentWorkingDirectory, `No logs found for build #${buildId} in project '${projectName}'.`);
|
|
87
86
|
}
|
|
88
|
-
const
|
|
87
|
+
const resolvedLogLevel = logLevel || 'ALL';
|
|
88
|
+
const filteredLogs = filterLogsByLevel(allLogs, resolvedLogLevel);
|
|
89
89
|
let output;
|
|
90
90
|
if (filteredLogs.length === 0) {
|
|
91
|
-
|
|
92
|
-
output = `No ${logLevel} level logs found for build #${buildId} in '${projectName}'.\nShowing all logs instead:\n\n${formatLogs(allLogs)}`;
|
|
91
|
+
output = `No ${resolvedLogLevel} level logs found for build #${buildId} in '${projectName}'.\nShowing all logs instead:\n\n${formatLogs(allLogs)}`;
|
|
93
92
|
}
|
|
94
93
|
else {
|
|
95
|
-
output = `Logs for build #${buildId} in '${projectName}' (${
|
|
94
|
+
output = `Logs for build #${buildId} in '${projectName}' (${resolvedLogLevel} level):\n\n${formatLogs(filteredLogs)}`;
|
|
96
95
|
}
|
|
97
96
|
return formatTextContents(absoluteCurrentWorkingDirectory, output);
|
|
98
97
|
}
|
|
@@ -5,7 +5,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
5
5
|
absoluteProjectPath: z.ZodString;
|
|
6
6
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
7
7
|
buildId: z.ZodOptional<z.ZodNumber>;
|
|
8
|
-
limit: z.
|
|
8
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
10
|
export type GetBuildStatusInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
11
11
|
export declare class GetBuildStatusTool extends Tool<GetBuildStatusInputSchema> {
|
|
@@ -19,9 +19,8 @@ const inputSchema = {
|
|
|
19
19
|
.describe('Optional: Specific build ID to inspect. If omitted, shows recent builds to help identify the latest build.'),
|
|
20
20
|
limit: z
|
|
21
21
|
.number()
|
|
22
|
-
.
|
|
23
|
-
.
|
|
24
|
-
.describe('Number of recent builds to fetch when buildId is not specified.'),
|
|
22
|
+
.describe('Number of recent builds to fetch when buildId is not specified. Defaults to 3 if not specified.')
|
|
23
|
+
.optional(),
|
|
25
24
|
};
|
|
26
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
26
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
@@ -127,7 +126,7 @@ export class GetBuildStatusTool extends Tool {
|
|
|
127
126
|
}
|
|
128
127
|
else {
|
|
129
128
|
const response = await fetchProjectBuilds(accountId, projectName, {
|
|
130
|
-
limit,
|
|
129
|
+
limit: limit || 3,
|
|
131
130
|
});
|
|
132
131
|
const { results } = response.data;
|
|
133
132
|
if (!results || results.length === 0) {
|
|
@@ -3,7 +3,12 @@ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
5
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
6
|
-
command: z.ZodOptional<z.
|
|
6
|
+
command: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
"hs auth": "hs auth";
|
|
8
|
+
"hs project create": "hs project create";
|
|
9
|
+
"hs project upload": "hs project upload";
|
|
10
|
+
"hs init": "hs init";
|
|
11
|
+
}>>;
|
|
7
12
|
}, z.core.$strip>;
|
|
8
13
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
9
14
|
export declare class GuidedWalkthroughTool extends Tool<InputSchemaType> {
|
|
@@ -14,12 +14,7 @@ const nextCommands = {
|
|
|
14
14
|
const inputSchema = {
|
|
15
15
|
absoluteCurrentWorkingDirectory,
|
|
16
16
|
command: z
|
|
17
|
-
.
|
|
18
|
-
z.literal('hs init'),
|
|
19
|
-
z.literal('hs auth'),
|
|
20
|
-
z.literal('hs project create'),
|
|
21
|
-
z.literal('hs project upload'),
|
|
22
|
-
])
|
|
17
|
+
.enum(['hs init', 'hs auth', 'hs project create', 'hs project upload'])
|
|
23
18
|
.describe('The command to learn more about. Start with `hs init`')
|
|
24
19
|
.optional(),
|
|
25
20
|
};
|
|
@@ -3,7 +3,7 @@ import z from 'zod';
|
|
|
3
3
|
import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
|
|
4
4
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
5
5
|
import { Tool } from '../../types.js';
|
|
6
|
-
import { runCommandInDir } from '../../utils/
|
|
6
|
+
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
8
8
|
import { formatTextContent, formatTextContents } from '../../utils/content.js';
|
|
9
9
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '../../types.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
4
|
-
import { runCommandInDir } from '../../utils/
|
|
4
|
+
import { runCommandInDir } from '../../utils/command.js';
|
|
5
5
|
import { formatTextContents } from '../../utils/content.js';
|
|
6
6
|
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { AddFeatureToProjectTool, } from '../AddFeatureToProjectTool.js';
|
|
2
|
-
import { runCommandInDir } from '../../../utils/
|
|
2
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
3
3
|
import { addFlag } from '../../../utils/command.js';
|
|
4
4
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../../lib/constants.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/project');
|
|
9
8
|
vi.mock('../../../utils/command');
|
|
10
9
|
vi.mock('../../../../lib/constants');
|
|
11
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { CreateProjectTool, } from '../CreateProjectTool.js';
|
|
2
|
-
import { runCommandInDir } from '../../../utils/
|
|
2
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
3
3
|
import { addFlag } from '../../../utils/command.js';
|
|
4
4
|
import { APP_DISTRIBUTION_TYPES, EMPTY_PROJECT, PROJECT_WITH_APP, } from '../../../../lib/constants.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
-
vi.mock('../../../utils/project');
|
|
9
8
|
vi.mock('../../../utils/command');
|
|
10
9
|
vi.mock('../../../../lib/constants');
|
|
11
10
|
vi.mock('../../../../lib/projects/create/v2');
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { CreateTestAccountTool, } from '../CreateTestAccountTool.js';
|
|
2
|
-
import { runCommandInDir } from '../../../utils/
|
|
2
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
3
3
|
import { addFlag } from '../../../utils/command.js';
|
|
4
4
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
5
5
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import * as config from '@hubspot/local-dev-lib/config';
|
|
8
8
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
9
|
-
vi.mock('../../../utils/project');
|
|
10
9
|
vi.mock('../../../utils/command');
|
|
11
10
|
vi.mock('../../../utils/toolUsageTracking');
|
|
12
11
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { DeployProjectTool } from '../DeployProjectTool.js';
|
|
2
|
-
import { runCommandInDir } from '../../../utils/
|
|
2
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
3
3
|
import { addFlag } from '../../../utils/command.js';
|
|
4
4
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
5
5
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
6
6
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
7
|
-
vi.mock('../../../utils/project');
|
|
8
7
|
vi.mock('../../../utils/command');
|
|
9
8
|
vi.mock('../../../utils/toolUsageTracking');
|
|
10
9
|
vi.mock('../../../utils/feedbackTracking');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GetApiUsagePatternsByAppIdTool } from '../GetApiUsagePatternsByAppIdTool.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
2
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
4
3
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
5
4
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
@@ -52,37 +51,6 @@ describe('mcp-server/tools/project/GetApiUsagePatternsByAppIdTool', () => {
|
|
|
52
51
|
expect(result).toBe(mockRegisteredTool);
|
|
53
52
|
});
|
|
54
53
|
});
|
|
55
|
-
describe('input validation', () => {
|
|
56
|
-
const inputSchema = z.object({
|
|
57
|
-
appId: z
|
|
58
|
-
.string()
|
|
59
|
-
.describe('The application ID to get API usage patterns for.'),
|
|
60
|
-
startDate: z
|
|
61
|
-
.string()
|
|
62
|
-
.regex(/^\d{4}-\d{2}-\d{2}$/, 'Start date must be in YYYY-MM-DD format')
|
|
63
|
-
.optional()
|
|
64
|
-
.describe('Start date for the usage patterns query in ISO 8601 format (e.g., 2025-01-01).'),
|
|
65
|
-
endDate: z
|
|
66
|
-
.string()
|
|
67
|
-
.regex(/^\d{4}-\d{2}-\d{2}$/, 'End date must be in YYYY-MM-DD format')
|
|
68
|
-
.optional()
|
|
69
|
-
.describe('End date for the usage patterns query in ISO 8601 format (e.g., 2025-12-31).'),
|
|
70
|
-
});
|
|
71
|
-
it('should validate date format correctly', () => {
|
|
72
|
-
const validInput = {
|
|
73
|
-
appId: '12345',
|
|
74
|
-
startDate: '2025-01-01',
|
|
75
|
-
endDate: '2025-12-31',
|
|
76
|
-
};
|
|
77
|
-
const invalidInput = {
|
|
78
|
-
appId: '12345',
|
|
79
|
-
startDate: '2025-1-1',
|
|
80
|
-
endDate: '2025-12-31T00:00:00Z',
|
|
81
|
-
};
|
|
82
|
-
expect(() => inputSchema.parse(validInput)).not.toThrow();
|
|
83
|
-
expect(() => inputSchema.parse(invalidInput)).toThrow();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
54
|
describe('handler', () => {
|
|
87
55
|
const input = {
|
|
88
56
|
absoluteCurrentWorkingDirectory: '/test/dir',
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { UploadProjectTools } from '../UploadProjectTools.js';
|
|
2
2
|
import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
|
|
3
3
|
import { getProjectConfig } from '../../../../lib/projects/config.js';
|
|
4
|
-
import { runCommandInDir } from '../../../utils/
|
|
4
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
8
|
vi.mock('@hubspot/project-parsing-lib/profiles');
|
|
9
9
|
vi.mock('../../../../lib/projects/config.js');
|
|
10
|
-
vi.mock('../../../utils/
|
|
10
|
+
vi.mock('../../../utils/command', () => ({
|
|
11
|
+
runCommandInDir: vi.fn(),
|
|
12
|
+
addFlag: vi.fn((command, flagName, value) => {
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
return `${command} --${flagName} ${value.map(item => `"${item}"`).join(' ')}`;
|
|
15
|
+
}
|
|
16
|
+
return `${command} --${flagName} "${value}"`;
|
|
17
|
+
}),
|
|
18
|
+
}));
|
|
11
19
|
vi.mock('../../../utils/toolUsageTracking');
|
|
12
20
|
vi.mock('../../../utils/feedbackTracking');
|
|
13
21
|
const mockTrackToolUsage = trackToolUsage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ValidateProjectTool, } from '../ValidateProjectTool.js';
|
|
2
|
-
import { runCommandInDir } from '../../../utils/
|
|
2
|
+
import { runCommandInDir } from '../../../utils/command.js';
|
|
3
3
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
4
4
|
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
5
5
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
6
|
-
vi.mock('../../../utils/
|
|
6
|
+
vi.mock('../../../utils/command');
|
|
7
7
|
vi.mock('../../../utils/toolUsageTracking');
|
|
8
8
|
vi.mock('../../../utils/feedbackTracking');
|
|
9
9
|
const mockTrackToolUsage = trackToolUsage;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
export declare const absoluteProjectPath: z.ZodString;
|
|
3
3
|
export declare const absoluteCurrentWorkingDirectory: z.ZodString;
|
|
4
|
-
export declare const features: z.ZodOptional<z.ZodArray<z.
|
|
4
|
+
export declare const features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
5
|
+
card: "card";
|
|
6
|
+
settings: "settings";
|
|
7
|
+
"app-event": "app-event";
|
|
8
|
+
"workflow-action-tool": "workflow-action-tool";
|
|
9
|
+
page: "page";
|
|
10
|
+
webhooks: "webhooks";
|
|
11
|
+
"workflow-action": "workflow-action";
|
|
12
|
+
"app-function": "app-function";
|
|
13
|
+
"app-object": "app-object";
|
|
14
|
+
scim: "scim";
|
|
15
|
+
}>>>;
|
|
5
16
|
export declare const docsSearchQuery: z.ZodString;
|
|
6
17
|
export declare const docUrl: z.ZodString;
|
|
@@ -6,23 +6,19 @@ export const absoluteCurrentWorkingDirectory = z
|
|
|
6
6
|
.string()
|
|
7
7
|
.describe('The absolute path to the current working directory.');
|
|
8
8
|
export const features = z
|
|
9
|
-
.array(z.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
z.literal('app-object'),
|
|
21
|
-
z.literal('app-event'),
|
|
22
|
-
z.literal('scim'),
|
|
23
|
-
z.literal('page'),
|
|
9
|
+
.array(z.enum([
|
|
10
|
+
'card',
|
|
11
|
+
'settings',
|
|
12
|
+
'app-function',
|
|
13
|
+
'webhooks',
|
|
14
|
+
'workflow-action',
|
|
15
|
+
'workflow-action-tool',
|
|
16
|
+
'app-object',
|
|
17
|
+
'app-event',
|
|
18
|
+
'scim',
|
|
19
|
+
'page',
|
|
24
20
|
]))
|
|
25
|
-
.describe('The features to include in the project, multiple options can be selected')
|
|
21
|
+
.describe('The features to include in the project, multiple options can be selected. "app-function" is also known as a public serverless function. "workflow-action" is also known as a custom workflow action. "workflow-action-tool" is also known as agent tools.')
|
|
26
22
|
.optional();
|
|
27
23
|
export const docsSearchQuery = z
|
|
28
24
|
.string()
|