@agiflowai/scaffold-mcp 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +40 -0
  2. package/dist/ListScaffoldingMethodsTool-BLTCwsd1.mjs +350 -0
  3. package/dist/ListScaffoldingMethodsTool-BuxKRbwi.cjs +376 -0
  4. package/dist/{ScaffoldConfigLoader-B-NLy6VP.cjs → ScaffoldConfigLoader-BB4_YUFL.cjs} +1 -1
  5. package/dist/{ScaffoldConfigLoader-SHk-KEje.mjs → ScaffoldConfigLoader-DKJtnrWT.mjs} +1 -1
  6. package/dist/ScaffoldService-BCjJE9yK.mjs +3 -0
  7. package/dist/ScaffoldService-Bhzxp5-C.cjs +3 -0
  8. package/dist/TemplateService-B1bd6iHw.mjs +3 -0
  9. package/dist/TemplateService-BrJGDvQt.cjs +3 -0
  10. package/dist/VariableReplacementService-BO-UYgcf.mjs +3 -0
  11. package/dist/{VariableReplacementService-DKaF2C9l.cjs → VariableReplacementService-CNimgwaq.cjs} +1 -1
  12. package/dist/cli.cjs +89 -11
  13. package/dist/cli.mjs +84 -6
  14. package/dist/index.cjs +9 -8
  15. package/dist/index.d.cts +7 -0
  16. package/dist/index.d.mts +7 -0
  17. package/dist/index.mjs +6 -5
  18. package/dist/{stdio-BGj_FLky.cjs → stdio-BcTSxlVH.cjs} +47 -367
  19. package/dist/{stdio-wAlpLC6l.mjs → stdio-DovjJsGY.mjs} +42 -347
  20. package/dist/useScaffoldMethod-Btc_9iCj.cjs +237 -0
  21. package/dist/useScaffoldMethod-C1hQdBVD.cjs +267 -0
  22. package/dist/useScaffoldMethod-CHJAsgA2.mjs +236 -0
  23. package/dist/useScaffoldMethod-CsBTssSw.mjs +263 -0
  24. package/package.json +6 -2
  25. package/dist/ScaffoldService-BNOyoqSb.cjs +0 -3
  26. package/dist/ScaffoldService-BNdfC21Z.mjs +0 -3
  27. package/dist/TemplateService-BRfzfaZs.mjs +0 -3
  28. package/dist/TemplateService-DqieT1Tq.cjs +0 -3
  29. package/dist/VariableReplacementService-BWCd-z7X.mjs +0 -3
  30. /package/dist/{ScaffoldConfigLoader-BDMJNI1o.mjs → ScaffoldConfigLoader-8YI7v2GJ.mjs} +0 -0
  31. /package/dist/{ScaffoldConfigLoader-Y_SBLPg7.cjs → ScaffoldConfigLoader-CQlXVksz.cjs} +0 -0
  32. /package/dist/{ScaffoldService-ChzxM0Yc.cjs → ScaffoldService-BPyiY_0B.cjs} +0 -0
  33. /package/dist/{ScaffoldService-BNuN00Fm.mjs → ScaffoldService-CgYunbKN.mjs} +0 -0
  34. /package/dist/{TemplateService-D3ydJR_R.cjs → TemplateService-CAD8jkoO.cjs} +0 -0
  35. /package/dist/{TemplateService-Cg5QV29n.mjs → TemplateService-CVDL2uqt.mjs} +0 -0
  36. /package/dist/{VariableReplacementService-DHIINRnJ.mjs → VariableReplacementService-B9RA8D0a.mjs} +0 -0
  37. /package/dist/{VariableReplacementService-CAjesAYq.cjs → VariableReplacementService-DDG5KZpb.cjs} +0 -0
@@ -1,15 +1,17 @@
1
- import { t as ScaffoldConfigLoader } from "./ScaffoldConfigLoader-BDMJNI1o.mjs";
2
- import { t as ScaffoldService } from "./ScaffoldService-BNuN00Fm.mjs";
3
- import { t as TemplateService } from "./TemplateService-Cg5QV29n.mjs";
4
- import { t as VariableReplacementService } from "./VariableReplacementService-DHIINRnJ.mjs";
1
+ import { i as PaginationHelper, n as ScaffoldingMethodsService, r as FileSystemService } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
2
+ import { t as ScaffoldConfigLoader } from "./ScaffoldConfigLoader-8YI7v2GJ.mjs";
3
+ import { t as ScaffoldService } from "./ScaffoldService-CgYunbKN.mjs";
4
+ import { t as TemplateService } from "./TemplateService-CVDL2uqt.mjs";
5
+ import { t as VariableReplacementService } from "./VariableReplacementService-B9RA8D0a.mjs";
5
6
  import * as path$1 from "node:path";
