@agiflowai/scaffold-mcp 1.0.27 → 1.2.0

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.
@@ -1,4 +1,4 @@
1
- import { c as PaginationHelper, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
1
+ import { c as PaginationHelper, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService } from "./ListScaffoldingMethodsTool-DxdrPlcb.mjs";
2
2
  import { ProjectConfigResolver, ensureDir, generateStableId, log, pathExists, pathExistsSync, readFile, readFileSync, readdir, statSync, writeFile } from "@agiflowai/aicode-utils";
3
3
  import { z } from "zod";
4
4
  import * as path$1 from "node:path";
@@ -6,9 +6,8 @@ import path from "node:path";
6
6
  import * as yaml$1 from "js-yaml";
7
7
  import { readdirSync } from "node:fs";
8
8
  import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
9
- import * as fs$1 from "node:fs/promises";
9
+ import { appendFile } from "node:fs/promises";
10
10
  import * as os$1 from "node:os";
11
-
12
11
  //#region src/services/BoilerplateGeneratorService.ts
13
12
  /**
14
13
  * Service for generating boilerplate configurations in scaffold.yaml files
@@ -166,7 +165,6 @@ var BoilerplateGeneratorService = class {
166
165
  };
167
166
  }
168
167
  };
169
-
170
168
  //#endregion
171
169
  //#region src/services/BoilerplateService.ts
172
170
  var BoilerplateService = class {
@@ -363,7 +361,7 @@ var BoilerplateService = class {
363
361
  };
364
362
  } catch (error) {
365
363
  if (error instanceof z.ZodError) {
366
- const zodErrors = error.errors.map((err) => {
364
+ const zodErrors = error.issues.map((err) => {
367
365
  return `${err.path.length > 0 ? err.path.join(".") : "root"}: ${err.message}`;
368
366
  });
369
367
  errors.push(...zodErrors);
@@ -375,7 +373,6 @@ var BoilerplateService = class {
375
373
  }
376
374
  }
377
375
  };
378
-
379
376
  //#endregion
380
377
  //#region src/services/ScaffoldGeneratorService.ts
381
378
  /**
@@ -499,7 +496,6 @@ var ScaffoldGeneratorService = class {
499
496
  return pathExists(path$1.join(this.templatesPath, templateName));
500
497
  }
501
498
  };
502
-
503
499
  //#endregion
504
500
  //#region src/tools/GenerateBoilerplateFileTool.ts
505
501
  /**
@@ -710,7 +706,6 @@ Use this after generate-boilerplate or generate-feature-scaffold to create the a
710
706
  }
711
707
  }
712
708
  };
713
-
714
709
  //#endregion
715
710
  //#region src/tools/GenerateBoilerplateTool.ts
716
711
  /**
@@ -956,7 +951,6 @@ Use this to add custom boilerplate configurations for frameworks not yet support
956
951
  }
957
952
  }
958
953
  };
959
-
960
954
  //#endregion
961
955
  //#region src/tools/GenerateFeatureScaffoldTool.ts
962
956
  /**
@@ -1175,11 +1169,9 @@ Use this to add custom feature scaffolds (pages, components, services, etc.) for
1175
1169
  }
1176
1170
  }
1177
1171
  };
1178
-
1179
1172
  //#endregion
1180
1173
  //#region src/instructions/tools/list-boilerplates/description.md?raw
1181
1174
  var description_default$1 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in `.toolkit/settings.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";
1182
-
1183
1175
  //#endregion
1184
1176
  //#region src/tools/ListBoilerplatesTool.ts
1185
1177
  var ListBoilerplatesTool = class ListBoilerplatesTool {
@@ -1232,11 +1224,9 @@ var ListBoilerplatesTool = class ListBoilerplatesTool {
1232
1224
  }
1233
1225
  }
1234
1226
  };
1235
-
1236
1227
  //#endregion
1237
1228
  //#region src/instructions/tools/use-boilerplate/description.md?raw
1238
1229
  var description_default = "{% if isMonolith %}\nThis tool is not available for monolith projects.\n\nMonolith projects use a single template specified in `.toolkit/settings.yaml` (`sourceTemplate`). 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";
1239
-
1240
1230
  //#endregion
1241
1231
  //#region src/tools/UseBoilerplateTool.ts
1242
1232
  var UseBoilerplateTool = class UseBoilerplateTool {
@@ -1320,12 +1310,28 @@ The boilerplate provides a starting point - you may need to add features or cust
1320
1310
  }
1321
1311
  }
1322
1312
  };
1323
-
1313
+ //#endregion
1314
+ //#region src/utils/scaffoldPendingLog.ts
1315
+ async function writePendingScaffoldLog(config) {
1316
+ const { scaffoldId, projectPath, featureName, generatedFiles } = config;
1317
+ try {
1318
+ const logEntry = {
1319
+ timestamp: Date.now(),
1320
+ scaffoldId,
1321
+ projectPath,
1322
+ featureName,
1323
+ generatedFiles,
1324
+ operation: "scaffold"
1325
+ };
1326
+ await appendFile(path$1.join(os$1.tmpdir(), `scaffold-mcp-pending-${scaffoldId}.jsonl`), `${JSON.stringify(logEntry)}\n`, "utf-8");
1327
+ } catch (error) {
1328
+ console.error("Failed to write pending scaffold log:", error);
1329
+ }
1330
+ }
1324
1331
  //#endregion
1325
1332
  //#region src/tools/UseScaffoldMethodTool.ts
1326
1333
  var UseScaffoldMethodTool = class UseScaffoldMethodTool {
1327
1334
  static TOOL_NAME = "use-scaffold-method";
1328
- static TEMP_LOG_DIR = os$1.tmpdir();
1329
1335
  fileSystemService;
1330
1336
  scaffoldingMethodsService;
1331
1337
  isMonolith;
@@ -1335,25 +1341,6 @@ var UseScaffoldMethodTool = class UseScaffoldMethodTool {
1335
1341
  this.isMonolith = isMonolith;
1336
1342
  }
1337
1343
  /**
1338
- * Write scaffold execution info to temp log file for hook processing
1339
- */
1340
- async writePendingScaffoldLog(scaffoldId, projectPath, featureName, generatedFiles) {
1341
- try {
1342
- const logEntry = {
1343
- timestamp: Date.now(),
1344
- scaffoldId,
1345
- projectPath,
1346
- featureName,
1347
- generatedFiles,
1348
- operation: "scaffold"
1349
- };
1350
- const tempLogFile = path$1.join(UseScaffoldMethodTool.TEMP_LOG_DIR, `scaffold-mcp-pending-${scaffoldId}.jsonl`);
1351
- await fs$1.appendFile(tempLogFile, `${JSON.stringify(logEntry)}\n`, "utf-8");
1352
- } catch (error) {
1353
- console.error("Failed to write pending scaffold log:", error);
1354
- }
1355
- }
1356
- /**
1357
1344
  * Get the tool definition for MCP
1358
1345
  */
1359
1346
  getDefinition() {
@@ -1418,7 +1405,12 @@ IMPORTANT:
1418
1405
  marker
1419
1406
  });
