@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,15 @@
|
|
|
1
|
+
import type { LibGeneratorSchema } from '../schema.js';
|
|
2
|
+
export interface NormalizedLibOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
projectName: string;
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
className: string;
|
|
7
|
+
fileName: string;
|
|
8
|
+
propertyName: string;
|
|
9
|
+
libType: 'generic' | 'plugin' | 'adapter' | 'tool-register';
|
|
10
|
+
publishable: boolean;
|
|
11
|
+
importPath: string;
|
|
12
|
+
parsedTags: string[];
|
|
13
|
+
skipFormat: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function normalizeOptions(schema: LibGeneratorSchema): NormalizedLibOptions;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = normalizeOptions;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function normalizeOptions(schema) {
|
|
6
|
+
const { className, fileName, propertyName } = (0, devkit_1.names)(schema.name);
|
|
7
|
+
const projectRoot = schema.directory ?? (0, devkit_1.joinPathFragments)('libs', fileName);
|
|
8
|
+
const libType = schema.libType ?? 'generic';
|
|
9
|
+
const publishable = schema.publishable ?? false;
|
|
10
|
+
const importPath = schema.importPath ?? `@frontmcp/${fileName}`;
|
|
11
|
+
const parsedTags = schema.tags
|
|
12
|
+
? schema.tags.split(',').map((t) => t.trim())
|
|
13
|
+
: ['scope:libs'];
|
|
14
|
+
if (publishable) {
|
|
15
|
+
parsedTags.push('scope:publishable');
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
name: schema.name,
|
|
19
|
+
projectName: fileName,
|
|
20
|
+
projectRoot,
|
|
21
|
+
className,
|
|
22
|
+
fileName,
|
|
23
|
+
propertyName,
|
|
24
|
+
libType,
|
|
25
|
+
publishable,
|
|
26
|
+
importPath,
|
|
27
|
+
parsedTags,
|
|
28
|
+
skipFormat: schema.skipFormat ?? false,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../src/generators/lib/lib/normalize-options.ts"],"names":[],"mappings":";;AAiBA,4CA2BC;AA5CD,uCAAsD;AAiBtD,SAAgB,gBAAgB,CAAC,MAA0B;IACzD,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,IAAI,IAAA,0BAAiB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC;IAC5C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;IAChD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,aAAa,QAAQ,EAAE,CAAC;IAChE,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI;QAC5B,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAEnB,IAAI,WAAW,EAAE,CAAC;QAChB,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,QAAQ;QACrB,WAAW;QACX,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,OAAO;QACP,WAAW;QACX,UAAU;QACV,UAAU;QACV,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK;KACvC,CAAC;AACJ,CAAC","sourcesContent":["import { names, joinPathFragments } from '@nx/devkit';\nimport type { LibGeneratorSchema } from '../schema.js';\n\nexport interface NormalizedLibOptions {\n name: string;\n projectName: string;\n projectRoot: string;\n className: string;\n fileName: string;\n propertyName: string;\n libType: 'generic' | 'plugin' | 'adapter' | 'tool-register';\n publishable: boolean;\n importPath: string;\n parsedTags: string[];\n skipFormat: boolean;\n}\n\nexport function normalizeOptions(schema: LibGeneratorSchema): NormalizedLibOptions {\n const { className, fileName, propertyName } = names(schema.name);\n const projectRoot = schema.directory ?? joinPathFragments('libs', fileName);\n const libType = schema.libType ?? 'generic';\n const publishable = schema.publishable ?? false;\n const importPath = schema.importPath ?? `@frontmcp/${fileName}`;\n const parsedTags = schema.tags\n ? schema.tags.split(',').map((t) => t.trim())\n : ['scope:libs'];\n\n if (publishable) {\n parsedTags.push('scope:publishable');\n }\n\n return {\n name: schema.name,\n projectName: fileName,\n projectRoot,\n className,\n fileName,\n propertyName,\n libType,\n publishable,\n importPath,\n parsedTags,\n skipFormat: schema.skipFormat ?? false,\n };\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.libGenerator = libGenerator;
|
|
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 libGenerator(tree, schema) {
|
|
8
|
+
return libGeneratorInternal(tree, schema);
|
|
9
|
+
}
|
|
10
|
+
async function libGeneratorInternal(tree, schema) {
|
|
11
|
+
const options = (0, index_js_1.normalizeOptions)(schema);
|
|
12
|
+
// Generate project config files (project.json, tsconfig, jest)
|
|
13
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'lib-project-files'), options.projectRoot, {
|
|
14
|
+
...options,
|
|
15
|
+
tmpl: '',
|
|
16
|
+
});
|
|
17
|
+
// Generate type-specific source files
|
|
18
|
+
const templateDir = (0, path_1.join)(__dirname, 'files', options.libType);
|
|
19
|
+
(0, devkit_1.generateFiles)(tree, templateDir, options.projectRoot, {
|
|
20
|
+
...options,
|
|
21
|
+
tmpl: '',
|
|
22
|
+
});
|
|
23
|
+
// Add path mapping to tsconfig.base.json if it exists
|
|
24
|
+
if (tree.exists('tsconfig.base.json')) {
|
|
25
|
+
(0, devkit_1.updateJson)(tree, 'tsconfig.base.json', (json) => {
|
|
26
|
+
json.compilerOptions = json.compilerOptions ?? {};
|
|
27
|
+
json.compilerOptions.paths = json.compilerOptions.paths ?? {};
|
|
28
|
+
json.compilerOptions.paths[options.importPath] = [`${options.projectRoot}/src/index.ts`];
|
|
29
|
+
return json;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (!options.skipFormat) {
|
|
33
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.default = libGenerator;
|
|
37
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../../src/generators/lib/lib.ts"],"names":[],"mappings":";;AAWA,oCAEC;AAbD,uCAMoB;AACpB,+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,CACjC,IAAU,EACV,MAA0B;IAE1B,MAAM,OAAO,GAAG,IAAA,2BAAgB,EAAC,MAAM,CAAC,CAAC;IAEzC,+DAA+D;IAC/D,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,mBAAmB,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE;QAC7E,GAAG,OAAO;QACV,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,sCAAsC;IACtC,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAA,sBAAa,EAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;QACpD,GAAG,OAAO;QACV,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,sDAAsD;IACtD,IAAI,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACtC,IAAA,mBAAU,EAAC,IAAI,EAAE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;YAClD,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE,CAAC;YAC9D,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,eAAe,CAAC,CAAC;YACzF,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED,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 {\n type Tree,\n formatFiles,\n generateFiles,\n updateJson,\n type GeneratorCallback,\n} from '@nx/devkit';\nimport { join } from 'path';\nimport type { LibGeneratorSchema } from './schema.js';\nimport { normalizeOptions } from './lib/index.js';\n\nexport async function libGenerator(tree: Tree, schema: LibGeneratorSchema): Promise<GeneratorCallback | void> {\n return libGeneratorInternal(tree, schema);\n}\n\nasync function libGeneratorInternal(\n tree: Tree,\n schema: LibGeneratorSchema,\n): Promise<GeneratorCallback | void> {\n const options = normalizeOptions(schema);\n\n // Generate project config files (project.json, tsconfig, jest)\n generateFiles(tree, join(__dirname, 'lib-project-files'), options.projectRoot, {\n ...options,\n tmpl: '',\n });\n\n // Generate type-specific source files\n const templateDir = join(__dirname, 'files', options.libType);\n generateFiles(tree, templateDir, options.projectRoot, {\n ...options,\n tmpl: '',\n });\n\n // Add path mapping to tsconfig.base.json if it exists\n if (tree.exists('tsconfig.base.json')) {\n updateJson(tree, 'tsconfig.base.json', (json) => {\n json.compilerOptions = json.compilerOptions ?? {};\n json.compilerOptions.paths = json.compilerOptions.paths ?? {};\n json.compilerOptions.paths[options.importPath] = [`${options.projectRoot}/src/index.ts`];\n return json;\n });\n }\n\n if (!options.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default libGenerator;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/generators/lib/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface LibGeneratorSchema {\n name: string;\n directory?: string;\n libType?: 'generic' | 'plugin' | 'adapter' | 'tool-register';\n publishable?: boolean;\n importPath?: string;\n tags?: string;\n skipFormat?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "FrontMcpLib",
|
|
4
|
+
"title": "FrontMCP Library Generator",
|
|
5
|
+
"description": "Generate a shared library",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the library",
|
|
11
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
12
|
+
"x-prompt": "What name would you like for the library?",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"directory": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The directory of the library (default: libs/<name>)",
|
|
18
|
+
"x-priority": "important"
|
|
19
|
+
},
|
|
20
|
+
"libType": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The type of library to generate",
|
|
23
|
+
"enum": ["generic", "plugin", "adapter", "tool-register"],
|
|
24
|
+
"default": "generic",
|
|
25
|
+
"x-prompt": {
|
|
26
|
+
"message": "What type of library?",
|
|
27
|
+
"type": "list",
|
|
28
|
+
"items": [
|
|
29
|
+
{ "value": "generic", "label": "Generic TypeScript library" },
|
|
30
|
+
{ "value": "plugin", "label": "FrontMCP Plugin" },
|
|
31
|
+
{ "value": "adapter", "label": "FrontMCP Adapter" },
|
|
32
|
+
{ "value": "tool-register", "label": "Tool Register (multi-tool)" }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"x-priority": "important"
|
|
36
|
+
},
|
|
37
|
+
"publishable": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "Generate a publishable library with package.json",
|
|
40
|
+
"default": false
|
|
41
|
+
},
|
|
42
|
+
"importPath": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "The npm scope/import path (e.g., @my-org/my-lib). Required for publishable libraries."
|
|
45
|
+
},
|
|
46
|
+
"tags": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Comma-separated tags for the project",
|
|
49
|
+
"x-priority": "internal"
|
|
50
|
+
},
|
|
51
|
+
"skipFormat": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"description": "Skip formatting files",
|
|
54
|
+
"default": false,
|
|
55
|
+
"x-priority": "internal"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": ["name"]
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context extension for <%= className %>Plugin.
|
|
3
|
+
*
|
|
4
|
+
* This file provides:
|
|
5
|
+
* 1. Module augmentation — TypeScript types for `this.<%= propertyName %>`
|
|
6
|
+
* 2. Runtime extension — prototype modification to make it available at runtime
|
|
7
|
+
*
|
|
8
|
+
* Usage in tools/resources/prompts:
|
|
9
|
+
* const value = this.<%= propertyName %>;
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// 1. Module augmentation
|
|
13
|
+
declare module '@frontmcp/sdk' {
|
|
14
|
+
interface ExecutionContextBase {
|
|
15
|
+
readonly <%= propertyName %>: unknown; // TODO: replace with actual type
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 2. Runtime extension
|
|
20
|
+
export function install<%= className %>ContextExtension(): void {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
22
|
+
const { ExecutionContextBase } = require('@frontmcp/sdk');
|
|
23
|
+
|
|
24
|
+
Object.defineProperty(ExecutionContextBase.prototype, '<%= propertyName %>', {
|
|
25
|
+
get: function () {
|
|
26
|
+
// TODO: return the appropriate value from DI container
|
|
27
|
+
// Example: return this.get(MY_TOKEN);
|
|
28
|
+
return undefined;
|
|
29
|
+
},
|
|
30
|
+
configurable: true,
|
|
31
|
+
enumerable: false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Plugin, DynamicPlugin, type PluginRegistrationContext } from '@frontmcp/sdk';
|
|
2
|
+
|
|
3
|
+
export interface <%= className %>PluginOptions {
|
|
4
|
+
// TODO: define plugin options
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@Plugin({
|
|
8
|
+
name: '<%= fileName %>',
|
|
9
|
+
description: 'TODO: describe what this plugin does',
|
|
10
|
+
})
|
|
11
|
+
export class <%= className %>Plugin extends DynamicPlugin<<%= className %>PluginOptions> {
|
|
12
|
+
async dynamicProviders() {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async onRegister(ctx: PluginRegistrationContext): Promise<void> {
|
|
17
|
+
// TODO: register tools, resources, prompts, or context extensions
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import type { PluginGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function pluginGenerator(tree: Tree, schema: PluginGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
|
+
export default pluginGenerator;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pluginGenerator = pluginGenerator;
|
|
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
|
+
const names_js_1 = require("../../utils/names.js");
|
|
8
|
+
async function pluginGenerator(tree, schema) {
|
|
9
|
+
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'plugins');
|
|
10
|
+
const withContextExtension = schema.withContextExtension ?? false;
|
|
11
|
+
const propertyName = (0, names_js_1.toPropertyName)(schema.name);
|
|
12
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
13
|
+
...options,
|
|
14
|
+
propertyName,
|
|
15
|
+
tmpl: '',
|
|
16
|
+
});
|
|
17
|
+
// Remove context extension file if not requested
|
|
18
|
+
if (!withContextExtension) {
|
|
19
|
+
const extensionPath = (0, path_1.join)(options.directory, `${options.fileName}.context-extension.ts`);
|
|
20
|
+
if (tree.exists(extensionPath)) {
|
|
21
|
+
tree.delete(extensionPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!schema.skipFormat) {
|
|
25
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = pluginGenerator;
|
|
29
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/generators/plugin/plugin.ts"],"names":[],"mappings":";;AAMA,0CAsBC;AA5BD,uCAA2F;AAC3F,+BAA4B;AAE5B,2EAA6E;AAC7E,mDAAsD;AAE/C,KAAK,UAAU,eAAe,CAAC,IAAU,EAAE,MAA6B;IAC7E,MAAM,OAAO,GAAG,IAAA,gDAAyB,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACnE,MAAM,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,IAAI,KAAK,CAAC;IAClE,MAAM,YAAY,GAAG,IAAA,yBAAc,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEjD,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE;QAC/D,GAAG,OAAO;QACV,YAAY;QACZ,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,iDAAiD;IACjD,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,QAAQ,uBAAuB,CAAC,CAAC;QAC1F,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,kBAAe,eAAe,CAAC","sourcesContent":["import { type Tree, formatFiles, generateFiles, type GeneratorCallback } from '@nx/devkit';\nimport { join } from 'path';\nimport type { PluginGeneratorSchema } from './schema.js';\nimport { normalizePrimitiveOptions } from '../../utils/normalize-options.js';\nimport { toPropertyName } from '../../utils/names.js';\n\nexport async function pluginGenerator(tree: Tree, schema: PluginGeneratorSchema): Promise<GeneratorCallback | void> {\n const options = normalizePrimitiveOptions(tree, schema, 'plugins');\n const withContextExtension = schema.withContextExtension ?? false;\n const propertyName = toPropertyName(schema.name);\n\n generateFiles(tree, join(__dirname, 'files'), options.directory, {\n ...options,\n propertyName,\n tmpl: '',\n });\n\n // Remove context extension file if not requested\n if (!withContextExtension) {\n const extensionPath = join(options.directory, `${options.fileName}.context-extension.ts`);\n if (tree.exists(extensionPath)) {\n tree.delete(extensionPath);\n }\n }\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default pluginGenerator;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/generators/plugin/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface PluginGeneratorSchema {\n name: string;\n project: string;\n withContextExtension?: boolean;\n directory?: string;\n skipFormat?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "FrontMcpPlugin",
|
|
4
|
+
"title": "FrontMCP Plugin Generator",
|
|
5
|
+
"description": "Generate a @Plugin class extending DynamicPlugin",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the plugin",
|
|
11
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
12
|
+
"x-prompt": "What name would you like for the plugin?",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The project to add the plugin to",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"withContextExtension": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Generate a context extension file (module augmentation + prototype extension)",
|
|
24
|
+
"default": false
|
|
25
|
+
},
|
|
26
|
+
"directory": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Subdirectory within src/plugins/"
|
|
29
|
+
},
|
|
30
|
+
"skipFormat": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"default": false,
|
|
33
|
+
"x-priority": "internal"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"required": ["name", "project"]
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Prompt, PromptContext } from '@frontmcp/sdk';
|
|
2
|
+
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
|
|
4
|
+
@Prompt({
|
|
5
|
+
name: '<%= name %>',
|
|
6
|
+
description: 'TODO: describe what this prompt does',<% if (promptArgs.length > 0) { %>
|
|
7
|
+
arguments: [<% promptArgs.forEach(function(arg, i) { %>
|
|
8
|
+
{ name: '<%= arg %>', description: 'TODO: describe', required: true },<% }); %>
|
|
9
|
+
],<% } %>
|
|
10
|
+
})
|
|
11
|
+
export default class <%= className %>Prompt extends PromptContext {
|
|
12
|
+
async execute(args: Record<string, string>): Promise<GetPromptResult> {
|
|
13
|
+
return {
|
|
14
|
+
messages: [
|
|
15
|
+
{
|
|
16
|
+
role: 'user',
|
|
17
|
+
content: {
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: 'TODO: implement prompt template',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import type { PromptGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function promptGenerator(tree: Tree, schema: PromptGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
|
+
export default promptGenerator;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promptGenerator = promptGenerator;
|
|
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 promptGenerator(tree, schema) {
|
|
8
|
+
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'prompts');
|
|
9
|
+
const promptArgs = schema.arguments
|
|
10
|
+
? schema.arguments
|
|
11
|
+
.split(',')
|
|
12
|
+
.map((a) => a.trim())
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
: [];
|
|
15
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
16
|
+
...options,
|
|
17
|
+
promptArgs,
|
|
18
|
+
tmpl: '',
|
|
19
|
+
});
|
|
20
|
+
if (!schema.skipFormat) {
|
|
21
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = promptGenerator;
|
|
25
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/generators/prompt/prompt.ts"],"names":[],"mappings":";;AAKA,0CAkBC;AAvBD,uCAA2F;AAC3F,+BAA4B;AAE5B,2EAA6E;AAEtE,KAAK,UAAU,eAAe,CAAC,IAAU,EAAE,MAA6B;IAC7E,MAAM,OAAO,GAAG,IAAA,gDAAyB,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS;QACjC,CAAC,CAAC,MAAM,CAAC,SAAS;aACb,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,UAAU;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,eAAe,CAAC","sourcesContent":["import { type Tree, formatFiles, generateFiles, type GeneratorCallback } from '@nx/devkit';\nimport { join } from 'path';\nimport type { PromptGeneratorSchema } from './schema.js';\nimport { normalizePrimitiveOptions } from '../../utils/normalize-options.js';\n\nexport async function promptGenerator(tree: Tree, schema: PromptGeneratorSchema): Promise<GeneratorCallback | void> {\n const options = normalizePrimitiveOptions(tree, schema, 'prompts');\n const promptArgs = schema.arguments\n ? schema.arguments\n .split(',')\n .map((a) => a.trim())\n .filter(Boolean)\n : [];\n\n generateFiles(tree, join(__dirname, 'files'), options.directory, {\n ...options,\n promptArgs,\n tmpl: '',\n });\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default promptGenerator;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/generators/prompt/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface PromptGeneratorSchema {\n name: string;\n project: string;\n arguments?: string;\n directory?: string;\n skipFormat?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "FrontMcpPrompt",
|
|
4
|
+
"title": "FrontMCP Prompt Generator",
|
|
5
|
+
"description": "Generate a @Prompt class",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the prompt",
|
|
11
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
12
|
+
"x-prompt": "What name would you like for the prompt?",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The project to add the prompt to",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"arguments": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Comma-separated argument names for the prompt"
|
|
24
|
+
},
|
|
25
|
+
"directory": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Subdirectory within src/prompts/"
|
|
28
|
+
},
|
|
29
|
+
"skipFormat": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": false,
|
|
32
|
+
"x-priority": "internal"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": ["name", "project"]
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Provider } from '@frontmcp/sdk';
|
|
2
|
+
|
|
3
|
+
export const <%= constantName %>_TOKEN = Symbol('<%= className %>Provider');
|
|
4
|
+
|
|
5
|
+
@Provider({
|
|
6
|
+
token: <%= constantName %>_TOKEN,
|
|
7
|
+
scope: '<%= scope %>',
|
|
8
|
+
})
|
|
9
|
+
export class <%= className %>Provider {
|
|
10
|
+
// TODO: implement provider logic
|
|
11
|
+
|
|
12
|
+
static factory(): <%= className %>Provider {
|
|
13
|
+
return new <%= className %>Provider();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import type { ProviderGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function providerGenerator(tree: Tree, schema: ProviderGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
|
+
export default providerGenerator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.providerGenerator = providerGenerator;
|
|
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 providerGenerator(tree, schema) {
|
|
8
|
+
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'providers');
|
|
9
|
+
const scope = schema.scope ?? 'singleton';
|
|
10
|
+
const constantName = (0, devkit_1.names)(schema.name).constantName;
|
|
11
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
12
|
+
...options,
|
|
13
|
+
scope,
|
|
14
|
+
constantName,
|
|
15
|
+
tmpl: '',
|
|
16
|
+
});
|
|
17
|
+
if (!schema.skipFormat) {
|
|
18
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = providerGenerator;
|
|
22
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/generators/provider/provider.ts"],"names":[],"mappings":";;AAKA,8CAkBC;AAvBD,uCAAkG;AAClG,+BAA4B;AAE5B,2EAA6E;AAEtE,KAAK,UAAU,iBAAiB,CACrC,IAAU,EACV,MAA+B;IAE/B,MAAM,OAAO,GAAG,IAAA,gDAAyB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,WAAW,CAAC;IAC1C,MAAM,YAAY,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC;IAErD,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE;QAC/D,GAAG,OAAO;QACV,KAAK;QACL,YAAY;QACZ,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,iBAAiB,CAAC","sourcesContent":["import { type Tree, formatFiles, generateFiles, names, type GeneratorCallback } from '@nx/devkit';\nimport { join } from 'path';\nimport type { ProviderGeneratorSchema } from './schema.js';\nimport { normalizePrimitiveOptions } from '../../utils/normalize-options.js';\n\nexport async function providerGenerator(\n tree: Tree,\n schema: ProviderGeneratorSchema,\n): Promise<GeneratorCallback | void> {\n const options = normalizePrimitiveOptions(tree, schema, 'providers');\n const scope = schema.scope ?? 'singleton';\n const constantName = names(schema.name).constantName;\n\n generateFiles(tree, join(__dirname, 'files'), options.directory, {\n ...options,\n scope,\n constantName,\n tmpl: '',\n });\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n}\n\nexport default providerGenerator;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/generators/provider/schema.ts"],"names":[],"mappings":"","sourcesContent":["export interface ProviderGeneratorSchema {\n name: string;\n project: string;\n scope?: 'singleton' | 'request' | 'context';\n directory?: string;\n skipFormat?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "FrontMcpProvider",
|
|
4
|
+
"title": "FrontMCP Provider Generator",
|
|
5
|
+
"description": "Generate a @Provider class for dependency injection",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the provider",
|
|
11
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
12
|
+
"x-prompt": "What name would you like for the provider?",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The project to add the provider to",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"scope": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The provider scope",
|
|
24
|
+
"enum": ["singleton", "request", "context"],
|
|
25
|
+
"default": "singleton"
|
|
26
|
+
},
|
|
27
|
+
"directory": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Subdirectory within src/providers/"
|
|
30
|
+
},
|
|
31
|
+
"skipFormat": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": false,
|
|
34
|
+
"x-priority": "internal"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": ["name", "project"]
|
|
38
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<% if (isTemplate) { %>import { ResourceTemplate, ResourceContext } from '@frontmcp/sdk';
|
|
2
|
+
|
|
3
|
+
@ResourceTemplate({
|
|
4
|
+
name: '<%= name %>',
|
|
5
|
+
uriTemplate: '<%= name %>://{id}',
|
|
6
|
+
description: 'TODO: describe this resource template',
|
|
7
|
+
mimeType: 'application/json',
|
|
8
|
+
})
|
|
9
|
+
export default class <%= className %>Resource extends ResourceContext {
|
|
10
|
+
async execute(uri: string, params: Record<string, string>) {
|
|
11
|
+
// TODO: implement — params.id available from URI template
|
|
12
|
+
return {
|
|
13
|
+
contents: [
|
|
14
|
+
{
|
|
15
|
+
uri,
|
|
16
|
+
mimeType: 'application/json',
|
|
17
|
+
text: JSON.stringify({ id: params.id }),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}<% } else { %>import { Resource, ResourceContext } from '@frontmcp/sdk';
|
|
23
|
+
|
|
24
|
+
@Resource({
|
|
25
|
+
name: '<%= name %>',
|
|
26
|
+
uri: '<%= name %>://data',
|
|
27
|
+
description: 'TODO: describe this resource',
|
|
28
|
+
mimeType: 'application/json',
|
|
29
|
+
})
|
|
30
|
+
export default class <%= className %>Resource extends ResourceContext {
|
|
31
|
+
async execute(uri: string) {
|
|
32
|
+
// TODO: implement
|
|
33
|
+
return {
|
|
34
|
+
contents: [
|
|
35
|
+
{
|
|
36
|
+
uri,
|
|
37
|
+
mimeType: 'application/json',
|
|
38
|
+
text: JSON.stringify({}),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}<% } %>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import type { ResourceGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function resourceGenerator(tree: Tree, schema: ResourceGeneratorSchema): Promise<GeneratorCallback | void>;
|
|
4
|
+
export default resourceGenerator;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resourceGenerator = resourceGenerator;
|
|
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 resourceGenerator(tree, schema) {
|
|
8
|
+
const options = (0, normalize_options_js_1.normalizePrimitiveOptions)(tree, schema, 'resources');
|
|
9
|
+
const isTemplate = schema.template ?? false;
|
|
10
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.directory, {
|
|
11
|
+
...options,
|
|
12
|
+
isTemplate,
|
|
13
|
+
tmpl: '',
|
|
14
|
+
});
|
|
15
|
+
if (!schema.skipFormat) {
|
|
16
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = resourceGenerator;
|
|
20
|
+
//# sourceMappingURL=resource.js.map
|