6
7
  import path from "node:path";
7
- import { ProjectConfigResolver, copy, ensureDir, log, pathExists, pathExistsSync, readFile, readFileSync, readJson, readdir, stat, statSync, writeFile } from "@agiflowai/aicode-utils";
8
+ import { ProjectConfigResolver, ensureDir, generateStableId, log, pathExists, pathExistsSync, readFile, readFileSync, readdir, statSync, writeFile } from "@agiflowai/aicode-utils";
8
9
  import * as yaml$1 from "js-yaml";
9
- import yaml from "js-yaml";
10
10
  import { readdirSync } from "node:fs";
11
11
  import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
12
12
  import { z } from "zod";
13
+ import * as fs$1 from "node:fs/promises";
14
+ import * as os$1 from "node:os";
13
15
  import { randomUUID } from "node:crypto";
14
16
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
15
17
  import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
@@ -175,85 +177,6 @@ var BoilerplateGeneratorService = class {
175
177
  }
176
178
  };
177
179
 
178
- //#endregion
179
- //#region src/utils/pagination.ts
180
- var PaginationHelper = class PaginationHelper {
181
- /**
182
- * Default page size for pagination
183
- */
184
- static DEFAULT_PAGE_SIZE = 10;
185
- /**
186
- * Decodes a cursor string to extract the start index
187
- * @param cursor - String representing the start index (e.g., "10")
188
- * @returns Start index or 0 if invalid/undefined
189
- */
190
- static decodeCursor(cursor) {
191
- if (!cursor) return 0;
192
- const index = Number.parseInt(cursor, 10);
193
- if (Number.isNaN(index) || index < 0) return 0;
194
- return index;
195
- }
196
- /**
197
- * Encodes an index into a cursor string
198
- * @param index - Start index to encode
199
- * @returns Cursor string (e.g., "10")
200
- */
201
- static encodeCursor(index) {
202
- return index.toString();
203
- }
204
- /**
205
- * Paginates an array of items
206
- * @param items - All items to paginate
207
- * @param cursor - Optional cursor representing the start index
208
- * @param pageSize - Number of items per page (default: 10)
209
- * @param includeMeta - Whether to include metadata in response (default: true)
210
- * @returns Paginated result with items and optional nextCursor
211
- */
212
- static paginate(items, cursor, pageSize = PaginationHelper.DEFAULT_PAGE_SIZE, includeMeta = true) {
213
- const startIndex = PaginationHelper.decodeCursor(cursor);
214
- const endIndex = startIndex + pageSize;
215
- const result = {
216
- items: items.slice(startIndex, endIndex),
217
- nextCursor: endIndex < items.length ? PaginationHelper.encodeCursor(endIndex) : void 0
218
- };
219
- if (includeMeta) result._meta = {
220
- total: items.length,
221
- offset: startIndex,
222
- limit: pageSize
223
- };
224
- return result;
225
- }
226
- };
227
-
228
- //#endregion
229
- //#region src/services/FileSystemService.ts
230
- var FileSystemService = class {
231
- async pathExists(path$2) {
232
- return pathExists(path$2);
233
- }
234
- async readFile(path$2, encoding = "utf8") {
235
- return readFile(path$2, encoding);
236
- }
237
- async readJson(path$2) {
238
- return readJson(path$2);
239
- }
240
- async writeFile(path$2, content, encoding = "utf8") {
241
- return writeFile(path$2, content, encoding);
242
- }
243
- async ensureDir(path$2) {
244
- return ensureDir(path$2);
245
- }
246
- async copy(src, dest) {
247
- return copy(src, dest);
248
- }
249
- async readdir(path$2) {
250
- return readdir(path$2);
251
- }
252
- async stat(path$2) {
253
- return stat(path$2);
254
- }
255
- };
256
-
257
180
  //#endregion
258
181
  //#region src/services/BoilerplateService.ts
