@hubspot/cli 7.5.11-experimental.0 → 7.7.0-experimental.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 (289) hide show
  1. package/bin/cli.js +5 -6
  2. package/bin/hsmcp.d.ts +2 -0
  3. package/bin/hsmcp.js +13 -0
  4. package/commands/account/auth.d.ts +3 -7
  5. package/commands/account/auth.js +19 -9
  6. package/commands/account/clean.d.ts +3 -7
  7. package/commands/account/clean.js +16 -9
  8. package/commands/account/createOverride.d.ts +3 -7
  9. package/commands/account/createOverride.js +23 -6
  10. package/commands/account/info.d.ts +3 -7
  11. package/commands/account/info.js +13 -5
  12. package/commands/account/list.d.ts +3 -7
  13. package/commands/account/list.js +15 -8
  14. package/commands/account/remove.d.ts +3 -7
  15. package/commands/account/remove.js +21 -9
  16. package/commands/account/removeOverride.d.ts +3 -7
  17. package/commands/account/removeOverride.js +23 -6
  18. package/commands/account/rename.d.ts +3 -7
  19. package/commands/account/rename.js +16 -9
  20. package/commands/account/use.d.ts +5 -9
  21. package/commands/account/use.js +14 -6
  22. package/commands/account.d.ts +3 -4
  23. package/commands/account.js +35 -58
  24. package/commands/app/migrate.d.ts +1 -2
  25. package/commands/app/migrate.js +7 -8
  26. package/commands/app/secret/add.d.ts +7 -0
  27. package/commands/app/secret/add.js +64 -0
  28. package/commands/app/secret/delete.d.ts +8 -0
  29. package/commands/app/secret/delete.js +87 -0
  30. package/commands/app/secret/list.d.ts +6 -0
  31. package/commands/app/secret/list.js +64 -0
  32. package/commands/app/secret/update.d.ts +7 -0
  33. package/commands/app/secret/update.js +77 -0
  34. package/commands/app/secret.d.ts +3 -0
  35. package/commands/app/secret.js +30 -0
  36. package/commands/app.d.ts +2 -5
  37. package/commands/app.js +12 -8
  38. package/commands/auth.d.ts +3 -7
  39. package/commands/auth.js +12 -5
  40. package/commands/cms/convertFields.d.ts +7 -1
  41. package/commands/cms/convertFields.js +57 -41
  42. package/commands/cms/getReactModule.d.ts +7 -1
  43. package/commands/cms/getReactModule.js +52 -34
  44. package/commands/cms/lighthouseScore.d.ts +8 -1
  45. package/commands/cms/lighthouseScore.js +129 -100
  46. package/commands/cms.d.ts +3 -1
  47. package/commands/cms.js +24 -15
  48. package/commands/completion.d.ts +3 -1
  49. package/commands/completion.js +25 -12
  50. package/commands/config/migrate.d.ts +3 -7
  51. package/commands/config/migrate.js +25 -15
  52. package/commands/config/set.d.ts +5 -6
  53. package/commands/config/set.js +38 -14
  54. package/commands/config.d.ts +3 -4
  55. package/commands/config.js +20 -44
  56. package/commands/create/api-sample.d.ts +3 -1
  57. package/commands/create/api-sample.js +34 -38
  58. package/commands/create/app.d.ts +3 -1
  59. package/commands/create/app.js +9 -7
  60. package/commands/create/function.d.ts +3 -1
  61. package/commands/create/function.js +11 -10
  62. package/commands/create/index.d.ts +5 -1
  63. package/commands/create/index.js +23 -11
  64. package/commands/create/module.d.ts +3 -1
  65. package/commands/create/module.js +14 -13
  66. package/commands/create/react-app.d.ts +3 -1
  67. package/commands/create/react-app.js +10 -7
  68. package/commands/create/template.d.ts +3 -1
  69. package/commands/create/template.js +14 -14
  70. package/commands/create/vue-app.d.ts +3 -1
  71. package/commands/create/vue-app.js +10 -7
  72. package/commands/create/webpack-serverless.d.ts +3 -1
  73. package/commands/create/webpack-serverless.js +10 -7
  74. package/commands/create/website-theme.d.ts +3 -1
  75. package/commands/create/website-theme.js +10 -9
  76. package/commands/create.d.ts +4 -24
  77. package/commands/create.js +64 -74
  78. package/commands/customObject/create.d.ts +4 -9
  79. package/commands/customObject/create.js +17 -10
  80. package/commands/customObject/schema/create.d.ts +4 -9
  81. package/commands/customObject/schema/create.js +18 -11
  82. package/commands/customObject/schema/delete.d.ts +4 -9
  83. package/commands/customObject/schema/delete.js +17 -10
  84. package/commands/customObject/schema/fetch-all.d.ts +4 -9
  85. package/commands/customObject/schema/fetch-all.js +17 -10
  86. package/commands/customObject/schema/fetch.d.ts +4 -9
  87. package/commands/customObject/schema/fetch.js +17 -10
  88. package/commands/customObject/schema/list.d.ts +4 -8
  89. package/commands/customObject/schema/list.js +17 -10
  90. package/commands/customObject/schema/update.d.ts +4 -9
  91. package/commands/customObject/schema/update.js +18 -11
  92. package/commands/customObject/schema.d.ts +3 -5
  93. package/commands/customObject/schema.js +27 -54
  94. package/commands/customObject.d.ts +3 -4
  95. package/commands/customObject.js +20 -45
  96. package/commands/doctor.d.ts +6 -8
  97. package/commands/doctor.js +32 -21
  98. package/commands/feedback.d.ts +4 -1
  99. package/commands/feedback.js +40 -47
  100. package/commands/fetch.d.ts +12 -1
  101. package/commands/fetch.js +49 -33
  102. package/commands/filemanager/fetch.d.ts +4 -9
  103. package/commands/filemanager/fetch.js +18 -11
  104. package/commands/filemanager/upload.d.ts +4 -9
  105. package/commands/filemanager/upload.js +17 -11
  106. package/commands/filemanager.d.ts +3 -4
  107. package/commands/filemanager.js +20 -41
  108. package/commands/function/deploy.d.ts +6 -1
  109. package/commands/function/deploy.js +70 -50
  110. package/commands/function/list.d.ts +6 -1
  111. package/commands/function/list.js +44 -32
  112. package/commands/function/server.d.ts +10 -1
  113. package/commands/function/server.js +49 -38
  114. package/commands/function.d.ts +5 -1
  115. package/commands/function.js +24 -10
  116. package/commands/hubdb/clear.d.ts +4 -9
  117. package/commands/hubdb/clear.js +17 -10
  118. package/commands/hubdb/create.d.ts +4 -9
  119. package/commands/hubdb/create.js +17 -10
  120. package/commands/hubdb/delete.d.ts +4 -9
  121. package/commands/hubdb/delete.js +17 -10
  122. package/commands/hubdb/fetch.d.ts +4 -9
  123. package/commands/hubdb/fetch.js +17 -10
  124. package/commands/hubdb.d.ts +3 -2
  125. package/commands/hubdb.js +23 -45
  126. package/commands/init.d.ts +3 -7
  127. package/commands/init.js +12 -5
  128. package/commands/lint.d.ts +6 -4
  129. package/commands/lint.js +44 -43
  130. package/commands/list.d.ts +3 -7
  131. package/commands/list.js +19 -11
  132. package/commands/logs.d.ts +10 -1
  133. package/commands/logs.js +53 -44
  134. package/commands/module/marketplace-validate.d.ts +6 -1
  135. package/commands/module/marketplace-validate.js +39 -27
  136. package/commands/module.d.ts +3 -1
  137. package/commands/module.js +22 -10
  138. package/commands/mv.d.ts +3 -7
  139. package/commands/mv.js +19 -11
  140. package/commands/open.d.ts +3 -7
  141. package/commands/open.js +19 -11
  142. package/commands/project/cloneApp.d.ts +1 -1
  143. package/commands/project/cloneApp.js +2 -2
  144. package/commands/project/create.js +3 -3
  145. package/commands/project/deploy.d.ts +1 -0
  146. package/commands/project/deploy.js +40 -12
  147. package/commands/project/dev/index.d.ts +1 -4
  148. package/commands/project/dev/index.js +48 -16
  149. package/commands/project/dev/unifiedFlow.d.ts +2 -1
  150. package/commands/project/dev/unifiedFlow.js +85 -30
  151. package/commands/project/migrate.d.ts +1 -0
  152. package/commands/project/profile/add.d.ts +7 -0
  153. package/commands/project/profile/add.js +209 -0
  154. package/commands/project/profile/delete.d.ts +6 -0
  155. package/commands/project/profile/delete.js +123 -0
  156. package/commands/project/profile.d.ts +3 -0
  157. package/commands/project/profile.js +25 -0
  158. package/commands/project/upload.d.ts +1 -0
  159. package/commands/project/upload.js +38 -8
  160. package/commands/project/validate.d.ts +4 -0
  161. package/commands/project/validate.js +53 -0
  162. package/commands/project.js +4 -0
  163. package/commands/remove.d.ts +3 -7
  164. package/commands/remove.js +19 -11
  165. package/commands/sandbox/create.d.ts +4 -9
  166. package/commands/sandbox/create.js +18 -11
  167. package/commands/sandbox/delete.d.ts +4 -9
  168. package/commands/sandbox/delete.js +18 -11
  169. package/commands/sandbox.d.ts +3 -4
  170. package/commands/sandbox.js +20 -43
  171. package/commands/secret/addSecret.d.ts +4 -9
  172. package/commands/secret/addSecret.js +17 -10
  173. package/commands/secret/deleteSecret.d.ts +4 -9
  174. package/commands/secret/deleteSecret.js +17 -10
  175. package/commands/secret/listSecret.d.ts +4 -9
  176. package/commands/secret/listSecret.js +17 -10
  177. package/commands/secret/updateSecret.d.ts +4 -9
  178. package/commands/secret/updateSecret.js +17 -10
  179. package/commands/secret.d.ts +3 -4
  180. package/commands/secret.js +25 -48
  181. package/commands/setupMcp.d.ts +8 -0
  182. package/commands/setupMcp.js +229 -0
  183. package/commands/theme/generate-selectors.d.ts +3 -7
  184. package/commands/theme/generate-selectors.js +14 -6
  185. package/commands/theme/marketplace-validate.d.ts +4 -9
  186. package/commands/theme/marketplace-validate.js +17 -10
  187. package/commands/theme/preview.d.ts +4 -9
  188. package/commands/theme/preview.js +16 -9
  189. package/commands/theme.d.ts +3 -4
  190. package/commands/theme.js +23 -46
  191. package/commands/upload.d.ts +12 -1
  192. package/commands/upload.js +118 -97
  193. package/commands/watch.d.ts +14 -1
  194. package/commands/watch.js +76 -65
  195. package/lang/en.d.ts +838 -574
  196. package/lang/en.js +630 -373
  197. package/lang/en.lyaml +30 -23
  198. package/lib/accountTypes.js +2 -1
  199. package/lib/app/migrate.d.ts +23 -0
  200. package/lib/app/migrate.js +14 -3
  201. package/lib/app/migrate_legacy.js +7 -7
  202. package/lib/app/urls.d.ts +16 -0
  203. package/lib/app/urls.js +16 -0
  204. package/lib/configMigrate.js +24 -10
  205. package/lib/configOptions.d.ts +4 -0
  206. package/lib/configOptions.js +41 -46
  207. package/lib/constants.d.ts +6 -0
  208. package/lib/constants.js +7 -1
  209. package/lib/dependencyManagement.d.ts +0 -5
  210. package/lib/dependencyManagement.js +13 -39
  211. package/lib/doctor/Doctor.js +2 -1
  212. package/lib/filesystem.d.ts +1 -1
  213. package/lib/interpolation.d.ts +2 -3
  214. package/lib/lang.d.ts +2 -3
  215. package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
  216. package/lib/middleware/autoUpdateMiddleware.js +89 -0
  217. package/lib/middleware/configMiddleware.js +8 -0
  218. package/lib/npm.d.ts +9 -0
  219. package/lib/npm.js +36 -0
  220. package/lib/projectProfiles.d.ts +6 -0
  221. package/lib/projectProfiles.js +65 -0
  222. package/lib/projects/buildAndDeploy.js +17 -2
  223. package/lib/projects/localDev/AppDevModeInterface.d.ts +26 -0
  224. package/lib/projects/localDev/AppDevModeInterface.js +156 -0
  225. package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
  226. package/lib/projects/localDev/DevServerManagerV2.js +19 -15
  227. package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
  228. package/lib/projects/localDev/LocalDevLogger.js +158 -0
  229. package/lib/projects/localDev/LocalDevManager.js +12 -5
  230. package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
  231. package/lib/projects/localDev/LocalDevProcess.js +171 -0
  232. package/lib/projects/localDev/LocalDevState.d.ts +37 -0
  233. package/lib/projects/localDev/LocalDevState.js +78 -0
  234. package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
  235. package/lib/projects/localDev/LocalDevWatcher.js +56 -0
  236. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
  237. package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
  238. package/lib/projects/localDev/helpers.d.ts +3 -2
  239. package/lib/projects/localDev/helpers.js +32 -2
  240. package/lib/projects/upload.d.ts +2 -1
  241. package/lib/projects/upload.js +2 -2
  242. package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
  243. package/lib/prompts/createTemplatePrompt.d.ts +22 -4
  244. package/lib/prompts/installAppPrompt.d.ts +1 -0
  245. package/lib/prompts/installAppPrompt.js +35 -0
  246. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
  247. package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
  248. package/lib/prompts/promptUtils.d.ts +2 -1
  249. package/lib/prompts/promptUtils.js +2 -1
  250. package/lib/prompts/selectAppPrompt.d.ts +2 -0
  251. package/lib/prompts/selectAppPrompt.js +40 -0
  252. package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
  253. package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
  254. package/lib/testUtils.d.ts +3 -3
  255. package/lib/testUtils.js +8 -9
  256. package/lib/ui/index.js +4 -1
  257. package/lib/upload.d.ts +1 -1
  258. package/lib/validation.js +4 -5
  259. package/lib/yargsUtils.d.ts +4 -0
  260. package/lib/yargsUtils.js +6 -0
  261. package/mcp-server/index.d.ts +1 -0
  262. package/mcp-server/index.js +17 -0
  263. package/mcp-server/mcpLoader.d.ts +5 -0
  264. package/mcp-server/mcpLoader.js +24 -0
  265. package/mcp-server/tools/ExplainProjectStructureTool.d.ts +33 -0
  266. package/mcp-server/tools/ExplainProjectStructureTool.js +266 -0
  267. package/mcp-server/tools/GenerateAppComponentTool.d.ts +99 -0
  268. package/mcp-server/tools/GenerateAppComponentTool.js +193 -0
  269. package/mcp-server/tools/GenerateCardComponentTool.d.ts +74 -0
  270. package/mcp-server/tools/GenerateCardComponentTool.js +146 -0
  271. package/mcp-server/tools/GenerateProjectConfigTool.d.ts +32 -0
  272. package/mcp-server/tools/GenerateProjectConfigTool.js +40 -0
  273. package/mcp-server/tools/HubSpotCLIHelper.d.ts +16 -0
  274. package/mcp-server/tools/HubSpotCLIHelper.js +74 -0
  275. package/mcp-server/tools/UploadProjectTool.d.ts +44 -0
  276. package/mcp-server/tools/UploadProjectTool.js +149 -0
  277. package/mcp-server/tools/ValidateProjectTool.d.ts +62 -0
  278. package/mcp-server/tools/ValidateProjectTool.js +315 -0
  279. package/package.json +13 -6
  280. package/types/Cms.d.ts +30 -0
  281. package/types/Cms.js +2 -0
  282. package/types/LocalDev.d.ts +24 -0
  283. package/types/LocalDev.js +2 -0
  284. package/types/Prompts.d.ts +0 -7
  285. package/types/Yargs.d.ts +8 -1
  286. package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
  287. package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
  288. package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
  289. package/lib/prompts/installPublicAppPrompt.js +0 -41
