@hubspot/cli 7.7.19-experimental.0 → 7.7.19-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/mcp/setup.js +0 -1
- package/commands/mcp/start.d.ts +1 -4
- package/commands/mcp/start.js +3 -10
- package/commands/open.js +14 -12
- package/commands/project/dev/unifiedFlow.js +1 -1
- package/commands/testAccount/create.js +11 -24
- package/lang/en.d.ts +43 -5
- package/lang/en.js +43 -5
- package/lib/app/migrate.js +2 -6
- package/lib/buildAccount.d.ts +7 -1
- package/lib/buildAccount.js +54 -4
- package/lib/mcp/setup.js +3 -8
- package/lib/projects/create/v3.d.ts +3 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -2
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +9 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +86 -47
- package/lib/prompts/createModulePrompt.js +1 -2
- package/lib/prompts/projectAddPrompt.d.ts +2 -1
- package/lib/prompts/projectAddPrompt.js +2 -1
- package/lib/prompts/promptUtils.d.ts +2 -2
- package/lib/prompts/promptUtils.js +161 -35
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +2 -1
- package/lib/prompts/selectProjectTemplatePrompt.js +2 -1
- package/lib/usageTracking.d.ts +5 -5
- package/lib/usageTracking.js +79 -74
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/UploadProjectTools.js +1 -1
- package/mcp-server/utils/project.js +0 -3
- package/package.json +3 -3
- package/types/Prompts.d.ts +4 -2
package/commands/mcp/setup.js
CHANGED
package/commands/mcp/start.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { CommonArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
-
|
|
3
|
-
aiAgent: string;
|
|
4
|
-
}
|
|
5
|
-
declare const mcpStartCommand: YargsCommandModule<unknown, McpStartArgs>;
|
|
2
|
+
declare const mcpStartCommand: YargsCommandModule<unknown, CommonArgs>;
|
|
6
3
|
export default mcpStartCommand;
|
package/commands/mcp/start.js
CHANGED
|
@@ -24,9 +24,9 @@ async function handler(args) {
|
|
|
24
24
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
25
25
|
}
|
|
26
26
|
(0, usageTracking_1.trackCommandUsage)('mcp-start', {}, args.derivedAccountId);
|
|
27
|
-
await startMcpServer(
|
|
27
|
+
await startMcpServer();
|
|
28
28
|
}
|
|
29
|
-
async function startMcpServer(
|
|
29
|
+
async function startMcpServer() {
|
|
30
30
|
try {
|
|
31
31
|
const serverPath = path_1.default.join(__dirname, '..', '..', 'mcp-server', 'server.js');
|
|
32
32
|
// Check if server file exists
|
|
@@ -36,13 +36,11 @@ async function startMcpServer(aiAgent) {
|
|
|
36
36
|
}
|
|
37
37
|
logger_1.uiLogger.info(en_1.commands.mcp.start.startingServer);
|
|
38
38
|
logger_1.uiLogger.info(en_1.commands.mcp.start.stopInstructions);
|
|
39
|
-
const args = [serverPath];
|
|
40
39
|
// Start the server using ts-node
|
|
41
|
-
const child = (0, child_process_1.spawn)(
|
|
40
|
+
const child = (0, child_process_1.spawn)('node', [serverPath], {
|
|
42
41
|
stdio: 'inherit',
|
|
43
42
|
env: {
|
|
44
43
|
...process.env,
|
|
45
|
-
HUBSPOT_MCP_AI_AGENT: aiAgent || 'unknown',
|
|
46
44
|
},
|
|
47
45
|
});
|
|
48
46
|
// Handle server process events
|
|
@@ -65,11 +63,6 @@ async function startMcpServer(aiAgent) {
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
function startBuilder(yargs) {
|
|
68
|
-
yargs
|
|
69
|
-
.option('ai-agent', {
|
|
70
|
-
type: 'string',
|
|
71
|
-
})
|
|
72
|
-
.demandOption('ai-agent');
|
|
73
66
|
return yargs;
|
|
74
67
|
}
|
|
75
68
|
const builder = (0, yargsUtils_1.makeYargsBuilder)(startBuilder, command, describe, {
|
package/commands/open.js
CHANGED
|
@@ -8,16 +8,18 @@ const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
|
8
8
|
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
9
9
|
const separator = ' => ';
|
|
10
10
|
async function createListPrompt(accountId) {
|
|
11
|
-
return (0, promptUtils_1.promptUser)(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
return (0, promptUtils_1.promptUser)({
|
|
12
|
+
name: 'open',
|
|
13
|
+
type: 'rawlist',
|
|
14
|
+
pageSize: 20,
|
|
15
|
+
message: (0, lang_1.i18n)('commands.open.selectLink'),
|
|
16
|
+
choices: (0, links_1.getSiteLinksAsArray)(accountId)
|
|
17
|
+
.filter(l => !!l.url)
|
|
18
|
+
.map(l => ({
|
|
19
|
+
name: `${l.shortcut}${separator}${l.url}`,
|
|
20
|
+
value: l.shortcut,
|
|
21
|
+
})),
|
|
22
|
+
});
|
|
21
23
|
}
|
|
22
24
|
const command = 'open [shortcut]';
|
|
23
25
|
const describe = (0, lang_1.i18n)('commands.open.describe');
|
|
@@ -25,8 +27,8 @@ async function handler(args) {
|
|
|
25
27
|
const { shortcut, list, derivedAccountId } = args;
|
|
26
28
|
(0, usageTracking_1.trackCommandUsage)('open', undefined, derivedAccountId);
|
|
27
29
|
if (shortcut === undefined && !list) {
|
|
28
|
-
const
|
|
29
|
-
(0, links_1.openLink)(derivedAccountId,
|
|
30
|
+
const { open } = await createListPrompt(derivedAccountId);
|
|
31
|
+
(0, links_1.openLink)(derivedAccountId, open);
|
|
30
32
|
}
|
|
31
33
|
else if (list) {
|
|
32
34
|
(0, links_1.logSiteLinks)(derivedAccountId);
|
|
@@ -93,7 +93,7 @@ async function unifiedProjectDevFlow({ args, targetProjectAccountId, providedTar
|
|
|
93
93
|
}
|
|
94
94
|
else if (devAccountPromptResponse.createNestedAccount) {
|
|
95
95
|
// Create a new developer test account and automatically add it to the CLI config
|
|
96
|
-
targetTestingAccountId = await (0, helpers_1.createDeveloperTestAccountForLocalDev)(targetProjectAccountId, targetProjectAccountConfig, env);
|
|
96
|
+
targetTestingAccountId = await (0, helpers_1.createDeveloperTestAccountForLocalDev)(targetProjectAccountId, targetProjectAccountConfig, env, true);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
else if (accountType === config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTestAccounts");
|
|
9
8
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
9
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
10
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
@@ -16,8 +15,8 @@ const validation_1 = require("../../lib/validation");
|
|
|
16
15
|
const en_1 = require("../../lang/en");
|
|
17
16
|
const createDeveloperTestAccountConfigPrompt_1 = require("../../lib/prompts/createDeveloperTestAccountConfigPrompt");
|
|
18
17
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
19
|
-
const polling_1 = require("../../lib/polling");
|
|
20
18
|
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
19
|
+
const buildAccount_1 = require("../../lib/buildAccount");
|
|
21
20
|
const command = 'create';
|
|
22
21
|
const describe = en_1.commands.testAccount.create.describe;
|
|
23
22
|
async function handler(args) {
|
|
@@ -73,36 +72,24 @@ async function handler(args) {
|
|
|
73
72
|
text: en_1.commands.testAccount.create.polling.start(testAccountConfig.accountName),
|
|
74
73
|
});
|
|
75
74
|
try {
|
|
76
|
-
const
|
|
75
|
+
const result = await (0, buildAccount_1.createDeveloperTestAccountV3)(derivedAccountId, testAccountConfig);
|
|
77
76
|
if (formatOutputAsJson) {
|
|
78
|
-
jsonOutput.accountName =
|
|
79
|
-
jsonOutput.accountId =
|
|
80
|
-
jsonOutput.personalAccessKey =
|
|
77
|
+
jsonOutput.accountName = result.accountName;
|
|
78
|
+
jsonOutput.accountId = result.accountId;
|
|
79
|
+
jsonOutput.personalAccessKey = result.personalAccessKey;
|
|
81
80
|
}
|
|
82
|
-
testAccountId =
|
|
81
|
+
testAccountId = result.accountId;
|
|
83
82
|
}
|
|
84
83
|
catch (err) {
|
|
85
84
|
(0, errorHandlers_1.logError)(err);
|
|
86
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
87
|
-
}
|
|
88
|
-
SpinniesManager_1.default.update('createTestAccount', {
|
|
89
|
-
text: en_1.commands.testAccount.create.polling.syncing,
|
|
90
|
-
});
|
|
91
|
-
try {
|
|
92
|
-
await (0, polling_1.poll)(() => (0, developerTestAccounts_1.fetchDeveloperTestAccountGateSyncStatus)(derivedAccountId, testAccountId), {
|
|
93
|
-
successStates: ['SUCCESS'],
|
|
94
|
-
errorStates: [],
|
|
95
|
-
});
|
|
96
|
-
SpinniesManager_1.default.succeed('createTestAccount', {
|
|
97
|
-
text: en_1.commands.testAccount.create.polling.success(testAccountConfig.accountName, testAccountId),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
(0, errorHandlers_1.debugError)(err);
|
|
102
85
|
SpinniesManager_1.default.fail('createTestAccount', {
|
|
103
|
-
text: en_1.commands.testAccount.create.polling.
|
|
86
|
+
text: en_1.commands.testAccount.create.polling.createFailure,
|
|
104
87
|
});
|
|
88
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
105
89
|
}
|
|
90
|
+
SpinniesManager_1.default.succeed('createTestAccount', {
|
|
91
|
+
text: en_1.commands.testAccount.create.polling.success(testAccountConfig.accountName, testAccountId),
|
|
92
|
+
});
|
|
106
93
|
if (formatOutputAsJson) {
|
|
107
94
|
logger_1.uiLogger.json(jsonOutput);
|
|
108
95
|
}
|
package/lang/en.d.ts
CHANGED
|
@@ -1811,7 +1811,7 @@ ${string}`;
|
|
|
1811
1811
|
readonly start: (testAccountName: string) => string;
|
|
1812
1812
|
readonly syncing: "Test account created! Syncing account data... (may take a few minutes - you can exit and the sync will continue)";
|
|
1813
1813
|
readonly success: (testAccountName: string, testAccountId: number) => string;
|
|
1814
|
-
readonly
|
|
1814
|
+
readonly createFailure: "Failed to create test account.";
|
|
1815
1815
|
};
|
|
1816
1816
|
readonly options: {
|
|
1817
1817
|
readonly configPath: "The path to the test account config";
|
|
@@ -1820,7 +1820,7 @@ ${string}`;
|
|
|
1820
1820
|
};
|
|
1821
1821
|
readonly createConfig: {
|
|
1822
1822
|
readonly describe: "Create a test account config file.";
|
|
1823
|
-
readonly pathPrompt: "[--path]
|
|
1823
|
+
readonly pathPrompt: "[--path] Enter the name of the Test Account config file: ";
|
|
1824
1824
|
readonly errors: {
|
|
1825
1825
|
readonly pathError: "Path is required";
|
|
1826
1826
|
readonly pathFormatError: "Path must end with .json";
|
|
@@ -2763,6 +2763,12 @@ Run ${string} to upgrade to version ${string}`;
|
|
|
2763
2763
|
readonly noLogsFound: "No logs found.";
|
|
2764
2764
|
};
|
|
2765
2765
|
};
|
|
2766
|
+
readonly buildAccount: {
|
|
2767
|
+
readonly createDeveloperTestAccountV3: {
|
|
2768
|
+
readonly syncFailure: "Failed to sync developer test account";
|
|
2769
|
+
readonly pakFailure: "Failed to generate personal access key for developer test account";
|
|
2770
|
+
};
|
|
2771
|
+
};
|
|
2766
2772
|
readonly configOptions: {
|
|
2767
2773
|
readonly enableOrDisableBooleanFieldPrompt: {
|
|
2768
2774
|
readonly message: (fieldName: string) => string;
|
|
@@ -2845,9 +2851,41 @@ Run ${string} to upgrade to version ${string}`;
|
|
|
2845
2851
|
readonly keepingCurrentDefault: (accountName: string) => string;
|
|
2846
2852
|
};
|
|
2847
2853
|
readonly createDeveloperTestAccountConfigPrompt: {
|
|
2848
|
-
readonly namePrompt:
|
|
2849
|
-
readonly descriptionPrompt:
|
|
2850
|
-
readonly
|
|
2854
|
+
readonly namePrompt: (withFlag?: boolean) => string;
|
|
2855
|
+
readonly descriptionPrompt: (withFlag?: boolean) => string;
|
|
2856
|
+
readonly useDefaultAccountLevelsPrompt: {
|
|
2857
|
+
readonly message: "Would you like to create a default Test Account, or customize your own?";
|
|
2858
|
+
readonly default: "Default (All Hubs, ENTERPRISE)";
|
|
2859
|
+
readonly manual: "Customize my own";
|
|
2860
|
+
};
|
|
2861
|
+
readonly tiersPrompt: (withFlag?: boolean) => string;
|
|
2862
|
+
readonly tiers: {
|
|
2863
|
+
readonly marketing: {
|
|
2864
|
+
readonly free: "Marketing [FREE]";
|
|
2865
|
+
readonly starter: "Marketing [STARTER]";
|
|
2866
|
+
readonly professional: "Marketing [PROFESSIONAL]";
|
|
2867
|
+
};
|
|
2868
|
+
readonly ops: {
|
|
2869
|
+
readonly free: "Ops [FREE]";
|
|
2870
|
+
readonly starter: "Ops [STARTER]";
|
|
2871
|
+
readonly professional: "Ops [PROFESSIONAL]";
|
|
2872
|
+
};
|
|
2873
|
+
readonly service: {
|
|
2874
|
+
readonly free: "Service [FREE]";
|
|
2875
|
+
readonly starter: "Service [STARTER]";
|
|
2876
|
+
readonly professional: "Service [PROFESSIONAL]";
|
|
2877
|
+
};
|
|
2878
|
+
readonly sales: {
|
|
2879
|
+
readonly free: "Sales [FREE]";
|
|
2880
|
+
readonly starter: "Sales [STARTER]";
|
|
2881
|
+
readonly professional: "Sales [PROFESSIONAL]";
|
|
2882
|
+
};
|
|
2883
|
+
readonly content: {
|
|
2884
|
+
readonly free: "Content [FREE]";
|
|
2885
|
+
readonly starter: "Content [STARTER]";
|
|
2886
|
+
readonly professional: "Content [PROFESSIONAL]";
|
|
2887
|
+
};
|
|
2888
|
+
};
|
|
2851
2889
|
readonly errors: {
|
|
2852
2890
|
readonly tiersError: "Cannot have more than one tier per hub";
|
|
2853
2891
|
};
|
package/lang/en.js
CHANGED
|
@@ -1809,7 +1809,7 @@ exports.commands = {
|
|
|
1809
1809
|
start: (testAccountName) => `Creating test account "${chalk_1.default.bold(testAccountName)}"...`,
|
|
1810
1810
|
syncing: 'Test account created! Syncing account data... (may take a few minutes - you can exit and the sync will continue)',
|
|
1811
1811
|
success: (testAccountName, testAccountId) => `Test account "${chalk_1.default.bold(testAccountName)}" successfully created with id: ${chalk_1.default.bold(testAccountId)}`,
|
|
1812
|
-
|
|
1812
|
+
createFailure: 'Failed to create test account.',
|
|
1813
1813
|
},
|
|
1814
1814
|
options: {
|
|
1815
1815
|
configPath: 'The path to the test account config',
|
|
@@ -1818,7 +1818,7 @@ exports.commands = {
|
|
|
1818
1818
|
},
|
|
1819
1819
|
createConfig: {
|
|
1820
1820
|
describe: 'Create a test account config file.',
|
|
1821
|
-
pathPrompt: '[--path]
|
|
1821
|
+
pathPrompt: '[--path] Enter the name of the Test Account config file: ',
|
|
1822
1822
|
errors: {
|
|
1823
1823
|
pathError: 'Path is required',
|
|
1824
1824
|
pathFormatError: 'Path must end with .json',
|
|
@@ -2758,6 +2758,12 @@ exports.lib = {
|
|
|
2758
2758
|
noLogsFound: 'No logs found.',
|
|
2759
2759
|
},
|
|
2760
2760
|
},
|
|
2761
|
+
buildAccount: {
|
|
2762
|
+
createDeveloperTestAccountV3: {
|
|
2763
|
+
syncFailure: 'Failed to sync developer test account',
|
|
2764
|
+
pakFailure: 'Failed to generate personal access key for developer test account',
|
|
2765
|
+
},
|
|
2766
|
+
},
|
|
2761
2767
|
configOptions: {
|
|
2762
2768
|
enableOrDisableBooleanFieldPrompt: {
|
|
2763
2769
|
message: (fieldName) => `Choose to enable or disable ${fieldName}`,
|
|
@@ -2840,9 +2846,41 @@ exports.lib = {
|
|
|
2840
2846
|
keepingCurrentDefault: (accountName) => `Account "${accountName}" will continue to be the default account`,
|
|
2841
2847
|
},
|
|
2842
2848
|
createDeveloperTestAccountConfigPrompt: {
|
|
2843
|
-
namePrompt: '[--name]
|
|
2844
|
-
descriptionPrompt: '[--description]
|
|
2845
|
-
|
|
2849
|
+
namePrompt: (withFlag = true) => `${withFlag ? '[--name] ' : ''}Enter the name of the Test Account:`,
|
|
2850
|
+
descriptionPrompt: (withFlag = true) => `${withFlag ? '[--description] ' : ''}Enter the description of the Test Account:`,
|
|
2851
|
+
useDefaultAccountLevelsPrompt: {
|
|
2852
|
+
message: 'Would you like to create a default Test Account, or customize your own?',
|
|
2853
|
+
default: 'Default (All Hubs, ENTERPRISE)',
|
|
2854
|
+
manual: 'Customize my own',
|
|
2855
|
+
},
|
|
2856
|
+
tiersPrompt: (withFlag = true) => `${withFlag ? '[--tiers] ' : ''}Select an option per hub to customize tiers. If left blank, default is ENTERPRISE`,
|
|
2857
|
+
tiers: {
|
|
2858
|
+
marketing: {
|
|
2859
|
+
free: 'Marketing [FREE]',
|
|
2860
|
+
starter: 'Marketing [STARTER]',
|
|
2861
|
+
professional: 'Marketing [PROFESSIONAL]',
|
|
2862
|
+
},
|
|
2863
|
+
ops: {
|
|
2864
|
+
free: 'Ops [FREE]',
|
|
2865
|
+
starter: 'Ops [STARTER]',
|
|
2866
|
+
professional: 'Ops [PROFESSIONAL]',
|
|
2867
|
+
},
|
|
2868
|
+
service: {
|
|
2869
|
+
free: 'Service [FREE]',
|
|
2870
|
+
starter: 'Service [STARTER]',
|
|
2871
|
+
professional: 'Service [PROFESSIONAL]',
|
|
2872
|
+
},
|
|
2873
|
+
sales: {
|
|
2874
|
+
free: 'Sales [FREE]',
|
|
2875
|
+
starter: 'Sales [STARTER]',
|
|
2876
|
+
professional: 'Sales [PROFESSIONAL]',
|
|
2877
|
+
},
|
|
2878
|
+
content: {
|
|
2879
|
+
free: 'Content [FREE]',
|
|
2880
|
+
starter: 'Content [STARTER]',
|
|
2881
|
+
professional: 'Content [PROFESSIONAL]',
|
|
2882
|
+
},
|
|
2883
|
+
},
|
|
2846
2884
|
errors: {
|
|
2847
2885
|
tiersError: 'Cannot have more than one tier per hub',
|
|
2848
2886
|
},
|
package/lib/app/migrate.js
CHANGED
|
@@ -25,7 +25,7 @@ const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
|
25
25
|
const transform_1 = require("@hubspot/project-parsing-lib/src/lib/transform");
|
|
26
26
|
const Migration_1 = require("@hubspot/local-dev-lib/types/Migration");
|
|
27
27
|
const projects_2 = require("@hubspot/local-dev-lib/api/projects");
|
|
28
|
-
const
|
|
28
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
29
29
|
const promptUtils_1 = require("../prompts/promptUtils");
|
|
30
30
|
const ui_1 = require("../ui");
|
|
31
31
|
const ensureProjectExists_1 = require("../projects/ensureProjectExists");
|
|
@@ -119,11 +119,7 @@ async function promptForAppToMigrate(allApps, derivedAccountId) {
|
|
|
119
119
|
const enabledChoices = appChoices.filter(app => !app.disabled);
|
|
120
120
|
const disabledChoices = appChoices.filter(app => app.disabled);
|
|
121
121
|
const { appId: selectedAppId } = await (0, promptUtils_1.listPrompt)(en_1.lib.migrate.prompt.chooseApp, {
|
|
122
|
-
choices: [
|
|
123
|
-
...enabledChoices,
|
|
124
|
-
new inquirer.Separator(),
|
|
125
|
-
...disabledChoices,
|
|
126
|
-
],
|
|
122
|
+
choices: [...enabledChoices, new prompts_1.Separator(), ...disabledChoices],
|
|
127
123
|
});
|
|
128
124
|
return selectedAppId;
|
|
129
125
|
}
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
1
2
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
2
3
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
3
4
|
import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
4
5
|
import { SandboxAccountType } from '../types/Sandboxes';
|
|
5
6
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
6
|
-
export declare function
|
|
7
|
+
export declare function createDeveloperTestAccountV3(parentAccountId: number, testAccountConfig: DeveloperTestAccountConfig): Promise<{
|
|
8
|
+
accountName: string;
|
|
9
|
+
accountId?: number;
|
|
10
|
+
personalAccessKey?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number, useV3?: boolean): Promise<number>;
|
|
7
13
|
type SandboxAccount = SandboxResponse & {
|
|
8
14
|
name: string;
|
|
9
15
|
};
|
package/lib/buildAccount.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.saveAccountToConfig = saveAccountToConfig;
|
|
7
|
+
exports.createDeveloperTestAccountV3 = createDeveloperTestAccountV3;
|
|
7
8
|
exports.buildDeveloperTestAccount = buildDeveloperTestAccount;
|
|
8
9
|
exports.buildSandbox = buildSandbox;
|
|
9
10
|
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
@@ -14,12 +15,15 @@ const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTes
|
|
|
14
15
|
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
15
16
|
const sandboxHubs_1 = require("@hubspot/local-dev-lib/api/sandboxHubs");
|
|
16
17
|
const personalAccessKeyPrompt_1 = require("./prompts/personalAccessKeyPrompt");
|
|
18
|
+
const createDeveloperTestAccountConfigPrompt_1 = require("./prompts/createDeveloperTestAccountConfigPrompt");
|
|
17
19
|
const lang_1 = require("./lang");
|
|
18
20
|
const accountNamePrompt_1 = require("./prompts/accountNamePrompt");
|
|
19
21
|
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
20
22
|
const index_1 = require("./errorHandlers/index");
|
|
21
23
|
const sandboxes_1 = require("./sandboxes");
|
|
22
24
|
const developerTestAccounts_2 = require("./developerTestAccounts");
|
|
25
|
+
const en_1 = require("../lang/en");
|
|
26
|
+
const polling_1 = require("./polling");
|
|
23
27
|
async function saveAccountToConfig(accountId, accountName, env, personalAccessKey, force = false) {
|
|
24
28
|
if (!personalAccessKey) {
|
|
25
29
|
const configData = await (0, personalAccessKeyPrompt_1.personalAccessKeyPrompt)({
|
|
@@ -60,12 +64,51 @@ async function saveAccountToConfig(accountId, accountName, env, personalAccessKe
|
|
|
60
64
|
logger_1.logger.log('');
|
|
61
65
|
return validName;
|
|
62
66
|
}
|
|
63
|
-
async function
|
|
67
|
+
async function createDeveloperTestAccountV3(parentAccountId, testAccountConfig) {
|
|
68
|
+
const result = {
|
|
69
|
+
accountName: testAccountConfig.accountName,
|
|
70
|
+
};
|
|
71
|
+
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountConfig);
|
|
72
|
+
result.accountId = data.id;
|
|
73
|
+
try {
|
|
74
|
+
await (0, polling_1.poll)(() => (0, developerTestAccounts_1.fetchDeveloperTestAccountGateSyncStatus)(parentAccountId, result.accountId), {
|
|
75
|
+
successStates: ['SUCCESS'],
|
|
76
|
+
errorStates: [],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
(0, index_1.debugError)(err);
|
|
81
|
+
throw new Error(en_1.lib.buildAccount.createDeveloperTestAccountV3.syncFailure);
|
|
82
|
+
}
|
|
83
|
+
// HACK: The status endpoint sometimes returns an early success status.
|
|
84
|
+
// Sleep for an extra 5 seconds to make sure the sync is actually complete.
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
86
|
+
try {
|
|
87
|
+
// Attempt to generate a new personal access key for the test account now that gate sync is complete.
|
|
88
|
+
const { data } = await (0, developerTestAccounts_1.generateDeveloperTestAccountPersonalAccessKey)(parentAccountId, result.accountId);
|
|
89
|
+
result.personalAccessKey = data.personalAccessKey;
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
(0, index_1.debugError)(err);
|
|
93
|
+
throw new Error(en_1.lib.buildAccount.createDeveloperTestAccountV3.pakFailure);
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV3 = false) {
|
|
64
98
|
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(parentAccountConfig);
|
|
65
99
|
const parentAccountId = (0, config_1.getAccountId)(id);
|
|
100
|
+
let testAccountConfig = {
|
|
101
|
+
accountName: testAccountName,
|
|
102
|
+
};
|
|
66
103
|
if (!parentAccountId) {
|
|
67
104
|
throw new Error((0, lang_1.i18n)(`lib.developerTestAccount.create.loading.fail`));
|
|
68
105
|
}
|
|
106
|
+
if (useV3) {
|
|
107
|
+
testAccountConfig = await (0, createDeveloperTestAccountConfigPrompt_1.createDeveloperTestAccountConfigPrompt)({
|
|
108
|
+
name: testAccountConfig.accountName,
|
|
109
|
+
description: 'Test Account created by the HubSpot CLI',
|
|
110
|
+
}, false);
|
|
111
|
+
}
|
|
69
112
|
SpinniesManager_1.default.init({
|
|
70
113
|
succeedColor: 'white',
|
|
71
114
|
});
|
|
@@ -78,9 +121,16 @@ async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, e
|
|
|
78
121
|
let developerTestAccountId;
|
|
79
122
|
let developerTestAccountPersonalAccessKey;
|
|
80
123
|
try {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
124
|
+
if (useV3) {
|
|
125
|
+
const result = await createDeveloperTestAccountV3(parentAccountId, testAccountConfig);
|
|
126
|
+
developerTestAccountId = result.accountId;
|
|
127
|
+
developerTestAccountPersonalAccessKey = result.personalAccessKey;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountName);
|
|
131
|
+
developerTestAccountId = data.id;
|
|
132
|
+
developerTestAccountPersonalAccessKey = data.personalAccessKey;
|
|
133
|
+
}
|
|
84
134
|
SpinniesManager_1.default.succeed('buildDeveloperTestAccount', {
|
|
85
135
|
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.succeed`, {
|
|
86
136
|
accountName: testAccountName,
|
package/lib/mcp/setup.js
CHANGED
|
@@ -157,7 +157,7 @@ async function setupClaudeCode(mcpCommand = defaultMcpCommand) {
|
|
|
157
157
|
// Run claude mcp add command
|
|
158
158
|
const mcpConfig = JSON.stringify({
|
|
159
159
|
type: 'stdio',
|
|
160
|
-
...
|
|
160
|
+
...mcpCommand,
|
|
161
161
|
});
|
|
162
162
|
const { stdout } = await (0, command_1.execAsync)('claude mcp list');
|
|
163
163
|
if (stdout.includes(mcpServerName)) {
|
|
@@ -203,7 +203,7 @@ function setupCursor(mcpCommand = defaultMcpCommand) {
|
|
|
203
203
|
configuringMessage: en_1.commands.mcp.setup.spinners.configuringCursor,
|
|
204
204
|
configuredMessage: en_1.commands.mcp.setup.spinners.configuredCursor,
|
|
205
205
|
failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureCursor,
|
|
206
|
-
mcpCommand
|
|
206
|
+
mcpCommand,
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
function setupWindsurf(mcpCommand = defaultMcpCommand) {
|
|
@@ -213,11 +213,6 @@ function setupWindsurf(mcpCommand = defaultMcpCommand) {
|
|
|
213
213
|
configuringMessage: en_1.commands.mcp.setup.spinners.configuringWindsurf,
|
|
214
214
|
configuredMessage: en_1.commands.mcp.setup.spinners.configuredWindsurf,
|
|
215
215
|
failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureWindsurf,
|
|
216
|
-
mcpCommand
|
|
216
|
+
mcpCommand,
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
function buildCommandWithAgentString(mcpCommand, agent) {
|
|
220
|
-
const mcpCommandCopy = structuredClone(mcpCommand);
|
|
221
|
-
mcpCommandCopy.args.push('--ai-agent', agent);
|
|
222
|
-
return mcpCommandCopy;
|
|
223
|
-
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Separator } from '@inquirer/prompts';
|
|
1
2
|
import { ComponentTemplate, ComponentTemplateChoice, ProjectTemplateRepoConfig } from '../../../types/Projects';
|
|
2
3
|
import { ProjectMetadata } from '@hubspot/project-parsing-lib/src/lib/project';
|
|
3
4
|
import { SelectProjectTemplatePromptResponse } from '../../prompts/selectProjectTemplatePrompt';
|
|
@@ -7,13 +8,13 @@ export declare function createV3App(providedAuth: string | undefined, providedDi
|
|
|
7
8
|
authType: string;
|
|
8
9
|
distribution: string;
|
|
9
10
|
}>;
|
|
10
|
-
export declare function calculateComponentTemplateChoices(components: ComponentTemplate[], authType: string | undefined, distribution: string | undefined, projectMetadata?: ProjectMetadata): ComponentTemplateChoice[];
|
|
11
|
+
export declare function calculateComponentTemplateChoices(components: ComponentTemplate[], authType: string | undefined, distribution: string | undefined, projectMetadata?: ProjectMetadata): (ComponentTemplateChoice | Separator)[];
|
|
11
12
|
type V3ComponentInfo = {
|
|
12
13
|
authType?: string;
|
|
13
14
|
distribution?: string;
|
|
14
15
|
repoConfig?: ProjectTemplateRepoConfig;
|
|
15
16
|
projectContents?: string;
|
|
16
|
-
componentTemplateChoices?: ComponentTemplateChoice[];
|
|
17
|
+
componentTemplateChoices?: (ComponentTemplateChoice | Separator)[];
|
|
17
18
|
};
|
|
18
19
|
export declare function v3ComponentFlow(platformVersion: string, projectBase: string | undefined, providedAuth: string | undefined, providedDistribution: string | undefined): Promise<V3ComponentInfo>;
|
|
19
20
|
export declare function generateComponentPaths({ selectProjectTemplatePromptResponse, platformVersion, repoConfig, projectContents, authType, distribution, }: {
|
|
@@ -8,6 +8,7 @@ exports.createV3App = createV3App;
|
|
|
8
8
|
exports.calculateComponentTemplateChoices = calculateComponentTemplateChoices;
|
|
9
9
|
exports.v3ComponentFlow = v3ComponentFlow;
|
|
10
10
|
exports.generateComponentPaths = generateComponentPaths;
|
|
11
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
11
12
|
const constants_1 = require("../../constants");
|
|
12
13
|
const en_1 = require("../../../lang/en");
|
|
13
14
|
const promptUtils_1 = require("../../prompts/promptUtils");
|
|
@@ -17,7 +18,6 @@ const path_1 = __importDefault(require("path"));
|
|
|
17
18
|
const legacy_1 = require("./legacy");
|
|
18
19
|
const errorHandlers_1 = require("../../errorHandlers");
|
|
19
20
|
const exitCodes_1 = require("../../enums/exitCodes");
|
|
20
|
-
const inquirer = require('inquirer');
|
|
21
21
|
exports.EMPTY_PROJECT = 'empty';
|
|
22
22
|
exports.PROJECT_WITH_APP = 'app';
|
|
23
23
|
async function createV3App(providedAuth, providedDistribution) {
|
|
@@ -96,7 +96,7 @@ function calculateComponentTemplateChoices(components, authType, distribution, p
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
return disabledComponents.length
|
|
99
|
-
? [...enabledComponents, new
|
|
99
|
+
? [...enabledComponents, new prompts_1.Separator(), ...disabledComponents]
|
|
100
100
|
: [...enabledComponents];
|
|
101
101
|
}
|
|
102
102
|
async function v3ComponentFlow(platformVersion, projectBase, providedAuth, providedDistribution) {
|
|
@@ -11,7 +11,7 @@ export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount):
|
|
|
11
11
|
export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
12
12
|
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
13
13
|
export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
14
|
-
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
14
|
+
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment, useV3?: boolean): Promise<number>;
|
|
15
15
|
export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
|
|
16
16
|
export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig, targetAccountId: number, shouldCreateWithoutConfirmation: boolean, hasPublicApps: boolean): Promise<Project>;
|
|
17
17
|
export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIR?: boolean, profile?: string): Promise<Build>;
|
|
@@ -152,7 +152,7 @@ async function createSandboxForLocalDev(accountId, accountConfig, env) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
// Create a developer test account and return its accountId
|
|
155
|
-
async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env) {
|
|
155
|
+
async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env, useV3 = false) {
|
|
156
156
|
let currentPortalCount = 0;
|
|
157
157
|
let maxTestPortals = 10;
|
|
158
158
|
try {
|
|
@@ -182,7 +182,7 @@ async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, e
|
|
|
182
182
|
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
183
183
|
});
|
|
184
184
|
(0, usageTracking_1.trackCommandMetadataUsage)('developer-test-account-create', { step: 'project-dev' }, accountId);
|
|
185
|
-
const result = await (0, buildAccount_1.buildDeveloperTestAccount)(name, accountConfig, env, maxTestPortals);
|
|
185
|
+
const result = await (0, buildAccount_1.buildDeveloperTestAccount)(name, accountConfig, env, maxTestPortals, useV3);
|
|
186
186
|
return result;
|
|
187
187
|
}
|
|
188
188
|
catch (err) {
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
1
|
+
import { AccountLevel, DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
2
2
|
declare const hubs: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
MARKETING: string;
|
|
4
|
+
OPS: string;
|
|
5
|
+
SERVICE: string;
|
|
6
|
+
SALES: string;
|
|
7
|
+
CONTENT: string;
|
|
8
8
|
};
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
export type HubConfig = `${HubName}:${HubTier}`;
|
|
9
|
+
type HubKey = keyof typeof hubs;
|
|
10
|
+
export type HubConfig = `${HubKey}:${AccountLevel}`;
|
|
12
11
|
export declare function createDeveloperTestAccountConfigPrompt(args?: {
|
|
13
12
|
name?: string;
|
|
14
13
|
description?: string;
|
|
15
14
|
tiers?: HubConfig[];
|
|
16
|
-
}): Promise<DeveloperTestAccountConfig>;
|
|
15
|
+
}, supportFlags?: boolean): Promise<DeveloperTestAccountConfig>;
|
|
17
16
|
export {};
|