259
182
  var BoilerplateService = class {
@@ -576,179 +499,6 @@ var ScaffoldGeneratorService = class {
576
499
  }
577
500
  };
578
501
 
579
- //#endregion
580
- //#region src/services/ScaffoldingMethodsService.ts
581
- var ScaffoldingMethodsService = class {
582
- templateService;
583
- constructor(fileSystem, templatesRootPath) {
584
- this.fileSystem = fileSystem;
585
- this.templatesRootPath = templatesRootPath;
586
- this.templateService = new TemplateService();
587
- }
588
- async listScaffoldingMethods(projectPath, cursor) {
589
- const absoluteProjectPath = path.resolve(projectPath);
590
- const sourceTemplate = (await ProjectConfigResolver.resolveProjectConfig(absoluteProjectPath)).sourceTemplate;
591
- return this.listScaffoldingMethodsByTemplate(sourceTemplate, cursor);
592
- }
593
- async listScaffoldingMethodsByTemplate(templateName, cursor) {
594
- const templatePath = await this.findTemplatePath(templateName);
595
- if (!templatePath) throw new Error(`Template not found for sourceTemplate: ${templateName}`);
596
- const fullTemplatePath = path.join(this.templatesRootPath, templatePath);
597
- const scaffoldYamlPath = path.join(fullTemplatePath, "scaffold.yaml");
598
- if (!await this.fileSystem.pathExists(scaffoldYamlPath)) throw new Error(`scaffold.yaml not found at ${scaffoldYamlPath}`);
599
- const scaffoldContent = await this.fileSystem.readFile(scaffoldYamlPath, "utf8");
600
- const architectConfig = yaml.load(scaffoldContent);
601
- const methods = [];
602
- if (architectConfig.features && Array.isArray(architectConfig.features)) architectConfig.features.forEach((feature) => {
603
- const featureName = feature.name || `scaffold-${templateName}`;
604
- methods.push({
605
- name: featureName,
606
- description: feature.description || "",
607
- instruction: feature.instruction || "",
608
- variables_schema: feature.variables_schema || {
609
- type: "object",
610
- properties: {},
611
- required: [],
612
- additionalProperties: false
613
- },
614
- generator: feature.generator
615
- });
616
- });
617
- const paginatedResult = PaginationHelper.paginate(methods, cursor);
618
- return {
619
- sourceTemplate: templateName,
620
- templatePath,
621
- methods: paginatedResult.items,
622
- nextCursor: paginatedResult.nextCursor,
623
- _meta: paginatedResult._meta
624
- };
625
- }
626
- /**
627
- * Gets scaffolding methods with instructions rendered using provided variables
628
- */
629
- async listScaffoldingMethodsWithVariables(projectPath, variables, cursor) {
630
- const result = await this.listScaffoldingMethods(projectPath, cursor);
631
- const processedMethods = result.methods.map((method) => ({
632
- ...method,
633
- instruction: method.instruction ? this.processScaffoldInstruction(method.instruction, variables) : void 0
634
- }));
635
- return {
636
- ...result,
637
- methods: processedMethods
638
- };
639
- }
640
- /**
641
- * Processes scaffold instruction with template service
642
- */
643
- processScaffoldInstruction(instruction, variables) {
644
- if (this.templateService.containsTemplateVariables(instruction)) return this.templateService.renderString(instruction, variables);
645
- return instruction;
646
- }
647
- async findTemplatePath(sourceTemplate) {
648
- const templateDirs = await this.discoverTemplateDirs();
649
- if (templateDirs.includes(sourceTemplate)) return sourceTemplate;
650
- for (const templateDir of templateDirs) {
651
- const templatePath = path.join(this.templatesRootPath, templateDir);
652
- const scaffoldYamlPath = path.join(templatePath, "scaffold.yaml");
653
- if (await this.fileSystem.pathExists(scaffoldYamlPath)) try {
654
- const scaffoldContent = await this.fileSystem.readFile(scaffoldYamlPath, "utf8");
655
- const architectConfig = yaml.load(scaffoldContent);
656
- if (architectConfig.boilerplate && Array.isArray(architectConfig.boilerplate)) {
657
- for (const boilerplate of architectConfig.boilerplate) if (boilerplate.name?.includes(sourceTemplate)) return templateDir;
658
- }
659
- } catch (error) {
660
- log.warn(`Failed to read scaffold.yaml at ${scaffoldYamlPath}:`, error);
661
- }
662
- }
663
- return null;
664
- }
665
- /**
666
- * Resolves the project path, handling both monorepo and monolith cases
667
- * Uses ProjectConfigResolver to find the correct workspace/project root
668
- */
669
- async resolveProjectPath(projectPath) {
670
- const absolutePath = path.resolve(projectPath);
671
- return (await ProjectConfigResolver.resolveProjectConfig(absolutePath)).workspaceRoot || absolutePath;
672
- }
673
- /**
674
- * Dynamically discovers all template directories
675
- * Supports both flat structure (templates/nextjs-15) and nested structure (templates/apps/nextjs-15)
676
- **/
677
- async discoverTemplateDirs() {
678
- const templateDirs = [];
679
- try {
680
- const items = await this.fileSystem.readdir(this.templatesRootPath);
681
- for (const item of items) {
682
- const itemPath = path.join(this.templatesRootPath, item);
683
- if (!(await this.fileSystem.stat(itemPath)).isDirectory()) continue;
684
- const scaffoldYamlPath = path.join(itemPath, "scaffold.yaml");
685
- if (await this.fileSystem.pathExists(scaffoldYamlPath)) {
686
- templateDirs.push(item);
687
- continue;
688
- }
689
- try {
690
- const subItems = await this.fileSystem.readdir(itemPath);
691
- for (const subItem of subItems) {
692
- const subItemPath = path.join(itemPath, subItem);
693
- if (!(await this.fileSystem.stat(subItemPath)).isDirectory()) continue;
694
- const subScaffoldYamlPath = path.join(subItemPath, "scaffold.yaml");
695
- if (await this.fileSystem.pathExists(subScaffoldYamlPath)) {
696
- const relativePath = path.join(item, subItem);
697
- templateDirs.push(relativePath);
698
- }
699
- }
700
- } catch (error) {
701
- log.warn(`Failed to read subdirectories in ${itemPath}:`, error);
702
- }
703
- }
704
- } catch (error) {
705
- log.warn(`Failed to read templates root directory ${this.templatesRootPath}:`, error);
706
- }
707
- return templateDirs;
708
- }
709
- async useScaffoldMethod(request) {
710
- const { projectPath, scaffold_feature_name, variables } = request;
711
- const absoluteProjectPath = await this.resolveProjectPath(projectPath);
712
- const scaffoldingMethods = await this.listScaffoldingMethods(absoluteProjectPath);
713
- const method = scaffoldingMethods.methods.find((m) => m.name === scaffold_feature_name);
714
- if (!method) {
715
- const availableMethods = scaffoldingMethods.methods.map((m) => m.name).join(", ");
716
- throw new Error(`Scaffold method '${scaffold_feature_name}' not found. Available methods: ${availableMethods}`);
717
- }
718
- const ScaffoldService$1 = (await import("./ScaffoldService-BNdfC21Z.mjs")).ScaffoldService;
719
- const ScaffoldConfigLoader$1 = (await import("./ScaffoldConfigLoader-SHk-KEje.mjs")).ScaffoldConfigLoader;
720
- const VariableReplacementService$1 = (await import("./VariableReplacementService-BWCd-z7X.mjs")).VariableReplacementService;
721
- const TemplateService$1 = (await import("./TemplateService-BRfzfaZs.mjs")).TemplateService;
722
- const templateService = new TemplateService$1();
723
- const scaffoldConfigLoader = new ScaffoldConfigLoader$1(this.fileSystem, templateService);
724
- const variableReplacer = new VariableReplacementService$1(this.fileSystem, templateService);
725
- const scaffoldService = new ScaffoldService$1(this.fileSystem, scaffoldConfigLoader, variableReplacer, this.templatesRootPath);
726
- const projectName = path.basename(absoluteProjectPath);
727
- const result = await scaffoldService.useFeature({
728
- projectPath: absoluteProjectPath,
729
- templateFolder: scaffoldingMethods.templatePath,
730
- featureName: scaffold_feature_name,
731
- variables: {
732
- ...variables,
733
- appPath: absoluteProjectPath,
734
- appName: projectName
735
- }
736
- });
737
- if (!result.success) throw new Error(result.message);
738
- return {
739
- success: true,
740
- message: `
741
- Successfully scaffolded ${scaffold_feature_name} in ${projectPath}.
742
- Please follow this **instruction**: \n ${method.instruction ? this.processScaffoldInstruction(method.instruction, variables) : ""}.
743
- -> Create or update the plan based on the instruction.
744
- `,
745
- warnings: result.warnings,
746
- createdFiles: result.createdFiles,
747
- existingFiles: result.existingFiles
748
- };
749
- }
750
- };
751
-
752
502
  //#endregion