package/lib/validation.js CHANGED
@@ -145,28 +145,27 @@ function validateCmsPublishMode(options) {
145
145
  return false;
146
146
  }
147
147
  function fileExists(_path) {
148
- let isFile;
149
148
  try {
150
149
  const absoluteSrcPath = path.resolve((0, path_1.getCwd)(), _path);
151
150
  if (!absoluteSrcPath)
152
151
  return false;
153
152
  const stats = fs.statSync(absoluteSrcPath);
154
- isFile = stats.isFile();
153
+ const isFile = stats.isFile();
155
154
  if (!isFile) {
156
- logger_1.logger.error(`The path "${_path}" is not a path to a file`);
157
155
  return false;
158
156
  }
159
157
  }
160
158
  catch (e) {
161
- logger_1.logger.error(`The path "${_path}" is not a path to a file`);
162
159
  return false;
163
160
  }
164
161
  return true;
165
162
  }
166
163
  function checkAndConvertToJson(_path) {
167
164
  const filePath = (0, path_1.getAbsoluteFilePath)(_path);
168
- if (!fileExists(filePath))
165
+ if (!fileExists(filePath)) {
166
+ logger_1.logger.error(`The path "${_path}" is not a path to a file`);
169
167
  return null;
168
+ }
170
169
  if ((0, path_1.getExt)(_path) !== 'json') {
171
170
  logger_1.logger.error(`The file "${_path}" must be a valid JSON file`);
172
171
  return null;
@@ -6,4 +6,8 @@ export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>,
6
6
  useConfigOptions?: boolean;
7
7
  useEnvironmentOptions?: boolean;
8
8
  useTestingOptions?: boolean;
9
+ useCmsPublishModeOptions?: boolean | {
10
+ read?: boolean;
11
+ write?: boolean;
12
+ };
9
13
  }): (yargs: Argv) => Promise<Argv<T>>;
