@agiflowai/scaffold-mcp 1.0.3 → 1.0.5
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 +27 -124
- package/dist/{cli.js → cli.mjs} +27 -120
- package/dist/index.cjs +14 -18
- package/dist/{index.d.ts → index.d.mts} +1 -1
- package/dist/{index.js → index.mjs} +14 -16
- package/dist/{stdio-DM_C4xbZ.cjs → stdio-BGj_FLky.cjs} +410 -423
- package/dist/{stdio-BheRzmRj.js → stdio-wAlpLC6l.mjs} +413 -418
- 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.2";
|
|
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
|
|
@@ -457,7 +360,7 @@ function createServer(options = {}) {
|
|
|
457
360
|
});
|
|
458
361
|
const server = new __modelcontextprotocol_sdk_server_index_js.Server({
|
|
459
362
|
name: "scaffold-mcp",
|
|
460
|
-
version
|
|
363
|
+
version
|
|
461
364
|
}, {
|
|
462
365
|
instructions,
|
|
463
366
|
capabilities: {
|
|
@@ -483,31 +386,31 @@ function createServer(options = {}) {
|
|
|
483
386
|
return { tools };
|
|
484
387
|
});
|
|
485
388
|
server.setRequestHandler(__modelcontextprotocol_sdk_types_js.CallToolRequestSchema, async (request) => {
|
|
486
|
-
const { name
|
|
487
|
-
if (name
|
|
389
|
+
const { name, arguments: args } = request.params;
|
|
390
|
+
if (name === require_stdio.ListBoilerplatesTool.TOOL_NAME) {
|
|
488
391
|
if (isMonolith || !listBoilerplatesTool) throw new Error("Boilerplate tools are not available for monolith projects");
|
|
489
392
|
return await listBoilerplatesTool.execute(args || {});
|
|
490
393
|
}
|
|
491
|
-
if (name
|
|
394
|
+
if (name === require_stdio.UseBoilerplateTool.TOOL_NAME) {
|
|
492
395
|
if (isMonolith || !useBoilerplateTool) throw new Error("Boilerplate tools are not available for monolith projects");
|
|
493
396
|
return await useBoilerplateTool.execute(args || {});
|
|
494
397
|
}
|
|
495
|
-
if (name
|
|
496
|
-
if (name
|
|
497
|
-
if (name
|
|
498
|
-
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) {
|
|
499
402
|
if (!adminEnabled || !generateBoilerplateTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
500
403
|
return await generateBoilerplateTool.execute(args);
|
|
501
404
|
}
|
|
502
|
-
if (name
|
|
405
|
+
if (name === require_stdio.GenerateBoilerplateFileTool.TOOL_NAME) {
|
|
503
406
|
if (!adminEnabled || !generateBoilerplateFileTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
504
407
|
return await generateBoilerplateFileTool.execute(args);
|
|
505
408
|
}
|
|
506
|
-
if (name
|
|
409
|
+
if (name === require_stdio.GenerateFeatureScaffoldTool.TOOL_NAME) {
|
|
507
410
|
if (!adminEnabled || !generateFeatureScaffoldTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
508
411
|
return await generateFeatureScaffoldTool.execute(args);
|
|
509
412
|
}
|
|
510
|
-
throw new Error(`Unknown tool: ${name
|
|
413
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
511
414
|
});
|
|
512
415
|
server.setRequestHandler(__modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async () => {
|
|
513
416
|
const prompts = [];
|
|
@@ -520,18 +423,18 @@ function createServer(options = {}) {
|
|
|
520
423
|
return { prompts };
|
|
521
424
|
});
|
|
522
425
|
server.setRequestHandler(__modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
|
|
523
|
-
const { name
|
|
524
|
-
if (name
|
|
525
|
-
if (name
|
|
526
|
-
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) {
|
|
527
430
|
if (!generateBoilerplatePrompt) throw new Error("Prompt not available");
|
|
528
431
|
return { messages: generateBoilerplatePrompt.getMessages(args) };
|
|
529
432
|
}
|
|
530
|
-
if (name
|
|
433
|
+
if (name === GenerateFeatureScaffoldPrompt.PROMPT_NAME) {
|
|
531
434
|
if (!generateFeatureScaffoldPrompt) throw new Error("Prompt not available");
|
|
532
435
|
return { messages: generateFeatureScaffoldPrompt.getMessages(args) };
|
|
533
436
|
}
|
|
534
|
-
throw new Error(`Unknown prompt: ${name
|
|
437
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
535
438
|
});
|
|
536
439
|
return server;
|
|
537
440
|
}
|
|
@@ -801,7 +704,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
801
704
|
*/
|
|
802
705
|
async function main() {
|
|
803
706
|
const program = new commander.Command();
|
|
804
|
-
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);
|
|
805
708
|
program.addCommand(mcpServeCommand);
|
|
806
709
|
program.addCommand(boilerplateCommand);
|
|
807
710
|
program.addCommand(scaffoldCommand);
|
package/dist/{cli.js → cli.mjs}
RENAMED
|
@@ -1,110 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import "./ScaffoldConfigLoader-
|
|
4
|
-
import "./ScaffoldService-
|
|
5
|
-
import { TemplateService } from "./TemplateService-
|
|
6
|
-
import "./VariableReplacementService-
|
|
7
|
-
import { Command } from "commander";
|
|
8
|
-
import { ProjectConfigResolver, TemplatesManagerService, icons, messages, print, sections } from "@agiflowai/aicode-utils";
|
|
2
|
+
import { a as UseScaffoldMethodTool, c as ListBoilerplatesTool, d as GenerateBoilerplateFileTool, f as ScaffoldingMethodsService, h as FileSystemService, i as WriteToFileTool, l as GenerateFeatureScaffoldTool, m as BoilerplateService, n as SseTransportHandler, o as UseBoilerplateTool, r as HttpTransportHandler, s as ListScaffoldingMethodsTool, t as StdioTransportHandler, u as GenerateBoilerplateTool } from "./stdio-wAlpLC6l.mjs";
|
|
3
|
+
import "./ScaffoldConfigLoader-BDMJNI1o.mjs";
|
|
4
|
+
import "./ScaffoldService-BNuN00Fm.mjs";
|
|
5
|
+
import { t as TemplateService } from "./TemplateService-Cg5QV29n.mjs";
|
|
6
|
+
import "./VariableReplacementService-DHIINRnJ.mjs";
|
|
9
7
|
import path from "node:path";
|
|
10
|
-
import {
|
|
8
|
+
import { ProjectConfigResolver, TemplatesManagerService, icons, messages, print, sections } from "@agiflowai/aicode-utils";
|
|
11
9
|
import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
+
import { Command } from "commander";
|
|
11
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var
|
|
15
|
-
var description = "MCP server for scaffolding applications with boilerplate templates";
|
|
16
|
-
var version = "1.0.2";
|
|
17
|
-
var license = "AGPL-3.0";
|
|
18
|
-
var author = "AgiflowIO";
|
|
19
|
-
var repository = {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "https://github.com/AgiFlow/aicode-toolkit.git",
|
|
22
|
-
"directory": "packages/scaffold-mcp"
|
|
23
|
-
};
|
|
24
|
-
var homepage = "https://github.com/AgiFlow/aicode-toolkit#readme";
|
|
25
|
-
var bugs = { "url": "https://github.com/AgiFlow/aicode-toolkit/issues" };
|
|
26
|
-
var keywords = [
|
|
27
|
-
"mcp",
|
|
28
|
-
"model-context-protocol",
|
|
29
|
-
"scaffold",
|
|
30
|
-
"boilerplate",
|
|
31
|
-
"template",
|
|
32
|
-
"code-generation",
|
|
33
|
-
"nextjs",
|
|
34
|
-
"react",
|
|
35
|
-
"vite"
|
|
36
|
-
];
|
|
37
|
-
var bin = { "scaffold-mcp": "./dist/cli.cjs" };
|
|
38
|
-
var main$1 = "./dist/index.cjs";
|
|
39
|
-
var types = "./dist/index.d.cts";
|
|
40
|
-
var module = "./dist/index.js";
|
|
41
|
-
var files = ["dist", "README.md"];
|
|
42
|
-
var scripts = {
|
|
43
|
-
"dev": "node --loader ts-node/esm src/cli.ts",
|
|
44
|
-
"build": "tsdown",
|
|
45
|
-
"test": "vitest --run",
|
|
46
|
-
"typecheck": "tsc --noEmit"
|
|
47
|
-
};
|
|
48
|
-
var dependencies = {
|
|
49
|
-
"@agiflowai/aicode-utils": "workspace:*",
|
|
50
|
-
"@composio/json-schema-to-zod": "0.1.15",
|
|
51
|
-
"@inquirer/prompts": "^7.8.6",
|
|
52
|
-
"@modelcontextprotocol/sdk": "1.19.1",
|
|
53
|
-
"chalk": "5.6.2",
|
|
54
|
-
"commander": "14.0.1",
|
|
55
|
-
"execa": "^9.5.2",
|
|
56
|
-
"express": "^4.21.2",
|
|
57
|
-
"fs-extra": "11.3.2",
|
|
58
|
-
"js-yaml": "4.1.0",
|
|
59
|
-
"liquidjs": "10.21.1",
|
|
60
|
-
"pino": "^10.0.0",
|
|
61
|
-
"pino-pretty": "^13.1.1",
|
|
62
|
-
"zod": "3.25.76"
|
|
63
|
-
};
|
|
64
|
-
var devDependencies = {
|
|
65
|
-
"@types/express": "^5.0.0",
|
|
66
|
-
"@types/fs-extra": "^11.0.4",
|
|
67
|
-
"@types/js-yaml": "^4.0.9",
|
|
68
|
-
"@types/node": "^22.0.0",
|
|
69
|
-
"tsdown": "^0.15.6",
|
|
70
|
-
"typescript": "5.9.3",
|
|
71
|
-
"unplugin-raw": "^0.6.3"
|
|
72
|
-
};
|
|
73
|
-
var publishConfig = { "access": "public" };
|
|
74
|
-
var type = "module";
|
|
75
|
-
var exports = {
|
|
76
|
-
".": {
|
|
77
|
-
"import": "./dist/index.js",
|
|
78
|
-
"require": "./dist/index.cjs"
|
|
79
|
-
},
|
|
80
|
-
"./cli": {
|
|
81
|
-
"import": "./dist/cli.js",
|
|
82
|
-
"require": "./dist/cli.cjs"
|
|
83
|
-
},
|
|
84
|
-
"./package.json": "./package.json"
|
|
85
|
-
};
|
|
86
|
-
var package_default = {
|
|
87
|
-
name,
|
|
88
|
-
description,
|
|
89
|
-
version,
|
|
90
|
-
license,
|
|
91
|
-
author,
|
|
92
|
-
repository,
|
|
93
|
-
homepage,
|
|
94
|
-
bugs,
|
|
95
|
-
keywords,
|
|
96
|
-
bin,
|
|
97
|
-
main: main$1,
|
|
98
|
-
types,
|
|
99
|
-
module,
|
|
100
|
-
files,
|
|
101
|
-
scripts,
|
|
102
|
-
dependencies,
|
|
103
|
-
devDependencies,
|
|
104
|
-
publishConfig,
|
|
105
|
-
type,
|
|
106
|
-
exports
|
|
107
|
-
};
|
|
14
|
+
var version = "1.0.4";
|
|
108
15
|
|
|
109
16
|
//#endregion
|
|
110
17
|
//#region src/commands/boilerplate.ts
|
|
@@ -451,7 +358,7 @@ function createServer(options = {}) {
|
|
|
451
358
|
});
|
|
452
359
|
const server = new Server({
|
|
453
360
|
name: "scaffold-mcp",
|
|
454
|
-
version
|
|
361
|
+
version
|
|
455
362
|
}, {
|
|
456
363
|
instructions,
|
|
457
364
|
capabilities: {
|
|
@@ -477,31 +384,31 @@ function createServer(options = {}) {
|
|
|
477
384
|
return { tools };
|
|
478
385
|
});
|
|
479
386
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
480
|
-
const { name
|
|
481
|
-
if (name
|
|
387
|
+
const { name, arguments: args } = request.params;
|
|
388
|
+
if (name === ListBoilerplatesTool.TOOL_NAME) {
|
|
482
389
|
if (isMonolith || !listBoilerplatesTool) throw new Error("Boilerplate tools are not available for monolith projects");
|
|
483
390
|
return await listBoilerplatesTool.execute(args || {});
|
|
484
391
|
}
|
|
485
|
-
if (name
|
|
392
|
+
if (name === UseBoilerplateTool.TOOL_NAME) {
|
|
486
393
|
if (isMonolith || !useBoilerplateTool) throw new Error("Boilerplate tools are not available for monolith projects");
|
|
487
394
|
return await useBoilerplateTool.execute(args || {});
|
|
488
395
|
}
|
|
489
|
-
if (name
|
|
490
|
-
if (name
|
|
491
|
-
if (name
|
|
492
|
-
if (name
|
|
396
|
+
if (name === ListScaffoldingMethodsTool.TOOL_NAME) return await listScaffoldingMethodsTool.execute(args || {});
|
|
397
|
+
if (name === UseScaffoldMethodTool.TOOL_NAME) return await useScaffoldMethodTool.execute(args || {});
|
|
398
|
+
if (name === WriteToFileTool.TOOL_NAME) return await writeToFileTool.execute(args || {});
|
|
399
|
+
if (name === GenerateBoilerplateTool.TOOL_NAME) {
|
|
493
400
|
if (!adminEnabled || !generateBoilerplateTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
494
401
|
return await generateBoilerplateTool.execute(args);
|
|
495
402
|
}
|
|
496
|
-
if (name
|
|
403
|
+
if (name === GenerateBoilerplateFileTool.TOOL_NAME) {
|
|
497
404
|
if (!adminEnabled || !generateBoilerplateFileTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
498
405
|
return await generateBoilerplateFileTool.execute(args);
|
|
499
406
|
}
|
|
500
|
-
if (name
|
|
407
|
+
if (name === GenerateFeatureScaffoldTool.TOOL_NAME) {
|
|
501
408
|
if (!adminEnabled || !generateFeatureScaffoldTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
|
|
502
409
|
return await generateFeatureScaffoldTool.execute(args);
|
|
503
410
|
}
|
|
504
|
-
throw new Error(`Unknown tool: ${name
|
|
411
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
505
412
|
});
|
|
506
413
|
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
507
414
|
const prompts = [];
|
|
@@ -514,18 +421,18 @@ function createServer(options = {}) {
|
|
|
514
421
|
return { prompts };
|
|
515
422
|
});
|
|
516
423
|
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
517
|
-
const { name
|
|
518
|
-
if (name
|
|
519
|
-
if (name
|
|
520
|
-
if (name
|
|
424
|
+
const { name, arguments: args } = request.params;
|
|
425
|
+
if (name === ScaffoldApplicationPrompt.PROMPT_NAME) return { messages: scaffoldApplicationPrompt.getMessages(args) };
|
|
426
|
+
if (name === ScaffoldFeaturePrompt.PROMPT_NAME) return { messages: scaffoldFeaturePrompt.getMessages(args) };
|
|
427
|
+
if (name === GenerateBoilerplatePrompt.PROMPT_NAME) {
|
|
521
428
|
if (!generateBoilerplatePrompt) throw new Error("Prompt not available");
|
|
522
429
|
return { messages: generateBoilerplatePrompt.getMessages(args) };
|
|
523
430
|
}
|
|
524
|
-
if (name
|
|
431
|
+
if (name === GenerateFeatureScaffoldPrompt.PROMPT_NAME) {
|
|
525
432
|
if (!generateFeatureScaffoldPrompt) throw new Error("Prompt not available");
|
|
526
433
|
return { messages: generateFeatureScaffoldPrompt.getMessages(args) };
|
|
527
434
|
}
|
|
528
|
-
throw new Error(`Unknown prompt: ${name
|
|
435
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
529
436
|
});
|
|
530
437
|
return server;
|
|
531
438
|
}
|
|
@@ -795,7 +702,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
795
702
|
*/
|
|
796
703
|
async function main() {
|
|
797
704
|
const program = new Command();
|
|
798
|
-
program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version(
|
|
705
|
+
program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version(version);
|
|
799
706
|
program.addCommand(mcpServeCommand);
|
|
800
707
|
program.addCommand(boilerplateCommand);
|
|
801
708
|
program.addCommand(scaffoldCommand);
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_stdio = require('./stdio-
|
|
3
|
-
const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-
|
|
4
|
-
const require_ScaffoldService = require('./ScaffoldService-
|
|
5
|
-
const require_TemplateService = require('./TemplateService-
|
|
6
|
-
const require_VariableReplacementService = require('./VariableReplacementService-
|
|
2
|
+
const require_stdio = require('./stdio-BGj_FLky.cjs');
|
|
3
|
+
const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-Y_SBLPg7.cjs');
|
|
4
|
+
const require_ScaffoldService = require('./ScaffoldService-ChzxM0Yc.cjs');
|
|
5
|
+
const require_TemplateService = require('./TemplateService-D3ydJR_R.cjs');
|
|
6
|
+
const require_VariableReplacementService = require('./VariableReplacementService-CAjesAYq.cjs');
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
9
|
-
let
|
|
10
|
-
fs_extra = require_chunk.__toESM(fs_extra);
|
|
9
|
+
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
11
10
|
let execa = require("execa");
|
|
12
|
-
execa = require_chunk.__toESM(execa);
|
|
13
11
|
|
|
14
12
|
//#region src/utils/git.ts
|
|
15
13
|
/**
|
|
@@ -31,8 +29,7 @@ async function findWorkspaceRoot(startPath = process.cwd()) {
|
|
|
31
29
|
let currentPath = node_path.default.resolve(startPath);
|
|
32
30
|
const rootPath = node_path.default.parse(currentPath).root;
|
|
33
31
|
while (true) {
|
|
34
|
-
|
|
35
|
-
if (await fs_extra.pathExists(gitPath)) return currentPath;
|
|
32
|
+
if (await (0, __agiflowai_aicode_utils.pathExists)(node_path.default.join(currentPath, ".git"))) return currentPath;
|
|
36
33
|
if (currentPath === rootPath) return null;
|
|
37
34
|
currentPath = node_path.default.dirname(currentPath);
|
|
38
35
|
}
|
|
@@ -88,8 +85,7 @@ async function cloneSubdirectory(repoUrl, branch, subdirectory, targetFolder) {
|
|
|
88
85
|
"core.sparseCheckout",
|
|
89
86
|
"true"
|
|
90
87
|
], tempFolder);
|
|
91
|
-
|
|
92
|
-
await fs_extra.writeFile(sparseCheckoutFile, `${subdirectory}\n`);
|
|
88
|
+
await (0, __agiflowai_aicode_utils.writeFile)(node_path.default.join(tempFolder, ".git", "info", "sparse-checkout"), `${subdirectory}\n`);
|
|
93
89
|
await execGit([
|
|
94
90
|
"pull",
|
|
95
91
|
"--depth=1",
|
|
@@ -97,12 +93,12 @@ async function cloneSubdirectory(repoUrl, branch, subdirectory, targetFolder) {
|
|
|
97
93
|
branch
|
|
98
94
|
], tempFolder);
|
|
99
95
|
const sourceDir = node_path.default.join(tempFolder, subdirectory);
|
|
100
|
-
if (!await
|
|
101
|
-
if (await
|
|
102
|
-
await
|
|
103
|
-
await
|
|
96
|
+
if (!await (0, __agiflowai_aicode_utils.pathExists)(sourceDir)) throw new Error(`Subdirectory '${subdirectory}' not found in repository at branch '${branch}'`);
|
|
97
|
+
if (await (0, __agiflowai_aicode_utils.pathExists)(targetFolder)) throw new Error(`Target folder already exists: ${targetFolder}`);
|
|
98
|
+
await (0, __agiflowai_aicode_utils.move)(sourceDir, targetFolder);
|
|
99
|
+
await (0, __agiflowai_aicode_utils.remove)(tempFolder);
|
|
104
100
|
} catch (error) {
|
|
105
|
-
if (await
|
|
101
|
+
if (await (0, __agiflowai_aicode_utils.pathExists)(tempFolder)) await (0, __agiflowai_aicode_utils.remove)(tempFolder);
|
|
106
102
|
throw error;
|
|
107
103
|
}
|
|
108
104
|
}
|
|
@@ -116,7 +112,7 @@ async function cloneRepository(repoUrl, targetFolder) {
|
|
|
116
112
|
targetFolder
|
|
117
113
|
]);
|
|
118
114
|
const gitFolder = node_path.default.join(targetFolder, ".git");
|
|
119
|
-
if (await
|
|
115
|
+
if (await (0, __agiflowai_aicode_utils.pathExists)(gitFolder)) await (0, __agiflowai_aicode_utils.remove)(gitFolder);
|
|
120
116
|
}
|
|
121
117
|
/**
|
|
122
118
|
* Fetch directory listing from GitHub API
|