753
503
  //#region src/tools/GenerateBoilerplateFileTool.ts
754
504
  /**
@@ -1427,7 +1177,7 @@ Use this to add custom feature scaffolds (pages, components, services, etc.) for
1427
1177
 
1428
1178
  //#endregion
1429
1179
  //#region src/instructions/tools/list-boilerplates/description.md?raw
1430
- var description_default$2 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in `toolkit.yaml`.\n\nUse `list-scaffolding-methods` for available features instead.\n{% else %}\nLists all available project boilerplates for creating new applications, APIs, or packages in the monorepo.\n\nEach boilerplate includes:\n- Complete project template with starter files\n- Variable schema for customization\n- Target directory information (e.g., apps/, packages/)\n- Required and optional configuration options\n\nUse this FIRST when creating new projects to understand available templates and their requirements.\n{% endif %}\n";
1180
+ var description_default$1 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in `toolkit.yaml`.\n\nUse `list-scaffolding-methods` for available features instead.\n{% else %}\nLists all available project boilerplates for creating new applications, APIs, or packages in the monorepo.\n\nEach boilerplate includes:\n- Complete project template with starter files\n- Variable schema for customization\n- Target directory information (e.g., apps/, packages/)\n- Required and optional configuration options\n\nUse this FIRST when creating new projects to understand available templates and their requirements.\n{% endif %}\n";
1431
1181
 
1432
1182
  //#endregion
1433
1183
  //#region src/tools/ListBoilerplatesTool.ts
@@ -1445,7 +1195,7 @@ var ListBoilerplatesTool = class ListBoilerplatesTool {
1445
1195
  * Get the tool definition for MCP
1446
1196
  */
