@hubspot/cli 8.18.0 → 8.19.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/commands/account/auth.js +2 -2
  2. package/commands/account/createOverride.js +2 -0
  3. package/commands/account/removeOverride.js +2 -0
  4. package/commands/app/secret/add.js +1 -1
  5. package/commands/app/secret/delete.js +1 -1
  6. package/commands/app/secret/list.js +1 -1
  7. package/commands/app/secret/update.js +1 -1
  8. package/commands/app/secret.js +1 -1
  9. package/commands/auth.js +3 -2
  10. package/commands/cms/function/create.js +5 -37
  11. package/commands/cms/function/deploy.js +8 -1
  12. package/commands/cms/function/list.js +4 -0
  13. package/commands/cms/function/logs.js +2 -0
  14. package/commands/cms/function/server.js +6 -0
  15. package/commands/cms/upload.js +6 -0
  16. package/commands/cms/watch.js +2 -0
  17. package/commands/cms/webpack/create.js +5 -32
  18. package/commands/customObject.js +2 -2
  19. package/commands/getStarted.js +4 -4
  20. package/commands/hubdb/list.js +2 -2
  21. package/commands/init.js +3 -2
  22. package/commands/mcp/setup.js +3 -2
  23. package/commands/project/dev/index.js +2 -2
  24. package/commands/project/logs.js +2 -2
  25. package/commands/project/upload.js +6 -2
  26. package/commands/project/watch.js +2 -2
  27. package/commands/sandbox/create.js +3 -3
  28. package/commands/sandbox/delete.js +1 -1
  29. package/commands/sandbox.js +1 -1
  30. package/lang/en.d.ts +26 -0
  31. package/lang/en.js +85 -43
  32. package/lib/accountAuth.js +12 -0
  33. package/lib/app/logSystemTypes.d.ts +4 -0
  34. package/lib/app/logSystemTypes.js +17 -0
  35. package/lib/app/logs.d.ts +2 -4
  36. package/lib/app/logs.js +2 -17
  37. package/lib/app/migrate.js +3 -3
  38. package/lib/constants.d.ts +2 -0
  39. package/lib/constants.js +4 -0
  40. package/lib/crossPlatformSpawn/escape.d.ts +2 -0
  41. package/lib/crossPlatformSpawn/escape.js +38 -0
  42. package/lib/crossPlatformSpawn/index.d.ts +7 -0
  43. package/lib/crossPlatformSpawn/index.js +43 -0
  44. package/lib/crossPlatformSpawn/resolveCommand.d.ts +1 -0
  45. package/lib/crossPlatformSpawn/resolveCommand.js +69 -0
  46. package/lib/errorHandlers/suppressError.js +3 -3
  47. package/lib/hints/hints.d.ts +9 -0
  48. package/lib/hints/hints.js +30 -0
  49. package/lib/hints/throttle.d.ts +4 -0
  50. package/lib/hints/throttle.js +9 -0
  51. package/lib/jsonOutput/projectUpload.d.ts +1 -0
  52. package/lib/jsonOutput/projectUpload.js +1 -0
  53. package/lib/mcp/promotion.js +15 -30
  54. package/lib/mcp/setup.d.ts +6 -1
  55. package/lib/mcp/setup.js +1 -1
  56. package/lib/middleware/deprecationWarningMiddleware.js +4 -9
  57. package/lib/projects/localDev/AppDevModeInterface.js +3 -3
  58. package/lib/projects/localDev/LocalDevLogger.js +5 -5
  59. package/lib/projects/localDev/helpers/project.js +3 -3
  60. package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
  61. package/lib/projects/projectInfo.js +4 -4
  62. package/lib/projects/projectProfiles.js +3 -3
  63. package/lib/projects/ui.js +3 -3
  64. package/lib/projects/upload.d.ts +3 -1
  65. package/lib/projects/upload.js +23 -6
  66. package/lib/projects/watch.js +4 -2
  67. package/lib/projects/workspaces.js +4 -4
  68. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  69. package/lib/prompts/selectPublicAppForMigrationPrompt.js +3 -3
  70. package/lib/serverlessSunset.d.ts +6 -0
  71. package/lib/serverlessSunset.js +32 -0
  72. package/lib/ui/appLogs.js +4 -4
  73. package/lib/ui/formatting.d.ts +13 -0
  74. package/lib/ui/formatting.js +39 -0
  75. package/lib/ui/git.js +3 -3
  76. package/lib/ui/index.d.ts +9 -23
  77. package/lib/ui/index.js +36 -69
  78. package/lib/ui/logger.d.ts +1 -0
  79. package/lib/ui/logger.js +2 -1
  80. package/lib/ui/uiMessages.js +1 -1
  81. package/mcp-server/server.js +13 -5
  82. package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
  83. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  84. package/mcp-server/tools/cms/HsListTool.js +4 -1
  85. package/mcp-server/tools/index.js +0 -2
  86. package/mcp-server/utils/command.js +16 -5
  87. package/package.json +9 -9
  88. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
  89. package/mcp-server/tools/cms/HsCreateFunctionTool.js +0 -100
