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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) 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 +105 -6
  40. package/lang/en.js +269 -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/migrate.js +5 -8
  47. package/lib/commonOpts.js +4 -0
  48. package/lib/constants.d.ts +4 -0
  49. package/lib/constants.js +6 -0
  50. package/lib/errorHandlers/suppressError.js +3 -3
  51. package/lib/feedback.d.ts +3 -0
  52. package/lib/feedback.js +13 -0
  53. package/lib/jsonOutput/projectDownload.d.ts +1 -0
  54. package/lib/jsonOutput/projectDownload.js +1 -0
  55. package/lib/jsonOutput/projectUpload.d.ts +1 -0
  56. package/lib/jsonOutput/projectUpload.js +1 -0
  57. package/lib/mcp/clients.d.ts +2 -1
  58. package/lib/mcp/clients.js +7 -7
  59. package/lib/mcp/setup.d.ts +7 -2
  60. package/lib/mcp/setup.js +22 -37
  61. package/lib/mcp/skills.d.ts +8 -0
  62. package/lib/mcp/skills.js +64 -0
  63. package/lib/projects/archive.d.ts +8 -0
  64. package/lib/projects/archive.js +104 -0
  65. package/lib/projects/archiveDiff.d.ts +12 -0
  66. package/lib/projects/archiveDiff.js +68 -0
  67. package/lib/projects/config.js +1 -1
  68. package/lib/projects/download.d.ts +37 -0
  69. package/lib/projects/download.js +123 -0
  70. package/lib/projects/localDev/AppDevModeInterface.js +3 -3
  71. package/lib/projects/localDev/LocalDevLogger.js +5 -5
  72. package/lib/projects/localDev/LocalDevWatcher.js +2 -1
  73. package/lib/projects/localDev/helpers/project.js +3 -3
  74. package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
  75. package/lib/projects/projectInfo.js +4 -4
  76. package/lib/projects/projectProfiles.js +3 -3
  77. package/lib/projects/ui.js +3 -3
  78. package/lib/projects/upload.d.ts +3 -1
  79. package/lib/projects/upload.js +23 -6
  80. package/lib/projects/watch.js +4 -2
  81. package/lib/projects/workspaces.js +4 -4
  82. package/lib/prompts/importDataTestAccountSelectPrompt.js +1 -1
  83. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  84. package/lib/prompts/selectPublicAppForMigrationPrompt.js +3 -3
  85. package/lib/serverlessSunset.d.ts +6 -0
  86. package/lib/serverlessSunset.js +32 -0
  87. package/lib/testUtils.d.ts +5 -1
  88. package/lib/testUtils.js +2 -2
  89. package/lib/ui/appLogs.js +3 -3
  90. package/lib/ui/git.js +3 -3
  91. package/lib/ui/index.d.ts +8 -10
  92. package/lib/ui/index.js +34 -31
  93. package/lib/validation.js +16 -1
  94. package/lib/yargs/makeWrappedYargsHandler.d.ts +1 -0
  95. package/lib/yargs/makeWrappedYargsHandler.js +7 -0
  96. package/mcp-server/Tool.d.ts +1 -0
  97. package/mcp-server/Tool.js +4 -1
  98. package/mcp-server/server.js +16 -5
  99. package/mcp-server/skills/hubspot-fix-build/SKILL.md +61 -0
  100. package/mcp-server/skills/hubspot-new-app/SKILL.md +84 -0
  101. package/mcp-server/tools/cms/HsFunctionLogsTool.js +1 -1
  102. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  103. package/mcp-server/tools/index.js +2 -2
  104. package/mcp-server/tools/project/DocFetchTool.d.ts +4 -1
  105. package/mcp-server/tools/project/DocFetchTool.js +53 -12
  106. package/mcp-server/tools/project/DocsSearchTool.js +2 -7
  107. package/mcp-server/tools/project/FindProjectsTool.js +4 -1
  108. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +2 -7
  109. package/mcp-server/tools/project/GetApplicationInfoTool.js +2 -7
  110. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +1 -1
  111. package/mcp-server/tools/project/GetBuildLogsTool.js +2 -12
  112. package/mcp-server/tools/project/GetBuildStatusTool.js +2 -12
  113. package/mcp-server/tools/project/KnowledgeSearchTool.js +2 -5
  114. package/mcp-server/tools/project/SubmitFeedbackTool.d.ts +25 -0
  115. package/mcp-server/tools/project/SubmitFeedbackTool.js +73 -0
  116. package/mcp-server/utils/command.js +23 -4
  117. package/mcp-server/utils/errors.d.ts +1 -0
  118. package/mcp-server/utils/errors.js +9 -0
  119. package/mcp-server/utils/feedbackTracking.js +3 -1
  120. package/package.json +14 -14
  121. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
  122. 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));
