@hubspot/cli 8.15.0 → 8.16.0-beta.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 (141) hide show
  1. package/api/releases.d.ts +4 -1
  2. package/bin/cli.js +2 -0
  3. package/commands/account/auth.d.ts +3 -2
  4. package/commands/account/auth.js +21 -10
  5. package/commands/app/migrate.js +3 -3
  6. package/commands/project/add.d.ts +3 -2
  7. package/commands/project/add.js +10 -8
  8. package/commands/project/appInstallStatus.d.ts +2 -2
  9. package/commands/project/appInstallStatus.js +2 -2
  10. package/commands/project/create.d.ts +4 -2
  11. package/commands/project/create.js +16 -4
  12. package/commands/project/deploy.d.ts +2 -2
  13. package/commands/project/deploy.js +2 -2
  14. package/commands/project/download.d.ts +2 -2
  15. package/commands/project/download.js +2 -2
  16. package/commands/project/info.d.ts +1 -1
  17. package/commands/project/info.js +1 -1
  18. package/commands/project/installApp.d.ts +2 -2
  19. package/commands/project/installApp.js +2 -2
  20. package/commands/project/listBuilds.d.ts +2 -2
  21. package/commands/project/listBuilds.js +2 -2
  22. package/commands/project/migrate.js +4 -4
  23. package/commands/project/release/create.d.ts +2 -2
  24. package/commands/project/release/create.js +7 -3
  25. package/commands/project/release/info.d.ts +2 -2
  26. package/commands/project/release/info.js +2 -2
  27. package/commands/project/release/list.d.ts +2 -2
  28. package/commands/project/release/list.js +2 -2
  29. package/commands/project/release/preview.d.ts +9 -0
  30. package/commands/project/release/preview.js +167 -0
  31. package/commands/project/release.js +7 -1
  32. package/commands/project/upload.d.ts +2 -2
  33. package/commands/project/upload.js +2 -2
  34. package/commands/project/validate.d.ts +2 -2
  35. package/commands/project/validate.js +2 -2
  36. package/commands/testAccount/create.d.ts +2 -2
  37. package/commands/testAccount/create.js +2 -2
  38. package/lang/en.d.ts +27 -0
  39. package/lang/en.js +32 -4
  40. package/lib/accountAuth.d.ts +1 -0
  41. package/lib/accountAuth.js +8 -0
  42. package/lib/app/urls.d.ts +0 -1
  43. package/lib/app/urls.js +0 -4
  44. package/lib/constants.d.ts +6 -0
  45. package/lib/constants.js +11 -0
  46. package/lib/jsonOutput/accountAuth.d.ts +7 -0
  47. package/lib/jsonOutput/accountAuth.js +6 -0
  48. package/lib/jsonOutput/projectAdd.d.ts +9 -0
  49. package/lib/jsonOutput/projectAdd.js +10 -0
  50. package/lib/jsonOutput/{appInstallStatus.d.ts → projectAppInstallStatus.d.ts} +2 -2
  51. package/lib/jsonOutput/{appInstallStatus.js → projectAppInstallStatus.js} +1 -1
  52. package/lib/jsonOutput/projectCreate.d.ts +8 -0
  53. package/lib/jsonOutput/projectCreate.js +7 -0
  54. package/lib/jsonOutput/projectDeploy.d.ts +5 -0
  55. package/lib/jsonOutput/{deploy.js → projectDeploy.js} +1 -1
  56. package/lib/jsonOutput/projectDownload.d.ts +7 -0
  57. package/lib/jsonOutput/{download.js → projectDownload.js} +1 -1
  58. package/lib/jsonOutput/{installApp.d.ts → projectInstallApp.d.ts} +2 -2
  59. package/lib/jsonOutput/{installApp.js → projectInstallApp.js} +1 -1
  60. package/lib/jsonOutput/{listBuilds.d.ts → projectListBuilds.d.ts} +2 -2
  61. package/lib/jsonOutput/{listBuilds.js → projectListBuilds.js} +1 -1
  62. package/lib/jsonOutput/{release.d.ts → projectRelease.d.ts} +15 -8
  63. package/lib/jsonOutput/{release.js → projectRelease.js} +11 -4
  64. package/lib/jsonOutput/{upload.d.ts → projectUpload.d.ts} +2 -2
  65. package/lib/jsonOutput/{upload.js → projectUpload.js} +1 -1
  66. package/lib/jsonOutput/{validate.d.ts → projectValidate.d.ts} +2 -2
  67. package/lib/jsonOutput/{validate.js → projectValidate.js} +1 -1
  68. package/lib/jsonOutput/{createTestAccount.d.ts → testAccountCreate.d.ts} +2 -2
  69. package/lib/jsonOutput/{createTestAccount.js → testAccountCreate.js} +1 -1
  70. package/lib/middleware/deprecationWarningMiddleware.d.ts +1 -0
  71. package/lib/middleware/deprecationWarningMiddleware.js +57 -0
  72. package/lib/projects/add/legacyAddComponent.d.ts +2 -1
  73. package/lib/projects/add/legacyAddComponent.js +3 -0
  74. package/lib/projects/add/v2AddComponent.d.ts +2 -1
  75. package/lib/projects/add/v2AddComponent.js +7 -1
  76. package/lib/projects/localDev/LocalDevWatcher.js +1 -1
  77. package/lib/projects/release.d.ts +2 -2
  78. package/lib/projects/validate.d.ts +1 -1
  79. package/lib/prompts/projectProfilePrompt.d.ts +7 -0
  80. package/lib/prompts/projectProfilePrompt.js +1 -1
  81. package/lib/testUtils.d.ts +5 -0
  82. package/lib/testUtils.js +24 -0
  83. package/lib/ui/index.js +11 -1
  84. package/lib/ui/uiMessages.d.ts +1 -0
  85. package/lib/ui/uiMessages.js +1 -0
  86. package/mcp-server/Tool.d.ts +6 -1
  87. package/mcp-server/Tool.js +6 -4
  88. package/mcp-server/server.js +26 -4
  89. package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
  90. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +1 -1
  91. package/mcp-server/tools/cms/HsFunctionLogsTool.js +59 -5
  92. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  93. package/mcp-server/tools/index.js +2 -0
  94. package/mcp-server/tools/project/AddFeatureToProjectTool.js +31 -31
  95. package/mcp-server/tools/project/AuthAccountTool.d.ts +1 -0
  96. package/mcp-server/tools/project/AuthAccountTool.js +36 -5
  97. package/mcp-server/tools/project/CreateProjectTool.js +13 -3
  98. package/mcp-server/tools/project/CreateTestAccountTool.js +13 -13
  99. package/mcp-server/tools/project/DeployProjectTool.d.ts +2 -2
  100. package/mcp-server/tools/project/DeployProjectTool.js +34 -16
  101. package/mcp-server/tools/project/DocFetchTool.js +1 -1
  102. package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
  103. package/mcp-server/tools/project/DocsSearchTool.js +18 -9
  104. package/mcp-server/tools/project/FindProjectsTool.js +12 -0
  105. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +3 -2
  106. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +38 -10
  107. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +2 -1
  108. package/mcp-server/tools/project/GetApplicationInfoTool.js +13 -14
  109. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +2 -1
  110. package/mcp-server/tools/project/GetBuildLogsTool.js +12 -9
  111. package/mcp-server/tools/project/GetBuildStatusTool.d.ts +2 -1
  112. package/mcp-server/tools/project/GetBuildStatusTool.js +12 -9
  113. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +2 -1
  114. package/mcp-server/tools/project/GetConfigValuesTool.js +11 -8
  115. package/mcp-server/tools/project/KnowledgeSearchTool.d.ts +29 -0
  116. package/mcp-server/tools/project/KnowledgeSearchTool.js +82 -0
  117. package/mcp-server/tools/project/UploadProjectTools.d.ts +2 -2
  118. package/mcp-server/tools/project/UploadProjectTools.js +52 -39
  119. package/mcp-server/tools/project/ValidateProjectTool.js +23 -7
  120. package/mcp-server/tools/project/apps.d.ts +8 -0
  121. package/mcp-server/tools/project/apps.js +7 -0
  122. package/mcp-server/tools/project/constants.d.ts +3 -0
  123. package/mcp-server/tools/project/constants.js +11 -1
  124. package/mcp-server/tools/project/productionConfirmation.d.ts +12 -0
  125. package/mcp-server/tools/project/productionConfirmation.js +45 -0
  126. package/mcp-server/tools/project/resolveAccount.d.ts +15 -0
  127. package/mcp-server/tools/project/resolveAccount.js +60 -0
  128. package/mcp-server/utils/command.d.ts +1 -0
  129. package/mcp-server/utils/command.js +8 -0
  130. package/mcp-server/utils/content.d.ts +1 -0
  131. package/mcp-server/utils/content.js +5 -0
  132. package/mcp-server/utils/elicitSelection.d.ts +11 -0
  133. package/mcp-server/utils/elicitSelection.js +25 -0
  134. package/mcp-server/utils/elicitation.d.ts +11 -0
  135. package/mcp-server/utils/elicitation.js +38 -0
  136. package/package.json +23 -22
  137. package/ui/components/Table.d.ts +8 -8
  138. package/lib/jsonOutput/deploy.d.ts +0 -5
  139. package/lib/jsonOutput/download.d.ts +0 -7
  140. /package/lib/jsonOutput/{info.d.ts → projectInfo.d.ts} +0 -0
  141. /package/lib/jsonOutput/{info.js → projectInfo.js} +0 -0