1447
1197
  getDefinition() {
1448
- const description = this.templateService.renderString(description_default$2, { isMonolith: this.isMonolith });
1198
+ const description = this.templateService.renderString(description_default$1, { isMonolith: this.isMonolith });
1449
1199
  return {
1450
1200
  name: ListBoilerplatesTool.TOOL_NAME,
1451
1201
  description: description.trim(),
@@ -1482,87 +1232,6 @@ var ListBoilerplatesTool = class ListBoilerplatesTool {
1482
1232
  }
1483
1233
  };
1484
1234
 
1485
- //#endregion
1486
- //#region src/instructions/tools/list-scaffolding-methods/description.md?raw
1487
- var description_default$1 = "Lists all available scaffolding methods (features) that can be added to an existing project{% if not isMonolith %} or for a specific template{% endif %}.\n\nThis tool:\n{% if isMonolith %}\n- Reads your project's sourceTemplate from toolkit.yaml at workspace root\n{% else %}\n- Reads the project's sourceTemplate from project.json (monorepo) or toolkit.yaml (monolith), OR\n- Directly uses the provided templateName to list available features\n{% endif %}\n- Returns available features for that template type\n- Provides variable schemas for each scaffolding method\n- Shows descriptions of what each method creates\n\nUse this FIRST when adding features to understand:\n- What scaffolding methods are available\n- What variables each method requires\n- What files/features will be generated\n\nExample methods might include:\n- Adding new React routes (for React apps)\n- Creating API endpoints (for backend projects)\n- Adding new components (for frontend projects)\n- Setting up database models (for API projects)\n";
1488
-
1489
- //#endregion
1490
- //#region src/tools/ListScaffoldingMethodsTool.ts
1491
- var ListScaffoldingMethodsTool = class ListScaffoldingMethodsTool {
1492
- static TOOL_NAME = "list-scaffolding-methods";
1493
- fileSystemService;
1494
- scaffoldingMethodsService;
1495
- templateService;
1496
- isMonolith;
1497
- constructor(templatesPath, isMonolith = false) {
1498
- this.fileSystemService = new FileSystemService();
1499
- this.scaffoldingMethodsService = new ScaffoldingMethodsService(this.fileSystemService, templatesPath);
1500
- this.templateService = new TemplateService();
1501
- this.isMonolith = isMonolith;
1502
- }
1503
- /**
1504
- * Get the tool definition for MCP
1505
- */
1506
- getDefinition() {
1507
- const description = this.templateService.renderString(description_default$1, { isMonolith: this.isMonolith });
1508
- const properties = { cursor: {
1509
- type: "string",
1510
- description: "Optional pagination cursor to fetch the next page of results. Omit to fetch the first page."
1511
- } };
1512
- if (!this.isMonolith) {
1513
- properties.projectPath = {
1514
- type: "string",
1515
- description: "Absolute path to the project directory (for monorepo: containing project.json; for monolith: workspace root with toolkit.yaml). Either projectPath or templateName is required."
1516
- };
1517
- properties.templateName = {
1518
- type: "string",
1519
- description: "Name of the template to list scaffolding methods for (e.g., \"nextjs-15\", \"typescript-mcp-package\"). Either projectPath or templateName is required."
1520
- };
1521
- }
1522
- return {
1523
- name: ListScaffoldingMethodsTool.TOOL_NAME,
1524
- description: description.trim(),
1525
- inputSchema: {
1526
- type: "object",
1527
- properties,
1528
- additionalProperties: false
1529
- }
1530
- };
1531
- }
1532
- /**
1533
- * Execute the tool
1534
- */
1535
- async execute(args) {
1536
- try {
1537
- const { projectPath, templateName, cursor } = args;
1538
- let result;
1539
- if (this.isMonolith) try {
1540
- const resolvedTemplateName = (await ProjectConfigResolver.resolveProjectConfig(process.cwd())).sourceTemplate;
1541
- result = await this.scaffoldingMethodsService.listScaffoldingMethodsByTemplate(resolvedTemplateName, cursor);
1542
- } catch (error) {
1543
- throw new Error(`Failed to read template name from configuration: ${error instanceof Error ? error.message : String(error)}`);
1544
- }
1545
- else {
1546
- if (!projectPath && !templateName) throw new Error("Either projectPath or templateName must be provided");
1547
- if (projectPath) result = await this.scaffoldingMethodsService.listScaffoldingMethods(projectPath, cursor);
1548
- else result = await this.scaffoldingMethodsService.listScaffoldingMethodsByTemplate(templateName, cursor);
1549
- }
1550
- return { content: [{
1551
- type: "text",
1552
- text: JSON.stringify(result, null, 2)
1553
- }] };
1554
- } catch (error) {
1555
- return {
1556
- content: [{
1557
- type: "text",
1558
- text: `Error listing scaffolding methods: ${error instanceof Error ? error.message : String(error)}`
1559
- }],
1560
- isError: true
1561
- };
1562
- }
1563
- }
1564
- };
1565
-
1566
1235
  //#endregion
1567
1236
  //#region src/instructions/tools/use-boilerplate/description.md?raw
1568
1237
  var description_default = "{% if isMonolith %}\nThis tool is not available for monolith projects.\n\nMonolith projects use a single template specified in `toolkit.yaml` (sourceTemplate field). The template cannot be changed through this tool - it's determined by the workspace configuration.\n\nUse `list-scaffolding-methods` and `use-scaffold-method` to add features to your monolith project instead.\n{% else %}\nCreates a new project from a boilerplate template with the specified variables.\n\n**For Monorepo Projects Only:**\nThis tool creates new sub-projects (apps, packages) in your monorepo. Each project can use a different template.\n\nThis tool will:\n- Generate all necessary files from the selected boilerplate template\n- Replace template variables with provided values\n- Create the project in targetFolder/projectName (e.g., apps/my-new-app)\n- Set up initial configuration files (package.json, tsconfig.json, etc.)\n- Create project.json with sourceTemplate reference\n\nIMPORTANT:\n- Always call `list-boilerplates` first to get the exact variable schema\n- Follow the schema exactly - required fields must be provided\n- Use kebab-case for project names (e.g., \"my-new-app\", not \"MyNewApp\")\n- The tool will validate all variables against the schema before proceeding\n- Each new project can use a different boilerplate template\n{% endif %}\n";
@@ -1650,6 +1319,7 @@ The boilerplate provides a starting point - you may need to add features or cust
1650
1319
  //#region src/tools/UseScaffoldMethodTool.ts
1651
1320
  var UseScaffoldMethodTool = class UseScaffoldMethodTool {
1652
1321
  static TOOL_NAME = "use-scaffold-method";
1322
+ static TEMP_LOG_DIR = os$1.tmpdir();
1653
1323
  fileSystemService;
1654
1324
  scaffoldingMethodsService;
1655
1325
  isMonolith;
@@ -1659,6 +1329,25 @@ var UseScaffoldMethodTool = class UseScaffoldMethodTool {
1659
1329
  this.isMonolith = isMonolith;
1660
1330
  }
1661
1331
  /**
1332
+ * Write scaffold execution info to temp log file for hook processing
1333
+ */
1334
+ async writePendingScaffoldLog(scaffoldId, projectPath, featureName, generatedFiles) {
1335
+ try {
1336
+ const logEntry = {
1337
+ timestamp: Date.now(),
1338
+ scaffoldId,
1339
+ projectPath,
1340
+ featureName,
1341
+ generatedFiles,
1342
+ operation: "scaffold"
1343
+ };
1344
+ const tempLogFile = path$1.join(UseScaffoldMethodTool.TEMP_LOG_DIR, `scaffold-mcp-pending-${scaffoldId}.jsonl`);
1345
+ await fs$1.appendFile(tempLogFile, `${JSON.stringify(logEntry)}\n`, "utf-8");
1346
+ } catch (error) {
1347
+ console.error("Failed to write pending scaffold log:", error);
1348
+ }
1349
+ }
1350
+ /**
1662
1351
  * Get the tool definition for MCP
1663
1352
  */
1664
1353
  getDefinition() {
@@ -1712,13 +1401,16 @@ IMPORTANT:
1712
1401
  try {
1713
1402
  const { projectPath, scaffold_feature_name, variables } = args;
1714
1403
  const resolvedProjectPath = this.isMonolith ? process.cwd() : projectPath;
1404
+ const result = await this.scaffoldingMethodsService.useScaffoldMethod({
1405
+ projectPath: resolvedProjectPath,
1406
+ scaffold_feature_name,
1407
+ variables
1408
+ });
1409
+ const scaffoldId = generateStableId(6);
1410
+ if (result.createdFiles && result.createdFiles.length > 0) await this.writePendingScaffoldLog(scaffoldId, resolvedProjectPath, scaffold_feature_name, result.createdFiles);
1715
1411
  return { content: [{
1716
1412
  type: "text",
1717
- text: `${(await this.scaffoldingMethodsService.useScaffoldMethod({
1718
- projectPath: resolvedProjectPath,
1719
- scaffold_feature_name,
1720
- variables
1721
- })).message}
1413
+ text: `${result.message}
1722
1414
 
1723
1415
  IMPORTANT - Next Steps:
1724
1416
  1. READ the generated files to understand their structure and template placeholders
@@ -1728,6 +1420,9 @@ IMPORTANT - Next Steps:
1728
1420
  5. Only after completing the implementation should you move to other tasks
1729
1421
 
1730
1422
  Do not skip the implementation step - the scaffolded files contain templates that need actual code.`
1423
+ }, {
1424
+ type: "text",
1425
+ text: `SCAFFOLD_ID:${scaffoldId}`
1731
1426
  }] };
1732
1427
  } catch (error) {
1733
1428
  return {
@@ -2135,4 +1830,4 @@ var StdioTransportHandler = class {
2135
1830
  };
2136
1831
 
2137
1832
  //#endregion
2138
- export { UseScaffoldMethodTool as a, ListBoilerplatesTool as c, GenerateBoilerplateFileTool as d, ScaffoldingMethodsService as f, BoilerplateGeneratorService as g, FileSystemService as h, WriteToFileTool as i, GenerateFeatureScaffoldTool as l, BoilerplateService as m, SseTransportHandler as n, UseBoilerplateTool as o, ScaffoldGeneratorService as p, HttpTransportHandler as r, ListScaffoldingMethodsTool as s, StdioTransportHandler as t, GenerateBoilerplateTool as u };
1833
+ export { UseScaffoldMethodTool as a, GenerateFeatureScaffoldTool as c, ScaffoldGeneratorService as d, BoilerplateService as f, WriteToFileTool as i, GenerateBoilerplateTool as l, SseTransportHandler as n, UseBoilerplateTool as o, BoilerplateGeneratorService as p, HttpTransportHandler as r, ListBoilerplatesTool as s, StdioTransportHandler as t, GenerateBoilerplateFileTool as u };