@@ -22,7 +22,7 @@ export async function importDataTestAccountSelectPrompt(parentAccountId) {
22
22
  return promptUser({
23
23
  type: 'list',
24
24
  name: 'selectedAccountId',
25
- message: '[--account] Select a developer test account:',
25
+ message: lib.prompts.importDataTestAccountSelectPrompt.message,
26
26
  choices: childAccounts,
27
27
  });
28
28
  }
@@ -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
+ }
@@ -12,7 +12,11 @@ type MockErrorResponse = {
12
12
  };
13
13
  };
14
14
  export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
15
- export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
15
+ type MockErrorRequestConfig = {
16
+ url?: string;
17
+ data?: string;
18
+ };
19
+ export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse, config?: MockErrorRequestConfig): HubSpotHttpError;
16
20
  export declare function stubColorEnv(): void;
17
21
  export declare const MOCK_SANDBOX_TARGET: AccountTargetCandidate;
18
22
  export declare const MOCK_PRODUCTION_TARGET: AccountTargetCandidate;
package/lib/testUtils.js CHANGED
@@ -13,9 +13,9 @@ export function mockHubSpotHttpResponse(data) {
13
13
  },
14
14
  });
15
15
  }
16
- export function mockHubSpotHttpError(message, response) {
16
+ export function mockHubSpotHttpError(message, response, config) {
17
17
  return new HubSpotHttpError(message, {
18
- cause: { isAxiosError: true, response },
18
+ cause: { isAxiosError: true, response, config },
19
19
  });
20
20
  }
21
21
  // Stubs the color-detection env to a color-capable interactive baseline.
package/lib/ui/appLogs.js CHANGED
@@ -2,7 +2,7 @@ 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
7
  import { SYSTEM_TYPE_DISPLAY_NAMES, toTypeChoice } from '../app/logs.js';
8
8
  import { getAppLogDetailsUrl, getAppLogsUrl } from '../app/urls.js';
@@ -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));
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
@@ -7,25 +7,23 @@ export declare const UI_COLORS: {
7
7
  MARIGOLD: string;
8
8
  MARIGOLD_DARK: string;
9
9
  };
10
- export declare function uiLine(): void;
10
+ export declare function logUiLine(): void;
11
11
  export declare function getTerminalUISupport(): TerminalSupport;
12
12
  export declare function uiLink(linkText: string, url: string): string;
13
13
  export declare function uiAccountDescription(accountId?: number | null, bold?: boolean): string;
14
- export declare function uiInfoSection(title: string, logContent: () => void): void;
14
+ export declare function logUiInfoSection(title: string, logContent: () => void): void;
15
15
  export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
16
16
  export declare function uiAuthCommandReference({ accountId, qa, }?: {
17
17
  accountId?: number | string;
18
18
  qa?: boolean;
19
19
  }): 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;
20
+ export declare function logUiFeatureHighlight(features: string[], title?: string): void;
21
+ export declare function uiBetaTag(message: string): string;
22
+ export declare function uiDeprecatedTag(message: string): string;
25
23
  export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
26
- export declare function uiDeprecatedDescription(message: string, command: string, url?: string): undefined;
24
+ export declare function logUiDeprecatedDescription(message: string, command: string, url?: string): void;
27
25
  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;