package/lib/yargsUtils.js CHANGED
@@ -32,6 +32,12 @@ function makeYargsBuilder(callback, command, describe, options = {}) {
32
32
  if (options.useTestingOptions) {
33
33
  (0, commonOpts_1.addTestingOptions)(yargs);
34
34
  }
35
+ if (options.useCmsPublishModeOptions) {
36
+ const opts = typeof options.useCmsPublishModeOptions === 'object'
37
+ ? options.useCmsPublishModeOptions
38
+ : { write: true };
39
+ (0, commonOpts_1.addCmsPublishModeOptions)(yargs, opts);
40
+ }
35
41
  const result = callback(yargs);
36
42
  // Must go last to pick up available options
37
43
  await (0, commonOpts_1.addCustomHelpOutput)(result, command, describe);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { MCPServer } from 'mcp-framework';
2
+ import { dirname, join } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+ // Calculate the correct base path for tools
7
+ // ToolLoader does: dirname(basePath) + "/tools"
8
+ // We want it to look in dist/mcp-server/tools
9
+ // So basePath should be dist/mcp-server/anything
10
+ // __filename is dist/mcp-server/index.js, so dirname is dist/mcp-server
11
+ // We need to provide a path like dist/mcp-server/main.js
12
+ const basePath = join(__dirname, 'main.js');
13
+ console.log('Debug: basePath:', basePath);
14
+ const server = new MCPServer({
15
+ basePath: basePath,
16
+ });
17
+ server.start();
@@ -0,0 +1,5 @@
1
+ export declare function getMCPServer(): Promise<any>;
2
+ export declare function getMCPTool(): Promise<any>;
3
+ export declare class MCPToolBase {
4
+ static create(): Promise<any>;
5
+ }
@@ -0,0 +1,24 @@
1
+ // Dynamic import loader for mcp-framework to handle ESM/CommonJS compatibility
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
+ let mcpFramework = null;
4
+ async function loadMCPFramework() {
5
+ if (!mcpFramework) {
6
+ mcpFramework = await import('mcp-framework');
7
+ }
8
+ return mcpFramework;
9
+ }
10
+ export async function getMCPServer() {
11
+ const framework = await loadMCPFramework();
12
+ return framework.MCPServer;
13
+ }
14
+ export async function getMCPTool() {
15
+ const framework = await loadMCPFramework();
16
+ return framework.MCPTool;
17
+ }
18
+ // Export a ready-to-use MCPTool base class
19
+ export class MCPToolBase {
20
+ static async create() {
21
+ const MCPTool = await getMCPTool();
22
+ return MCPTool;
23
+ }
24
+ }
@@ -0,0 +1,33 @@
1
+ import { MCPTool } from "mcp-framework";
2
+ import { z } from "zod";
3
+ interface ExplainProjectStructureInput {
4
+ section?: string;
5
+ }
6
+ declare class ExplainProjectStructureTool extends MCPTool<ExplainProjectStructureInput> {
7
+ name: string;
8
+ description: string;
9
+ schema: {
10
+ section: {
11
+ type: z.ZodOptional<z.ZodString>;
12
+ description: string;
13
+ };
14
+ };
15
+ execute(input: ExplainProjectStructureInput): Promise<{
16
+ section: string;
17
+ title: string;
18
+ content: string;
19
+ message?: undefined;
20
+ sections?: undefined;
21
+ } | {
22
+ message: string;
23
+ sections: {
24
+ section: string;
25
+ title: string;
26
+ content: string;
27
+ }[];
28
+ section?: undefined;
29
+ title?: undefined;
30
+ content?: undefined;
31
+ }>;
32
+ }
33
+ export default ExplainProjectStructureTool;
@@ -0,0 +1,266 @@
1
+ import { MCPTool } from "mcp-framework";
2
+ import { z } from "zod";
3
+ class ExplainProjectStructureTool extends MCPTool {
4
+ name = "explainProjectStructure";
5
+ description = "Explains the developer projects platform structure, conventions, and best practices";
6
+ schema = {
7
+ section: {
8
+ type: z.string().optional(),
9
+ description: "Specific section to explain (overview, projectFiles, components, hierarchy, fileNaming, bestPractices, envelope). If not provided, returns complete explanation",
10
+ },
11
+ };
12
+ async execute(input) {
13
+ const { section } = input;
14
+ const explanation = {
15
+ overview: {
16
+ title: "Developer Projects Platform Overview",
17
+ content: `
18
+ The developer projects platform allows users to build applications using a hierarchical component-based architecture with consistency and predictability as core principles.
19
+
20
+ Key Concepts:
21
+ - Projects are defined by hsproject.json files in the root directory
22
+ - Components follow a hierarchical structure with top-level and sub-components
23
+ - Apps are the primary top-level components that provide authentication
24
+ - Sub-components (features) live within apps and depend on app authentication
25
+ - All components live in the src directory with dedicated folders
26
+ - Component instances are declared via *-hsmeta.json files
27
+ - 1:1 relationship between components and their configuration files
28
+ - Envelope layer (uid, type) provides meta information about components
29
+ `,
30
+ },
31
+ projectFiles: {
32
+ title: "Project Configuration Files",
33
+ content: `
34
+ hsproject.json (Project Root):
35
+ - Designates a folder as a developer project
36
+ - Contains project metadata including name, source directory, and platform version
37
+ - Required fields:
38
+ * name: Project name (e.g., "North Star Project")
39
+ * srcDir: Source code directory (typically "src")
40
+ * platformVersion: Platform version (e.g., "2025.1", defaults to "2025.2")
41
+
42
+ Example:
43
+ {
44
+ "name": "North Star Project",
45
+ "srcDir": "src",
46
+ "platformVersion": "2025.1"
47
+ }
48
+ `,
49
+ },
50
+ components: {
51
+ title: "Component Architecture",
52
+ content: `
53
+ Components follow a structured, predictable architecture with two main categories:
54
+
55
+ **Top-Level Components:**
56
+ - Stand-alone components that provide core functionality
57
+ - Currently: Apps (and Themes)
58
+ - Located directly in src/[component-type]/
59
+ - Provide authentication and foundational services
60
+
61
+ **Sub-Components (Features):**
62
+ - Live within top-level components (primarily apps)
63
+ - Depend on parent component's authentication
64
+ - Located in src/app/[feature-type]/
65
+ - Include: cards, functions, settings, webhooks, marketing-events, timeline-events, etc.
66
+
67
+ Standard Component Structure (Envelope Layer):
68
+ {
69
+ "uid": "unique-component-id", // Unique identifier
70
+ "type": "component-type", // Component type
71
+ "config": { // Component-specific configuration
72
+ // Configuration details here
73
+ }
74
+ }
75
+
76
+ Component Characteristics:
77
+ - Each component has a dedicated folder and *-hsmeta.json file (1:1 relationship)
78
+ - Some components are singular (only one per app): settings, webhooks, calling
79
+ - Others can have multiple instances: cards, functions, marketing-events
80
+ - All follow the envelope layer structure for consistency
81
+ `,
82
+ },
83
+ hierarchy: {
84
+ title: "Component Hierarchy & Authentication",
85
+ content: `
86
+ The platform uses a hierarchical architecture where authentication flows from top-level components to sub-components.
87
+
88
+ **Top-Level Components:**
89
+ - App: Primary component providing OAuth authentication
90
+ - Theme: Styling and branding (top-level but may depend on app context)
91
+
92
+ **Sub-Components within Apps:**
93
+ Sub-components rely on their parent app's authentication and include:
94
+
95
+ - App Objects: Custom CRM objects
96
+ - App Object Associations: Relationships between objects
97
+ - Cards: UI cards displayed in HubSpot
98
+ - Functions: Serverless functions
99
+ - Settings: Configuration interfaces
100
+ - Marketing Events: Custom marketing event types
101
+ - Timeline Events: Custom timeline activities
102
+ - Webhooks: Event notification endpoints
103
+ - Workflow Actions: Custom workflow steps
104
+ - Calling: Phone/communication features
105
+ - Video Conferencing: Meeting integrations
106
+ - Media Bridge: Media handling capabilities
107
+
108
+ **Authentication Flow:**
109
+ 1. App component defines OAuth scopes and authentication
110
+ 2. Sub-components inherit and utilize app authentication
111
+ 3. Sub-components cannot exist without a parent app
112
+ 4. All API calls from sub-components use app credentials
113
+ `,
114
+ },
115
+ fileNaming: {
116
+ title: "File Naming Conventions & Structure",
117
+ content: `
118
+ Component Configuration Files (*-hsmeta.json):
119
+ - Must end with "-hsmeta.json"
120
+ - Prefix can be anything meaningful to the user
121
+ - Recommended: use component name as prefix for clarity
122
+ - Examples: "my-app-hsmeta.json", "contact-card-hsmeta.json"
123
+ - Maintain 1:1 relationship between components and configuration files
124
+
125
+ Complete Directory Structure:
126
+ my-project/
127
+ ├── hsproject.json # Project configuration
128
+ └── src/ # Source code directory
129
+ ├── app/ # App component directory (top-level)
130
+ │ ├── my-app-hsmeta.json # App component configuration
131
+ │ ├── cards/ # Cards sub-components
132
+ │ │ ├── contact-card-hsmeta.json
133
+ │ │ └── deal-card-hsmeta.json
134
+ │ ├── functions/ # Function sub-components
135
+ │ │ ├── data-sync-hsmeta.json
136
+ │ │ └── email-validator-hsmeta.json
137
+ │ ├── settings/ # Settings sub-component (singular)
138
+ │ │ └── app-settings-hsmeta.json
139
+ │ ├── webhooks/ # Webhooks sub-component (singular)
140
+ │ │ └── event-handler-hsmeta.json
141
+ │ └── [other-features]/ # Other sub-component directories
142
+ └── theme/ # Theme component (if applicable)
143
+ └── brand-theme-hsmeta.json
144
+
145
+ UIDs (Unique Identifiers):
146
+ - Must be unique within each project
147
+ - Use descriptive, kebab-case naming
148
+ - Examples: "my-unified-app", "contact-summary-card", "lead-scoring-function"
149
+ - Should clearly identify the component's purpose and type
150
+ `,
151
+ },
152
+ envelope: {
153
+ title: "Envelope Layer Architecture",
154
+ content: `
155
+ The envelope layer provides a consistent structure for all components, enabling the system to derive meta information automatically.
156
+
157
+ Envelope Structure:
158
+ {
159
+ "uid": "component-identifier", // Unique ID for component identification
160
+ "type": "component-type", // Type determines component behavior
161
+ "config": { // Component-specific configuration
162
+ // All component-specific settings go here
163
+ }
164
+ }
165
+
166
+ Benefits of Envelope Layer:
167
+ - Consistent metadata extraction across all component types
168
+ - Predictable structure for tooling and validation
169
+ - Clear separation between component identity (uid, type) and configuration
170
+ - Enables automatic component discovery and management
171
+ - Supports hierarchical relationships between components
172
+
173
+ Example App Component (Top-Level):
174
+ {
175
+ "uid": "my-unified-app",
176
+ "type": "app",
177
+ "config": {
178
+ "description": "An example to demonstrate how to build a public app with developer projects.",
179
+ "name": "My unified app",
180
+ "logo": "./app-logo.png",
181
+ "distribution": "A public app",
182
+ "auth": {
183
+ "type": "oauth",
184
+ "redirectUrls": ["http://localhost:3000/oauth-callback"],
185
+ "requiredScopes": ["crm.objects.contacts.read"]
186
+ }
187
+ }
188
+ }
189
+
190
+ Example Sub-Component (Card):
191
+ {
192
+ "uid": "contact-summary-card",
193
+ "type": "cards",
194
+ "config": {
195
+ "title": "Contact Summary",
196
+ "description": "Displays key contact information",
197
+ "displayOptions": {
198
+ "width": "medium",
199
+ "height": "auto"
200
+ }
201
+ }
202
+ }
203
+ `,
204
+ },
205
+ bestPractices: {
206
+ title: "Best Practices & Guidelines",
207
+ content: `
208
+ 1. Hierarchy and Authentication:
209
+ - Always create an app component first (provides authentication)
210
+ - Sub-components must live within the app directory structure
211
+ - Ensure app has sufficient OAuth scopes for all sub-components
212
+ - Consider authentication requirements when planning components
213
+
214
+ 2. Consistency and Predictability:
215
+ - Follow established folder structures exactly
216
+ - Maintain 1:1 relationship between components and configuration files
217
+ - Use consistent naming conventions across all components
218
+ - Ensure each component has a dedicated folder
219
+
220
+ 3. Project Organization:
221
+ - Keep hsproject.json in project root
222
+ - Organize sub-components in their dedicated directories within src/app/
223
+ - Group related functionality (e.g., all cards in cards/ directory)
224
+ - Follow the hierarchical structure religiously
225
+
226
+ 4. Component Configuration:
227
+ - Keep configurations clear and concise
228
+ - Focus on the rules established by the schema
229
+ - Use the envelope layer (uid, type, config) consistently
230
+ - Ensure UIDs are unique and descriptive across all component types
231
+
232
+ 5. File Management:
233
+ - Use meaningful -hsmeta.json file names that reflect component purpose
234
+ - Place sub-component files in appropriate feature directories
235
+ - Include necessary assets (like logos) in component directories
236
+ - Follow kebab-case for consistency
237
+
238
+ 6. Component Development:
239
+ - Start with app component to establish authentication foundation
240
+ - Plan OAuth scopes to cover all intended sub-components
241
+ - Consider component relationships and dependencies
242
+ - Validate component configurations against the schema
243
+ - Remember some components are singular (settings, webhooks) vs. multiple instances (cards, functions)
244
+ `,
245
+ },
246
+ };
247
+ if (section && explanation[section]) {
248
+ const selectedSection = explanation[section];
249
+ return {
250
+ section: section,
251
+ title: selectedSection.title,
252
+ content: selectedSection.content.trim(),
253
+ };
254
+ }
255
+ // Return complete explanation
256
+ return {
257
+ message: "Complete Developer Projects Platform Structure Guide",
258
+ sections: Object.entries(explanation).map(([key, value]) => ({
259
+ section: key,
260
+ title: value.title,
261
+ content: value.content.trim(),
262
+ })),
263
+ };
264
+ }
265
+ }
266
+ export default ExplainProjectStructureTool;
@@ -0,0 +1,99 @@
1
+ import { MCPTool } from "mcp-framework";
2
+ import { z } from "zod";
3
+ interface GenerateAppComponentInput {
4
+ appName: string;
5
+ uid: string;
6
+ description?: string;
7
+ displayName?: string;
8
+ distribution?: string;
9
+ supportEmail?: string;
10
+ documentationUrl?: string;
11
+ supportUrl?: string;
12
+ supportPhone?: string;
13
+ redirectUrls?: string[];
14
+ requiredScopes?: string[];
15
+ optionalScopes?: string[];
16
+ permittedFetchUrls?: string[];
17
+ plannedFeatures?: string[];
18
+ }
19
+ declare class GenerateAppComponentTool extends MCPTool<GenerateAppComponentInput> {
20
+ name: string;
21
+ description: string;
22
+ schema: {
23
+ appName: {
24
+ type: z.ZodString;
25
+ description: string;
26
+ };
27
+ uid: {
28
+ type: z.ZodString;
29
+ description: string;
30
+ };
31
+ description: {
32
+ type: z.ZodOptional<z.ZodString>;
33
+ description: string;
34
+ };
35
+ displayName: {
36
+ type: z.ZodOptional<z.ZodString>;
37
+ description: string;
38
+ };
39
+ distribution: {
40
+ type: z.ZodOptional<z.ZodString>;
41
+ description: string;
42
+ };
43
+ supportEmail: {
44
+ type: z.ZodOptional<z.ZodString>;
45
+ description: string;
46
+ };
47
+ documentationUrl: {
48
+ type: z.ZodOptional<z.ZodString>;
49
+ description: string;
50
+ };
51
+ supportUrl: {
52
+ type: z.ZodOptional<z.ZodString>;
53
+ description: string;
54
+ };
55
+ supportPhone: {
56
+ type: z.ZodOptional<z.ZodString>;
57
+ description: string;
58
+ };
59
+ redirectUrls: {
60
+ type: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
61
+ description: string;
62
+ };
63
+ requiredScopes: {
64
+ type: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
65
+ description: string;
66
+ };
67
+ optionalScopes: {
68
+ type: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
69
+ description: string;
70
+ };
71
+ permittedFetchUrls: {
72
+ type: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
73
+ description: string;
74
+ };
75
+ plannedFeatures: {
76
+ type: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
77
+ description: string;
78
+ };
79
+ };
80
+ execute(input: GenerateAppComponentInput): Promise<{
81
+ message: string;
82
+ config: string;
83
+ folderPath: string;
84
+ fileName: string;
85
+ fullPath: string;
86
+ architecture: {
87
+ componentType: string;
88
+ role: string;
89
+ singularComponent: boolean;
90
+ dependents: string;
91
+ };
92
+ scopeRecommendations: string[];
93
+ nextSteps: string[];
94
+ instructions: string[];
95
+ }>;
96
+ private generateScopeRecommendations;
97
+ private generateNextSteps;
98
+ }
99
+ export default GenerateAppComponentTool;