@hubspot/cli 8.3.1-experimental.0 → 8.3.1-experimental.2

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.
Files changed (136) hide show
  1. package/api/feedback.d.ts +10 -0
  2. package/api/feedback.js +9 -0
  3. package/bin/cli.js +19 -1
  4. package/commands/account/auth.js +2 -2
  5. package/commands/account/createOverride.js +2 -0
  6. package/commands/account/removeOverride.js +2 -0
  7. package/commands/app/secret/add.js +1 -1
  8. package/commands/app/secret/delete.js +1 -1
  9. package/commands/app/secret/list.js +1 -1
  10. package/commands/app/secret/update.js +1 -1
  11. package/commands/app/secret.js +1 -1
  12. package/commands/auth.js +3 -2
  13. package/commands/cms/function/create.js +5 -37
  14. package/commands/cms/function/deploy.js +8 -1
  15. package/commands/cms/function/list.js +4 -0
  16. package/commands/cms/function/logs.js +2 -0
  17. package/commands/cms/function/server.js +6 -0
  18. package/commands/cms/lighthouseScore.js +1 -1
  19. package/commands/cms/upload.js +6 -0
  20. package/commands/cms/watch.js +2 -0
  21. package/commands/cms/webpack/create.js +5 -32
  22. package/commands/customObject.js +2 -2
  23. package/commands/feedback.d.ts +6 -2
  24. package/commands/feedback.js +82 -8
  25. package/commands/getStarted.js +4 -4
  26. package/commands/hubdb/list.js +2 -2
  27. package/commands/init.js +3 -2
  28. package/commands/mcp/setup.d.ts +1 -0
  29. package/commands/mcp/setup.js +11 -3
  30. package/commands/project/dev/index.js +2 -2
  31. package/commands/project/download.d.ts +2 -0
  32. package/commands/project/download.js +56 -16
  33. package/commands/project/logs.js +2 -2
  34. package/commands/project/upload.js +6 -2
  35. package/commands/project/watch.js +2 -2
  36. package/commands/sandbox/create.js +3 -3
  37. package/commands/sandbox/delete.js +1 -1
  38. package/commands/sandbox.js +1 -1
  39. package/lang/en.d.ts +111 -6
  40. package/lang/en.js +275 -51
  41. package/lib/accountAuth.js +12 -0
  42. package/lib/accountCredentials.d.ts +1 -0
  43. package/lib/accountCredentials.js +25 -0
  44. package/lib/agentHelp.d.ts +17 -0
  45. package/lib/agentHelp.js +90 -0
  46. package/lib/app/logSystemTypes.d.ts +4 -0
  47. package/lib/app/logSystemTypes.js +17 -0
  48. package/lib/app/logs.d.ts +2 -4
  49. package/lib/app/logs.js +2 -17
  50. package/lib/app/migrate.js +5 -8
  51. package/lib/commonOpts.js +4 -0
  52. package/lib/constants.d.ts +4 -0
  53. package/lib/constants.js +6 -0
  54. package/lib/crossPlatformSpawn/escape.d.ts +2 -0
  55. package/lib/crossPlatformSpawn/escape.js +38 -0
  56. package/lib/crossPlatformSpawn/index.d.ts +7 -0
  57. package/lib/crossPlatformSpawn/index.js +43 -0
  58. package/lib/crossPlatformSpawn/resolveCommand.d.ts +1 -0
  59. package/lib/crossPlatformSpawn/resolveCommand.js +69 -0
  60. package/lib/errorHandlers/suppressError.js +3 -3
  61. package/lib/feedback.d.ts +3 -0
  62. package/lib/feedback.js +13 -0
  63. package/lib/jsonOutput/projectDownload.d.ts +1 -0
  64. package/lib/jsonOutput/projectDownload.js +1 -0
  65. package/lib/jsonOutput/projectUpload.d.ts +1 -0
  66. package/lib/jsonOutput/projectUpload.js +1 -0
  67. package/lib/mcp/clients.d.ts +2 -1
  68. package/lib/mcp/clients.js +7 -7
  69. package/lib/mcp/setup.d.ts +7 -2
  70. package/lib/mcp/setup.js +22 -37
  71. package/lib/mcp/skills.d.ts +8 -0
  72. package/lib/mcp/skills.js +64 -0
  73. package/lib/projects/archive.d.ts +8 -0
  74. package/lib/projects/archive.js +104 -0
  75. package/lib/projects/archiveDiff.d.ts +12 -0
  76. package/lib/projects/archiveDiff.js +68 -0
  77. package/lib/projects/config.js +1 -1
  78. package/lib/projects/download.d.ts +37 -0
  79. package/lib/projects/download.js +123 -0
  80. package/lib/projects/localDev/AppDevModeInterface.js +3 -3
  81. package/lib/projects/localDev/LocalDevLogger.js +5 -5
  82. package/lib/projects/localDev/LocalDevWatcher.js +2 -1
  83. package/lib/projects/localDev/helpers/project.js +3 -3
  84. package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
  85. package/lib/projects/projectInfo.js +4 -4
  86. package/lib/projects/projectProfiles.js +3 -3
  87. package/lib/projects/ui.js +3 -3
  88. package/lib/projects/upload.d.ts +3 -1
  89. package/lib/projects/upload.js +23 -6
  90. package/lib/projects/watch.js +4 -2
  91. package/lib/projects/workspaces.js +4 -4
  92. package/lib/prompts/importDataTestAccountSelectPrompt.js +1 -1
  93. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  94. package/lib/prompts/selectPublicAppForMigrationPrompt.js +3 -3
  95. package/lib/serverlessSunset.d.ts +6 -0
  96. package/lib/serverlessSunset.js +32 -0
  97. package/lib/testUtils.d.ts +5 -1
  98. package/lib/testUtils.js +2 -2
  99. package/lib/ui/appLogs.js +4 -4
  100. package/lib/ui/formatting.d.ts +13 -0
  101. package/lib/ui/formatting.js +39 -0
  102. package/lib/ui/git.js +3 -3
  103. package/lib/ui/index.d.ts +9 -23
  104. package/lib/ui/index.js +36 -69
  105. package/lib/ui/uiMessages.js +1 -1
  106. package/lib/validation.js +16 -1
  107. package/lib/yargs/makeWrappedYargsHandler.d.ts +1 -0
  108. package/lib/yargs/makeWrappedYargsHandler.js +7 -0
  109. package/mcp-server/Tool.d.ts +1 -0
  110. package/mcp-server/Tool.js +4 -1
  111. package/mcp-server/server.js +16 -5
  112. package/mcp-server/skills/hubspot-fix-build/SKILL.md +61 -0
  113. package/mcp-server/skills/hubspot-new-app/SKILL.md +84 -0
  114. package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
  115. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  116. package/mcp-server/tools/cms/HsListTool.js +4 -1
  117. package/mcp-server/tools/index.js +2 -2
  118. package/mcp-server/tools/project/DocFetchTool.d.ts +4 -1
  119. package/mcp-server/tools/project/DocFetchTool.js +53 -12
  120. package/mcp-server/tools/project/DocsSearchTool.js +2 -7
  121. package/mcp-server/tools/project/FindProjectsTool.js +4 -1
  122. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +2 -7
  123. package/mcp-server/tools/project/GetApplicationInfoTool.js +2 -7
  124. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +1 -1
  125. package/mcp-server/tools/project/GetBuildLogsTool.js +2 -12
  126. package/mcp-server/tools/project/GetBuildStatusTool.js +2 -12
  127. package/mcp-server/tools/project/KnowledgeSearchTool.js +2 -5
  128. package/mcp-server/tools/project/SubmitFeedbackTool.d.ts +25 -0
  129. package/mcp-server/tools/project/SubmitFeedbackTool.js +73 -0
  130. package/mcp-server/utils/command.js +16 -5
  131. package/mcp-server/utils/errors.d.ts +1 -0
  132. package/mcp-server/utils/errors.js +9 -0
  133. package/mcp-server/utils/feedbackTracking.js +3 -1
  134. package/package.json +12 -14
  135. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
  136. package/mcp-server/tools/cms/HsCreateFunctionTool.js +0 -100
