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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/api/feedback.d.ts +10 -0
  2. package/api/feedback.js +9 -0
  3. package/bin/cli.js +19 -1
  4. package/commands/account/auth.js +2 -2
  5. package/commands/account/createOverride.js +2 -0
  6. package/commands/account/removeOverride.js +2 -0
  7. package/commands/app/secret/add.js +1 -1
  8. package/commands/app/secret/delete.js +1 -1
  9. package/commands/app/secret/list.js +1 -1
  10. package/commands/app/secret/update.js +1 -1
  11. package/commands/app/secret.js +1 -1
  12. package/commands/auth.js +3 -2
  13. package/commands/cms/function/create.js +5 -37
  14. package/commands/cms/function/deploy.js +8 -1
  15. package/commands/cms/function/list.js +4 -0
  16. package/commands/cms/function/logs.js +2 -0
  17. package/commands/cms/function/server.js +6 -0
  18. package/commands/cms/lighthouseScore.js +1 -1
  19. package/commands/cms/upload.js +6 -0
  20. package/commands/cms/watch.js +2 -0
  21. package/commands/cms/webpack/create.js +5 -32
  22. package/commands/customObject.js +2 -2
  23. package/commands/feedback.d.ts +6 -2
  24. package/commands/feedback.js +82 -8
  25. package/commands/getStarted.js +4 -4
  26. package/commands/hubdb/list.js +2 -2
  27. package/commands/init.js +3 -2
  28. package/commands/mcp/setup.d.ts +1 -0
  29. package/commands/mcp/setup.js +11 -3
  30. package/commands/project/dev/index.js +2 -2
  31. package/commands/project/download.d.ts +2 -0
  32. package/commands/project/download.js +56 -16
  33. package/commands/project/logs.js +2 -2
  34. package/commands/project/upload.js +6 -2
  35. package/commands/project/watch.js +2 -2
  36. package/commands/sandbox/create.js +3 -3
  37. package/commands/sandbox/delete.js +1 -1
  38. package/commands/sandbox.js +1 -1
  39. package/lang/en.d.ts +111 -6
  40. package/lang/en.js +275 -51
  41. package/lib/accountAuth.js +12 -0
  42. package/lib/accountCredentials.d.ts +1 -0
  43. package/lib/accountCredentials.js +25 -0
  44. package/lib/agentHelp.d.ts +17 -0
  45. package/lib/agentHelp.js +90 -0
  46. package/lib/app/logSystemTypes.d.ts +4 -0
  47. package/lib/app/logSystemTypes.js +17 -0
  48. package/lib/app/logs.d.ts +2 -4
  49. package/lib/app/logs.js +2 -17
  50. package/lib/app/migrate.js +5 -8
  51. package/lib/commonOpts.js +4 -0
  52. package/lib/constants.d.ts +4 -0
  53. package/lib/constants.js +6 -0
  54. package/lib/crossPlatformSpawn/escape.d.ts +2 -0
  55. package/lib/crossPlatformSpawn/escape.js +38 -0
  56. package/lib/crossPlatformSpawn/index.d.ts +7 -0
  57. package/lib/crossPlatformSpawn/index.js +43 -0
  58. package/lib/crossPlatformSpawn/resolveCommand.d.ts +1 -0
  59. package/lib/crossPlatformSpawn/resolveCommand.js +69 -0
  60. package/lib/errorHandlers/suppressError.js +3 -3
  61. package/lib/feedback.d.ts +3 -0
  62. package/lib/feedback.js +13 -0
  63. package/lib/jsonOutput/projectDownload.d.ts +1 -0
  64. package/lib/jsonOutput/projectDownload.js +1 -0
  65. package/lib/jsonOutput/projectUpload.d.ts +1 -0
  66. package/lib/jsonOutput/projectUpload.js +1 -0
  67. package/lib/mcp/clients.d.ts +2 -1
  68. package/lib/mcp/clients.js +7 -7
  69. package/lib/mcp/setup.d.ts +7 -2
  70. package/lib/mcp/setup.js +22 -37
  71. package/lib/mcp/skills.d.ts +8 -0
  72. package/lib/mcp/skills.js +64 -0
  73. package/lib/projects/archive.d.ts +8 -0
  74. package/lib/projects/archive.js +104 -0
  75. package/lib/projects/archiveDiff.d.ts +12 -0
  76. package/lib/projects/archiveDiff.js +68 -0
  77. package/lib/projects/config.js +1 -1
  78. package/lib/projects/download.d.ts +37 -0
  79. package/lib/projects/download.js +123 -0
  80. package/lib/projects/localDev/AppDevModeInterface.js +3 -3
  81. package/lib/projects/localDev/LocalDevLogger.js +5 -5
  82. package/lib/projects/localDev/LocalDevWatcher.js +2 -1
  83. package/lib/projects/localDev/helpers/project.js +3 -3
  84. package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
  85. package/lib/projects/projectInfo.js +4 -4
  86. package/lib/projects/projectProfiles.js +3 -3
  87. package/lib/projects/ui.js +3 -3
  88. package/lib/projects/upload.d.ts +3 -1
  89. package/lib/projects/upload.js +23 -6
  90. package/lib/projects/watch.js +4 -2
  91. package/lib/projects/workspaces.js +4 -4
  92. package/lib/prompts/importDataTestAccountSelectPrompt.js +1 -1
  93. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  94. package/lib/prompts/selectPublicAppForMigrationPrompt.js +3 -3
  95. package/lib/serverlessSunset.d.ts +6 -0
  96. package/lib/serverlessSunset.js +32 -0
  97. package/lib/testUtils.d.ts +5 -1
  98. package/lib/testUtils.js +2 -2
  99. package/lib/ui/appLogs.js +4 -4
  100. package/lib/ui/formatting.d.ts +13 -0
  101. package/lib/ui/formatting.js +39 -0
  102. package/lib/ui/git.js +3 -3
  103. package/lib/ui/index.d.ts +9 -23
  104. package/lib/ui/index.js +36 -69
  105. package/lib/ui/uiMessages.js +1 -1
  106. package/lib/validation.js +16 -1
  107. package/lib/yargs/makeWrappedYargsHandler.d.ts +1 -0
  108. package/lib/yargs/makeWrappedYargsHandler.js +7 -0
  109. package/mcp-server/Tool.d.ts +1 -0
  110. package/mcp-server/Tool.js +4 -1
  111. package/mcp-server/server.js +16 -5
  112. package/mcp-server/skills/hubspot-fix-build/SKILL.md +61 -0
  113. package/mcp-server/skills/hubspot-new-app/SKILL.md +84 -0
  114. package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
  115. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  116. package/mcp-server/tools/cms/HsListTool.js +4 -1
  117. package/mcp-server/tools/index.js +2 -2
  118. package/mcp-server/tools/project/DocFetchTool.d.ts +4 -1
  119. package/mcp-server/tools/project/DocFetchTool.js +53 -12
  120. package/mcp-server/tools/project/DocsSearchTool.js +2 -7
  121. package/mcp-server/tools/project/FindProjectsTool.js +4 -1
  122. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +2 -7
  123. package/mcp-server/tools/project/GetApplicationInfoTool.js +2 -7
  124. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +1 -1
  125. package/mcp-server/tools/project/GetBuildLogsTool.js +2 -12
  126. package/mcp-server/tools/project/GetBuildStatusTool.js +2 -12
  127. package/mcp-server/tools/project/KnowledgeSearchTool.js +2 -5
  128. package/mcp-server/tools/project/SubmitFeedbackTool.d.ts +25 -0
  129. package/mcp-server/tools/project/SubmitFeedbackTool.js +73 -0
  130. package/mcp-server/utils/command.js +16 -5
  131. package/mcp-server/utils/errors.d.ts +1 -0
  132. package/mcp-server/utils/errors.js +9 -0
  133. package/mcp-server/utils/feedbackTracking.js +3 -1
  134. package/package.json +12 -14
  135. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +0 -26
  136. package/mcp-server/tools/cms/HsCreateFunctionTool.js +0 -100
