@hubspot/cli 8.15.0-beta.3 → 8.16.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) 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/project/add.d.ts +3 -2
  6. package/commands/project/add.js +10 -8
  7. package/commands/project/appInstallStatus.d.ts +2 -2
  8. package/commands/project/appInstallStatus.js +2 -2
  9. package/commands/project/create.d.ts +4 -2
  10. package/commands/project/create.js +16 -4
  11. package/commands/project/deploy.d.ts +2 -2
  12. package/commands/project/deploy.js +2 -2
  13. package/commands/project/download.d.ts +2 -2
  14. package/commands/project/download.js +2 -2
  15. package/commands/project/info.d.ts +1 -1
  16. package/commands/project/info.js +1 -1
  17. package/commands/project/installApp.d.ts +2 -2
  18. package/commands/project/installApp.js +2 -2
  19. package/commands/project/listBuilds.d.ts +2 -2
  20. package/commands/project/listBuilds.js +2 -2
  21. package/commands/project/release/create.d.ts +2 -2
  22. package/commands/project/release/create.js +7 -3
  23. package/commands/project/release/info.d.ts +2 -2
  24. package/commands/project/release/info.js +2 -2
  25. package/commands/project/release/list.d.ts +2 -2
  26. package/commands/project/release/list.js +2 -2
  27. package/commands/project/release/preview.d.ts +9 -0
  28. package/commands/project/release/preview.js +167 -0
  29. package/commands/project/release.js +7 -1
  30. package/commands/project/upload.d.ts +2 -2
  31. package/commands/project/upload.js +2 -2
  32. package/commands/project/validate.d.ts +2 -2
  33. package/commands/project/validate.js +2 -2
  34. package/commands/testAccount/create.d.ts +2 -2
  35. package/commands/testAccount/create.js +2 -2
  36. package/lang/en.d.ts +25 -0
  37. package/lang/en.js +27 -2
  38. package/lib/app/urls.d.ts +0 -1
  39. package/lib/app/urls.js +0 -4
  40. package/lib/constants.d.ts +5 -0
  41. package/lib/constants.js +9 -0
  42. package/lib/jsonOutput/accountAuth.d.ts +7 -0
  43. package/lib/jsonOutput/accountAuth.js +6 -0
  44. package/lib/jsonOutput/projectAdd.d.ts +9 -0
  45. package/lib/jsonOutput/projectAdd.js +10 -0
  46. package/lib/jsonOutput/{appInstallStatus.d.ts → projectAppInstallStatus.d.ts} +2 -2
  47. package/lib/jsonOutput/{appInstallStatus.js → projectAppInstallStatus.js} +1 -1
  48. package/lib/jsonOutput/projectCreate.d.ts +8 -0
  49. package/lib/jsonOutput/projectCreate.js +7 -0
  50. package/lib/jsonOutput/projectDeploy.d.ts +5 -0
  51. package/lib/jsonOutput/{deploy.js → projectDeploy.js} +1 -1
  52. package/lib/jsonOutput/projectDownload.d.ts +7 -0
  53. package/lib/jsonOutput/{download.js → projectDownload.js} +1 -1
  54. package/lib/jsonOutput/{installApp.d.ts → projectInstallApp.d.ts} +2 -2
  55. package/lib/jsonOutput/{installApp.js → projectInstallApp.js} +1 -1
  56. package/lib/jsonOutput/{listBuilds.d.ts → projectListBuilds.d.ts} +2 -2
  57. package/lib/jsonOutput/{listBuilds.js → projectListBuilds.js} +1 -1
  58. package/lib/jsonOutput/{release.d.ts → projectRelease.d.ts} +15 -8
  59. package/lib/jsonOutput/{release.js → projectRelease.js} +11 -4
  60. package/lib/jsonOutput/{upload.d.ts → projectUpload.d.ts} +2 -2
  61. package/lib/jsonOutput/{upload.js → projectUpload.js} +1 -1
  62. package/lib/jsonOutput/{validate.d.ts → projectValidate.d.ts} +2 -2
  63. package/lib/jsonOutput/{validate.js → projectValidate.js} +1 -1
  64. package/lib/jsonOutput/{createTestAccount.d.ts → testAccountCreate.d.ts} +2 -2
  65. package/lib/jsonOutput/{createTestAccount.js → testAccountCreate.js} +1 -1
  66. package/lib/middleware/deprecationWarningMiddleware.d.ts +1 -0
  67. package/lib/middleware/deprecationWarningMiddleware.js +57 -0
  68. package/lib/projects/add/legacyAddComponent.d.ts +2 -1
  69. package/lib/projects/add/legacyAddComponent.js +3 -0
  70. package/lib/projects/add/v2AddComponent.d.ts +2 -1
  71. package/lib/projects/add/v2AddComponent.js +7 -1
  72. package/lib/projects/localDev/LocalDevWatcher.js +1 -1
  73. package/lib/projects/release.d.ts +2 -2
  74. package/lib/projects/validate.d.ts +1 -1
  75. package/mcp-server/Tool.d.ts +6 -1
  76. package/mcp-server/Tool.js +6 -4
  77. package/mcp-server/server.js +26 -4
  78. package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
  79. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +1 -1
  80. package/mcp-server/tools/cms/HsFunctionLogsTool.js +59 -5
  81. package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
  82. package/mcp-server/tools/index.js +2 -0
  83. package/mcp-server/tools/project/AddFeatureToProjectTool.js +31 -31
  84. package/mcp-server/tools/project/AuthAccountTool.js +12 -2
  85. package/mcp-server/tools/project/CreateProjectTool.js +13 -3
  86. package/mcp-server/tools/project/CreateTestAccountTool.js +13 -13
  87. package/mcp-server/tools/project/DeployProjectTool.js +9 -1
  88. package/mcp-server/tools/project/DocFetchTool.js +1 -1
  89. package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
  90. package/mcp-server/tools/project/DocsSearchTool.js +18 -9
  91. package/mcp-server/tools/project/FindProjectsTool.js +12 -0
  92. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +3 -2
  93. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +38 -10
  94. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +2 -1
  95. package/mcp-server/tools/project/GetApplicationInfoTool.js +13 -14
  96. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +2 -1
  97. package/mcp-server/tools/project/GetBuildLogsTool.js +12 -9
  98. package/mcp-server/tools/project/GetBuildStatusTool.d.ts +2 -1
  99. package/mcp-server/tools/project/GetBuildStatusTool.js +12 -9
  100. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +2 -1
  101. package/mcp-server/tools/project/GetConfigValuesTool.js +11 -8
  102. package/mcp-server/tools/project/KnowledgeSearchTool.d.ts +29 -0
  103. package/mcp-server/tools/project/KnowledgeSearchTool.js +82 -0
  104. package/mcp-server/tools/project/UploadProjectTools.js +3 -3
  105. package/mcp-server/tools/project/ValidateProjectTool.js +23 -7
  106. package/mcp-server/tools/project/apps.d.ts +8 -0
  107. package/mcp-server/tools/project/apps.js +7 -0
  108. package/mcp-server/tools/project/constants.d.ts +2 -0
  109. package/mcp-server/tools/project/constants.js +8 -1
  110. package/mcp-server/tools/project/resolveAccount.d.ts +15 -0
  111. package/mcp-server/tools/project/resolveAccount.js +60 -0
  112. package/mcp-server/utils/command.d.ts +1 -0
  113. package/mcp-server/utils/command.js +8 -0
  114. package/mcp-server/utils/content.d.ts +1 -0
  115. package/mcp-server/utils/content.js +5 -0
  116. package/mcp-server/utils/elicitSelection.d.ts +11 -0
  117. package/mcp-server/utils/elicitSelection.js +25 -0
  118. package/mcp-server/utils/elicitation.d.ts +9 -0
  119. package/mcp-server/utils/elicitation.js +35 -0
  120. package/package.json +23 -22
  121. package/ui/components/Table.d.ts +8 -8
  122. package/lib/jsonOutput/deploy.d.ts +0 -5
  123. package/lib/jsonOutput/download.d.ts +0 -7
  124. /package/lib/jsonOutput/{info.d.ts → projectInfo.d.ts} +0 -0
  125. /package/lib/jsonOutput/{info.js → projectInfo.js} +0 -0