@@ -10,6 +10,13 @@ import { setAsDefaultAccountPrompt } from './prompts/setAsDefaultAccountPrompt.j
10
10
  import { awaitPersonalAccessKeyOverWebsocket } from './auth/awaitPersonalAccessKeyOverWebsocket.js';
11
11
  import { commands } from '../lang/en.js';
12
12
  import { uiLogger } from './ui/logger.js';
13
+ const WHITESPACE_PATTERN = /\s/;
14
+ function getAccountNameError(accountName) {
15
+ if (!accountName || !WHITESPACE_PATTERN.test(accountName)) {
16
+ return undefined;
17
+ }
18
+ return commands.account.subcommands.auth.errors.accountNameContainsSpaces(accountName, toKebabCase(accountName) || undefined);
19
+ }
13
20
  async function getPersonalAccessKey(env, accountId) {
14
21
  if (process.env.BROWSER !== 'none') {
15
22
  try {
@@ -109,6 +116,11 @@ export function getCurrentDefaultAccount() {
109
116
  }
110
117
  }
111
118
  export async function authenticateNewAccount({ env, providedPersonalAccessKey, accountId, setAsDefaultAccount, accountName: providedAccountName, useDefaultAccountName, }) {
119
+ const accountNameError = getAccountNameError(providedAccountName);
120
+ if (accountNameError) {
121
+ uiLogger.error(accountNameError);
122
+ return null;
123
+ }
112
124
  const configMigrationSuccess = await handleConfigMigration();
113
125
  if (!configMigrationSuccess) {
114
126
  return null;
@@ -0,0 +1 @@
1
+ export declare function getConfigCredentials(): string[];
@@ -0,0 +1,25 @@
1
+ import { getAllConfigAccounts } from '@hubspot/local-dev-lib/config';
2
+ import { API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
3
+ function getAccountCredentials(account) {
4
+ if (account.authType === API_KEY_AUTH_METHOD.value) {
5
+ return [account.apiKey];
6
+ }
7
+ const { accessToken, refreshToken } = account.auth?.tokenInfo ?? {};
8
+ if (account.authType === PERSONAL_ACCESS_KEY_AUTH_METHOD.value) {
9
+ return [account.personalAccessKey, accessToken, refreshToken];
10
+ }
11
+ if (account.authType === OAUTH_AUTH_METHOD.value) {
12
+ return [account.auth.clientSecret, accessToken, refreshToken];
13
+ }
14
+ return [accessToken, refreshToken];
15
+ }
16
+ export function getConfigCredentials() {
17
+ try {
18
+ return getAllConfigAccounts()
19
+ .flatMap(getAccountCredentials)
20
+ .filter((credential) => Boolean(credential));
21
+ }
22
+ catch {
23
+ return [];
24
+ }
25
+ }
@@ -0,0 +1,17 @@
1
+ import { Argv } from 'yargs';
2
+ type CommandModule = {
3
+ command?: string | readonly string[];
4
+ describe?: string | false;
5
+ builder?: unknown;
6
+ handler?: unknown;
7
+ };
8
+ export declare function recordCommands(instance: Argv): CommandModule[];
9
+ type VisitedCommand = {
10
+ module: CommandModule;
11
+ commandPath: string[];
12
+ usage: string;
13
+ };
14
+ export declare function walkCommands(modules: CommandModule[], visit: (command: VisitedCommand) => void, parentPath?: string[]): Promise<void>;
15
+ export declare function getRootAgentHelp(rootCommands: CommandModule[]): Promise<string>;
16
+ export declare function getCommandAgentHelp(command: string, helpText: string): string;
17
+ export {};
@@ -0,0 +1,90 @@
1
+ import yargs from 'yargs';
2
+ import { z } from 'zod';
3
+ import { lib } from '../lang/en.js';
4
+ import { indent } from './ui/index.js';
5
+ import { debugError } from './errorHandlers/index.js';
6
+ import { getJsonOutputSchema } from './yargs/makeWrappedYargsHandler.js';
7
+ const { agentHelp } = lib;
8
+ function formatSection(heading, lines) {
9
+ return [heading, ...lines.map(line => `${indent(1)}${line}`)].join('\n');
10
+ }
11
+ function formatWorkflows(workflows) {
12
+ return formatSection(agentHelp.headings.workflows, workflows.flatMap(({ title, steps }) => [
13
+ title,
14
+ ...steps.flatMap(({ command, description }, index) => [
15
+ `${indent(1)}${index + 1}. ${command}`,
16
+ `${indent(2)} ${description}`,
17
+ ]),
18
+ ]));
19
+ }
20
+ export function recordCommands(instance) {
21
+ const commands = [];
22
+ const { command } = instance;
23
+ Object.assign(instance, {
24
+ command(...args) {
25
+ const [module] = args;
26
+ if (typeof module === 'object' && module !== null) {
27
+ commands.push(module);
28
+ }
29
+ return Reflect.apply(command, instance, args);
30
+ },
31
+ });
32
+ return commands;
33
+ }
34
+ export async function walkCommands(modules, visit, parentPath = []) {
35
+ for (const module of modules) {
36
+ const [commandString = ''] = [module.command ?? []].flat();
37
+ const commandPath = [...parentPath, commandString.split(' ')[0]];
38
+ visit({
39
+ module,
40
+ commandPath,
41
+ usage: ['hs', ...parentPath, commandString].join(' '),
42
+ });
43
+ const instance = yargs([]);
44
+ const subcommands = recordCommands(instance);
45
+ try {
46
+ if (typeof module.builder === 'function') {
47
+ await module.builder(instance);
48
+ }
49
+ }
50
+ catch (e) {
51
+ debugError(e);
52
+ }
53
+ await walkCommands(subcommands, visit, commandPath);
54
+ }
55
+ }
56
+ function joinSections(sections) {
57
+ return sections.filter(Boolean).join('\n\n');
58
+ }
59
+ function formatExitCodes() {
60
+ return formatSection(agentHelp.headings.exitCodes, [agentHelp.exitCodes]);
61
+ }
62
+ export async function getRootAgentHelp(rootCommands) {
63
+ const commandLines = [];
64
+ await walkCommands(rootCommands, ({ module, usage }) => {
65
+ if (typeof module.describe === 'string') {
66
+ commandLines.push(`- ${usage}: ${module.describe.replace(/\s*\n\s*/g, ' ')}`);
67
+ }
68
+ });
69
+ return joinSections([
70
+ formatSection(agentHelp.headings.conventions, agentHelp.conventions.map(convention => `- ${convention}`)),
71
+ formatWorkflows(agentHelp.workflows),
72
+ formatSection(agentHelp.headings.commands, commandLines),
73
+ formatExitCodes(),
74
+ ]);
75
+ }
76
+ export function getCommandAgentHelp(command, helpText) {
77
+ const jsonOutputSchema = getJsonOutputSchema(command.replace(/^hs /, '').replaceAll(' ', '-'));
78
+ const workflows = agentHelp.workflows.filter(({ steps }) => steps.some(step => `${step.command} `.startsWith(`${command} `)));
79
+ return joinSections([
80
+ helpText.includes('--json') &&
81
+ formatSection(agentHelp.headings.jsonOutput, jsonOutputSchema
82
+ ? [
83
+ agentHelp.jsonOutput.schema,
84
+ ...JSON.stringify(z.toJSONSchema(jsonOutputSchema), null, 2).split('\n'),
85
+ ]
86
+ : [agentHelp.jsonOutput.noSchema]),
87
+ workflows.length > 0 && formatWorkflows(workflows),
88
+ formatExitCodes(),
89
+ ]);
90
+ }
@@ -0,0 +1,4 @@
1
+ export declare const SYSTEM_TYPE_DISPLAY_NAMES: {
2
+ [key: string]: string;
3
+ };
4
+ export declare function toTypeChoice(systemType: string): string;
@@ -0,0 +1,17 @@
1
+ export const SYSTEM_TYPE_DISPLAY_NAMES = {
2
+ WEBHOOKS: 'Webhooks',
3
+ API_CALL: 'API Call',
4
+ SERVERLESS_EXECUTION: 'Serverless Function',
5
+ CRM_EXTENSIBILITY_CARD: 'CRM Card',
6
+ CRM_LEGACY_CARD: 'CRM Legacy Card',
7
+ EXTENSION_LOG: 'Extension Log',
8
+ EXTENSION_RENDER: 'Extension Render',
9
+ APP_SETTINGS: 'App Settings',
10
+ PROXY_EXECUTION: 'Proxy Execution',
11
+ SERVERLESS_GATEWAY_EXECUTION: 'Serverless Gateway Execution',
12
+ ACCEPTANCE_TEST: 'Acceptance Test',
13
+ OAUTH_AUTHORIZATION: 'OAuth Authorization',
14
+ };
15
+ export function toTypeChoice(systemType) {
16
+ return systemType.toLowerCase().replaceAll('_', '-');
17
+ }
package/lib/app/logs.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { AppLogEntry as ApiAppLogEntry, SystemType } from '@hubspot/local-dev-lib/types/AppLogs';
2
- export declare const SYSTEM_TYPE_DISPLAY_NAMES: {
3
- [key: string]: string;
4
- };
2
+ import { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice } from './logSystemTypes.js';
3
+ export { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice };
5
4
  export declare const SYSTEM_TYPE_CHOICES: string[];
6
5
  export declare function parseSinceTime(sinceInput: string): {
7
6
  startTime: number;
@@ -24,7 +23,6 @@ export type AppLogsOptions = {
24
23
  limit?: number;
25
24
  errorsOnly?: boolean;
26
25
  };
27
- export declare function toTypeChoice(systemType: string): string;
28
26
  export declare function toSystemType(choice: string): string;
29
27
  export declare function getTypeChoices(): {
30
28
  name: string;
package/lib/app/logs.js CHANGED
@@ -5,20 +5,8 @@ import { uiLogger } from '../ui/logger.js';
5
5
  import SpinniesManager from '../ui/SpinniesManager.js';
6
6
  import { handleExit, handleKeypress } from '../process.js';
7
7
  import { commands } from '../../lang/en.js';
8
- export const SYSTEM_TYPE_DISPLAY_NAMES = {
9
- WEBHOOKS: 'Webhooks',
10
- API_CALL: 'API Call',
11
- SERVERLESS_EXECUTION: 'Serverless Function',
12
- CRM_EXTENSIBILITY_CARD: 'CRM Card',
13
- CRM_LEGACY_CARD: 'CRM Legacy Card',
14
- EXTENSION_LOG: 'Extension Log',
15
- EXTENSION_RENDER: 'Extension Render',
16
- APP_SETTINGS: 'App Settings',
17
- PROXY_EXECUTION: 'Proxy Execution',
18
- SERVERLESS_GATEWAY_EXECUTION: 'Serverless Gateway Execution',
19
- ACCEPTANCE_TEST: 'Acceptance Test',
20
- OAUTH_AUTHORIZATION: 'OAuth Authorization',
21
- };
8
+ import { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice } from './logSystemTypes.js';
9
+ export { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice };
22
10
  export const SYSTEM_TYPE_CHOICES = Object.keys(SYSTEM_TYPE_DISPLAY_NAMES).map(toTypeChoice);
23
11
  export function parseSinceTime(sinceInput) {
24
12
  const now = moment();
@@ -68,9 +56,6 @@ export function transformApiLogEntry(apiLog) {
68
56
  };
69
57
  }
70
58
  const TAIL_DELAY = 5000;
71
- export function toTypeChoice(systemType) {
72
- return systemType.toLowerCase().replaceAll('_', '-');
73
- }
74
59
  export function toSystemType(choice) {
75
60
  return choice.toUpperCase().replaceAll('-', '_');
76
61
  }
@@ -10,12 +10,12 @@ import { MIGRATION_STATUS } from '@hubspot/local-dev-lib/types/Migration';
10
10
  import { downloadProject, fetchProjectComponentsMetadata, } from '@hubspot/local-dev-lib/api/projects';
11
11
  import { Separator } from '@inquirer/prompts';
12
12
  import { confirmPrompt, inputPrompt, listPrompt, } from '../prompts/promptUtils.js';
13
- import { uiAccountDescription, uiCommandReference, uiLine, uiLink, } from '../ui/index.js';
13
+ import { uiAccountDescription, uiCommandReference, logUiLine, uiLink, } from '../ui/index.js';
14
+ import { archiveProjectSource } from '../projects/archive.js';
14
15
  import { ensureProjectExists } from '../projects/ensureProjectExists.js';
15
16
  import SpinniesManager from '../ui/SpinniesManager.js';
16
17
  import { DEFAULT_POLLING_STATUS_LOOKUP, poll } from '../polling.js';
17
18
  import { checkMigrationStatusV2, CLI_UNMIGRATABLE_REASONS, continueAppMigration, initializeAppMigration, isMigrationStatus, listAppsForMigration, } from '../../api/migrate.js';
18
- import fs from 'fs';
19
19
  import { lib } from '../../lang/en.js';
20
20
  import { hasUnfiedAppsAccess } from '../hasFeature.js';
21
21
  import { getProjectBuildDetailUrl, getProjectDetailUrl, } from '../projects/urls.js';
@@ -311,11 +311,8 @@ export async function downloadProjectFiles(derivedAccountId, projectName, buildI
311
311
  const { projectDir } = projectConfig;
312
312
  absoluteDestPath = projectDir;
313
313
  const { srcDir } = projectConfig.projectConfig;
314
- const archiveDest = srcDir === '.'
315
- ? path.join(path.dirname(projectDir), `${path.basename(projectDir)}-archive`)
316
- : path.join(projectDir, 'archive');
317
314
  // Move the existing source directory to archive
318
- fs.renameSync(path.join(projectDir, srcDir), archiveDest);
315
+ const archiveDest = archiveProjectSource(projectDir, srcDir);
319
316
  uiLogger.info(lib.migrate.sourceContentsMoved(archiveDest));
320
317
  }
321
318
  else {
@@ -388,8 +385,8 @@ export async function migrateApp(derivedAccountId, options, projectConfig) {
388
385
  uiLogger.log(uiLink('Build Details', getProjectBuildDetailUrl(projectName, buildId, derivedAccountId)));
389
386
  }
390
387
  export function logInvalidAccountError() {
391
- uiLine();
388
+ logUiLine();
392
389
  uiLogger.error(lib.migrate.errors.invalidAccountTypeTitle);
393
390
  uiLogger.log(lib.migrate.errors.invalidAccountTypeDescription(uiCommandReference('hs account use')));
394
- uiLine();
391
+ logUiLine();
395
392
  }
package/lib/commonOpts.js CHANGED
@@ -10,6 +10,7 @@ import { uiCommandReference } from './ui/index.js';
10
10
  import { lib } from '../lang/en.js';
11
11
  import { getTerminalUISupport, UI_COLORS } from './ui/index.js';
12
12
  import SpinniesManager from './ui/SpinniesManager.js';
13
+ import { getCommandAgentHelp } from './agentHelp.js';
13
14
  export function addGlobalOptions(yargs) {
14
15
  yargs.version(false);
15
16
  yargs.option('debug', {
@@ -129,6 +130,9 @@ export async function addCustomHelpOutput(yargs, command, describe) {
129
130
  const fullCommand = `${commandBase.trim()} ${commandString}`;
130
131
  // Format the original help output to be more readable
131
132
  let commandHelp = await yargs.getHelp();
133
+ if (parsedArgv.agentHelp) {
134
+ commandHelp = `${commandHelp}\n\n${getCommandAgentHelp(`${commandBase.trim()} ${commandString.split(' ')[0]}`, commandHelp)}`;
135
+ }
132
136
  ['Options:', 'Commands:', 'Examples:', 'Positionals:'].forEach(header => {
133
137
  commandHelp = commandHelp.replace(header, chalk.bold(header));
134
138
  });
@@ -8,6 +8,8 @@ export declare const ONE_DAY_IN_MILLISECONDS: number;
8
8
  export declare const CLI_DEPRECATED_MAJOR_VERSION = 7;
9
9
  export declare const CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE = "2026-09-02";
10
10
  export declare const CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE = "2027-03-01";
11
+ export declare const SERVERLESS_SUNSET_EDITING_DISABLED_DATE = "2026-11-17";
12
+ export declare const SERVERLESS_SUNSET_CHANGELOG_URL: "https://developers.hubspot.com/changelog/sunsetting-design-manager-serverless-functions-and-older-node.js-runtimes-for-custom-code-actions";
11
13
  export declare const CLI_SUPPORT_GUIDELINES_URL: "https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/version-support";
12
14
  export declare const DEFAULT_POLLING_DELAY = 2000;
13
15
  export declare const PREVIEW_POLL_TIMEOUT: number;
@@ -160,4 +162,6 @@ export declare const ACCOUNT_LEVELS: {
160
162
  };
161
163
  export declare const ACCOUNT_LEVEL_CHOICES: readonly ["FREE", "STARTER", "PROFESSIONAL", "ENTERPRISE"];
162
164
  export declare const FEEDBACK_URL = "https://developers.hubspot.com/feedback";
165
+ export declare const FEEDBACK_SOURCE_ENV_VAR = "HUBSPOT_FEEDBACK_SOURCE";
166
+ export declare const MAX_FEEDBACK_LENGTH = 5000;
163
167
  export declare const LOCAL_DEV_DEFAULT_PORT = 4828;
package/lib/constants.js CHANGED
@@ -12,6 +12,10 @@ export const CLI_DEPRECATED_MAJOR_VERSION = 7;
12
12
  export const CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE = '2026-09-02';
13
13
  // The date CLI_DEPRECATED_MAJOR_VERSION reaches end of life
14
14
  export const CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE = '2027-03-01';
15
+ // The date, in UTC, that editing CMS serverless functions stops. The commands
16
+ // that deploy or serve functions are disabled on and after this date.
17
+ export const SERVERLESS_SUNSET_EDITING_DISABLED_DATE = '2026-11-17';
18
+ export const SERVERLESS_SUNSET_CHANGELOG_URL = 'https://developers.hubspot.com/changelog/sunsetting-design-manager-serverless-functions-and-older-node.js-runtimes-for-custom-code-actions';
15
19
  export const CLI_SUPPORT_GUIDELINES_URL = 'https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/version-support';
16
20
  export const DEFAULT_POLLING_DELAY = 2000;
17
21
  export const PREVIEW_POLL_TIMEOUT = 5 * 60 * 1000;
@@ -166,6 +170,8 @@ export const ACCOUNT_LEVEL_CHOICES = [
166
170
  ACCOUNT_LEVELS.ENTERPRISE,
167
171
  ];
168
172
  export const FEEDBACK_URL = 'https://developers.hubspot.com/feedback';
173
+ export const FEEDBACK_SOURCE_ENV_VAR = 'HUBSPOT_FEEDBACK_SOURCE';
174
+ export const MAX_FEEDBACK_LENGTH = 5000;
169
175
  // TODO: remove this constant and use PORT_MANAGER_SERVER_PORT from
170
176
  // @hubspot/local-dev-lib once LDL changes its default to 4828.
171
177
  export const LOCAL_DEV_DEFAULT_PORT = 4828;
@@ -0,0 +1,2 @@
1
+ export declare function escapeMetaCharacters(value: string): string;
2
+ export declare function escapeArgument(arg: string, doubleEscapeMetaChars: boolean): string;
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Adapted from cross-spawn 7.0.6 (lib/util/escape.js)
3
+ * https://github.com/moxystudio/node-cross-spawn
4
+ *
5
+ * The MIT License (MIT)
6
+ *
7
+ * Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in
17
+ * all copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ * THE SOFTWARE.
26
+ */
27
+ const META_CHARS_PATTERN = /([()\][%!^"`<>&|;, *?])/g;
28
+ const BACKSLASHES_BEFORE_QUOTE_PATTERN = /(?=(\\+?)?)\1"/g;
29
+ const TRAILING_BACKSLASHES_PATTERN = /(?=(\\+?)?)\1$/;
30
+ export function escapeMetaCharacters(value) {
31
+ return value.replace(META_CHARS_PATTERN, '^$1');
32
+ }
33
+ export function escapeArgument(arg, doubleEscapeMetaChars) {
34
+ const quotesEscaped = arg.replace(BACKSLASHES_BEFORE_QUOTE_PATTERN, '$1$1\\"');
35
+ const trailingEscaped = quotesEscaped.replace(TRAILING_BACKSLASHES_PATTERN, '$1$1');
36
+ const escaped = escapeMetaCharacters(`"${trailingEscaped}"`);
37
+ return doubleEscapeMetaChars ? escapeMetaCharacters(escaped) : escaped;
38
+ }
@@ -0,0 +1,7 @@
1
+ import { type ChildProcessWithoutNullStreams } from 'node:child_process';
2
+ type CrossPlatformSpawnOptions = {
3
+ cwd: string;
4
+ env: NodeJS.ProcessEnv;
5
+ };
6
+ export declare function crossPlatformSpawn(command: string, args: string[], options: CrossPlatformSpawnOptions): ChildProcessWithoutNullStreams;
7
+ export {};
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Adapted from cross-spawn 7.0.6 (index.js and lib/parse.js)
3
+ * https://github.com/moxystudio/node-cross-spawn
4
+ * The cross-spawn license is reproduced in escape.ts.
5
+ */
6
+ import path from 'path';
7
+ import { spawn } from 'node:child_process';
8
+ import { lib } from '../../lang/en.js';
9
+ import { escapeArgument, escapeMetaCharacters } from './escape.js';
10
+ import { resolveCommand } from './resolveCommand.js';
11
+ const DEFAULT_SHELL = 'cmd.exe';
12
+ const SKIP_CURRENT_DIRECTORY_ENV_VAR = 'NoDefaultCurrentDirectoryInExePath';
13
+ const CMD_SHIM_PATTERN = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
14
+ const UNSAFE_ARG_PATTERN = /["%^&|<>\r\n]/;
15
+ const TRAILING_BACKSLASHES = '\\\\';
16
+ function isUnsafeArg(arg) {
17
+ return UNSAFE_ARG_PATTERN.test(arg) || arg.endsWith(TRAILING_BACKSLASHES);
18
+ }
19
+ function assertArgsAreSafe(args) {
20
+ const unsafeArg = args.find(isUnsafeArg);
21
+ if (unsafeArg !== undefined) {
22
+ throw new Error(lib.crossPlatformSpawn.unsafeArg(unsafeArg));
23
+ }
24
+ }
25
+ function buildShellLine(command, args, env) {
26
+ const file = resolveCommand(command, env);
27
+ const doubleEscapeMetaChars = file !== undefined && CMD_SHIM_PATTERN.test(file);
28
+ return [
29
+ escapeMetaCharacters(path.win32.normalize(command)),
30
+ ...args.map(arg => escapeArgument(arg, doubleEscapeMetaChars)),
31
+ ].join(' ');
32
+ }
33
+ export function crossPlatformSpawn(command, args, options) {
34
+ if (process.platform !== 'win32') {
35
+ return spawn(command, args, options);
36
+ }
37
+ assertArgsAreSafe(args);
38
+ return spawn(process.env.comspec || DEFAULT_SHELL, ['/d', '/s', '/c', `"${buildShellLine(command, args, options.env)}"`], {
39
+ ...options,
40
+ env: { ...options.env, [SKIP_CURRENT_DIRECTORY_ENV_VAR]: '1' },
41
+ windowsVerbatimArguments: true,
42
+ });
43
+ }
@@ -0,0 +1 @@
1
+ export declare function resolveCommand(command: string, env: NodeJS.ProcessEnv): string | undefined;
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Adapted from cross-spawn 7.0.6 (lib/util/resolveCommand.js), whose
3
+ * license is reproduced in escape.ts, and from the packages below.
4
+ *
5
+ * which 2.0.2 (which.js) and isexe 2.0.0 (windows.js)
6
+ * https://github.com/isaacs/node-which
7
+ * https://github.com/isaacs/isexe
8
+ *
9
+ * The ISC License
10
+ *
11
+ * Copyright (c) Isaac Z. Schlueter and Contributors
12
+ *
13
+ * Permission to use, copy, modify, and/or distribute this software for any
14
+ * purpose with or without fee is hereby granted, provided that the above
15
+ * copyright notice and this permission notice appear in all copies.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
18
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
19
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
20
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
22
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
23
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24
+ *
25
+ * path-key 3.1.1 (index.js)
26
+ * https://github.com/sindresorhus/path-key
27
+ *
28
+ * MIT License
29
+ *
30
+ * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
31
+ *
32
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
33
+ *
34
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
35
+ *
36
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37
+ */
38
+ import fs from 'fs';
39
+ import path from 'path';
40
+ const PATH_DELIMITER = ';';
41
+ const DEFAULT_PATH_EXT = '.EXE;.CMD;.BAT;.COM';
42
+ const QUOTED_PATH_PATTERN = /^".*"$/;
43
+ function getPathKey(env) {
44
+ return (Object.keys(env)
45
+ .reverse()
46
+ .find(key => key.toUpperCase() === 'PATH') || 'Path');
47
+ }
48
+ function unquote(directory) {
49
+ return QUOTED_PATH_PATTERN.test(directory)
50
+ ? directory.slice(1, -1)
51
+ : directory;
52
+ }
53
+ function isFile(filePath) {
54
+ try {
55
+ return fs.statSync(filePath).isFile();
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ }
61
+ export function resolveCommand(command, env) {
62
+ const directories = (env[getPathKey(env)] || process.env.PATH || '')
63
+ .split(PATH_DELIMITER)
64
+ .map(unquote);
65
+ const extensions = (process.env.PATHEXT || DEFAULT_PATH_EXT).split(PATH_DELIMITER);
66
+ return directories
67
+ .flatMap(directory => extensions.map(extension => path.win32.join(directory, command + extension)))
68
+ .find(isFile);
69
+ }
@@ -2,7 +2,7 @@ import { isSpecifiedError, isMissingScopeError, } from '@hubspot/local-dev-lib/e
2
2
  import { uiLogger } from '../ui/logger.js';
3
3
  import { PLATFORM_VERSION_ERROR_TYPES } from '../constants.js';
4
4
  import { lib } from '../../lang/en.js';
5
- import { uiAccountDescription, uiLine, uiLink } from '../ui/index.js';
5
+ import { uiAccountDescription, logUiLine, uiLink } from '../ui/index.js';
6
6
  import { isPromptExitError } from '../errors/PromptExitError.js';
7
7
  function createPlatformVersionError(err, subCategory) {
8
8
  let translationKey = 'unspecifiedPlatformVersion';
@@ -17,7 +17,7 @@ function createPlatformVersionError(err, subCategory) {
17
17
  platformVersion = errorContext?.PLATFORM_VERSION ?? platformVersion;
18
18
  translationKey = 'nonExistentPlatformVersion';
19
19
  }
20
- uiLine();
20
+ logUiLine();
21
21
  uiLogger.error(lib.errorHandlers.suppressErrors.platformVersionErrors.header);
22
22
  const errorMessage = lib.errorHandlers.suppressErrors.platformVersionErrors[translationKey];
23
23
  uiLogger.log(typeof errorMessage === 'function'
@@ -25,7 +25,7 @@ function createPlatformVersionError(err, subCategory) {
25
25
  : errorMessage);
26
26
  uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.updateProject);
27
27
  uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.betaLink(uiLink(lib.errorHandlers.suppressErrors.platformVersionErrors.docsLink, 'https://developers.hubspot.com/docs/developer-tooling/platform/versioning')));
28
- uiLine();
28
+ logUiLine();
29
29
  }
30
30
  export function shouldSuppressError(err, context) {
31
31
  if (isPromptExitError(err)) {
@@ -0,0 +1,3 @@
1
+ import { FeedbackSource } from '../api/feedback.js';
2
+ export declare function containsAccountCredentials(feedback: string): boolean;
3
+ export declare function submitFeedback(accountId: number, feedback: string, source: FeedbackSource): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import { sendFeedback } from '../api/feedback.js';
2
+ import { getConfigCredentials } from './accountCredentials.js';
3
+ import { pkg } from './jsonLoader.js';
4
+ export function containsAccountCredentials(feedback) {
5
+ return getConfigCredentials().some(credential => feedback.includes(credential));
6
+ }
7
+ export async function submitFeedback(accountId, feedback, source) {
8
+ await sendFeedback(accountId, {
9
+ feedback,
10
+ source,
11
+ cliVersion: pkg.version,
12
+ });
13
+ }
@@ -3,5 +3,6 @@ export declare const ProjectDownloadSchema: z.ZodObject<{
3
3
  projectName: z.ZodString;
4
4
  buildId: z.ZodNumber;
5
5
  dest: z.ZodString;
6
+ archiveDest: z.ZodOptional<z.ZodString>;
6
7
  }, z.core.$strip>;
7
8
  export type ProjectDownloadJsonOutput = z.infer<typeof ProjectDownloadSchema>;
@@ -3,4 +3,5 @@ export const ProjectDownloadSchema = z.object({
3
3
  projectName: z.string(),
4
4
  buildId: z.number(),
5
5
  dest: z.string(),
6
+ archiveDest: z.string().optional(),
6
7
  });
@@ -21,6 +21,7 @@ export declare const ProjectUploadSchema: z.ZodObject<{
21
21
  releaseTag: z.ZodOptional<z.ZodString>;
22
22
  succeeded: z.ZodBoolean;
23
23
  }, z.core.$strip>>;
24
+ skippedHsMetaFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
25
  }, z.core.$strip>;
25
26
  export type PreviewJsonOutput = z.infer<typeof PreviewSchema>;
26
27
  export type TargetAccountJsonOutput = z.infer<typeof TargetAccountSchema>;
@@ -13,6 +13,7 @@ export const ProjectUploadSchema = z.object({
13
13
  buildId: z.number().optional(),
14
14
  deployId: z.number().optional(),
15
15
  preview: PreviewSchema.optional(),
16
+ skippedHsMetaFiles: z.array(z.string()).optional(),
16
17
  });
17
18
  export function mapAccountToTargetAccount(accountId, account) {
18
19
  return {
@@ -1,5 +1,5 @@
1
1
  export declare const MCP_SERVER_NAME = "HubSpotDev";
2
- export type McpClientId = 'codex' | 'claude' | 'cursor' | 'devin' | 'gemini' | 'opencode' | 'vscode';
2
+ export type McpClientId = 'codex' | 'claude' | 'cursor' | 'devin' | 'opencode' | 'vscode';
3
3
  type McpClientDetection = {
4
4
  type: 'json' | 'text';
5
5
  pathSegments: string[];
@@ -7,6 +7,7 @@ type McpClientDetection = {
7
7
  export type McpClient = {
8
8
  id: McpClientId;
9
9
  detection: McpClientDetection;
10
+ skillsPathSegments: string[];
10
11
  };
11
12
  export declare const MCP_CLIENTS: McpClient[];
12
13
  export declare function getMcpClientPathSegments(id: McpClientId): string[];