@hubspot/cli 7.11.8-experimental.0 → 8.0.0-beta.1
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/__tests__/migrate.test.js +19 -1
- package/api/migrate.d.ts +1 -1
- package/api/migrate.js +2 -1
- package/bin/cli.js +12 -27
- package/commands/__tests__/customObject.test.js +0 -2
- package/commands/__tests__/doctor.test.js +0 -2
- package/commands/__tests__/getStarted.test.js +0 -4
- package/commands/__tests__/project.test.js +0 -4
- package/commands/__tests__/upgrade.test.js +309 -0
- package/commands/account/__tests__/auth.test.js +180 -0
- package/commands/account/__tests__/list.test.js +128 -3
- package/commands/account/__tests__/rename.test.js +0 -2
- package/commands/account/__tests__/use.test.js +138 -0
- package/commands/account/auth.js +1 -1
- package/commands/account/clean.js +4 -3
- package/commands/account/createOverride.js +3 -2
- package/commands/account/info.js +2 -2
- package/commands/account/list.js +4 -4
- package/commands/account/remove.js +3 -2
- package/commands/account/removeOverride.js +3 -2
- package/commands/account/use.js +4 -3
- package/commands/app/__tests__/migrate.test.js +8 -25
- package/commands/app/migrate.js +10 -16
- package/commands/app/secret/__tests__/add.test.js +112 -0
- package/commands/app/secret/add.js +13 -13
- package/commands/auth.js +8 -2
- package/commands/cms/__tests__/fetch.test.js +114 -15
- package/commands/cms/__tests__/upload.test.js +308 -0
- package/commands/cms/__tests__/watch.test.js +212 -0
- package/commands/cms/app/create.js +2 -3
- package/commands/cms/convertFields.js +1 -1
- package/commands/cms/fetch.js +3 -2
- package/commands/cms/function/deploy.js +2 -2
- package/commands/cms/function/list.js +2 -3
- package/commands/cms/lighthouseScore.js +19 -27
- package/commands/cms/module/marketplace-validate.js +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +2 -8
- package/commands/cms/theme/create.js +1 -1
- package/commands/cms/theme/marketplace-validate.js +0 -1
- package/commands/cms/theme/preview.d.ts +0 -1
- package/commands/cms/theme/preview.js +12 -52
- package/commands/cms/upload.js +3 -3
- package/commands/cms/watch.js +3 -3
- package/commands/customObject.js +0 -2
- package/commands/doctor.js +10 -2
- package/commands/filemanager/__tests__/upload.test.js +161 -0
- package/commands/getStarted.js +13 -3
- package/commands/hubdb/__tests__/list.test.js +0 -9
- package/commands/hubdb/list.js +6 -8
- package/commands/init.js +8 -2
- package/commands/mcp/__tests__/start.test.js +113 -3
- package/commands/mcp/setup.js +0 -7
- package/commands/mcp/start.d.ts +1 -1
- package/commands/mcp/start.js +0 -7
- package/commands/project/__tests__/add.test.js +0 -2
- package/commands/project/__tests__/create.test.js +2 -2
- package/commands/project/__tests__/deploy.test.js +0 -4
- package/commands/project/__tests__/dev.test.js +273 -0
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -5
- package/commands/project/__tests__/installDeps.test.js +0 -2
- package/commands/project/__tests__/lint.test.js +0 -5
- package/commands/project/__tests__/logs.test.js +24 -31
- package/commands/project/__tests__/migrate.test.js +7 -12
- package/commands/project/__tests__/updateDeps.test.js +0 -2
- package/commands/project/__tests__/upload.test.js +191 -0
- package/commands/project/__tests__/validate.test.js +314 -31
- package/commands/project/cloneApp.d.ts +1 -7
- package/commands/project/cloneApp.js +1 -149
- package/commands/project/create.js +3 -4
- package/commands/project/deploy.js +18 -7
- package/commands/project/dev/deprecatedFlow.js +0 -2
- package/commands/project/dev/index.js +23 -11
- package/commands/project/dev/unifiedFlow.d.ts +1 -1
- package/commands/project/dev/unifiedFlow.js +1 -4
- package/commands/project/list.js +4 -4
- package/commands/project/listBuilds.js +2 -7
- package/commands/project/logs.js +19 -12
- package/commands/project/migrate.js +3 -3
- package/commands/project/profile/add.js +1 -1
- package/commands/project/profile/delete.js +1 -1
- package/commands/project/upload.d.ts +1 -1
- package/commands/project/upload.js +13 -4
- package/commands/project/validate.js +85 -13
- package/commands/project/watch.js +7 -7
- package/commands/project.js +0 -4
- package/commands/sandbox/__tests__/create.test.js +0 -2
- package/commands/secret/__tests__/addSecret.test.js +140 -7
- package/commands/secret/addSecret.js +3 -1
- package/commands/testAccount/__tests__/create.test.js +6 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -1
- package/commands/testAccount/create.d.ts +1 -0
- package/commands/testAccount/create.js +13 -5
- package/commands/upgrade.d.ts +8 -0
- package/commands/upgrade.js +119 -0
- package/lang/en.d.ts +88 -10
- package/lang/en.js +105 -26
- package/lib/__tests__/buildAccount.test.js +0 -13
- package/lib/__tests__/cliUpgradeUtils.test.js +131 -0
- package/lib/__tests__/commonOpts.test.js +0 -1
- package/lib/__tests__/dependencyManagement.test.js +633 -13
- package/lib/__tests__/developerTestAccounts.test.js +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -6
- package/lib/__tests__/importData.test.js +0 -1
- package/lib/__tests__/npmCli.test.js +84 -0
- package/lib/__tests__/oauth.test.js +1 -11
- package/lib/__tests__/process.test.js +0 -1
- package/lib/__tests__/sandboxSync.test.js +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -1
- package/lib/__tests__/usageTracking.test.js +39 -6
- package/lib/__tests__/validation.test.js +0 -1
- package/lib/app/__tests__/migrate.test.js +137 -12
- package/lib/app/migrate.d.ts +5 -2
- package/lib/app/migrate.js +30 -11
- package/lib/app/urls.d.ts +1 -1
- package/lib/buildAccount.d.ts +1 -1
- package/lib/cliUpgradeUtils.d.ts +22 -0
- package/lib/cliUpgradeUtils.js +62 -0
- package/lib/cmsAssets/api-sample.js +2 -5
- package/lib/cmsAssets/function.js +1 -9
- package/lib/cmsAssets/module.js +1 -9
- package/lib/cmsAssets/template.js +1 -9
- package/lib/configOptions.d.ts +0 -1
- package/lib/configOptions.js +1 -5
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +10 -4
- package/lib/dependencyManagement.d.ts +9 -0
- package/lib/dependencyManagement.js +127 -26
- package/lib/developerTestAccounts.d.ts +1 -1
- package/lib/doctor/Diagnosis.d.ts +1 -0
- package/lib/doctor/Diagnosis.js +7 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +8 -4
- package/lib/doctor/Doctor.d.ts +12 -0
- package/lib/doctor/Doctor.js +283 -33
- package/lib/doctor/__tests__/Diagnosis.test.js +1 -0
- package/lib/doctor/__tests__/Doctor.test.js +201 -51
- package/lib/errorHandlers/__tests__/index.test.d.ts +1 -0
- package/lib/errorHandlers/__tests__/index.test.js +278 -0
- package/lib/errorHandlers/index.d.ts +1 -0
- package/lib/errorHandlers/index.js +14 -2
- package/lib/http.js +3 -1
- package/lib/links.js +2 -3
- package/lib/mcp/__tests__/setup.test.js +69 -2
- package/lib/mcp/setup.d.ts +1 -0
- package/lib/mcp/setup.js +37 -4
- package/lib/middleware/__tests__/configMiddleware.test.js +1 -43
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +44 -0
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -5
- package/lib/middleware/autoUpdateMiddleware.js +58 -57
- package/lib/middleware/configMiddleware.d.ts +0 -3
- package/lib/middleware/configMiddleware.js +0 -11
- package/lib/middleware/fireAlarmMiddleware.js +1 -1
- package/lib/middleware/spinniesMiddleware.d.ts +1 -0
- package/lib/middleware/spinniesMiddleware.js +4 -0
- package/lib/middleware/usageTrackingMiddleware.d.ts +13 -0
- package/lib/middleware/usageTrackingMiddleware.js +16 -0
- package/lib/{npm.d.ts → npm/npmCli.d.ts} +8 -3
- package/lib/npm/npmCli.js +59 -0
- package/lib/npm/packageJson.d.ts +24 -0
- package/lib/npm/packageJson.js +102 -0
- package/lib/npm/workspaces.d.ts +12 -0
- package/lib/npm/workspaces.js +48 -0
- package/lib/oauth.js +1 -3
- package/lib/projects/__tests__/AppDevModeInterface.test.js +40 -18
- package/lib/projects/__tests__/DevServerManager.test.js +1 -0
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +1 -0
- package/lib/projects/__tests__/DevSessionManager.test.js +250 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +19 -6
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -2
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -1
- package/lib/projects/__tests__/components.test.js +6 -22
- package/lib/projects/__tests__/deploy.test.js +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +3 -5
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +1 -0
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +328 -0
- package/lib/projects/__tests__/projectProfiles.test.d.ts +1 -0
- package/lib/projects/__tests__/projectProfiles.test.js +441 -0
- package/lib/projects/__tests__/projects.test.js +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +2 -11
- package/lib/projects/__tests__/upload.test.js +104 -3
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -2
- package/lib/projects/add/__tests__/v2AddComponent.test.js +2 -4
- package/lib/projects/add/v2AddComponent.js +2 -3
- package/lib/projects/components.d.ts +1 -1
- package/lib/projects/components.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -1
- package/lib/projects/create/v2.d.ts +1 -1
- package/lib/projects/create/v2.js +1 -1
- package/lib/projects/ensureProjectExists.js +0 -1
- package/lib/projects/localDev/AppDevModeInterface.js +9 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +18 -0
- package/lib/projects/localDev/DevSessionManager.js +95 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +18 -7
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +4 -3
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +23 -12
- package/lib/projects/localDev/LocalDevProcess.d.ts +2 -1
- package/lib/projects/localDev/LocalDevProcess.js +18 -7
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/devSessionsApi.d.ts +9 -0
- package/lib/projects/localDev/helpers/devSessionsApi.js +19 -0
- package/lib/projects/localDev/helpers/project.d.ts +1 -1
- package/lib/projects/localDev/helpers/project.js +1 -2
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -5
- package/lib/projects/projectProfiles.d.ts +17 -0
- package/lib/projects/projectProfiles.js +140 -0
- package/lib/projects/structure.d.ts +1 -1
- package/lib/projects/uieLinting.js +6 -8
- package/lib/projects/upload.d.ts +9 -1
- package/lib/projects/upload.js +11 -5
- package/lib/projects/urls.d.ts +1 -0
- package/lib/projects/urls.js +3 -3
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +8 -4
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +2 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +19 -13
- package/lib/sandboxSync.d.ts +1 -1
- package/lib/sandboxes.d.ts +1 -1
- package/lib/serverlessLogs.js +0 -1
- package/lib/theme/__tests__/migrate.test.js +12 -4
- package/lib/theme/migrate.js +2 -3
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -1
- package/lib/usageTracking.js +18 -0
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +2 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.js +2 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +2 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +2 -2
- package/mcp-server/tools/cms/HsListTool.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +4 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +4 -3
- package/mcp-server/tools/project/CreateProjectTool.js +4 -3
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +7 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +19 -9
- package/mcp-server/tools/project/DocFetchTool.js +2 -1
- package/mcp-server/tools/project/DocsSearchTool.js +2 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +4 -4
- package/mcp-server/tools/project/GetApplicationInfoTool.js +5 -5
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -1
- package/mcp-server/tools/project/UploadProjectTools.js +6 -3
- package/mcp-server/tools/project/ValidateProjectTool.js +2 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +23 -4
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +4 -2
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +8 -5
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +7 -3
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +17 -3
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +3 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -3
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -3
- package/mcp-server/utils/__tests__/project.test.js +65 -4
- package/mcp-server/utils/project.js +6 -2
- package/package.json +15 -17
- package/types/Cms.d.ts +1 -1
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +3 -2
- package/types/PackageJson.d.ts +10 -0
- package/types/PackageJson.js +1 -0
- package/types/ProjectComponents.d.ts +1 -1
- package/ui/components/BoxWithTitle.js +1 -1
- package/ui/components/Table.d.ts +89 -0
- package/ui/components/Table.js +246 -0
- package/ui/lib/table.d.ts +2 -0
- package/ui/lib/table.js +11 -0
- package/ui/playground/Playground.d.ts +5 -0
- package/ui/{views/UiSandbox.js → playground/Playground.js} +4 -4
- package/ui/{lib/ui-testing-utils.d.ts → playground/fixtures.d.ts} +1 -1
- package/ui/{lib/ui-testing-utils.js → playground/fixtures.js} +33 -1
- package/ui/render.d.ts +19 -0
- package/ui/render.js +44 -0
- package/commands/__tests__/create.test.js +0 -53
- package/commands/create.d.ts +0 -4
- package/commands/create.js +0 -137
- package/commands/customObject/__tests__/schema.test.js +0 -53
- package/commands/customObject/schema/create.d.ts +0 -4
- package/commands/customObject/schema/create.js +0 -34
- package/commands/customObject/schema/delete.d.ts +0 -4
- package/commands/customObject/schema/delete.js +0 -37
- package/commands/customObject/schema/fetch-all.d.ts +0 -4
- package/commands/customObject/schema/fetch-all.js +0 -32
- package/commands/customObject/schema/fetch.d.ts +0 -4
- package/commands/customObject/schema/fetch.js +0 -36
- package/commands/customObject/schema/list.d.ts +0 -4
- package/commands/customObject/schema/list.js +0 -26
- package/commands/customObject/schema/update.d.ts +0 -4
- package/commands/customObject/schema/update.js +0 -39
- package/commands/customObject/schema.d.ts +0 -3
- package/commands/customObject/schema.js +0 -31
- package/commands/fetch.d.ts +0 -4
- package/commands/fetch.js +0 -52
- package/commands/function/deploy.d.ts +0 -4
- package/commands/function/deploy.js +0 -31
- package/commands/function/list.d.ts +0 -4
- package/commands/function/list.js +0 -33
- package/commands/function/server.d.ts +0 -4
- package/commands/function/server.js +0 -57
- package/commands/function.d.ts +0 -3
- package/commands/function.js +0 -32
- package/commands/lint.d.ts +0 -4
- package/commands/lint.js +0 -31
- package/commands/list.d.ts +0 -4
- package/commands/list.js +0 -31
- package/commands/logs.d.ts +0 -4
- package/commands/logs.js +0 -58
- package/commands/module/marketplace-validate.d.ts +0 -4
- package/commands/module/marketplace-validate.js +0 -31
- package/commands/module.d.ts +0 -3
- package/commands/module.js +0 -23
- package/commands/mv.d.ts +0 -4
- package/commands/mv.js +0 -35
- package/commands/project/__tests__/migrateApp.test.js +0 -78
- package/commands/project/migrateApp.d.ts +0 -4
- package/commands/project/migrateApp.js +0 -55
- package/commands/remove.d.ts +0 -4
- package/commands/remove.js +0 -31
- package/commands/theme/generate-selectors.d.ts +0 -4
- package/commands/theme/generate-selectors.js +0 -30
- package/commands/theme/marketplace-validate.d.ts +0 -4
- package/commands/theme/marketplace-validate.js +0 -33
- package/commands/theme/preview.d.ts +0 -4
- package/commands/theme/preview.js +0 -59
- package/commands/theme.d.ts +0 -3
- package/commands/theme.js +0 -29
- package/commands/upload.d.ts +0 -4
- package/commands/upload.js +0 -62
- package/commands/watch.d.ts +0 -4
- package/commands/watch.js +0 -73
- package/lib/__tests__/npm.test.js +0 -57
- package/lib/__tests__/projectProfiles.test.js +0 -129
- package/lib/app/__tests__/migrate_legacy.test.js +0 -143
- package/lib/app/migrate_legacy.d.ts +0 -4
- package/lib/app/migrate_legacy.js +0 -121
- package/lib/npm.js +0 -33
- package/lib/projectProfiles.d.ts +0 -7
- package/lib/projectProfiles.js +0 -73
- package/lib/ui/table.d.ts +0 -3
- package/lib/ui/table.js +0 -63
- package/ui/index.d.ts +0 -1
- package/ui/index.js +0 -6
- package/ui/views/UiSandbox.d.ts +0 -5
- /package/commands/__tests__/{create.test.d.ts → upgrade.test.d.ts} +0 -0
- /package/commands/{customObject/__tests__/schema.test.d.ts → cms/__tests__/upload.test.d.ts} +0 -0
- /package/commands/{project/__tests__/migrateApp.test.d.ts → cms/__tests__/watch.test.d.ts} +0 -0
- /package/{lib/__tests__/npm.test.d.ts → commands/project/__tests__/dev.test.d.ts} +0 -0
- /package/lib/__tests__/{projectProfiles.test.d.ts → cliUpgradeUtils.test.d.ts} +0 -0
- /package/lib/{app/__tests__/migrate_legacy.test.d.ts → __tests__/npmCli.test.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import z from 'zod';
|
|
3
|
-
import { getAllHsProfiles } from '@hubspot/project-parsing-lib';
|
|
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
6
|
import { runCommandInDir } from '../../utils/project.js';
|
|
@@ -62,12 +62,15 @@ export class UploadProjectTools extends Tool {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const { stdout, stderr } = await runCommandInDir(absoluteProjectPath, command);
|
|
65
|
-
|
|
65
|
+
const response = await formatTextContents(stdout, stderr);
|
|
66
|
+
// Add reminder about cards needing to be added to views
|
|
67
|
+
response.content.push(formatTextContent('\nIMPORTANT: If this project contains cards, remember that uploading does NOT make them live automatically. Cards must be manually added to a view in HubSpot to become visible to users.'));
|
|
68
|
+
return response;
|
|
66
69
|
}
|
|
67
70
|
register() {
|
|
68
71
|
return this.mcpServer.registerTool(toolName, {
|
|
69
72
|
title: 'Upload HubSpot Project',
|
|
70
|
-
description: 'DO NOT run this tool unless the user specifies they would like to upload the project, it is potentially destructive. Uploads the HubSpot project in current working directory. If the project does not exist, it will be created. MUST be ran from within the project directory.',
|
|
73
|
+
description: 'DO NOT run this tool unless the user specifies they would like to upload the project, it is potentially destructive. Uploads the HubSpot project in current working directory. If the project does not exist, it will be created. MUST be ran from within the project directory. IMPORTANT: Uploading a project does NOT automatically make cards live or visible to users. Cards must be manually added to a view in HubSpot after upload to become visible.',
|
|
71
74
|
inputSchema,
|
|
72
75
|
annotations: {
|
|
73
76
|
readOnlyHint: false,
|
|
@@ -5,6 +5,7 @@ import { runCommandInDir } from '../../utils/project.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';
|
|
8
|
+
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
8
9
|
const inputSchema = {
|
|
9
10
|
absoluteProjectPath,
|
|
10
11
|
absoluteCurrentWorkingDirectory,
|
|
@@ -24,7 +25,7 @@ export class ValidateProjectTool extends Tool {
|
|
|
24
25
|
return formatTextContents(stdout, stderr);
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
|
27
|
-
return formatTextContents(error
|
|
28
|
+
return formatTextContents(getErrorMessage(error));
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
register() {
|
|
@@ -3,12 +3,14 @@ import { runCommandInDir } from '../../../utils/project.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
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
6
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
7
8
|
vi.mock('../../../utils/project');
|
|
8
9
|
vi.mock('../../../utils/command');
|
|
9
10
|
vi.mock('../../../../lib/constants');
|
|
10
11
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
12
|
vi.mock('../../../utils/feedbackTracking');
|
|
13
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
12
14
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
13
15
|
const mockRunCommandInDir = runCommandInDir;
|
|
14
16
|
const mockAddFlag = addFlag;
|
|
@@ -17,7 +19,6 @@ describe('mcp-server/tools/project/AddFeatureToProject', () => {
|
|
|
17
19
|
let tool;
|
|
18
20
|
let mockRegisteredTool;
|
|
19
21
|
beforeEach(() => {
|
|
20
|
-
vi.clearAllMocks();
|
|
21
22
|
// @ts-expect-error Not mocking the whole server
|
|
22
23
|
mockMcpServer = {
|
|
23
24
|
registerTool: vi.fn(),
|
|
@@ -25,6 +26,7 @@ describe('mcp-server/tools/project/AddFeatureToProject', () => {
|
|
|
25
26
|
mockRegisteredTool = {};
|
|
26
27
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
27
28
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
29
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
28
30
|
tool = new AddFeatureToProjectTool(mockMcpServer);
|
|
29
31
|
// Mock addFlag to simulate command building
|
|
30
32
|
mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
|
|
@@ -85,7 +87,7 @@ describe('mcp-server/tools/project/AddFeatureToProject', () => {
|
|
|
85
87
|
expect(result.content).toEqual([
|
|
86
88
|
{
|
|
87
89
|
type: 'text',
|
|
88
|
-
text: expect.stringContaining('Ask the user how they would you like to distribute the
|
|
90
|
+
text: expect.stringContaining('Ask the user how they would you like to distribute the app'),
|
|
89
91
|
},
|
|
90
92
|
{
|
|
91
93
|
type: 'text',
|
|
@@ -3,6 +3,7 @@ import { runCommandInDir } from '../../../utils/project.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
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
6
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
7
8
|
vi.mock('../../../utils/project');
|
|
8
9
|
vi.mock('../../../utils/command');
|
|
@@ -10,6 +11,7 @@ vi.mock('../../../../lib/constants');
|
|
|
10
11
|
vi.mock('../../../../lib/projects/create/v2');
|
|
11
12
|
vi.mock('../../../utils/toolUsageTracking');
|
|
12
13
|
vi.mock('../../../utils/feedbackTracking');
|
|
14
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
13
15
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
14
16
|
const mockRunCommandInDir = runCommandInDir;
|
|
15
17
|
const mockAddFlag = addFlag;
|
|
@@ -18,7 +20,6 @@ describe('mcp-server/tools/project/CreateProjectTool', () => {
|
|
|
18
20
|
let tool;
|
|
19
21
|
let mockRegisteredTool;
|
|
20
22
|
beforeEach(() => {
|
|
21
|
-
vi.clearAllMocks();
|
|
22
23
|
// @ts-expect-error Not mocking the whole thing
|
|
23
24
|
mockMcpServer = {
|
|
24
25
|
registerTool: vi.fn(),
|
|
@@ -26,6 +27,7 @@ describe('mcp-server/tools/project/CreateProjectTool', () => {
|
|
|
26
27
|
mockRegisteredTool = {};
|
|
27
28
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
28
29
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
30
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
29
31
|
tool = new CreateProjectTool(mockMcpServer);
|
|
30
32
|
// Mock addFlag to simulate command building
|
|
31
33
|
mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
|
|
@@ -83,7 +85,7 @@ describe('mcp-server/tools/project/CreateProjectTool', () => {
|
|
|
83
85
|
expect(result.content).toEqual([
|
|
84
86
|
{
|
|
85
87
|
type: 'text',
|
|
86
|
-
text: expect.stringContaining('Ask the user how they would you like to distribute the
|
|
88
|
+
text: expect.stringContaining('Ask the user how they would you like to distribute the app?'),
|
|
87
89
|
},
|
|
88
90
|
{
|
|
89
91
|
type: 'text',
|
|
@@ -2,6 +2,7 @@ import { CreateTestAccountTool, } from '../CreateTestAccountTool.js';
|
|
|
2
2
|
import { runCommandInDir } from '../../../utils/project.js';
|
|
3
3
|
import { addFlag } from '../../../utils/command.js';
|
|
4
4
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
5
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
5
6
|
import fs from 'fs';
|
|
6
7
|
import * as config from '@hubspot/local-dev-lib/config';
|
|
7
8
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
@@ -11,6 +12,7 @@ vi.mock('../../../utils/toolUsageTracking');
|
|
|
11
12
|
vi.mock('../../../utils/feedbackTracking');
|
|
12
13
|
vi.mock('fs');
|
|
13
14
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
15
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
14
16
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
15
17
|
const mockRunCommandInDir = runCommandInDir;
|
|
16
18
|
const mockAddFlag = addFlag;
|
|
@@ -21,7 +23,6 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
21
23
|
let tool;
|
|
22
24
|
let mockRegisteredTool;
|
|
23
25
|
beforeEach(() => {
|
|
24
|
-
vi.clearAllMocks();
|
|
25
26
|
// @ts-expect-error Not mocking the whole server
|
|
26
27
|
mockMcpServer = {
|
|
27
28
|
registerTool: vi.fn(),
|
|
@@ -29,6 +30,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
29
30
|
mockRegisteredTool = {};
|
|
30
31
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
31
32
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
33
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
32
34
|
tool = new CreateTestAccountTool(mockMcpServer);
|
|
33
35
|
// Mock addFlag to simulate command building
|
|
34
36
|
mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
|
|
@@ -63,6 +65,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
63
65
|
serviceLevel: 'ENTERPRISE',
|
|
64
66
|
salesLevel: 'ENTERPRISE',
|
|
65
67
|
contentLevel: 'ENTERPRISE',
|
|
68
|
+
commerceLevel: 'ENTERPRISE',
|
|
66
69
|
};
|
|
67
70
|
it('should create test account with config path', async () => {
|
|
68
71
|
mockRunCommandInDir.mockResolvedValue({
|
|
@@ -97,6 +100,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
97
100
|
serviceLevel: 'ENTERPRISE',
|
|
98
101
|
salesLevel: 'ENTERPRISE',
|
|
99
102
|
contentLevel: 'ENTERPRISE',
|
|
103
|
+
commerceLevel: 'ENTERPRISE',
|
|
100
104
|
};
|
|
101
105
|
await tool.handler(input);
|
|
102
106
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'config-path', '/absolute/path/to/config.json');
|
|
@@ -117,6 +121,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
117
121
|
serviceLevel: 'ENTERPRISE',
|
|
118
122
|
salesLevel: 'ENTERPRISE',
|
|
119
123
|
contentLevel: 'ENTERPRISE',
|
|
124
|
+
commerceLevel: 'ENTERPRISE',
|
|
120
125
|
};
|
|
121
126
|
await tool.handler(input);
|
|
122
127
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'config-path', './test-account.json');
|
|
@@ -176,6 +181,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
176
181
|
serviceLevel: 'ENTERPRISE',
|
|
177
182
|
salesLevel: 'ENTERPRISE',
|
|
178
183
|
contentLevel: 'ENTERPRISE',
|
|
184
|
+
commerceLevel: 'ENTERPRISE',
|
|
179
185
|
};
|
|
180
186
|
await tool.handler(input);
|
|
181
187
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MyTestAccount');
|
|
@@ -192,7 +198,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
192
198
|
await tool.handler(input);
|
|
193
199
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MyTestAccount');
|
|
194
200
|
// Implementation uses name as fallback for description, and adds all hub levels with ENTERPRISE defaults
|
|
195
|
-
expect(mockAddFlag).toHaveBeenCalledTimes(
|
|
201
|
+
expect(mockAddFlag).toHaveBeenCalledTimes(8);
|
|
196
202
|
expect(mockRunCommandInDir).toHaveBeenCalled();
|
|
197
203
|
});
|
|
198
204
|
it('should create test account with account name and description', async () => {
|
|
@@ -209,6 +215,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
209
215
|
serviceLevel: 'ENTERPRISE',
|
|
210
216
|
salesLevel: 'ENTERPRISE',
|
|
211
217
|
contentLevel: 'ENTERPRISE',
|
|
218
|
+
commerceLevel: 'ENTERPRISE',
|
|
212
219
|
};
|
|
213
220
|
await tool.handler(input);
|
|
214
221
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'MyTestAccount');
|
|
@@ -226,6 +233,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
226
233
|
marketingLevel: 'PROFESSIONAL',
|
|
227
234
|
salesLevel: 'STARTER',
|
|
228
235
|
contentLevel: 'FREE',
|
|
236
|
+
commerceLevel: 'FREE',
|
|
229
237
|
serviceLevel: 'ENTERPRISE',
|
|
230
238
|
opsLevel: 'ENTERPRISE',
|
|
231
239
|
};
|
|
@@ -249,6 +257,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
249
257
|
serviceLevel: 'STARTER',
|
|
250
258
|
salesLevel: 'ENTERPRISE',
|
|
251
259
|
contentLevel: 'PROFESSIONAL',
|
|
260
|
+
commerceLevel: 'FREE',
|
|
252
261
|
};
|
|
253
262
|
await tool.handler(input);
|
|
254
263
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'AllHubsAccount');
|
|
@@ -258,6 +267,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
258
267
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'service-level', 'STARTER');
|
|
259
268
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'sales-level', 'ENTERPRISE');
|
|
260
269
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'content-level', 'PROFESSIONAL');
|
|
270
|
+
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'commerce-level', 'FREE');
|
|
261
271
|
});
|
|
262
272
|
});
|
|
263
273
|
describe('handler defaults', () => {
|
|
@@ -275,6 +285,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
275
285
|
serviceLevel: 'ENTERPRISE',
|
|
276
286
|
salesLevel: 'ENTERPRISE',
|
|
277
287
|
contentLevel: 'ENTERPRISE',
|
|
288
|
+
commerceLevel: 'ENTERPRISE',
|
|
278
289
|
};
|
|
279
290
|
await tool.handler(input);
|
|
280
291
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'DefaultLevelsAccount');
|
|
@@ -283,6 +294,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
283
294
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'service-level', 'ENTERPRISE');
|
|
284
295
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'sales-level', 'ENTERPRISE');
|
|
285
296
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'content-level', 'ENTERPRISE');
|
|
297
|
+
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'commerce-level', 'ENTERPRISE');
|
|
286
298
|
});
|
|
287
299
|
it('should use name as fallback for description when description is empty', async () => {
|
|
288
300
|
mockRunCommandInDir.mockResolvedValue({
|
|
@@ -298,6 +310,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
298
310
|
serviceLevel: 'ENTERPRISE',
|
|
299
311
|
salesLevel: 'ENTERPRISE',
|
|
300
312
|
contentLevel: 'ENTERPRISE',
|
|
313
|
+
commerceLevel: 'ENTERPRISE',
|
|
301
314
|
};
|
|
302
315
|
await tool.handler(input);
|
|
303
316
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'NoDescriptionAccount');
|
|
@@ -318,6 +331,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
318
331
|
opsLevel: 'ENTERPRISE',
|
|
319
332
|
serviceLevel: 'ENTERPRISE',
|
|
320
333
|
contentLevel: 'ENTERPRISE',
|
|
334
|
+
commerceLevel: 'ENTERPRISE',
|
|
321
335
|
};
|
|
322
336
|
await tool.handler(input);
|
|
323
337
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'PartialLevelsAccount');
|
|
@@ -326,6 +340,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
326
340
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'ops-level', 'ENTERPRISE');
|
|
327
341
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'service-level', 'ENTERPRISE');
|
|
328
342
|
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'content-level', 'ENTERPRISE');
|
|
343
|
+
expect(mockAddFlag).toHaveBeenCalledWith(expect.any(String), 'commerce-level', 'ENTERPRISE');
|
|
329
344
|
});
|
|
330
345
|
it('should add all hub level flags when defaults are applied', async () => {
|
|
331
346
|
mockRunCommandInDir.mockResolvedValue({
|
|
@@ -341,10 +356,11 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
341
356
|
serviceLevel: 'ENTERPRISE',
|
|
342
357
|
salesLevel: 'ENTERPRISE',
|
|
343
358
|
contentLevel: 'ENTERPRISE',
|
|
359
|
+
commerceLevel: 'ENTERPRISE',
|
|
344
360
|
};
|
|
345
361
|
const result = await tool.handler(input);
|
|
346
362
|
expect(mockRunCommandInDir).toHaveBeenCalled();
|
|
347
|
-
expect(mockAddFlag).toHaveBeenCalledTimes(
|
|
363
|
+
expect(mockAddFlag).toHaveBeenCalledTimes(8);
|
|
348
364
|
expect(result.content[1]).toEqual({
|
|
349
365
|
type: 'text',
|
|
350
366
|
text: 'Test account created with defaults',
|
|
@@ -361,7 +377,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
361
377
|
};
|
|
362
378
|
await tool.handler(input);
|
|
363
379
|
expect(mockAddFlag).toHaveBeenCalledWith('hs test-account create', 'name', 'BypassedDefaultsAccount');
|
|
364
|
-
expect(mockAddFlag).toHaveBeenCalledTimes(
|
|
380
|
+
expect(mockAddFlag).toHaveBeenCalledTimes(8);
|
|
365
381
|
});
|
|
366
382
|
});
|
|
367
383
|
describe('interactive mode', () => {
|
|
@@ -374,6 +390,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
374
390
|
serviceLevel: 'ENTERPRISE',
|
|
375
391
|
salesLevel: 'ENTERPRISE',
|
|
376
392
|
contentLevel: 'ENTERPRISE',
|
|
393
|
+
commerceLevel: 'ENTERPRISE',
|
|
377
394
|
};
|
|
378
395
|
const result = await tool.handler(input);
|
|
379
396
|
// Should NOT run the command
|
|
@@ -404,6 +421,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
404
421
|
serviceLevel: 'ENTERPRISE',
|
|
405
422
|
salesLevel: 'ENTERPRISE',
|
|
406
423
|
contentLevel: 'ENTERPRISE',
|
|
424
|
+
commerceLevel: 'ENTERPRISE',
|
|
407
425
|
};
|
|
408
426
|
const result = await tool.handler(input);
|
|
409
427
|
expect(result).toEqual({
|
|
@@ -429,6 +447,7 @@ describe('mcp-server/tools/project/CreateTestAccountTool', () => {
|
|
|
429
447
|
serviceLevel: 'ENTERPRISE',
|
|
430
448
|
salesLevel: 'ENTERPRISE',
|
|
431
449
|
contentLevel: 'ENTERPRISE',
|
|
450
|
+
commerceLevel: 'ENTERPRISE',
|
|
432
451
|
};
|
|
433
452
|
const result = await tool.handler(input);
|
|
434
453
|
expect(result).toEqual({
|
|
@@ -2,11 +2,13 @@ import { DeployProjectTool } from '../DeployProjectTool.js';
|
|
|
2
2
|
import { runCommandInDir } from '../../../utils/project.js';
|
|
3
3
|
import { addFlag } from '../../../utils/command.js';
|
|
4
4
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
5
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
5
6
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
6
7
|
vi.mock('../../../utils/project');
|
|
7
8
|
vi.mock('../../../utils/command');
|
|
8
9
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
10
|
vi.mock('../../../utils/feedbackTracking');
|
|
11
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
10
12
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
11
13
|
const mockRunCommandInDir = runCommandInDir;
|
|
12
14
|
const mockAddFlag = addFlag;
|
|
@@ -15,7 +17,6 @@ describe('mcp-server/tools/project/DeployProject', () => {
|
|
|
15
17
|
let tool;
|
|
16
18
|
let mockRegisteredTool;
|
|
17
19
|
beforeEach(() => {
|
|
18
|
-
vi.clearAllMocks();
|
|
19
20
|
// @ts-expect-error Not mocking the whole server
|
|
20
21
|
mockMcpServer = {
|
|
21
22
|
registerTool: vi.fn(),
|
|
@@ -23,6 +24,7 @@ describe('mcp-server/tools/project/DeployProject', () => {
|
|
|
23
24
|
mockRegisteredTool = {};
|
|
24
25
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
25
26
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
27
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
26
28
|
tool = new DeployProjectTool(mockMcpServer);
|
|
27
29
|
// Mock addFlag to simulate command building
|
|
28
30
|
mockAddFlag.mockImplementation((command, flag, value) => `${command} --${flag} "${value}"`);
|
|
@@ -3,12 +3,14 @@ import { http } from '@hubspot/local-dev-lib/http';
|
|
|
3
3
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
4
4
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
6
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
7
8
|
vi.mock('@hubspot/local-dev-lib/http');
|
|
8
9
|
vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
9
10
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
10
11
|
vi.mock('../../../utils/toolUsageTracking');
|
|
11
12
|
vi.mock('../../../utils/feedbackTracking');
|
|
13
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
12
14
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
13
15
|
const mockHttp = http;
|
|
14
16
|
const mockIsHubSpotHttpError = vi.mocked(isHubSpotHttpError);
|
|
@@ -18,7 +20,6 @@ describe('mcp-server/tools/project/DocsSearchTool', () => {
|
|
|
18
20
|
let tool;
|
|
19
21
|
let mockRegisteredTool;
|
|
20
22
|
beforeEach(() => {
|
|
21
|
-
vi.clearAllMocks();
|
|
22
23
|
// @ts-expect-error Not mocking whole server
|
|
23
24
|
mockMcpServer = {
|
|
24
25
|
registerTool: vi.fn(),
|
|
@@ -26,6 +27,7 @@ describe('mcp-server/tools/project/DocsSearchTool', () => {
|
|
|
26
27
|
mockRegisteredTool = {};
|
|
27
28
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
28
29
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
30
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
29
31
|
tool = new DocsSearchTool(mockMcpServer);
|
|
30
32
|
});
|
|
31
33
|
describe('register', () => {
|
|
@@ -4,12 +4,14 @@ import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
|
4
4
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
5
5
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
6
6
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
7
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
8
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
9
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
10
|
vi.mock('@hubspot/local-dev-lib/http');
|
|
10
11
|
vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
11
12
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
12
13
|
vi.mock('../../../utils/feedbackTracking');
|
|
14
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
13
15
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
14
16
|
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
15
17
|
const mockHttp = http;
|
|
@@ -19,7 +21,6 @@ describe('mcp-server/tools/project/GetApiUsagePatternsByAppIdTool', () => {
|
|
|
19
21
|
let tool;
|
|
20
22
|
let mockRegisteredTool;
|
|
21
23
|
beforeEach(() => {
|
|
22
|
-
vi.clearAllMocks();
|
|
23
24
|
// @ts-expect-error Not mocking the whole thing
|
|
24
25
|
mockMcpServer = {
|
|
25
26
|
registerTool: vi.fn(),
|
|
@@ -27,6 +28,7 @@ describe('mcp-server/tools/project/GetApiUsagePatternsByAppIdTool', () => {
|
|
|
27
28
|
mockRegisteredTool = {};
|
|
28
29
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
29
30
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
31
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
30
32
|
tool = new GetApiUsagePatternsByAppIdTool(mockMcpServer);
|
|
31
33
|
});
|
|
32
34
|
describe('register', () => {
|
|
@@ -34,7 +36,7 @@ describe('mcp-server/tools/project/GetApiUsagePatternsByAppIdTool', () => {
|
|
|
34
36
|
const result = tool.register();
|
|
35
37
|
expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-api-usage-patterns-by-app-id', expect.objectContaining({
|
|
36
38
|
title: 'Get API Usage Patterns by App ID',
|
|
37
|
-
description: expect.stringContaining('Retrieves detailed API usage pattern analytics for a specific HubSpot
|
|
39
|
+
description: expect.stringContaining('Retrieves detailed API usage pattern analytics for a specific HubSpot app'),
|
|
38
40
|
inputSchema: expect.objectContaining({
|
|
39
41
|
appId: expect.objectContaining({
|
|
40
42
|
describe: expect.any(Function),
|
|
@@ -3,12 +3,15 @@ import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
|
3
3
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
4
4
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
6
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
7
|
-
vi.mock('
|
|
8
|
+
vi.mock('../../../utils/toolUsageTracking');
|
|
8
9
|
vi.mock('@hubspot/local-dev-lib/http');
|
|
9
10
|
vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
10
11
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
11
12
|
vi.mock('../../../utils/feedbackTracking');
|
|
13
|
+
vi.mock('../../../utils/config');
|
|
14
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
12
15
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
13
16
|
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
14
17
|
const mockHttp = http;
|
|
@@ -18,7 +21,6 @@ describe('mcp-server/tools/project/GetApplicationInfoTool', () => {
|
|
|
18
21
|
let tool;
|
|
19
22
|
let mockRegisteredTool;
|
|
20
23
|
beforeEach(() => {
|
|
21
|
-
vi.clearAllMocks();
|
|
22
24
|
// @ts-expect-error Not mocking the whole thing
|
|
23
25
|
mockMcpServer = {
|
|
24
26
|
registerTool: vi.fn(),
|
|
@@ -26,14 +28,15 @@ describe('mcp-server/tools/project/GetApplicationInfoTool', () => {
|
|
|
26
28
|
mockRegisteredTool = {};
|
|
27
29
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
28
30
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
31
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
29
32
|
tool = new GetApplicationInfoTool(mockMcpServer);
|
|
30
33
|
});
|
|
31
34
|
describe('register', () => {
|
|
32
35
|
it('should register tool with correct parameters', () => {
|
|
33
36
|
const result = tool.register();
|
|
34
|
-
expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-
|
|
35
|
-
title: 'Get
|
|
36
|
-
description: expect.stringContaining('Retrieves a list of all HubSpot
|
|
37
|
+
expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-apps-info', expect.objectContaining({
|
|
38
|
+
title: 'Get Apps Information',
|
|
39
|
+
description: expect.stringContaining('Retrieves a list of all HubSpot apps available in the current account'),
|
|
37
40
|
inputSchema: expect.any(Object),
|
|
38
41
|
}), expect.any(Function));
|
|
39
42
|
expect(result).toBe(mockRegisteredTool);
|
|
@@ -4,6 +4,7 @@ import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
|
4
4
|
import { getProjectConfig, validateProjectConfig, } from '../../../../lib/projects/config.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
7
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
8
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
9
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
10
|
vi.mock('../../../utils/cliConfig');
|
|
@@ -12,6 +13,7 @@ vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
|
12
13
|
vi.mock('../../../../lib/projects/config.js');
|
|
13
14
|
vi.mock('../../../utils/feedbackTracking');
|
|
14
15
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
16
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
15
17
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
16
18
|
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
17
19
|
const mockHttpGet = http.get;
|
|
@@ -134,7 +136,6 @@ describe('mcp-server/tools/project/GetBuildLogsTool', () => {
|
|
|
134
136
|
let tool;
|
|
135
137
|
let mockRegisteredTool;
|
|
136
138
|
beforeEach(() => {
|
|
137
|
-
vi.clearAllMocks();
|
|
138
139
|
// @ts-expect-error Not mocking the whole thing
|
|
139
140
|
mockMcpServer = {
|
|
140
141
|
registerTool: vi.fn(),
|
|
@@ -142,6 +143,7 @@ describe('mcp-server/tools/project/GetBuildLogsTool', () => {
|
|
|
142
143
|
mockRegisteredTool = {};
|
|
143
144
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
144
145
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
146
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
145
147
|
tool = new GetBuildLogsTool(mockMcpServer);
|
|
146
148
|
// Default mock implementations
|
|
147
149
|
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
@@ -4,6 +4,7 @@ import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
|
4
4
|
import { getProjectConfig, validateProjectConfig, } from '../../../../lib/projects/config.js';
|
|
5
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
6
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
7
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
7
8
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
9
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
10
|
vi.mock('@hubspot/local-dev-lib/api/projects');
|
|
@@ -11,6 +12,7 @@ vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
|
11
12
|
vi.mock('../../../../lib/projects/config.js');
|
|
12
13
|
vi.mock('../../../utils/feedbackTracking');
|
|
13
14
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
15
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
14
16
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
15
17
|
const mockFetchProjectBuilds = fetchProjectBuilds;
|
|
16
18
|
const mockGetBuildStatus = getBuildStatus;
|
|
@@ -83,7 +85,6 @@ describe('mcp-server/tools/project/GetBuildStatusTool', () => {
|
|
|
83
85
|
let tool;
|
|
84
86
|
let mockRegisteredTool;
|
|
85
87
|
beforeEach(() => {
|
|
86
|
-
vi.clearAllMocks();
|
|
87
88
|
// @ts-expect-error Not mocking the whole thing
|
|
88
89
|
mockMcpServer = {
|
|
89
90
|
registerTool: vi.fn(),
|
|
@@ -91,6 +92,7 @@ describe('mcp-server/tools/project/GetBuildStatusTool', () => {
|
|
|
91
92
|
mockRegisteredTool = {};
|
|
92
93
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
93
94
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
95
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
94
96
|
tool = new GetBuildStatusTool(mockMcpServer);
|
|
95
97
|
// Default mock implementations
|
|
96
98
|
mockIsHubSpotHttpError.mockReturnValue(false);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { GetConfigValuesTool } from '../GetConfigValuesTool.js';
|
|
2
|
-
import { getIntermediateRepresentationSchema
|
|
2
|
+
import { getIntermediateRepresentationSchema } from '@hubspot/project-parsing-lib/schema';
|
|
3
|
+
import { mapToInternalType } from '@hubspot/project-parsing-lib/transform';
|
|
3
4
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
4
5
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
5
7
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
6
|
-
vi.mock('@hubspot/project-parsing-lib');
|
|
8
|
+
vi.mock('@hubspot/project-parsing-lib/schema');
|
|
9
|
+
vi.mock('@hubspot/project-parsing-lib/transform');
|
|
7
10
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
8
11
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
12
|
vi.mock('../../../utils/feedbackTracking');
|
|
13
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
10
14
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
11
15
|
const mockGetIntermediateRepresentationSchema = getIntermediateRepresentationSchema;
|
|
12
16
|
const mockMapToInternalType = mapToInternalType;
|
|
@@ -16,7 +20,6 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
16
20
|
let tool;
|
|
17
21
|
let mockRegisteredTool;
|
|
18
22
|
beforeEach(() => {
|
|
19
|
-
vi.clearAllMocks();
|
|
20
23
|
// @ts-expect-error Not mocking the whole thing
|
|
21
24
|
mockMcpServer = {
|
|
22
25
|
registerTool: vi.fn(),
|
|
@@ -24,6 +27,7 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
24
27
|
mockRegisteredTool = {};
|
|
25
28
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
26
29
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
30
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
27
31
|
tool = new GetConfigValuesTool(mockMcpServer);
|
|
28
32
|
});
|
|
29
33
|
describe('register', () => {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { GuidedWalkthroughTool } from '../GuidedWalkthroughTool.js';
|
|
2
2
|
import { execAsync } from '../../../utils/command.js';
|
|
3
3
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
4
|
+
import { trackToolUsage } from '../../../utils/toolUsageTracking.js';
|
|
4
5
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
5
6
|
vi.mock('../../../utils/command');
|
|
6
7
|
vi.mock('../../../utils/toolUsageTracking');
|
|
7
8
|
vi.mock('../../../utils/feedbackTracking');
|
|
9
|
+
const mockTrackToolUsage = trackToolUsage;
|
|
8
10
|
const mockExecAsync = execAsync;
|
|
9
11
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
10
12
|
describe('mcp-server/tools/project/GuidedWalkthroughTool', () => {
|
|
@@ -12,7 +14,6 @@ describe('mcp-server/tools/project/GuidedWalkthroughTool', () => {
|
|
|
12
14
|
let tool;
|
|
13
15
|
let mockRegisteredTool;
|
|
14
16
|
beforeEach(() => {
|
|
15
|
-
vi.clearAllMocks();
|
|
16
17
|
// @ts-expect-error Not mocking whole server
|
|
17
18
|
mockMcpServer = {
|
|
18
19
|
registerTool: vi.fn(),
|
|
@@ -20,6 +21,7 @@ describe('mcp-server/tools/project/GuidedWalkthroughTool', () => {
|
|
|
20
21
|
mockRegisteredTool = {};
|
|
21
22
|
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
22
23
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
24
|
+
mockTrackToolUsage.mockResolvedValue(undefined);
|
|
23
25
|
tool = new GuidedWalkthroughTool(mockMcpServer);
|
|
24
26
|
});
|
|
25
27
|
describe('register', () => {
|