@hubspot/cli 8.3.0-experimental.0 → 8.3.1-experimental.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.
Files changed (58) hide show
  1. package/bin/cli.js +2 -0
  2. package/commands/app/migrate.js +3 -3
  3. package/commands/project/migrate.js +4 -4
  4. package/lang/en.d.ts +8 -0
  5. package/lang/en.js +12 -3
  6. package/lib/accountAuth.d.ts +1 -0
  7. package/lib/accountAuth.js +8 -0
  8. package/lib/app/urls.d.ts +0 -1
  9. package/lib/app/urls.js +0 -4
  10. package/lib/constants.d.ts +6 -0
  11. package/lib/constants.js +11 -0
  12. package/lib/middleware/deprecationWarningMiddleware.d.ts +1 -0
  13. package/lib/middleware/deprecationWarningMiddleware.js +57 -0
  14. package/lib/projects/localDev/LocalDevWatcher.js +1 -1
  15. package/lib/prompts/projectProfilePrompt.d.ts +7 -0
  16. package/lib/prompts/projectProfilePrompt.js +1 -1
  17. package/lib/testUtils.d.ts +5 -0
  18. package/lib/testUtils.js +24 -0
  19. package/lib/ui/index.js +11 -1
  20. package/lib/ui/uiMessages.d.ts +1 -0
  21. package/lib/ui/uiMessages.js +1 -0
  22. package/mcp-server/server.js +9 -3
  23. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +1 -1
  24. package/mcp-server/tools/cms/HsFunctionLogsTool.js +58 -4
  25. package/mcp-server/tools/project/AuthAccountTool.d.ts +1 -0
  26. package/mcp-server/tools/project/AuthAccountTool.js +24 -3
  27. package/mcp-server/tools/project/CreateProjectTool.js +1 -1
  28. package/mcp-server/tools/project/DeployProjectTool.d.ts +2 -2
  29. package/mcp-server/tools/project/DeployProjectTool.js +26 -16
  30. package/mcp-server/tools/project/DocFetchTool.js +1 -1
  31. package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
  32. package/mcp-server/tools/project/DocsSearchTool.js +18 -9
  33. package/mcp-server/tools/project/FindProjectsTool.js +12 -0
  34. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +3 -2
  35. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +38 -10
  36. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +2 -1
  37. package/mcp-server/tools/project/GetApplicationInfoTool.js +13 -14
  38. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +2 -1
  39. package/mcp-server/tools/project/GetBuildLogsTool.js +12 -9
  40. package/mcp-server/tools/project/GetBuildStatusTool.js +11 -46
  41. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +2 -1
  42. package/mcp-server/tools/project/GetConfigValuesTool.js +11 -8
  43. package/mcp-server/tools/project/KnowledgeSearchTool.js +6 -3
  44. package/mcp-server/tools/project/UploadProjectTools.d.ts +2 -2
  45. package/mcp-server/tools/project/UploadProjectTools.js +49 -36
  46. package/mcp-server/tools/project/apps.d.ts +8 -0
  47. package/mcp-server/tools/project/apps.js +7 -0
  48. package/mcp-server/tools/project/constants.d.ts +2 -0
  49. package/mcp-server/tools/project/constants.js +7 -0
  50. package/mcp-server/tools/project/productionConfirmation.d.ts +12 -0
  51. package/mcp-server/tools/project/productionConfirmation.js +45 -0
  52. package/mcp-server/tools/project/resolveAccount.d.ts +15 -0
  53. package/mcp-server/tools/project/resolveAccount.js +60 -0
  54. package/mcp-server/utils/elicitSelection.d.ts +11 -0
  55. package/mcp-server/utils/elicitSelection.js +25 -0
  56. package/mcp-server/utils/elicitation.d.ts +2 -0
  57. package/mcp-server/utils/elicitation.js +9 -6
  58. package/package.json +4 -4
package/bin/cli.js CHANGED
@@ -10,6 +10,7 @@ import { checkAndWarnGitInclusionMiddleware } from '../lib/middleware/gitMiddlew
10
10
  import { performChecks } from '../lib/middleware/yargsChecksMiddleware.js';
11
11
  import { setRequestHeaders } from '../lib/middleware/requestMiddleware.js';
12
12
  import { checkFireAlarms } from '../lib/middleware/fireAlarmMiddleware.js';
13
+ import { checkDeprecationWarning } from '../lib/middleware/deprecationWarningMiddleware.js';
13
14
  import { handleDisableUsageTracking } from '../lib/middleware/usageTrackingMiddleware.js';
14
15
  import initCommand from '../commands/init.js';
15
16
  import hubdbCommand from '../commands/hubdb.js';
@@ -70,6 +71,7 @@ const argv = yargs(process.argv.slice(2))
70
71
  injectAccountIdMiddleware,
71
72
  validateConfigMiddleware,
72
73
  autoUpdateCLI,
74
+ checkDeprecationWarning,
73
75
  checkAndWarnGitInclusionMiddleware,
74
76
  validateAccountOptions,
75
77
  checkFireAlarms,
@@ -9,7 +9,7 @@ import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
9
9
  import { migrateApp } from '../../lib/app/migrate.js';
10
10
  import { getIsInProject } from '../../lib/projects/config.js';