@@ -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,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>;
@@ -5,11 +5,15 @@ import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
5
5
  import { formatTextContents } from '../../utils/content.js';
6
6
  import { setupHubSpotConfig } from '../../utils/config.js';
7
7
  import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
8
+ import { getRoutes } from '@hubspot/local-dev-lib/api/functions';
9
+ import { discoverAccountTargets } from '../../../lib/accountTargetDiscovery.js';
10
+ import { elicitSelection } from '../../utils/elicitSelection.js';
8
11
  const inputSchema = {
9
12
  absoluteCurrentWorkingDirectory,
10
13
  endpoint: z
11
14
  .string()
12
- .describe('The function endpoint/path to get logs for. Required. Example: "my-function" or "api/my-endpoint" (leading slash will be automatically removed)'),
15
+ .describe('The function endpoint/path to get logs for. Example: "my-function" or "api/my-endpoint" (leading slash will be automatically removed). If omitted and the account has several functions, you will be asked to choose one.')
16
+ .optional(),
13
17
  account: z
14
18
  .string()
15
19
  .describe('The HubSpot account id or name from the HubSpot config file to use for the operation.')
@@ -33,10 +37,60 @@ export class HsFunctionLogsTool extends Tool {
33
37
  }
34
38
  async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }, extra) {
35
39
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
40
+ let resolvedEndpoint = endpoint;
41
+ if (!resolvedEndpoint) {
42
+ const { recommended } = await discoverAccountTargets({
43
+ explicitAccount: account,
44
+ });
45
+ const accountId = recommended?.accountId;
46
+ if (!accountId) {
47
+ return formatTextContents('No account ID found. Call the auth-account tool to authenticate a HubSpot account.');
48
+ }
49
+ try {
50
+ const routesResponse = await getRoutes(accountId);
51
+ const routes = routesResponse.data.objects ?? [];
52
+ if (routes.length === 0) {
53
+ return formatTextContents('No CMS serverless functions found for this account.');
54
+ }
55
+ // The logs command takes a path (method-agnostic), and a path can
56
+ // appear under multiple methods, so dedupe by route to keep the
57
+ // elicitation values unique.
58
+ const seenRoutes = new Set();
59
+ const options = [];
60
+ routes.forEach(route => {
61
+ if (seenRoutes.has(route.route)) {
62
+ return;
63
+ }
64
+ seenRoutes.add(route.route);
65
+ options.push({
66
+ value: route.route,
67
+ label: `${route.method} ${route.route}`,
68
+ });
69
+ });
70
+ const selected = await elicitSelection(this.mcpServer, this.logger, {
71
+ message: 'Select the CMS serverless function to get logs for.',
72
+ title: 'CMS serverless function',
73
+ options,
74
+ });
75
+ if (!selected) {
76
+ return formatTextContents(`Several functions are available. Ask the user which to use, then call ${toolName} again with the endpoint argument set to one of: ${options
77
+ .map(option => option.label)
78
+ .join(', ')}.`);
79
+ }
80
+ resolvedEndpoint = selected;
81
+ }
82
+ catch (error) {
83
+ this.logger.debug(toolName, {
84
+ message: 'Failed to list functions for elicitation',
85
+ error: getErrorMessage(error),
86
+ });
87
+ return formatTextContents(`Error listing CMS serverless functions: ${getErrorMessage(error)}`);
88
+ }
89
+ }
36
90
  // Ensure endpoint doesn't start with '/'
37
- const normalizedEndpoint = endpoint.startsWith('/')
38
- ? endpoint.slice(1)
39
- : endpoint;
91
+ const normalizedEndpoint = resolvedEndpoint.startsWith('/')
92
+ ? resolvedEndpoint.slice(1)
93
+ : resolvedEndpoint;
40
94
  const command = new HubSpotCommand(`cms function logs ${normalizedEndpoint}`);
41
95
  if (latest) {
42
96
  command.addFlag('latest', latest);
@@ -65,7 +119,7 @@ export class HsFunctionLogsTool extends Tool {
65
119
  register() {
66
120
  return this.mcpServer.registerTool(toolName, {
67
121
  title: 'Get HubSpot CMS serverless function logs for an endpoint',
68
- description: 'Retrieve logs for HubSpot CMS serverless functions. Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
122
+ description: 'Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
69
123
  inputSchema,
70
124
  annotations: {
71
125
  readOnlyHint: true,
@@ -54,7 +54,7 @@ export class HsListFunctionsTool extends Tool {
54
54
  register() {
55
55
  return this.mcpServer.registerTool(toolName, {
56
56
  title: 'List HubSpot CMS Serverless Functions',
57
- description: 'Get a list of all serverless functions deployed in a HubSpot portal/account. Shows function routes, HTTP methods, secrets, and timestamps.',
57
+ description: 'Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
58
58
  inputSchema,
59
59
  annotations: {
60
60
  readOnlyHint: true,
@@ -7,6 +7,7 @@ import { ValidateProjectTool } from './project/ValidateProjectTool.js';
7
7
  import { GetConfigValuesTool } from './project/GetConfigValuesTool.js';
8
8
  import { DocsSearchTool } from './project/DocsSearchTool.js';
9
9
  import { DocFetchTool } from './project/DocFetchTool.js';
10
+ import { KnowledgeSearchTool } from './project/KnowledgeSearchTool.js';
10
11
  import { GetApiUsagePatternsByAppIdTool } from './project/GetApiUsagePatternsByAppIdTool.js';
11
12
  import { GetApplicationInfoTool } from './project/GetApplicationInfoTool.js';
12
13
  import { GetBuildLogsTool } from './project/GetBuildLogsTool.js';
@@ -32,6 +33,7 @@ export function registerProjectTools(mcpServer, logger) {
32
33
  new GetConfigValuesTool(mcpServer, logger).register(),
33
34
  new DocsSearchTool(mcpServer, logger).register(),
34
35
  new DocFetchTool(mcpServer, logger).register(),
36
+ new KnowledgeSearchTool(mcpServer, logger).register(),
35
37
  new GetApiUsagePatternsByAppIdTool(mcpServer, logger).register(),
36
38
  new GetApplicationInfoTool(mcpServer, logger).register(),
37
39
  new GetBuildLogsTool(mcpServer, logger).register(),
@@ -5,7 +5,8 @@ import { HubSpotCommand } from '../../utils/command.js';
5
5
  import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
6
6
  import { formatTextContents, formatTextContent } from '../../utils/content.js';
7
7
  import { setupHubSpotConfig } from '../../utils/config.js';
8
- import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
8
+ import { parseCommandJsonOutput } from '../../utils/json.js';
9
+ import { ProjectAddSchema } from '../../../lib/jsonOutput/projectAdd.js';
9
10
  const inputSchema = {
10
11
  absoluteProjectPath,
11
12
  absoluteCurrentWorkingDirectory,
@@ -33,38 +34,36 @@ export class AddFeatureToProjectTool extends Tool {
33
34
  }
34
35
  async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }, extra) {
35
36
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
36
- try {
37
- const command = new HubSpotCommand('project add');
38
- const content = [];
39
- if (distribution) {
40
- command.addFlag('distribution', distribution);
41
- }
42
- else if (addApp) {
43
- content.push(formatTextContent(`Ask the user how they would you like to distribute the app. Options are ${APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${APP_DISTRIBUTION_TYPES.PRIVATE}`));
44
- }
45
- if (auth) {
46
- command.addFlag('auth', auth);
47
- }
48
- else if (addApp) {
49
- content.push(formatTextContent(`Ask the user which auth type they would like to use. Options are ${APP_AUTH_TYPES.STATIC} and ${APP_AUTH_TYPES.OAUTH}`));
50
- }
51
- if (content.length > 0) {
52
- return {
53
- content,
54
- };
55
- }
56
- // If features isn't provided, pass an empty array to bypass the prompt
57
- command.addFlag('features', features || []);
58
- const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
59
- return formatTextContents(stdout, stderr);
37
+ const command = new HubSpotCommand('project add', [
38
+ { name: 'json', value: true },
39
+ ]);
40
+ const content = [];
41
+ if (distribution) {
42
+ command.addFlag('distribution', distribution);
60
43
  }
61
- catch (error) {
62
- this.logger.debug(toolName, {
63
- message: 'Handler caught error',
64
- error: error instanceof Error ? error.message : String(error),
65
- });
66
- return formatTextContents(getErrorMessage(error));
44
+ else if (addApp) {
45
+ content.push(formatTextContent(`Ask the user how they would you like to distribute the app. Options are ${APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${APP_DISTRIBUTION_TYPES.PRIVATE}`));
67
46
  }
47
+ if (auth) {
48
+ command.addFlag('auth', auth);
49
+ }
50
+ else if (addApp) {
51
+ content.push(formatTextContent(`Ask the user which auth type they would like to use. Options are ${APP_AUTH_TYPES.STATIC} and ${APP_AUTH_TYPES.OAUTH}`));
52
+ }
53
+ if (content.length > 0) {
54
+ return {
55
+ content,
56
+ structuredContent: {},
57
+ };
58
+ }
59
+ // If features isn't provided, pass an empty array to bypass the prompt
60
+ command.addFlag('features', features || []);
61
+ const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
62
+ const response = await formatTextContents(stdout, stderr);
63
+ response.structuredContent =
64
+ parseCommandJsonOutput(stdout, ProjectAddSchema, this.logger, toolName) ??
65
+ {};
66
+ return response;
68
67
  }
69
68
  register() {
70
69
  return this.mcpServer.registerTool(toolName, {
@@ -72,6 +71,7 @@ export class AddFeatureToProjectTool extends Tool {
72
71
  description: `Adds a feature to an existing HubSpot project.
73
72
  Only works for projects with platformVersion '2025.2' and beyond. If you do not know the project path, use the find-projects tool first to locate HubSpot projects in the workspace.`,
74
73
  inputSchema,
74
+ outputSchema: ProjectAddSchema.shape,
75
75
  annotations: {
76
76
  readOnlyHint: false,
77
77
  destructiveHint: false,