@agiflowai/scaffold-mcp 1.0.2 → 1.0.4
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/dist/{ScaffoldConfigLoader-DQMCLVGD.cjs → ScaffoldConfigLoader-B-NLy6VP.cjs} +1 -1
- package/dist/{ScaffoldConfigLoader-CI0T6zdG.js → ScaffoldConfigLoader-BDMJNI1o.mjs} +1 -1
- package/dist/ScaffoldConfigLoader-SHk-KEje.mjs +3 -0
- package/dist/{ScaffoldConfigLoader-BrmvENTo.cjs → ScaffoldConfigLoader-Y_SBLPg7.cjs} +0 -1
- package/dist/ScaffoldService-BNOyoqSb.cjs +3 -0
- package/dist/ScaffoldService-BNdfC21Z.mjs +3 -0
- package/dist/{ScaffoldService-DB7-Cyod.js → ScaffoldService-BNuN00Fm.mjs} +8 -8
- package/dist/{ScaffoldService-BwDmXt83.cjs → ScaffoldService-ChzxM0Yc.cjs} +1 -3
- package/dist/TemplateService-BRfzfaZs.mjs +3 -0
- package/dist/{TemplateService-CiZJA06s.js → TemplateService-Cg5QV29n.mjs} +1 -1
- package/dist/{TemplateService-DRubcvS9.cjs → TemplateService-D3ydJR_R.cjs} +0 -2
- package/dist/TemplateService-DqieT1Tq.cjs +3 -0
- package/dist/VariableReplacementService-BWCd-z7X.mjs +3 -0
- package/dist/{VariableReplacementService-D0QnWKUW.cjs → VariableReplacementService-CAjesAYq.cjs} +1 -2
- package/dist/{VariableReplacementService-DRxd9ILB.js → VariableReplacementService-DHIINRnJ.mjs} +5 -5
- package/dist/{VariableReplacementService-CroHkMha.cjs → VariableReplacementService-DKaF2C9l.cjs} +1 -1
- package/dist/cli.cjs +74 -138
- package/dist/{cli.js → cli.mjs} +74 -134
- package/dist/index.cjs +14 -18
- package/dist/index.d.cts +20 -6
- package/dist/{index.d.ts → index.d.mts} +21 -7
- package/dist/{index.js → index.mjs} +14 -16
- package/dist/{stdio-TGsG8akc.cjs → stdio-BGj_FLky.cjs} +471 -414
- package/dist/{stdio-Bxn4A1IU.js → stdio-wAlpLC6l.mjs} +474 -409
- package/package.json +6 -8
- package/dist/ScaffoldConfigLoader-DhthV6xq.js +0 -3
- package/dist/ScaffoldService-B3En_m4t.cjs +0 -3
- package/dist/ScaffoldService-CJ3vNmAj.js +0 -3
- package/dist/TemplateService-BZRt3NI8.cjs +0 -3
- package/dist/TemplateService-DropYdp8.js +0 -3
- package/dist/VariableReplacementService-BAwTGv_R.js +0 -3
- /package/dist/{cli.d.ts → cli.d.mts} +0 -0
|
@@ -4,7 +4,6 @@ node_path = require_chunk.__toESM(node_path);
|
|
|
4
4
|
let js_yaml = require("js-yaml");
|
|
5
5
|
js_yaml = require_chunk.__toESM(js_yaml);
|
|
6
6
|
let zod = require("zod");
|
|
7
|
-
zod = require_chunk.__toESM(zod);
|
|
8
7
|
|
|
9
8
|
//#region src/services/ScaffoldConfigLoader.ts
|
|
10
9
|
const VariablesSchemaSchema = zod.z.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplatesManagerService, log } from "@agiflowai/aicode-utils";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { TemplatesManagerService, log } from "@agiflowai/aicode-utils";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
//#region src/services/ScaffoldProcessingService.ts
|
|
@@ -68,9 +68,9 @@ var ScaffoldProcessingService = class {
|
|
|
68
68
|
if (!item) continue;
|
|
69
69
|
const itemPath = path.join(dirPath, item);
|
|
70
70
|
try {
|
|
71
|
-
const stat = await this.fileSystem.stat(itemPath);
|
|
72
|
-
if (stat.isDirectory()) await this.trackCreatedFilesRecursive(itemPath, createdFiles);
|
|
73
|
-
else if (stat.isFile()) createdFiles.push(itemPath);
|
|
71
|
+
const stat$1 = await this.fileSystem.stat(itemPath);
|
|
72
|
+
if (stat$1.isDirectory()) await this.trackCreatedFilesRecursive(itemPath, createdFiles);
|
|
73
|
+
else if (stat$1.isFile()) createdFiles.push(itemPath);
|
|
74
74
|
} catch (error) {
|
|
75
75
|
log.warn(`Cannot stat ${itemPath}: ${error}`);
|
|
76
76
|
}
|
|
@@ -91,9 +91,9 @@ var ScaffoldProcessingService = class {
|
|
|
91
91
|
if (!item) continue;
|
|
92
92
|
const itemPath = path.join(dirPath, item);
|
|
93
93
|
try {
|
|
94
|
-
const stat = await this.fileSystem.stat(itemPath);
|
|
95
|
-
if (stat.isDirectory()) await this.trackExistingFilesRecursive(itemPath, existingFiles);
|
|
96
|
-
else if (stat.isFile()) existingFiles.push(itemPath);
|
|
94
|
+
const stat$1 = await this.fileSystem.stat(itemPath);
|
|
95
|
+
if (stat$1.isDirectory()) await this.trackExistingFilesRecursive(itemPath, existingFiles);
|
|
96
|
+
else if (stat$1.isFile()) existingFiles.push(itemPath);
|
|
97
97
|
} catch (error) {
|
|
98
98
|
log.warn(`Cannot stat ${itemPath}: ${error}`);
|
|
99
99
|
}
|
|
@@ -290,4 +290,4 @@ var ScaffoldService = class {
|
|
|
290
290
|
};
|
|
291
291
|
|
|
292
292
|
//#endregion
|
|
293
|
-
export { ScaffoldProcessingService, ScaffoldService };
|
|
293
|
+
export { ScaffoldProcessingService as n, ScaffoldService as t };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
3
|
-
__agiflowai_aicode_utils = require_chunk.__toESM(__agiflowai_aicode_utils);
|
|
4
2
|
let node_path = require("node:path");
|
|
5
3
|
node_path = require_chunk.__toESM(node_path);
|
|
4
|
+
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
6
5
|
let node_url = require("node:url");
|
|
7
|
-
node_url = require_chunk.__toESM(node_url);
|
|
8
6
|
|
|
9
7
|
//#region src/services/ScaffoldProcessingService.ts
|
|
10
8
|
/**
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
3
|
-
__agiflowai_aicode_utils = require_chunk.__toESM(__agiflowai_aicode_utils);
|
|
4
3
|
let liquidjs = require("liquidjs");
|
|
5
|
-
liquidjs = require_chunk.__toESM(liquidjs);
|
|
6
4
|
|
|
7
5
|
//#region src/services/TemplateService.ts
|
|
8
6
|
var TemplateService = class {
|
package/dist/{VariableReplacementService-D0QnWKUW.cjs → VariableReplacementService-CAjesAYq.cjs}
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
3
|
-
__agiflowai_aicode_utils = require_chunk.__toESM(__agiflowai_aicode_utils);
|
|
4
2
|
let node_path = require("node:path");
|
|
5
3
|
node_path = require_chunk.__toESM(node_path);
|
|
4
|
+
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
6
5
|
|
|
7
6
|
//#region src/services/VariableReplacementService.ts
|
|
8
7
|
var VariableReplacementService = class {
|
package/dist/{VariableReplacementService-DRxd9ILB.js → VariableReplacementService-DHIINRnJ.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { log } from "@agiflowai/aicode-utils";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { log } from "@agiflowai/aicode-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/services/VariableReplacementService.ts
|
|
5
5
|
var VariableReplacementService = class {
|
|
@@ -38,9 +38,9 @@ var VariableReplacementService = class {
|
|
|
38
38
|
if (!item) continue;
|
|
39
39
|
const itemPath = path.join(dirPath, item);
|
|
40
40
|
try {
|
|
41
|
-
const stat = await this.fileSystem.stat(itemPath);
|
|
42
|
-
if (stat.isDirectory()) await this.processFilesForVariableReplacement(itemPath, variables);
|
|
43
|
-
else if (stat.isFile()) await this.replaceVariablesInFile(itemPath, variables);
|
|
41
|
+
const stat$1 = await this.fileSystem.stat(itemPath);
|
|
42
|
+
if (stat$1.isDirectory()) await this.processFilesForVariableReplacement(itemPath, variables);
|
|
43
|
+
else if (stat$1.isFile()) await this.replaceVariablesInFile(itemPath, variables);
|
|
44
44
|
} catch (error) {
|
|
45
45
|
log.warn(`Skipping item ${itemPath}: ${error}`);
|
|
46
46
|
}
|
|
@@ -63,4 +63,4 @@ var VariableReplacementService = class {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
//#endregion
|
|
66
|
-
export { VariableReplacementService };
|
|
66
|
+
export { VariableReplacementService as t };
|
package/dist/{VariableReplacementService-CroHkMha.cjs → VariableReplacementService-DKaF2C9l.cjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const require_VariableReplacementService = require('./VariableReplacementService-
|
|
1
|
+
const require_VariableReplacementService = require('./VariableReplacementService-CAjesAYq.cjs');
|
|
2
2
|
|
|
3
3
|
exports.VariableReplacementService = require_VariableReplacementService.VariableReplacementService;
|
package/dist/cli.cjs
CHANGED
|
@@ -1,116 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
3
|
-
const require_stdio = require('./stdio-
|
|
4
|
-
require('./ScaffoldConfigLoader-
|
|
5
|
-
require('./ScaffoldService-
|
|
6
|
-
const require_TemplateService = require('./TemplateService-
|
|
7
|
-
require('./VariableReplacementService-
|
|
8
|
-
let commander = require("commander");
|
|
9
|
-
commander = require_chunk.__toESM(commander);
|
|
10
|
-
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
11
|
-
__agiflowai_aicode_utils = require_chunk.__toESM(__agiflowai_aicode_utils);
|
|
3
|
+
const require_stdio = require('./stdio-BGj_FLky.cjs');
|
|
4
|
+
require('./ScaffoldConfigLoader-Y_SBLPg7.cjs');
|
|
5
|
+
require('./ScaffoldService-ChzxM0Yc.cjs');
|
|
6
|
+
const require_TemplateService = require('./TemplateService-D3ydJR_R.cjs');
|
|
7
|
+
require('./VariableReplacementService-CAjesAYq.cjs');
|
|
12
8
|
let node_path = require("node:path");
|
|
13
9
|
node_path = require_chunk.__toESM(node_path);
|
|
14
|
-
let
|
|
15
|
-
__modelcontextprotocol_sdk_server_index_js = require_chunk.__toESM(__modelcontextprotocol_sdk_server_index_js);
|
|
10
|
+
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
16
11
|
let __modelcontextprotocol_sdk_types_js = require("@modelcontextprotocol/sdk/types.js");
|
|
17
|
-
|
|
12
|
+
let commander = require("commander");
|
|
13
|
+
let __modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
|
|
18
14
|
|
|
19
15
|
//#region package.json
|
|
20
|
-
var
|
|
21
|
-
var description = "MCP server for scaffolding applications with boilerplate templates";
|
|
22
|
-
var version = "1.0.1";
|
|
23
|
-
var license = "AGPL-3.0";
|
|
24
|
-
var author = "AgiflowIO";
|
|
25
|
-
var repository = {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "https://github.com/AgiFlow/aicode-toolkit.git",
|
|
28
|
-
"directory": "packages/scaffold-mcp"
|
|
29
|
-
};
|
|
30
|
-
var homepage = "https://github.com/AgiFlow/aicode-toolkit#readme";
|
|
31
|
-
var bugs = { "url": "https://github.com/AgiFlow/aicode-toolkit/issues" };
|
|
32
|
-
var keywords = [
|
|
33
|
-
"mcp",
|
|
34
|
-
"model-context-protocol",
|
|
35
|
-
"scaffold",
|
|
36
|
-
"boilerplate",
|
|
37
|
-
"template",
|
|
38
|
-
"code-generation",
|
|
39
|
-
"nextjs",
|
|
40
|
-
"react",
|
|
41
|
-
"vite"
|
|
42
|
-
];
|
|
43
|
-
var bin = { "scaffold-mcp": "./dist/cli.cjs" };
|
|
44
|
-
var main$1 = "./dist/index.cjs";
|
|
45
|
-
var types = "./dist/index.d.cts";
|
|
46
|
-
var module$1 = "./dist/index.js";
|
|
47
|
-
var files = ["dist", "README.md"];
|
|
48
|
-
var scripts = {
|
|
49
|
-
"dev": "node --loader ts-node/esm src/cli.ts",
|
|
50
|
-
"build": "tsdown",
|
|
51
|
-
"test": "vitest --run",
|
|
52
|
-
"typecheck": "tsc --noEmit"
|
|
53
|
-
};
|
|
54
|
-
var dependencies = {
|
|
55
|
-
"@agiflowai/aicode-utils": "workspace:*",
|
|
56
|
-
"@composio/json-schema-to-zod": "0.1.15",
|
|
57
|
-
"@inquirer/prompts": "^7.8.6",
|
|
58
|
-
"@modelcontextprotocol/sdk": "1.19.1",
|
|
59
|
-
"chalk": "5.6.2",
|
|
60
|
-
"commander": "14.0.1",
|
|
61
|
-
"execa": "^9.5.2",
|
|
62
|
-
"express": "^4.21.2",
|
|
63
|
-
"fs-extra": "11.3.2",
|
|
64
|
-
"js-yaml": "4.1.0",
|
|
65
|
-
"liquidjs": "10.21.1",
|
|
66
|
-
"pino": "^10.0.0",
|
|
67
|
-
"pino-pretty": "^13.1.1",
|
|
68
|
-
"zod": "3.25.76"
|
|
69
|
-
};
|
|
70
|
-
var devDependencies = {
|
|
71
|
-
"@types/express": "^5.0.0",
|
|
72
|
-
"@types/fs-extra": "^11.0.4",
|
|
73
|
-
"@types/js-yaml": "^4.0.9",
|
|
74
|
-
"@types/node": "^22.0.0",
|
|
75
|
-
"tsdown": "^0.15.6",
|
|
76
|
-
"typescript": "5.9.3",
|
|
77
|
-
"unplugin-raw": "^0.6.3"
|
|
78
|
-
};
|
|
79
|
-
var publishConfig = { "access": "public" };
|
|
80
|
-
var type = "module";
|
|
81
|
-
var exports$1 = {
|
|
82
|
-
".": {
|
|
83
|
-
"import": "./dist/index.js",
|
|
84
|
-
"require": "./dist/index.cjs"
|
|
85
|
-
},
|
|
86
|
-
"./cli": {
|
|
87
|
-
"import": "./dist/cli.js",
|
|
88
|
-
"require": "./dist/cli.cjs"
|
|
89
|
-
},
|
|
90
|
-
"./package.json": "./package.json"
|
|
91
|
-
};
|
|
92
|
-
var package_default = {
|
|
93
|
-
name,
|
|
94
|
-
description,
|
|
95
|
-
version,
|
|
96
|
-
license,
|
|
97
|
-
author,
|
|
98
|
-
repository,
|
|
99
|
-
homepage,
|
|
100
|
-
bugs,
|
|
101
|
-
keywords,
|
|
102
|
-
bin,
|
|
103
|
-
main: main$1,
|
|
104
|
-
types,
|
|
105
|
-
module: module$1,
|
|
106
|
-
files,
|
|
107
|
-
scripts,
|
|
108
|
-
dependencies,
|
|
109
|
-
devDependencies,
|
|
110
|
-
publishConfig,
|
|
111
|
-
type,
|
|
112
|
-
exports: exports$1
|
|
113
|
-
};
|
|
16
|
+
var version = "1.0.4";
|
|
114
17
|
|
|
115
18
|
//#endregion
|
|
116
19
|
//#region src/commands/boilerplate.ts
|
|
@@ -118,9 +21,9 @@ var package_default = {
|
|
|
118
21
|
* Boilerplate CLI command
|
|
119
22
|
*/
|
|
120
23
|
const boilerplateCommand = new commander.Command("boilerplate").description("Manage boilerplate templates");
|
|
121
|
-
boilerplateCommand.command("list").description("List all available boilerplate templates").action(async () => {
|
|
24
|
+
boilerplateCommand.command("list").description("List all available boilerplate templates").option("-c, --cursor <cursor>", "Pagination cursor for next page").action(async (options) => {
|
|
122
25
|
try {
|
|
123
|
-
const { boilerplates } = await new require_stdio.BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath()).listBoilerplates();
|
|
26
|
+
const { boilerplates, nextCursor } = await new require_stdio.BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath()).listBoilerplates(options.cursor);
|
|
124
27
|
if (boilerplates.length === 0) {
|
|
125
28
|
__agiflowai_aicode_utils.messages.warning("No boilerplate templates found.");
|
|
126
29
|
return;
|
|
@@ -134,6 +37,11 @@ boilerplateCommand.command("list").description("List all available boilerplate t
|
|
|
134
37
|
if (required && required.length > 0) __agiflowai_aicode_utils.print.debug(` Required: ${required.join(", ")}`);
|
|
135
38
|
__agiflowai_aicode_utils.print.newline();
|
|
136
39
|
}
|
|
40
|
+
if (nextCursor) {
|
|
41
|
+
__agiflowai_aicode_utils.print.newline();
|
|
42
|
+
__agiflowai_aicode_utils.print.info(`${__agiflowai_aicode_utils.icons.info} More results available. Use --cursor to fetch next page:`);
|
|
43
|
+
__agiflowai_aicode_utils.print.debug(` scaffold-mcp boilerplate list --cursor "${nextCursor}"`);
|
|
44
|
+
}
|
|
137
45
|
} catch (error) {
|
|
138
46
|
__agiflowai_aicode_utils.messages.error("Error listing boilerplates:", error);
|
|
139
47
|
process.exit(1);
|
|
@@ -152,9 +60,15 @@ boilerplateCommand.command("create <boilerplateName>").description("Create a new
|
|
|
152
60
|
}
|
|
153
61
|
const boilerplate = await boilerplateService.getBoilerplate(boilerplateName);
|
|
154
62
|
if (!boilerplate) {
|
|
155
|
-
|
|
63
|
+
let allBoilerplates = [];
|
|
64
|
+
let cursor;
|
|
65
|
+
do {
|
|
66
|
+
const result$1 = await boilerplateService.listBoilerplates(cursor);
|
|
67
|
+
allBoilerplates = allBoilerplates.concat(result$1.boilerplates);
|
|
68
|
+
cursor = result$1.nextCursor;
|
|
69
|
+
} while (cursor);
|
|
156
70
|
__agiflowai_aicode_utils.messages.error(`Boilerplate '${boilerplateName}' not found.`);
|
|
157
|
-
__agiflowai_aicode_utils.print.warning(`Available boilerplates: ${
|
|
71
|
+
__agiflowai_aicode_utils.print.warning(`Available boilerplates: ${allBoilerplates.map((b) => b.name).join(", ")}`);
|
|
158
72
|
process.exit(1);
|
|
159
73
|
}
|
|
160
74
|
const required = typeof boilerplate.variables_schema === "object" && boilerplate.variables_schema !== null && "required" in boilerplate.variables_schema ? boilerplate.variables_schema.required : [];
|
|
@@ -446,7 +360,7 @@ function createServer(options = {}) {
|
|
|
446
360
|
});
|
|
447
361
|
const server = new __modelcontextprotocol_sdk_server_index_js.Server({
|
|
448
362
|
name: "scaffold-mcp",
|
|
449
|
-
version
|
|
363
|
+
version
|
|
450
364
|
}, {
|
|
451
365
|
instructions,
|
|
452
366
|
capabilities: {
|
|
@@ -472,31 +386,31 @@ function createServer(options = {}) {
|
|
|
472
386
|
return { tools };
|
|
473
387
|
});
|
|
474
388
|
server.setRequestHandler(__modelcontextprotocol_sdk_types_js.CallToolRequestSchema, async (request) => {
|
|
475
|
-
const { name
|
|
476
|
-
if (name
|
|
389
|
+
const { name, arguments: args } = request.params;
|
|
390
|
+
if (name === require_stdio.ListBoilerplatesTool.TOOL_NAME) {
|
|
477
391
|
if (isMonolith || !listBoilerplatesTool) throw new Error("Boilerplate tools are not available for monolith projects");
|
|
478
392
|
return await listBoilerplatesTool.execute(args || {});
|
|
479
393
|
}
|
|
480
|
-
if (name
|
|
394
|
+
if (name === require_stdio.UseBoilerplateTool.TOOL_NAME) {
|
|
481
395
|
if (isMonolith || !useBoilerplateTool) throw new Error("Boilerplate tools are not available for monolith projects");
|
|
482
396
|
return await useBoilerplateTool.execute(args || {});
|
|
483
397
|
}
|
|
484
|
-
if (name
|
|
485
|
-
if (name
|
|
486
|
-
if (name
|
|
487
|
-
if (name
|
|
398
|
+
if (name === require_stdio.ListScaffoldingMethodsTool.TOOL_NAME) return await listScaffoldingMethodsTool.execute(args || {});
|
|
399
|
+
if (name === require_stdio.UseScaffoldMethodTool.TOOL_NAME) return await useScaffoldMethodTool.execute(args || {});
|
|
400
|
+
if (name === require_stdio.WriteToFileTool.TOOL_NAME) return await writeToFileTool.execute(args || {});
|
|
401
|
+
if (name === require_stdio.GenerateBoilerplateTool.TOOL_NAME) {
|
|
488
402
|
if (!adminEnabled || !generateBoilerplateTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
489
403
|
return await generateBoilerplateTool.execute(args);
|
|
490
404
|
}
|
|
491
|
-
if (name
|
|
405
|
+
if (name === require_stdio.GenerateBoilerplateFileTool.TOOL_NAME) {
|
|
492
406
|
if (!adminEnabled || !generateBoilerplateFileTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
493
407
|
return await generateBoilerplateFileTool.execute(args);
|
|
494
408
|
}
|
|
495
|
-
if (name
|
|
409
|
+
if (name === require_stdio.GenerateFeatureScaffoldTool.TOOL_NAME) {
|
|
496
410
|
if (!adminEnabled || !generateFeatureScaffoldTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
497
411
|
return await generateFeatureScaffoldTool.execute(args);
|
|
498
412
|
}
|
|
499
|
-
throw new Error(`Unknown tool: ${name
|
|
413
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
500
414
|
});
|
|
501
415
|
server.setRequestHandler(__modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async () => {
|
|
502
416
|
const prompts = [];
|
|
@@ -509,18 +423,18 @@ function createServer(options = {}) {
|
|
|
509
423
|
return { prompts };
|
|
510
424
|
});
|
|
511
425
|
server.setRequestHandler(__modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
|
|
512
|
-
const { name
|
|
513
|
-
if (name
|
|
514
|
-
if (name
|
|
515
|
-
if (name
|
|
426
|
+
const { name, arguments: args } = request.params;
|
|
427
|
+
if (name === ScaffoldApplicationPrompt.PROMPT_NAME) return { messages: scaffoldApplicationPrompt.getMessages(args) };
|
|
428
|
+
if (name === ScaffoldFeaturePrompt.PROMPT_NAME) return { messages: scaffoldFeaturePrompt.getMessages(args) };
|
|
429
|
+
if (name === GenerateBoilerplatePrompt.PROMPT_NAME) {
|
|
516
430
|
if (!generateBoilerplatePrompt) throw new Error("Prompt not available");
|
|
517
431
|
return { messages: generateBoilerplatePrompt.getMessages(args) };
|
|
518
432
|
}
|
|
519
|
-
if (name
|
|
433
|
+
if (name === GenerateFeatureScaffoldPrompt.PROMPT_NAME) {
|
|
520
434
|
if (!generateFeatureScaffoldPrompt) throw new Error("Prompt not available");
|
|
521
435
|
return { messages: generateFeatureScaffoldPrompt.getMessages(args) };
|
|
522
436
|
}
|
|
523
|
-
throw new Error(`Unknown prompt: ${name
|
|
437
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
524
438
|
});
|
|
525
439
|
return server;
|
|
526
440
|
}
|
|
@@ -601,7 +515,7 @@ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MC
|
|
|
601
515
|
* Scaffold CLI command
|
|
602
516
|
*/
|
|
603
517
|
const scaffoldCommand = new commander.Command("scaffold").description("Add features to existing projects");
|
|
604
|
-
scaffoldCommand.command("list [projectPath]").description("List available scaffolding methods for a project or template").option("-t, --template <name>", "Template name (e.g., nextjs-15, typescript-mcp-package)").action(async (projectPath, options) => {
|
|
518
|
+
scaffoldCommand.command("list [projectPath]").description("List available scaffolding methods for a project or template").option("-t, --template <name>", "Template name (e.g., nextjs-15, typescript-mcp-package)").option("-c, --cursor <cursor>", "Pagination cursor for next page").action(async (projectPath, options) => {
|
|
605
519
|
try {
|
|
606
520
|
if (!projectPath && !options.template) {
|
|
607
521
|
__agiflowai_aicode_utils.messages.error("Either projectPath or --template option must be provided");
|
|
@@ -621,10 +535,10 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
|
|
|
621
535
|
__agiflowai_aicode_utils.messages.hint("For monorepo: ensure project.json exists with sourceTemplate field\nFor monolith: ensure toolkit.yaml exists at workspace root\nOr use --template option to list methods for a specific template");
|
|
622
536
|
process.exit(1);
|
|
623
537
|
}
|
|
624
|
-
result = await scaffoldingMethodsService.listScaffoldingMethods(absolutePath);
|
|
538
|
+
result = await scaffoldingMethodsService.listScaffoldingMethods(absolutePath, options.cursor);
|
|
625
539
|
displayName = projectPath;
|
|
626
540
|
} else {
|
|
627
|
-
result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template);
|
|
541
|
+
result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template, options.cursor);
|
|
628
542
|
displayName = `template: ${options.template}`;
|
|
629
543
|
}
|
|
630
544
|
const methods = result.methods;
|
|
@@ -639,6 +553,13 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
|
|
|
639
553
|
if (method.variables_schema.required && method.variables_schema.required.length > 0) __agiflowai_aicode_utils.print.debug(` Required: ${method.variables_schema.required.join(", ")}`);
|
|
640
554
|
__agiflowai_aicode_utils.print.newline();
|
|
641
555
|
}
|
|
556
|
+
if (result.nextCursor) {
|
|
557
|
+
__agiflowai_aicode_utils.print.newline();
|
|
558
|
+
__agiflowai_aicode_utils.print.info(`${__agiflowai_aicode_utils.icons.info} More results available. Use --cursor to fetch next page:`);
|
|
559
|
+
const cursorOption = `--cursor "${result.nextCursor}"`;
|
|
560
|
+
if (projectPath) __agiflowai_aicode_utils.print.debug(` scaffold-mcp scaffold list ${projectPath} ${cursorOption}`);
|
|
561
|
+
else __agiflowai_aicode_utils.print.debug(` scaffold-mcp scaffold list --template ${options.template} ${cursorOption}`);
|
|
562
|
+
}
|
|
642
563
|
} catch (error) {
|
|
643
564
|
__agiflowai_aicode_utils.messages.error("Error listing scaffolding methods:", error);
|
|
644
565
|
process.exit(1);
|
|
@@ -662,11 +583,17 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
|
|
|
662
583
|
}
|
|
663
584
|
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
664
585
|
const scaffoldingMethodsService = new require_stdio.ScaffoldingMethodsService(new require_stdio.FileSystemService(), templatesDir);
|
|
665
|
-
|
|
666
|
-
|
|
586
|
+
let allMethods = [];
|
|
587
|
+
let cursor;
|
|
588
|
+
do {
|
|
589
|
+
const listResult = await scaffoldingMethodsService.listScaffoldingMethods(projectPath, cursor);
|
|
590
|
+
allMethods = allMethods.concat(listResult.methods);
|
|
591
|
+
cursor = listResult.nextCursor;
|
|
592
|
+
} while (cursor);
|
|
593
|
+
const method = allMethods.find((m) => m.name === featureName);
|
|
667
594
|
if (!method) {
|
|
668
595
|
__agiflowai_aicode_utils.messages.error(`Scaffold method '${featureName}' not found.`);
|
|
669
|
-
__agiflowai_aicode_utils.print.warning(`Available methods: ${
|
|
596
|
+
__agiflowai_aicode_utils.print.warning(`Available methods: ${allMethods.map((m) => m.name).join(", ")}`);
|
|
670
597
|
__agiflowai_aicode_utils.print.debug(`Run 'scaffold-mcp scaffold list ${options.project}' to see all available methods`);
|
|
671
598
|
process.exit(1);
|
|
672
599
|
}
|
|
@@ -727,7 +654,8 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
727
654
|
}
|
|
728
655
|
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
729
656
|
const scaffoldingMethodsService = new require_stdio.ScaffoldingMethodsService(new require_stdio.FileSystemService(), templatesDir);
|
|
730
|
-
let
|
|
657
|
+
let allMethods = [];
|
|
658
|
+
let cursor;
|
|
731
659
|
if (options.project) {
|
|
732
660
|
const projectPath = node_path.default.resolve(options.project);
|
|
733
661
|
if (!await __agiflowai_aicode_utils.ProjectConfigResolver.hasConfiguration(projectPath)) {
|
|
@@ -735,9 +663,17 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
735
663
|
__agiflowai_aicode_utils.messages.hint("For monorepo: ensure project.json exists with sourceTemplate field\nFor monolith: ensure toolkit.yaml exists at workspace root\nOr use --template option to view info for a specific template");
|
|
736
664
|
process.exit(1);
|
|
737
665
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
666
|
+
do {
|
|
667
|
+
const result = await scaffoldingMethodsService.listScaffoldingMethods(projectPath, cursor);
|
|
668
|
+
allMethods = allMethods.concat(result.methods);
|
|
669
|
+
cursor = result.nextCursor;
|
|
670
|
+
} while (cursor);
|
|
671
|
+
} else do {
|
|
672
|
+
const result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template, cursor);
|
|
673
|
+
allMethods = allMethods.concat(result.methods);
|
|
674
|
+
cursor = result.nextCursor;
|
|
675
|
+
} while (cursor);
|
|
676
|
+
const method = allMethods.find((m) => m.name === featureName);
|
|
741
677
|
if (!method) {
|
|
742
678
|
__agiflowai_aicode_utils.messages.error(`❌ Scaffold method '${featureName}' not found.`);
|
|
743
679
|
process.exit(1);
|
|
@@ -768,7 +704,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
768
704
|
*/
|
|
769
705
|
async function main() {
|
|
770
706
|
const program = new commander.Command();
|
|
771
|
-
program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version(
|
|
707
|
+
program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version(version);
|
|
772
708
|
program.addCommand(mcpServeCommand);
|
|
773
709
|
program.addCommand(boilerplateCommand);
|
|
774
710
|
program.addCommand(scaffoldCommand);
|