@frontmcp/nx 1.8.6 → 1.8.7
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/executors/build/build.impl.js +9 -19
- package/executors/build/build.impl.js.map +1 -1
- package/executors/build/schema.d.ts +2 -0
- package/executors/build/schema.js.map +1 -1
- package/executors/build/schema.json +22 -2
- package/executors/build-exec/build-exec.impl.js +5 -17
- package/executors/build-exec/build-exec.impl.js.map +1 -1
- package/executors/deploy/deploy.impl.js.map +1 -1
- package/executors/dev/dev.impl.js +11 -17
- package/executors/dev/dev.impl.js.map +1 -1
- package/executors/frontmcp-cli.d.ts +31 -0
- package/executors/frontmcp-cli.js +108 -0
- package/executors/frontmcp-cli.js.map +1 -0
- package/executors/inspector/inspector.impl.js +10 -18
- package/executors/inspector/inspector.impl.js.map +1 -1
- package/executors/serve/serve.impl.js +11 -17
- package/executors/serve/serve.impl.js.map +1 -1
- package/executors/test/test.impl.js +3 -15
- package/executors/test/test.impl.js.map +1 -1
- package/generators/adapter/files/__fileName__.adapter.ts__tmpl__ +9 -2
- package/generators/agent/agent.d.ts +1 -1
- package/generators/agent/agent.js +21 -7
- package/generators/agent/agent.js.map +1 -1
- package/generators/agent/files/__fileName__.agent.ts__tmpl__ +12 -6
- package/generators/app/app.d.ts +1 -1
- package/generators/app/app.js +3 -3
- package/generators/app/app.js.map +1 -1
- package/generators/app/files/jest.config.cjs__tmpl__ +37 -0
- package/generators/app/files/package.json__tmpl__ +5 -0
- package/generators/app/files/project.json__tmpl__ +3 -1
- package/generators/app/files/tsconfig.json__tmpl__ +6 -9
- package/generators/app/files/tsconfig.lib.json__tmpl__ +1 -2
- package/generators/app/files/tsconfig.spec.json__tmpl__ +3 -4
- package/generators/app/lib/normalize-options.d.ts +8 -1
- package/generators/app/lib/normalize-options.js +7 -2
- package/generators/app/lib/normalize-options.js.map +1 -1
- package/generators/app/schema.d.ts +2 -0
- package/generators/app/schema.js.map +1 -1
- package/generators/app/schema.json +5 -0
- package/generators/auth-provider/files/__fileName__.auth-provider.ts__tmpl__ +0 -1
- package/generators/flow/files/__fileName__.flow.ts__tmpl__ +54 -16
- package/generators/init/init.d.ts +4 -0
- package/generators/init/init.js +40 -0
- package/generators/init/init.js.map +1 -0
- package/generators/init/schema.d.ts +4 -0
- package/generators/init/schema.js +3 -0
- package/generators/init/schema.js.map +1 -0
- package/generators/init/schema.json +21 -0
- package/generators/lib/lib/normalize-options.d.ts +4 -1
- package/generators/lib/lib/normalize-options.js +5 -2
- package/generators/lib/lib/normalize-options.js.map +1 -1
- package/generators/lib/lib-project-files/jest.config.cjs__tmpl__ +39 -0
- package/generators/lib/lib-project-files/project.json__tmpl__ +16 -0
- package/generators/lib/lib-project-files/tsconfig.json__tmpl__ +15 -0
- package/generators/lib/lib-project-files/tsconfig.lib.json__tmpl__ +11 -0
- package/generators/lib/lib-project-files/tsconfig.spec.json__tmpl__ +11 -0
- package/generators/lib/lib.js +1 -1
- package/generators/lib/lib.js.map +1 -1
- package/generators/plugin/files/__fileName__.plugin.ts__tmpl__ +9 -5
- package/generators/provider/files/__fileName__.provider.ts__tmpl__ +5 -9
- package/generators/provider/provider.d.ts +1 -1
- package/generators/provider/provider.js +3 -3
- package/generators/provider/provider.js.map +1 -1
- package/generators/server/files/common/package.json__tmpl__ +5 -0
- package/generators/server/files/common/project.json__tmpl__ +3 -2
- package/generators/server/files/common/src/main.ts__tmpl__ +2 -2
- package/generators/server/files/common/tsconfig.json__tmpl__ +6 -8
- package/generators/server/files/common/tsconfig.lib.json__tmpl__ +0 -1
- package/generators/server/lib/normalize-options.d.ts +9 -1
- package/generators/server/lib/normalize-options.js +15 -2
- package/generators/server/lib/normalize-options.js.map +1 -1
- package/generators/server/server.d.ts +1 -1
- package/generators/server/server.js +2 -2
- package/generators/server/server.js.map +1 -1
- package/generators/ui-component/files/__className__/__className__.tsx__tmpl__ +0 -1
- package/generators/ui-component/ui-component.d.ts +1 -1
- package/generators/ui-component/ui-component.js +4 -1
- package/generators/ui-component/ui-component.js.map +1 -1
- package/generators/ui-page/ui-page.d.ts +1 -1
- package/generators/ui-page/ui-page.js +4 -1
- package/generators/ui-page/ui-page.js.map +1 -1
- package/generators/ui-shared/add-ui-entry.js.map +1 -1
- package/generators/ui-shared/ensure-ui-package.d.ts +17 -0
- package/generators/ui-shared/ensure-ui-package.js +120 -0
- package/generators/ui-shared/ensure-ui-package.js.map +1 -0
- package/generators/ui-shell/files/__fileName__/__fileName__.shell.spec.ts__tmpl__ +2 -1
- package/generators/ui-shell/ui-shell.d.ts +1 -1
- package/generators/ui-shell/ui-shell.js +4 -1
- package/generators/ui-shell/ui-shell.js.map +1 -1
- package/generators/workspace/files/nx.json__tmpl__ +15 -1
- package/generators/workspace/files/package.json__tmpl__ +3 -3
- package/generators/workspace/workspace.d.ts +1 -1
- package/generators/workspace/workspace.js +3 -2
- package/generators/workspace/workspace.js.map +1 -1
- package/generators.json +5 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/utils/add-dependencies.d.ts +4 -2
- package/utils/add-dependencies.js +2 -2
- package/utils/add-dependencies.js.map +1 -1
- package/utils/normalize-options.js.map +1 -1
- package/utils/project-paths.d.ts +20 -0
- package/utils/project-paths.js +56 -0
- package/utils/project-paths.js.map +1 -0
- package/utils/versions.d.ts +2 -0
- package/utils/versions.js +17 -5
- package/utils/versions.js.map +1 -1
- package/generators/app/files/jest.config.ts__tmpl__ +0 -23
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = buildExecutor;
|
|
4
|
-
const
|
|
4
|
+
const frontmcp_cli_js_1 = require("../frontmcp-cli.js");
|
|
5
5
|
async function buildExecutor(options, context) {
|
|
6
|
-
const args = ['
|
|
6
|
+
const args = ['build'];
|
|
7
|
+
// `adapter` is the old spelling of `target`; the CLI has no `--adapter` flag.
|
|
8
|
+
const target = options.target ?? options.adapter;
|
|
9
|
+
if (target)
|
|
10
|
+
args.push('--target', target);
|
|
7
11
|
if (options.entry)
|
|
8
|
-
args.push('--entry', options.entry);
|
|
12
|
+
args.push('--entry', (0, frontmcp_cli_js_1.toAbsolute)(context, options.entry));
|
|
9
13
|
if (options.outputPath)
|
|
10
|
-
args.push('--out-dir', options.outputPath);
|
|
11
|
-
|
|
12
|
-
args.push('--adapter', options.adapter);
|
|
13
|
-
const command = args.join(' ');
|
|
14
|
-
console.log(`Running: ${command}`);
|
|
15
|
-
try {
|
|
16
|
-
(0, child_process_1.execSync)(command, {
|
|
17
|
-
cwd: context.root,
|
|
18
|
-
stdio: 'inherit',
|
|
19
|
-
env: { ...process.env, FORCE_COLOR: '1' },
|
|
20
|
-
});
|
|
21
|
-
return { success: true };
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return { success: false };
|
|
25
|
-
}
|
|
14
|
+
args.push('--out-dir', (0, frontmcp_cli_js_1.toAbsolute)(context, options.outputPath));
|
|
15
|
+
return (0, frontmcp_cli_js_1.runFrontmcp)(context, args);
|
|
26
16
|
}
|
|
27
17
|
//# sourceMappingURL=build.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../src/executors/build/build.impl.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../src/executors/build/build.impl.ts"],"names":[],"mappings":";;AAIA,gCAWC;AAdD,wDAA6D;AAG9C,KAAK,UAAU,aAAa,CACzC,OAA4B,EAC5B,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,OAAO,CAAC,CAAC;IACjC,8EAA8E;IAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IACjD,IAAI,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC1C,IAAI,OAAO,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAA,4BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAA,4BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACxF,OAAO,IAAA,6BAAW,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { runFrontmcp, toAbsolute } from '../frontmcp-cli.js';\nimport type { BuildExecutorSchema } from './schema.js';\n\nexport default async function buildExecutor(\n options: BuildExecutorSchema,\n context: ExecutorContext,\n): Promise<{ success: boolean }> {\n const args: string[] = ['build'];\n // `adapter` is the old spelling of `target`; the CLI has no `--adapter` flag.\n const target = options.target ?? options.adapter;\n if (target) args.push('--target', target);\n if (options.entry) args.push('--entry', toAbsolute(context, options.entry));\n if (options.outputPath) args.push('--out-dir', toAbsolute(context, options.outputPath));\n return runFrontmcp(context, args);\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export interface BuildExecutorSchema {
|
|
2
2
|
entry?: string;
|
|
3
3
|
outputPath?: string;
|
|
4
|
+
target?: 'node' | 'vercel' | 'lambda' | 'cloudflare' | 'distributed' | 'cli' | 'sdk' | 'browser' | 'mcpb';
|
|
5
|
+
/** @deprecated Use `target`. */
|
|
4
6
|
adapter?: 'node' | 'vercel' | 'lambda' | 'cloudflare';
|
|
5
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/executors/build/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface BuildExecutorSchema {\n entry?: string;\n outputPath?: string;\n adapter?: 'node' | 'vercel' | 'lambda' | 'cloudflare';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/executors/build/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface BuildExecutorSchema {\n entry?: string;\n outputPath?: string;\n target?: 'node' | 'vercel' | 'lambda' | 'cloudflare' | 'distributed' | 'cli' | 'sdk' | 'browser' | 'mcpb';\n /** @deprecated Use `target`. */\n adapter?: 'node' | 'vercel' | 'lambda' | 'cloudflare';\n}\n"]}
|
|
@@ -14,8 +14,28 @@
|
|
|
14
14
|
},
|
|
15
15
|
"adapter": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
18
|
-
"enum": [
|
|
17
|
+
"description": "Deprecated alias of `target`",
|
|
18
|
+
"enum": [
|
|
19
|
+
"node",
|
|
20
|
+
"vercel",
|
|
21
|
+
"lambda",
|
|
22
|
+
"cloudflare"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"target": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Build target passed to `frontmcp build --target`",
|
|
28
|
+
"enum": [
|
|
29
|
+
"node",
|
|
30
|
+
"vercel",
|
|
31
|
+
"lambda",
|
|
32
|
+
"cloudflare",
|
|
33
|
+
"distributed",
|
|
34
|
+
"cli",
|
|
35
|
+
"sdk",
|
|
36
|
+
"browser",
|
|
37
|
+
"mcpb"
|
|
38
|
+
]
|
|
19
39
|
}
|
|
20
40
|
},
|
|
21
41
|
"required": []
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = buildExecExecutor;
|
|
4
|
-
const
|
|
4
|
+
const frontmcp_cli_js_1 = require("../frontmcp-cli.js");
|
|
5
5
|
async function buildExecExecutor(options, context) {
|
|
6
|
-
const args = ['
|
|
6
|
+
const args = ['build', '--target', 'node'];
|
|
7
7
|
if (options.entry)
|
|
8
|
-
args.push('--entry', options.entry);
|
|
8
|
+
args.push('--entry', (0, frontmcp_cli_js_1.toAbsolute)(context, options.entry));
|
|
9
9
|
if (options.outputPath)
|
|
10
|
-
args.push('--out-dir', options.outputPath);
|
|
11
|
-
|
|
12
|
-
console.log(`Running: ${command}`);
|
|
13
|
-
try {
|
|
14
|
-
(0, child_process_1.execSync)(command, {
|
|
15
|
-
cwd: context.root,
|
|
16
|
-
stdio: 'inherit',
|
|
17
|
-
env: { ...process.env, FORCE_COLOR: '1' },
|
|
18
|
-
});
|
|
19
|
-
return { success: true };
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return { success: false };
|
|
23
|
-
}
|
|
10
|
+
args.push('--out-dir', (0, frontmcp_cli_js_1.toAbsolute)(context, options.outputPath));
|
|
11
|
+
return (0, frontmcp_cli_js_1.runFrontmcp)(context, args);
|
|
24
12
|
}
|
|
25
13
|
//# sourceMappingURL=build-exec.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-exec.impl.js","sourceRoot":"","sources":["../../../../src/executors/build-exec/build-exec.impl.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"build-exec.impl.js","sourceRoot":"","sources":["../../../../src/executors/build-exec/build-exec.impl.ts"],"names":[],"mappings":";;AAIA,oCAQC;AAXD,wDAA6D;AAG9C,KAAK,UAAU,iBAAiB,CAC7C,OAAgC,EAChC,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,IAAI,OAAO,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAA,4BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAA,4BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACxF,OAAO,IAAA,6BAAW,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { runFrontmcp, toAbsolute } from '../frontmcp-cli.js';\nimport type { BuildExecExecutorSchema } from './schema.js';\n\nexport default async function buildExecExecutor(\n options: BuildExecExecutorSchema,\n context: ExecutorContext,\n): Promise<{ success: boolean }> {\n const args: string[] = ['build', '--target', 'node'];\n if (options.entry) args.push('--entry', toAbsolute(context, options.entry));\n if (options.outputPath) args.push('--out-dir', toAbsolute(context, options.outputPath));\n return runFrontmcp(context, args);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.impl.js","sourceRoot":"","sources":["../../../../src/executors/deploy/deploy.impl.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deploy.impl.js","sourceRoot":"","sources":["../../../../src/executors/deploy/deploy.impl.ts"],"names":[],"mappings":";;AAYA,iCA0BC;AAtCD,iDAAyC;AAKzC,MAAM,eAAe,GAA2B;IAC9C,IAAI,EAAE,8BAA8B;IACpC,MAAM,EAAE,mBAAmB;IAC3B,MAAM,EAAE,yBAAyB;IACjC,UAAU,EAAE,qBAAqB;CAClC,CAAC;AAEa,KAAK,UAAU,cAAc,CAC1C,OAA6B,EAC7B,OAAwB;IAExB,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,sBAAsB,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;IAExF,OAAO,CAAC,GAAG,CAAC,aAAa,WAAW,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,IAAA,wBAAQ,EAAC,OAAO,EAAE;YAChB,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,EAAE;YACrC,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 { execSync } from 'child_process';\n\nimport type { ExecutorContext } from '../executor-context.js';\nimport type { DeployExecutorSchema } from './schema.js';\n\nconst DEPLOY_COMMANDS: Record<string, string> = {\n node: 'docker compose up --build -d',\n vercel: 'npx vercel --prod',\n lambda: 'sam build && sam deploy',\n cloudflare: 'npx wrangler deploy',\n};\n\nexport default async function deployExecutor(\n options: DeployExecutorSchema,\n context: ExecutorContext,\n): Promise<{ success: boolean }> {\n const command = DEPLOY_COMMANDS[options.target];\n if (!command) {\n console.error(`Unknown deployment target: ${options.target}`);\n return { success: false };\n }\n\n const projectName = context.projectName ?? '';\n const projectRoot = context.projectsConfigurations?.projects?.[projectName]?.root ?? '';\n\n console.log(`Deploying ${projectName} to ${options.target}...`);\n console.log(`Running: ${command}`);\n\n try {\n execSync(command, {\n cwd: `${context.root}/${projectRoot}`,\n stdio: 'inherit',\n env: { ...process.env, FORCE_COLOR: '1' },\n });\n return { success: true };\n } catch {\n return { success: false };\n }\n}\n"]}
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = devExecutor;
|
|
4
|
-
const
|
|
4
|
+
const frontmcp_cli_js_1 = require("../frontmcp-cli.js");
|
|
5
5
|
async function* devExecutor(options, context) {
|
|
6
|
-
const args = ['
|
|
6
|
+
const args = ['dev'];
|
|
7
7
|
if (options.entry)
|
|
8
|
-
args.push('--entry', options.entry);
|
|
8
|
+
args.push('--entry', (0, frontmcp_cli_js_1.toAbsolute)(context, options.entry));
|
|
9
9
|
if (options.port !== undefined)
|
|
10
10
|
args.push('--port', String(options.port));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
yield { success: true, ...(options.port !== undefined && { baseUrl: `http://localhost:${options.port}` }) };
|
|
11
|
+
const child = (0, frontmcp_cli_js_1.spawnFrontmcp)(context, args);
|
|
12
|
+
if (!child) {
|
|
13
|
+
yield { success: false };
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
18
16
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
child.on('close', (code) => resolve(code ?? 1));
|
|
22
|
-
});
|
|
23
|
-
yield { success: exitCode === 0 };
|
|
17
|
+
yield { success: true, ...(options.port !== undefined && { baseUrl: `http://localhost:${options.port}` }) };
|
|
18
|
+
yield { success: (await (0, frontmcp_cli_js_1.waitForExit)(child)) === 0 };
|
|
24
19
|
}
|
|
25
20
|
finally {
|
|
26
|
-
|
|
27
|
-
child.kill();
|
|
21
|
+
(0, frontmcp_cli_js_1.stopChild)(child);
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
24
|
//# sourceMappingURL=dev.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.impl.js","sourceRoot":"","sources":["../../../../src/executors/dev/dev.impl.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"dev.impl.js","sourceRoot":"","sources":["../../../../src/executors/dev/dev.impl.ts"],"names":[],"mappings":";;AAIA,8BAoBC;AAvBD,wDAAuF;AAGxE,KAAK,SAAS,CAAC,CAAC,WAAW,CACxC,OAA0B,EAC1B,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,OAAO,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAA,4BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1E,MAAM,KAAK,GAAG,IAAA,+BAAa,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,oBAAoB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC5G,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,IAAA,6BAAW,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,IAAA,2BAAS,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { spawnFrontmcp, stopChild, toAbsolute, waitForExit } from '../frontmcp-cli.js';\nimport type { DevExecutorSchema } from './schema.js';\n\nexport default async function* devExecutor(\n options: DevExecutorSchema,\n context: ExecutorContext,\n): AsyncGenerator<{ success: boolean; baseUrl?: string }> {\n const args: string[] = ['dev'];\n if (options.entry) args.push('--entry', toAbsolute(context, options.entry));\n if (options.port !== undefined) args.push('--port', String(options.port));\n\n const child = spawnFrontmcp(context, args);\n if (!child) {\n yield { success: false };\n return;\n }\n\n try {\n yield { success: true, ...(options.port !== undefined && { baseUrl: `http://localhost:${options.port}` }) };\n yield { success: (await waitForExit(child)) === 0 };\n } finally {\n stopChild(child);\n }\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ChildProcess } from 'child_process';
|
|
2
|
+
import type { ExecutorContext } from './executor-context.js';
|
|
3
|
+
export interface FrontmcpInvocation {
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
/** The project's own folder: the CLI reads `tsconfig.json`, `jest.config.*` and `frontmcp.config.*` from here. */
|
|
7
|
+
cwd: string;
|
|
8
|
+
env: NodeJS.ProcessEnv;
|
|
9
|
+
}
|
|
10
|
+
/** Absolute path of the project's folder; the workspace root when the project is unknown. */
|
|
11
|
+
export declare function getProjectRoot(context: ExecutorContext): string;
|
|
12
|
+
/** Nx hands options over relative to the workspace root, while the CLI resolves them from the project folder. */
|
|
13
|
+
export declare function toAbsolute(context: ExecutorContext, path: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Find the `frontmcp` CLI the workspace has installed. Running it through `npx`
|
|
16
|
+
* would download whatever is newest on the registry whenever it is missing,
|
|
17
|
+
* so the executors refuse to fall back to that.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveFrontmcpBin(workspaceRoot: string): string;
|
|
20
|
+
export declare function buildFrontmcpInvocation(context: ExecutorContext, args: string[], extraEnv?: NodeJS.ProcessEnv): FrontmcpInvocation;
|
|
21
|
+
export declare function describeInvocation(invocation: FrontmcpInvocation): string;
|
|
22
|
+
/** Run the CLI to completion in the project folder. Never throws: the executor result carries the outcome. */
|
|
23
|
+
export declare function runFrontmcp(context: ExecutorContext, args: string[], extraEnv?: NodeJS.ProcessEnv): {
|
|
24
|
+
success: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** Start the CLI as a long-running child in the project folder. */
|
|
27
|
+
export declare function spawnFrontmcp(context: ExecutorContext, args: string[], extraEnv?: NodeJS.ProcessEnv): ChildProcess | undefined;
|
|
28
|
+
/** Resolve with the child's exit code. */
|
|
29
|
+
export declare function waitForExit(child: ChildProcess): Promise<number>;
|
|
30
|
+
/** Stop the child if it is still running — Nx returns from the generator to cancel a long-running executor. */
|
|
31
|
+
export declare function stopChild(child: ChildProcess): void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectRoot = getProjectRoot;
|
|
4
|
+
exports.toAbsolute = toAbsolute;
|
|
5
|
+
exports.resolveFrontmcpBin = resolveFrontmcpBin;
|
|
6
|
+
exports.buildFrontmcpInvocation = buildFrontmcpInvocation;
|
|
7
|
+
exports.describeInvocation = describeInvocation;
|
|
8
|
+
exports.runFrontmcp = runFrontmcp;
|
|
9
|
+
exports.spawnFrontmcp = spawnFrontmcp;
|
|
10
|
+
exports.waitForExit = waitForExit;
|
|
11
|
+
exports.stopChild = stopChild;
|
|
12
|
+
const child_process_1 = require("child_process");
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const path_1 = require("path");
|
|
15
|
+
/** Absolute path of the project's folder; the workspace root when the project is unknown. */
|
|
16
|
+
function getProjectRoot(context) {
|
|
17
|
+
const projectRoot = context.projectName
|
|
18
|
+
? context.projectsConfigurations?.projects?.[context.projectName]?.root
|
|
19
|
+
: undefined;
|
|
20
|
+
return projectRoot ? (0, path_1.resolve)(context.root, projectRoot) : context.root;
|
|
21
|
+
}
|
|
22
|
+
/** Nx hands options over relative to the workspace root, while the CLI resolves them from the project folder. */
|
|
23
|
+
function toAbsolute(context, path) {
|
|
24
|
+
return (0, path_1.isAbsolute)(path) ? path : (0, path_1.resolve)(context.root, path);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Find the `frontmcp` CLI the workspace has installed. Running it through `npx`
|
|
28
|
+
* would download whatever is newest on the registry whenever it is missing,
|
|
29
|
+
* so the executors refuse to fall back to that.
|
|
30
|
+
*/
|
|
31
|
+
function resolveFrontmcpBin(workspaceRoot) {
|
|
32
|
+
const manifestPath = (0, path_1.join)(workspaceRoot, 'node_modules', 'frontmcp', 'package.json');
|
|
33
|
+
if ((0, fs_1.existsSync)(manifestPath)) {
|
|
34
|
+
try {
|
|
35
|
+
const manifest = JSON.parse((0, fs_1.readFileSync)(manifestPath, 'utf8'));
|
|
36
|
+
const bin = typeof manifest.bin === 'string' ? manifest.bin : manifest.bin?.['frontmcp'];
|
|
37
|
+
if (bin) {
|
|
38
|
+
const binPath = (0, path_1.join)(workspaceRoot, 'node_modules', 'frontmcp', bin);
|
|
39
|
+
if ((0, fs_1.existsSync)(binPath))
|
|
40
|
+
return binPath;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// fall through to the "not installed" error below
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`The "frontmcp" CLI is not installed in ${workspaceRoot}. Add it to the workspace ` +
|
|
48
|
+
`(\`npm install --save-dev frontmcp\`) so the executors run the version you pinned.`);
|
|
49
|
+
}
|
|
50
|
+
function buildFrontmcpInvocation(context, args, extraEnv = {}) {
|
|
51
|
+
return {
|
|
52
|
+
command: process.execPath,
|
|
53
|
+
args: [resolveFrontmcpBin(context.root), ...args],
|
|
54
|
+
cwd: getProjectRoot(context),
|
|
55
|
+
env: { ...process.env, FORCE_COLOR: '1', ...extraEnv },
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function describeInvocation(invocation) {
|
|
59
|
+
return `frontmcp ${invocation.args.slice(1).join(' ')} (in ${invocation.cwd})`;
|
|
60
|
+
}
|
|
61
|
+
/** Run the CLI to completion in the project folder. Never throws: the executor result carries the outcome. */
|
|
62
|
+
function runFrontmcp(context, args, extraEnv = {}) {
|
|
63
|
+
try {
|
|
64
|
+
const invocation = buildFrontmcpInvocation(context, args, extraEnv);
|
|
65
|
+
console.log(`Running: ${describeInvocation(invocation)}`);
|
|
66
|
+
(0, child_process_1.execFileSync)(invocation.command, invocation.args, {
|
|
67
|
+
cwd: invocation.cwd,
|
|
68
|
+
stdio: 'inherit',
|
|
69
|
+
env: invocation.env,
|
|
70
|
+
});
|
|
71
|
+
return { success: true };
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
// A failing CLI already printed its own output; only report problems that happened before it ran.
|
|
75
|
+
if (err instanceof Error && !('status' in err))
|
|
76
|
+
console.error(err.message);
|
|
77
|
+
return { success: false };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Start the CLI as a long-running child in the project folder. */
|
|
81
|
+
function spawnFrontmcp(context, args, extraEnv = {}) {
|
|
82
|
+
try {
|
|
83
|
+
const invocation = buildFrontmcpInvocation(context, args, extraEnv);
|
|
84
|
+
console.log(`Running: ${describeInvocation(invocation)}`);
|
|
85
|
+
return (0, child_process_1.spawn)(invocation.command, invocation.args, {
|
|
86
|
+
cwd: invocation.cwd,
|
|
87
|
+
stdio: 'inherit',
|
|
88
|
+
env: invocation.env,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** Resolve with the child's exit code. */
|
|
97
|
+
function waitForExit(child) {
|
|
98
|
+
return new Promise((resolvePromise) => {
|
|
99
|
+
child.on('error', () => resolvePromise(1));
|
|
100
|
+
child.on('close', (code) => resolvePromise(code ?? 1));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** Stop the child if it is still running — Nx returns from the generator to cancel a long-running executor. */
|
|
104
|
+
function stopChild(child) {
|
|
105
|
+
if (child.exitCode === null && child.signalCode === null && !child.killed)
|
|
106
|
+
child.kill();
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=frontmcp-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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,CAAC,KAAmB;IAC7C,OAAO,IAAI,OAAO,CAAS,CAAC,cAAc,EAAE,EAAE;QAC5C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,+GAA+G;AAC/G,SAAgB,SAAS,CAAC,KAAmB;IAC3C,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC1F,CAAC","sourcesContent":["import { execFileSync, spawn, type ChildProcess } from 'child_process';\nimport { existsSync, readFileSync } from 'fs';\nimport { isAbsolute, join, resolve } from 'path';\n\nimport type { ExecutorContext } from './executor-context.js';\n\nexport interface FrontmcpInvocation {\n command: string;\n args: string[];\n /** The project's own folder: the CLI reads `tsconfig.json`, `jest.config.*` and `frontmcp.config.*` from here. */\n cwd: string;\n env: NodeJS.ProcessEnv;\n}\n\n/** Absolute path of the project's folder; the workspace root when the project is unknown. */\nexport function getProjectRoot(context: ExecutorContext): string {\n const projectRoot = context.projectName\n ? context.projectsConfigurations?.projects?.[context.projectName]?.root\n : undefined;\n return projectRoot ? resolve(context.root, projectRoot) : context.root;\n}\n\n/** Nx hands options over relative to the workspace root, while the CLI resolves them from the project folder. */\nexport function toAbsolute(context: ExecutorContext, path: string): string {\n return isAbsolute(path) ? path : resolve(context.root, path);\n}\n\n/**\n * Find the `frontmcp` CLI the workspace has installed. Running it through `npx`\n * would download whatever is newest on the registry whenever it is missing,\n * so the executors refuse to fall back to that.\n */\nexport function resolveFrontmcpBin(workspaceRoot: string): string {\n const manifestPath = join(workspaceRoot, 'node_modules', 'frontmcp', 'package.json');\n if (existsSync(manifestPath)) {\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { bin?: string | Record<string, string> };\n const bin = typeof manifest.bin === 'string' ? manifest.bin : manifest.bin?.['frontmcp'];\n if (bin) {\n const binPath = join(workspaceRoot, 'node_modules', 'frontmcp', bin);\n if (existsSync(binPath)) return binPath;\n }\n } catch {\n // fall through to the \"not installed\" error below\n }\n }\n throw new Error(\n `The \"frontmcp\" CLI is not installed in ${workspaceRoot}. Add it to the workspace ` +\n `(\\`npm install --save-dev frontmcp\\`) so the executors run the version you pinned.`,\n );\n}\n\nexport function buildFrontmcpInvocation(\n context: ExecutorContext,\n args: string[],\n extraEnv: NodeJS.ProcessEnv = {},\n): FrontmcpInvocation {\n return {\n command: process.execPath,\n args: [resolveFrontmcpBin(context.root), ...args],\n cwd: getProjectRoot(context),\n env: { ...process.env, FORCE_COLOR: '1', ...extraEnv },\n };\n}\n\nexport function describeInvocation(invocation: FrontmcpInvocation): string {\n return `frontmcp ${invocation.args.slice(1).join(' ')} (in ${invocation.cwd})`;\n}\n\n/** Run the CLI to completion in the project folder. Never throws: the executor result carries the outcome. */\nexport function runFrontmcp(\n context: ExecutorContext,\n args: string[],\n extraEnv: NodeJS.ProcessEnv = {},\n): { success: boolean } {\n try {\n const invocation = buildFrontmcpInvocation(context, args, extraEnv);\n console.log(`Running: ${describeInvocation(invocation)}`);\n execFileSync(invocation.command, invocation.args, {\n cwd: invocation.cwd,\n stdio: 'inherit',\n env: invocation.env,\n });\n return { success: true };\n } catch (err) {\n // A failing CLI already printed its own output; only report problems that happened before it ran.\n if (err instanceof Error && !('status' in err)) console.error(err.message);\n return { success: false };\n }\n}\n\n/** Start the CLI as a long-running child in the project folder. */\nexport function spawnFrontmcp(\n context: ExecutorContext,\n args: string[],\n extraEnv: NodeJS.ProcessEnv = {},\n): ChildProcess | undefined {\n try {\n const invocation = buildFrontmcpInvocation(context, args, extraEnv);\n console.log(`Running: ${describeInvocation(invocation)}`);\n return spawn(invocation.command, invocation.args, {\n cwd: invocation.cwd,\n stdio: 'inherit',\n env: invocation.env,\n });\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n return undefined;\n }\n}\n\n/** Resolve with the child's exit code. */\nexport function waitForExit(child: ChildProcess): Promise<number> {\n return new Promise<number>((resolvePromise) => {\n child.on('error', () => resolvePromise(1));\n child.on('close', (code) => resolvePromise(code ?? 1));\n });\n}\n\n/** Stop the child if it is still running — Nx returns from the generator to cancel a long-running executor. */\nexport function stopChild(child: ChildProcess): void {\n if (child.exitCode === null && child.signalCode === null && !child.killed) child.kill();\n}\n"]}
|
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = inspectorExecutor;
|
|
4
|
-
const
|
|
4
|
+
const frontmcp_cli_js_1 = require("../frontmcp-cli.js");
|
|
5
5
|
async function* inspectorExecutor(options, context) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
stdio: 'inherit',
|
|
13
|
-
env: { ...process.env, FORCE_COLOR: '1' },
|
|
14
|
-
});
|
|
15
|
-
yield { success: true };
|
|
6
|
+
// `frontmcp inspector` takes no flags; the MCP Inspector it launches reads its UI port from the environment.
|
|
7
|
+
const child = (0, frontmcp_cli_js_1.spawnFrontmcp)(context, ['inspector'], options.port !== undefined ? { CLIENT_PORT: String(options.port) } : {});
|
|
8
|
+
if (!child) {
|
|
9
|
+
yield { success: false };
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
16
12
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
child.on('close', (code) => resolve(code ?? 1));
|
|
20
|
-
});
|
|
21
|
-
yield { success: exitCode === 0 };
|
|
13
|
+
yield { success: true };
|
|
14
|
+
yield { success: (await (0, frontmcp_cli_js_1.waitForExit)(child)) === 0 };
|
|
22
15
|
}
|
|
23
16
|
finally {
|
|
24
|
-
|
|
25
|
-
child.kill();
|
|
17
|
+
(0, frontmcp_cli_js_1.stopChild)(child);
|
|
26
18
|
}
|
|
27
19
|
}
|
|
28
20
|
//# sourceMappingURL=inspector.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspector.impl.js","sourceRoot":"","sources":["../../../../src/executors/inspector/inspector.impl.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"inspector.impl.js","sourceRoot":"","sources":["../../../../src/executors/inspector/inspector.impl.ts"],"names":[],"mappings":";;AAIA,oCAqBC;AAxBD,wDAA2E;AAG5D,KAAK,SAAS,CAAC,CAAC,iBAAiB,CAC9C,OAAgC,EAChC,OAAwB;IAExB,6GAA6G;IAC7G,MAAM,KAAK,GAAG,IAAA,+BAAa,EACzB,OAAO,EACP,CAAC,WAAW,CAAC,EACb,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CACxE,CAAC;IACF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACxB,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,IAAA,6BAAW,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,IAAA,2BAAS,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { spawnFrontmcp, stopChild, waitForExit } from '../frontmcp-cli.js';\nimport type { InspectorExecutorSchema } from './schema.js';\n\nexport default async function* inspectorExecutor(\n options: InspectorExecutorSchema,\n context: ExecutorContext,\n): AsyncGenerator<{ success: boolean }> {\n // `frontmcp inspector` takes no flags; the MCP Inspector it launches reads its UI port from the environment.\n const child = spawnFrontmcp(\n context,\n ['inspector'],\n options.port !== undefined ? { CLIENT_PORT: String(options.port) } : {},\n );\n if (!child) {\n yield { success: false };\n return;\n }\n\n try {\n yield { success: true };\n yield { success: (await waitForExit(child)) === 0 };\n } finally {\n stopChild(child);\n }\n}\n"]}
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = serveExecutor;
|
|
4
|
-
const
|
|
4
|
+
const frontmcp_cli_js_1 = require("../frontmcp-cli.js");
|
|
5
5
|
async function* serveExecutor(options, context) {
|
|
6
|
-
const args = ['
|
|
6
|
+
const args = ['start'];
|
|
7
7
|
if (context.projectName)
|
|
8
8
|
args.push(context.projectName);
|
|
9
9
|
if (options.entry)
|
|
10
|
-
args.push('--entry', options.entry);
|
|
10
|
+
args.push('--entry', (0, frontmcp_cli_js_1.toAbsolute)(context, options.entry));
|
|
11
11
|
if (options.port !== undefined)
|
|
12
12
|
args.push('--port', String(options.port));
|
|
13
13
|
if (options.maxRestarts !== undefined)
|
|
14
14
|
args.push('--max-restarts', String(options.maxRestarts));
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
yield { success: true };
|
|
15
|
+
const child = (0, frontmcp_cli_js_1.spawnFrontmcp)(context, args);
|
|
16
|
+
if (!child) {
|
|
17
|
+
yield { success: false };
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
22
20
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
child.on('close', (code) => resolve(code ?? 1));
|
|
26
|
-
});
|
|
27
|
-
yield { success: exitCode === 0 };
|
|
21
|
+
yield { success: true };
|
|
22
|
+
yield { success: (await (0, frontmcp_cli_js_1.waitForExit)(child)) === 0 };
|
|
28
23
|
}
|
|
29
24
|
finally {
|
|
30
|
-
|
|
31
|
-
child.kill();
|
|
25
|
+
(0, frontmcp_cli_js_1.stopChild)(child);
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
28
|
//# sourceMappingURL=serve.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.impl.js","sourceRoot":"","sources":["../../../../src/executors/serve/serve.impl.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"serve.impl.js","sourceRoot":"","sources":["../../../../src/executors/serve/serve.impl.ts"],"names":[],"mappings":";;AAIA,gCAsBC;AAzBD,wDAAuF;AAGxE,KAAK,SAAS,CAAC,CAAC,aAAa,CAC1C,OAA4B,EAC5B,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,OAAO,CAAC,CAAC;IACjC,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,IAAA,4BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,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,MAAM,KAAK,GAAG,IAAA,+BAAa,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACxB,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,IAAA,6BAAW,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,IAAA,2BAAS,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { spawnFrontmcp, stopChild, toAbsolute, waitForExit } from '../frontmcp-cli.js';\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[] = ['start'];\n if (context.projectName) args.push(context.projectName);\n if (options.entry) args.push('--entry', toAbsolute(context, 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 const child = spawnFrontmcp(context, args);\n if (!child) {\n yield { success: false };\n return;\n }\n\n try {\n yield { success: true };\n yield { success: (await waitForExit(child)) === 0 };\n } finally {\n stopChild(child);\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = testExecutor;
|
|
4
|
-
const
|
|
4
|
+
const frontmcp_cli_js_1 = require("../frontmcp-cli.js");
|
|
5
5
|
async function testExecutor(options, context) {
|
|
6
|
-
const args = ['
|
|
6
|
+
const args = ['test'];
|
|
7
7
|
if (options.runInBand)
|
|
8
8
|
args.push('--runInBand');
|
|
9
9
|
if (options.watch)
|
|
@@ -14,18 +14,6 @@ async function testExecutor(options, context) {
|
|
|
14
14
|
args.push('--verbose');
|
|
15
15
|
if (options.timeout)
|
|
16
16
|
args.push('--timeout', String(options.timeout));
|
|
17
|
-
|
|
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
|
-
}
|
|
17
|
+
return (0, frontmcp_cli_js_1.runFrontmcp)(context, args);
|
|
30
18
|
}
|
|
31
19
|
//# sourceMappingURL=test.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.impl.js","sourceRoot":"","sources":["../../../../src/executors/test/test.impl.ts"],"names":[],"mappings":";;AAIA,+
|
|
1
|
+
{"version":3,"file":"test.impl.js","sourceRoot":"","sources":["../../../../src/executors/test/test.impl.ts"],"names":[],"mappings":";;AAIA,+BAWC;AAdD,wDAAiD;AAGlC,KAAK,UAAU,YAAY,CACxC,OAA2B,EAC3B,OAAwB;IAExB,MAAM,IAAI,GAAa,CAAC,MAAM,CAAC,CAAC;IAChC,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;IACrE,OAAO,IAAA,6BAAW,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import type { ExecutorContext } from '../executor-context.js';\nimport { runFrontmcp } from '../frontmcp-cli.js';\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[] = ['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 return runFrontmcp(context, args);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, DynamicAdapter, type
|
|
1
|
+
import { Adapter, DynamicAdapter, type FrontMcpAdapterResponse } from '@frontmcp/sdk';
|
|
2
2
|
|
|
3
3
|
export interface <%= className %>AdapterOptions {
|
|
4
4
|
// TODO: define adapter options
|
|
@@ -9,7 +9,14 @@ export interface <%= className %>AdapterOptions {
|
|
|
9
9
|
description: 'TODO: describe what this adapter does',
|
|
10
10
|
})
|
|
11
11
|
export class <%= className %>Adapter extends DynamicAdapter<<%= className %>AdapterOptions> {
|
|
12
|
-
|
|
12
|
+
options: { name: string } & <%= className %>AdapterOptions;
|
|
13
|
+
|
|
14
|
+
constructor(options: { name: string } & <%= className %>AdapterOptions) {
|
|
15
|
+
super();
|
|
16
|
+
this.options = options;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async fetch(): Promise<FrontMcpAdapterResponse> {
|
|
13
20
|
// TODO: implement — return tools, resources, and/or prompts
|
|
14
21
|
return {
|
|
15
22
|
tools: [],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
2
|
import type { AgentGeneratorSchema } from './schema.js';
|
|
3
3
|
export declare function agentGenerator(tree: Tree, schema: AgentGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
4
|
export default agentGenerator;
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.agentGenerator = agentGenerator;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const path_1 = require("path");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const names_js_1 = require("../../utils/names.js");
|
|
6
7
|
const normalize_options_js_1 = require("../../utils/normalize-options.js");
|
|
7
8
|
async function agentGenerator(tree, schema) {
|
|
8
9
|
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'agents');
|
|
9
10
|
const model = schema.model ?? 'gpt-4';
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
:
|
|
11
|
+
const toolsDir = (0, path_1.join)(options.projectSourceRoot, 'tools');
|
|
12
|
+
const toolRefs = (schema.tools ?? '')
|
|
13
|
+
.split(',')
|
|
14
|
+
.map((t) => t.trim())
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.map((t) => ({ className: (0, devkit_1.names)(t).className, fileName: (0, names_js_1.toFileName)(t) }))
|
|
17
|
+
.filter((t, i, all) => all.findIndex((other) => other.className === t.className) === i)
|
|
18
|
+
.map((t) => {
|
|
19
|
+
const importPath = (0, path_1.relative)(options.directory, (0, path_1.join)(toolsDir, `${t.fileName}.tool`))
|
|
20
|
+
.split('\\')
|
|
21
|
+
.join('/');
|
|
22
|
+
return {
|
|
23
|
+
className: t.className,
|
|
24
|
+
importPath: importPath.startsWith('.') ? importPath : `./${importPath}`,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const isAnthropic = model.toLowerCase().startsWith('claude');
|
|
16
28
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
17
29
|
...options,
|
|
18
30
|
model,
|
|
31
|
+
llmProvider: isAnthropic ? 'anthropic' : 'openai',
|
|
32
|
+
apiKeyEnv: isAnthropic ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY',
|
|
19
33
|
toolRefs,
|
|
20
34
|
tmpl: '',
|
|
21
35
|
});
|