@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.
Files changed (32) hide show
  1. package/dist/{ScaffoldConfigLoader-DQMCLVGD.cjs → ScaffoldConfigLoader-B-NLy6VP.cjs} +1 -1
  2. package/dist/{ScaffoldConfigLoader-CI0T6zdG.js → ScaffoldConfigLoader-BDMJNI1o.mjs} +1 -1
  3. package/dist/ScaffoldConfigLoader-SHk-KEje.mjs +3 -0
  4. package/dist/{ScaffoldConfigLoader-BrmvENTo.cjs → ScaffoldConfigLoader-Y_SBLPg7.cjs} +0 -1
  5. package/dist/ScaffoldService-BNOyoqSb.cjs +3 -0
  6. package/dist/ScaffoldService-BNdfC21Z.mjs +3 -0
  7. package/dist/{ScaffoldService-DB7-Cyod.js → ScaffoldService-BNuN00Fm.mjs} +8 -8
  8. package/dist/{ScaffoldService-BwDmXt83.cjs → ScaffoldService-ChzxM0Yc.cjs} +1 -3
  9. package/dist/TemplateService-BRfzfaZs.mjs +3 -0
  10. package/dist/{TemplateService-CiZJA06s.js → TemplateService-Cg5QV29n.mjs} +1 -1
  11. package/dist/{TemplateService-DRubcvS9.cjs → TemplateService-D3ydJR_R.cjs} +0 -2
  12. package/dist/TemplateService-DqieT1Tq.cjs +3 -0
  13. package/dist/VariableReplacementService-BWCd-z7X.mjs +3 -0
  14. package/dist/{VariableReplacementService-D0QnWKUW.cjs → VariableReplacementService-CAjesAYq.cjs} +1 -2
  15. package/dist/{VariableReplacementService-DRxd9ILB.js → VariableReplacementService-DHIINRnJ.mjs} +5 -5
  16. package/dist/{VariableReplacementService-CroHkMha.cjs → VariableReplacementService-DKaF2C9l.cjs} +1 -1
  17. package/dist/cli.cjs +74 -138
  18. package/dist/{cli.js → cli.mjs} +74 -134
  19. package/dist/index.cjs +14 -18
  20. package/dist/index.d.cts +20 -6
  21. package/dist/{index.d.ts → index.d.mts} +21 -7
  22. package/dist/{index.js → index.mjs} +14 -16
  23. package/dist/{stdio-TGsG8akc.cjs → stdio-BGj_FLky.cjs} +471 -414
  24. package/dist/{stdio-Bxn4A1IU.js → stdio-wAlpLC6l.mjs} +474 -409
  25. package/package.json +6 -8
  26. package/dist/ScaffoldConfigLoader-DhthV6xq.js +0 -3
  27. package/dist/ScaffoldService-B3En_m4t.cjs +0 -3
  28. package/dist/ScaffoldService-CJ3vNmAj.js +0 -3
  29. package/dist/TemplateService-BZRt3NI8.cjs +0 -3
  30. package/dist/TemplateService-DropYdp8.js +0 -3
  31. package/dist/VariableReplacementService-BAwTGv_R.js +0 -3
  32. /package/dist/{cli.d.ts → cli.d.mts} +0 -0
