@hubspot/cli 7.8.12-experimental.0 → 7.9.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/cms.test.js +44 -1
- package/commands/__tests__/customObject.test.js +22 -1
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/__tests__/project.test.js +2 -0
- package/commands/account/auth.js +1 -0
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/app.js +1 -6
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +17 -7
- package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
- package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
- package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +82 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +79 -0
- package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +60 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +135 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +45 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +17 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
- package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +46 -0
- package/commands/cms/theme/preview.d.ts +12 -0
- package/commands/cms/theme/preview.js +224 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +14 -0
- package/commands/cms/watch.js +138 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.js +28 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +6 -4
- package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +56 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/schema/create.d.ts +4 -6
- package/commands/customObject/schema/create.js +13 -38
- package/commands/customObject/schema/delete.d.ts +4 -7
- package/commands/customObject/schema/delete.js +15 -50
- package/commands/customObject/schema/fetch-all.d.ts +4 -6
- package/commands/customObject/schema/fetch-all.js +14 -40
- package/commands/customObject/schema/fetch.d.ts +4 -7
- package/commands/customObject/schema/fetch.js +14 -49
- package/commands/customObject/schema/list.d.ts +4 -4
- package/commands/customObject/schema/list.js +10 -19
- package/commands/customObject/schema/update.d.ts +4 -7
- package/commands/customObject/schema/update.js +15 -50
- package/commands/customObject/schema.js +5 -3
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +71 -0
- package/commands/customObject.js +22 -8
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +7 -12
- package/commands/fetch.d.ts +4 -12
- package/commands/fetch.js +20 -47
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.d.ts +4 -6
- package/commands/function/deploy.js +14 -89
- package/commands/function/list.d.ts +4 -6
- package/commands/function/list.js +14 -40
- package/commands/function/server.d.ts +4 -10
- package/commands/function/server.js +22 -31
- package/commands/function.d.ts +2 -4
- package/commands/function.js +25 -14
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.d.ts +4 -6
- package/commands/lint.js +13 -65
- package/commands/list.d.ts +4 -6
- package/commands/list.js +14 -81
- package/commands/logs.d.ts +4 -10
- package/commands/logs.js +25 -94
- package/commands/module/marketplace-validate.d.ts +4 -6
- package/commands/module/marketplace-validate.js +15 -27
- package/commands/module.d.ts +2 -2
- package/commands/module.js +17 -15
- package/commands/mv.d.ts +4 -7
- package/commands/mv.js +14 -51
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +15 -13
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +6 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +6 -5
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +1 -2
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +9 -18
- package/commands/project/dev/index.js +19 -17
- package/commands/project/dev/unifiedFlow.js +11 -4
- package/commands/project/download.js +15 -15
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +9 -8
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +5 -2
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.d.ts +2 -2
- package/commands/project/upload.js +17 -26
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +4 -6
- package/commands/remove.js +12 -24
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/create.js +2 -5
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/generate-selectors.d.ts +4 -6
- package/commands/theme/generate-selectors.js +14 -152
- package/commands/theme/marketplace-validate.d.ts +4 -6
- package/commands/theme/marketplace-validate.js +14 -25
- package/commands/theme/preview.d.ts +4 -12
- package/commands/theme/preview.js +18 -183
- package/commands/theme.d.ts +2 -2
- package/commands/theme.js +19 -13
- package/commands/upload.d.ts +4 -12
- package/commands/upload.js +19 -169
- package/commands/watch.d.ts +4 -14
- package/commands/watch.js +23 -88
- package/lang/en.d.ts +863 -542
- package/lang/en.js +912 -595
- package/lang/en.lyaml +4 -4
- package/lib/__tests__/buildAccount.test.js +4 -3
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +32 -64
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configMigrate.js +88 -9
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +15 -1
- package/lib/constants.js +19 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/generateSelectors.js +1 -1
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
- package/lib/middleware/autoUpdateMiddleware.js +12 -2
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +74 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projectProfiles.d.ts +1 -1
- package/lib/projectProfiles.js +2 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +101 -135
- package/lib/projects/__tests__/DevServerManager.test.js +183 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +76 -45
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
- package/lib/projects/__tests__/deploy.test.js +9 -9
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +39 -39
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +3 -3
- package/lib/projects/create/index.js +4 -4
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +5 -5
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +11 -3
- package/lib/projects/localDev/AppDevModeInterface.js +128 -115
- package/lib/projects/localDev/DevServerManager.d.ts +10 -29
- package/lib/projects/localDev/DevServerManager.js +20 -76
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +10 -11
- package/lib/projects/localDev/LocalDevProcess.js +3 -2
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +46 -16
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +15 -0
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +39 -3
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +2 -3
- package/lib/projects/upload.js +17 -9
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +7 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +6 -6
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +6 -0
- package/lib/ui/index.js +55 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +73 -0
- package/lib/ui/uiMessages.js +76 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +8 -7
- package/types/Cms.d.ts +6 -6
- package/types/Yargs.d.ts +1 -1
- package/commands/app/__tests__/install.test.js +0 -47
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -122
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
- /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
- /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
- /package/commands/{app/__tests__/install.test.d.ts → customObject/__tests__/deleteSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
- /package/commands/{customObject/schema/__tests__/update.test.d.ts → project/__tests__/list.test.d.ts} +0 -0
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
- /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/function.js +0 -0
- /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/index.js +0 -0
- /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/module.js +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/template.js +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
- /package/lib/{projects/add/__tests__/v3AddComponent.test.d.ts → middleware/__test__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/projects/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lib/ui/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
3
|
-
import {
|
|
2
|
+
import { getAccountConfig, configFileExists, } from '@hubspot/local-dev-lib/config';
|
|
3
|
+
import { uiLogger } from './logger.js';
|
|
4
4
|
import { supportsHyperlinkModule } from './supportHyperlinks.js';
|
|
5
5
|
import { supportsColor } from './supportsColor.js';
|
|
6
|
-
import {
|
|
6
|
+
import { uiMessages } from './uiMessages.js';
|
|
7
7
|
import { HUBSPOT_ACCOUNT_TYPE_STRINGS } from '@hubspot/local-dev-lib/constants/config';
|
|
8
8
|
export const UI_COLORS = {
|
|
9
9
|
SORBET: '#FF8F59',
|
|
@@ -11,7 +11,7 @@ export const UI_COLORS = {
|
|
|
11
11
|
MARIGOLD_DARK: '#dbae60',
|
|
12
12
|
};
|
|
13
13
|
export function uiLine() {
|
|
14
|
-
|
|
14
|
+
uiLogger.log('-'.repeat(50));
|
|
15
15
|
}
|
|
16
16
|
export function getTerminalUISupport() {
|
|
17
17
|
return {
|
|
@@ -50,10 +50,10 @@ export function uiAccountDescription(accountId, bold = true) {
|
|
|
50
50
|
}
|
|
51
51
|
export function uiInfoSection(title, logContent) {
|
|
52
52
|
uiLine();
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
uiLogger.log(chalk.bold(title));
|
|
54
|
+
uiLogger.log('');
|
|
55
55
|
logContent();
|
|
56
|
-
|
|
56
|
+
uiLogger.log('');
|
|
57
57
|
uiLine();
|
|
58
58
|
}
|
|
59
59
|
export function uiCommandReference(command, withQuotes = true) {
|
|
@@ -63,66 +63,83 @@ export function uiCommandReference(command, withQuotes = true) {
|
|
|
63
63
|
? chalk.hex(UI_COLORS.MARIGOLD_DARK)(commandReference)
|
|
64
64
|
: commandReference);
|
|
65
65
|
}
|
|
66
|
+
export function uiAuthCommandReference({ accountId, qa, } = {}) {
|
|
67
|
+
const userIsUsingGlobalConfig = configFileExists(true);
|
|
68
|
+
let command = 'hs auth';
|
|
69
|
+
if (userIsUsingGlobalConfig) {
|
|
70
|
+
command = 'hs account auth';
|
|
71
|
+
}
|
|
72
|
+
return uiCommandReference(`${command}${accountId ? ` --account=${accountId}` : ''}${qa ? ' --qa' : ''}`);
|
|
73
|
+
}
|
|
66
74
|
export function uiFeatureHighlight(features, title) {
|
|
67
|
-
uiInfoSection(title ? title :
|
|
75
|
+
uiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
|
|
68
76
|
features.forEach(feature => {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
77
|
+
const featureConfig = uiMessages.featureHighlight.featureKeys[feature];
|
|
78
|
+
if (!featureConfig) {
|
|
79
|
+
uiLogger.debug(`Feature config not found for: ${feature}`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
let message;
|
|
83
|
+
if ('linkText' in featureConfig && 'url' in featureConfig) {
|
|
84
|
+
// linkText + url (for sampleProjects)
|
|
85
|
+
message = featureConfig.message(uiLink(featureConfig.linkText, featureConfig.url));
|
|
86
|
+
}
|
|
87
|
+
else if ('command' in featureConfig && 'message' in featureConfig) {
|
|
88
|
+
// Command + Message function (most cases)
|
|
89
|
+
message = featureConfig.message(uiCommandReference(featureConfig.command));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Message only (for projectCommandTip)
|
|
93
|
+
message = featureConfig.message;
|
|
94
|
+
}
|
|
95
|
+
uiLogger.log(` - ${message}`);
|
|
75
96
|
});
|
|
76
97
|
});
|
|
77
98
|
}
|
|
78
99
|
export function uiBetaTag(message, log = true) {
|
|
79
|
-
const tag =
|
|
100
|
+
const tag = uiMessages.betaTag;
|
|
80
101
|
const result = `${tag} ${message}`;
|
|
81
102
|
if (log) {
|
|
82
|
-
|
|
103
|
+
uiLogger.log(result);
|
|
83
104
|
return;
|
|
84
105
|
}
|
|
85
106
|
return result;
|
|
86
107
|
}
|
|
87
108
|
export function uiDeprecatedTag(message, log = true) {
|
|
88
|
-
const tag =
|
|
109
|
+
const tag = uiMessages.deprecatedTag;
|
|
89
110
|
const result = `${tag} ${message}`;
|
|
90
111
|
if (log) {
|
|
91
|
-
|
|
112
|
+
uiLogger.log(result);
|
|
92
113
|
return;
|
|
93
114
|
}
|
|
94
115
|
return result;
|
|
95
116
|
}
|
|
96
117
|
export function uiCommandDisabledBanner(command, url, message) {
|
|
97
118
|
const tag = message ||
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
url: url ? uiLink(i18n(`lib.ui.disabledUrlText`), url) : '',
|
|
101
|
-
npmCommand: uiCommandReference('npm i -g @hubspot/cli@latest'),
|
|
102
|
-
});
|
|
103
|
-
logger.log();
|
|
119
|
+
`The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('See all HubSpot CLI commands here.', url) : ''}`;
|
|
120
|
+
uiLogger.log('');
|
|
104
121
|
uiLine();
|
|
105
|
-
|
|
122
|
+
uiLogger.error(tag);
|
|
106
123
|
uiLine();
|
|
107
|
-
|
|
124
|
+
uiLogger.log('');
|
|
108
125
|
}
|
|
109
126
|
export function uiDeprecatedDescription(message, command, url) {
|
|
110
|
-
const tag =
|
|
111
|
-
message,
|
|
112
|
-
command: uiCommandReference(command),
|
|
113
|
-
url: url ? uiLink(i18n(`lib.ui.deprecatedUrlText`), url) : '',
|
|
114
|
-
});
|
|
127
|
+
const tag = message || uiMessages.disabledMessage(command, url);
|
|
115
128
|
return uiDeprecatedTag(tag);
|
|
116
129
|
}
|
|
130
|
+
export function uiCommandRenamedDescription(describe, newCommand) {
|
|
131
|
+
return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedMessage(newCommand)}`, false);
|
|
132
|
+
}
|
|
117
133
|
export function uiDeprecatedMessage(command, url, message) {
|
|
118
|
-
const tag = message ||
|
|
119
|
-
|
|
120
|
-
command: uiCommandReference(command),
|
|
121
|
-
url: url ? uiLink(i18n(`lib.ui.deprecatedUrlText`), url) : '',
|
|
122
|
-
});
|
|
123
|
-
logger.log();
|
|
134
|
+
const tag = uiMessages.deprecatedDescription(message || '', command, url);
|
|
135
|
+
uiLogger.log('');
|
|
124
136
|
uiDeprecatedTag(tag);
|
|
125
|
-
|
|
137
|
+
uiLogger.log('');
|
|
138
|
+
}
|
|
139
|
+
export function uiCommandRelocatedMessage(newCommand) {
|
|
140
|
+
uiLogger.log('');
|
|
141
|
+
uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand));
|
|
142
|
+
uiLogger.log('');
|
|
126
143
|
}
|
|
127
144
|
export function indent(level) {
|
|
128
145
|
const indentation = ' ';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Styles } from '@hubspot/local-dev-lib/logger';
|
|
4
|
+
import { uiLogger } from './logger.js';
|
|
5
|
+
import { lib } from '../../lang/en.js';
|
|
5
6
|
const SEPARATOR = ' - ';
|
|
6
7
|
const LOG_STATUS_COLORS = {
|
|
7
8
|
SUCCESS: Styles.success,
|
|
@@ -56,9 +57,7 @@ function processLog(log, options) {
|
|
|
56
57
|
return logHandler[log.status](log, options);
|
|
57
58
|
}
|
|
58
59
|
catch (e) {
|
|
59
|
-
|
|
60
|
-
log: JSON.stringify(log),
|
|
61
|
-
}));
|
|
60
|
+
uiLogger.error(lib.ui.serverlessFunctionLogs.unableToProcessLog(JSON.stringify(log)));
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
function isLogsResponse(logsResp) {
|
|
@@ -70,7 +69,7 @@ function isLogsResponse(logsResp) {
|
|
|
70
69
|
function processLogs(logsResp, options) {
|
|
71
70
|
const isLogsResp = isLogsResponse(logsResp);
|
|
72
71
|
if (!logsResp || (isLogsResp && logsResp.results.length === 0)) {
|
|
73
|
-
return
|
|
72
|
+
return lib.ui.serverlessFunctionLogs.noLogsFound;
|
|
74
73
|
}
|
|
75
74
|
else if (isLogsResp) {
|
|
76
75
|
return logsResp
|
|
@@ -82,5 +81,8 @@ function processLogs(logsResp, options) {
|
|
|
82
81
|
return processLog(logsResp, options);
|
|
83
82
|
}
|
|
84
83
|
export function outputLogs(logsResp, options) {
|
|
85
|
-
|
|
84
|
+
const result = processLogs(logsResp, options);
|
|
85
|
+
if (result) {
|
|
86
|
+
uiLogger.log(result);
|
|
87
|
+
}
|
|
86
88
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export declare const uiMessages: {
|
|
2
|
+
betaTag: string;
|
|
3
|
+
deprecatedTag: string;
|
|
4
|
+
deprecatedDescription: (message: string, command: string, url?: string) => string;
|
|
5
|
+
disabledMessage: (command: string, url?: string) => string;
|
|
6
|
+
disabledUrlText: string;
|
|
7
|
+
commandRenamedMessage: (newCommand: string) => string;
|
|
8
|
+
featureHighlight: {
|
|
9
|
+
defaultTitle: string;
|
|
10
|
+
featureKeys: {
|
|
11
|
+
accountOption: {
|
|
12
|
+
command: string;
|
|
13
|
+
message: (command: string) => string;
|
|
14
|
+
};
|
|
15
|
+
accountsListCommand: {
|
|
16
|
+
command: string;
|
|
17
|
+
message: (command: string) => string;
|
|
18
|
+
};
|
|
19
|
+
accountsUseCommand: {
|
|
20
|
+
command: string;
|
|
21
|
+
message: (command: string) => string;
|
|
22
|
+
};
|
|
23
|
+
authCommand: {
|
|
24
|
+
command: string;
|
|
25
|
+
message: (command: string) => string;
|
|
26
|
+
};
|
|
27
|
+
feedbackCommand: {
|
|
28
|
+
command: string;
|
|
29
|
+
message: (command: string) => string;
|
|
30
|
+
};
|
|
31
|
+
getStartedCommand: {
|
|
32
|
+
command: string;
|
|
33
|
+
message: (command: string) => string;
|
|
34
|
+
};
|
|
35
|
+
helpCommand: {
|
|
36
|
+
command: string;
|
|
37
|
+
message: (command: string) => string;
|
|
38
|
+
};
|
|
39
|
+
projectCreateCommand: {
|
|
40
|
+
command: string;
|
|
41
|
+
message: (command: string) => string;
|
|
42
|
+
};
|
|
43
|
+
projectDeployCommand: {
|
|
44
|
+
command: string;
|
|
45
|
+
message: (command: string) => string;
|
|
46
|
+
};
|
|
47
|
+
projectHelpCommand: {
|
|
48
|
+
command: string;
|
|
49
|
+
message: (command: string) => string;
|
|
50
|
+
};
|
|
51
|
+
projectUploadCommand: {
|
|
52
|
+
command: string;
|
|
53
|
+
message: (command: string) => string;
|
|
54
|
+
};
|
|
55
|
+
projectDevCommand: {
|
|
56
|
+
command: string;
|
|
57
|
+
message: (command: string) => string;
|
|
58
|
+
};
|
|
59
|
+
projectInstallDepsCommand: {
|
|
60
|
+
command: string;
|
|
61
|
+
message: (command: string) => string;
|
|
62
|
+
};
|
|
63
|
+
projectCommandTip: {
|
|
64
|
+
message: string;
|
|
65
|
+
};
|
|
66
|
+
sampleProjects: {
|
|
67
|
+
linkText: string;
|
|
68
|
+
url: string;
|
|
69
|
+
message: (link: string) => string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// UI messages for the UI module - separate file to avoid circular imports with lang/en.ts
|
|
2
|
+
// This contains the same strings that would be in lib.ui.* from lang/en.ts
|
|
3
|
+
import { uiCommandReference, uiLink } from './index.js';
|
|
4
|
+
export const uiMessages = {
|
|
5
|
+
betaTag: '[BETA]',
|
|
6
|
+
deprecatedTag: '[DEPRECATED]',
|
|
7
|
+
deprecatedDescription: (message, command, url) => `${message}. The ${uiCommandReference(command)} command is deprecated and will be disabled soon. ${url ? uiLink('Learn more', url) : ''}`,
|
|
8
|
+
disabledMessage: (command, url) => `The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('Learn more', url) : ''}`,
|
|
9
|
+
disabledUrlText: 'See all HubSpot CLI commands here.',
|
|
10
|
+
commandRenamedMessage: (newCommand) => `This command has been deprecated. Please use ${uiCommandReference(newCommand)} instead.`,
|
|
11
|
+
featureHighlight: {
|
|
12
|
+
defaultTitle: "What's next?",
|
|
13
|
+
featureKeys: {
|
|
14
|
+
accountOption: {
|
|
15
|
+
command: '--account',
|
|
16
|
+
message: (command) => `Use the ${command} option with any command to override the default account`,
|
|
17
|
+
},
|
|
18
|
+
accountsListCommand: {
|
|
19
|
+
command: 'hs accounts list',
|
|
20
|
+
message: (command) => `${command} - See a list of configured HubSpot accounts`,
|
|
21
|
+
},
|
|
22
|
+
accountsUseCommand: {
|
|
23
|
+
command: 'hs accounts use',
|
|
24
|
+
message: (command) => `${command} - Set the Hubspot account that the CLI will target by default`,
|
|
25
|
+
},
|
|
26
|
+
authCommand: {
|
|
27
|
+
command: 'hs auth',
|
|
28
|
+
message: (command) => `${command} - Connect the CLI to additional HubSpot accounts`,
|
|
29
|
+
},
|
|
30
|
+
feedbackCommand: {
|
|
31
|
+
command: 'hs feedback',
|
|
32
|
+
message: (command) => `${command} - Report a bug or leave feedback`,
|
|
33
|
+
},
|
|
34
|
+
getStartedCommand: {
|
|
35
|
+
command: 'hs get-started',
|
|
36
|
+
message: (command) => `${command} - Get started with HubSpot development`,
|
|
37
|
+
},
|
|
38
|
+
helpCommand: {
|
|
39
|
+
command: 'hs help',
|
|
40
|
+
message: (command) => `${command} - See a list of available commands`,
|
|
41
|
+
},
|
|
42
|
+
projectCreateCommand: {
|
|
43
|
+
command: 'hs project create',
|
|
44
|
+
message: (command) => `${command} - Create a new project`,
|
|
45
|
+
},
|
|
46
|
+
projectDeployCommand: {
|
|
47
|
+
command: 'hs project deploy',
|
|
48
|
+
message: (command) => `Ready to take your project live? Run ${command}`,
|
|
49
|
+
},
|
|
50
|
+
projectHelpCommand: {
|
|
51
|
+
command: 'hs project --help',
|
|
52
|
+
message: (command) => `${command} - Learn more about available project commands`,
|
|
53
|
+
},
|
|
54
|
+
projectUploadCommand: {
|
|
55
|
+
command: 'hs project upload',
|
|
56
|
+
message: (command) => `${command} - Upload your project to HubSpot and trigger builds`,
|
|
57
|
+
},
|
|
58
|
+
projectDevCommand: {
|
|
59
|
+
command: 'hs project dev',
|
|
60
|
+
message: (command) => `${command} - Set up a test environment and start local development`,
|
|
61
|
+
},
|
|
62
|
+
projectInstallDepsCommand: {
|
|
63
|
+
command: 'hs project install-deps',
|
|
64
|
+
message: (command) => `${command} - Install all project dependencies`,
|
|
65
|
+
},
|
|
66
|
+
projectCommandTip: {
|
|
67
|
+
message: 'Tip: All project commands must be run from within a project directory',
|
|
68
|
+
},
|
|
69
|
+
sampleProjects: {
|
|
70
|
+
linkText: "HubSpot's sample projects",
|
|
71
|
+
url: 'https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next',
|
|
72
|
+
message: (link) => `See ${link}`,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
package/lib/usageTracking.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { trackUsage } from '@hubspot/local-dev-lib/trackUsage';
|
|
2
2
|
import { isTrackingAllowed, getAccountConfig, } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { API_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
|
|
4
|
-
import {
|
|
4
|
+
import { uiLogger } from './ui/logger.js';
|
|
5
5
|
import packageJson from '../package.json' with { type: 'json' };
|
|
6
6
|
const version = packageJson.version;
|
|
7
7
|
import { debugError } from './errorHandlers/index.js';
|
|
@@ -31,7 +31,7 @@ export async function trackCommandUsage(command, meta = {}, accountId) {
|
|
|
31
31
|
if (!isTrackingAllowed()) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
uiLogger.debug(`Attempting to track usage of "${command}" command`);
|
|
35
35
|
let authType = 'unknown';
|
|
36
36
|
if (accountId) {
|
|
37
37
|
const accountConfig = getAccountConfig(accountId);
|
|
@@ -53,10 +53,10 @@ export async function trackHelpUsage(command) {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
if (command) {
|
|
56
|
-
|
|
56
|
+
uiLogger.debug(`Tracking help usage of "${command}" sub-command`);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
|
|
59
|
+
uiLogger.debug('Tracking help usage of main command');
|
|
60
60
|
}
|
|
61
61
|
return trackCliInteraction({
|
|
62
62
|
action: 'cli-help',
|
|
@@ -84,7 +84,7 @@ export async function trackCommandMetadataUsage(command, meta = {}, accountId) {
|
|
|
84
84
|
if (!isTrackingAllowed()) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
uiLogger.debug(`Attempting to track metadata usage of "${command}" command`);
|
|
88
88
|
let authType = 'unknown';
|
|
89
89
|
if (accountId) {
|
|
90
90
|
const accountConfig = getAccountConfig(accountId);
|
|
@@ -122,7 +122,7 @@ async function trackCliInteraction({ action, accountId, command, authType, meta
|
|
|
122
122
|
action: 'cli-mcp-server',
|
|
123
123
|
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
124
124
|
}, accountId);
|
|
125
|
-
|
|
125
|
+
uiLogger.debug('Sent AI usage tracking command event:', {
|
|
126
126
|
...usageTrackingEvent,
|
|
127
127
|
action: 'cli-mcp-server',
|
|
128
128
|
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
@@ -133,7 +133,7 @@ async function trackCliInteraction({ action, accountId, command, authType, meta
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
try {
|
|
136
|
-
|
|
136
|
+
uiLogger.debug('Sent usage tracking command event:', usageTrackingEvent);
|
|
137
137
|
return trackUsage('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
|
|
138
138
|
}
|
|
139
139
|
catch (error) {
|
package/lib/validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from '../lib/ui/logger.js';
|
|
4
4
|
import { CMS_PUBLISH_MODE } from '@hubspot/local-dev-lib/constants/files';
|
|
5
5
|
import { API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
|
|
6
6
|
import { commaSeparatedValues } from '@hubspot/local-dev-lib/text';
|
|
@@ -10,43 +10,43 @@ import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personal
|
|
|
10
10
|
import { getAbsoluteFilePath, getCwd, getExt, } from '@hubspot/local-dev-lib/path';
|
|
11
11
|
import { getCmsPublishMode } from './commonOpts.js';
|
|
12
12
|
import { logError } from './errorHandlers/index.js';
|
|
13
|
+
import { lib } from '../lang/en.js';
|
|
13
14
|
export async function validateAccount(options) {
|
|
14
15
|
const { derivedAccountId, userProvidedAccount } = options;
|
|
15
16
|
const accountId = getAccountId(derivedAccountId);
|
|
16
17
|
if (!accountId) {
|
|
17
18
|
if (userProvidedAccount) {
|
|
18
|
-
|
|
19
|
+
uiLogger.error(lib.validation.accountNotFoundInConfig(userProvidedAccount));
|
|
19
20
|
}
|
|
20
21
|
else {
|
|
21
|
-
|
|
22
|
+
uiLogger.error(lib.validation.accountRequired);
|
|
22
23
|
}
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
25
26
|
if (userProvidedAccount && loadConfigFromEnvironment()) {
|
|
26
|
-
throw new Error(
|
|
27
|
+
throw new Error(lib.validation.userProvidedAccount);
|
|
27
28
|
}
|
|
28
29
|
const accountConfig = getAccountConfig(accountId);
|
|
29
30
|
if (!accountConfig) {
|
|
30
|
-
|
|
31
|
+
uiLogger.error(lib.validation.accountNotConfigured(accountId));
|
|
31
32
|
return false;
|
|
32
33
|
}
|
|
33
34
|
const { authType, auth, apiKey, personalAccessKey } = accountConfig;
|
|
34
35
|
if (typeof authType === 'string' && authType !== authType.toLowerCase()) {
|
|
35
|
-
|
|
36
|
+
uiLogger.error(lib.validation.invalidAuthType(authType, accountId, getConfigPath() || '', commaSeparatedValues([
|
|
36
37
|
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
37
38
|
OAUTH_AUTH_METHOD,
|
|
38
39
|
API_KEY_AUTH_METHOD,
|
|
39
|
-
].map(method => method.value))
|
|
40
|
+
].map(method => method.value))));
|
|
40
41
|
}
|
|
41
42
|
if (authType === 'oauth2') {
|
|
42
43
|
if (typeof auth !== 'object') {
|
|
43
|
-
|
|
44
|
+
uiLogger.error(lib.validation.oauth2ConfigMissing(accountId));
|
|
44
45
|
return false;
|
|
45
46
|
}
|
|
46
47
|
const { clientId, clientSecret, tokenInfo } = auth;
|
|
47
48
|
if (!clientId || !clientSecret || !tokenInfo || !tokenInfo.refreshToken) {
|
|
48
|
-
|
|
49
|
-
logger.error('Run "hs auth --type=oauth2" to reauthenticate');
|
|
49
|
+
uiLogger.error(lib.validation.oauth2ConfigIncorrect(accountId));
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
52
|
const oauth = getOauthManager(accountId, accountConfig);
|
|
@@ -56,7 +56,7 @@ export async function validateAccount(options) {
|
|
|
56
56
|
accessToken = await oauth.accessToken();
|
|
57
57
|
}
|
|
58
58
|
if (!accessToken) {
|
|
59
|
-
|
|
59
|
+
uiLogger.error(lib.validation.oauth2AccessTokenNotFound(accountId));
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -67,13 +67,13 @@ export async function validateAccount(options) {
|
|
|
67
67
|
}
|
|
68
68
|
else if (authType === 'personalaccesskey') {
|
|
69
69
|
if (!personalAccessKey) {
|
|
70
|
-
|
|
70
|
+
uiLogger.error(lib.validation.personalAccessKeyMissing(accountId));
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
try {
|
|
74
74
|
const accessToken = await accessTokenForPersonalAccessKey(accountId);
|
|
75
75
|
if (!accessToken) {
|
|
76
|
-
|
|
76
|
+
uiLogger.error(lib.validation.personalAccessKeyTokenRetrievalFailed(accountId));
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -83,7 +83,7 @@ export async function validateAccount(options) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
else if (!apiKey) {
|
|
86
|
-
|
|
86
|
+
uiLogger.error(lib.validation.authConfigurationMissing(accountId));
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
return true;
|
|
@@ -93,15 +93,12 @@ export function validateCmsPublishMode(options) {
|
|
|
93
93
|
if (CMS_PUBLISH_MODE[cmsPublishMode]) {
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
|
-
const modesMessage =
|
|
96
|
+
const modesMessage = lib.validation.availableCMSModes(Object.values(CMS_PUBLISH_MODE).join(', '));
|
|
97
97
|
if (cmsPublishMode != null) {
|
|
98
|
-
|
|
99
|
-
`The CMS publish mode "${cmsPublishMode}" is invalid.`,
|
|
100
|
-
modesMessage,
|
|
101
|
-
].join(' '));
|
|
98
|
+
uiLogger.error(lib.validation.invalidCmsPublishMode(cmsPublishMode, modesMessage));
|
|
102
99
|
}
|
|
103
100
|
else {
|
|
104
|
-
|
|
101
|
+
uiLogger.error(lib.validation.missingCmsPublishMode(modesMessage));
|
|
105
102
|
}
|
|
106
103
|
return false;
|
|
107
104
|
}
|
|
@@ -124,11 +121,11 @@ export function fileExists(_path) {
|
|
|
124
121
|
export function checkAndConvertToJson(_path) {
|
|
125
122
|
const filePath = getAbsoluteFilePath(_path);
|
|
126
123
|
if (!fileExists(filePath)) {
|
|
127
|
-
|
|
124
|
+
uiLogger.error(lib.validation.pathNotFile(_path));
|
|
128
125
|
return null;
|
|
129
126
|
}
|
|
130
127
|
if (getExt(_path) !== 'json') {
|
|
131
|
-
|
|
128
|
+
uiLogger.error(lib.validation.fileNotJson(_path));
|
|
132
129
|
return null;
|
|
133
130
|
}
|
|
134
131
|
let result;
|
|
@@ -136,7 +133,7 @@ export function checkAndConvertToJson(_path) {
|
|
|
136
133
|
result = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
137
134
|
}
|
|
138
135
|
catch (e) {
|
|
139
|
-
|
|
136
|
+
uiLogger.error(lib.validation.fileInvalidJson(_path));
|
|
140
137
|
result = null;
|
|
141
138
|
}
|
|
142
139
|
return result;
|
package/lib/yargsUtils.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>,
|
|
|
13
13
|
};
|
|
14
14
|
useJSONOutputOptions?: boolean;
|
|
15
15
|
}): (yargs: Argv) => Promise<Argv<T>>;
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function strictEnforceBoolean(rawArgs: string[], booleanOptions: string[]): boolean;
|
package/lib/yargsUtils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addCustomHelpOutput, addTestingOptions, addAccountOptions, addConfigOptions, addGlobalOptions, addUseEnvironmentOptions, addCmsPublishModeOptions, addJSONOutputOptions, } from './commonOpts.js';
|
|
2
2
|
import { hasFlag } from './utils/hasFlag.js';
|
|
3
|
+
import { commands } from '../lang/en.js';
|
|
3
4
|
// Re-export for backwards compatibility
|
|
4
5
|
export { hasFlag };
|
|
5
6
|
export function makeYargsBuilder(callback, command, describe, options = {}) {
|
|
@@ -34,9 +35,15 @@ export function makeYargsBuilder(callback, command, describe, options = {}) {
|
|
|
34
35
|
return result;
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
export function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
export function strictEnforceBoolean(rawArgs, booleanOptions) {
|
|
39
|
+
for (const option of booleanOptions) {
|
|
40
|
+
const argIndex = rawArgs.findIndex(arg => arg.startsWith(`--${option}=`));
|
|
41
|
+
if (argIndex !== -1) {
|
|
42
|
+
const value = rawArgs[argIndex].split('=')[1];
|
|
43
|
+
if (value && !['true', 'false'].includes(value.toLowerCase())) {
|
|
44
|
+
throw new Error(commands.config.subcommands.set.errors.invalidBoolean(option, value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
42
49
|
}
|
|
@@ -13,20 +13,20 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
absoluteCurrentWorkingDirectory: string;
|
|
15
15
|
dest?: string | undefined;
|
|
16
|
-
global?: boolean | undefined;
|
|
17
16
|
moduleLabel?: string | undefined;
|
|
18
17
|
reactType?: boolean | undefined;
|
|
19
|
-
|
|
18
|
+
global?: boolean | undefined;
|
|
20
19
|
availableForNewContent?: boolean | undefined;
|
|
20
|
+
contentTypes?: string | undefined;
|
|
21
21
|
userSuppliedName?: string | undefined;
|
|
22
22
|
}, {
|
|
23
23
|
absoluteCurrentWorkingDirectory: string;
|
|
24
24
|
dest?: string | undefined;
|
|
25
|
-
global?: boolean | undefined;
|
|
26
25
|
moduleLabel?: string | undefined;
|
|
27
26
|
reactType?: boolean | undefined;
|
|
28
|
-
|
|
27
|
+
global?: boolean | undefined;
|
|
29
28
|
availableForNewContent?: boolean | undefined;
|
|
29
|
+
contentTypes?: string | undefined;
|
|
30
30
|
userSuppliedName?: string | undefined;
|
|
31
31
|
}>;
|
|
32
32
|
export type HsCreateModuleInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
@@ -7,6 +7,8 @@ import { ValidateProjectTool } from './project/ValidateProjectTool.js';
|
|
|
7
7
|
import { GetConfigValuesTool } from './project/GetConfigValuesTool.js';
|
|
8
8
|
import { DocsSearchTool } from './project/DocsSearchTool.js';
|
|
9
9
|
import { DocFetchTool } from './project/DocFetchTool.js';
|
|
10
|
+
import { GetApiUsagePatternsByAppIdTool } from './project/GetApiUsagePatternsByAppIdTool.js';
|
|
11
|
+
import { GetApplicationInfoTool } from './project/GetApplicationInfoTool.js';
|
|
10
12
|
import { HsListTool } from './cms/HsListTool.js';
|
|
11
13
|
import { HsCreateModuleTool } from './cms/HsCreateModuleTool.js';
|
|
12
14
|
import { HsCreateTemplateTool } from './cms/HsCreateTemplateTool.js';
|
|
@@ -24,6 +26,8 @@ export function registerProjectTools(mcpServer) {
|
|
|
24
26
|
new GetConfigValuesTool(mcpServer).register(),
|
|
25
27
|
new DocsSearchTool(mcpServer).register(),
|
|
26
28
|
new DocFetchTool(mcpServer).register(),
|
|
29
|
+
new GetApiUsagePatternsByAppIdTool(mcpServer).register(),
|
|
30
|
+
new GetApplicationInfoTool(mcpServer).register(),
|
|
27
31
|
];
|
|
28
32
|
}
|
|
29
33
|
export function registerCmsTools(mcpServer) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types.js';
|
|
2
|
+
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
appId: z.ZodString;
|
|
6
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
7
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
appId: string;
|
|
10
|
+
startDate?: string | undefined;
|
|
11
|
+
endDate?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
appId: string;
|
|
14
|
+
startDate?: string | undefined;
|
|
15
|
+
endDate?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type GetApiUsagePatternsByAppIdInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
18
|
+
export declare class GetApiUsagePatternsByAppIdTool extends Tool<GetApiUsagePatternsByAppIdInputSchema> {
|
|
19
|
+
constructor(mcpServer: McpServer);
|
|
20
|
+
handler({ appId, startDate, endDate, }: GetApiUsagePatternsByAppIdInputSchema): Promise<TextContentResponse>;
|
|
21
|
+
register(): RegisteredTool;
|
|
22
|
+
}
|
|
23
|
+
export {};
|