@hubspot/cli 7.8.0-experimental.0 → 7.8.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 -27
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/__tests__/getStarted.test.js +2 -2
- package/commands/__tests__/mcp.test.js +1 -1
- package/commands/__tests__/project.test.js +2 -3
- 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 -6
- package/commands/app/migrate.js +13 -19
- package/commands/app/secret/add.js +2 -1
- package/commands/app/secret/delete.js +2 -1
- package/commands/app/secret/list.js +2 -1
- package/commands/app/secret/update.js +2 -1
- package/commands/app/secret.js +2 -1
- package/commands/app.js +2 -2
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +17 -7
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms.js +2 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -37
- package/commands/config.js +2 -2
- package/commands/create.js +2 -2
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/schema/create.js +9 -11
- package/commands/customObject/schema/delete.js +16 -16
- package/commands/customObject/schema/fetch-all.js +12 -11
- package/commands/customObject/schema/fetch.js +15 -15
- package/commands/customObject/schema/list.js +4 -4
- package/commands/customObject/schema/update.js +13 -13
- package/commands/customObject/schema.js +2 -2
- package/commands/customObject.js +6 -7
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +8 -13
- package/commands/fetch.js +8 -8
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.js +11 -29
- package/commands/function/list.js +8 -8
- package/commands/function/server.js +9 -11
- package/commands/function.d.ts +1 -1
- package/commands/function.js +2 -2
- package/commands/getStarted.d.ts +1 -3
- package/commands/getStarted.js +68 -20
- 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.js +16 -16
- package/commands/list.js +8 -14
- package/commands/logs.js +14 -20
- package/commands/mcp/__tests__/setup.test.js +2 -2
- package/commands/mcp/setup.js +11 -2
- package/commands/mcp.js +3 -3
- package/commands/mv.js +6 -17
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +15 -13
- package/commands/project/__tests__/create.test.js +6 -6
- package/commands/project/__tests__/deploy.test.js +3 -7
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -4
- 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 -4
- package/commands/project/__tests__/migrate.test.js +7 -7
- package/commands/project/__tests__/migrateApp.test.js +3 -7
- package/commands/project/__tests__/profile.test.js +1 -1
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +7 -10
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +4 -11
- package/commands/project/deploy.js +5 -5
- package/commands/project/dev/deprecatedFlow.js +9 -18
- package/commands/project/dev/index.js +21 -18
- package/commands/project/dev/unifiedFlow.js +15 -8
- package/commands/project/download.js +15 -16
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +9 -9
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.js +12 -21
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +33 -12
- package/commands/project/migrateApp.js +10 -17
- package/commands/project/open.js +6 -14
- package/commands/project/profile/add.js +3 -3
- package/commands/project/profile/delete.js +1 -2
- package/commands/project/profile.js +2 -3
- package/commands/project/upload.js +16 -25
- package/commands/project/validate.js +7 -7
- package/commands/project/watch.js +13 -22
- package/commands/project.js +4 -3
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +39 -64
- 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 -2
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/testAccount/importData.d.ts +1 -1
- package/commands/testAccount/importData.js +1 -1
- package/commands/testAccount.js +1 -1
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +365 -111
- package/lang/en.js +409 -158
- 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__/hasFeature.test.js +145 -7
- 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 +19 -56
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.d.ts +2 -8
- package/lib/app/migrate.js +6 -81
- 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 +22 -1
- package/lib/constants.js +26 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +9 -36
- 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/hasFeature.js +6 -0
- package/lib/lang.js +6 -5
- package/lib/links.d.ts +1 -0
- package/lib/links.js +14 -7
- package/lib/mcp/setup.js +1 -1
- 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/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/fireAlarmMiddleware.js +15 -5
- 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/projects/__tests__/AppDevModeInterface.test.js +87 -90
- package/lib/projects/__tests__/LocalDevProcess.test.js +231 -19
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +89 -63
- package/lib/projects/__tests__/deploy.test.js +73 -8
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +6 -2
- 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} +82 -7
- 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} +16 -13
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +10 -1
- package/lib/projects/localDev/AppDevModeInterface.js +118 -89
- package/lib/projects/localDev/DevServerManager.d.ts +11 -29
- package/lib/projects/localDev/DevServerManager.js +19 -61
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +27 -6
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +10 -11
- package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
- package/lib/projects/localDev/LocalDevProcess.js +93 -21
- package/lib/projects/localDev/LocalDevState.d.ts +12 -8
- package/lib/projects/localDev/LocalDevState.js +27 -17
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +6 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +94 -33
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/project.d.ts +3 -2
- package/lib/projects/localDev/helpers/project.js +49 -10
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +7 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +19 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +17 -8
- 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 +9 -2
- 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 +30 -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/selectProjectTemplatePrompt.js +2 -0
- 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.d.ts +1 -0
- package/lib/theme/__tests__/migrate.test.js +233 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +90 -0
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +112 -8
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +47 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +72 -0
- package/lib/ui/uiMessages.js +75 -0
- package/lib/usageTracking.js +8 -8
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +1 -1
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +3 -3
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +5 -5
- package/mcp-server/tools/project/DeployProjectTool.js +1 -1
- package/mcp-server/tools/project/DocFetchTool.js +2 -2
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +7 -7
- 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.d.ts +4 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +13 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +2 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +1 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +14 -12
- 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/tools/project/__tests__/GetConfigValuesTool.test.js +9 -8
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +1 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/constants.d.ts +1 -1
- package/mcp-server/tools/project/constants.js +9 -3
- package/mcp-server/utils/__tests__/cliConfig.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/cliConfig.test.js +110 -0
- package/mcp-server/utils/cliConfig.d.ts +1 -0
- package/mcp-server/utils/cliConfig.js +12 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +8 -12
- package/types/LocalDev.d.ts +19 -3
- package/ui/components/HorizontalSelectPrompt.js +1 -1
- package/ui/index.js +1 -1
- package/commands/getStartedV2.d.ts +0 -9
- package/commands/getStartedV2.js +0 -39
- 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/ui/components/Ascii.d.ts +0 -10
- package/ui/components/Ascii.js +0 -11
- package/ui/views/GetStarted.d.ts +0 -7
- package/ui/views/GetStarted.js +0 -157
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/list.test.d.ts} +0 -0
- /package/{lib/projects/add/__tests__/v3AddComponent.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
- /package/lib/{projects/create/__tests__/v3.test.d.ts → middleware/__test__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
|
@@ -7,8 +7,10 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
7
7
|
|
|
8
8
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
9
|
**/
|
|
10
|
+
import readline from 'readline';
|
|
10
11
|
import chalk from 'chalk';
|
|
11
|
-
import
|
|
12
|
+
import cliCursor from 'cli-cursor';
|
|
13
|
+
import { breakText, cleanStream, colorOptions, getLinesLength, purgeSpinnerOptions, purgeSpinnersOptions, SPINNERS, terminalSupportsUnicode, writeStream, prefixOptions, } from './spinniesUtils.js';
|
|
12
14
|
function safeColor(text, color) {
|
|
13
15
|
const chalkFn = chalk[color];
|
|
14
16
|
if (typeof chalkFn === 'function') {
|
|
@@ -17,6 +19,7 @@ function safeColor(text, color) {
|
|
|
17
19
|
return text;
|
|
18
20
|
}
|
|
19
21
|
class SpinniesManager {
|
|
22
|
+
disableOutput = false;
|
|
20
23
|
options;
|
|
21
24
|
spinners = {};
|
|
22
25
|
isCursorHidden = false;
|
|
@@ -34,10 +37,14 @@ class SpinniesManager {
|
|
|
34
37
|
succeedColor: 'green',
|
|
35
38
|
failColor: 'red',
|
|
36
39
|
spinner: terminalSupportsUnicode() ? SPINNERS.dots : SPINNERS.dashes,
|
|
37
|
-
disableSpins:
|
|
40
|
+
disableSpins: false,
|
|
38
41
|
...purgeSpinnersOptions(options),
|
|
39
42
|
};
|
|
40
|
-
this.spin =
|
|
43
|
+
this.spin =
|
|
44
|
+
!this.options.disableSpins &&
|
|
45
|
+
!process.env.CI &&
|
|
46
|
+
process.stderr &&
|
|
47
|
+
process.stderr.isTTY;
|
|
41
48
|
if (!this.hasAnySpinners()) {
|
|
42
49
|
this.resetState();
|
|
43
50
|
}
|
|
@@ -55,6 +62,9 @@ class SpinniesManager {
|
|
|
55
62
|
this.lineCount = 0;
|
|
56
63
|
this.currentFrameIndex = 0;
|
|
57
64
|
}
|
|
65
|
+
setDisableOutput(disableOutput) {
|
|
66
|
+
this.disableOutput = disableOutput;
|
|
67
|
+
}
|
|
58
68
|
pick(name) {
|
|
59
69
|
return this.spinners?.[name];
|
|
60
70
|
}
|
|
@@ -135,7 +145,25 @@ class SpinniesManager {
|
|
|
135
145
|
status = status || 'spinning';
|
|
136
146
|
this.spinners[name] = { ...this.spinners[name], ...options, status };
|
|
137
147
|
}
|
|
138
|
-
updateSpinnerState() {
|
|
148
|
+
updateSpinnerState() {
|
|
149
|
+
if (this.disableOutput) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (this.spin) {
|
|
153
|
+
if (this.currentInterval) {
|
|
154
|
+
clearInterval(this.currentInterval);
|
|
155
|
+
}
|
|
156
|
+
this.currentInterval = this.loopStream();
|
|
157
|
+
if (!this.isCursorHidden) {
|
|
158
|
+
cliCursor.hide();
|
|
159
|
+
}
|
|
160
|
+
this.isCursorHidden = true;
|
|
161
|
+
this.checkIfActiveSpinners();
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.setRawStreamOutput();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
139
167
|
loopStream() {
|
|
140
168
|
const frames = this.options.spinner?.frames || SPINNERS.dots.frames;
|
|
141
169
|
const interval = this.options.spinner?.interval || SPINNERS.dots.interval;
|
|
@@ -147,10 +175,86 @@ class SpinniesManager {
|
|
|
147
175
|
: ++this.currentFrameIndex;
|
|
148
176
|
}, interval);
|
|
149
177
|
}
|
|
150
|
-
setStreamOutput(frame = '') {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
178
|
+
setStreamOutput(frame = '') {
|
|
179
|
+
let output = '';
|
|
180
|
+
const linesLength = [];
|
|
181
|
+
const hasActiveSpinners = this.hasActiveSpinners();
|
|
182
|
+
Object.values(this.spinners).forEach(spinner => {
|
|
183
|
+
let { text } = spinner;
|
|
184
|
+
const { status, color, spinnerColor, succeedColor, failColor, indent = 0, succeedPrefix = prefixOptions(this.options).succeedPrefix, failPrefix = prefixOptions(this.options).failPrefix, } = spinner;
|
|
185
|
+
let line;
|
|
186
|
+
let prefixLength = indent;
|
|
187
|
+
text = text ?? '';
|
|
188
|
+
if (status === 'spinning') {
|
|
189
|
+
prefixLength += frame.length + 1;
|
|
190
|
+
text = breakText(text, prefixLength);
|
|
191
|
+
const colorizedFrame = safeColor(frame, spinnerColor);
|
|
192
|
+
const colorizedText = safeColor(text, color);
|
|
193
|
+
line = `${colorizedFrame} ${colorizedText}`;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
if (status === 'succeed') {
|
|
197
|
+
prefixLength += succeedPrefix.length + 1;
|
|
198
|
+
if (hasActiveSpinners) {
|
|
199
|
+
text = breakText(text, prefixLength);
|
|
200
|
+
}
|
|
201
|
+
const colorizedText = safeColor(text, succeedColor);
|
|
202
|
+
line = `${chalk.green(succeedPrefix)} ${colorizedText}`;
|
|
203
|
+
}
|
|
204
|
+
else if (status === 'fail') {
|
|
205
|
+
prefixLength += failPrefix.length + 1;
|
|
206
|
+
if (hasActiveSpinners) {
|
|
207
|
+
text = breakText(text, prefixLength);
|
|
208
|
+
}
|
|
209
|
+
const colorizedText = safeColor(text, failColor);
|
|
210
|
+
line = `${chalk.red(failPrefix)} ${colorizedText}`;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
if (hasActiveSpinners) {
|
|
214
|
+
text = breakText(text, prefixLength);
|
|
215
|
+
}
|
|
216
|
+
line = safeColor(text, color);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
linesLength.push(...getLinesLength(text, prefixLength));
|
|
220
|
+
output += indent ? `${' '.repeat(indent)}${line}\n` : `${line}\n`;
|
|
221
|
+
});
|
|
222
|
+
if (!hasActiveSpinners) {
|
|
223
|
+
readline.clearScreenDown(this.stream);
|
|
224
|
+
}
|
|
225
|
+
writeStream(this.stream, output, linesLength);
|
|
226
|
+
if (hasActiveSpinners) {
|
|
227
|
+
cleanStream(this.stream, linesLength);
|
|
228
|
+
}
|
|
229
|
+
this.lineCount = linesLength.length;
|
|
230
|
+
}
|
|
231
|
+
setRawStreamOutput() {
|
|
232
|
+
Object.values(this.spinners).forEach(i => {
|
|
233
|
+
process.stderr.write(`- ${i.text}\n`);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
checkIfActiveSpinners() {
|
|
237
|
+
if (!this.hasActiveSpinners()) {
|
|
238
|
+
if (this.spin) {
|
|
239
|
+
this.setStreamOutput();
|
|
240
|
+
readline.moveCursor(this.stream, 0, this.lineCount);
|
|
241
|
+
if (this.currentInterval) {
|
|
242
|
+
clearInterval(this.currentInterval);
|
|
243
|
+
}
|
|
244
|
+
this.isCursorHidden = false;
|
|
245
|
+
cliCursor.show();
|
|
246
|
+
}
|
|
247
|
+
this.spinners = {};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
bindSigint() {
|
|
251
|
+
process.removeAllListeners('SIGINT');
|
|
252
|
+
process.on('SIGINT', () => {
|
|
253
|
+
cliCursor.show();
|
|
254
|
+
readline.moveCursor(process.stderr, 0, this.lineCount);
|
|
255
|
+
process.exit(0);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
154
258
|
}
|
|
155
259
|
const toExport = new SpinniesManager();
|
|
156
260
|
export default toExport;
|
package/lib/ui/boxen.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { uiLogger } from './logger.js';
|
|
2
2
|
import { UI_COLORS } from './index.js';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { lib } from '../../lang/en.js';
|
|
5
4
|
const defaultOptions = {
|
|
6
5
|
titleAlignment: 'left',
|
|
@@ -17,7 +16,7 @@ export async function logInBox({ contents, options, }) {
|
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
catch (error) {
|
|
20
|
-
|
|
19
|
+
uiLogger.debug(lib.boxen.failedToLoad);
|
|
21
20
|
if (options?.title) {
|
|
22
21
|
uiLogger.log(options.title);
|
|
23
22
|
uiLogger.log('');
|
package/lib/ui/git.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import { checkGitInclusion } from '@hubspot/local-dev-lib/gitignore';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { uiLogger } from './logger.js';
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
|
+
import { uiLine } from './index.js';
|
|
5
6
|
export function checkAndWarnGitInclusion(configPath) {
|
|
6
7
|
try {
|
|
7
8
|
const { inGit, configIgnored } = checkGitInclusion(configPath);
|
|
8
9
|
if (!inGit || configIgnored)
|
|
9
10
|
return;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
uiLine();
|
|
12
|
+
uiLogger.warn(lib.ui.git.securityIssue);
|
|
13
|
+
uiLogger.log(lib.ui.git.configFileTracked);
|
|
14
|
+
uiLogger.log(lib.ui.git.fileName(configPath));
|
|
15
|
+
uiLogger.log('');
|
|
16
|
+
uiLogger.log(lib.ui.git.moveConfig(os.homedir()));
|
|
17
|
+
uiLogger.log(lib.ui.git.addGitignore(configPath));
|
|
18
|
+
uiLogger.log(lib.ui.git.noRemote);
|
|
19
|
+
uiLine();
|
|
17
20
|
}
|
|
18
21
|
catch (e) {
|
|
19
22
|
// fail silently
|
|
20
|
-
|
|
23
|
+
uiLogger.debug(lib.ui.git.checkFailed);
|
|
21
24
|
}
|
|
22
25
|
}
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export declare function uiLink(linkText: string, url: string): string;
|
|
|
13
13
|
export declare function uiAccountDescription(accountId?: number | null, bold?: boolean): string;
|
|
14
14
|
export declare function uiInfoSection(title: string, logContent: () => void): void;
|
|
15
15
|
export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
|
|
16
|
+
export declare function uiAuthCommandReference({ accountId, qa, }?: {
|
|
17
|
+
accountId?: number | string;
|
|
18
|
+
qa?: boolean;
|
|
19
|
+
}): string;
|
|
16
20
|
export declare function uiFeatureHighlight(features: string[], title?: string): void;
|
|
17
21
|
export declare function uiBetaTag(message: string, log?: true): undefined;
|
|
18
22
|
export declare function uiBetaTag(message: string, log: false): string;
|
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,75 @@ 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
|
}
|
|
117
130
|
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();
|
|
131
|
+
const tag = uiMessages.deprecatedDescription(message || '', command, url);
|
|
132
|
+
uiLogger.log('');
|
|
124
133
|
uiDeprecatedTag(tag);
|
|
125
|
-
|
|
134
|
+
uiLogger.log('');
|
|
126
135
|
}
|
|
127
136
|
export function indent(level) {
|
|
128
137
|
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,72 @@
|
|
|
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
|
+
featureHighlight: {
|
|
8
|
+
defaultTitle: string;
|
|
9
|
+
featureKeys: {
|
|
10
|
+
accountOption: {
|
|
11
|
+
command: string;
|
|
12
|
+
message: (command: string) => string;
|
|
13
|
+
};
|
|
14
|
+
accountsListCommand: {
|
|
15
|
+
command: string;
|
|
16
|
+
message: (command: string) => string;
|
|
17
|
+
};
|
|
18
|
+
accountsUseCommand: {
|
|
19
|
+
command: string;
|
|
20
|
+
message: (command: string) => string;
|
|
21
|
+
};
|
|
22
|
+
authCommand: {
|
|
23
|
+
command: string;
|
|
24
|
+
message: (command: string) => string;
|
|
25
|
+
};
|
|
26
|
+
feedbackCommand: {
|
|
27
|
+
command: string;
|
|
28
|
+
message: (command: string) => string;
|
|
29
|
+
};
|
|
30
|
+
getStartedCommand: {
|
|
31
|
+
command: string;
|
|
32
|
+
message: (command: string) => string;
|
|
33
|
+
};
|
|
34
|
+
helpCommand: {
|
|
35
|
+
command: string;
|
|
36
|
+
message: (command: string) => string;
|
|
37
|
+
};
|
|
38
|
+
projectCreateCommand: {
|
|
39
|
+
command: string;
|
|
40
|
+
message: (command: string) => string;
|
|
41
|
+
};
|
|
42
|
+
projectDeployCommand: {
|
|
43
|
+
command: string;
|
|
44
|
+
message: (command: string) => string;
|
|
45
|
+
};
|
|
46
|
+
projectHelpCommand: {
|
|
47
|
+
command: string;
|
|
48
|
+
message: (command: string) => string;
|
|
49
|
+
};
|
|
50
|
+
projectUploadCommand: {
|
|
51
|
+
command: string;
|
|
52
|
+
message: (command: string) => string;
|
|
53
|
+
};
|
|
54
|
+
projectDevCommand: {
|
|
55
|
+
command: string;
|
|
56
|
+
message: (command: string) => string;
|
|
57
|
+
};
|
|
58
|
+
projectInstallDepsCommand: {
|
|
59
|
+
command: string;
|
|
60
|
+
message: (command: string) => string;
|
|
61
|
+
};
|
|
62
|
+
projectCommandTip: {
|
|
63
|
+
message: string;
|
|
64
|
+
};
|
|
65
|
+
sampleProjects: {
|
|
66
|
+
linkText: string;
|
|
67
|
+
url: string;
|
|
68
|
+
message: (link: string) => string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
featureHighlight: {
|
|
11
|
+
defaultTitle: "What's next?",
|
|
12
|
+
featureKeys: {
|
|
13
|
+
accountOption: {
|
|
14
|
+
command: '--account',
|
|
15
|
+
message: (command) => `Use the ${command} option with any command to override the default account`,
|
|
16
|
+
},
|
|
17
|
+
accountsListCommand: {
|
|
18
|
+
command: 'hs accounts list',
|
|
19
|
+
message: (command) => `${command} - See a list of configured HubSpot accounts`,
|
|
20
|
+
},
|
|
21
|
+
accountsUseCommand: {
|
|
22
|
+
command: 'hs accounts use',
|
|
23
|
+
message: (command) => `${command} - Set the Hubspot account that the CLI will target by default`,
|
|
24
|
+
},
|
|
25
|
+
authCommand: {
|
|
26
|
+
command: 'hs auth',
|
|
27
|
+
message: (command) => `${command} - Connect the CLI to additional HubSpot accounts`,
|
|
28
|
+
},
|
|
29
|
+
feedbackCommand: {
|
|
30
|
+
command: 'hs feedback',
|
|
31
|
+
message: (command) => `${command} - Report a bug or leave feedback`,
|
|
32
|
+
},
|
|
33
|
+
getStartedCommand: {
|
|
34
|
+
command: 'hs get-started',
|
|
35
|
+
message: (command) => `${command} - Get started with HubSpot development`,
|
|
36
|
+
},
|
|
37
|
+
helpCommand: {
|
|
38
|
+
command: 'hs help',
|
|
39
|
+
message: (command) => `${command} - See a list of available commands`,
|
|
40
|
+
},
|
|
41
|
+
projectCreateCommand: {
|
|
42
|
+
command: 'hs project create',
|
|
43
|
+
message: (command) => `${command} - Create a new project`,
|
|
44
|
+
},
|
|
45
|
+
projectDeployCommand: {
|
|
46
|
+
command: 'hs project deploy',
|
|
47
|
+
message: (command) => `Ready to take your project live? Run ${command}`,
|
|
48
|
+
},
|
|
49
|
+
projectHelpCommand: {
|
|
50
|
+
command: 'hs project --help',
|
|
51
|
+
message: (command) => `${command} - Learn more about available project commands`,
|
|
52
|
+
},
|
|
53
|
+
projectUploadCommand: {
|
|
54
|
+
command: 'hs project upload',
|
|
55
|
+
message: (command) => `${command} - Upload your project to HubSpot and trigger builds`,
|
|
56
|
+
},
|
|
57
|
+
projectDevCommand: {
|
|
58
|
+
command: 'hs project dev',
|
|
59
|
+
message: (command) => `${command} - Set up a test environment and start local development`,
|
|
60
|
+
},
|
|
61
|
+
projectInstallDepsCommand: {
|
|
62
|
+
command: 'hs project install-deps',
|
|
63
|
+
message: (command) => `${command} - Install all project dependencies`,
|
|
64
|
+
},
|
|
65
|
+
projectCommandTip: {
|
|
66
|
+
message: 'Tip: All project commands must be run from within a project directory',
|
|
67
|
+
},
|
|
68
|
+
sampleProjects: {
|
|
69
|
+
linkText: "HubSpot's sample projects",
|
|
70
|
+
url: 'https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next',
|
|
71
|
+
message: (link) => `See ${link}`,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
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);
|
|
@@ -44,7 +44,7 @@ export async function trackCommandUsage(command, meta = {}, accountId) {
|
|
|
44
44
|
action: 'cli-command',
|
|
45
45
|
command,
|
|
46
46
|
authType,
|
|
47
|
-
|
|
47
|
+
meta,
|
|
48
48
|
accountId,
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -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,12 +133,12 @@ async function trackCliInteraction({ action, accountId, command, authType, meta
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
try {
|
|
136
|
+
uiLogger.debug('Sent usage tracking command event:', usageTrackingEvent);
|
|
136
137
|
return trackUsage('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
|
|
137
138
|
}
|
|
138
139
|
catch (error) {
|
|
139
140
|
debugError(error);
|
|
140
141
|
}
|
|
141
|
-
logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
|
|
142
142
|
}
|
|
143
143
|
catch (e) {
|
|
144
144
|
debugError(e);
|