@@ -47,7 +47,13 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
47
47
  }
48
48
  return { buildId, error };
49
49
  }
50
- export async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, skipNpmAudit = false, skipAutoDeploy = false, force = false, }) {
50
+ function validateSkippedHsMetaFilesCanBeConfirmed({ skippedHsMetaFiles, force, formatOutputAsJson, }) {
51
+ if (skippedHsMetaFiles.length === 0 || force || !formatOutputAsJson) {
52
+ return;
53
+ }
54
+ throw new ProjectValidationError(lib.projects.skippedHsMetaFiles.jsonRequiresForce(skippedHsMetaFiles));
55
+ }
56
+ export async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, skipNpmAudit = false, skipAutoDeploy = false, force = false, formatOutputAsJson = false, }) {
51
57
  const srcDir = path.resolve(projectDir, projectConfig.srcDir);
52
58
  await validateSourceDirectory(srcDir, projectConfig, projectDir);
53
59
  await validateNoHSMetaMismatch(srcDir, projectConfig);
@@ -85,6 +91,7 @@ export async function handleProjectUpload({ accountId, projectConfig, projectDir
85
91
  try {
86
92
  uiLogger.debug(lib.projectUpload.handleProjectUpload.compressed(archive.pointer()));
87
93
  let intermediateRepresentation;
94
+ let skippedHsMetaFiles;
88
95
  if (sendIR) {
89
96
  try {
90
97
  const translateResult = await handleTranslate({
@@ -96,7 +103,13 @@ export async function handleProjectUpload({ accountId, projectConfig, projectDir
96
103
  });
97
104
  intermediateRepresentation =
98
105
  translateResult.intermediateRepresentation;
99
- const shouldContinue = await warnAboutSkippedHsMetaFiles(translateResult.skippedHsMetaFiles, force);
106
+ skippedHsMetaFiles = translateResult.skippedHsMetaFiles;
107
+ validateSkippedHsMetaFilesCanBeConfirmed({
108
+ skippedHsMetaFiles,
109
+ force,
110
+ formatOutputAsJson,
111
+ });
112
+ const shouldContinue = await warnAboutSkippedHsMetaFiles(skippedHsMetaFiles, force);
100
113
  if (!shouldContinue) {
101
114
  return resolve({ userDeclined: true });
102
115
  }
@@ -112,16 +125,16 @@ export async function handleProjectUpload({ accountId, projectConfig, projectDir
112
125
  });
113
126
  if (!projectExists) {
114
127
  uiLogger.log(lib.projectUpload.handleProjectUpload.projectDoesNotExist(accountId));
115
- return resolve({ projectNotFound: true });
128
+ return resolve({ projectNotFound: true, skippedHsMetaFiles });
116
129
  }
117
130
  const projectId = project?.id;
118
131
  const { buildId, error } = await uploadProjectFiles(accountId, projectConfig.name, tempFile.name, uploadMessage, projectConfig.platformVersion, intermediateRepresentation, skipAutoDeploy);
119
132
  if (error) {
120
- resolve({ uploadError: error, projectId });
133
+ resolve({ uploadError: error, projectId, skippedHsMetaFiles });
121
134
  }
122
135
  else if (callbackFunc) {
123
136
  const uploadResult = await callbackFunc(accountId, projectConfig, tempFile, buildId);
124
- resolve({ result: uploadResult, projectId });
137
+ resolve({ result: uploadResult, projectId, skippedHsMetaFiles });
125
138
  }
126
139
  }
127
140
  catch (e) {
@@ -137,7 +150,7 @@ export async function handleProjectUpload({ accountId, projectConfig, projectDir
137
150
  lockfilePathsToUpdate.has(file.name)) {
138
151
  return false;
139
152
  }
140
- const ignored = shouldIgnoreFile(file.name, true);
153
+ const ignored = shouldIgnoreFile(file.name, true, srcDir);
141
154
  if (ignored) {
142
155
  const isNodeModule = file.name.includes('node_modules');
143
156
  if (!isNodeModule || !loggedIgnoredNodeModule) {
@@ -159,6 +172,10 @@ export async function validateSourceDirectory(srcDir, projectConfig, projectDir)
159
172
  if (!projectFilePaths || projectFilePaths.length === 0) {
160
173
  throw new ProjectValidationError(lib.projectUpload.handleProjectUpload.emptySource(projectConfig.srcDir));
161
174
  }
175
+ const hasUploadableFile = projectFilePaths.some(filePath => !shouldIgnoreFile(filePath, true, srcDir));
176
+ if (!hasUploadableFile) {
177
+ throw new ProjectValidationError(lib.projectUpload.handleProjectUpload.noFilesToUpload(projectConfig.srcDir));
178
+ }
162
179
  const warnings = [];
163
180
  if (!isLegacyProject(projectConfig.platformVersion)) {
164
181
  projectFilePaths.forEach(filePath => {
@@ -16,6 +16,7 @@ const queue = new PQueue({
16
16
  });
17
17
  const standbyQueue = [];
18
18
  let currentBuildId;
19
+ let watchedSourceDir;
19
20
  let handleBuildStatus;
20
21
  let handleUserInput;
21
22
  let handleWatchTermination = () => { };
@@ -79,7 +80,7 @@ async function queueFileOrFolder(accountId, projectName, platformVersion, filePa
79
80
  uiLogger.debug(commands.project.watch.debug.extensionNotAllowed(filePath));
80
81
  return;
81
82
  }
82
- if (shouldIgnoreFile(filePath, true)) {
83
+ if (shouldIgnoreFile(filePath, true, watchedSourceDir)) {
83
84
  uiLogger.debug(commands.project.watch.debug.ignored(filePath));
84
85
  return;
85
86
  }
@@ -141,13 +142,14 @@ async function handleWatchEvent(accountId, projectName, platformVersion, project
141
142
  }
142
143
  export async function createWatcher(accountId, projectConfig, projectDir, handleBuildStatusFn, handleUserInputFn, handleWatchTerminationFn) {
143
144
  const projectSourceDir = path.join(projectDir, projectConfig.srcDir);
145
+ watchedSourceDir = projectSourceDir;
144
146
  handleBuildStatus = handleBuildStatusFn;
145
147
  handleUserInput = handleUserInputFn;
146
148
  handleWatchTermination = handleWatchTerminationFn;
147
149
  await createNewStagingBuild(accountId, projectConfig.name, projectConfig.platformVersion);
148
150
  const watcher = chokidar.watch(projectSourceDir, {
149
151
  ignoreInitial: true,
150
- ignored: file => shouldIgnoreFile(file),
152
+ ignored: file => shouldIgnoreFile(file, false, projectSourceDir),
151
153
  });
152
154
  watcher.on('ready', async () => {
153
155
  uiLogger.log(commands.project.watch.logs.watching(projectDir));
@@ -67,13 +67,13 @@ export function computeExternalArchivePath(absolutePath, kind = KIND_DIRECTORY)
67
67
  * Creates a file filter function for workspace archiving.
68
68
  * Filters files based on packable files list and ignore rules.
69
69
  */
70
- function createWorkspaceFileFilter(packableFiles) {
70
+ function createWorkspaceFileFilter(packableFiles, rootDir) {
71
71
  return (file) => {
72
72
  if (packableFiles.size > 0 && !packableFiles.has(file.name)) {
73
73
  uiLogger.debug(lib.projectUpload.handleProjectUpload.fileFiltered(file.name));
74
74
  return false;
75
75
  }
76
- const ignored = shouldIgnoreFile(file.name, true);
76
+ const ignored = shouldIgnoreFile(file.name, true, rootDir);
77
77
  if (ignored) {
78
78
  uiLogger.debug(lib.projectUpload.handleProjectUpload.fileFiltered(file.name));
79
79
  return false;
@@ -134,7 +134,7 @@ async function archiveWorkspaceDirectories(archive, srcDir, workspaceMappings) {
134
134
  // Archive directories sequentially (archiver requires sequential operations)
135
135
  for (const { dir, archivePath, packableFiles } of withPackableFiles) {
136
136
  uiLogger.log(lib.projectUpload.handleProjectUpload.workspaceIncluded(dir, archivePath));
137
- archive.directory(dir, archivePath, createWorkspaceFileFilter(packableFiles));
137
+ archive.directory(dir, archivePath, createWorkspaceFileFilter(packableFiles, dir));
138
138
  }
139
139
  return { externalArchivePaths, packageWorkspaceEntries };
140
140
  }
@@ -181,7 +181,7 @@ async function archiveFileDependencies(archive, srcDir, fileDependencyMappings,
181
181
  })));
182
182
  for (const { localPath, archivePath, packageName, packableFiles, } of directoriesWithPackableFiles) {
183
183
  uiLogger.log(lib.projectUpload.handleProjectUpload.fileDependencyIncluded(packageName, localPath, archivePath));
184
- archive.directory(localPath, archivePath, createWorkspaceFileFilter(packableFiles));
184
+ archive.directory(localPath, archivePath, createWorkspaceFileFilter(packableFiles, localPath));
185
185
  }
186
186
  for (const { localPath, archivePath, packageName } of tarballItems) {
187
187
  uiLogger.log(lib.projectUpload.handleProjectUpload.fileDependencyIncluded(packageName, localPath, archivePath));
@@ -5,7 +5,7 @@ import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
5
5
  import { uiLogger } from '../ui/logger.js';
6
6
  import { promptUser } from './promptUtils.js';
7
7
  import { getCliAccountNamePromptConfig, } from './accountNamePrompt.js';
8
- import { uiInfoSection } from '../ui/index.js';
8
+ import { logUiInfoSection } from '../ui/index.js';
9
9
  import { lib } from '../../lang/en.js';
10
10
  import { PromptExitError } from '../errors/PromptExitError.js';
11
11
  import { EXIT_CODES } from '../enums/exitCodes.js';
@@ -14,7 +14,7 @@ export async function legacyPersonalAccessKeyPrompt({ env, account, }) {
14
14
  const websiteOrigin = getHubSpotWebsiteOrigin(env);
15
15
  let url = `${websiteOrigin}/l/personal-access-key`;
16
16
  if (process.env.BROWSER !== 'none') {
17
- uiInfoSection(lib.prompts.personalAccessKeyPrompt.personalAccessKeySetupTitle, () => {
17
+ logUiInfoSection(lib.prompts.personalAccessKeyPrompt.personalAccessKeySetupTitle, () => {
18
18
  uiLogger.log(lib.prompts.personalAccessKeyPrompt.personalAccessKeyBrowserOpenPrep);
19
19
  });
20
20
  if (account) {
@@ -1,6 +1,6 @@
1
1
  import { promptUser } from './promptUtils.js';
2
2
  import { lib } from '../../lang/en.js';
3
- import { uiLine } from '../ui/index.js';
3
+ import { logUiLine } from '../ui/index.js';
4
4
  import { logError } from '../errorHandlers/index.js';
5
5
  import { uiLogger } from '../ui/logger.js';
6
6
  import { fetchPublicAppsForPortal } from '@hubspot/local-dev-lib/api/appsDev';
@@ -17,14 +17,14 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
17
17
  if (!filteredPublicApps.length ||
18
18
  (isMigratingApp &&
19
19
  !filteredPublicApps.some(app => !app.preventProjectMigrations || !app.listingInfo))) {
20
- uiLine();
20
+ logUiLine();
21
21
  if (isMigratingApp) {
22
22
  uiLogger.error(`${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigration}\n${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigrationMessage(accountName)}`);
23
23
  }
24
24
  else {
25
25
  uiLogger.error(`${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsClone}\n${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsCloneMessage(accountName)}`);
26
26
  }
27
- uiLine();
27
+ logUiLine();
28
28
  throw new PromptExitError(isMigratingApp
29
29
  ? lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigration
30
30
  : lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsClone, EXIT_CODES.SUCCESS);
@@ -0,0 +1,6 @@
1
+ export declare function isServerlessEditingDisabled(): boolean;
2
+ export declare function isServerlessFunctionPath(path: string): boolean;
3
+ export declare function logServerlessDeprecation(command: string): void;
4
+ export declare function logServerlessCreationBlocked(command: string): void;
5
+ export declare function logServerlessEditingDisabled(command: string): void;
6
+ export declare function logServerlessUploadBlockedHint(paths: string[]): void;
@@ -0,0 +1,32 @@
1
+ import moment from 'moment';
2
+ import { lib } from '../lang/en.js';
3
+ import { SERVERLESS_SUNSET_EDITING_DISABLED_DATE } from './constants.js';
4
+ import { uiCommandDisabledBanner, uiDeprecatedTag } from './ui/index.js';
5
+ import { uiLogger } from './ui/logger.js';
6
+ export function isServerlessEditingDisabled() {
7
+ return moment
8
+ .utc()
9
+ .isSameOrAfter(moment.utc(SERVERLESS_SUNSET_EDITING_DISABLED_DATE));
10
+ }
11
+ const SERVERLESS_FOLDER_SEGMENT = /\.functions(\/|$)/;
12
+ export function isServerlessFunctionPath(path) {
13
+ return SERVERLESS_FOLDER_SEGMENT.test(path.replace(/\\/g, '/'));
14
+ }
15
+ export function logServerlessDeprecation(command) {
16
+ uiLogger.log('');
17
+ uiLogger.log(uiDeprecatedTag(lib.serverlessSunset.deprecationNotice(command)));
18
+ uiLogger.log('');
19
+ }
20
+ export function logServerlessCreationBlocked(command) {
21
+ uiCommandDisabledBanner(command, undefined, lib.serverlessSunset.creationBlocked(command));
22
+ }
23
+ export function logServerlessEditingDisabled(command) {
24
+ uiCommandDisabledBanner(command, undefined, lib.serverlessSunset.editingDisabled(command));
25
+ }
26
+ export function logServerlessUploadBlockedHint(paths) {
27
+ if (paths.some(isServerlessFunctionPath)) {
28
+ uiLogger.info(isServerlessEditingDisabled()
29
+ ? lib.serverlessSunset.uploadEditingBlockedHint
30
+ : lib.serverlessSunset.uploadBlockedHint);
31
+ }
32
+ }
package/lib/ui/appLogs.js CHANGED
@@ -2,9 +2,9 @@ import moment from 'moment';
2
2
  import chalk from 'chalk';
3
3
  import { Styles } from '@hubspot/local-dev-lib/logger';
4
4
  import { uiLogger } from './logger.js';
5
- import { indent, uiLine } from './index.js';
5
+ import { indent, logUiLine } from './index.js';
6
6
  import { commands } from '../../lang/en.js';
7
- import { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice } from '../app/logs.js';
7
+ import { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice, } from '../app/logSystemTypes.js';
8
8
  import { getAppLogDetailsUrl, getAppLogsUrl } from '../app/urls.js';
9
9
  import { renderTable } from '../../ui/render.js';
10
10
  const SEPARATOR = ' - ';
@@ -78,7 +78,7 @@ export async function outputAppLogs(response, options) {
78
78
  }
79
79
  });
80
80
  if (!options.compact && !options.tail) {
81
- uiLine();
81
+ logUiLine();
82
82
  uiLogger.log('');
83
83
  const tableHeaders = [
84
84
  commands.app.subcommands.logs.outputMessages.tableHeaders.appId,
@@ -168,7 +168,7 @@ export function outputAppLogDetails(details, options) {
168
168
  });
169
169
  }
170
170
  uiLogger.log('');
171
- uiLine();
171
+ logUiLine();
172
172
  uiLogger.log('');
173
173
  const detailUrl = getAppLogDetailsUrl(options.accountId, options.appId, details.loggingSystemType, details.id);
174
174
  uiLogger.log(commands.app.subcommands.logDetails.outputMessages.viewInHubSpot(detailUrl));
@@ -0,0 +1,13 @@
1
+ type TerminalSupport = {
2
+ hyperlinks: boolean;
3
+ color: boolean;
4
+ };
5
+ export declare const UI_COLORS: {
6
+ SORBET: string;
7
+ MARIGOLD: string;
8
+ MARIGOLD_DARK: string;
9
+ };
10
+ export declare function getTerminalUISupport(): TerminalSupport;
11
+ export declare function uiLink(linkText: string, url: string): string;
12
+ export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
13
+ export {};
@@ -0,0 +1,39 @@
1
+ import chalk from 'chalk';
2
+ import { supportsHyperlinkModule } from './supportHyperlinks.js';
3
+ import { isColorEnabled } from './supportsColor.js';
4
+ export const UI_COLORS = {
5
+ SORBET: '#FF8F59',
6
+ MARIGOLD: '#f5c26b',
7
+ MARIGOLD_DARK: '#dbae60',
8
+ };
9
+ export function getTerminalUISupport() {
10
+ return {
11
+ hyperlinks: supportsHyperlinkModule.stdout,
12
+ color: isColorEnabled(),
13
+ };
14
+ }
15
+ export function uiLink(linkText, url) {
16
+ const terminalUISupport = getTerminalUISupport();
17
+ const encodedUrl = encodeURI(url);
18
+ if (terminalUISupport.hyperlinks) {
19
+ const CLOSE_SEQUENCE = '\u001B]8;;\u0007';
20
+ const result = [
21
+ '\u001B]8;;',
22
+ encodedUrl,
23
+ '\u0007',
24
+ linkText,
25
+ CLOSE_SEQUENCE,
26
+ ].join('');
27
+ return terminalUISupport.color ? chalk.cyan(result) : result;
28
+ }
29
+ return terminalUISupport.color
30
+ ? `${linkText}: ${chalk.reset.cyan(encodedUrl)}`
31
+ : `${linkText}: ${encodedUrl}`;
32
+ }
33
+ export function uiCommandReference(command, withQuotes = true) {
34
+ const terminalUISupport = getTerminalUISupport();
35
+ const commandReference = withQuotes ? `\`${command}\`` : command;
36
+ return chalk.bold(terminalUISupport.color
37
+ ? chalk.hex(UI_COLORS.MARIGOLD_DARK)(commandReference)
38
+ : commandReference);
39
+ }
package/lib/ui/git.js CHANGED
@@ -2,13 +2,13 @@ import os from 'os';
2
2
  import { checkGitInclusion } from '@hubspot/local-dev-lib/gitignore';
3
3
  import { uiLogger } from './logger.js';
4
4
  import { lib } from '../../lang/en.js';
5
- import { uiLine } from './index.js';
5
+ import { logUiLine } from './index.js';
6
6
  export function checkAndWarnGitInclusion(configPath) {
7
7
  try {
8
8
  const { inGit, configIgnored } = checkGitInclusion(configPath);
9
9
  if (!inGit || configIgnored)
10
10
  return;
11
- uiLine();
11
+ logUiLine();
12
12
  uiLogger.warn(lib.ui.git.securityIssue);
13
13
  uiLogger.log(lib.ui.git.configFileTracked);
14
14
  uiLogger.log(lib.ui.git.fileName(configPath));
@@ -16,7 +16,7 @@ export function checkAndWarnGitInclusion(configPath) {
16
16
  uiLogger.log(lib.ui.git.moveConfig(os.homedir()));
17
17
  uiLogger.log(lib.ui.git.addGitignore(configPath));
18
18
  uiLogger.log(lib.ui.git.noRemote);
19
- uiLine();
19
+ logUiLine();
20
20
  }
21
21
  catch (e) {
22
22
  // fail silently
package/lib/ui/index.d.ts CHANGED
@@ -1,31 +1,17 @@
1
- type TerminalSupport = {
2
- hyperlinks: boolean;
3
- color: boolean;
4
- };
5
- export declare const UI_COLORS: {
6
- SORBET: string;
7
- MARIGOLD: string;
8
- MARIGOLD_DARK: string;
9
- };
10
- export declare function uiLine(): void;
11
- export declare function getTerminalUISupport(): TerminalSupport;
12
- export declare function uiLink(linkText: string, url: string): string;
1
+ export { getTerminalUISupport, UI_COLORS, uiCommandReference, uiLink, } from './formatting.js';
2
+ export declare function logUiLine(): void;
13
3
  export declare function uiAccountDescription(accountId?: number | null, bold?: boolean): string;
14
- export declare function uiInfoSection(title: string, logContent: () => void): void;
15
- export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
4
+ export declare function logUiInfoSection(title: string, logContent: () => void): void;
16
5
  export declare function uiAuthCommandReference({ accountId, qa, }?: {
17
6
  accountId?: number | string;
18
7
  qa?: boolean;
19
8
  }): string;
20
- export declare function uiFeatureHighlight(features: string[], title?: string): void;
21
- export declare function uiBetaTag(message: string, log?: true): undefined;
22
- export declare function uiBetaTag(message: string, log: false): string;
23
- export declare function uiDeprecatedTag(message: string, log?: true): undefined;
24
- export declare function uiDeprecatedTag(message: string, log: false): string;
9
+ export declare function logUiFeatureHighlight(features: string[], title?: string): void;
10
+ export declare function uiBetaTag(message: string): string;
11
+ export declare function uiDeprecatedTag(message: string): string;
25
12
  export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
26
- export declare function uiDeprecatedDescription(message: string, command: string, url?: string): undefined;
13
+ export declare function logUiDeprecatedDescription(message: string, command: string, url?: string): void;
27
14
  export declare function uiCommandRenamedDescription(describe: string | false | undefined, newCommand: string): string | undefined;
28
- export declare function uiDeprecatedMessage(command: string, url?: string, message?: string): void;
29
- export declare function uiCommandRelocatedMessage(newCommand: string): void;
15
+ export declare function logUiDeprecatedMessage(command: string, url?: string, message?: string): void;
16
+ export declare function logUiCommandRelocatedMessage(newCommand: string): void;
30
17
  export declare function indent(level: number): string;
31
- export {};
package/lib/ui/index.js CHANGED
@@ -1,42 +1,13 @@
1
1
  import chalk from 'chalk';
2
2
  import { getConfigAccountIfExists, globalConfigFileExists, } from '@hubspot/local-dev-lib/config';
3
3
  import { uiLogger } from './logger.js';
4
- import { supportsHyperlinkModule } from './supportHyperlinks.js';
5
- import { isColorEnabled } from './supportsColor.js';
6
4
  import { uiMessages } from './uiMessages.js';
5
+ import { uiCommandReference, uiLink } from './formatting.js';
7
6
  import { HUBSPOT_ACCOUNT_TYPE_STRINGS } from '@hubspot/local-dev-lib/constants/config';
8
- export const UI_COLORS = {
9
- SORBET: '#FF8F59',
10
- MARIGOLD: '#f5c26b',
11
- MARIGOLD_DARK: '#dbae60',
12
- };
13
- export function uiLine() {
7
+ export { getTerminalUISupport, UI_COLORS, uiCommandReference, uiLink, } from './formatting.js';
8
+ export function logUiLine() {
14
9
  uiLogger.log('-'.repeat(50));
15
10
  }
16
- export function getTerminalUISupport() {
17
- return {
18
- hyperlinks: supportsHyperlinkModule.stdout,
19
- color: isColorEnabled(),
20
- };
21
- }
22
- export function uiLink(linkText, url) {
23
- const terminalUISupport = getTerminalUISupport();
24
- const encodedUrl = encodeURI(url);
25
- if (terminalUISupport.hyperlinks) {
26
- const CLOSE_SEQUENCE = '\u001B]8;;\u0007';
27
- const result = [
28
- '\u001B]8;;',
29
- encodedUrl,
30
- '\u0007',
31
- linkText,
32
- CLOSE_SEQUENCE,
33
- ].join('');
34
- return terminalUISupport.color ? chalk.cyan(result) : result;
35
- }
36
- return terminalUISupport.color
37
- ? `${linkText}: ${chalk.reset.cyan(encodedUrl)}`
38
- : `${linkText}: ${encodedUrl}`;
39
- }
40
11
  export function uiAccountDescription(accountId, bold = true) {
41
12
  const account = accountId ? getConfigAccountIfExists(accountId) : undefined;
42
13
  let message;
@@ -51,20 +22,13 @@ export function uiAccountDescription(accountId, bold = true) {
51
22
  }
52
23
  return bold ? chalk.bold(message) : message;
53
24
  }
54
- export function uiInfoSection(title, logContent) {
55
- uiLine();
25
+ export function logUiInfoSection(title, logContent) {
26
+ logUiLine();
56
27
  uiLogger.log(chalk.bold(title));
57
28
  uiLogger.log('');
58
29
  logContent();
59
30
  uiLogger.log('');
60
- uiLine();
61
- }
62
- export function uiCommandReference(command, withQuotes = true) {
63
- const terminalUISupport = getTerminalUISupport();
64
- const commandReference = withQuotes ? `\`${command}\`` : command;
65
- return chalk.bold(terminalUISupport.color
66
- ? chalk.hex(UI_COLORS.MARIGOLD_DARK)(commandReference)
67
- : commandReference);
31
+ logUiLine();
68
32
  }
69
33
  export function uiAuthCommandReference({ accountId, qa, } = {}) {
70
34
  const userIsUsingGlobalConfig = globalConfigFileExists();
@@ -74,8 +38,8 @@ export function uiAuthCommandReference({ accountId, qa, } = {}) {
74
38
  }
75
39
  return uiCommandReference(`${command}${accountId ? ` --account=${accountId}` : ''}${qa ? ' --qa' : ''}`);
76
40
  }
77
- export function uiFeatureHighlight(features, title) {
78
- uiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
41
+ export function logUiFeatureHighlight(features, title) {
42
+ logUiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
79
43
  features.forEach(feature => {
80
44
  const featureConfig = uiMessages.featureHighlight.featureKeys[feature];
81
45
  if (!featureConfig) {
@@ -99,59 +63,62 @@ export function uiFeatureHighlight(features, title) {
99
63
  });
100
64
  });
101
65
  }
102
- export function uiBetaTag(message, log = true) {
66
+ // export function uiBetaTag(message: string): string {
67
+ // const terminalUISupport = getTerminalUISupport();
68
+ // const tag = i18n(`lib.ui.betaTag`);
69
+ // return `${
70
+ // terminalUISupport.color ? chalk.hex(UI_COLORS.SORBET)(tag) : tag
71
+ // } ${message}`;
72
+ // }
73
+ // Replace this with the above code once we've upgraded to yargs 18.0.0
74
+ export function uiBetaTag(message) {
103
75
  const tag = uiMessages.betaTag;
104
- const result = `${tag} ${message}`;
105
- if (log) {
106
- uiLogger.log(result);
107
- return;
108
- }
109
- return result;
76
+ return `${tag} ${message}`;
110
77
  }
111
- export function uiDeprecatedTag(message, log = true) {
78
+ // export function uiDeprecatedTag(message: string): string {
79
+ // const terminalUISupport = getTerminalUISupport();
80
+ // const tag = i18n(`lib.ui.deprecatedTag`);
81
+ // return `${terminalUISupport.color ? chalk.yellow(tag) : tag} ${message}`;
82
+ // }
83
+ // Replace this with the above code once we've upgraded to yargs 18.0.0
84
+ export function uiDeprecatedTag(message) {
112
85
  const tag = uiMessages.deprecatedTag;
113
- const result = `${tag} ${message}`;
114
- if (log) {
115
- uiLogger.log(result);
116
- return;
117
- }
118
- return result;
86
+ return `${tag} ${message}`;
119
87
  }
120
88
  export function uiCommandDisabledBanner(command, url, message) {
121
89
  const tag = message ||
122
90
  `The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('See all HubSpot CLI commands here.', url) : ''}`;
123
91
  uiLogger.log('');
124
- uiLine();
92
+ logUiLine();
125
93
  uiLogger.error(tag);
126
- uiLine();
94
+ logUiLine();
127
95
  uiLogger.log('');
128
96
  }
129
- export function uiDeprecatedDescription(message, command, url) {
97
+ export function logUiDeprecatedDescription(message, command, url) {
130
98
  const tag = message || uiMessages.disabledMessage(command, url);
131
- return uiDeprecatedTag(tag);
99
+ uiLogger.log(uiDeprecatedTag(tag));
132
100
  }
133
101
  // export function uiCommandRenamedDescription(
134
102
  // describe: string | false | undefined,
135
103
  // newCommand: string
136
104
  // ): string | undefined {
137
105
  // return uiDeprecatedTag(
138
- // `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`,
139
- // false
106
+ // `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`
140
107
  // );
141
108
  // }
142
109
  // Replace this with the above code once we've upgraded to yargs 18.0.0
143
110
  export function uiCommandRenamedDescription(describe, newCommand) {
144
- return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`, false);
111
+ return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`);
145
112
  }
146
- export function uiDeprecatedMessage(command, url, message) {
113
+ export function logUiDeprecatedMessage(command, url, message) {
147
114
  const tag = uiMessages.deprecatedDescription(message || '', command, url);
148
115
  uiLogger.log('');
149
- uiDeprecatedTag(tag);
116
+ uiLogger.log(uiDeprecatedTag(tag));
150
117
  uiLogger.log('');
151
118
  }
152
- export function uiCommandRelocatedMessage(newCommand) {
119
+ export function logUiCommandRelocatedMessage(newCommand) {
153
120
  uiLogger.log('');
154
- uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand));
121
+ uiLogger.log(uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand)));
155
122
  uiLogger.log('');
156
123
  }
157
124
  export function indent(level) {
@@ -4,6 +4,7 @@ export declare const uiLogger: {
4
4
  warn: (message: string) => void;
5
5
  success: (message: string) => void;
6
6
  info: (message: string) => void;
7
+ hint: (message: string) => void;
7
8
  debug: (...args: any[]) => void;
8
9
  group: (message: string) => void;
9
10
  groupEnd: () => void;
package/lib/ui/logger.js CHANGED
@@ -1,4 +1,4 @@
1
- import { logger as _logger } from '@hubspot/local-dev-lib/logger';
1
+ import { logger as _logger, getLabels, stylize, Styles, } from '@hubspot/local-dev-lib/logger';
2
2
  // Wrapper around LDL logger to provide type checking
3
3
  export const uiLogger = {
4
4
  log: (message) => _logger.log(message),
@@ -6,6 +6,7 @@ export const uiLogger = {
6
6
  warn: (message) => _logger.warn(message),
7
7
  success: (message) => _logger.success(message),
8
8
  info: (message) => _logger.info(message),
9
+ hint: (message) => console.error(...stylize(getLabels().info, Styles.info, [message])),
9
10
  debug: _logger.debug,
10
11
  group: (message) => _logger.group(message),
11
12
  groupEnd: () => _logger.groupEnd(),
@@ -1,6 +1,6 @@
1
1
  // UI messages for the UI module - separate file to avoid circular imports with lang/en.ts
2
2
  // This contains the same strings that would be in lib.ui.* from lang/en.ts
3
- import { uiCommandReference, uiLink } from './index.js';
3
+ import { uiCommandReference, uiLink } from './formatting.js';
4
4
  export const uiMessages = {
5
5
  betaTag: '[BETA]',
6
6
  deprecatedTag: '[DEPRECATED]',
@@ -45,13 +45,17 @@ REQUIRED WORKFLOWS
45
45
  5. Debugging a failed build: start with \`get-build-status\` to surface
46
46
  error messages, and only reach for \`get-build-logs\` for deeper
47
47
  troubleshooting or warnings.
48
- 6. Reading serverless function logs: call \`list-cms-serverless-functions\`
49
- first to discover the endpoint path, then
50
- \`get-cms-serverless-function-logs\`.
48
+ 6. Reading serverless function logs (deprecated, CMS serverless functions
49
+ are being sunset: editing ends on November 17, 2026 and existing
50
+ functions stop running on February 1, 2027): call
51
+ \`list-cms-serverless-functions\` first to discover the endpoint path,
52
+ then \`get-cms-serverless-function-logs\`.
51
53
  7. Serverless functions come in two distinct kinds. CMS serverless
52
54
  functions are website endpoints served at \`/hs/serverless/<path>\`.
53
- Create them with \`create-cms-function\`, and manage them with
54
- \`list-cms-serverless-functions\` and
55
+ They can no longer be created and editing ends on November 17, 2026,
56
+ so build new serverless functions in a Developer Project instead with
57
+ \`add-feature-to-project\`.
58
+ Manage existing ones with \`list-cms-serverless-functions\` and
55
59
  \`get-cms-serverless-function-logs\`. App functions are serverless
56
60
  functions built inside a developer-platform app, either private
57
61
  (the \`app-function\` feature) or publicly accessible via an endpoint
@@ -63,6 +67,10 @@ REQUIRED WORKFLOWS
63
67
  9. Feedback: when you hit a bug, an error you cannot explain, a confusing
64
68
  result, or a request these tools cannot do, call \`submit-feedback\`
65
69
  with one short message. Then continue with the task.
70
+ 10. Long-running commands: never run \`hs project dev\`,
71
+ \`hs project watch\`, or \`hs cms watch\` from a shell, even if
72
+ asked. Ask the user to run it in a separate terminal window. To
73
+ watch a project, give them \`hs project dev --auto-upload\`.
66
74
 
67
75
  OUTPUT
68
76
  Tool results contain the relevant \`hs\` stdout/stderr or structured data.
@@ -91,7 +91,7 @@ export class HsFunctionLogsTool extends Tool {
91
91
  const normalizedEndpoint = resolvedEndpoint.startsWith('/')
92
92
  ? resolvedEndpoint.slice(1)
93
93
  : resolvedEndpoint;
94
- const command = new HubSpotCommand(`cms function logs ${normalizedEndpoint}`);
94
+ const command = new HubSpotCommand('cms function logs').addArg(normalizedEndpoint);
95
95
  if (latest) {
96
96
  command.addFlag('latest', latest);
97
97
  }
@@ -119,7 +119,7 @@ export class HsFunctionLogsTool extends Tool {
119
119
  register() {
120
120
  return this.mcpServer.registerTool(toolName, {
121
121
  title: 'Get HubSpot CMS serverless function logs for an endpoint',
122
- description: 'Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
122
+ description: 'DEPRECATED: CMS serverless functions are being sunset: creating them has ended, editing ends on November 17, 2026, and existing functions stop running on February 1, 2027. Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
123
123
  inputSchema,
124
124
  annotations: {
125
125
  readOnlyHint: true,
@@ -54,7 +54,7 @@ export class HsListFunctionsTool extends Tool {
54
54
  register() {
55
55
  return this.mcpServer.registerTool(toolName, {
56
56
  title: 'List HubSpot CMS Serverless Functions',
57
- description: 'Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
57
+ description: 'DEPRECATED: CMS serverless functions are being sunset: creating them has ended, editing ends on November 17, 2026, and existing functions stop running on February 1, 2027. Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
58
58
  inputSchema,
59
59
  annotations: {
60
60
  readOnlyHint: true,