@@ -2,7 +2,7 @@ import { hasLocalStateFlag } from '@hubspot/local-dev-lib/config';
2
2
  import { getConfigDefaultAccountIfExists, isConfigFlagEnabled, } from '@hubspot/local-dev-lib/config';
3
3
  import { CONFIG_FLAGS } from '@hubspot/local-dev-lib/constants/config';
4
4
  import { uiLogger } from '../../ui/logger.js';
5
- import { uiLine, uiAccountDescription, uiCommandReference, } from '../../ui/index.js';
5
+ import { logUiLine, uiAccountDescription, uiCommandReference, } from '../../ui/index.js';
6
6
  import { lib } from '../../../lang/en.js';
7
7
  import SpinniesManager from '../../ui/SpinniesManager.js';
8
8
  import { logError, getErrorMessage } from '../../errorHandlers/index.js';
@@ -105,7 +105,7 @@ class LocalDevLogger {
105
105
  }
106
106
  uiLogger.log('');
107
107
  uiLogger.log(lib.LocalDevManager.quitHelper);
108
- uiLine();
108
+ logUiLine();
109
109
  uiLogger.log('');
110
110
  }
111
111
  cleanupStart() {
@@ -155,12 +155,12 @@ class LocalDevLogger {
155
155
  uploadSuccess() {
156
156
  uiLogger.log('');
157
157
  uiLogger.log(lib.LocalDevProcess.uploadSuccess);
158
- uiLine();
158
+ logUiLine();
159
159
  uiLogger.log('');
160
160
  }
161
161
  uploadSuccessAutoDeployDisabled() {
162
162
  uiLogger.warn(lib.LocalDevProcess.uploadSuccessAutoDeployDisabled);
163
- uiLine();
163
+ logUiLine();
164
164
  uiLogger.log('');
165
165
  }
166
166
  deployError(error) {
@@ -174,7 +174,7 @@ class LocalDevLogger {
174
174
  deploySuccess() {
175
175
  uiLogger.log('');
176
176
  uiLogger.log(lib.LocalDevProcess.deploySuccess);
177
- uiLine();
177
+ logUiLine();
178
178
  uiLogger.log('');
179
179
  }
180
180
  monitorConsoleOutput() {
@@ -7,6 +7,7 @@ const WATCH_EVENTS = {
7
7
  unlink: 'unlink',
8
8
  unlinkDir: 'unlinkDir',
9
9
  };
10
+ const IGNORED_DIRECTORIES = ['dist', 'node_modules'];
10
11
  class LocalDevWatcher {
11
12
  localDevProcess;
12
13
  watcher;
@@ -23,7 +24,7 @@ class LocalDevWatcher {
23
24
  start() {
24
25
  this.watcher = chokidar.watch(this.localDevProcess.projectDir, {
25
26
  ignoreInitial: true,
26
- ignored: ['**/dist', '**/node_modules'],
27
+ ignored: filePath => IGNORED_DIRECTORIES.includes(path.basename(filePath)),
27
28
  });
28
29
  const configPaths = Object.values(this.localDevProcess.projectNodes).map(component => component.localDev.componentConfigPath);
29
30
  const projectConfigPath = path.join(this.localDevProcess.projectDir, PROJECT_CONFIG_FILE);
@@ -12,7 +12,7 @@ import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
12
12
  import { PROJECT_BUILD_TEXT, PROJECT_CONFIG_FILE, PROJECT_DEPLOY_TEXT, PROJECT_ERROR_TYPES, } from '../../../constants.js';
13
13
  import { lib } from '../../../../lang/en.js';
14
14
  import { uiLogger } from '../../../ui/logger.js';
15
- import { uiAccountDescription, uiLine } from '../../../ui/index.js';
15
+ import { uiAccountDescription, logUiLine } from '../../../ui/index.js';
16
16
  import { confirmPrompt } from '../../../prompts/promptUtils.js';
17
17
  import SpinniesManager from '../../../ui/SpinniesManager.js';
18
18
  import { EXIT_CODES } from '../../../enums/exitCodes.js';
@@ -32,9 +32,9 @@ export async function createNewProjectForLocalDev(projectConfig, targetAccountId
32
32
  .projectMustExistExplanation;
33
33
  const explanationString = explanationLangFunction(projectConfig.name, targetAccountId);
34
34
  uiLogger.log('');
35
- uiLine();
35
+ logUiLine();
36
36
  uiLogger.log(explanationString);
37
- uiLine();
37
+ logUiLine();
38
38
  shouldCreateProject = await confirmPrompt(lib.localDevHelpers.project.createNewProjectForLocalDev.createProject(projectConfig.name, uiAccountDescription(targetAccountId)));
39
39
  }
40
40
  if (shouldCreateProject) {
@@ -3,7 +3,7 @@ import { getBuildStatus, getBuildStructure, getDeployStatus, getDeployStructure,
3
3
  import { DEFAULT_POLLING_DELAY, PROJECT_BUILD_TEXT, PROJECT_DEPLOY_TEXT, PROJECT_TASK_TYPES, PROJECT_ERROR_TYPES, } from '../constants.js';
4
4
  import SpinniesManager from '../ui/SpinniesManager.js';
5
5
  import { logError, ApiErrorContext } from '../errorHandlers/index.js';
6
- import { uiLine, uiLink, uiAccountDescription } from '../ui/index.js';
6
+ import { logUiLine, uiLink, uiAccountDescription } from '../ui/index.js';
7
7
  import { getProjectBuildDetailUrl, getProjectDeployDetailUrl, getProjectActivityUrl, } from './urls.js';
8
8
  import { lib } from '../../lang/en.js';
9
9
  import { uiLogger } from '../ui/logger.js';
@@ -172,12 +172,12 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
172
172
  });
173
173
  if (!silenceLogs) {
174
174
  const failedSubtasks = subtasks.filter(subtask => subtask.status === 'FAILURE');
175
- uiLine();
175
+ logUiLine();
176
176
  uiLogger.log(`${statusStrings.SUBTASK_FAIL(failedSubtasks.length === 1
177
177
  ? getSubtaskName(failedSubtasks[0])
178
178
  : failedSubtasks.length + ' components', displayId)}\n`);
179
179
  uiLogger.log(lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorSummary);
180
- uiLine();
180
+ logUiLine();
181
181
  const displayErrors = failedSubtasks.filter(subtask => subtask?.standardError?.subCategory !==
182
182
  PROJECT_ERROR_TYPES.SUBBUILD_FAILED &&
183
183
  subtask?.standardError?.subCategory !==
@@ -295,7 +295,7 @@ export async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFi
295
295
  const { silenceLogs = false, skipDeploy = false } = options;
296
296
  let buildStatus = await pollBuildStatus(accountId, projectConfig.name, buildId, null, silenceLogs);
297
297
  if (!silenceLogs) {
298
- uiLine();
298
+ logUiLine();
299
299
  }
300
300
  const result = {
301
301
  succeeded: true,
@@ -4,7 +4,7 @@ import { APP_KEY, USER_FACING_TO_INTERNAL_TYPE, } from '@hubspot/project-parsing
4
4
  import { debugError } from '../errorHandlers/index.js';
5
5
  import { getProjectDetailUrl } from './urls.js';
6
6
  import { commands } from '../../lang/en.js';
7
- import { uiLine, uiLink } from '../ui/index.js';
7
+ import { logUiLine, uiLink } from '../ui/index.js';
8
8
  import { uiLogger } from '../ui/logger.js';
9
9
  export async function getProjectInfo(project, platformVersion, accountId) {
10
10
  const deployedBuild = project.deployedBuild;
@@ -46,7 +46,7 @@ export async function getProjectInfo(project, platformVersion, accountId) {
46
46
  }
47
47
  export function logProjectInfo(projectInfo) {
48
48
  uiLogger.log(chalk.bold(commands.project.info.project.title(projectInfo.projectName)));
49
- uiLine();
49
+ logUiLine();
50
50
  uiLogger.log(commands.project.info.project.platformVersion(projectInfo.platformVersion));
51
51
  uiLogger.log(commands.project.info.project.id(projectInfo.projectId));
52
52
  uiLogger.log(commands.project.info.project.deployedBuild(projectInfo.deployedBuildId));
@@ -58,7 +58,7 @@ export function logProjectInfo(projectInfo) {
58
58
  if (projectInfo.app) {
59
59
  uiLogger.log('');
60
60
  uiLogger.log(chalk.bold(commands.project.info.app.title));
61
- uiLine();
61
+ logUiLine();
62
62
  uiLogger.log(commands.project.info.app.name(projectInfo.app.name));
63
63
  uiLogger.log(commands.project.info.app.id(projectInfo.app.id));
64
64
  uiLogger.log(commands.project.info.app.uid(projectInfo.app.uid));
@@ -72,7 +72,7 @@ export function logProjectInfo(projectInfo) {
72
72
  if (projectInfo.components.length > 0) {
73
73
  uiLogger.log('');
74
74
  uiLogger.log(chalk.bold(commands.project.info.componentsHeader));
75
- uiLine();
75
+ logUiLine();
76
76
  const typeColWidth = Math.max(commands.project.info.labels.type.length, ...projectInfo.components.map(c => c.type.length));
77
77
  uiLogger.log(`${commands.project.info.labels.type.padEnd(typeColWidth)} ${commands.project.info.labels.uid}`);
78
78
  for (const component of projectInfo.components) {
@@ -1,14 +1,14 @@
1
1
  import path from 'path';
2
2
  import { loadHsProfileFile, getHsProfileFilename, validateProfileVariables, } from '@hubspot/project-parsing-lib/profiles';
3
3
  import { commands, lib } from '../../lang/en.js';
4
- import { indent, uiLine } from '../ui/index.js';
4
+ import { indent, logUiLine } from '../ui/index.js';
5
5
  import { uiLogger } from '../ui/logger.js';
6
6
  import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
7
7
  import SpinniesManager from '../ui/SpinniesManager.js';
8
8
  import { handleTranslate } from './upload.js';
9
9
  import { getErrorMessage } from '../errorHandlers/index.js';
10
10
  export function logProfileHeader(profileName) {
11
- uiLine();
11
+ logUiLine();
12
12
  uiLogger.log(lib.projectProfiles.logs.usingProfile(getHsProfileFilename(profileName)));
13
13
  uiLogger.log('');
14
14
  }
@@ -21,7 +21,7 @@ export function logProfileFooter(profile, includeVariables = false) {
21
21
  uiLogger.log(` ${key}: ${value}`);
22
22
  });
23
23
  }
24
- uiLine();
24
+ logUiLine();
25
25
  uiLogger.log('');
26
26
  }
27
27
  export function loadProfile(projectConfig, projectDir, profileName) {
@@ -1,13 +1,13 @@
1
1
  import { uiLogger } from '../ui/logger.js';
2
2
  import { FEEDBACK_INTERVAL } from '../constants.js';
3
- import { uiLine } from '../ui/index.js';
3
+ import { logUiLine } from '../ui/index.js';
4
4
  import { lib } from '../../lang/en.js';
5
5
  import { confirmPrompt } from '../prompts/promptUtils.js';
6
6
  export function logFeedbackMessage(buildId) {
7
7
  if (buildId > 0 && buildId % FEEDBACK_INTERVAL === 0) {
8
- uiLine();
8
+ logUiLine();
9
9
  uiLogger.log(lib.projects.logFeedbackMessage.feedbackHeader);
10
- uiLine();
10
+ logUiLine();
11
11
  uiLogger.log(lib.projects.logFeedbackMessage.feedbackMessage);
12
12
  }
13
13
  }
@@ -8,6 +8,7 @@ type ProjectUploadResult<T> = {
8
8
  projectNotFound?: boolean;
9
9
  projectId?: number;
10
10
  userDeclined?: boolean;
11
+ skippedHsMetaFiles?: string[];
11
12
  };
12
13
  type HandleProjectUploadArg<T> = {
13
14
  accountId: number;
@@ -23,8 +24,9 @@ type HandleProjectUploadArg<T> = {
23
24
  skipAutoDeploy?: boolean;
24
25
  profile?: string;
25
26
  force?: boolean;
27
+ formatOutputAsJson?: boolean;
26
28
  };
27
- export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, skipNpmAudit, skipAutoDeploy, force, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
29
+ export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, skipNpmAudit, skipAutoDeploy, force, formatOutputAsJson, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
28
30
  export type SourceDirectoryWarning = {
29
31
  message: string;
30
32
  file: string;
@@ -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,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 {};