@hubspot/cli 7.7.35-experimental.0 → 7.8.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__/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 +0 -3
- 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 +16 -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 +7 -12
- 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 +0 -2
- package/commands/getStarted.js +4 -4
- 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 +4 -2
- 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__/logs.test.js +1 -4
- package/commands/project/__tests__/migrate.test.js +6 -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.js +4 -8
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +2 -9
- package/commands/project/deploy.js +5 -5
- package/commands/project/dev/deprecatedFlow.js +7 -16
- package/commands/project/dev/index.js +16 -13
- package/commands/project/dev/unifiedFlow.js +8 -4
- package/commands/project/download.js +10 -14
- package/commands/project/installDeps.js +8 -9
- package/commands/project/listBuilds.js +12 -21
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +41 -13
- 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 +2 -3
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +35 -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/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/lang/en.d.ts +317 -98
- package/lang/en.js +312 -96
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -1
- 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 +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 +5 -80
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.js +25 -57
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +13 -0
- package/lib/constants.js +17 -0
- 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 +10 -17
- 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.d.ts +1 -0
- 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 +78 -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 +2 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +227 -16
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +86 -60
- package/lib/projects/__tests__/deploy.test.js +71 -6
- 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__/v3AddComponent.test.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v3.test.js +80 -5
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v3.js +10 -8
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
- package/lib/projects/localDev/AppDevModeInterface.js +21 -12
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +27 -6
- package/lib/projects/localDev/LocalDevManager.js +4 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
- package/lib/projects/localDev/LocalDevProcess.js +90 -19
- package/lib/projects/localDev/LocalDevState.d.ts +9 -8
- package/lib/projects/localDev/LocalDevState.js +18 -17
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +2 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +62 -33
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +42 -1
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +4 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +10 -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/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/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.js +8 -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 +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 +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.js +38 -37
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +68 -0
- package/lib/ui/uiMessages.js +71 -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/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +5 -5
- 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 +12 -6
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +12 -10
- 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 +8 -7
- 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 +4 -4
- package/types/LocalDev.d.ts +19 -3
- package/ui/index.js +1 -1
- 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/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
|
@@ -6,7 +6,7 @@ import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError
|
|
|
6
6
|
import { AxiosError } from 'axios';
|
|
7
7
|
import { isSpecifiedError as _isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
8
8
|
import { promisify as _promisify } from 'util';
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('../../ui/logger.js');
|
|
10
10
|
vi.mock('../Diagnosis');
|
|
11
11
|
vi.mock('../../ui/SpinniesManager');
|
|
12
12
|
vi.mock('../DiagnosticInfoBuilder');
|
|
@@ -336,7 +336,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
336
336
|
// @ts-expect-error Testing private method
|
|
337
337
|
expect(doctor.diagnosis.addProjectSection).toHaveBeenCalledWith({
|
|
338
338
|
type: 'error',
|
|
339
|
-
message: expect.stringMatching(/
|
|
339
|
+
message: expect.stringMatching(/Invalid JSON in/),
|
|
340
340
|
});
|
|
341
341
|
});
|
|
342
342
|
it('should add error section if it is unable to determine if dependencies need installed', async () => {
|
|
@@ -359,7 +359,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
359
359
|
expect(doctor.diagnosis?.addProjectSection).toHaveBeenCalledWith({
|
|
360
360
|
type: 'warning',
|
|
361
361
|
message: 'Port 8080 is in use',
|
|
362
|
-
secondaryMessaging: expect.stringMatching(/Make sure it is available
|
|
362
|
+
secondaryMessaging: expect.stringMatching(/Make sure it is available before running `hs project dev`/),
|
|
363
363
|
});
|
|
364
364
|
});
|
|
365
365
|
it('should add success section if port is available', async () => {
|
|
@@ -388,7 +388,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
388
388
|
// @ts-expect-error Testing private method
|
|
389
389
|
expect(doctor.diagnosis.addProjectSection).toHaveBeenCalledWith({
|
|
390
390
|
type: 'error',
|
|
391
|
-
message: expect.stringMatching(/
|
|
391
|
+
message: expect.stringMatching(/Invalid JSON in/),
|
|
392
392
|
});
|
|
393
393
|
});
|
|
394
394
|
});
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { isHubSpotHttpError, isValidationError, } from '@hubspot/local-dev-lib/errors/index';
|
|
3
3
|
import { getConfig } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { shouldSuppressError } from './suppressError.js';
|
|
5
|
-
import {
|
|
5
|
+
import { lib } from '../../lang/en.js';
|
|
6
6
|
import util from 'util';
|
|
7
|
-
import { uiCommandReference } from '../ui/index.js';
|
|
8
7
|
import { isProjectValidationError } from '../errors/ProjectValidationError.js';
|
|
9
8
|
export function logError(error, context) {
|
|
10
9
|
debugError(error, context);
|
|
11
10
|
if (isProjectValidationError(error)) {
|
|
12
|
-
|
|
11
|
+
uiLogger.error(error.message);
|
|
13
12
|
return;
|
|
14
13
|
}
|
|
15
14
|
if (shouldSuppressError(error, context)) {
|
|
@@ -24,7 +23,7 @@ export function logError(error, context) {
|
|
|
24
23
|
error.updateContext(context);
|
|
25
24
|
}
|
|
26
25
|
if (isHubSpotHttpError(error) && isValidationError(error)) {
|
|
27
|
-
|
|
26
|
+
uiLogger.error(error.formattedValidationErrors());
|
|
28
27
|
}
|
|
29
28
|
else if (isErrorWithMessageOrReason(error)) {
|
|
30
29
|
const message = [];
|
|
@@ -33,44 +32,37 @@ export function logError(error, context) {
|
|
|
33
32
|
message.push(msg);
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
|
-
|
|
35
|
+
uiLogger.error(message.join(' '));
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
38
|
// Unknown errors
|
|
40
|
-
|
|
39
|
+
uiLogger.error(lib.errorHandlers.index.unknownErrorOccurred);
|
|
41
40
|
}
|
|
42
41
|
if (isHubSpotHttpError(error) && error.code === 'ETIMEDOUT') {
|
|
43
42
|
const config = getConfig();
|
|
44
43
|
const defaultTimeout = config?.httpTimeout;
|
|
45
44
|
// Timeout was caused by the default timeout
|
|
46
45
|
if (error.timeout && defaultTimeout === error.timeout) {
|
|
47
|
-
|
|
48
|
-
timeout: error.timeout,
|
|
49
|
-
configSetCommand: uiCommandReference('hs config set'),
|
|
50
|
-
}));
|
|
46
|
+
uiLogger.error(lib.errorHandlers.index.configTimeoutErrorOccurred(error.timeout, 'hs config set'));
|
|
51
47
|
}
|
|
52
48
|
// Timeout was caused by a custom timeout set by the CLI or LDL
|
|
53
49
|
else {
|
|
54
|
-
|
|
50
|
+
uiLogger.error(lib.errorHandlers.index.genericTimeoutErrorOccurred);
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
export function debugError(error, context) {
|
|
59
55
|
if (isHubSpotHttpError(error)) {
|
|
60
|
-
|
|
56
|
+
uiLogger.debug(error.toString());
|
|
61
57
|
}
|
|
62
58
|
else {
|
|
63
|
-
|
|
59
|
+
uiLogger.debug(lib.errorHandlers.index.errorOccurred(String(error)));
|
|
64
60
|
}
|
|
65
61
|
if (error instanceof Error && error.cause && !isHubSpotHttpError(error)) {
|
|
66
|
-
|
|
67
|
-
cause: util.inspect(error.cause, false, null, true),
|
|
68
|
-
}));
|
|
62
|
+
uiLogger.debug(lib.errorHandlers.index.errorCause(util.inspect(error.cause, false, null, true)));
|
|
69
63
|
}
|
|
70
64
|
if (context) {
|
|
71
|
-
|
|
72
|
-
context: util.inspect(context, false, null, true),
|
|
73
|
-
}));
|
|
65
|
+
uiLogger.debug(lib.errorHandlers.index.errorContext(util.inspect(context, false, null, true)));
|
|
74
66
|
}
|
|
75
67
|
}
|
|
76
68
|
export class ApiErrorContext {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isSpecifiedError, isMissingScopeError, } from '@hubspot/local-dev-lib/errors/index';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../ui/logger.js';
|
|
3
3
|
import { PLATFORM_VERSION_ERROR_TYPES } from '../constants.js';
|
|
4
|
-
import {
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
5
|
import { uiAccountDescription, uiLine, uiLink, uiCommandReference, } from '../ui/index.js';
|
|
6
6
|
function createPlatformVersionError(err, subCategory) {
|
|
7
7
|
let translationKey = 'unspecifiedPlatformVersion';
|
|
@@ -17,25 +17,18 @@ function createPlatformVersionError(err, subCategory) {
|
|
|
17
17
|
translationKey = 'nonExistentPlatformVersion';
|
|
18
18
|
}
|
|
19
19
|
uiLine();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}));
|
|
20
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.platformVersionErrors.header);
|
|
21
|
+
const errorMessage = lib.errorHandlers.suppressErrors.platformVersionErrors[translationKey];
|
|
22
|
+
uiLogger.log(typeof errorMessage === 'function'
|
|
23
|
+
? errorMessage(platformVersion)
|
|
24
|
+
: errorMessage);
|
|
25
|
+
uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.updateProject);
|
|
26
|
+
uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.betaLink(uiLink(lib.errorHandlers.suppressErrors.platformVersionErrors.docsLink, 'https://developers.hubspot.com/docs/developer-tooling/platform/versioning')));
|
|
28
27
|
uiLine();
|
|
29
28
|
}
|
|
30
29
|
export function shouldSuppressError(err, context) {
|
|
31
30
|
if (isMissingScopeError(err)) {
|
|
32
|
-
|
|
33
|
-
accountName: context?.accountId
|
|
34
|
-
? uiAccountDescription(context.accountId)
|
|
35
|
-
: '',
|
|
36
|
-
request: context?.request || 'request',
|
|
37
|
-
authCommand: uiCommandReference('hs auth'),
|
|
38
|
-
}));
|
|
31
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.missingScopeError(context?.request || 'request', context?.accountId ? uiAccountDescription(context.accountId) : '', uiCommandReference('hs auth')));
|
|
39
32
|
return true;
|
|
40
33
|
}
|
|
41
34
|
if (isSpecifiedError(err, {
|
package/lib/lang.js
CHANGED
|
@@ -2,7 +2,7 @@ import util from 'util';
|
|
|
2
2
|
import path, { dirname } from 'path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import yaml from 'js-yaml';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from './ui/logger.js';
|
|
6
6
|
import { interpolate } from './interpolation.js';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -22,10 +22,11 @@ function loadLanguageFromYaml() {
|
|
|
22
22
|
// Fall back to using the default language file
|
|
23
23
|
locale = languageFileExists ? nodeLocale : 'en';
|
|
24
24
|
languageObj = yaml.load(fs.readFileSync(path.join(__dirname, `../lang/${locale}.lyaml`), 'utf8'));
|
|
25
|
-
|
|
25
|
+
uiLogger.debug('Loaded language data: ' + util.inspect(languageObj, true, 999, true));
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
|
-
|
|
28
|
+
uiLogger.error('Error loading language data: ' +
|
|
29
|
+
(e instanceof Error ? e.message : String(e)));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function getTextValue(lookupDotNotation) {
|
|
@@ -42,8 +43,8 @@ function getTextValue(lookupDotNotation) {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
uiLogger.debug(`Unable to access language property: ${lookupProps.join('.')}. Failed to access prop "${previouslyCheckedProp}".`);
|
|
47
|
+
uiLogger.error('Unable to access language property.');
|
|
47
48
|
return missingTextData;
|
|
48
49
|
}
|
|
49
50
|
if (!textValue) {
|
package/lib/links.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ type SiteLink = {
|
|
|
7
7
|
export declare function getSiteLinksAsArray(accountId: number): SiteLink[];
|
|
8
8
|
export declare function logSiteLinks(accountId: number): void;
|
|
9
9
|
export declare function openLink(accountId: number, shortcut: string): void;
|
|
10
|
+
export declare function getProductUpdatesUrl(rolloutId: string, accountId?: number): string;
|
|
10
11
|
export {};
|
package/lib/links.js
CHANGED
|
@@ -2,9 +2,9 @@ import open from 'open';
|
|
|
2
2
|
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
4
4
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from './ui/logger.js';
|
|
6
6
|
import { getTableContents, getTableHeader } from './ui/table.js';
|
|
7
|
-
const
|
|
7
|
+
const COMMON_SITE_LINKS = {
|
|
8
8
|
APPS_MARKETPLACE: {
|
|
9
9
|
shortcut: 'apps-marketplace',
|
|
10
10
|
alias: 'apm',
|
|
@@ -76,7 +76,7 @@ const SITE_LINKS = {
|
|
|
76
76
|
};
|
|
77
77
|
export function getSiteLinksAsArray(accountId) {
|
|
78
78
|
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
79
|
-
return Object.values(
|
|
79
|
+
return Object.values(COMMON_SITE_LINKS)
|
|
80
80
|
.sort((a, b) => (a.shortcut < b.shortcut ? -1 : 1))
|
|
81
81
|
.map(l => ({ ...l, url: l.getUrl(accountId, baseUrl) }));
|
|
82
82
|
}
|
|
@@ -87,15 +87,22 @@ export function logSiteLinks(accountId) {
|
|
|
87
87
|
l.url,
|
|
88
88
|
]);
|
|
89
89
|
linksAsArray.unshift(getTableHeader(['Shortcut', '', 'Url']));
|
|
90
|
-
|
|
90
|
+
uiLogger.log(getTableContents(linksAsArray));
|
|
91
91
|
}
|
|
92
92
|
export function openLink(accountId, shortcut) {
|
|
93
|
-
const match = Object.values(
|
|
93
|
+
const match = Object.values(COMMON_SITE_LINKS).find(l => l.shortcut === shortcut || (l.alias && l.alias === shortcut));
|
|
94
94
|
if (!match) {
|
|
95
|
-
|
|
95
|
+
uiLogger.error(`We couldn't find a shortcut matching ${shortcut}. Type 'hs open list' to see a list of available shortcuts`);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
99
99
|
open(match.getUrl(accountId, baseUrl), { url: true });
|
|
100
|
-
|
|
100
|
+
uiLogger.success(`We opened ${match.getUrl(accountId, baseUrl)} in your browser`);
|
|
101
|
+
}
|
|
102
|
+
export function getProductUpdatesUrl(rolloutId, accountId) {
|
|
103
|
+
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
104
|
+
if (accountId) {
|
|
105
|
+
return `${baseUrl}/product-updates/${accountId}/in-beta?rollout=${rolloutId}`;
|
|
106
|
+
}
|
|
107
|
+
return `${baseUrl}/l/product-updates/in-beta?rollout=${rolloutId}`;
|
|
101
108
|
}
|
package/lib/mcp/setup.js
CHANGED
|
@@ -8,7 +8,7 @@ import path from 'path';
|
|
|
8
8
|
import os from 'os';
|
|
9
9
|
import fs from 'fs-extra';
|
|
10
10
|
import { existsSync } from 'fs';
|
|
11
|
-
const mcpServerName = '
|
|
11
|
+
const mcpServerName = 'HubSpotDev';
|
|
12
12
|
const claudeCode = 'claude';
|
|
13
13
|
const windsurf = 'windsurf';
|
|
14
14
|
const cursor = 'cursor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as cliConfig from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { isTargetedCommand, shouldLoadConfigForCommand, shouldRunAccountValidationForCommand, shouldRunConfigValidationForCommand, } from '../commandTargetingUtils.js';
|
|
3
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
4
|
+
const configFileExistsSpy = vi.spyOn(cliConfig, 'configFileExists');
|
|
5
|
+
const targetCommandMap = {
|
|
6
|
+
init: true,
|
|
7
|
+
account: {
|
|
8
|
+
use: true,
|
|
9
|
+
},
|
|
10
|
+
project: {
|
|
11
|
+
deploy: true,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
describe('lib/middleware/commandTargetingUtils', () => {
|
|
15
|
+
describe('isTargetedCommand()', () => {
|
|
16
|
+
it('should return true for a direct target command', () => {
|
|
17
|
+
const result = isTargetedCommand(['init'], targetCommandMap);
|
|
18
|
+
expect(result).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
it('should return false for a command with a subcommand', () => {
|
|
21
|
+
const result = isTargetedCommand(['account'], targetCommandMap);
|
|
22
|
+
expect(result).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
it('should return true for a nested target command', () => {
|
|
25
|
+
const result = isTargetedCommand(['project', 'deploy'], targetCommandMap);
|
|
26
|
+
expect(result).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
it('should return false for a non-existent command', () => {
|
|
29
|
+
const result = isTargetedCommand(['nonexistent'], targetCommandMap);
|
|
30
|
+
expect(result).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('should return false for a non-targeted command', () => {
|
|
33
|
+
const result = isTargetedCommand(['auth'], targetCommandMap);
|
|
34
|
+
expect(result).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
it('should return false for a command with a targeted subcommand', () => {
|
|
37
|
+
const result = isTargetedCommand(['project'], targetCommandMap);
|
|
38
|
+
expect(result).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
it('should return false for a non-existent subcommand', () => {
|
|
41
|
+
const result = isTargetedCommand(['auth', 'nonexistent'], targetCommandMap);
|
|
42
|
+
expect(result).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
it('should return false for an empty command array', () => {
|
|
45
|
+
const result = isTargetedCommand([], targetCommandMap);
|
|
46
|
+
expect(result).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('shouldLoadConfigForCommand()', () => {
|
|
50
|
+
it('should return true for a command that requires a config file', () => {
|
|
51
|
+
const result = shouldLoadConfigForCommand(['account', 'use']);
|
|
52
|
+
expect(result).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it('should return false for a command that does not require a config file', () => {
|
|
55
|
+
const result = shouldLoadConfigForCommand(['init']);
|
|
56
|
+
expect(result).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it('should return false when the user is trying to migrate the global config', () => {
|
|
59
|
+
configFileExistsSpy.mockReturnValue(false);
|
|
60
|
+
const result = shouldLoadConfigForCommand(['config', 'migrate']);
|
|
61
|
+
expect(result).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
it('should return true when the global config file does exist', () => {
|
|
64
|
+
configFileExistsSpy.mockReturnValue(true);
|
|
65
|
+
const result = shouldLoadConfigForCommand(['account', 'use']);
|
|
66
|
+
expect(result).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('shouldRunAccountValidationForCommand()', () => {
|
|
70
|
+
it('should return true for a command that requires a config file', () => {
|
|
71
|
+
const result = shouldRunAccountValidationForCommand([
|
|
72
|
+
'project',
|
|
73
|
+
'upload',
|
|
74
|
+
]);
|
|
75
|
+
expect(result).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
it('should return false for a command that does not require account validation', () => {
|
|
78
|
+
const result1 = shouldRunAccountValidationForCommand(['init']);
|
|
79
|
+
const result2 = shouldRunAccountValidationForCommand(['auth']);
|
|
80
|
+
const result3 = shouldRunAccountValidationForCommand([
|
|
81
|
+
'accounts',
|
|
82
|
+
'list',
|
|
83
|
+
]);
|
|
84
|
+
expect(result1).toBe(false);
|
|
85
|
+
expect(result2).toBe(false);
|
|
86
|
+
expect(result3).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('shouldRunConfigValidationForCommand()', () => {
|
|
90
|
+
it('should return true for a command that requires a config file', () => {
|
|
91
|
+
const result = shouldRunConfigValidationForCommand(['account', 'use']);
|
|
92
|
+
expect(result).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it('should return false for a command that does not require config validation', () => {
|
|
95
|
+
const result = shouldRunConfigValidationForCommand(['init']);
|
|
96
|
+
expect(result).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
2
2
|
import * as cliConfig from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import * as validation from '../../validation.js';
|
|
4
4
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
5
|
-
import { handleDeprecatedEnvVariables, injectAccountIdMiddleware,
|
|
6
|
-
vi.mock('
|
|
7
|
-
|
|
5
|
+
import { handleDeprecatedEnvVariables, injectAccountIdMiddleware, loadAndValidateConfigMiddleware, validateAccountOptions, } from '../configMiddleware.js';
|
|
6
|
+
vi.mock('../../ui/logger.js', () => ({
|
|
7
|
+
uiLogger: {
|
|
8
8
|
error: vi.fn(),
|
|
9
9
|
log: vi.fn(),
|
|
10
10
|
},
|
|
@@ -39,7 +39,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
39
39
|
$0: 'hs',
|
|
40
40
|
};
|
|
41
41
|
handleDeprecatedEnvVariables(argv);
|
|
42
|
-
expect(
|
|
42
|
+
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead.'));
|
|
43
43
|
expect(process.env.HUBSPOT_ACCOUNT_ID).toBe('123');
|
|
44
44
|
process.env = originalEnv;
|
|
45
45
|
});
|
|
@@ -56,7 +56,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
56
56
|
$0: 'hs',
|
|
57
57
|
};
|
|
58
58
|
handleDeprecatedEnvVariables(argv);
|
|
59
|
-
expect(
|
|
59
|
+
expect(uiLogger.log).not.toHaveBeenCalled();
|
|
60
60
|
expect(process.env.HUBSPOT_ACCOUNT_ID).toBe('456');
|
|
61
61
|
process.env = originalEnv;
|
|
62
62
|
});
|
|
@@ -93,7 +93,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
93
93
|
expect(getAccountIdSpy).toHaveBeenCalledWith('test-account');
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
-
describe('
|
|
96
|
+
describe('loadAndValidateConfigMiddleware()', () => {
|
|
97
97
|
it('should exit with error when config file exists and --config flag is used', async () => {
|
|
98
98
|
configFileExistsSpy.mockReturnValue(true);
|
|
99
99
|
const argv = {
|
|
@@ -101,9 +101,9 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
101
101
|
config: 'custom-config.json',
|
|
102
102
|
$0: 'hs',
|
|
103
103
|
};
|
|
104
|
-
await expect(
|
|
104
|
+
await expect(loadAndValidateConfigMiddleware(argv)).rejects.toThrow();
|
|
105
105
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
106
|
-
expect(
|
|
106
|
+
expect(uiLogger.error).toHaveBeenCalledWith('A configuration file already exists at /path/to/config. To specify a new configuration file, delete the existing one and try again.');
|
|
107
107
|
});
|
|
108
108
|
it('should load config and validate for non-init commands', async () => {
|
|
109
109
|
configFileExistsSpy.mockReturnValue(false);
|
|
@@ -113,7 +113,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
113
113
|
_: ['some-command'],
|
|
114
114
|
$0: 'hs',
|
|
115
115
|
};
|
|
116
|
-
await
|
|
116
|
+
await loadAndValidateConfigMiddleware(argv);
|
|
117
117
|
expect(loadConfigSpy).toHaveBeenCalled();
|
|
118
118
|
expect(validateConfigSpy).toHaveBeenCalled();
|
|
119
119
|
});
|
|
@@ -123,7 +123,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
123
123
|
_: ['init'],
|
|
124
124
|
$0: 'hs',
|
|
125
125
|
};
|
|
126
|
-
await
|
|
126
|
+
await loadAndValidateConfigMiddleware(argv);
|
|
127
127
|
expect(loadConfigSpy).not.toHaveBeenCalled();
|
|
128
128
|
expect(validateConfigSpy).not.toHaveBeenCalled();
|
|
129
129
|
});
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
3
2
|
import * as projectsConfig from '../../projects/config.js';
|
|
4
3
|
import { performChecks } from '../yargsChecksMiddleware.js';
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
5
|
+
import { commands } from '../../../lang/en.js';
|
|
6
|
+
vi.mock('../../ui/logger', () => ({
|
|
7
|
+
uiLogger: {
|
|
7
8
|
error: vi.fn(),
|
|
8
9
|
},
|
|
9
10
|
}));
|
|
10
11
|
vi.mock('../../projects/config');
|
|
11
|
-
vi.mock('../../lang', () => ({
|
|
12
|
-
i18n: vi.fn(key => key),
|
|
13
|
-
}));
|
|
14
12
|
const getIsInProjectSpy = vi.spyOn(projectsConfig, 'getIsInProject');
|
|
15
13
|
const processExitSpy = vi.spyOn(process, 'exit');
|
|
16
14
|
describe('lib/middleware/yargsChecksMiddleware', () => {
|
|
@@ -29,7 +27,7 @@ describe('lib/middleware/yargsChecksMiddleware', () => {
|
|
|
29
27
|
getIsInProjectSpy.mockReturnValue(true);
|
|
30
28
|
expect(() => performChecks(argv)).toThrow();
|
|
31
29
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
32
|
-
expect(
|
|
30
|
+
expect(uiLogger.error).toHaveBeenCalledWith(commands.generalErrors.srcIsProject(argv.src, argv._.toString()));
|
|
33
31
|
});
|
|
34
32
|
it('should return true when no checks fail', () => {
|
|
35
33
|
const argv = {
|
|
@@ -40,7 +38,7 @@ describe('lib/middleware/yargsChecksMiddleware', () => {
|
|
|
40
38
|
getIsInProjectSpy.mockReturnValue(false);
|
|
41
39
|
expect(performChecks(argv)).toBe(true);
|
|
42
40
|
expect(processExitSpy).not.toHaveBeenCalled();
|
|
43
|
-
expect(
|
|
41
|
+
expect(uiLogger.error).not.toHaveBeenCalled();
|
|
44
42
|
});
|
|
45
43
|
});
|
|
46
44
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TargetCommandMap = {
|
|
2
|
+
[key: string]: boolean | TargetCommandMap;
|
|
3
|
+
};
|
|
4
|
+
export declare function isTargetedCommand(commandParts: (string | number)[], targetCommandMap: TargetCommandMap): boolean;
|
|
5
|
+
export declare function shouldLoadConfigForCommand(commandParts: (string | number)[]): boolean;
|
|
6
|
+
export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
7
|
+
export declare function shouldRunConfigValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { configFileExists } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
export function isTargetedCommand(commandParts, targetCommandMap) {
|
|
3
|
+
const currentCommandPart = commandParts[0];
|
|
4
|
+
if (!targetCommandMap[currentCommandPart]) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
if (typeof targetCommandMap[currentCommandPart] === 'boolean' &&
|
|
8
|
+
targetCommandMap[currentCommandPart]) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (commandParts.length > 1) {
|
|
12
|
+
const targetSubCommandMap = targetCommandMap[currentCommandPart];
|
|
13
|
+
if (!targetSubCommandMap) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return isTargetedCommand(commandParts.slice(1), targetSubCommandMap);
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const SKIP_CONFIG_LOADING_COMMANDS = {
|
|
21
|
+
init: true,
|
|
22
|
+
feedback: true,
|
|
23
|
+
};
|
|
24
|
+
// Returns true if the command requires a config file to be present
|
|
25
|
+
export function shouldLoadConfigForCommand(commandParts) {
|
|
26
|
+
const globalConfigExists = configFileExists(true);
|
|
27
|
+
// the user is trying to migrate the global config
|
|
28
|
+
const isGlobalConfigMigration = !globalConfigExists &&
|
|
29
|
+
isTargetedCommand(commandParts, {
|
|
30
|
+
account: { auth: true },
|
|
31
|
+
config: { migrate: true },
|
|
32
|
+
});
|
|
33
|
+
return (!isGlobalConfigMigration &&
|
|
34
|
+
!isTargetedCommand(commandParts, SKIP_CONFIG_LOADING_COMMANDS));
|
|
35
|
+
}
|
|
36
|
+
const accountsSubCommands = {
|
|
37
|
+
auth: true,
|
|
38
|
+
clean: true,
|
|
39
|
+
list: true,
|
|
40
|
+
ls: true,
|
|
41
|
+
remove: true,
|
|
42
|
+
use: true,
|
|
43
|
+
};
|
|
44
|
+
const sandboxesSubCommands = {
|
|
45
|
+
delete: true,
|
|
46
|
+
};
|
|
47
|
+
const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
|
|
48
|
+
init: true,
|
|
49
|
+
auth: true,
|
|
50
|
+
mcp: {
|
|
51
|
+
setup: true,
|
|
52
|
+
start: true,
|
|
53
|
+
},
|
|
54
|
+
account: accountsSubCommands,
|
|
55
|
+
accounts: accountsSubCommands,
|
|
56
|
+
sandbox: sandboxesSubCommands,
|
|
57
|
+
sandboxes: sandboxesSubCommands,
|
|
58
|
+
config: {
|
|
59
|
+
migrate: true,
|
|
60
|
+
},
|
|
61
|
+
feedback: true,
|
|
62
|
+
};
|
|
63
|
+
// Returns true if the command requires a valid account to be set in the config
|
|
64
|
+
export function shouldRunAccountValidationForCommand(commandParts) {
|
|
65
|
+
return !isTargetedCommand(commandParts, SKIP_ACCOUNT_VALIDATION_COMMANDS);
|
|
66
|
+
}
|
|
67
|
+
const SKIP_CONFIG_VALIDATION_COMMANDS = {
|
|
68
|
+
init: true,
|
|
69
|
+
auth: true,
|
|
70
|
+
mcp: {
|
|
71
|
+
setup: true,
|
|
72
|
+
start: true,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
// Returns true if the command requires a valid config file to be present
|
|
76
|
+
export function shouldRunConfigValidationForCommand(commandParts) {
|
|
77
|
+
return !isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS);
|
|
78
|
+
}
|
|
@@ -9,5 +9,5 @@ export declare function handleDeprecatedEnvVariables(argv: Arguments<{
|
|
|
9
9
|
export declare function injectAccountIdMiddleware(argv: Arguments<{
|
|
10
10
|
account?: string;
|
|
11
11
|
}>): Promise<void>;
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function loadAndValidateConfigMiddleware(argv: Arguments<CLIOptions>): Promise<void>;
|
|
13
13
|
export declare function validateAccountOptions(argv: Arguments): Promise<void>;
|