@frontmcp/nx 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +135 -0
- package/executors/build/build.impl.d.ts +5 -0
- package/executors/build/build.impl.js +27 -0
- package/executors/build/build.impl.js.map +1 -0
- package/executors/build/schema.d.ts +5 -0
- package/executors/build/schema.js +3 -0
- package/executors/build/schema.js.map +1 -0
- package/executors/build/schema.json +22 -0
- package/executors/build-exec/build-exec.impl.d.ts +5 -0
- package/executors/build-exec/build-exec.impl.js +25 -0
- package/executors/build-exec/build-exec.impl.js.map +1 -0
- package/executors/build-exec/schema.d.ts +4 -0
- package/executors/build-exec/schema.js +3 -0
- package/executors/build-exec/schema.js.map +1 -0
- package/executors/build-exec/schema.json +11 -0
- package/executors/deploy/deploy.impl.d.ts +5 -0
- package/executors/deploy/deploy.impl.js +33 -0
- package/executors/deploy/deploy.impl.js.map +1 -0
- package/executors/deploy/schema.d.ts +3 -0
- package/executors/deploy/schema.js +3 -0
- package/executors/deploy/schema.js.map +1 -0
- package/executors/deploy/schema.json +14 -0
- package/executors/dev/dev.impl.d.ts +6 -0
- package/executors/dev/dev.impl.js +30 -0
- package/executors/dev/dev.impl.js.map +1 -0
- package/executors/dev/schema.d.ts +4 -0
- package/executors/dev/schema.js +3 -0
- package/executors/dev/schema.js.map +1 -0
- package/executors/dev/schema.json +11 -0
- package/executors/executor-context.d.ts +19 -0
- package/executors/executor-context.js +3 -0
- package/executors/executor-context.js.map +1 -0
- package/executors/inspector/inspector.impl.d.ts +5 -0
- package/executors/inspector/inspector.impl.js +28 -0
- package/executors/inspector/inspector.impl.js.map +1 -0
- package/executors/inspector/schema.d.ts +3 -0
- package/executors/inspector/schema.js +3 -0
- package/executors/inspector/schema.js.map +1 -0
- package/executors/inspector/schema.json +10 -0
- package/executors/serve/schema.d.ts +5 -0
- package/executors/serve/schema.js +3 -0
- package/executors/serve/schema.js.map +1 -0
- package/executors/serve/schema.json +12 -0
- package/executors/serve/serve.impl.d.ts +5 -0
- package/executors/serve/serve.impl.js +34 -0
- package/executors/serve/serve.impl.js.map +1 -0
- package/executors/test/schema.d.ts +7 -0
- package/executors/test/schema.js +3 -0
- package/executors/test/schema.js.map +1 -0
- package/executors/test/schema.json +14 -0
- package/executors/test/test.impl.d.ts +5 -0
- package/executors/test/test.impl.js +31 -0
- package/executors/test/test.impl.js.map +1 -0
- package/executors.json +39 -0
- package/generators/adapter/adapter.d.ts +4 -0
- package/generators/adapter/adapter.js +18 -0
- package/generators/adapter/adapter.js.map +1 -0
- package/generators/adapter/files/__fileName__.adapter.ts__tmpl__ +20 -0
- package/generators/adapter/schema.d.ts +6 -0
- package/generators/adapter/schema.js +3 -0
- package/generators/adapter/schema.js.map +1 -0
- package/generators/adapter/schema.json +32 -0
- package/generators/agent/agent.d.ts +4 -0
- package/generators/agent/agent.js +27 -0
- package/generators/agent/agent.js.map +1 -0
- package/generators/agent/files/__fileName__.agent.ts__tmpl__ +17 -0
- package/generators/agent/schema.d.ts +8 -0
- package/generators/agent/schema.js +3 -0
- package/generators/agent/schema.js.map +1 -0
- package/generators/agent/schema.json +41 -0
- package/generators/app/app.d.ts +4 -0
- package/generators/app/app.js +21 -0
- package/generators/app/app.js.map +1 -0
- package/generators/app/files/jest.config.ts__tmpl__ +21 -0
- package/generators/app/files/project.json__tmpl__ +37 -0
- package/generators/app/files/src/__fileName__.app.ts__tmpl__ +9 -0
- package/generators/app/files/src/main.ts__tmpl__ +9 -0
- package/generators/app/files/src/tools/hello.tool.ts__tmpl__ +14 -0
- package/generators/app/files/tsconfig.json__tmpl__ +17 -0
- package/generators/app/files/tsconfig.lib.json__tmpl__ +11 -0
- package/generators/app/files/tsconfig.spec.json__tmpl__ +10 -0
- package/generators/app/lib/index.d.ts +2 -0
- package/generators/app/lib/index.js +6 -0
- package/generators/app/lib/index.js.map +1 -0
- package/generators/app/lib/normalize-options.d.ts +12 -0
- package/generators/app/lib/normalize-options.js +20 -0
- package/generators/app/lib/normalize-options.js.map +1 -0
- package/generators/app/schema.d.ts +6 -0
- package/generators/app/schema.js +3 -0
- package/generators/app/schema.js.map +1 -0
- package/generators/app/schema.json +33 -0
- package/generators/auth-provider/auth-provider.d.ts +4 -0
- package/generators/auth-provider/auth-provider.js +22 -0
- package/generators/auth-provider/auth-provider.js.map +1 -0
- package/generators/auth-provider/files/__fileName__.auth-provider.ts__tmpl__ +27 -0
- package/generators/auth-provider/schema.d.ts +7 -0
- package/generators/auth-provider/schema.js +3 -0
- package/generators/auth-provider/schema.js.map +1 -0
- package/generators/auth-provider/schema.json +50 -0
- package/generators/flow/files/__fileName__.flow.ts__tmpl__ +31 -0
- package/generators/flow/flow.d.ts +4 -0
- package/generators/flow/flow.js +18 -0
- package/generators/flow/flow.js.map +1 -0
- package/generators/flow/schema.d.ts +6 -0
- package/generators/flow/schema.js +3 -0
- package/generators/flow/schema.js.map +1 -0
- package/generators/flow/schema.json +32 -0
- package/generators/job/files/__fileName__.job.ts__tmpl__ +19 -0
- package/generators/job/job.d.ts +4 -0
- package/generators/job/job.js +18 -0
- package/generators/job/job.js.map +1 -0
- package/generators/job/schema.d.ts +6 -0
- package/generators/job/schema.js +3 -0
- package/generators/job/schema.js.map +1 -0
- package/generators/job/schema.json +32 -0
- package/generators/lib/files/adapter/src/__fileName__.adapter.ts__tmpl__ +19 -0
- package/generators/lib/files/adapter/src/index.ts__tmpl__ +1 -0
- package/generators/lib/files/generic/src/__fileName__.ts__tmpl__ +5 -0
- package/generators/lib/files/generic/src/index.ts__tmpl__ +1 -0
- package/generators/lib/files/plugin/src/__fileName__.plugin.ts__tmpl__ +19 -0
- package/generators/lib/files/plugin/src/index.ts__tmpl__ +1 -0
- package/generators/lib/files/tool-register/src/__fileName__.tools.ts__tmpl__ +20 -0
- package/generators/lib/files/tool-register/src/index.ts__tmpl__ +1 -0
- package/generators/lib/lib/index.d.ts +2 -0
- package/generators/lib/lib/index.js +6 -0
- package/generators/lib/lib/index.js.map +1 -0
- package/generators/lib/lib/normalize-options.d.ts +15 -0
- package/generators/lib/lib/normalize-options.js +31 -0
- package/generators/lib/lib/normalize-options.js.map +1 -0
- package/generators/lib/lib.d.ts +4 -0
- package/generators/lib/lib.js +37 -0
- package/generators/lib/lib.js.map +1 -0
- package/generators/lib/schema.d.ts +9 -0
- package/generators/lib/schema.js +3 -0
- package/generators/lib/schema.js.map +1 -0
- package/generators/lib/schema.json +59 -0
- package/generators/plugin/files/__fileName__.context-extension.ts__tmpl__ +33 -0
- package/generators/plugin/files/__fileName__.plugin.ts__tmpl__ +19 -0
- package/generators/plugin/plugin.d.ts +4 -0
- package/generators/plugin/plugin.js +29 -0
- package/generators/plugin/plugin.js.map +1 -0
- package/generators/plugin/schema.d.ts +7 -0
- package/generators/plugin/schema.js +3 -0
- package/generators/plugin/schema.js.map +1 -0
- package/generators/plugin/schema.json +37 -0
- package/generators/prompt/files/__fileName__.prompt.ts__tmpl__ +25 -0
- package/generators/prompt/prompt.d.ts +4 -0
- package/generators/prompt/prompt.js +25 -0
- package/generators/prompt/prompt.js.map +1 -0
- package/generators/prompt/schema.d.ts +7 -0
- package/generators/prompt/schema.js +3 -0
- package/generators/prompt/schema.js.map +1 -0
- package/generators/prompt/schema.json +36 -0
- package/generators/provider/files/__fileName__.provider.ts__tmpl__ +15 -0
- package/generators/provider/provider.d.ts +4 -0
- package/generators/provider/provider.js +22 -0
- package/generators/provider/provider.js.map +1 -0
- package/generators/provider/schema.d.ts +7 -0
- package/generators/provider/schema.js +3 -0
- package/generators/provider/schema.js.map +1 -0
- package/generators/provider/schema.json +38 -0
- package/generators/resource/files/__fileName__.resource.ts__tmpl__ +43 -0
- package/generators/resource/resource.d.ts +4 -0
- package/generators/resource/resource.js +20 -0
- package/generators/resource/resource.js.map +1 -0
- package/generators/resource/schema.d.ts +7 -0
- package/generators/resource/schema.js +3 -0
- package/generators/resource/schema.js.map +1 -0
- package/generators/resource/schema.json +37 -0
- package/generators/server/files/cloudflare/wrangler.toml__tmpl__ +6 -0
- package/generators/server/files/common/project.json__tmpl__ +25 -0
- package/generators/server/files/common/src/main.ts__tmpl__ +9 -0
- package/generators/server/files/common/tsconfig.json__tmpl__ +14 -0
- package/generators/server/files/common/tsconfig.lib.json__tmpl__ +11 -0
- package/generators/server/files/lambda/template.yaml__tmpl__ +27 -0
- package/generators/server/files/node/Dockerfile__tmpl__ +17 -0
- package/generators/server/files/node/__dot__dockerignore__tmpl__ +8 -0
- package/generators/server/files/node/docker-compose.yml__tmpl__ +28 -0
- package/generators/server/files/vercel/vercel.json__tmpl__ +15 -0
- package/generators/server/lib/index.d.ts +2 -0
- package/generators/server/lib/index.js +6 -0
- package/generators/server/lib/index.js.map +1 -0
- package/generators/server/lib/normalize-options.d.ts +14 -0
- package/generators/server/lib/normalize-options.js +25 -0
- package/generators/server/lib/normalize-options.js.map +1 -0
- package/generators/server/schema.d.ts +9 -0
- package/generators/server/schema.js +3 -0
- package/generators/server/schema.js.map +1 -0
- package/generators/server/schema.json +62 -0
- package/generators/server/server.d.ts +4 -0
- package/generators/server/server.js +28 -0
- package/generators/server/server.js.map +1 -0
- package/generators/skill/files/__fileName__.skill.ts__tmpl__ +16 -0
- package/generators/skill/schema.d.ts +7 -0
- package/generators/skill/schema.js +3 -0
- package/generators/skill/schema.js.map +1 -0
- package/generators/skill/schema.json +36 -0
- package/generators/skill/skill.d.ts +4 -0
- package/generators/skill/skill.js +25 -0
- package/generators/skill/skill.js.map +1 -0
- package/generators/tool/files/__fileName__.tool.ts__tmpl__ +19 -0
- package/generators/tool/schema.d.ts +6 -0
- package/generators/tool/schema.js +3 -0
- package/generators/tool/schema.js.map +1 -0
- package/generators/tool/schema.json +32 -0
- package/generators/tool/tool.d.ts +4 -0
- package/generators/tool/tool.js +18 -0
- package/generators/tool/tool.js.map +1 -0
- package/generators/workflow/files/__fileName__.workflow.ts__tmpl__ +23 -0
- package/generators/workflow/schema.d.ts +6 -0
- package/generators/workflow/schema.js +3 -0
- package/generators/workflow/schema.js.map +1 -0
- package/generators/workflow/schema.json +32 -0
- package/generators/workflow/workflow.d.ts +4 -0
- package/generators/workflow/workflow.js +18 -0
- package/generators/workflow/workflow.js.map +1 -0
- package/generators/workspace/files/__dot__gitignore__tmpl__ +28 -0
- package/generators/workspace/files/__dot__prettierrc__tmpl__ +6 -0
- package/generators/workspace/files/nx.json__tmpl__ +52 -0
- package/generators/workspace/files/package.json__tmpl__ +46 -0
- package/generators/workspace/files/tsconfig.base.json__tmpl__ +24 -0
- package/generators/workspace/lib/index.d.ts +2 -0
- package/generators/workspace/lib/index.js +6 -0
- package/generators/workspace/lib/index.js.map +1 -0
- package/generators/workspace/lib/normalize-options.d.ts +5 -0
- package/generators/workspace/lib/normalize-options.js +14 -0
- package/generators/workspace/lib/normalize-options.js.map +1 -0
- package/generators/workspace/schema.d.ts +7 -0
- package/generators/workspace/schema.js +3 -0
- package/generators/workspace/schema.js.map +1 -0
- package/generators/workspace/schema.json +42 -0
- package/generators/workspace/workspace.d.ts +4 -0
- package/generators/workspace/workspace.js +47 -0
- package/generators/workspace/workspace.js.map +1 -0
- package/generators.json +84 -0
- package/index.d.ts +16 -0
- package/index.js +44 -0
- package/index.js.map +1 -0
- package/package.json +24 -0
- package/utils/add-dependencies.d.ts +2 -0
- package/utils/add-dependencies.js +8 -0
- package/utils/add-dependencies.js.map +1 -0
- package/utils/names.d.ts +5 -0
- package/utils/names.js +27 -0
- package/utils/names.js.map +1 -0
- package/utils/normalize-options.d.ts +16 -0
- package/utils/normalize-options.js +30 -0
- package/utils/normalize-options.js.map +1 -0
- package/utils/versions.d.ts +5 -0
- package/utils/versions.js +65 -0
- package/utils/versions.js.map +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"title": "FrontMCP Dev Server",
|
|
4
|
+
"description": "Start a development server",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"entry": { "type": "string", "description": "Entry file path" },
|
|
8
|
+
"port": { "type": "number", "description": "Port to listen on" }
|
|
9
|
+
},
|
|
10
|
+
"required": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal ExecutorContext type to avoid importing @nx/devkit at runtime in executor files.
|
|
3
|
+
* The full type is only needed at build time.
|
|
4
|
+
*/
|
|
5
|
+
export interface ExecutorContext {
|
|
6
|
+
root: string;
|
|
7
|
+
cwd: string;
|
|
8
|
+
projectName?: string;
|
|
9
|
+
isVerbose: boolean;
|
|
10
|
+
projectsConfigurations?: {
|
|
11
|
+
version: number;
|
|
12
|
+
projects: Record<string, {
|
|
13
|
+
root: string;
|
|
14
|
+
sourceRoot?: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
projectGraph: unknown;
|
|
18
|
+
nxJsonConfiguration: unknown;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-context.js","sourceRoot":"","sources":["../../../src/executors/executor-context.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Minimal ExecutorContext type to avoid importing @nx/devkit at runtime in executor files.\n * The full type is only needed at build time.\n */\nexport interface ExecutorContext {\n root: string;\n cwd: string;\n projectName?: string;\n isVerbose: boolean;\n projectsConfigurations?: {\n version: number;\n projects: Record<string, { root: string; sourceRoot?: string }>;\n };\n projectGraph: unknown;\n nxJsonConfiguration: unknown;\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ExecutorContext } from '../executor-context.js';
|
|
2
|
+
import type { InspectorExecutorSchema } from './schema.js';
|
|
3
|
+
export default function inspectorExecutor(options: InspectorExecutorSchema, context: ExecutorContext): AsyncGenerator<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = inspectorExecutor;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
async function* inspectorExecutor(options, context) {
|
|
6
|
+
const args = ['frontmcp', 'inspector'];
|
|
7
|
+
if (options.port !== undefined)
|
|
8
|
+
args.push('--port', String(options.port));
|
|
9
|
+
console.log(`Running: npx ${args.join(' ')}`);
|
|
10
|
+
const child = (0, child_process_1.spawn)(process.platform === 'win32' ? 'npx.cmd' : 'npx', args, {
|
|
11
|
+
cwd: context.root,
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
env: { ...process.env, FORCE_COLOR: '1' },
|
|
14
|
+
});
|
|
15
|
+
yield { success: true };
|
|
16
|
+
try {
|
|
17
|
+
const exitCode = await new Promise((resolve) => {
|
|
18
|
+
child.on('error', () => resolve(1));
|
|
19
|
+
child.on('close', (code) => resolve(code ?? 1));
|
|
20
|
+
});
|
|
21
|
+
yield { success: exitCode === 0 };
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
if (!child.killed)
|
|
25
|
+
child.kill();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=inspector.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector.impl.js","sourceRoot":"","sources":["../../../../src/executors/inspector/inspector.impl.ts"],"names":[],"mappings":";;AAIA,oCA2BC;AA9BD,iDAAsC;AAGvB,KAAK,SAAS,CAAC,CAAC,iBAAiB,CAC9C,OAAgC,EAChC,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1E,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE;QAC1E,GAAG,EAAE,OAAO,CAAC,IAAI;QACjB,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE;KAC1C,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAExB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;YACrD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAK,CAAC,EAAE,CAAC;IACpC,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { spawn } from 'child_process';\nimport type { InspectorExecutorSchema } from './schema.js';\n\nexport default async function* inspectorExecutor(\n options: InspectorExecutorSchema,\n context: ExecutorContext,\n): AsyncGenerator<{ success: boolean }> {\n const args: string[] = ['frontmcp', 'inspector'];\n if (options.port !== undefined) args.push('--port', String(options.port));\n\n console.log(`Running: npx ${args.join(' ')}`);\n\n const child = spawn(process.platform === 'win32' ? 'npx.cmd' : 'npx', args, {\n cwd: context.root,\n stdio: 'inherit',\n env: { ...process.env, FORCE_COLOR: '1' },\n });\n\n yield { success: true };\n\n try {\n const exitCode = await new Promise<number>((resolve) => {\n child.on('error', () => resolve(1));\n child.on('close', (code) => resolve(code ?? 1));\n });\n\n yield { success: exitCode === 0 };\n } finally {\n if (!child.killed) child.kill();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/executors/inspector/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface InspectorExecutorSchema {\n port?: number;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/executors/serve/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface ServeExecutorSchema {\n entry?: string;\n port?: number;\n maxRestarts?: number;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"title": "FrontMCP Serve",
|
|
4
|
+
"description": "Start a supervised production server",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"entry": { "type": "string", "description": "Entry file path" },
|
|
8
|
+
"port": { "type": "number", "description": "Port to listen on" },
|
|
9
|
+
"maxRestarts": { "type": "number", "description": "Maximum number of restarts", "default": 5 }
|
|
10
|
+
},
|
|
11
|
+
"required": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = serveExecutor;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
async function* serveExecutor(options, context) {
|
|
6
|
+
const args = ['frontmcp', 'start'];
|
|
7
|
+
if (context.projectName)
|
|
8
|
+
args.push(context.projectName);
|
|
9
|
+
if (options.entry)
|
|
10
|
+
args.push('--entry', options.entry);
|
|
11
|
+
if (options.port !== undefined)
|
|
12
|
+
args.push('--port', String(options.port));
|
|
13
|
+
if (options.maxRestarts !== undefined)
|
|
14
|
+
args.push('--max-restarts', String(options.maxRestarts));
|
|
15
|
+
console.log(`Running: npx ${args.join(' ')}`);
|
|
16
|
+
const child = (0, child_process_1.spawn)(process.platform === 'win32' ? 'npx.cmd' : 'npx', args, {
|
|
17
|
+
cwd: context.root,
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
env: { ...process.env, FORCE_COLOR: '1' },
|
|
20
|
+
});
|
|
21
|
+
yield { success: true };
|
|
22
|
+
try {
|
|
23
|
+
const exitCode = await new Promise((resolve) => {
|
|
24
|
+
child.on('error', () => resolve(1));
|
|
25
|
+
child.on('close', (code) => resolve(code ?? 1));
|
|
26
|
+
});
|
|
27
|
+
yield { success: exitCode === 0 };
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
if (!child.killed)
|
|
31
|
+
child.kill();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=serve.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.impl.js","sourceRoot":"","sources":["../../../../src/executors/serve/serve.impl.ts"],"names":[],"mappings":";;AAIA,gCA8BC;AAjCD,iDAAsC;AAGvB,KAAK,SAAS,CAAC,CAAC,aAAa,CAC1C,OAA4B,EAC5B,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,OAAO,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACxD,IAAI,OAAO,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAEhG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE;QAC1E,GAAG,EAAE,OAAO,CAAC,IAAI;QACjB,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE;KAC1C,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAExB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;YACrD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAK,CAAC,EAAE,CAAC;IACpC,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { spawn } from 'child_process';\nimport type { ServeExecutorSchema } from './schema.js';\n\nexport default async function* serveExecutor(\n options: ServeExecutorSchema,\n context: ExecutorContext,\n): AsyncGenerator<{ success: boolean }> {\n const args: string[] = ['frontmcp', 'start'];\n if (context.projectName) args.push(context.projectName);\n if (options.entry) args.push('--entry', options.entry);\n if (options.port !== undefined) args.push('--port', String(options.port));\n if (options.maxRestarts !== undefined) args.push('--max-restarts', String(options.maxRestarts));\n\n console.log(`Running: npx ${args.join(' ')}`);\n\n const child = spawn(process.platform === 'win32' ? 'npx.cmd' : 'npx', args, {\n cwd: context.root,\n stdio: 'inherit',\n env: { ...process.env, FORCE_COLOR: '1' },\n });\n\n yield { success: true };\n\n try {\n const exitCode = await new Promise<number>((resolve) => {\n child.on('error', () => resolve(1));\n child.on('close', (code) => resolve(code ?? 1));\n });\n\n yield { success: exitCode === 0 };\n } finally {\n if (!child.killed) child.kill();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/executors/test/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface TestExecutorSchema {\n runInBand?: boolean;\n watch?: boolean;\n coverage?: boolean;\n verbose?: boolean;\n timeout?: number;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"title": "FrontMCP Test",
|
|
4
|
+
"description": "Run E2E tests",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"runInBand": { "type": "boolean", "description": "Run tests serially", "default": false },
|
|
8
|
+
"watch": { "type": "boolean", "description": "Watch mode", "default": false },
|
|
9
|
+
"coverage": { "type": "boolean", "description": "Collect coverage", "default": false },
|
|
10
|
+
"verbose": { "type": "boolean", "description": "Verbose output", "default": false },
|
|
11
|
+
"timeout": { "type": "number", "description": "Test timeout in ms" }
|
|
12
|
+
},
|
|
13
|
+
"required": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = testExecutor;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
async function testExecutor(options, context) {
|
|
6
|
+
const args = ['npx', 'frontmcp', 'test'];
|
|
7
|
+
if (options.runInBand)
|
|
8
|
+
args.push('--runInBand');
|
|
9
|
+
if (options.watch)
|
|
10
|
+
args.push('--watch');
|
|
11
|
+
if (options.coverage)
|
|
12
|
+
args.push('--coverage');
|
|
13
|
+
if (options.verbose)
|
|
14
|
+
args.push('--verbose');
|
|
15
|
+
if (options.timeout)
|
|
16
|
+
args.push('--timeout', String(options.timeout));
|
|
17
|
+
const command = args.join(' ');
|
|
18
|
+
console.log(`Running: ${command}`);
|
|
19
|
+
try {
|
|
20
|
+
(0, child_process_1.execSync)(command, {
|
|
21
|
+
cwd: context.root,
|
|
22
|
+
stdio: 'inherit',
|
|
23
|
+
env: { ...process.env, FORCE_COLOR: '1' },
|
|
24
|
+
});
|
|
25
|
+
return { success: true };
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return { success: false };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=test.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.impl.js","sourceRoot":"","sources":["../../../../src/executors/test/test.impl.ts"],"names":[],"mappings":";;AAIA,+BAwBC;AA3BD,iDAAyC;AAG1B,KAAK,UAAU,YAAY,CACxC,OAA2B,EAC3B,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,IAAI,OAAO,CAAC,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,OAAO,CAAC,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,IAAI,OAAO,CAAC,OAAO;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5C,IAAI,OAAO,CAAC,OAAO;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAErE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,IAAA,wBAAQ,EAAC,OAAO,EAAE;YAChB,GAAG,EAAE,OAAO,CAAC,IAAI;YACjB,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE;SAC1C,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { execSync } from 'child_process';\nimport type { TestExecutorSchema } from './schema.js';\n\nexport default async function testExecutor(\n options: TestExecutorSchema,\n context: ExecutorContext,\n): Promise<{ success: boolean }> {\n const args: string[] = ['npx', 'frontmcp', 'test'];\n if (options.runInBand) args.push('--runInBand');\n if (options.watch) args.push('--watch');\n if (options.coverage) args.push('--coverage');\n if (options.verbose) args.push('--verbose');\n if (options.timeout) args.push('--timeout', String(options.timeout));\n\n const command = args.join(' ');\n console.log(`Running: ${command}`);\n\n try {\n execSync(command, {\n cwd: context.root,\n stdio: 'inherit',\n env: { ...process.env, FORCE_COLOR: '1' },\n });\n return { success: true };\n } catch {\n return { success: false };\n }\n}\n"]}
|
package/executors.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"executors": {
|
|
3
|
+
"build": {
|
|
4
|
+
"implementation": "./executors/build/build.impl",
|
|
5
|
+
"schema": "./executors/build/schema.json",
|
|
6
|
+
"description": "Compile a FrontMCP project using frontmcp build"
|
|
7
|
+
},
|
|
8
|
+
"build-exec": {
|
|
9
|
+
"implementation": "./executors/build-exec/build-exec.impl",
|
|
10
|
+
"schema": "./executors/build-exec/schema.json",
|
|
11
|
+
"description": "Build a distributable bundle using frontmcp build --exec"
|
|
12
|
+
},
|
|
13
|
+
"dev": {
|
|
14
|
+
"implementation": "./executors/dev/dev.impl",
|
|
15
|
+
"schema": "./executors/dev/schema.json",
|
|
16
|
+
"description": "Start a development server using frontmcp dev"
|
|
17
|
+
},
|
|
18
|
+
"serve": {
|
|
19
|
+
"implementation": "./executors/serve/serve.impl",
|
|
20
|
+
"schema": "./executors/serve/schema.json",
|
|
21
|
+
"description": "Start a supervised production server using frontmcp start"
|
|
22
|
+
},
|
|
23
|
+
"test": {
|
|
24
|
+
"implementation": "./executors/test/test.impl",
|
|
25
|
+
"schema": "./executors/test/schema.json",
|
|
26
|
+
"description": "Run E2E tests using frontmcp test"
|
|
27
|
+
},
|
|
28
|
+
"inspector": {
|
|
29
|
+
"implementation": "./executors/inspector/inspector.impl",
|
|
30
|
+
"schema": "./executors/inspector/schema.json",
|
|
31
|
+
"description": "Launch MCP Inspector using frontmcp inspector"
|
|
32
|
+
},
|
|
33
|
+
"deploy": {
|
|
34
|
+
"implementation": "./executors/deploy/deploy.impl",
|
|
35
|
+
"schema": "./executors/deploy/schema.json",
|
|
36
|
+
"description": "Deploy to a target platform (node/vercel/lambda/cloudflare)"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import type { AdapterGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function adapterGenerator(tree: Tree, schema: AdapterGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
|
+
export default adapterGenerator;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adapterGenerator = adapterGenerator;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const normalize_options_js_1 = require("../../utils/normalize-options.js");
|
|
7
|
+
async function adapterGenerator(tree, schema) {
|
|
8
|
+
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'adapters');
|
|
9
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
10
|
+
...options,
|
|
11
|
+
tmpl: '',
|
|
12
|
+
});
|
|
13
|
+
if (!schema.skipFormat) {
|
|
14
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = adapterGenerator;
|
|
18
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/generators/adapter/adapter.ts"],"names":[],"mappings":";;AAKA,4CAWC;AAhBD,uCAA2F;AAC3F,+BAA4B;AAE5B,2EAA6E;AAEtE,KAAK,UAAU,gBAAgB,CAAC,IAAU,EAAE,MAA8B;IAC/E,MAAM,OAAO,GAAG,IAAA,gDAAyB,EAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAEpE,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE;QAC/D,GAAG,OAAO;QACV,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,kBAAe,gBAAgB,CAAC","sourcesContent":["import { type Tree, formatFiles, generateFiles, type GeneratorCallback } from '@nx/devkit';\nimport { join } from 'path';\nimport type { AdapterGeneratorSchema } from './schema.js';\nimport { normalizePrimitiveOptions } from '../../utils/normalize-options.js';\n\nexport async function adapterGenerator(tree: Tree, schema: AdapterGeneratorSchema): Promise<GeneratorCallback | void> {\n const options = normalizePrimitiveOptions(tree, schema, 'adapters');\n\n generateFiles(tree, join(__dirname, 'files'), options.directory, {\n ...options,\n tmpl: '',\n });\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default adapterGenerator;\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Adapter, DynamicAdapter, type AdapterFetchResult } from '@frontmcp/sdk';
|
|
2
|
+
|
|
3
|
+
export interface <%= className %>AdapterOptions {
|
|
4
|
+
// TODO: define adapter options
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@Adapter({
|
|
8
|
+
name: '<%= fileName %>',
|
|
9
|
+
description: 'TODO: describe what this adapter does',
|
|
10
|
+
})
|
|
11
|
+
export class <%= className %>Adapter extends DynamicAdapter<<%= className %>AdapterOptions> {
|
|
12
|
+
async fetch(): Promise<AdapterFetchResult> {
|
|
13
|
+
// TODO: implement — return tools, resources, and/or prompts
|
|
14
|
+
return {
|
|
15
|
+
tools: [],
|
|
16
|
+
resources: [],
|
|
17
|
+
prompts: [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/generators/adapter/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface AdapterGeneratorSchema {\n name: string;\n project: string;\n directory?: string;\n skipFormat?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "FrontMcpAdapter",
|
|
4
|
+
"title": "FrontMCP Adapter Generator",
|
|
5
|
+
"description": "Generate an @Adapter class extending DynamicAdapter",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the adapter",
|
|
11
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
12
|
+
"x-prompt": "What name would you like for the adapter?",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The project to add the adapter to",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"directory": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Subdirectory within src/adapters/"
|
|
24
|
+
},
|
|
25
|
+
"skipFormat": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false,
|
|
28
|
+
"x-priority": "internal"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["name", "project"]
|
|
32
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import type { AgentGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function agentGenerator(tree: Tree, schema: AgentGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
|
+
export default agentGenerator;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentGenerator = agentGenerator;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const normalize_options_js_1 = require("../../utils/normalize-options.js");
|
|
7
|
+
async function agentGenerator(tree, schema) {
|
|
8
|
+
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'agents');
|
|
9
|
+
const model = schema.model ?? 'gpt-4';
|
|
10
|
+
const toolRefs = schema.tools
|
|
11
|
+
? schema.tools
|
|
12
|
+
.split(',')
|
|
13
|
+
.map((t) => t.trim())
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
: [];
|
|
16
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
17
|
+
...options,
|
|
18
|
+
model,
|
|
19
|
+
toolRefs,
|
|
20
|
+
tmpl: '',
|
|
21
|
+
});
|
|
22
|
+
if (!schema.skipFormat) {
|
|
23
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = agentGenerator;
|
|
27
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/generators/agent/agent.ts"],"names":[],"mappings":";;AAKA,wCAoBC;AAzBD,uCAA2F;AAC3F,+BAA4B;AAE5B,2EAA6E;AAEtE,KAAK,UAAU,cAAc,CAAC,IAAU,EAAE,MAA4B;IAC3E,MAAM,OAAO,GAAG,IAAA,gDAAyB,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK;QAC3B,CAAC,CAAC,MAAM,CAAC,KAAK;aACT,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,OAAO,CAAC;QACpB,CAAC,CAAC,EAAE,CAAC;IAEP,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE;QAC/D,GAAG,OAAO;QACV,KAAK;QACL,QAAQ;QACR,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,kBAAe,cAAc,CAAC","sourcesContent":["import { type Tree, formatFiles, generateFiles, type GeneratorCallback } from '@nx/devkit';\nimport { join } from 'path';\nimport type { AgentGeneratorSchema } from './schema.js';\nimport { normalizePrimitiveOptions } from '../../utils/normalize-options.js';\n\nexport async function agentGenerator(tree: Tree, schema: AgentGeneratorSchema): Promise<GeneratorCallback | void> {\n const options = normalizePrimitiveOptions(tree, schema, 'agents');\n const model = schema.model ?? 'gpt-4';\n const toolRefs = schema.tools\n ? schema.tools\n .split(',')\n .map((t) => t.trim())\n .filter(Boolean)\n : [];\n\n generateFiles(tree, join(__dirname, 'files'), options.directory, {\n ...options,\n model,\n toolRefs,\n tmpl: '',\n });\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default agentGenerator;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Agent, AgentContext } from '@frontmcp/sdk';
|
|
2
|
+
|
|
3
|
+
@Agent({
|
|
4
|
+
name: '<%= name %>',
|
|
5
|
+
description: 'TODO: describe what this agent does',
|
|
6
|
+
llm: {
|
|
7
|
+
model: '<%= model %>',
|
|
8
|
+
},<% if (toolRefs.length > 0) { %>
|
|
9
|
+
tools: [<%- toolRefs.map(t => `'${t}'`).join(', ') %>],<% } %>
|
|
10
|
+
systemInstructions: 'TODO: define system instructions for this agent',
|
|
11
|
+
})
|
|
12
|
+
export default class <%= className %>Agent extends AgentContext {
|
|
13
|
+
async execute(input: unknown): Promise<unknown> {
|
|
14
|
+
// TODO: implement agent logic
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/generators/agent/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface AgentGeneratorSchema {\n name: string;\n project: string;\n model?: string;\n tools?: string;\n directory?: string;\n skipFormat?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "FrontMcpAgent",
|
|
4
|
+
"title": "FrontMCP Agent Generator",
|
|
5
|
+
"description": "Generate an @Agent class",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the agent",
|
|
11
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
12
|
+
"x-prompt": "What name would you like for the agent?",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The project to add the agent to",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"model": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The LLM model name",
|
|
24
|
+
"default": "gpt-4"
|
|
25
|
+
},
|
|
26
|
+
"tools": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Comma-separated tool names to reference"
|
|
29
|
+
},
|
|
30
|
+
"directory": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Subdirectory within src/agents/"
|
|
33
|
+
},
|
|
34
|
+
"skipFormat": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"default": false,
|
|
37
|
+
"x-priority": "internal"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"required": ["name", "project"]
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appGenerator = appGenerator;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const index_js_1 = require("./lib/index.js");
|
|
7
|
+
async function appGenerator(tree, schema) {
|
|
8
|
+
return appGeneratorInternal(tree, schema);
|
|
9
|
+
}
|
|
10
|
+
async function appGeneratorInternal(tree, schema) {
|
|
11
|
+
const options = (0, index_js_1.normalizeOptions)(schema);
|
|
12
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.projectRoot, {
|
|
13
|
+
...options,
|
|
14
|
+
tmpl: '',
|
|
15
|
+
});
|
|
16
|
+
if (!options.skipFormat) {
|
|
17
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = appGenerator;
|
|
21
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/generators/app/app.ts"],"names":[],"mappings":";;AAKA,oCAEC;AAPD,uCAA2F;AAC3F,+BAA4B;AAE5B,6CAAkD;AAE3C,KAAK,UAAU,YAAY,CAAC,IAAU,EAAE,MAA0B;IACvE,OAAO,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,IAAU,EAAE,MAA0B;IACxE,MAAM,OAAO,GAAG,IAAA,2BAAgB,EAAC,MAAM,CAAC,CAAC;IAEzC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE;QACjE,GAAG,OAAO;QACV,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,kBAAe,YAAY,CAAC","sourcesContent":["import { type Tree, formatFiles, generateFiles, type GeneratorCallback } from '@nx/devkit';\nimport { join } from 'path';\nimport type { AppGeneratorSchema } from './schema.js';\nimport { normalizeOptions } from './lib/index.js';\n\nexport async function appGenerator(tree: Tree, schema: AppGeneratorSchema): Promise<GeneratorCallback | void> {\n return appGeneratorInternal(tree, schema);\n}\n\nasync function appGeneratorInternal(tree: Tree, schema: AppGeneratorSchema): Promise<GeneratorCallback | void> {\n const options = normalizeOptions(schema);\n\n generateFiles(tree, join(__dirname, 'files'), options.projectRoot, {\n ...options,\n tmpl: '',\n });\n\n if (!options.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default appGenerator;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
displayName: '<%= projectName %>',
|
|
3
|
+
preset: '../../jest.preset.js',
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
transform: {
|
|
6
|
+
'^.+\\.[tj]s$': ['@swc/jest', {
|
|
7
|
+
jsc: {
|
|
8
|
+
target: 'es2022',
|
|
9
|
+
parser: { syntax: 'typescript', decorators: true, dynamicImport: true },
|
|
10
|
+
transform: { decoratorMetadata: true, legacyDecorator: true },
|
|
11
|
+
keepClassNames: true,
|
|
12
|
+
externalHelpers: true,
|
|
13
|
+
loose: true,
|
|
14
|
+
},
|
|
15
|
+
module: { type: 'es6' },
|
|
16
|
+
sourceMaps: true,
|
|
17
|
+
swcrc: false,
|
|
18
|
+
}],
|
|
19
|
+
},
|
|
20
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
21
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= projectName %>",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "<%= projectRoot %>/src",
|
|
5
|
+
"projectType": "application",
|
|
6
|
+
"tags": [<%- parsedTags.map(t => `"${t}"`).join(', ') %>],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@frontmcp/nx:build",
|
|
10
|
+
"outputs": ["{projectRoot}/dist"],
|
|
11
|
+
"options": {
|
|
12
|
+
"entry": "{projectRoot}/src/main.ts",
|
|
13
|
+
"outputPath": "{projectRoot}/dist"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dev": {
|
|
17
|
+
"executor": "@frontmcp/nx:dev",
|
|
18
|
+
"options": {
|
|
19
|
+
"entry": "{projectRoot}/src/main.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"serve": {
|
|
23
|
+
"executor": "@frontmcp/nx:serve",
|
|
24
|
+
"options": {
|
|
25
|
+
"entry": "{projectRoot}/src/main.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"test": {
|
|
29
|
+
"executor": "@frontmcp/nx:test",
|
|
30
|
+
"options": {}
|
|
31
|
+
},
|
|
32
|
+
"inspector": {
|
|
33
|
+
"executor": "@frontmcp/nx:inspector",
|
|
34
|
+
"options": {}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|