@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.
- package/bin/cli.js +5 -6
- package/bin/hsmcp.d.ts +2 -0
- package/bin/hsmcp.js +13 -0
- package/commands/account/auth.d.ts +3 -7
- package/commands/account/auth.js +19 -9
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +35 -58
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +12 -8
- package/commands/auth.d.ts +3 -7
- package/commands/auth.js +12 -5
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +24 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +25 -12
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +25 -15
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +20 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +64 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +32 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +40 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +20 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +24 -10
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +12 -5
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +44 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +19 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -27
- package/commands/module.d.ts +3 -1
- package/commands/module.js +22 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +19 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +19 -11
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.js +3 -3
- package/commands/project/deploy.d.ts +1 -0
- package/commands/project/deploy.js +40 -12
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +48 -16
- package/commands/project/dev/unifiedFlow.d.ts +2 -1
- package/commands/project/dev/unifiedFlow.js +85 -30
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +38 -8
- package/commands/project/validate.d.ts +4 -0
- package/commands/project/validate.js +53 -0
- package/commands/project.js +4 -0
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +19 -11
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +20 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +25 -48
- package/commands/setupMcp.d.ts +8 -0
- package/commands/setupMcp.js +229 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +14 -6
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +17 -10
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +16 -9
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +23 -46
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +118 -97
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +76 -65
- package/lang/en.d.ts +838 -574
- package/lang/en.js +630 -373
- package/lang/en.lyaml +30 -23
- package/lib/accountTypes.js +2 -1
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +14 -3
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/configMigrate.js +24 -10
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +7 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +2 -1
- package/lib/filesystem.d.ts +1 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +8 -0
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +6 -0
- package/lib/projectProfiles.js +65 -0
- package/lib/projects/buildAndDeploy.js +17 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +26 -0
- package/lib/projects/localDev/AppDevModeInterface.js +156 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +158 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
- package/lib/projects/localDev/LocalDevProcess.js +171 -0
- package/lib/projects/localDev/LocalDevState.d.ts +37 -0
- package/lib/projects/localDev/LocalDevState.js +78 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +56 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
- package/lib/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +2 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +1 -0
- package/lib/prompts/installAppPrompt.js +35 -0
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +2 -1
- package/lib/prompts/promptUtils.js +2 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/index.d.ts +1 -0
- package/mcp-server/index.js +17 -0
- package/mcp-server/mcpLoader.d.ts +5 -0
- package/mcp-server/mcpLoader.js +24 -0
- package/mcp-server/tools/ExplainProjectStructureTool.d.ts +33 -0
- package/mcp-server/tools/ExplainProjectStructureTool.js +266 -0
- package/mcp-server/tools/GenerateAppComponentTool.d.ts +99 -0
- package/mcp-server/tools/GenerateAppComponentTool.js +193 -0
- package/mcp-server/tools/GenerateCardComponentTool.d.ts +74 -0
- package/mcp-server/tools/GenerateCardComponentTool.js +146 -0
- package/mcp-server/tools/GenerateProjectConfigTool.d.ts +32 -0
- package/mcp-server/tools/GenerateProjectConfigTool.js +40 -0
- package/mcp-server/tools/HubSpotCLIHelper.d.ts +16 -0
- package/mcp-server/tools/HubSpotCLIHelper.js +74 -0
- package/mcp-server/tools/UploadProjectTool.d.ts +44 -0
- package/mcp-server/tools/UploadProjectTool.js +149 -0
- package/mcp-server/tools/ValidateProjectTool.d.ts +62 -0
- package/mcp-server/tools/ValidateProjectTool.js +315 -0
- package/package.json +13 -6
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +24 -0
- package/types/LocalDev.js +2 -0
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +8 -1
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- 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;
|
package/lib/yargsUtils.d.ts
CHANGED
|
@@ -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,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;
|