1420
1407
  const scaffoldId = generateStableId(6);
1421
- if (result.createdFiles && result.createdFiles.length > 0) await this.writePendingScaffoldLog(scaffoldId, resolvedProjectPath, scaffold_feature_name, result.createdFiles);
1408
+ if (result.createdFiles && result.createdFiles.length > 0) await writePendingScaffoldLog({
1409
+ scaffoldId,
1410
+ projectPath: resolvedProjectPath,
1411
+ featureName: scaffold_feature_name,
1412
+ generatedFiles: result.createdFiles
1413
+ });
1422
1414
  return { content: [{
1423
1415
  type: "text",
1424
1416
  text: `${result.message}
@@ -1446,7 +1438,6 @@ Do not skip the implementation step - the scaffolded files contain templates tha
1446
1438
  }
1447
1439
  }
1448
1440
  };
1449
-
1450
1441
  //#endregion
1451
1442
  //#region src/tools/WriteToFileTool.ts
1452
1443
  var WriteToFileTool = class WriteToFileTool {
@@ -1455,6 +1446,13 @@ var WriteToFileTool = class WriteToFileTool {
1455
1446
  constructor() {
1456
1447
  this.fileSystemService = new FileSystemService();
1457
1448
  }
1449
+ resolveWorkspaceFilePath(filePath) {
1450
+ const workspaceRoot = path.resolve(process.cwd());
1451
+ const resolvedPath = path.resolve(workspaceRoot, filePath);
1452
+ const relativeToWorkspace = path.relative(workspaceRoot, resolvedPath);
1453
+ if (!(!relativeToWorkspace.startsWith(`..${path.sep}`) && relativeToWorkspace !== ".." && !path.isAbsolute(relativeToWorkspace))) throw new Error(`Path "${filePath}" is outside the workspace directory`);
1454
+ return resolvedPath;
1455
+ }
1458
1456
  /**
1459
1457
  * Get the tool definition for MCP
1460
1458
  */
@@ -1470,14 +1468,14 @@ This tool will:
1470
1468
  - Overwrite existing files with new content
1471
1469
 
1472
1470
  Parameters:
1473
- - file_path: Absolute or relative path to the target file
1471
+ - file_path: Absolute or relative path to a file inside the current workspace
1474
1472
  - content: The content to write to the file`,
1475
1473
  inputSchema: {
1476
1474
  type: "object",
1477
1475
  properties: {
1478
1476
  file_path: {
1479
1477
  type: "string",
1480
- description: "Path to the file to write (absolute or relative to current working directory)"
1478
+ description: "Path to the file to write within the current workspace directory"
1481
1479
  },
1482
1480
  content: {
1483
1481
  type: "string",
@@ -1497,7 +1495,7 @@ Parameters:
1497
1495
  const { file_path, content } = args;
1498
1496
  if (!file_path) throw new Error("Missing required parameter: file_path");
1499
1497
  if (content === void 0 || content === null) throw new Error("Missing required parameter: content");
1500
- const resolvedPath = path.isAbsolute(file_path) ? file_path : path.resolve(process.cwd(), file_path);
1498
+ const resolvedPath = this.resolveWorkspaceFilePath(file_path);
1501
1499
  const dirPath = path.dirname(resolvedPath);
1502
1500
  await this.fileSystemService.ensureDir(dirPath);
1503
1501
  await this.fileSystemService.writeFile(resolvedPath, content);
@@ -1516,6 +1514,5 @@ Parameters:
1516
1514
  }
1517
1515
  }
1518
1516
  };
1519
-
1520
1517
  //#endregion
1521
- export { GenerateFeatureScaffoldTool as a, ScaffoldGeneratorService as c, ListBoilerplatesTool as i, BoilerplateService as l, UseScaffoldMethodTool as n, GenerateBoilerplateTool as o, UseBoilerplateTool as r, GenerateBoilerplateFileTool as s, WriteToFileTool as t, BoilerplateGeneratorService as u };
1518
+ export { ListBoilerplatesTool as a, GenerateBoilerplateFileTool as c, BoilerplateGeneratorService as d, UseBoilerplateTool as i, ScaffoldGeneratorService as l, UseScaffoldMethodTool as n, GenerateFeatureScaffoldTool as o, writePendingScaffoldLog as r, GenerateBoilerplateTool as s, WriteToFileTool as t, BoilerplateService as u };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agiflowai/scaffold-mcp",
3
3
  "description": "MCP server for scaffolding applications with boilerplate templates",
4
- "version": "1.0.27",
4
+ "version": "1.2.0",
5
5
  "license": "AGPL-3.0",
6
6
  "author": "AgiflowIO",
7
7
  "repository": {
@@ -35,31 +35,31 @@
35
35
  "README.md"
36
36
  ],
37
37
  "dependencies": {
38
- "@composio/json-schema-to-zod": "0.1.15",
39
- "@inquirer/prompts": "^7.8.6",
40
- "@modelcontextprotocol/sdk": "1.26.0",
38
+ "@composio/json-schema-to-zod": "0.1.20",
39
+ "@inquirer/prompts": "8.4.1",
40
+ "@modelcontextprotocol/sdk": "1.29.0",
41
41
  "chalk": "5.6.2",
42
- "commander": "14.0.1",
43
- "execa": "^9.5.2",
44
- "express": "^4.21.2",
45
- "js-yaml": "4.1.1",
46
- "liquidjs": "10.25.0",
47
- "minimatch": "^10.2.3",
48
- "pino": "^10.0.0",
49
- "pino-pretty": "^13.1.1",
50
- "zod": "3.25.76",
51
- "@agiflowai/aicode-utils": "1.0.20",
52
- "@agiflowai/architect-mcp": "1.0.25",
53
- "@agiflowai/hooks-adapter": "0.0.21",
54
- "@agiflowai/coding-agent-bridge": "1.0.23"
42
+ "commander": "14.0.3",
43
+ "execa": "9.6.1",
44
+ "express": "5.2.1",
45
+ "js-yaml": "4.2.0",
46
+ "liquidjs": "10.27.0",
47
+ "minimatch": "10.2.5",
48
+ "pino": "10.3.1",
49
+ "pino-pretty": "13.1.3",
50
+ "zod": "4.3.6",
51
+ "@agiflowai/aicode-utils": "1.2.0",
52
+ "@agiflowai/architect-mcp": "1.2.0",
53
+ "@agiflowai/hooks-adapter": "0.1.1",
54
+ "@agiflowai/coding-agent-bridge": "1.2.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@types/express": "^5.0.0",
58
- "@types/js-yaml": "^4.0.9",
59
- "@types/node": "^22.0.0",
60
- "tsdown": "^0.16.4",
57
+ "@types/express": "5.0.6",
58
+ "@types/js-yaml": "4.0.9",
59
+ "@types/node": "25.6.0",
60
+ "tsdown": "0.21.8",
61
61
  "typescript": "5.9.3",
62
- "unplugin-raw": "^0.6.3"
62
+ "unplugin-raw": "0.7.0"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"