@@ -35,7 +35,7 @@ export declare const BuildSchema: z.ZodObject<{
35
35
  visible: z.ZodOptional<z.ZodBoolean>;
36
36
  }, z.core.$strip>>;
37
37
  }, z.core.$strip>;
38
- export declare const ProjectBuildsListSchema: z.ZodObject<{
38
+ export declare const ProjectListBuildsSchema: z.ZodObject<{
39
39
  projectName: z.ZodString;
40
40
  deployedBuildId: z.ZodOptional<z.ZodNumber>;
41
41
  results: z.ZodArray<z.ZodObject<{
@@ -70,6 +70,6 @@ export declare const ProjectBuildsListSchema: z.ZodObject<{
70
70
  }, z.core.$strip>;
71
71
  export type BuildSubbuildStatusJsonOutput = z.infer<typeof BuildSubbuildStatusSchema>;
72
72
  export type BuildJsonOutput = z.infer<typeof BuildSchema>;
73
- export type ProjectBuildsListJsonOutput = z.infer<typeof ProjectBuildsListSchema>;
73
+ export type ProjectListBuildsJsonOutput = z.infer<typeof ProjectListBuildsSchema>;
74
74
  export declare function mapBuildToJsonOutput(build: Build, deployedBuildId?: number): BuildJsonOutput;
75
75
  export {};
@@ -24,7 +24,7 @@ export const BuildSchema = z.object({
24
24
  createdAt: z.string().optional(),
25
25
  subbuildStatuses: z.array(BuildSubbuildStatusSchema),
26
26
  });
27
- export const ProjectBuildsListSchema = z.object({
27
+ export const ProjectListBuildsSchema = z.object({
28
28
  projectName: z.string(),
29
29
  deployedBuildId: z.number().optional(),
30
30
  results: z.array(BuildSchema),
@@ -1,13 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { Release } from '../../api/releases.js';
2
+ import { CreatedRelease } from '../../api/releases.js';
3
3
  declare const ReleaseComponentSchema: z.ZodObject<{
4
4
  buildType: z.ZodString;
5
5
  buildName: z.ZodOptional<z.ZodString>;
6
6
  rootPath: z.ZodOptional<z.ZodString>;
7
7
  id: z.ZodOptional<z.ZodString>;
8
8
  }, z.core.$strip>;
9
- export declare const ReleaseSchema: z.ZodObject<{
10
- releaseTag: z.ZodString;
9
+ export declare const ProjectReleaseSchema: z.ZodObject<{
10
+ releaseTag: z.ZodOptional<z.ZodString>;
11
11
  buildId: z.ZodNumber;
12
12
  createdAt: z.ZodString;
13
13
  components: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -17,9 +17,15 @@ export declare const ReleaseSchema: z.ZodObject<{
17
17
  id: z.ZodOptional<z.ZodString>;
18
18
  }, z.core.$strip>>>;
19
19
  }, z.core.$strip>;
20
- export declare const ReleaseListSchema: z.ZodObject<{
20
+ export declare const ProjectReleasePreviewSchema: z.ZodObject<{
21
+ buildId: z.ZodNumber;
22
+ targetPortalId: z.ZodNumber;
23
+ releaseTag: z.ZodOptional<z.ZodString>;
24
+ succeeded: z.ZodBoolean;
25
+ }, z.core.$strip>;
26
+ export declare const ProjectReleaseListSchema: z.ZodObject<{
21
27
  results: z.ZodArray<z.ZodObject<{
22
- releaseTag: z.ZodString;
28
+ releaseTag: z.ZodOptional<z.ZodString>;
23
29
  buildId: z.ZodNumber;
24
30
  createdAt: z.ZodString;
25
31
  components: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -36,7 +42,8 @@ export declare const ReleaseListSchema: z.ZodObject<{
36
42
  }, z.core.$strip>>;
37
43
  }, z.core.$strip>;
38
44
  export type ReleaseComponentJsonOutput = z.infer<typeof ReleaseComponentSchema>;
39
- export type ReleaseJsonOutput = z.infer<typeof ReleaseSchema>;
40
- export type ReleaseListJsonOutput = z.infer<typeof ReleaseListSchema>;
41
- export declare function mapReleaseToJsonOutput(release: Release): ReleaseJsonOutput;
45
+ export type ProjectReleaseJsonOutput = z.infer<typeof ProjectReleaseSchema>;
46
+ export type ProjectReleaseListJsonOutput = z.infer<typeof ProjectReleaseListSchema>;
47
+ export type ProjectReleasePreviewJsonOutput = z.infer<typeof ProjectReleasePreviewSchema>;
48
+ export declare function mapReleaseToJsonOutput(release: CreatedRelease): ProjectReleaseJsonOutput;
42
49
  export {};
@@ -5,14 +5,21 @@ const ReleaseComponentSchema = z.object({
5
5
  rootPath: z.string().optional(),
6
6
  id: z.string().optional(),
7
7
  });
8
- export const ReleaseSchema = z.object({
9
- releaseTag: z.string(),
8
+ export const ProjectReleaseSchema = z.object({
9
+ // Optional: a global-only (standalone) build deploys tag-free, see CreatedRelease.
10
+ releaseTag: z.string().optional(),
10
11
  buildId: z.number(),
11
12
  createdAt: z.string(),
12
13
  components: z.array(ReleaseComponentSchema).optional(),
13
14
  });
14
- export const ReleaseListSchema = z.object({
15
- results: z.array(ReleaseSchema),
15
+ export const ProjectReleasePreviewSchema = z.object({
16
+ buildId: z.number(),
17
+ targetPortalId: z.number(),
18
+ releaseTag: z.string().optional(),
19
+ succeeded: z.boolean(),
20
+ });
21
+ export const ProjectReleaseListSchema = z.object({
22
+ results: z.array(ProjectReleaseSchema),
16
23
  paging: z
17
24
  .object({
18
25
  next: z.object({
@@ -9,7 +9,7 @@ declare const TargetAccountSchema: z.ZodObject<{
9
9
  accountName: z.ZodOptional<z.ZodString>;
10
10
  accountType: z.ZodOptional<z.ZodString>;
11
11
  }, z.core.$strip>;
12
- export declare const UploadSchema: z.ZodObject<{
12
+ export declare const ProjectUploadSchema: z.ZodObject<{
13
13
  targetAccount: z.ZodOptional<z.ZodObject<{
14
14
  accountId: z.ZodNumber;
15
15
  accountName: z.ZodOptional<z.ZodString>;
@@ -24,6 +24,6 @@ export declare const UploadSchema: z.ZodObject<{
24
24
  }, z.core.$strip>;
25
25
  export type PreviewJsonOutput = z.infer<typeof PreviewSchema>;
26
26
  export type TargetAccountJsonOutput = z.infer<typeof TargetAccountSchema>;
27
- export type UploadJsonOutput = z.infer<typeof UploadSchema>;
27
+ export type ProjectUploadJsonOutput = z.infer<typeof ProjectUploadSchema>;
28
28
  export declare function mapAccountToTargetAccount(accountId: number, account?: HubSpotConfigAccount | null): TargetAccountJsonOutput;
29
29
  export {};
@@ -8,7 +8,7 @@ const TargetAccountSchema = z.object({
8
8
  accountName: z.string().optional(),
9
9
  accountType: z.string().optional(),
10
10
  });
11
- export const UploadSchema = z.object({
11
+ export const ProjectUploadSchema = z.object({
12
12
  targetAccount: TargetAccountSchema.optional(),
13
13
  buildId: z.number().optional(),
14
14
  deployId: z.number().optional(),
@@ -9,7 +9,7 @@ declare const ProfileValidationSchema: z.ZodObject<{
9
9
  accountId: z.ZodOptional<z.ZodNumber>;
10
10
  valid: z.ZodBoolean;
11
11
  }, z.core.$strip>;
12
- export declare const ValidateSchema: z.ZodObject<{
12
+ export declare const ProjectValidateSchema: z.ZodObject<{
13
13
  valid: z.ZodBoolean;
14
14
  projectName: z.ZodOptional<z.ZodString>;
15
15
  platformVersion: z.ZodOptional<z.ZodString>;
@@ -32,5 +32,5 @@ export declare const ValidateSchema: z.ZodObject<{
32
32
  }, z.core.$strip>;
33
33
  export type ValidationIssueJsonOutput = z.infer<typeof ValidationIssueSchema>;
34
34
  export type ProfileValidationJsonOutput = z.infer<typeof ProfileValidationSchema>;
35
- export type ValidateJsonOutput = z.infer<typeof ValidateSchema>;
35
+ export type ProjectValidateJsonOutput = z.infer<typeof ProjectValidateSchema>;
36
36
  export {};
@@ -9,7 +9,7 @@ const ProfileValidationSchema = z.object({
9
9
  accountId: z.number().optional(),
10
10
  valid: z.boolean(),
11
11
  });
12
- export const ValidateSchema = z.object({
12
+ export const ProjectValidateSchema = z.object({
13
13
  valid: z.boolean(),
14
14
  projectName: z.string().optional(),
15
15
  platformVersion: z.string().optional(),
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- export declare const CreateTestAccountSchema: z.ZodObject<{
2
+ export declare const TestAccountCreateSchema: z.ZodObject<{
3
3
  accountName: z.ZodOptional<z.ZodString>;
4
4
  accountId: z.ZodOptional<z.ZodNumber>;
5
5
  personalAccessKey: z.ZodOptional<z.ZodString>;
6
6
  }, z.core.$strip>;
7
- export type CreateTestAccountJsonOutput = z.infer<typeof CreateTestAccountSchema>;
7
+ export type TestAccountCreateJsonOutput = z.infer<typeof TestAccountCreateSchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export const CreateTestAccountSchema = z.object({
2
+ export const TestAccountCreateSchema = z.object({
3
3
  accountName: z.string().optional(),
4
4
  accountId: z.number().optional(),
5
5
  personalAccessKey: z.string().optional(),
@@ -0,0 +1 @@
1
+ export declare function checkDeprecationWarning(): Promise<void>;
@@ -0,0 +1,57 @@
1
+ import semver from 'semver';
2
+ import moment from 'moment';
3
+ import { getStateValue, setStateValue, } from '@hubspot/local-dev-lib/config/state';
4
+ import { STATE_FLAGS } from '@hubspot/local-dev-lib/constants/config';
5
+ import { pkg } from '../jsonLoader.js';
6
+ import { lib } from '../../lang/en.js';
7
+ import { debugError } from '../errorHandlers/index.js';
8
+ import { renderInline } from '../../ui/render.js';
9
+ import { getWarningBox, getAlertBox, } from '../../ui/components/StatusMessageBoxes.js';
10
+ import { CLI_DEPRECATED_MAJOR_VERSION, CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE, CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE, ONE_DAY_IN_MILLISECONDS, } from '../constants.js';
11
+ const LAST_SHOWN_STATE_FLAGS = {
12
+ deprecated: STATE_FLAGS.CLI_VERSION_DEPRECATION_WARNING_LAST_SHOWN_AT,
13
+ endOfLife: STATE_FLAGS.CLI_VERSION_END_OF_LIFE_WARNING_LAST_SHOWN_AT,
14
+ };
15
+ function getDeprecationStatusForCurrentMajorVersion() {
16
+ if (semver.major(pkg.version) !== CLI_DEPRECATED_MAJOR_VERSION) {
17
+ return null;
18
+ }
19
+ const now = moment();
20
+ if (now.isSameOrAfter(moment(CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE))) {
21
+ return 'endOfLife';
22
+ }
23
+ if (now.isSameOrAfter(moment(CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE))) {
24
+ return 'deprecated';
25
+ }
26
+ return null;
27
+ }
28
+ function hasShownWarningToday(status) {
29
+ const lastShown = getStateValue(LAST_SHOWN_STATE_FLAGS[status]);
30
+ const lastShownTime = typeof lastShown === 'string' ? Date.parse(lastShown) : NaN;
31
+ return (!Number.isNaN(lastShownTime) &&
32
+ Date.now() - lastShownTime < ONE_DAY_IN_MILLISECONDS);
33
+ }
34
+ async function logDeprecationStatusWarning(status) {
35
+ const eolDate = moment(CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE).format('MMMM D, YYYY');
36
+ const getBox = status === 'endOfLife' ? getAlertBox : getWarningBox;
37
+ const title = status === 'endOfLife'
38
+ ? lib.middleware.deprecationWarning.endOfLifeTitle
39
+ : lib.middleware.deprecationWarning.deprecatedTitle;
40
+ const message = status === 'endOfLife'
41
+ ? lib.middleware.deprecationWarning.endOfLifeMessage(pkg.version, eolDate)
42
+ : lib.middleware.deprecationWarning.deprecatedMessage(pkg.version, eolDate);
43
+ await renderInline(getBox({ title, message }));
44
+ setStateValue(LAST_SHOWN_STATE_FLAGS[status], new Date().toISOString());
45
+ }
46
+ export async function checkDeprecationWarning() {
47
+ try {
48
+ const status = getDeprecationStatusForCurrentMajorVersion();
49
+ if (!status || hasShownWarningToday(status)) {
50
+ return;
51
+ }
52
+ await logDeprecationStatusWarning(status);
53
+ }
54
+ catch (error) {
55
+ debugError(error);
56
+ }
57
+ }
@@ -1,5 +1,6 @@
1
1
  import { ProjectConfig } from '../../../types/Projects.js';
2
+ import { ProjectAddJsonOutput } from '../../jsonOutput/projectAdd.js';
2
3
  export declare function legacyAddComponent(args: {
3
4
  name?: string;
4
5
  type?: string;
5
- }, projectDir: string, projectConfig: ProjectConfig, derivedAccountId: number): Promise<void>;
6
+ }, projectDir: string, projectConfig: ProjectConfig, derivedAccountId: number): Promise<ProjectAddJsonOutput>;
@@ -39,6 +39,9 @@ export async function legacyAddComponent(args, projectDir, projectConfig, derive
39
39
  hideLogs: true,
40
40
  });
41
41
  uiLogger.success(commands.project.add.success(projectConfig.name));
42
+ return {
43
+ addedFeatures: [projectAddPromptResponse.componentTemplate.type],
44
+ };
42
45
  }
43
46
  catch (error) {
44
47
  throw new Error(commands.project.add.error.failedToDownloadComponent);
@@ -1,4 +1,5 @@
1
1
  import { ProjectConfig } from '../../../types/Projects.js';
2
+ import { ProjectAddJsonOutput } from '../../jsonOutput/projectAdd.js';
2
3
  export declare function v2AddComponent(args: {
3
4
  name?: string;
4
5
  type?: string;
@@ -6,4 +7,4 @@ export declare function v2AddComponent(args: {
6
7
  auth?: string;
7
8
  distribution?: string;
8
9
  derivedAccountId: number;
9
- }, projectDir: string, projectConfig: ProjectConfig, accountId: number): Promise<void>;
10
+ }, projectDir: string, projectConfig: ProjectConfig, accountId: number): Promise<ProjectAddJsonOutput>;
@@ -71,7 +71,7 @@ export async function v2AddComponent(args, projectDir, projectConfig, accountId)
71
71
  }
72
72
  if (components.length === 0) {
73
73
  uiLogger.log(lib.projects.add.nothingAdded);
74
- return;
74
+ return { addedFeatures: [] };
75
75
  }
76
76
  await cloneGithubRepo(HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, projectDir, {
77
77
  sourceDir: components,
@@ -98,6 +98,12 @@ export async function v2AddComponent(args, projectDir, projectConfig, accountId)
98
98
  updatedProjectMetadata,
99
99
  showSuccessMessage: true,
100
100
  });
101
+ return {
102
+ addedFeatures: componentTypes ?? [],
103
+ app: shouldCreateApp && derivedDistribution && derivedAuthType
104
+ ? { distribution: derivedDistribution, auth: derivedAuthType }
105
+ : undefined,
106
+ };
101
107
  }
102
108
  catch (error) {
103
109
  SpinniesManager.fail('project-add', {
@@ -23,7 +23,7 @@ class LocalDevWatcher {
23
23
  start() {
24
24
  this.watcher = chokidar.watch(this.localDevProcess.projectDir, {
25
25
  ignoreInitial: true,
26
- ignored: ['**/dist'],
26
+ ignored: ['**/dist', '**/node_modules'],
27
27
  });
28
28
  const configPaths = Object.values(this.localDevProcess.projectNodes).map(component => component.localDev.componentConfigPath);
29
29
  const projectConfigPath = path.join(this.localDevProcess.projectDir, PROJECT_CONFIG_FILE);
@@ -1,4 +1,4 @@
1
- import { type Release } from '../../api/releases.js';
1
+ import { type CreatedRelease } from '../../api/releases.js';
2
2
  export declare function resolveBuildId(accountId: number, projectName: string, buildOption?: number, force?: boolean): Promise<number | null | undefined>;
3
3
  export declare function validateBuildForRelease(accountId: number, projectName: string, buildId: number): Promise<boolean>;
4
- export declare function executeRelease(accountId: number, projectName: string, buildId: number): Promise<Release>;
4
+ export declare function executeRelease(accountId: number, projectName: string, buildId: number): Promise<CreatedRelease>;
@@ -1,5 +1,5 @@
1
1
  import { ProjectConfig } from '../../types/Projects.js';
2
- import { ProfileValidationJsonOutput, ValidationIssueJsonOutput } from '../jsonOutput/validate.js';
2
+ import { ProfileValidationJsonOutput, ValidationIssueJsonOutput } from '../jsonOutput/projectValidate.js';
3
3
  export type ProjectValidationResult = {
4
4
  valid: boolean;
5
5
  errors: ValidationIssueJsonOutput[];
@@ -1,2 +1,9 @@
1
1
  import { ProjectConfig } from '../../types/Projects.js';
2
+ type ProfilePromptOption = {
3
+ name: string;
4
+ value: string;
5
+ disabled?: boolean;
6
+ };
7
+ export declare function generateProfilePromptOption(projectDir: string, projectConfig: ProjectConfig, profileName: string): ProfilePromptOption;
2
8
  export declare function projectProfilePrompt(projectDir: string, projectConfig: ProjectConfig, profileName?: string, exitIfMissing?: boolean): Promise<string | null>;
9
+ export {};
@@ -3,7 +3,7 @@ import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
3
3
  import { listPrompt } from './promptUtils.js';
4
4
  import { loadProfile } from '../projects/projectProfiles.js';
5
5
  import { lib } from '../../lang/en.js';
6
- function generateProfilePromptOption(projectDir, projectConfig, profileName) {
6
+ export function generateProfilePromptOption(projectDir, projectConfig, profileName) {
7
7
  const choice = {
8
8
  name: profileName,
9
9
  value: profileName,
@@ -1,5 +1,7 @@
1
1
  import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
2
2
  import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
3
+ import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
4
+ import { AccountTargetCandidate } from '../types/AccountTargets.js';
3
5
  type MockErrorResponse = {
4
6
  status: number;
5
7
  data: {
@@ -12,4 +14,7 @@ type MockErrorResponse = {
12
14
  export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
13
15
  export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
14
16
  export declare function stubColorEnv(): void;
17
+ export declare const MOCK_SANDBOX_TARGET: AccountTargetCandidate;
18
+ export declare const MOCK_PRODUCTION_TARGET: AccountTargetCandidate;
19
+ export declare function getMockConfigAccount(identifier: number | string): HubSpotConfigAccount | undefined;
15
20
  export {};
package/lib/testUtils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { vi } from 'vitest';
2
2
  import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
3
+ import { ACCOUNT_TARGET_CATEGORIES, ACCOUNT_TARGET_SELECTION_SOURCES, } from '../types/AccountTargets.js';
3
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
5
  export function mockHubSpotHttpResponse(data) {
5
6
  return Promise.resolve({
@@ -30,3 +31,26 @@ export function stubColorEnv() {
30
31
  ].forEach(key => vi.stubEnv(key, undefined));
31
32
  vi.stubEnv('TERM', 'xterm-256color');
32
33
  }
34
+ export const MOCK_SANDBOX_TARGET = {
35
+ accountId: 222,
36
+ accountName: 'Sandbox',
37
+ source: ACCOUNT_TARGET_SELECTION_SOURCES.GLOBAL_DEFAULT,
38
+ category: ACCOUNT_TARGET_CATEGORIES.RECOMMENDED_TESTING,
39
+ };
40
+ export const MOCK_PRODUCTION_TARGET = {
41
+ accountId: 111,
42
+ accountName: 'Prod Portal',
43
+ source: ACCOUNT_TARGET_SELECTION_SOURCES.GLOBAL_DEFAULT,
44
+ category: ACCOUNT_TARGET_CATEGORIES.PRODUCTION_WITH_CARE,
45
+ };
46
+ // A getConfigAccountIfExists stand-in that knows only MOCK_PRODUCTION_TARGET.
47
+ export function getMockConfigAccount(identifier) {
48
+ if (identifier !== MOCK_PRODUCTION_TARGET.accountId) {
49
+ return undefined;
50
+ }
51
+ return {
52
+ accountId: MOCK_PRODUCTION_TARGET.accountId,
53
+ name: MOCK_PRODUCTION_TARGET.accountName,
54
+ accountType: 'STANDARD',
55
+ };
56
+ }
package/lib/ui/index.js CHANGED
@@ -130,8 +130,18 @@ export function uiDeprecatedDescription(message, command, url) {
130
130
  const tag = message || uiMessages.disabledMessage(command, url);
131
131
  return uiDeprecatedTag(tag);
132
132
  }
133
+ // export function uiCommandRenamedDescription(
134
+ // describe: string | false | undefined,
135
+ // newCommand: string
136
+ // ): string | undefined {
137
+ // return uiDeprecatedTag(
138
+ // `${describe} ${uiMessages.commandRenamedMessage(newCommand)}`,
139
+ // false
140
+ // );
141
+ // }
142
+ // Replace this with the above code once we've upgraded to yargs 18.0.0
133
143
  export function uiCommandRenamedDescription(describe, newCommand) {
134
- return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedMessage(newCommand)}`, false);
144
+ return uiDeprecatedTag(`${describe} ${uiMessages.commandRenamedPlainMessage(newCommand)}`, false);
135
145
  }
136
146
  export function uiDeprecatedMessage(command, url, message) {
137
147
  const tag = uiMessages.deprecatedDescription(message || '', command, url);
@@ -5,6 +5,7 @@ export declare const uiMessages: {
5
5
  disabledMessage: (command: string, url?: string) => string;
6
6
  disabledUrlText: string;
7
7
  commandRenamedMessage: (newCommand: string) => string;
8
+ commandRenamedPlainMessage: (newCommand: string) => string;
8
9
  featureHighlight: {
9
10
  defaultTitle: string;
10
11
  featureKeys: {
@@ -8,6 +8,7 @@ export const uiMessages = {
8
8
  disabledMessage: (command, url) => `The ${uiCommandReference(command)} command is disabled. Run ${uiCommandReference('npm i -g @hubspot/cli@latest')} to update to the latest HubSpot CLI version. ${url ? uiLink('Learn more', url) : ''}`,
9
9
  disabledUrlText: 'See all HubSpot CLI commands here.',
10
10
  commandRenamedMessage: (newCommand) => `This command has been deprecated. Please use ${uiCommandReference(newCommand)} instead.`,
11
+ commandRenamedPlainMessage: (newCommand) => `This command has been deprecated. Please use \`${newCommand}\` instead.`,
11
12
  featureHighlight: {
12
13
  defaultTitle: "What's next?",
13
14
  featureKeys: {
@@ -1,6 +1,6 @@
1
1
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
- import { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
3
+ import { ElicitResult, PrimitiveSchemaDefinition, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { McpLogger } from './utils/logger.js';
5
5
  import { McpToolResponse } from './types.js';
6
6
  import { CommandResults, Command } from './utils/command.js';
@@ -16,5 +16,10 @@ export declare class Tool<InputSchema> {
16
16
  protected getTrackingMeta(_input: InputSchema): {
17
17
  [key: string]: string;
18
18
  } | undefined;
19
+ protected elicit(params: {
20
+ message: string;
21
+ fields: Record<string, PrimitiveSchemaDefinition>;
22
+ required?: string[];
23
+ }): Promise<ElicitResult | undefined>;
19
24
  protected wrappedHandler(input: InputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
20
25
  }
@@ -1,7 +1,8 @@
1
- import { formatTextContents } from './utils/content.js';
1
+ import { formatErrorTextContents } from './utils/content.js';
2
2
  import { getErrorMessage } from '../lib/errorHandlers/index.js';
3
3
  import { trackToolUsage } from './utils/toolUsageTracking.js';
4
4
  import { runCommandInDir } from './utils/command.js';
5
+ import { requestElicitation } from './utils/elicitation.js';
5
6
  export class Tool {
6
7
  mcpServer;
7
8
  logger;
@@ -44,6 +45,9 @@ export class Tool {
44
45
  getTrackingMeta(_input) {
45
46
  return undefined;
46
47
  }
48
+ elicit(params) {
49
+ return requestElicitation(this.mcpServer, params, this.logger);
50
+ }
47
51
  wrappedHandler(input, extra) {
48
52
  return this.logger.runWithBuffer(async () => {
49
53
  const startTime = Date.now();
@@ -69,9 +73,7 @@ export class Tool {
69
73
  error: error instanceof Error ? error.message : String(error),
70
74
  durationMs: Date.now() - startTime,
71
75
  });
72
- const errorResponse = await formatTextContents(getErrorMessage(error));
73
- errorResponse.isError = true;
74
- return errorResponse;
76
+ return formatErrorTextContents(getErrorMessage(error));
75
77
  }
76
78
  finally {
77
79
  this.logger.flushLogsToFile(this.toolName);
@@ -15,15 +15,27 @@ WHEN TO USE THIS SERVER
15
15
  functions, project builds, deploys, or developer test accounts.
16
16
  - The user asks a HubSpot platform/API question — answer it from the docs
17
17
  via \`search-docs\` + \`fetch-doc\` rather than from prior knowledge.
18
+ - The user asks how to use HubSpot products or features, or about account
19
+ and subscription settings — answer it via \`search-knowledge-base\`
20
+ rather than from prior knowledge.
21
+ - The user asks whether an API or feature is available on a subscription
22
+ tier (for example Starter, Professional, or Enterprise) — answer it via
23
+ \`search-docs\` then \`fetch-doc\`, not the knowledge base. The doc lists
24
+ any required product and tier in a "Supported products" section.
18
25
 
19
26
  REQUIRED WORKFLOWS
20
27
  1. Authentication: call \`auth-account\` when the user wants to connect a
21
28
  HubSpot account, when any tool reports "No account ID found", or when
22
29
  there are no authenticated accounts. The tool opens a browser tab for
23
30
  the user to authorize — no Personal Access Key is required up front.
24
- 2. Documentation lookup: always call \`search-docs\` first, then
25
- \`fetch-doc\` on the most relevant result(s) before planning, writing
26
- code, or answering platform/API questions. Do not answer from memory.
31
+ 2. Documentation lookup: for developer APIs, SDKs, and platform reference,
32
+ call \`search-docs\` first, then \`fetch-doc\` on the most relevant
33
+ result(s). For HubSpot product, feature, or account and subscription
34
+ how-to questions, call \`search-knowledge-base\`. Whether a feature or
35
+ API is available on a subscription tier is a developer-docs question:
36
+ use \`search-docs\` then \`fetch-doc\`, not \`search-knowledge-base\`.
37
+ Answer from these tools before planning, writing code, or answering. Do
38
+ not answer from memory.
27
39
  3. Locating a HubSpot project: when the current working directory is not
28
40
  a HubSpot project (no \`hsproject.json\`) or you need to determine
29
41
  whether a directory contains one, call \`find-projects\` before
@@ -36,7 +48,17 @@ REQUIRED WORKFLOWS
36
48
  6. Reading serverless function logs: call \`list-cms-serverless-functions\`
37
49
  first to discover the endpoint path, then
38
50
  \`get-cms-serverless-function-logs\`.
39
- 7. App analytics: call \`get-apps-info\` to discover \`appId\` values
51
+ 7. Serverless functions come in two distinct kinds. CMS serverless
52
+ 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
+ \`get-cms-serverless-function-logs\`. App functions are serverless
56
+ functions built inside a developer-platform app, either private
57
+ (the \`app-function\` feature) or publicly accessible via an endpoint
58
+ (the \`app-function-endpoint\` feature). Create them with
59
+ \`add-feature-to-project\`. Do not use the CMS function tools for app
60
+ functions.
61
+ 8. App analytics: call \`get-apps-info\` to discover \`appId\` values
40
62
  before \`get-api-usage-patterns-by-app-id\`.
41
63
 
42
64
  OUTPUT
@@ -87,7 +87,7 @@ export class HsCreateFunctionTool extends Tool {
87
87
  register() {
88
88
  return this.mcpServer.registerTool(toolName, {
89
89
  title: 'Create HubSpot CMS Serverless Function',
90
- description: `Creates a new HubSpot CMS serverless function using the hs cms function create command. Functions can be created non-interactively by specifying functionsFolder, filename, and endpointPath. Supports all HTTP methods (${HTTP_METHODS.join(', ')}).`,
90
+ description: `Creates a new HubSpot CMS serverless function using the hs cms function create command. This is for CMS/website projects, served at /hs/serverless/<path>. Do NOT use this for developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). For those, use add-feature-to-project. Functions can be created non-interactively by specifying functionsFolder, filename, and endpointPath. Supports all HTTP methods (${HTTP_METHODS.join(', ')}).`,
91
91
  inputSchema,
92
92
  annotations: {
93
93
  readOnlyHint: false,
@@ -5,7 +5,7 @@ import { McpLogger } from '../../utils/logger.js';
5
5
  import { z } from 'zod';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  absoluteCurrentWorkingDirectory: z.ZodString;
8
- endpoint: z.ZodString;
8
+ endpoint: z.ZodOptional<z.ZodString>;
9
9
  account: z.ZodOptional<z.ZodString>;
10
10
  latest: z.ZodOptional<z.ZodBoolean>;
11
11
  compact: z.ZodOptional<z.ZodBoolean>;