26
+ export declare function logUiDeprecatedMessage(command: string, url?: string, message?: string): void;
27
+ export declare function logUiCommandRelocatedMessage(newCommand: string): void;
30
28
  export declare function indent(level: number): string;
31
29
  export {};
package/lib/ui/index.js CHANGED
@@ -10,7 +10,7 @@ export const UI_COLORS = {
10
10
  MARIGOLD: '#f5c26b',
11
11
  MARIGOLD_DARK: '#dbae60',
12
12
  };
13
- export function uiLine() {
13
+ export function logUiLine() {
14
14
  uiLogger.log('-'.repeat(50));
15
15
  }
16
16
  export function getTerminalUISupport() {
@@ -51,13 +51,13 @@ export function uiAccountDescription(accountId, bold = true) {
51
51
  }
52
52
  return bold ? chalk.bold(message) : message;
53
53
  }
54
- export function uiInfoSection(title, logContent) {
55
- uiLine();
54
+ export function logUiInfoSection(title, logContent) {
55
+ logUiLine();
56
56
  uiLogger.log(chalk.bold(title));
57
57
  uiLogger.log('');
58
58
  logContent();
59
59
  uiLogger.log('');
60
- uiLine();
60
+ logUiLine();
61
61
  }
62
62
  export function uiCommandReference(command, withQuotes = true) {
63
63
  const terminalUISupport = getTerminalUISupport();
@@ -74,8 +74,8 @@ export function uiAuthCommandReference({ accountId, qa, } = {}) {
74
74
  }
75
75
  return uiCommandReference(`${command}${accountId ? ` --account=${accountId}` : ''}${qa ? ' --qa' : ''}`);
76
76
  }
77
- export function uiFeatureHighlight(features, title) {
78
- uiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
77
+ export function logUiFeatureHighlight(features, title) {
78
+ logUiInfoSection(title ? title : uiMessages.featureHighlight.defaultTitle, () => {
79
79
  features.forEach(feature => {
80
80
  const featureConfig = uiMessages.featureHighlight.featureKeys[feature];
81
81
  if (!featureConfig) {
@@ -99,59 +99,62 @@ export function uiFeatureHighlight(features, title) {
99
99
  });
100
100
  });
101
101
  }
102
- export function uiBetaTag(message, log = true) {
102
+ // export function uiBetaTag(message: string): string {
103
+ // const terminalUISupport = getTerminalUISupport();
104
+ // const tag = i18n(`lib.ui.betaTag`);
105
+ // return `${
106
+ // terminalUISupport.color ? chalk.hex(UI_COLORS.SORBET)(tag) : tag
107
+ // } ${message}`;
108
+ // }
109
+ // Replace this with the above code once we've upgraded to yargs 18.0.0
110
+ export function uiBetaTag(message) {
103
111
  const tag = uiMessages.betaTag;
104
- const result = `${tag} ${message}`;
105
- if (log) {
106
- uiLogger.log(result);
107
- return;
108
- }
109
- return result;
112
+ return `${tag} ${message}`;
110
113
  }
111
- export function uiDeprecatedTag(message, log = true) {
114
+ // export function uiDeprecatedTag(message: string): string {
115
+ // const terminalUISupport = getTerminalUISupport();
116
+ // const tag = i18n(`lib.ui.deprecatedTag`);
117
+ // return `${terminalUISupport.color ? chalk.yellow(tag) : tag} ${message}`;
118
+ // }
119
+ // Replace this with the above code once we've upgraded to yargs 18.0.0
120
+ export function uiDeprecatedTag(message) {
112
121
  const tag = uiMessages.deprecatedTag;
113
- const result = `${tag} ${message}`;
114
- if (log) {
115
- uiLogger.log(result);
116
- return;
117
- }
118
- return result;
122
+ return `${tag} ${message}`;
119
123
  }
120
124
  export function uiCommandDisabledBanner(command, url, message) {
121
125
  const tag = message ||
122
126
  `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
127
  uiLogger.log('');
124
- uiLine();
128
+ logUiLine();
125
129
  uiLogger.error(tag);
126
- uiLine();
130
+ logUiLine();
127
131
  uiLogger.log('');
128
132
  }
129
- export function uiDeprecatedDescription(message, command, url) {
133
+ export function logUiDeprecatedDescription(message, command, url) {
130
134
  const tag = message || uiMessages.disabledMessage(command, url);
131
- return uiDeprecatedTag(tag);
135
+ uiLogger.log(uiDeprecatedTag(tag));
132
136
  }
133
137
  // export function uiCommandRenamedDescription(
134
138
  // describe: string | false | undefined,
135
139
  // newCommand: string
136
140
  // ): string | undefined {
137
141
  // return uiDeprecatedTag(
138
- // `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`,
139
- // false
142
+ // `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`
140
143
  // );
141
144
  // }
142
145
  // Replace this with the above code once we've upgraded to yargs 18.0.0
143
146
  export function uiCommandRenamedDescription(describe, newCommand) {
144
- return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`, false);
147
+ return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`);
145
148
  }
146
- export function uiDeprecatedMessage(command, url, message) {
149
+ export function logUiDeprecatedMessage(command, url, message) {
147
150
  const tag = uiMessages.deprecatedDescription(message || '', command, url);
148
151
  uiLogger.log('');
149
- uiDeprecatedTag(tag);
152
+ uiLogger.log(uiDeprecatedTag(tag));
150
153
  uiLogger.log('');
151
154
  }
152
- export function uiCommandRelocatedMessage(newCommand) {
155
+ export function logUiCommandRelocatedMessage(newCommand) {
153
156
  uiLogger.log('');
154
- uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand));
157
+ uiLogger.log(uiDeprecatedTag(uiMessages.commandRenamedMessage(newCommand)));
155
158
  uiLogger.log('');
156
159
  }
157
160
  export function indent(level) {
package/lib/validation.js CHANGED
@@ -2,11 +2,12 @@ import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { uiLogger } from '../lib/ui/logger.js';
4
4
  import { CMS_PUBLISH_MODE } from '@hubspot/local-dev-lib/constants/files';
5
- import { API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
5
+ import { ACCESS_TOKEN_AUTH_METHOD, API_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
6
6
  import { commaSeparatedValues } from '@hubspot/local-dev-lib/text';
7
7
  import { getConfigFilePath, getConfigAccountById, } from '@hubspot/local-dev-lib/config';
8
8
  import { getOauthManager } from '@hubspot/local-dev-lib/oauth';
9
9
  import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personalAccessKey';
10
+ import { accessTokenForInjectedAccessToken } from '@hubspot/local-dev-lib/accessToken';
10
11
  import { getAbsoluteFilePath, getCwd, getExt, } from '@hubspot/local-dev-lib/path';
11
12
  import { ENVIRONMENT_VARIABLES } from '@hubspot/local-dev-lib/constants/config';
12
13
  import { getCmsPublishMode } from './commonOpts.js';
@@ -39,6 +40,7 @@ export async function validateAccount(options) {
39
40
  PERSONAL_ACCESS_KEY_AUTH_METHOD,
40
41
  OAUTH_AUTH_METHOD,
41
42
  API_KEY_AUTH_METHOD,
43
+ ACCESS_TOKEN_AUTH_METHOD,
42
44
  ].map(method => method.value))));
43
45
  }
44
46
  if (authType === 'oauth2') {
@@ -84,6 +86,19 @@ export async function validateAccount(options) {
84
86
  return false;
85
87
  }
86
88
  }
89
+ else if (authType === ACCESS_TOKEN_AUTH_METHOD.value) {
90
+ if (!accountConfig.auth.tokenInfo.accessToken) {
91
+ uiLogger.error(lib.validation.accessTokenMissing(accountId));
92
+ return false;
93
+ }
94
+ try {
95
+ accessTokenForInjectedAccessToken(accountId);
96
+ }
97
+ catch (e) {
98
+ logError(e);
99
+ return false;
100
+ }
101
+ }
87
102
  else if (!accountConfig.apiKey) {
88
103
  uiLogger.error(lib.validation.authConfigurationMissing(accountId));
89
104
  return false;
@@ -4,4 +4,5 @@ import { CommonArgs } from '../../types/Yargs.js';
4
4
  export type WrappedHandlerOptions = {
5
5
  jsonOutputSchema?: z.ZodType;
6
6
  };
7
+ export declare function getJsonOutputSchema(trackingName: string): z.ZodType | undefined;
7
8
  export declare function makeWrappedYargsHandler<T extends CommonArgs>(trackingName: string, handler: (args: ArgumentsCamelCase<T>) => Promise<void>, options?: WrappedHandlerOptions): (args: ArgumentsCamelCase<T>) => Promise<void>;
@@ -14,6 +14,10 @@ import { isPromptExitError } from '../errors/PromptExitError.js';
14
14
  import { debugError } from '../errorHandlers/index.js';
15
15
  import { MAX_LOG_FILES } from '../constants.js';
16
16
  const HANDLER_LOG_DIR = path.join(os.homedir(), '.hscli', 'logs', 'cli');
17
+ const jsonOutputSchemas = new Map();
18
+ export function getJsonOutputSchema(trackingName) {
19
+ return jsonOutputSchemas.get(trackingName);
20
+ }
17
21
  function logUsageTrackingMessage(isJsonOutput) {
18
22
  if (isJsonOutput) {
19
23
  return;
@@ -119,6 +123,9 @@ function createLogFileWriter(trackingName, isJsonOutput) {
119
123
  return { writeLogFile, writeFailureLogFile };
120
124
  }
121
125
  export function makeWrappedYargsHandler(trackingName, handler, options) {
126
+ if (options?.jsonOutputSchema) {
127
+ jsonOutputSchemas.set(trackingName, options.jsonOutputSchema);
128
+ }
122
129
  return async (args) => {
123
130
  const wrappedHandlerArgs = args;
124
131
  const isJsonOutput = Boolean(wrappedHandlerArgs.json || wrappedHandlerArgs.formatOutputAsJson);
@@ -16,6 +16,7 @@ export declare class Tool<InputSchema> {
16
16
  protected getTrackingMeta(_input: InputSchema): {
17
17
  [key: string]: string;
18
18
  } | undefined;
19
+ protected getLoggableInput(input: InputSchema): unknown;
19
20
  protected elicit(params: {
20
21
  message: string;
21
22
  fields: Record<string, PrimitiveSchemaDefinition>;
@@ -45,6 +45,9 @@ export class Tool {
45
45
  getTrackingMeta(_input) {
46
46
  return undefined;
47
47
  }
48
+ getLoggableInput(input) {
49
+ return input;
50
+ }
48
51
  elicit(params) {
49
52
  return requestElicitation(this.mcpServer, params, this.logger);
50
53
  }
@@ -57,7 +60,7 @@ export class Tool {
57
60
  // Desktop, Inspector, etc.) will display these logs.
58
61
  this.logger.debug(this.toolName, {
59
62
  message: 'Tool invoked',
60
- args: input,
63
+ args: this.getLoggableInput(input),
61
64
  });
62
65
  await trackToolUsage(this.toolName, this.getTrackingMeta(input));
63
66
  const result = await this.handler(input, extra);
@@ -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
@@ -60,6 +64,13 @@ REQUIRED WORKFLOWS
60
64
  functions.
61
65
  8. App analytics: call \`get-apps-info\` to discover \`appId\` values
62
66
  before \`get-api-usage-patterns-by-app-id\`.
67
+ 9. Feedback: when you hit a bug, an error you cannot explain, a confusing
68
+ result, or a request these tools cannot do, call \`submit-feedback\`
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\`.
63
74
 
64
75
  OUTPUT
65
76
  Tool results contain the relevant \`hs\` stdout/stderr or structured data.