11
11
  import { makeYargsBuilder } from '../../lib/yargsUtils.js';
12
- const { v2025_2, v2026_03_BETA, v2026_03 } = PLATFORM_VERSIONS;
12
+ const { v2025_2, v2026_03_BETA, v2026_03, v2026_09 } = PLATFORM_VERSIONS;
13
13
  const command = 'migrate';
14
14
  const describe = commands.project.migrateApp.describe;
15
15
  export function handlerGenerator(commandTrackingName) {
@@ -67,7 +67,7 @@ function appMigrateBuilder(yargs) {
67
67
  },
68
68
  'platform-version': {
69
69
  type: 'string',
70
- choices: [v2025_2, v2026_03_BETA, v2026_03],
70
+ choices: [v2025_2, v2026_03_BETA, v2026_03, v2026_09],
71
71
  default: v2026_03,
72
72
  },
73
73
  unstable: {
@@ -81,7 +81,7 @@ function appMigrateBuilder(yargs) {
81
81
  ]);
82
82
  return yargs;
83
83
  }
84
- const builder = makeYargsBuilder(appMigrateBuilder, command, commands.project.migrateApp.describe, {
84
+ const builder = makeYargsBuilder(appMigrateBuilder, command, commands.project.migrateApp.verboseDescribe, {
85
85
  useGlobalOptions: true,
86
86
  useConfigOptions: true,
87
87
  useAccountOptions: true,
@@ -12,7 +12,7 @@ import { renderInline } from '../../ui/render.js';
12
12
  import { getWarningBox } from '../../ui/components/StatusMessageBoxes.js';
13
13
  import { getHasMigratableThemes, migrateThemesV2, } from '../../lib/theme/migrate.js';
14
14
  import { trackCommandMetadataUsage } from '../../lib/usageTracking.js';
15
- const { v2025_2, v2026_03_BETA, v2026_03 } = PLATFORM_VERSIONS;
15
+ const { v2025_2, v2026_03_BETA, v2026_03, v2026_09 } = PLATFORM_VERSIONS;
16
16
  const command = 'migrate';
17
17
  const describe = commands.project.migrate.describe;
18
18
  async function handler(args) {
@@ -62,8 +62,8 @@ function projectMigrateBuilder(yargs) {
62
62
  yargs
63
63
  .option('platform-version', {
64
64
  type: 'string',
65
- choices: [v2025_2, v2026_03_BETA, v2026_03],
66
- default: v2026_03,
65
+ choices: [v2025_2, v2026_03_BETA, v2026_03, v2026_09],
66
+ default: v2026_09,
67
67
  })
68
68
  .option('unstable', {
69
69
  type: 'boolean',
@@ -72,7 +72,7 @@ function projectMigrateBuilder(yargs) {
72
72
  });
73
73
  return yargs;
74
74
  }
75
- const builder = makeYargsBuilder(projectMigrateBuilder, command, commands.project.migrate.describe, {
75
+ const builder = makeYargsBuilder(projectMigrateBuilder, command, commands.project.migrate.verboseDescribe, {
76
76
  useGlobalOptions: true,
77
77
  useConfigOptions: true,
78
78
  useAccountOptions: true,
package/lang/en.d.ts CHANGED
@@ -1601,6 +1601,7 @@ export declare const commands: {
1601
1601
  };
1602
1602
  migrateApp: {
1603
1603
  describe: string;
1604
+ verboseDescribe: string;
1604
1605
  examples: {
1605
1606
  default: string;
1606
1607
  };
@@ -1645,6 +1646,7 @@ export declare const commands: {
1645
1646
  migrate: {
1646
1647
  preamble: (platformVersion: string) => string;
1647
1648
  describe: string;
1649
+ verboseDescribe: string;
1648
1650
  errors: {
1649
1651
  noProjectConfig: (command: string) => string;
1650
1652
  };
@@ -3556,6 +3558,12 @@ export declare const lib: {
3556
3558
  updateFailed: (latestVersion: string) => string;
3557
3559
  enableAutoUpdatesMessage: string;
3558
3560
  };
3561
+ deprecationWarning: {
3562
+ deprecatedTitle: string;
3563
+ deprecatedMessage: (currentVersion: string, eolDate: string) => string;
3564
+ endOfLifeTitle: string;
3565
+ endOfLifeMessage: (currentVersion: string, eolDate: string) => string;
3566
+ };
3559
3567
  };
3560
3568
  projectProfiles: {
3561
3569
  logs: {
package/lang/en.js CHANGED
@@ -2,11 +2,12 @@ import chalk from 'chalk';
2
2
  import { mapToUserFriendlyName } from '@hubspot/project-parsing-lib/transform';
3
3
  import { PLATFORM_VERSIONS } from '@hubspot/project-parsing-lib/constants';
4
4
  import { PERSONAL_ACCESS_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
5
- import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, LEGACY_PUBLIC_APP_FILE, LOCAL_DEV_DEFAULT_PORT, PROJECT_CONFIG_FILE, PROJECT_WITH_APP, } from '../lib/constants.js';
5
+ import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, CLI_SUPPORT_GUIDELINES_URL, LEGACY_PUBLIC_APP_FILE, LOCAL_DEV_DEFAULT_PORT, PROJECT_CONFIG_FILE, PROJECT_WITH_APP, } from '../lib/constants.js';
6
6
  import { ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME, DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME, GLOBAL_CONFIG_PATH, } from '@hubspot/local-dev-lib/constants/config';
7
7
  import { indent, UI_COLORS, uiAccountDescription, uiAuthCommandReference, uiBetaTag, uiCommandReference, uiDeprecatedTag, uiLink, } from '../lib/ui/index.js';
8
8
  import { getLocalDevUiUrl, getProjectDetailUrl, getProjectSettingsUrl, } from '../lib/projects/urls.js';
9
9
  import { getProductUpdatesUrl } from '../lib/links.js';
10
+ const MIGRATION_SUPPORT_CUTOFF_NOTICE = 'Automated platform version migrations beyond 2026.09 will not be supported.';
10
11
  export const commands = {
11
12
  generalErrors: {
12
13
  srcIsProject: (src, command) => `"${src}" is in a project folder. Did you mean "hs project ${command}"?`,
@@ -1616,7 +1617,8 @@ export const commands = {
1616
1617
  },
1617
1618
  },
1618
1619
  migrateApp: {
1619
- describe: 'Migrate a public app to the projects framework.',
1620
+ describe: uiDeprecatedTag(`Migrate a public app to the projects framework. ${MIGRATION_SUPPORT_CUTOFF_NOTICE}`, false),
1621
+ verboseDescribe: uiDeprecatedTag(`Migrate a public app to the projects framework. This command walks you through the fields required to complete the migration and downloads the project source code into a directory of your choosing.\n\n${chalk.bold.yellow(MIGRATION_SUPPORT_CUTOFF_NOTICE)}`, false),
1620
1622
  examples: {
1621
1623
  default: 'Migrate a public app to the projects framework',
1622
1624
  },
@@ -1660,7 +1662,8 @@ export const commands = {
1660
1662
  },
1661
1663
  migrate: {
1662
1664
  preamble: (platformVersion) => `This command will migrate an existing project to platformVersion ${platformVersion}. It will walk you through the fields required to complete the migration and download the new project source code into the project source directory. It will also copy all of your existing files to a new directory (archive) in case you need access to your old files later.`,
1663
- describe: 'Migrate an existing project to the new version of the projects framework.',
1665
+ describe: uiDeprecatedTag(`Migrate an existing project to the new version of the projects framework. ${MIGRATION_SUPPORT_CUTOFF_NOTICE}`, false),
1666
+ verboseDescribe: uiDeprecatedTag(`Migrate an existing project to a newer platform version. This command walks you through the fields required to complete the migration and downloads the new project source code into the project source directory. Your existing files are copied to a new directory (archive) in case you need access to them later.\n\n${chalk.bold.yellow(MIGRATION_SUPPORT_CUTOFF_NOTICE)}`, false),
1664
1667
  errors: {
1665
1668
  noProjectConfig: (command) => `No project detected. Please run this command again from a project directory. If you are trying to migrate an app, run ${command}`,
1666
1669
  },
@@ -3595,6 +3598,12 @@ export const lib = {
3595
3598
  updateFailed: (latestVersion) => `Failed to update HubSpot CLI to version ${chalk.bold(latestVersion)}`,
3596
3599
  enableAutoUpdatesMessage: `The HubSpot CLI can automatically keep itself up to date.\n\nThis helps ensure compatibility with the HubSpot platform. You can change this later at any time.\n\nRun ${uiCommandReference('hs config set --allow-auto-updates=true')}`,
3597
3600
  },
3601
+ deprecationWarning: {
3602
+ deprecatedTitle: 'Deprecated',
3603
+ deprecatedMessage: (currentVersion, eolDate) => `Version: HubSpot CLI v${currentVersion}\n\nStatus: Deprecated (End of Life: ${eolDate})\n\nAction Required: Upgrade to the latest major version to continue receiving new features\n\nReplacement: Run ${uiCommandReference('npm install -g @hubspot/cli@latest')} to upgrade\n\n${uiLink('CLI Support Guidelines', CLI_SUPPORT_GUIDELINES_URL)}`,
3604
+ endOfLifeTitle: 'End of Life',
3605
+ endOfLifeMessage: (currentVersion, eolDate) => `Version: HubSpot CLI v${currentVersion}\n\nStatus: End of Life (as of ${eolDate})\n\nAction Required: This version is no longer supported. Upgrade immediately to continue receiving updates\n\nReplacement: Run ${uiCommandReference('npm install -g @hubspot/cli@latest')} to upgrade\n\n${uiLink('CLI Support Guidelines', CLI_SUPPORT_GUIDELINES_URL)}`,
3606
+ },
3598
3607
  },
3599
3608
  projectProfiles: {
3600
3609
  logs: {
@@ -1,5 +1,6 @@
1
1
  import { Environment } from '@hubspot/local-dev-lib/types/Accounts';
2
2
  import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
3
+ export declare function getCurrentDefaultAccount(): HubSpotConfigAccount | undefined;
3
4
  type AuthenticateNewAccountOptions = {
4
5
  env: Environment;
5
6
  providedPersonalAccessKey?: string;
@@ -100,6 +100,14 @@ async function handleConfigMigration() {
100
100
  return false;
101
101
  }
102
102
  }
103
+ export function getCurrentDefaultAccount() {
104
+ try {
105
+ return getConfigDefaultAccountIfExists();
106
+ }
107
+ catch {
108
+ return undefined;
109
+ }
110
+ }
103
111
  export async function authenticateNewAccount({ env, providedPersonalAccessKey, accountId, setAsDefaultAccount, accountName: providedAccountName, useDefaultAccountName, }) {
104
112
  const configMigrationSuccess = await handleConfigMigration();
105
113
  if (!configMigrationSuccess) {
package/lib/app/urls.d.ts CHANGED
@@ -13,7 +13,6 @@ type PublicAppInstallUrlArgs = {
13
13
  };
14
14
  export declare function getOauthAppInstallUrl({ targetAccountId, env, clientId, scopes, redirectUrls, }: PublicAppInstallUrlArgs): string;
15
15
  export declare function getStaticAuthAppInstallUrl({ targetAccountId, env, appId, }: PrivateAppInstallUrlArgs): string;
16
- export declare function getAppCardSetupUrl({ targetAccountId, env, appId, }: PrivateAppInstallUrlArgs): string;
17
16
  export declare function getAppLogsUrl(accountId: number, appId: number, systemType: string): string;
18
17
  export declare function getAppLogDetailsUrl(accountId: number, appId: number, systemType: string, logId: string): string;
19
18
  export {};
package/lib/app/urls.js CHANGED
@@ -10,10 +10,6 @@ export function getStaticAuthAppInstallUrl({ targetAccountId, env, appId, }) {
10
10
  const websiteOrigin = getHubSpotWebsiteOrigin(env);
11
11
  return `${websiteOrigin}/static-token/${targetAccountId}/authorize?appId=${appId}`;
12
12
  }
13
- export function getAppCardSetupUrl({ targetAccountId, env, appId, }) {
14
- const websiteOrigin = getHubSpotWebsiteOrigin(env);
15
- return `${websiteOrigin}/integrations-settings/${targetAccountId}/installed/framework/${appId}/app-cards?tourId=get-started`;
16
- }
17
13
  export function getAppLogsUrl(accountId, appId, systemType) {
18
14
  return `${getHubSpotWebsiteOriginByAccountId(accountId)}/developer-monitoring/${accountId}/?logType=${systemType}&appId=${appId}`;
19
15
  }
@@ -4,8 +4,14 @@ export declare const DEFAULT_PROJECT_TEMPLATE_BRANCH: "main";
4
4
  export declare const FEEDBACK_INTERVAL: 10;
5
5
  export declare const HUBSPOT_FOLDER: "@hubspot";
6
6
  export declare const MARKETPLACE_FOLDER: "@marketplace";
7
+ export declare const ONE_DAY_IN_MILLISECONDS: number;
8
+ export declare const CLI_DEPRECATED_MAJOR_VERSION = 7;
9
+ export declare const CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE = "2026-09-02";
10
+ export declare const CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE = "2027-03-01";
11
+ export declare const CLI_SUPPORT_GUIDELINES_URL: "https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/version-support";
7
12
  export declare const DEFAULT_POLLING_DELAY = 2000;
8
13
  export declare const PREVIEW_POLL_TIMEOUT: number;
14
+ export declare const MCP_ELICITATION_TIMEOUT: number;
9
15
  export declare const PROJECT_CONFIG_FILE: "hsproject.json";
10
16
  export declare const PROJECT_BUILD_STATES: {
11
17
  readonly BUILDING: "BUILDING";
package/lib/constants.js CHANGED
@@ -4,8 +4,19 @@ export const DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
4
4
  export const FEEDBACK_INTERVAL = 10;
5
5
  export const HUBSPOT_FOLDER = '@hubspot';
6
6
  export const MARKETPLACE_FOLDER = '@marketplace';
7
+ export const ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
8
+ // The previous major CLI version, per the CLI Version Support &
9
+ // Deprecation Policy. Only 1 previous major version is supported at a time.
10
+ export const CLI_DEPRECATED_MAJOR_VERSION = 7;
11
+ // The date CLI_DEPRECATED_MAJOR_VERSION enters its Deprecation Phase
12
+ export const CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE = '2026-09-02';
13
+ // The date CLI_DEPRECATED_MAJOR_VERSION reaches end of life
14
+ export const CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE = '2027-03-01';
15
+ export const CLI_SUPPORT_GUIDELINES_URL = 'https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/version-support';
7
16
  export const DEFAULT_POLLING_DELAY = 2000;
8
17
  export const PREVIEW_POLL_TIMEOUT = 5 * 60 * 1000;
18
+ // MCP forms wait on a person, so they need longer than the SDK default of 60s.
19
+ export const MCP_ELICITATION_TIMEOUT = 5 * 60 * 1000;
9
20
  export const PROJECT_CONFIG_FILE = 'hsproject.json';
10
21
  export const PROJECT_BUILD_STATES = {
11
22
  BUILDING: 'BUILDING',
@@ -0,0 +1 @@
1
+ export declare function checkDeprecationWarning(): Promise<void>;
@@ -0,0 +1,57 @@
1
+ import semver from 'semver';
2
+ import moment from 'moment';
3
+ import { getStateValue, setStateValue, } from '@hubspot/local-dev-lib/config/state';
4
+ import { STATE_FLAGS } from '@hubspot/local-dev-lib/constants/config';
5
+ import { pkg } from '../jsonLoader.js';
6
+ import { lib } from '../../lang/en.js';
7
+ import { debugError } from '../errorHandlers/index.js';
8
+ import { renderInline } from '../../ui/render.js';
9
+ import { getWarningBox, getAlertBox, } from '../../ui/components/StatusMessageBoxes.js';
10
+ import { CLI_DEPRECATED_MAJOR_VERSION, CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE, CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE, ONE_DAY_IN_MILLISECONDS, } from '../constants.js';
11
+ const LAST_SHOWN_STATE_FLAGS = {
12
+ deprecated: STATE_FLAGS.CLI_VERSION_DEPRECATION_WARNING_LAST_SHOWN_AT,
13
+ endOfLife: STATE_FLAGS.CLI_VERSION_END_OF_LIFE_WARNING_LAST_SHOWN_AT,
14
+ };
15
+ function getDeprecationStatusForCurrentMajorVersion() {
16
+ if (semver.major(pkg.version) !== CLI_DEPRECATED_MAJOR_VERSION) {
17
+ return null;
18
+ }
19
+ const now = moment();
20
+ if (now.isSameOrAfter(moment(CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE))) {
21
+ return 'endOfLife';
22
+ }
23
+ if (now.isSameOrAfter(moment(CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE))) {
24
+ return 'deprecated';
25
+ }
26
+ return null;
27
+ }
28
+ function hasShownWarningToday(status) {
29
+ const lastShown = getStateValue(LAST_SHOWN_STATE_FLAGS[status]);
30
+ const lastShownTime = typeof lastShown === 'string' ? Date.parse(lastShown) : NaN;
31
+ return (!Number.isNaN(lastShownTime) &&
32
+ Date.now() - lastShownTime < ONE_DAY_IN_MILLISECONDS);
33
+ }
34
+ async function logDeprecationStatusWarning(status) {
35
+ const eolDate = moment(CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE).format('MMMM D, YYYY');
36
+ const getBox = status === 'endOfLife' ? getAlertBox : getWarningBox;
37
+ const title = status === 'endOfLife'
38
+ ? lib.middleware.deprecationWarning.endOfLifeTitle
39
+ : lib.middleware.deprecationWarning.deprecatedTitle;
40
+ const message = status === 'endOfLife'
41
+ ? lib.middleware.deprecationWarning.endOfLifeMessage(pkg.version, eolDate)
42
+ : lib.middleware.deprecationWarning.deprecatedMessage(pkg.version, eolDate);
43
+ await renderInline(getBox({ title, message }));
44
+ setStateValue(LAST_SHOWN_STATE_FLAGS[status], new Date().toISOString());
45
+ }
46
+ export async function checkDeprecationWarning() {
47
+ try {
48
+ const status = getDeprecationStatusForCurrentMajorVersion();
49
+ if (!status || hasShownWarningToday(status)) {
50
+ return;
51
+ }
52
+ await logDeprecationStatusWarning(status);
53
+ }
54
+ catch (error) {
55
+ debugError(error);
56
+ }
57
+ }
@@ -23,7 +23,7 @@ class LocalDevWatcher {
23
23
  start() {
24
24
  this.watcher = chokidar.watch(this.localDevProcess.projectDir, {
25
25
  ignoreInitial: true,
26
- ignored: ['**/dist'],
26
+ ignored: ['**/dist', '**/node_modules'],
27
27
  });
28
28
  const configPaths = Object.values(this.localDevProcess.projectNodes).map(component => component.localDev.componentConfigPath);
29
29
  const projectConfigPath = path.join(this.localDevProcess.projectDir, PROJECT_CONFIG_FILE);
@@ -1,2 +1,9 @@
1
1
  import { ProjectConfig } from '../../types/Projects.js';
2
+ type ProfilePromptOption = {
3
+ name: string;
4
+ value: string;
5
+ disabled?: boolean;
6
+ };
7
+ export declare function generateProfilePromptOption(projectDir: string, projectConfig: ProjectConfig, profileName: string): ProfilePromptOption;
2
8
  export declare function projectProfilePrompt(projectDir: string, projectConfig: ProjectConfig, profileName?: string, exitIfMissing?: boolean): Promise<string | null>;
9
+ export {};
@@ -3,7 +3,7 @@ import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
3
3
  import { listPrompt } from './promptUtils.js';
4
4
  import { loadProfile } from '../projects/projectProfiles.js';
5
5
  import { lib } from '../../lang/en.js';
6
- function generateProfilePromptOption(projectDir, projectConfig, profileName) {
6
+ export function generateProfilePromptOption(projectDir, projectConfig, profileName) {
7
7
  const choice = {
8
8
  name: profileName,
9
9
  value: profileName,
@@ -1,5 +1,7 @@
1
1
  import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
2
2
  import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
3
+ import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
4
+ import { AccountTargetCandidate } from '../types/AccountTargets.js';
3
5
  type MockErrorResponse = {
4
6
  status: number;
5
7
  data: {
@@ -12,4 +14,7 @@ type MockErrorResponse = {
12
14
  export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
13
15
  export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
14
16
  export declare function stubColorEnv(): void;
17
+ export declare const MOCK_SANDBOX_TARGET: AccountTargetCandidate;
18
+ export declare const MOCK_PRODUCTION_TARGET: AccountTargetCandidate;
19
+ export declare function getMockConfigAccount(identifier: number | string): HubSpotConfigAccount | undefined;
15
20
  export {};
package/lib/testUtils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { vi } from 'vitest';
2
2
  import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
3
+ import { ACCOUNT_TARGET_CATEGORIES, ACCOUNT_TARGET_SELECTION_SOURCES, } from '../types/AccountTargets.js';
3
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
5
  export function mockHubSpotHttpResponse(data) {
5
6
  return Promise.resolve({
@@ -30,3 +31,26 @@ export function stubColorEnv() {
30
31
  ].forEach(key => vi.stubEnv(key, undefined));
31
32
  vi.stubEnv('TERM', 'xterm-256color');
32
33
  }
34
+ export const MOCK_SANDBOX_TARGET = {
35
+ accountId: 222,
36
+ accountName: 'Sandbox',
37
+ source: ACCOUNT_TARGET_SELECTION_SOURCES.GLOBAL_DEFAULT,
38
+ category: ACCOUNT_TARGET_CATEGORIES.RECOMMENDED_TESTING,
39
+ };
40
+ export const MOCK_PRODUCTION_TARGET = {
41
+ accountId: 111,
42
+ accountName: 'Prod Portal',
43
+ source: ACCOUNT_TARGET_SELECTION_SOURCES.GLOBAL_DEFAULT,
44
+ category: ACCOUNT_TARGET_CATEGORIES.PRODUCTION_WITH_CARE,
45
+ };
46
+ // A getConfigAccountIfExists stand-in that knows only MOCK_PRODUCTION_TARGET.
47
+ export function getMockConfigAccount(identifier) {
48
+ if (identifier !== MOCK_PRODUCTION_TARGET.accountId) {
49
+ return undefined;
50
+ }
51
+ return {
52
+ accountId: MOCK_PRODUCTION_TARGET.accountId,
53
+ name: MOCK_PRODUCTION_TARGET.accountName,
54
+ accountType: 'STANDARD',
55
+ };
56
+ }
package/lib/ui/index.js CHANGED
@@ -130,8 +130,18 @@ export function uiDeprecatedDescription(message, command, url) {
130
130
  const tag = message || uiMessages.disabledMessage(command, url);
131
131
  return uiDeprecatedTag(tag);
132
132
  }
133
+ // export function uiCommandRenamedDescription(
134
+ // describe: string | false | undefined,
135
+ // newCommand: string
136
+ // ): string | undefined {
137
+ // return uiDeprecatedTag(
138
+ // `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`,
139
+ // false
140
+ // );
141
+ // }
142
+ // Replace this with the above code once we've upgraded to yargs 18.0.0
133
143
  export function uiCommandRenamedDescription(describe, newCommand) {
134
- return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedMessage(newCommand)}`, false);
144
+ return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`, false);
135
145
  }
136
146
  export function uiDeprecatedMessage(command, url, message) {
137
147
  const tag = uiMessages.deprecatedDescription(message || '', command, url);
@@ -5,6 +5,7 @@ export declare const uiMessages: {
5
5
  disabledMessage: (command: string, url?: string) => string;
6
6
  disabledUrlText: string;
7
7
  commandRenamedMessage: (newCommand: string) => string;
8
+ commandRenamedPlainMessage: (newCommand: string) => string;
8
9
  featureHighlight: {
9
10
  defaultTitle: string;
10
11
  featureKeys: {
@@ -8,6 +8,7 @@ export const uiMessages = {
8
8
  disabledMessage: (command, url) => `The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('Learn more', url) : ''}`,
9
9
  disabledUrlText: 'See all HubSpot CLI commands here.',
10
10
  commandRenamedMessage: (newCommand) => `This command has been deprecated. Please use ${uiCommandReference(newCommand)} instead.`,
11
+ commandRenamedPlainMessage: (newCommand) => `This command has been deprecated. Please use \`${newCommand}\` instead.`,
11
12
  featureHighlight: {
12
13
  defaultTitle: "What's next?",
13
14
  featureKeys: {
@@ -18,6 +18,10 @@ WHEN TO USE THIS SERVER
18
18
  - The user asks how to use HubSpot products or features, or about account
19
19
  and subscription settings — answer it via \`search-knowledge-base\`
20
20
  rather than from prior knowledge.
21
+ - The user asks whether an API or feature is available on a subscription
22
+ tier (for example Starter, Professional, or Enterprise) — answer it via
23
+ \`search-docs\` then \`fetch-doc\`, not the knowledge base. The doc lists
24
+ any required product and tier in a "Supported products" section.
21
25
 
22
26
  REQUIRED WORKFLOWS
23
27
  1. Authentication: call \`auth-account\` when the user wants to connect a
@@ -27,9 +31,11 @@ REQUIRED WORKFLOWS
27
31
  2. Documentation lookup: for developer APIs, SDKs, and platform reference,
28
32
  call \`search-docs\` first, then \`fetch-doc\` on the most relevant
29
33
  result(s). For HubSpot product, feature, or account and subscription
30
- how-to questions, call \`search-knowledge-base\`. Answer from these
31
- tools before planning, writing code, or answering. Do not answer from
32
- memory.
34
+ how-to questions, call \`search-knowledge-base\`. Whether a feature or
35
+ API is available on a subscription tier is a developer-docs question:
36
+ use \`search-docs\` then \`fetch-doc\`, not \`search-knowledge-base\`.
37
+ Answer from these tools before planning, writing code, or answering. Do
38
+ not answer from memory.
33
39
  3. Locating a HubSpot project: when the current working directory is not
34
40
  a HubSpot project (no \`hsproject.json\`) or you need to determine
35
41
  whether a directory contains one, call \`find-projects\` before
@@ -5,7 +5,7 @@ import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  absoluteCurrentWorkingDirectory: z.ZodString;
8
- endpoint: z.ZodString;
8
+ endpoint: z.ZodOptional<z.ZodString>;
9
9
  account: z.ZodOptional<z.ZodString>;
10
10
  latest: z.ZodOptional<z.ZodBoolean>;
11
11
  compact: z.ZodOptional<z.ZodBoolean>;
@@ -5,11 +5,15 @@ import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
5
5
  import { formatTextContents } from '../../utils/content.js';
6
6
  import { setupHubSpotConfig } from '../../utils/config.js';
7
7
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
8
+ import { getRoutes } from '@hubspot/local-dev-lib/api/functions';
9
+ import { discoverAccountTargets } from '../../../lib/accountTargetDiscovery.js';
10
+ import { elicitSelection } from '../../utils/elicitSelection.js';
8
11
  const inputSchema = {
9
12
  absoluteCurrentWorkingDirectory,
10
13
  endpoint: z
11
14
  .string()
12
- .describe('The function endpoint/path to get logs for. Required. Example: "my-function" or "api/my-endpoint" (leading slash will be automatically removed)'),
15
+ .describe('The function endpoint/path to get logs for. Example: "my-function" or "api/my-endpoint" (leading slash will be automatically removed). If omitted and the account has several functions, you will be asked to choose one.')
16
+ .optional(),
13
17
  account: z
14
18
  .string()
15
19
  .describe('The HubSpot account id or name from the HubSpot config file to use for the operation.')
@@ -33,10 +37,60 @@ export class HsFunctionLogsTool extends Tool {
33
37
  }
34
38
  async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }, extra) {
35
39
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
40
+ let resolvedEndpoint = endpoint;
41
+ if (!resolvedEndpoint) {
42
+ const { recommended } = await discoverAccountTargets({
43
+ explicitAccount: account,
44
+ });
45
+ const accountId = recommended?.accountId;
46
+ if (!accountId) {
47
+ return formatTextContents('No account ID found. Call the auth-account tool to authenticate a HubSpot account.');
48
+ }
49
+ try {
50
+ const routesResponse = await getRoutes(accountId);
51
+ const routes = routesResponse.data.objects ?? [];
52
+ if (routes.length === 0) {
53
+ return formatTextContents('No CMS serverless functions found for this account.');
54
+ }
55
+ // The logs command takes a path (method-agnostic), and a path can
56
+ // appear under multiple methods, so dedupe by route to keep the
57
+ // elicitation values unique.
58
+ const seenRoutes = new Set();
59
+ const options = [];
60
+ routes.forEach(route => {
61
+ if (seenRoutes.has(route.route)) {
62
+ return;
63
+ }
64
+ seenRoutes.add(route.route);
65
+ options.push({
66
+ value: route.route,
67
+ label: `${route.method} ${route.route}`,
68
+ });
69
+ });
70
+ const selected = await elicitSelection(this.mcpServer, this.logger, {
71
+ message: 'Select the CMS serverless function to get logs for.',
72
+ title: 'CMS serverless function',
73
+ options,
74
+ });
75
+ if (!selected) {
76
+ return formatTextContents(`Several functions are available. Ask the user which to use, then call ${toolName} again with the endpoint argument set to one of: ${options
77
+ .map(option => option.label)
78
+ .join(', ')}.`);
79
+ }
80
+ resolvedEndpoint = selected;
81
+ }
82
+ catch (error) {
83
+ this.logger.debug(toolName, {
84
+ message: 'Failed to list functions for elicitation',
85
+ error: getErrorMessage(error),
86
+ });
87
+ return formatTextContents(`Error listing CMS serverless functions: ${getErrorMessage(error)}`);
88
+ }
89
+ }
36
90
  // Ensure endpoint doesn't start with '/'
37
- const normalizedEndpoint = endpoint.startsWith('/')
38
- ? endpoint.slice(1)
39
- : endpoint;
91
+ const normalizedEndpoint = resolvedEndpoint.startsWith('/')
92
+ ? resolvedEndpoint.slice(1)
93
+ : resolvedEndpoint;
40
94
  const command = new HubSpotCommand(`cms function logs ${normalizedEndpoint}`);
41
95
  if (latest) {
42
96
  command.addFlag('latest', latest);
@@ -13,6 +13,7 @@ export type AuthAccountInputSchema = z.infer<typeof inputSchemaZodObject>;
13
13
  export declare class AuthAccountTool extends Tool<AuthAccountInputSchema> {
14
14
  constructor(mcpServer: McpServer, logger: McpLogger);
15
15
  handler({ absoluteCurrentWorkingDirectory, accountId, name, setAsDefault, }: AuthAccountInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
16
+ private resolveSetAsDefault;
16
17
  register(): RegisteredTool;
17
18
  }
18
19
  export {};
@@ -4,8 +4,10 @@ import { formatTextContents } from '../../utils/content.js';
4
4
  import { HubSpotCommand } from '../../utils/command.js';
5
5
  import { setupHubSpotConfig } from '../../utils/config.js';
6
6
  import { parseCommandJsonOutput } from '../../utils/json.js';
7
+ import { booleanField } from '../../utils/elicitation.js';
7
8
  import { absoluteCurrentWorkingDirectory } from './constants.js';
8
9
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
10
+ import { getCurrentDefaultAccount } from '../../../lib/accountAuth.js';
9
11
  import { AccountAuthSchema } from '../../../lib/jsonOutput/accountAuth.js';
10
12
  const inputSchema = {
11
13
  absoluteCurrentWorkingDirectory,
@@ -20,7 +22,7 @@ const inputSchema = {
20
22
  setAsDefault: z
21
23
  .boolean()
22
24
  .optional()
23
- .describe('Set this account as the default for CLI operations. Defaults to true when not specified.'),
25
+ .describe('Optional: set this account as the default for CLI operations. Omit unless the user stated a preference. If omitted and another account is already the default, the user is asked whether to replace it.'),
24
26
  };
25
27
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
28
  const inputSchemaZodObject = z.object({ ...inputSchema });
@@ -43,7 +45,8 @@ export class AuthAccountTool extends Tool {
43
45
  if (accountId !== undefined) {
44
46
  command.addFlag('account', accountId);
45
47
  }
46
- command.addFlag('default', setAsDefault === false ? 'false' : 'true');
48
+ const resolvedSetAsDefault = setAsDefault ?? (await this.resolveSetAsDefault(accountId));
49
+ command.addFlag('default', resolvedSetAsDefault ? 'true' : 'false');
47
50
  try {
48
51
  const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
49
52
  const structuredContent = parseCommandJsonOutput(stdout, AccountAuthSchema, this.logger, toolName);
@@ -61,6 +64,24 @@ export class AuthAccountTool extends Tool {
61
64
  return formatTextContents(getErrorMessage(error));
62
65
  }
63
66
  }
67
+ async resolveSetAsDefault(accountId) {
68
+ const currentDefault = getCurrentDefaultAccount();
69
+ if (!currentDefault || currentDefault.accountId === accountId) {
70
+ return true;
71
+ }
72
+ const elicitation = await this.elicit({
73
+ message: `${currentDefault.name} is the default HubSpot account. Set the account you authenticate now as the new default?`,
74
+ fields: {
75
+ setAsDefault: booleanField('Set as default account', `Other CLI commands will use the new account instead of ${currentDefault.name}.`, true),
76
+ },
77
+ required: ['setAsDefault'],
78
+ });
79
+ if (!elicitation) {
80
+ return true;
81
+ }
82
+ return (elicitation.action === 'accept' &&
83
+ elicitation.content?.setAsDefault === true);
84
+ }
64
85
  register() {
65
86
  return this.mcpServer.registerTool(toolName, {
66
87
  title: 'Authenticate a HubSpot Account',
@@ -74,7 +95,7 @@ export class AuthAccountTool extends Tool {
74
95
  '2. The user clicks "Connect to CLI" in the browser\n' +
75
96
  '3. Auth completes automatically via WebSocket\n' +
76
97
  '4. Retry any operation that was blocked by missing auth\n\n' +
77
- 'setAsDefault defaults to true. Pass setAsDefault: false to keep an existing default account.',
98
+ 'If another account is already the default and setAsDefault is omitted, the tool asks the user whether to replace it. If the client cannot ask the user, the new account becomes the default.',
78
99
  inputSchema,
79
100
  outputSchema: AccountAuthSchema.shape,
80
101
  annotations: {
@@ -41,7 +41,7 @@ export class CreateProjectTool extends Tool {
41
41
  async handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }, extra) {
42
42
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
43
43
  const command = new HubSpotCommand('project create', [
44
- { name: 'platform-version', value: PLATFORM_VERSIONS.v2026_03 },
44
+ { name: 'platform-version', value: PLATFORM_VERSIONS.v2026_09 },
45
45
  { name: 'json', value: true },
46
46
  ]);
47
47
  const content = [];
@@ -5,13 +5,13 @@ import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  absoluteProjectPath: z.ZodString;
8
- absoluteCurrentWorkingDirectory: z.ZodString;
9
8
  buildNumber: z.ZodOptional<z.ZodNumber>;
9
+ confirmProductionAccount: z.ZodOptional<z.ZodBoolean>;
10
10
  }, z.core.$strip>;
11
11
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
12
12
  export declare class DeployProjectTool extends Tool<InputSchemaType> {
13
13
  constructor(mcpServer: McpServer, logger: McpLogger);
14
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }: InputSchemaType, extra?: ToolExtra): Promise<McpToolResponse>;
14
+ handler({ absoluteProjectPath, buildNumber, confirmProductionAccount, }: InputSchemaType, extra?: ToolExtra): Promise<McpToolResponse>;
15
15
  register(): RegisteredTool;
16
16
  }
17
17
  export {};