@@ -1,110 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, UseBoilerplateTool, UseScaffoldMethodTool, WriteToFileTool } from "./stdio-Bxn4A1IU.js";
3
- import "./ScaffoldConfigLoader-CI0T6zdG.js";
4
- import "./ScaffoldService-DB7-Cyod.js";
5
- import { TemplateService } from "./TemplateService-CiZJA06s.js";
6
- import "./VariableReplacementService-DRxd9ILB.js";
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 { Server } from "@modelcontextprotocol/sdk/server/index.js";
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 name = "@agiflowai/scaffold-mcp";
15
- var description = "MCP server for scaffolding applications with boilerplate templates";
16
- var version = "1.0.1";
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
@@ -112,9 +19,9 @@ var package_default = {
112
19
  * Boilerplate CLI command
113
20
  */
114
21
  const boilerplateCommand = new Command("boilerplate").description("Manage boilerplate templates");
115
- boilerplateCommand.command("list").description("List all available boilerplate templates").action(async () => {
22
+ boilerplateCommand.command("list").description("List all available boilerplate templates").option("-c, --cursor <cursor>", "Pagination cursor for next page").action(async (options) => {
116
23
  try {
117
- const { boilerplates } = await new BoilerplateService(await TemplatesManagerService.findTemplatesPath()).listBoilerplates();
24
+ const { boilerplates, nextCursor } = await new BoilerplateService(await TemplatesManagerService.findTemplatesPath()).listBoilerplates(options.cursor);
118
25
  if (boilerplates.length === 0) {
119
26
  messages.warning("No boilerplate templates found.");
120
27
  return;
@@ -128,6 +35,11 @@ boilerplateCommand.command("list").description("List all available boilerplate t
128
35
  if (required && required.length > 0) print.debug(` Required: ${required.join(", ")}`);
129
36
  print.newline();
130
37
  }
38
+ if (nextCursor) {
39
+ print.newline();
40
+ print.info(`${icons.info} More results available. Use --cursor to fetch next page:`);
41
+ print.debug(` scaffold-mcp boilerplate list --cursor "${nextCursor}"`);
42
+ }
131
43
  } catch (error) {
132
44
  messages.error("Error listing boilerplates:", error);
133
45
  process.exit(1);
@@ -146,9 +58,15 @@ boilerplateCommand.command("create <boilerplateName>").description("Create a new
146
58
  }
147
59
  const boilerplate = await boilerplateService.getBoilerplate(boilerplateName);
148
60
  if (!boilerplate) {
149
- const { boilerplates } = await boilerplateService.listBoilerplates();
61
+ let allBoilerplates = [];
62
+ let cursor;
63
+ do {
64
+ const result$1 = await boilerplateService.listBoilerplates(cursor);
65
+ allBoilerplates = allBoilerplates.concat(result$1.boilerplates);
66
+ cursor = result$1.nextCursor;
67
+ } while (cursor);
150
68
  messages.error(`Boilerplate '${boilerplateName}' not found.`);
151
- print.warning(`Available boilerplates: ${boilerplates.map((b) => b.name).join(", ")}`);
69
+ print.warning(`Available boilerplates: ${allBoilerplates.map((b) => b.name).join(", ")}`);
152
70
  process.exit(1);
153
71
  }
154
72
  const required = typeof boilerplate.variables_schema === "object" && boilerplate.variables_schema !== null && "required" in boilerplate.variables_schema ? boilerplate.variables_schema.required : [];
@@ -440,7 +358,7 @@ function createServer(options = {}) {
440
358
  });
441
359
  const server = new Server({
442
360
  name: "scaffold-mcp",
443
- version: package_default.version
361
+ version
444
362
  }, {
445
363
  instructions,
446
364
  capabilities: {
@@ -466,31 +384,31 @@ function createServer(options = {}) {
466
384
  return { tools };
467
385
  });
468
386
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
469
- const { name: name$1, arguments: args } = request.params;
470
- if (name$1 === ListBoilerplatesTool.TOOL_NAME) {
387
+ const { name, arguments: args } = request.params;
388
+ if (name === ListBoilerplatesTool.TOOL_NAME) {
471
389
  if (isMonolith || !listBoilerplatesTool) throw new Error("Boilerplate tools are not available for monolith projects");
472
390
  return await listBoilerplatesTool.execute(args || {});
473
391
  }
474
- if (name$1 === UseBoilerplateTool.TOOL_NAME) {
392
+ if (name === UseBoilerplateTool.TOOL_NAME) {
475
393
  if (isMonolith || !useBoilerplateTool) throw new Error("Boilerplate tools are not available for monolith projects");
476
394
  return await useBoilerplateTool.execute(args || {});
477
395
  }
478
- if (name$1 === ListScaffoldingMethodsTool.TOOL_NAME) return await listScaffoldingMethodsTool.execute(args || {});
479
- if (name$1 === UseScaffoldMethodTool.TOOL_NAME) return await useScaffoldMethodTool.execute(args || {});
480
- if (name$1 === WriteToFileTool.TOOL_NAME) return await writeToFileTool.execute(args || {});
481
- if (name$1 === GenerateBoilerplateTool.TOOL_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) {
482
400
  if (!adminEnabled || !generateBoilerplateTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
483
401
  return await generateBoilerplateTool.execute(args);
484
402
  }
485
- if (name$1 === GenerateBoilerplateFileTool.TOOL_NAME) {
403
+ if (name === GenerateBoilerplateFileTool.TOOL_NAME) {
486
404
  if (!adminEnabled || !generateBoilerplateFileTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
487
405
  return await generateBoilerplateFileTool.execute(args);
488
406
  }
489
- if (name$1 === GenerateFeatureScaffoldTool.TOOL_NAME) {
407
+ if (name === GenerateFeatureScaffoldTool.TOOL_NAME) {
490
408
  if (!adminEnabled || !generateFeatureScaffoldTool) throw new Error("Admin tools are not enabled. Use --admin-enable flag to enable.");
491
409
  return await generateFeatureScaffoldTool.execute(args);
492
410
  }
493
- throw new Error(`Unknown tool: ${name$1}`);
411
+ throw new Error(`Unknown tool: ${name}`);
494
412
  });
495
413
  server.setRequestHandler(ListPromptsRequestSchema, async () => {
496
414
  const prompts = [];
@@ -503,18 +421,18 @@ function createServer(options = {}) {
503
421
  return { prompts };
504
422
  });
505
423
  server.setRequestHandler(GetPromptRequestSchema, async (request) => {
506
- const { name: name$1, arguments: args } = request.params;
507
- if (name$1 === ScaffoldApplicationPrompt.PROMPT_NAME) return { messages: scaffoldApplicationPrompt.getMessages(args) };
508
- if (name$1 === ScaffoldFeaturePrompt.PROMPT_NAME) return { messages: scaffoldFeaturePrompt.getMessages(args) };
509
- if (name$1 === GenerateBoilerplatePrompt.PROMPT_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) {
510
428
  if (!generateBoilerplatePrompt) throw new Error("Prompt not available");
511
429
  return { messages: generateBoilerplatePrompt.getMessages(args) };
512
430
  }
513
- if (name$1 === GenerateFeatureScaffoldPrompt.PROMPT_NAME) {
431
+ if (name === GenerateFeatureScaffoldPrompt.PROMPT_NAME) {
514
432
  if (!generateFeatureScaffoldPrompt) throw new Error("Prompt not available");
515
433
  return { messages: generateFeatureScaffoldPrompt.getMessages(args) };
516
434
  }
517
- throw new Error(`Unknown prompt: ${name$1}`);
435
+ throw new Error(`Unknown prompt: ${name}`);
518
436
  });
519
437
  return server;
520
438
  }
@@ -595,7 +513,7 @@ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server w
595
513
  * Scaffold CLI command
596
514
  */
597
515
  const scaffoldCommand = new Command("scaffold").description("Add features to existing projects");
598
- 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) => {
516
+ 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) => {
599
517
  try {
600
518
  if (!projectPath && !options.template) {
601
519
  messages.error("Either projectPath or --template option must be provided");
@@ -615,10 +533,10 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
615
533
  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");
616
534
  process.exit(1);
617
535
  }
618
- result = await scaffoldingMethodsService.listScaffoldingMethods(absolutePath);
536
+ result = await scaffoldingMethodsService.listScaffoldingMethods(absolutePath, options.cursor);
619
537
  displayName = projectPath;
620
538
  } else {
621
- result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template);
539
+ result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template, options.cursor);
622
540
  displayName = `template: ${options.template}`;
623
541
  }
624
542
  const methods = result.methods;
@@ -633,6 +551,13 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
633
551
  if (method.variables_schema.required && method.variables_schema.required.length > 0) print.debug(` Required: ${method.variables_schema.required.join(", ")}`);
634
552
  print.newline();
635
553
  }
554
+ if (result.nextCursor) {
555
+ print.newline();
556
+ print.info(`${icons.info} More results available. Use --cursor to fetch next page:`);
557
+ const cursorOption = `--cursor "${result.nextCursor}"`;
558
+ if (projectPath) print.debug(` scaffold-mcp scaffold list ${projectPath} ${cursorOption}`);
559
+ else print.debug(` scaffold-mcp scaffold list --template ${options.template} ${cursorOption}`);
560
+ }
636
561
  } catch (error) {
637
562
  messages.error("Error listing scaffolding methods:", error);
638
563
  process.exit(1);
@@ -656,11 +581,17 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
656
581
  }
657
582
  const templatesDir = await TemplatesManagerService.findTemplatesPath();
658
583
  const scaffoldingMethodsService = new ScaffoldingMethodsService(new FileSystemService(), templatesDir);
659
- const methods = (await scaffoldingMethodsService.listScaffoldingMethods(projectPath)).methods;
660
- const method = methods.find((m) => m.name === featureName);
584
+ let allMethods = [];
585
+ let cursor;
586
+ do {
587
+ const listResult = await scaffoldingMethodsService.listScaffoldingMethods(projectPath, cursor);
588
+ allMethods = allMethods.concat(listResult.methods);
589
+ cursor = listResult.nextCursor;
590
+ } while (cursor);
591
+ const method = allMethods.find((m) => m.name === featureName);
661
592
  if (!method) {
662
593
  messages.error(`Scaffold method '${featureName}' not found.`);
663
- print.warning(`Available methods: ${methods.map((m) => m.name).join(", ")}`);
594
+ print.warning(`Available methods: ${allMethods.map((m) => m.name).join(", ")}`);
664
595
  print.debug(`Run 'scaffold-mcp scaffold list ${options.project}' to see all available methods`);
665
596
  process.exit(1);
666
597
  }
@@ -721,7 +652,8 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
721
652
  }
722
653
  const templatesDir = await TemplatesManagerService.findTemplatesPath();
723
654
  const scaffoldingMethodsService = new ScaffoldingMethodsService(new FileSystemService(), templatesDir);
724
- let result;
655
+ let allMethods = [];
656
+ let cursor;
725
657
  if (options.project) {
726
658
  const projectPath = path.resolve(options.project);
727
659
  if (!await ProjectConfigResolver.hasConfiguration(projectPath)) {
@@ -729,9 +661,17 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
729
661
  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");
730
662
  process.exit(1);
731
663
  }
732
- result = await scaffoldingMethodsService.listScaffoldingMethods(projectPath);
733
- } else result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template);
734
- const method = result.methods.find((m) => m.name === featureName);
664
+ do {
665
+ const result = await scaffoldingMethodsService.listScaffoldingMethods(projectPath, cursor);
666
+ allMethods = allMethods.concat(result.methods);
667
+ cursor = result.nextCursor;
668
+ } while (cursor);
669
+ } else do {
670
+ const result = await scaffoldingMethodsService.listScaffoldingMethodsByTemplate(options.template, cursor);
671
+ allMethods = allMethods.concat(result.methods);
672
+ cursor = result.nextCursor;
673
+ } while (cursor);
674
+ const method = allMethods.find((m) => m.name === featureName);
735
675
  if (!method) {
736
676
  messages.error(`❌ Scaffold method '${featureName}' not found.`);
737
677
  process.exit(1);
@@ -762,7 +702,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
762
702
  */
763
703
  async function main() {
764
704
  const program = new Command();
765
- program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version(package_default.version);
705
+ program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version(version);
766
706
  program.addCommand(mcpServeCommand);
767
707
  program.addCommand(boilerplateCommand);
768
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-TGsG8akc.cjs');
3
- const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-BrmvENTo.cjs');
4
- const require_ScaffoldService = require('./ScaffoldService-BwDmXt83.cjs');
5
- const require_TemplateService = require('./TemplateService-DRubcvS9.cjs');
6
- const require_VariableReplacementService = require('./VariableReplacementService-D0QnWKUW.cjs');
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 fs_extra = require("fs-extra");
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
- const gitPath = node_path.default.join(currentPath, ".git");
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
- const sparseCheckoutFile = node_path.default.join(tempFolder, ".git", "info", "sparse-checkout");
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 fs_extra.pathExists(sourceDir)) throw new Error(`Subdirectory '${subdirectory}' not found in repository at branch '${branch}'`);
101
- if (await fs_extra.pathExists(targetFolder)) throw new Error(`Target folder already exists: ${targetFolder}`);
102
- await fs_extra.move(sourceDir, targetFolder);
103
- await fs_extra.remove(tempFolder);
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 fs_extra.pathExists(tempFolder)) await fs_extra.remove(tempFolder);
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 fs_extra.pathExists(gitFolder)) await fs_extra.remove(gitFolder);
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
package/dist/index.d.cts CHANGED
@@ -108,6 +108,12 @@ interface UseBoilerplateRequest {
108
108
  }
109
109
  interface ListBoilerplateResponse {
110
110
  boilerplates: BoilerplateInfo[];
111
+ nextCursor?: string;
112
+ _meta?: {
113
+ total: number;
114
+ offset: number;
115
+ limit: number;
116
+ };
111
117
  }
112
118
  //#endregion
113
119
  //#region src/types/interfaces.d.ts
@@ -226,9 +232,11 @@ declare class BoilerplateService {
226
232
  private scaffoldService;
227
233
  constructor(templatesPath: string);
228
234
  /**
229
- * Scans all scaffold.yaml files and returns available boilerplates
235
+ * Scans all scaffold.yaml files and returns available boilerplates with pagination
236
+ * @param cursor - Optional pagination cursor
237
+ * @returns Paginated list of boilerplates
230
238
  */
231
- listBoilerplates(): Promise<ListBoilerplateResponse>;
239
+ listBoilerplates(cursor?: string): Promise<ListBoilerplateResponse>;
232
240
  /**
233
241
  * Dynamically discovers template directories by finding all directories
234
242
  * that contain both package.json and scaffold.yaml files
@@ -353,6 +361,12 @@ interface ListScaffoldingMethodsResult {
353
361
  sourceTemplate: string;
354
362
  templatePath: string;
355
363
  methods: ScaffoldMethod[];
364
+ nextCursor?: string;
365
+ _meta?: {
366
+ total: number;
367
+ offset: number;
368
+ limit: number;
369
+ };
356
370
  }
357
371
  interface UseScaffoldMethodRequest {
358
372
  projectPath: string;
@@ -364,12 +378,12 @@ declare class ScaffoldingMethodsService {
364
378
  private templatesRootPath;
365
379
  private templateService;
366
380
  constructor(fileSystem: IFileSystemService, templatesRootPath: string);
367
- listScaffoldingMethods(projectPath: string): Promise<ListScaffoldingMethodsResult>;
368
- listScaffoldingMethodsByTemplate(templateName: string): Promise<ListScaffoldingMethodsResult>;
381
+ listScaffoldingMethods(projectPath: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
382
+ listScaffoldingMethodsByTemplate(templateName: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
369
383
  /**
370
384
  * Gets scaffolding methods with instructions rendered using provided variables
371
385
  */
372
- listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>): Promise<ListScaffoldingMethodsResult>;
386
+ listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>, cursor?: string): Promise<ListScaffoldingMethodsResult>;
373
387
  /**
374
388
  * Processes scaffold instruction with template service
375
389
  */
@@ -591,7 +605,7 @@ declare class ListBoilerplatesTool {
591
605
  /**
592
606
  * Execute the tool
593
607
  */
594
- execute(_args?: Record<string, any>): Promise<CallToolResult>;
608
+ execute(args?: Record<string, any>): Promise<CallToolResult>;
595
609
  }
596
610
  //#endregion
597
611
  //#region src/tools/ListScaffoldingMethodsTool.d.ts
@@ -1,8 +1,8 @@
1
1
  import { JsonSchema } from "@composio/json-schema-to-zod";
2
2
  import { z } from "zod";
3
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
3
  import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
5
4
  import "express";
5
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
6
 
7
7
  //#region src/services/BoilerplateGeneratorService.d.ts
8
8
  interface GenerateBoilerplateOptions {
@@ -109,6 +109,12 @@ interface UseBoilerplateRequest {
109
109
  }
110
110
  interface ListBoilerplateResponse {
111
111
  boilerplates: BoilerplateInfo[];
112
+ nextCursor?: string;
113
+ _meta?: {
114
+ total: number;
115
+ offset: number;
116
+ limit: number;
117
+ };
112
118
  }
113
119
  //#endregion
114
120
  //#region src/types/interfaces.d.ts
@@ -227,9 +233,11 @@ declare class BoilerplateService {
227
233
  private scaffoldService;
228
234
  constructor(templatesPath: string);
229
235
  /**
230
- * Scans all scaffold.yaml files and returns available boilerplates
236
+ * Scans all scaffold.yaml files and returns available boilerplates with pagination
237
+ * @param cursor - Optional pagination cursor
238
+ * @returns Paginated list of boilerplates
231
239
  */
232
- listBoilerplates(): Promise<ListBoilerplateResponse>;
240
+ listBoilerplates(cursor?: string): Promise<ListBoilerplateResponse>;
233
241
  /**
234
242
  * Dynamically discovers template directories by finding all directories
235
243
  * that contain both package.json and scaffold.yaml files
@@ -354,6 +362,12 @@ interface ListScaffoldingMethodsResult {
354
362
  sourceTemplate: string;
355
363
  templatePath: string;
356
364
  methods: ScaffoldMethod[];
365
+ nextCursor?: string;
366
+ _meta?: {
367
+ total: number;
368
+ offset: number;
369
+ limit: number;
370
+ };
357
371
  }
358
372
  interface UseScaffoldMethodRequest {
359
373
  projectPath: string;
@@ -365,12 +379,12 @@ declare class ScaffoldingMethodsService {
365
379
  private templatesRootPath;
366
380
  private templateService;
367
381
  constructor(fileSystem: IFileSystemService, templatesRootPath: string);
368
- listScaffoldingMethods(projectPath: string): Promise<ListScaffoldingMethodsResult>;
369
- listScaffoldingMethodsByTemplate(templateName: string): Promise<ListScaffoldingMethodsResult>;
382
+ listScaffoldingMethods(projectPath: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
383
+ listScaffoldingMethodsByTemplate(templateName: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
370
384
  /**
371
385
  * Gets scaffolding methods with instructions rendered using provided variables
372
386
  */
373
- listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>): Promise<ListScaffoldingMethodsResult>;
387
+ listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>, cursor?: string): Promise<ListScaffoldingMethodsResult>;
374
388
  /**
375
389
  * Processes scaffold instruction with template service
376
390
  */
@@ -592,7 +606,7 @@ declare class ListBoilerplatesTool {
592
606
  /**
593
607
  * Execute the tool
594
608
  */
595
- execute(_args?: Record<string, any>): Promise<CallToolResult>;
609
+ execute(args?: Record<string, any>): Promise<CallToolResult>;
596
610
  }
597
611
  //#endregion
598
612
  //#region src/tools/ListScaffoldingMethodsTool.d.ts
@@ -1,10 +1,10 @@
1
- import { BoilerplateGeneratorService, BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldGeneratorService, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, UseBoilerplateTool, UseScaffoldMethodTool, WriteToFileTool } from "./stdio-Bxn4A1IU.js";
2
- import { ScaffoldConfigLoader } from "./ScaffoldConfigLoader-CI0T6zdG.js";
3
- import { ScaffoldProcessingService, ScaffoldService } from "./ScaffoldService-DB7-Cyod.js";
4
- import { TemplateService } from "./TemplateService-CiZJA06s.js";
5
- import { VariableReplacementService } from "./VariableReplacementService-DRxd9ILB.js";
1
+ import { a as UseScaffoldMethodTool, c as ListBoilerplatesTool, d as GenerateBoilerplateFileTool, f as ScaffoldingMethodsService, g as BoilerplateGeneratorService, h as FileSystemService, i as WriteToFileTool, l as GenerateFeatureScaffoldTool, m as BoilerplateService, n as SseTransportHandler, o as UseBoilerplateTool, p as ScaffoldGeneratorService, r as HttpTransportHandler, s as ListScaffoldingMethodsTool, t as StdioTransportHandler, u as GenerateBoilerplateTool } from "./stdio-wAlpLC6l.mjs";
2
+ import { t as ScaffoldConfigLoader } from "./ScaffoldConfigLoader-BDMJNI1o.mjs";
3
+ import { n as ScaffoldProcessingService, t as ScaffoldService } from "./ScaffoldService-BNuN00Fm.mjs";
4
+ import { t as TemplateService } from "./TemplateService-Cg5QV29n.mjs";
5
+ import { t as VariableReplacementService } from "./VariableReplacementService-DHIINRnJ.mjs";
6
6
  import path from "node:path";
7
- import * as fs$1 from "fs-extra";
7
+ import { move, pathExists, remove, writeFile } from "@agiflowai/aicode-utils";
8
8
  import { execa } from "execa";
9
9
 
10
10
  //#region src/utils/git.ts
@@ -27,8 +27,7 @@ async function findWorkspaceRoot(startPath = process.cwd()) {
27
27
  let currentPath = path.resolve(startPath);
28
28
  const rootPath = path.parse(currentPath).root;
29
29
  while (true) {
30
- const gitPath = path.join(currentPath, ".git");
31
- if (await fs$1.pathExists(gitPath)) return currentPath;
30
+ if (await pathExists(path.join(currentPath, ".git"))) return currentPath;
32
31
  if (currentPath === rootPath) return null;
33
32
  currentPath = path.dirname(currentPath);
34
33
  }
@@ -84,8 +83,7 @@ async function cloneSubdirectory(repoUrl, branch, subdirectory, targetFolder) {
84
83
  "core.sparseCheckout",
85
84
  "true"
86
85
  ], tempFolder);
87
- const sparseCheckoutFile = path.join(tempFolder, ".git", "info", "sparse-checkout");
88
- await fs$1.writeFile(sparseCheckoutFile, `${subdirectory}\n`);
86
+ await writeFile(path.join(tempFolder, ".git", "info", "sparse-checkout"), `${subdirectory}\n`);
89
87
  await execGit([
90
88
  "pull",
91
89
  "--depth=1",
@@ -93,12 +91,12 @@ async function cloneSubdirectory(repoUrl, branch, subdirectory, targetFolder) {
93
91
  branch
94
92
  ], tempFolder);
95
93
  const sourceDir = path.join(tempFolder, subdirectory);
96
- if (!await fs$1.pathExists(sourceDir)) throw new Error(`Subdirectory '${subdirectory}' not found in repository at branch '${branch}'`);
97
- if (await fs$1.pathExists(targetFolder)) throw new Error(`Target folder already exists: ${targetFolder}`);
98
- await fs$1.move(sourceDir, targetFolder);
99
- await fs$1.remove(tempFolder);
94
+ if (!await pathExists(sourceDir)) throw new Error(`Subdirectory '${subdirectory}' not found in repository at branch '${branch}'`);
95
+ if (await pathExists(targetFolder)) throw new Error(`Target folder already exists: ${targetFolder}`);
96
+ await move(sourceDir, targetFolder);
97
+ await remove(tempFolder);
100
98
  } catch (error) {
101
- if (await fs$1.pathExists(tempFolder)) await fs$1.remove(tempFolder);
99
+ if (await pathExists(tempFolder)) await remove(tempFolder);
102
100
  throw error;
103
101
  }
104
102
  }
@@ -112,7 +110,7 @@ async function cloneRepository(repoUrl, targetFolder) {
112
110
  targetFolder
113
111
  ]);
114
112
  const gitFolder = path.join(targetFolder, ".git");
115
- if (await fs$1.pathExists(gitFolder)) await fs$1.remove(gitFolder);
113
+ if (await pathExists(gitFolder)) await remove(gitFolder);
116
114
  }
117
115
  /**
118
116
  * Fetch directory listing from GitHub API