@hubspot/cli 7.5.3-experimental.0 → 7.5.3
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/migrate.d.ts +12 -3
- package/api/migrate.js +9 -2
- package/bin/cli.js +100 -93
- package/commands/account/auth.d.ts +8 -0
- package/commands/account/auth.js +175 -0
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +54 -14
- package/commands/account/createOverride.d.ts +6 -0
- package/commands/account/createOverride.js +121 -0
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +36 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +38 -15
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +49 -9
- package/commands/account/removeOverride.d.ts +6 -0
- package/commands/account/removeOverride.js +93 -0
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +27 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -53
- package/commands/app/migrate.d.ts +5 -6
- package/commands/app/migrate.js +60 -44
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -10
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +37 -33
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -16
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -13
- package/commands/config/migrate.d.ts +6 -0
- package/commands/config/migrate.js +75 -0
- package/commands/config/set.d.ts +10 -1
- package/commands/config/set.js +56 -32
- package/commands/config.d.ts +3 -1
- package/commands/config.js +19 -11
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -75
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -48
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -22
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -48
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -34
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -42
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -11
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +21 -15
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +23 -17
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +24 -16
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +20 -14
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +24 -47
- package/commands/init.d.ts +3 -7
- package/commands/init.js +31 -24
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -44
- package/commands/list.d.ts +3 -7
- package/commands/list.js +21 -16
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -45
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +50 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +75 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -30
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -12
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +20 -15
- package/commands/open.d.ts +3 -7
- package/commands/open.js +20 -15
- package/commands/project/add.d.ts +8 -9
- package/commands/project/add.js +53 -85
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +51 -47
- package/commands/project/create.d.ts +4 -1
- package/commands/project/create.js +132 -81
- package/commands/project/deploy.d.ts +5 -6
- package/commands/project/deploy.js +93 -37
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +41 -26
- package/commands/project/dev/index.d.ts +4 -5
- package/commands/project/dev/index.js +103 -33
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +85 -46
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -30
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +7 -8
- package/commands/project/migrate.js +49 -26
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +10 -1
- package/commands/project/upload.js +94 -56
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +81 -0
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +49 -37
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -20
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +27 -21
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +35 -29
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -44
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +21 -15
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +28 -18
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +19 -13
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +25 -17
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -49
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -16
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -18
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +36 -30
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -48
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -135
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -76
- package/lang/en.d.ts +3218 -0
- package/lang/en.js +3075 -3313
- package/lang/en.lyaml +96 -228
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +11 -0
- package/lib/app/migrate.d.ts +33 -4
- package/lib/app/migrate.js +179 -88
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +12 -11
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +4 -7
- package/lib/commonOpts.js +47 -19
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +83 -0
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -45
- package/lib/constants.d.ts +33 -0
- package/lib/constants.js +34 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +14 -40
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +19 -16
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -9
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +60 -46
- package/lib/errorHandlers/index.js +13 -7
- package/lib/errorHandlers/suppressError.js +18 -26
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -6
- package/lib/hasFeature.d.ts +3 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +12 -0
- package/lib/mcp/setup.js +216 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +3 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +37 -3
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +125 -0
- package/lib/middleware/yargsChecksMiddleware.js +2 -2
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +46 -42
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +23 -15
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/projects/localDev/DevServerManagerV2.d.ts +22 -0
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +22 -19
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +57 -83
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +6 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +127 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +17 -2
- package/lib/projects/upload.js +74 -50
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +23 -1
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +20 -4
- package/lib/prompts/createProjectPrompt.js +43 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -25
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -8
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +15 -16
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +4 -2
- package/lib/prompts/promptUtils.js +3 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -9
- package/lib/prompts/setAsDefaultAccountPrompt.js +11 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +4 -2
- package/lib/ui/index.js +20 -17
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +5 -1
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +17 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +100 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +19 -11
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +14 -14
- package/lib/DevServerManagerV2.d.ts +0 -33
- package/lib/LocalDevManagerV2.d.ts +0 -64
- package/lib/LocalDevManagerV2.js +0 -377
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/index.d.ts +0 -21
- package/lib/projects/index.js +0 -194
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -40
package/lib/ui/git.js
CHANGED
|
@@ -8,22 +8,21 @@ const os_1 = __importDefault(require("os"));
|
|
|
8
8
|
const gitignore_1 = require("@hubspot/local-dev-lib/gitignore");
|
|
9
9
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
10
|
const lang_1 = require("../lang");
|
|
11
|
-
const i18nKey = 'lib.ui.git';
|
|
12
11
|
function checkAndWarnGitInclusion(configPath) {
|
|
13
12
|
try {
|
|
14
13
|
const { inGit, configIgnored } = (0, gitignore_1.checkGitInclusion)(configPath);
|
|
15
14
|
if (!inGit || configIgnored)
|
|
16
15
|
return;
|
|
17
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
18
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
19
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
20
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
21
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
22
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
23
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
16
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.securityIssue`));
|
|
17
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.configFileTracked`));
|
|
18
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.fileName`, { configPath }));
|
|
19
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.remediate`));
|
|
20
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.moveConfig`, { homeDir: os_1.default.homedir() }));
|
|
21
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.addGitignore`, { configPath }));
|
|
22
|
+
logger_1.logger.warn((0, lang_1.i18n)(`lib.ui.git.noRemote`));
|
|
24
23
|
}
|
|
25
24
|
catch (e) {
|
|
26
25
|
// fail silently
|
|
27
|
-
logger_1.logger.debug((0, lang_1.i18n)(
|
|
26
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.ui.git.checkFailed`));
|
|
28
27
|
}
|
|
29
28
|
}
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export declare function uiCommandReference(command: string, withQuotes?: boolean
|
|
|
11
11
|
export declare function uiFeatureHighlight(features: string[], title?: string): void;
|
|
12
12
|
export declare function uiBetaTag(message: string, log?: true): undefined;
|
|
13
13
|
export declare function uiBetaTag(message: string, log: false): string;
|
|
14
|
-
export declare function uiDeprecatedTag(message: string, log?:
|
|
14
|
+
export declare function uiDeprecatedTag(message: string, log?: true): undefined;
|
|
15
|
+
export declare function uiDeprecatedTag(message: string, log: false): string;
|
|
15
16
|
export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
|
|
16
|
-
export declare function uiDeprecatedDescription(message: string, command: string, url?: string):
|
|
17
|
+
export declare function uiDeprecatedDescription(message: string, command: string, url?: string): undefined;
|
|
17
18
|
export declare function uiDeprecatedMessage(command: string, url?: string, message?: string): void;
|
|
19
|
+
export declare function indent(level: number): string;
|
package/lib/ui/index.js
CHANGED
|
@@ -15,6 +15,7 @@ exports.uiDeprecatedTag = uiDeprecatedTag;
|
|
|
15
15
|
exports.uiCommandDisabledBanner = uiCommandDisabledBanner;
|
|
16
16
|
exports.uiDeprecatedDescription = uiDeprecatedDescription;
|
|
17
17
|
exports.uiDeprecatedMessage = uiDeprecatedMessage;
|
|
18
|
+
exports.indent = indent;
|
|
18
19
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
20
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
20
21
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
@@ -60,7 +61,10 @@ function uiAccountDescription(accountId, bold = true) {
|
|
|
60
61
|
if (account && account.accountType) {
|
|
61
62
|
message = `${account.name} [${HUBSPOT_ACCOUNT_TYPE_STRINGS[account.accountType]}] (${accountId})`;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
else {
|
|
65
|
+
message = accountId ? accountId.toString() : '';
|
|
66
|
+
}
|
|
67
|
+
return bold ? chalk_1.default.bold(message) : message;
|
|
64
68
|
}
|
|
65
69
|
function uiInfoSection(title, logContent) {
|
|
66
70
|
uiLine();
|
|
@@ -78,10 +82,9 @@ function uiCommandReference(command, withQuotes = true) {
|
|
|
78
82
|
: commandReference);
|
|
79
83
|
}
|
|
80
84
|
function uiFeatureHighlight(features, title) {
|
|
81
|
-
|
|
82
|
-
uiInfoSection(title ? title : (0, lang_1.i18n)(`${i18nKey}.defaultTitle`), () => {
|
|
85
|
+
uiInfoSection(title ? title : (0, lang_1.i18n)(`lib.ui.featureHighlight.defaultTitle`), () => {
|
|
83
86
|
features.forEach((c, i) => {
|
|
84
|
-
const featureKey =
|
|
87
|
+
const featureKey = `lib.ui.featureHighlight.featureKeys.${c}`;
|
|
85
88
|
const message = (0, lang_1.i18n)(`${featureKey}.message`, {
|
|
86
89
|
command: uiCommandReference((0, lang_1.i18n)(`${featureKey}.command`)),
|
|
87
90
|
link: uiLink((0, lang_1.i18n)(`${featureKey}.linkText`), (0, lang_1.i18n)(`${featureKey}.url`)),
|
|
@@ -94,9 +97,8 @@ function uiFeatureHighlight(features, title) {
|
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
99
|
function uiBetaTag(message, log = true) {
|
|
97
|
-
const i18nKey = 'lib.ui';
|
|
98
100
|
const terminalUISupport = getTerminalUISupport();
|
|
99
|
-
const tag = (0, lang_1.i18n)(
|
|
101
|
+
const tag = (0, lang_1.i18n)(`lib.ui.betaTag`);
|
|
100
102
|
const result = `${terminalUISupport.color ? chalk_1.default.hex(exports.UI_COLORS.SORBET)(tag) : tag} ${message}`;
|
|
101
103
|
if (log) {
|
|
102
104
|
logger_1.logger.log(result);
|
|
@@ -105,21 +107,20 @@ function uiBetaTag(message, log = true) {
|
|
|
105
107
|
return result;
|
|
106
108
|
}
|
|
107
109
|
function uiDeprecatedTag(message, log = true) {
|
|
108
|
-
const i18nKey = 'lib.ui';
|
|
109
110
|
const terminalUISupport = getTerminalUISupport();
|
|
110
|
-
const tag = (0, lang_1.i18n)(
|
|
111
|
+
const tag = (0, lang_1.i18n)(`lib.ui.deprecatedTag`);
|
|
111
112
|
const result = `${terminalUISupport.color ? chalk_1.default.yellow(tag) : tag} ${message}`;
|
|
112
113
|
if (log) {
|
|
113
114
|
logger_1.logger.log(result);
|
|
115
|
+
return;
|
|
114
116
|
}
|
|
115
117
|
return result;
|
|
116
118
|
}
|
|
117
119
|
function uiCommandDisabledBanner(command, url, message) {
|
|
118
|
-
const i18nKey = 'lib.ui';
|
|
119
120
|
const tag = message ||
|
|
120
|
-
(0, lang_1.i18n)(
|
|
121
|
+
(0, lang_1.i18n)(`lib.ui.disabledMessage`, {
|
|
121
122
|
command: uiCommandReference(command),
|
|
122
|
-
url: url ? uiLink((0, lang_1.i18n)(
|
|
123
|
+
url: url ? uiLink((0, lang_1.i18n)(`lib.ui.disabledUrlText`), url) : '',
|
|
123
124
|
npmCommand: uiCommandReference('npm i -g @hubspot/cli@latest'),
|
|
124
125
|
});
|
|
125
126
|
logger_1.logger.log();
|
|
@@ -129,22 +130,24 @@ function uiCommandDisabledBanner(command, url, message) {
|
|
|
129
130
|
logger_1.logger.log();
|
|
130
131
|
}
|
|
131
132
|
function uiDeprecatedDescription(message, command, url) {
|
|
132
|
-
const
|
|
133
|
-
const tag = (0, lang_1.i18n)(`${i18nKey}.deprecatedDescription`, {
|
|
133
|
+
const tag = (0, lang_1.i18n)(`lib.ui.deprecatedDescription`, {
|
|
134
134
|
message,
|
|
135
135
|
command: uiCommandReference(command),
|
|
136
|
-
url: url ? uiLink((0, lang_1.i18n)(
|
|
136
|
+
url: url ? uiLink((0, lang_1.i18n)(`lib.ui.deprecatedUrlText`), url) : '',
|
|
137
137
|
});
|
|
138
138
|
return uiDeprecatedTag(tag);
|
|
139
139
|
}
|
|
140
140
|
function uiDeprecatedMessage(command, url, message) {
|
|
141
|
-
const i18nKey = 'lib.ui';
|
|
142
141
|
const tag = message ||
|
|
143
|
-
(0, lang_1.i18n)(
|
|
142
|
+
(0, lang_1.i18n)(`lib.ui.deprecatedMessage`, {
|
|
144
143
|
command: uiCommandReference(command),
|
|
145
|
-
url: url ? uiLink((0, lang_1.i18n)(
|
|
144
|
+
url: url ? uiLink((0, lang_1.i18n)(`lib.ui.deprecatedUrlText`), url) : '',
|
|
146
145
|
});
|
|
147
146
|
logger_1.logger.log();
|
|
148
147
|
uiDeprecatedTag(tag);
|
|
149
148
|
logger_1.logger.log();
|
|
150
149
|
}
|
|
150
|
+
function indent(level) {
|
|
151
|
+
const indentation = ' ';
|
|
152
|
+
return indentation.repeat(level);
|
|
153
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const uiLogger: {
|
|
2
|
+
log: (message: string) => void;
|
|
3
|
+
error: (message: string) => void;
|
|
4
|
+
warn: (message: string) => void;
|
|
5
|
+
success: (message: string) => void;
|
|
6
|
+
info: (message: string) => void;
|
|
7
|
+
debug: (...args: any[]) => void;
|
|
8
|
+
group: (message: string) => void;
|
|
9
|
+
groupEnd: () => void;
|
|
10
|
+
};
|
package/lib/ui/logger.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uiLogger = void 0;
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
// Wrapper around LDL logger to provide type checking
|
|
6
|
+
exports.uiLogger = {
|
|
7
|
+
log: (message) => logger_1.logger.log(message),
|
|
8
|
+
error: (message) => logger_1.logger.error(message),
|
|
9
|
+
warn: (message) => logger_1.logger.warn(message),
|
|
10
|
+
success: (message) => logger_1.logger.success(message),
|
|
11
|
+
info: (message) => logger_1.logger.info(message),
|
|
12
|
+
debug: logger_1.logger.debug,
|
|
13
|
+
group: (message) => logger_1.logger.group(message),
|
|
14
|
+
groupEnd: () => logger_1.logger.groupEnd(),
|
|
15
|
+
};
|
|
@@ -8,7 +8,6 @@ const moment_1 = __importDefault(require("moment"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
10
|
const lang_1 = require("../lang");
|
|
11
|
-
const i18nKey = 'lib.ui.serverlessFunctionLogs';
|
|
12
11
|
const SEPARATOR = ' - ';
|
|
13
12
|
const LOG_STATUS_COLORS = {
|
|
14
13
|
SUCCESS: logger_1.Styles.success,
|
|
@@ -63,7 +62,7 @@ function processLog(log, options) {
|
|
|
63
62
|
return logHandler[log.status](log, options);
|
|
64
63
|
}
|
|
65
64
|
catch (e) {
|
|
66
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
65
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.ui.serverlessFunctionLogs.unableToProcessLog`, {
|
|
67
66
|
log: JSON.stringify(log),
|
|
68
67
|
}));
|
|
69
68
|
}
|
|
@@ -77,7 +76,7 @@ function isLogsResponse(logsResp) {
|
|
|
77
76
|
function processLogs(logsResp, options) {
|
|
78
77
|
const isLogsResp = isLogsResponse(logsResp);
|
|
79
78
|
if (!logsResp || (isLogsResp && logsResp.results.length === 0)) {
|
|
80
|
-
return (0, lang_1.i18n)(
|
|
79
|
+
return (0, lang_1.i18n)(`lib.ui.serverlessFunctionLogs.noLogsFound`);
|
|
81
80
|
}
|
|
82
81
|
else if (isLogsResp) {
|
|
83
82
|
return logsResp
|
package/lib/upload.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getUploadableFileList(src: string, convertFields
|
|
1
|
+
export declare function getUploadableFileList(src: string, convertFields?: boolean): Promise<string[]>;
|
package/lib/validation.js
CHANGED
|
@@ -145,28 +145,27 @@ function validateCmsPublishMode(options) {
|
|
|
145
145
|
return false;
|
|
146
146
|
}
|
|
147
147
|
function fileExists(_path) {
|
|
148
|
-
let isFile;
|
|
149
148
|
try {
|
|
150
149
|
const absoluteSrcPath = path.resolve((0, path_1.getCwd)(), _path);
|
|
151
150
|
if (!absoluteSrcPath)
|
|
152
151
|
return false;
|
|
153
152
|
const stats = fs.statSync(absoluteSrcPath);
|
|
154
|
-
isFile = stats.isFile();
|
|
153
|
+
const isFile = stats.isFile();
|
|
155
154
|
if (!isFile) {
|
|
156
|
-
logger_1.logger.error(`The path "${_path}" is not a path to a file`);
|
|
157
155
|
return false;
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
catch (e) {
|
|
161
|
-
logger_1.logger.error(`The path "${_path}" is not a path to a file`);
|
|
162
159
|
return false;
|
|
163
160
|
}
|
|
164
161
|
return true;
|
|
165
162
|
}
|
|
166
163
|
function checkAndConvertToJson(_path) {
|
|
167
164
|
const filePath = (0, path_1.getAbsoluteFilePath)(_path);
|
|
168
|
-
if (!fileExists(filePath))
|
|
165
|
+
if (!fileExists(filePath)) {
|
|
166
|
+
logger_1.logger.error(`The path "${_path}" is not a path to a file`);
|
|
169
167
|
return null;
|
|
168
|
+
}
|
|
170
169
|
if ((0, path_1.getExt)(_path) !== 'json') {
|
|
171
170
|
logger_1.logger.error(`The file "${_path}" must be a valid JSON file`);
|
|
172
171
|
return null;
|
package/lib/yargsUtils.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Argv } from 'yargs';
|
|
2
2
|
export declare function hasFlag(flag: string, argv?: string[]): boolean;
|
|
3
|
-
export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>, command: string, describe
|
|
3
|
+
export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>, command: string | string[], describe?: string, options?: {
|
|
4
4
|
useGlobalOptions?: boolean;
|
|
5
5
|
useAccountOptions?: boolean;
|
|
6
6
|
useConfigOptions?: boolean;
|
|
7
7
|
useEnvironmentOptions?: boolean;
|
|
8
8
|
useTestingOptions?: boolean;
|
|
9
|
+
useCmsPublishModeOptions?: boolean | {
|
|
10
|
+
read?: boolean;
|
|
11
|
+
write?: boolean;
|
|
12
|
+
};
|
|
9
13
|
}): (yargs: Argv) => Promise<Argv<T>>;
|
package/lib/yargsUtils.js
CHANGED
|
@@ -32,6 +32,12 @@ function makeYargsBuilder(callback, command, describe, options = {}) {
|
|
|
32
32
|
if (options.useTestingOptions) {
|
|
33
33
|
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
34
34
|
}
|
|
35
|
+
if (options.useCmsPublishModeOptions) {
|
|
36
|
+
const opts = typeof options.useCmsPublishModeOptions === 'object'
|
|
37
|
+
? options.useCmsPublishModeOptions
|
|
38
|
+
: { write: true };
|
|
39
|
+
(0, commonOpts_1.addCmsPublishModeOptions)(yargs, opts);
|
|
40
|
+
}
|
|
35
41
|
const result = callback(yargs);
|
|
36
42
|
// Must go last to pick up available options
|
|
37
43
|
await (0, commonOpts_1.addCustomHelpOutput)(result, command, describe);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
4
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
const tools_1 = require("./tools");
|
|
6
|
+
const server = new mcp_js_1.McpServer({
|
|
7
|
+
name: 'HubSpot CLI MCP Server',
|
|
8
|
+
version: '0.0.1',
|
|
9
|
+
description: 'Helps perform tasks for local development of HubSpot projects.',
|
|
10
|
+
capabilities: {
|
|
11
|
+
tools: {},
|
|
12
|
+
prompts: {},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
(0, tools_1.registerProjectTools)(server);
|
|
16
|
+
// Start receiving messages on stdin and sending messages on stdout
|
|
17
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
18
|
+
server.connect(transport);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerProjectTools = registerProjectTools;
|
|
4
|
+
const UploadProjectTools_1 = require("./project/UploadProjectTools");
|
|
5
|
+
const CreateProjectTool_1 = require("./project/CreateProjectTool");
|
|
6
|
+
const GuidedWalkthroughTool_1 = require("./project/GuidedWalkthroughTool");
|
|
7
|
+
const DeployProject_1 = require("./project/DeployProject");
|
|
8
|
+
const AddFeatureToProject_1 = require("./project/AddFeatureToProject");
|
|
9
|
+
function registerProjectTools(mcpServer) {
|
|
10
|
+
return [
|
|
11
|
+
new UploadProjectTools_1.UploadProjectTools(mcpServer).register(),
|
|
12
|
+
new CreateProjectTool_1.CreateProjectTool(mcpServer).register(),
|
|
13
|
+
new GuidedWalkthroughTool_1.GuidedWalkthroughTool(mcpServer).register(),
|
|
14
|
+
new DeployProject_1.DeployProject(mcpServer).register(),
|
|
15
|
+
new AddFeatureToProject_1.AddFeatureToProject(mcpServer).register(),
|
|
16
|
+
];
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types';
|
|
2
|
+
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
absoluteProjectPath: z.ZodString;
|
|
6
|
+
addApp: z.ZodBoolean;
|
|
7
|
+
distribution: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"marketplace">, z.ZodLiteral<"private">]>>;
|
|
8
|
+
auth: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"oauth">]>>;
|
|
9
|
+
features: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"card">, z.ZodLiteral<"settings">, z.ZodLiteral<"app-function">, z.ZodLiteral<"webhooks">]>, "many">>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
absoluteProjectPath: string;
|
|
12
|
+
addApp: boolean;
|
|
13
|
+
auth?: "oauth" | "static" | undefined;
|
|
14
|
+
distribution?: "marketplace" | "private" | undefined;
|
|
15
|
+
features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
absoluteProjectPath: string;
|
|
18
|
+
addApp: boolean;
|
|
19
|
+
auth?: "oauth" | "static" | undefined;
|
|
20
|
+
distribution?: "marketplace" | "private" | undefined;
|
|
21
|
+
features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
24
|
+
export declare class AddFeatureToProject extends Tool<AddFeatureInputSchema> {
|
|
25
|
+
constructor(mcpServer: McpServer);
|
|
26
|
+
handler({ absoluteProjectPath, distribution, auth, features, addApp, }: AddFeatureInputSchema): Promise<TextContentResponse>;
|
|
27
|
+
register(): RegisteredTool;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddFeatureToProject = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const constants_1 = require("../../../lib/constants");
|
|
7
|
+
const command_1 = require("../../utils/command");
|
|
8
|
+
const constants_2 = require("./constants");
|
|
9
|
+
const project_1 = require("../../utils/project");
|
|
10
|
+
const content_1 = require("../../utils/content");
|
|
11
|
+
const inputSchema = {
|
|
12
|
+
absoluteProjectPath: constants_2.absoluteProjectPath,
|
|
13
|
+
addApp: zod_1.z
|
|
14
|
+
.boolean()
|
|
15
|
+
.describe('Should an app be added? If there is no app in the project, an app must be added to add a feature'),
|
|
16
|
+
distribution: zod_1.z
|
|
17
|
+
.optional(zod_1.z.union([
|
|
18
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE),
|
|
19
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.PRIVATE),
|
|
20
|
+
]))
|
|
21
|
+
.describe('Private is used if you do not wish to distribute your application on the HubSpot marketplace. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
22
|
+
auth: zod_1.z
|
|
23
|
+
.optional(zod_1.z.union([
|
|
24
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.STATIC),
|
|
25
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.OAUTH),
|
|
26
|
+
]))
|
|
27
|
+
.describe('Static uses a static non changing authentication token, and is only available for private distribution. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
28
|
+
features: zod_1.z
|
|
29
|
+
.array(zod_1.z
|
|
30
|
+
.union([
|
|
31
|
+
zod_1.z.literal('card'),
|
|
32
|
+
zod_1.z.literal('settings'),
|
|
33
|
+
zod_1.z.literal('app-function'),
|
|
34
|
+
zod_1.z.literal('webhooks'),
|
|
35
|
+
])
|
|
36
|
+
.describe('The features to include in the project, multiple options can be selected'))
|
|
37
|
+
.optional(),
|
|
38
|
+
};
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
+
const inputSchemaZodObject = zod_1.z.object({
|
|
41
|
+
...inputSchema,
|
|
42
|
+
});
|
|
43
|
+
class AddFeatureToProject extends types_1.Tool {
|
|
44
|
+
constructor(mcpServer) {
|
|
45
|
+
super(mcpServer);
|
|
46
|
+
}
|
|
47
|
+
async handler({ absoluteProjectPath, distribution, auth, features, addApp, }) {
|
|
48
|
+
try {
|
|
49
|
+
let command = `hs project add`;
|
|
50
|
+
const content = [];
|
|
51
|
+
if (distribution) {
|
|
52
|
+
command = (0, command_1.addFlag)(command, 'distribution', distribution);
|
|
53
|
+
}
|
|
54
|
+
else if (addApp) {
|
|
55
|
+
content.push((0, content_1.formatTextContent)(`Ask the user how they would you like to distribute the application. Options are ${constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${constants_1.APP_DISTRIBUTION_TYPES.PRIVATE}`));
|
|
56
|
+
}
|
|
57
|
+
if (auth) {
|
|
58
|
+
command = (0, command_1.addFlag)(command, 'auth', auth);
|
|
59
|
+
}
|
|
60
|
+
else if (addApp) {
|
|
61
|
+
content.push((0, content_1.formatTextContent)(`Ask the user which auth type they would like to use. Options are ${constants_1.APP_AUTH_TYPES.STATIC} and ${constants_1.APP_AUTH_TYPES.OAUTH}`));
|
|
62
|
+
}
|
|
63
|
+
if (content.length > 0) {
|
|
64
|
+
return {
|
|
65
|
+
content,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// If features isn't provided, pass an empty array to bypass the prompt
|
|
69
|
+
command = (0, command_1.addFlag)(command, 'features', features || []);
|
|
70
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, command);
|
|
71
|
+
return (0, content_1.formatTextContents)(stdout, stderr);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return (0, content_1.formatTextContents)(error instanceof Error ? error.message : `${error}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
register() {
|
|
78
|
+
return this.mcpServer.registerTool('add-feature-to-hubspot-project', {
|
|
79
|
+
title: 'Add feature to HubSpot Project',
|
|
80
|
+
description: 'Adds a feature to an existing HubSpot project',
|
|
81
|
+
inputSchema,
|
|
82
|
+
}, this.handler);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.AddFeatureToProject = AddFeatureToProject;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types';
|
|
2
|
+
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
destination: z.ZodString;
|
|
8
|
+
projectBase: z.ZodUnion<[z.ZodLiteral<"empty">, z.ZodLiteral<"app">]>;
|
|
9
|
+
distribution: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"marketplace">, z.ZodLiteral<"private">]>>;
|
|
10
|
+
auth: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"oauth">]>>>;
|
|
11
|
+
features: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"card">, z.ZodLiteral<"settings">, z.ZodLiteral<"app-function">, z.ZodLiteral<"webhooks">]>, "many">>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
name: string;
|
|
14
|
+
projectBase: "app" | "empty";
|
|
15
|
+
absoluteCurrentWorkingDirectory: string;
|
|
16
|
+
destination: string;
|
|
17
|
+
auth?: "oauth" | "static" | undefined;
|
|
18
|
+
distribution?: "marketplace" | "private" | undefined;
|
|
19
|
+
features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
name: string;
|
|
22
|
+
projectBase: "app" | "empty";
|
|
23
|
+
absoluteCurrentWorkingDirectory: string;
|
|
24
|
+
destination: string;
|
|
25
|
+
auth?: "oauth" | "static" | undefined;
|
|
26
|
+
distribution?: "marketplace" | "private" | undefined;
|
|
27
|
+
features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
30
|
+
export declare class CreateProjectTool extends Tool<CreateProjectInputSchema> {
|
|
31
|
+
constructor(mcpServer: McpServer);
|
|
32
|
+
handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema): Promise<TextContentResponse>;
|
|
33
|
+
register(): RegisteredTool;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateProjectTool = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const constants_1 = require("../../../lib/constants");
|
|
7
|
+
const command_1 = require("../../utils/command");
|
|
8
|
+
const v3_1 = require("../../../lib/projects/create/v3");
|
|
9
|
+
const constants_2 = require("./constants");
|
|
10
|
+
const project_1 = require("../../utils/project");
|
|
11
|
+
const content_1 = require("../../utils/content");
|
|
12
|
+
const inputSchema = {
|
|
13
|
+
absoluteCurrentWorkingDirectory: constants_2.absoluteCurrentWorkingDirectory,
|
|
14
|
+
name: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.describe('The name of the project to be created. This name is how your project will appear in HubSpot.'),
|
|
17
|
+
destination: zod_1.z
|
|
18
|
+
.string()
|
|
19
|
+
.describe('Relative path to the directory the project will be created in. DO NOT use the current directory unless the user has explicitly stated to do so.'),
|
|
20
|
+
projectBase: zod_1.z
|
|
21
|
+
.union([zod_1.z.literal(v3_1.EMPTY_PROJECT), zod_1.z.literal(v3_1.PROJECT_WITH_APP)])
|
|
22
|
+
.describe('Empty will create an empty project, and app will create a project with an app inside of it.'),
|
|
23
|
+
distribution: zod_1.z
|
|
24
|
+
.optional(zod_1.z.union([
|
|
25
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE),
|
|
26
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.PRIVATE),
|
|
27
|
+
]))
|
|
28
|
+
.describe('Private is used if you do not wish to distribute your application on the HubSpot marketplace. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
29
|
+
auth: zod_1.z
|
|
30
|
+
.optional(zod_1.z.union([
|
|
31
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.STATIC),
|
|
32
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.OAUTH),
|
|
33
|
+
]))
|
|
34
|
+
.describe('Static uses a static non changing authentication token, and is only available for private distribution. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.')
|
|
35
|
+
.optional(),
|
|
36
|
+
features: zod_1.z
|
|
37
|
+
.array(zod_1.z
|
|
38
|
+
.union([
|
|
39
|
+
zod_1.z.literal('card'),
|
|
40
|
+
zod_1.z.literal('settings'),
|
|
41
|
+
zod_1.z.literal('app-function'),
|
|
42
|
+
zod_1.z.literal('webhooks'),
|
|
43
|
+
])
|
|
44
|
+
.describe('The features to include in the project, multiple options can be selected'))
|
|
45
|
+
.optional(),
|
|
46
|
+
};
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
48
|
+
const inputSchemaZodObject = zod_1.z.object({ ...inputSchema });
|
|
49
|
+
class CreateProjectTool extends types_1.Tool {
|
|
50
|
+
constructor(mcpServer) {
|
|
51
|
+
super(mcpServer);
|
|
52
|
+
}
|
|
53
|
+
async handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }) {
|
|
54
|
+
let command = (0, command_1.addFlag)('hs project create', 'platform-version', '2025.2');
|
|
55
|
+
const content = [];
|
|
56
|
+
if (name) {
|
|
57
|
+
command = (0, command_1.addFlag)(command, 'name', name);
|
|
58
|
+
}
|
|
59
|
+
if (destination) {
|
|
60
|
+
command = (0, command_1.addFlag)(command, 'dest', destination);
|
|
61
|
+
}
|
|
62
|
+
if (projectBase) {
|
|
63
|
+
command = (0, command_1.addFlag)(command, 'project-base', projectBase);
|
|
64
|
+
}
|
|
65
|
+
if (distribution) {
|
|
66
|
+
command = (0, command_1.addFlag)(command, 'distribution', distribution);
|
|
67
|
+
}
|
|
68
|
+
else if (projectBase === v3_1.PROJECT_WITH_APP) {
|
|
69
|
+
content.push((0, content_1.formatTextContent)(`Ask the user how they would you like to distribute the application? Options are ${constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${constants_1.APP_DISTRIBUTION_TYPES.PRIVATE}`));
|
|
70
|
+
}
|
|
71
|
+
if (auth) {
|
|
72
|
+
command = (0, command_1.addFlag)(command, 'auth', auth);
|
|
73
|
+
}
|
|
74
|
+
else if (projectBase === v3_1.PROJECT_WITH_APP) {
|
|
75
|
+
content.push((0, content_1.formatTextContent)(`Ask the user which auth type they would like to use? Options are ${constants_1.APP_AUTH_TYPES.STATIC} and ${constants_1.APP_AUTH_TYPES.OAUTH}`));
|
|
76
|
+
}
|
|
77
|
+
if (content.length > 0) {
|
|
78
|
+
return {
|
|
79
|
+
content,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// Always pass features, even if it is an empty array to bypass the prompts
|
|
83
|
+
command = (0, command_1.addFlag)(command, 'features', features || []);
|
|
84
|
+
try {
|
|
85
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteCurrentWorkingDirectory, command);
|
|
86
|
+
return (0, content_1.formatTextContents)(stdout, stderr);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return (0, content_1.formatTextContents)(error instanceof Error ? error.message : `${error}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
register() {
|
|
93
|
+
return this.mcpServer.registerTool('create-hubspot-project', {
|
|
94
|
+
title: 'Create HubSpot Project',
|
|
95
|
+
description: 'Creates a HubSpot project with the provided name and outputs it in the provided destination',
|
|
96
|
+
inputSchema,
|
|
97
|
+
}, this.handler);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.CreateProjectTool = CreateProjectTool;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types';
|
|
2
|
+
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
absoluteProjectPath: z.ZodString;
|
|
6
|
+
buildNumber: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
absoluteProjectPath: string;
|
|
9
|
+
buildNumber?: number | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
absoluteProjectPath: string;
|
|
12
|
+
buildNumber?: number | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
15
|
+
export declare class DeployProject extends Tool<InputSchemaType> {
|
|
16
|
+
constructor(mcpServer: McpServer);
|
|
17
|
+
handler({ absoluteProjectPath, buildNumber, }: InputSchemaType): Promise<TextContentResponse>;
|
|
18
|
+
register(): RegisteredTool;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeployProject = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const command_1 = require("../../utils/command");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const project_1 = require("../../utils/project");
|
|
9
|
+
const content_1 = require("../../utils/content");
|
|
10
|
+
const inputSchema = {
|
|
11
|
+
absoluteProjectPath: constants_1.absoluteProjectPath,
|
|
12
|
+
buildNumber: zod_1.z
|
|
13
|
+
.optional(zod_1.z.number())
|
|
14
|
+
.describe('The build number to be deployed. This can be found in the project details page using `hs project open`. If no build number is specified, the most recent build is deployed'),
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
+
const inputSchemaZodObject = zod_1.z.object({
|
|
18
|
+
...inputSchema,
|
|
19
|
+
});
|
|
20
|
+
class DeployProject extends types_1.Tool {
|
|
21
|
+
constructor(mcpServer) {
|
|
22
|
+
super(mcpServer);
|
|
23
|
+
}
|
|
24
|
+
async handler({ absoluteProjectPath, buildNumber, }) {
|
|
25
|
+
let command = `hs project deploy`;
|
|
26
|
+
const content = [];
|
|
27
|
+
if (!buildNumber) {
|
|
28
|
+
const { stdout } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project list-builds --limit 100`);
|
|
29
|
+
content.push((0, content_1.formatTextContent)(`Ask the user which build number they would like to deploy? Build information: ${stdout}`));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
command = (0, command_1.addFlag)(command, 'build', buildNumber);
|
|
33
|
+
}
|
|
34
|
+
if (content.length) {
|
|
35
|
+
return {
|
|
36
|
+
content,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, command);
|
|
40
|
+
return (0, content_1.formatTextContents)(stdout, stderr);
|
|
41
|
+
}
|
|
42
|
+
register() {
|
|
43
|
+
return this.mcpServer.registerTool('deploy-hubspot-project', {
|
|
44
|
+
title: 'Deploy a build of HubSpot Project',
|
|
45
|
+
description: 'Takes a build number and a project name and deploys that build of the project',
|
|
46
|
+
inputSchema,
|
|
47
|
+
}, this.handler);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.DeployProject = DeployProject;
|