@agiflowai/scaffold-mcp 1.0.26 → 1.1.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.
- package/dist/{ListScaffoldingMethodsTool-DBwZzJTA.cjs → ListScaffoldingMethodsTool-CYZtpU-W.cjs} +109 -126
- package/dist/{ListScaffoldingMethodsTool-D6BkKQyK.mjs → ListScaffoldingMethodsTool-DxdrPlcb.mjs} +32 -44
- package/dist/{claudeCode-B6CWgRYJ.cjs → claudeCode-BxcEboyM.cjs} +54 -57
- package/dist/{claudeCode-Dozuzn4S.mjs → claudeCode-DNgNiLlL.mjs} +7 -10
- package/dist/cli.cjs +141 -147
- package/dist/cli.mjs +9 -15
- package/dist/{geminiCli-COS3X1P7.cjs → geminiCli--s1Qy7ZP.cjs} +35 -37
- package/dist/{geminiCli-CzgQDDMl.mjs → geminiCli-CcrZEqsz.mjs} +3 -5
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +3 -7
- package/dist/index.d.mts +3 -9
- package/dist/index.mjs +4 -5
- package/dist/{shared-oDx2Btq0.mjs → shared-BVYIN3Is.mjs} +4 -10
- package/dist/{shared-fkWett9D.cjs → shared-QxPXh-L-.cjs} +17 -23
- package/dist/{src-sY88BbkJ.mjs → src-BEwgHhCT.mjs} +12 -30
- package/dist/{src-DxoKQE4s.cjs → src-oF_UdSBu.cjs} +59 -77
- package/dist/{tools-DsnQImJ1.cjs → tools-CVSZSirE.cjs} +103 -109
- package/dist/{tools-t-HMGLVh.mjs → tools-Cl06aoBi.mjs} +13 -19
- package/package.json +21 -21
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require(
|
|
2
|
-
let
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require("./ListScaffoldingMethodsTool-CYZtpU-W.cjs");
|
|
2
|
+
let _agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
3
3
|
let zod = require("zod");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
|
-
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path);
|
|
5
|
+
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path, 1);
|
|
6
6
|
let js_yaml = require("js-yaml");
|
|
7
|
-
js_yaml = require_ListScaffoldingMethodsTool.__toESM(js_yaml);
|
|
7
|
+
js_yaml = require_ListScaffoldingMethodsTool.__toESM(js_yaml, 1);
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
|
-
let
|
|
9
|
+
let _composio_json_schema_to_zod = require("@composio/json-schema-to-zod");
|
|
10
10
|
let node_fs_promises = require("node:fs/promises");
|
|
11
|
-
node_fs_promises = require_ListScaffoldingMethodsTool.__toESM(node_fs_promises);
|
|
11
|
+
node_fs_promises = require_ListScaffoldingMethodsTool.__toESM(node_fs_promises, 1);
|
|
12
12
|
let node_os = require("node:os");
|
|
13
|
-
node_os = require_ListScaffoldingMethodsTool.__toESM(node_os);
|
|
14
|
-
|
|
13
|
+
node_os = require_ListScaffoldingMethodsTool.__toESM(node_os, 1);
|
|
15
14
|
//#region src/services/BoilerplateGeneratorService.ts
|
|
16
15
|
/**
|
|
17
16
|
* Service for generating boilerplate configurations in scaffold.yaml files
|
|
@@ -79,11 +78,11 @@ var BoilerplateGeneratorService = class {
|
|
|
79
78
|
async generateBoilerplate(options) {
|
|
80
79
|
const { templateName, boilerplateName, description, instruction, targetFolder, variables, includes = [] } = options;
|
|
81
80
|
const templatePath = node_path.join(this.templatesPath, templateName);
|
|
82
|
-
await (0,
|
|
81
|
+
await (0, _agiflowai_aicode_utils.ensureDir)(templatePath);
|
|
83
82
|
const scaffoldYamlPath = node_path.join(templatePath, "scaffold.yaml");
|
|
84
83
|
let scaffoldConfig = {};
|
|
85
|
-
if (await (0,
|
|
86
|
-
const yamlContent = await (0,
|
|
84
|
+
if (await (0, _agiflowai_aicode_utils.pathExists)(scaffoldYamlPath)) {
|
|
85
|
+
const yamlContent = await (0, _agiflowai_aicode_utils.readFile)(scaffoldYamlPath, "utf-8");
|
|
87
86
|
scaffoldConfig = js_yaml.load(yamlContent);
|
|
88
87
|
}
|
|
89
88
|
if (!scaffoldConfig.boilerplate) scaffoldConfig.boilerplate = [];
|
|
@@ -113,7 +112,7 @@ var BoilerplateGeneratorService = class {
|
|
|
113
112
|
};
|
|
114
113
|
if (instruction) boilerplateDefinition.instruction = instruction;
|
|
115
114
|
scaffoldConfig.boilerplate.push(boilerplateDefinition);
|
|
116
|
-
await (0,
|
|
115
|
+
await (0, _agiflowai_aicode_utils.writeFile)(scaffoldYamlPath, this.dumpYamlWithLiteralBlocks(scaffoldConfig), "utf-8");
|
|
117
116
|
return {
|
|
118
117
|
success: true,
|
|
119
118
|
message: `Boilerplate '${boilerplateName}' added to ${scaffoldYamlPath}`,
|
|
@@ -125,13 +124,13 @@ var BoilerplateGeneratorService = class {
|
|
|
125
124
|
* List all templates (directories in templates folder)
|
|
126
125
|
*/
|
|
127
126
|
async listTemplates() {
|
|
128
|
-
return (await (0,
|
|
127
|
+
return (await (0, _agiflowai_aicode_utils.readdir)(this.templatesPath, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
129
128
|
}
|
|
130
129
|
/**
|
|
131
130
|
* Check if a template exists
|
|
132
131
|
*/
|
|
133
132
|
async templateExists(templateName) {
|
|
134
|
-
return (0,
|
|
133
|
+
return (0, _agiflowai_aicode_utils.pathExists)(node_path.join(this.templatesPath, templateName));
|
|
135
134
|
}
|
|
136
135
|
/**
|
|
137
136
|
* Create or update a template file for a boilerplate
|
|
@@ -139,17 +138,17 @@ var BoilerplateGeneratorService = class {
|
|
|
139
138
|
async createTemplateFile(options) {
|
|
140
139
|
const { templateName, filePath, content, sourceFile, header } = options;
|
|
141
140
|
const templatePath = node_path.join(this.templatesPath, templateName);
|
|
142
|
-
if (!await (0,
|
|
141
|
+
if (!await (0, _agiflowai_aicode_utils.pathExists)(templatePath)) return {
|
|
143
142
|
success: false,
|
|
144
143
|
message: `Template directory '${templateName}' does not exist at ${templatePath}`
|
|
145
144
|
};
|
|
146
145
|
let fileContent = content || "";
|
|
147
146
|
if (sourceFile) {
|
|
148
|
-
if (!await (0,
|
|
147
|
+
if (!await (0, _agiflowai_aicode_utils.pathExists)(sourceFile)) return {
|
|
149
148
|
success: false,
|
|
150
149
|
message: `Source file '${sourceFile}' does not exist`
|
|
151
150
|
};
|
|
152
|
-
fileContent = await (0,
|
|
151
|
+
fileContent = await (0, _agiflowai_aicode_utils.readFile)(sourceFile, "utf-8");
|
|
153
152
|
}
|
|
154
153
|
if (!fileContent && !sourceFile) return {
|
|
155
154
|
success: false,
|
|
@@ -157,10 +156,10 @@ var BoilerplateGeneratorService = class {
|
|
|
157
156
|
};
|
|
158
157
|
const templateFilePath = filePath.endsWith(".liquid") ? filePath : `${filePath}.liquid`;
|
|
159
158
|
const fullPath = node_path.join(templatePath, templateFilePath);
|
|
160
|
-
await (0,
|
|
159
|
+
await (0, _agiflowai_aicode_utils.ensureDir)(node_path.dirname(fullPath));
|
|
161
160
|
let finalContent = fileContent;
|
|
162
161
|
if (header) finalContent = `${header}\n\n${fileContent}`;
|
|
163
|
-
await (0,
|
|
162
|
+
await (0, _agiflowai_aicode_utils.writeFile)(fullPath, finalContent, "utf-8");
|
|
164
163
|
return {
|
|
165
164
|
success: true,
|
|
166
165
|
message: "Template file created successfully",
|
|
@@ -169,7 +168,6 @@ var BoilerplateGeneratorService = class {
|
|
|
169
168
|
};
|
|
170
169
|
}
|
|
171
170
|
};
|
|
172
|
-
|
|
173
171
|
//#endregion
|
|
174
172
|
//#region src/services/BoilerplateService.ts
|
|
175
173
|
var BoilerplateService = class {
|
|
@@ -191,12 +189,12 @@ var BoilerplateService = class {
|
|
|
191
189
|
const templateDirs = await this.discoverTemplateDirectories();
|
|
192
190
|
for (const templatePath of templateDirs) {
|
|
193
191
|
const scaffoldYamlPath = node_path.join(this.templatesPath, templatePath, "scaffold.yaml");
|
|
194
|
-
if ((0,
|
|
195
|
-
const scaffoldContent = (0,
|
|
192
|
+
if ((0, _agiflowai_aicode_utils.pathExistsSync)(scaffoldYamlPath)) try {
|
|
193
|
+
const scaffoldContent = (0, _agiflowai_aicode_utils.readFileSync)(scaffoldYamlPath, "utf8");
|
|
196
194
|
const scaffoldConfig = js_yaml.load(scaffoldContent);
|
|
197
195
|
if (scaffoldConfig.boilerplate) for (const boilerplate of scaffoldConfig.boilerplate) {
|
|
198
196
|
if (!boilerplate.targetFolder) {
|
|
199
|
-
|
|
197
|
+
_agiflowai_aicode_utils.log.warn(`Skipping boilerplate '${boilerplate.name}' in ${templatePath}: targetFolder is required in scaffold.yaml`);
|
|
200
198
|
continue;
|
|
201
199
|
}
|
|
202
200
|
boilerplates.push({
|
|
@@ -210,7 +208,7 @@ var BoilerplateService = class {
|
|
|
210
208
|
});
|
|
211
209
|
}
|
|
212
210
|
} catch (error) {
|
|
213
|
-
|
|
211
|
+
_agiflowai_aicode_utils.log.warn(`Failed to load scaffold.yaml for ${templatePath}:`, error);
|
|
214
212
|
}
|
|
215
213
|
}
|
|
216
214
|
return boilerplates;
|
|
@@ -236,14 +234,14 @@ var BoilerplateService = class {
|
|
|
236
234
|
async discoverTemplateDirectories() {
|
|
237
235
|
const templateDirs = [];
|
|
238
236
|
const findTemplates = (dir, baseDir = "") => {
|
|
239
|
-
if (!(0,
|
|
237
|
+
if (!(0, _agiflowai_aicode_utils.pathExistsSync)(dir)) return;
|
|
240
238
|
const items = (0, node_fs.readdirSync)(dir);
|
|
241
239
|
const hasPackageJson = items.includes("package.json") || items.includes("package.json.liquid");
|
|
242
240
|
const hasScaffoldYaml = items.includes("scaffold.yaml");
|
|
243
241
|
if (hasPackageJson && hasScaffoldYaml) templateDirs.push(baseDir);
|
|
244
242
|
for (const item of items) {
|
|
245
243
|
const itemPath = node_path.join(dir, item);
|
|
246
|
-
if ((0,
|
|
244
|
+
if ((0, _agiflowai_aicode_utils.statSync)(itemPath).isDirectory() && !item.startsWith(".") && item !== "node_modules") findTemplates(itemPath, baseDir ? node_path.join(baseDir, item) : item);
|
|
247
245
|
}
|
|
248
246
|
};
|
|
249
247
|
findTemplates(this.templatesPath);
|
|
@@ -256,18 +254,18 @@ var BoilerplateService = class {
|
|
|
256
254
|
let { boilerplateName, variables, monolith, targetFolderOverride } = request;
|
|
257
255
|
let projectConfig = null;
|
|
258
256
|
if (monolith === void 0 || monolith && !boilerplateName) try {
|
|
259
|
-
projectConfig = await
|
|
257
|
+
projectConfig = await _agiflowai_aicode_utils.ProjectConfigResolver.resolveProjectConfig(process.cwd());
|
|
260
258
|
} catch (_error) {}
|
|
261
259
|
if (monolith === void 0) if (projectConfig) {
|
|
262
260
|
monolith = projectConfig.type === "monolith";
|
|
263
|
-
|
|
261
|
+
_agiflowai_aicode_utils.log.info(`Auto-detected project type: ${projectConfig.type}`);
|
|
264
262
|
} else {
|
|
265
263
|
monolith = false;
|
|
266
|
-
|
|
264
|
+
_agiflowai_aicode_utils.log.info("No project configuration found, defaulting to monorepo mode");
|
|
267
265
|
}
|
|
268
266
|
if (monolith && !boilerplateName) if (projectConfig) {
|
|
269
267
|
boilerplateName = projectConfig.sourceTemplate;
|
|
270
|
-
|
|
268
|
+
_agiflowai_aicode_utils.log.info(`Using boilerplate from toolkit.yaml: ${boilerplateName}`);
|
|
271
269
|
} else return {
|
|
272
270
|
success: false,
|
|
273
271
|
message: "Failed to read boilerplate name from toolkit.yaml: No project configuration found"
|
|
@@ -312,10 +310,10 @@ var BoilerplateService = class {
|
|
|
312
310
|
marker: request.marker
|
|
313
311
|
});
|
|
314
312
|
if (!result.success) return result;
|
|
315
|
-
if (monolith) await
|
|
313
|
+
if (monolith) await _agiflowai_aicode_utils.ProjectConfigResolver.createToolkitYaml(boilerplate.template_path);
|
|
316
314
|
else {
|
|
317
315
|
const projectPath = node_path.join(targetFolder, folderName);
|
|
318
|
-
await
|
|
316
|
+
await _agiflowai_aicode_utils.ProjectConfigResolver.createProjectJson(projectPath, folderName, boilerplate.template_path);
|
|
319
317
|
}
|
|
320
318
|
const processedInstruction = boilerplate.instruction ? this.processBoilerplateInstruction(boilerplate.instruction, variables) : "";
|
|
321
319
|
let enhancedMessage = result.message;
|
|
@@ -359,14 +357,14 @@ var BoilerplateService = class {
|
|
|
359
357
|
validateBoilerplateVariables(boilerplate, variables) {
|
|
360
358
|
const errors = [];
|
|
361
359
|
try {
|
|
362
|
-
(0,
|
|
360
|
+
(0, _composio_json_schema_to_zod.jsonSchemaToZod)(boilerplate.variables_schema).parse(variables);
|
|
363
361
|
return {
|
|
364
362
|
isValid: true,
|
|
365
363
|
errors: []
|
|
366
364
|
};
|
|
367
365
|
} catch (error) {
|
|
368
366
|
if (error instanceof zod.z.ZodError) {
|
|
369
|
-
const zodErrors = error.
|
|
367
|
+
const zodErrors = error.issues.map((err) => {
|
|
370
368
|
return `${err.path.length > 0 ? err.path.join(".") : "root"}: ${err.message}`;
|
|
371
369
|
});
|
|
372
370
|
errors.push(...zodErrors);
|
|
@@ -378,7 +376,6 @@ var BoilerplateService = class {
|
|
|
378
376
|
}
|
|
379
377
|
}
|
|
380
378
|
};
|
|
381
|
-
|
|
382
379
|
//#endregion
|
|
383
380
|
//#region src/services/ScaffoldGeneratorService.ts
|
|
384
381
|
/**
|
|
@@ -447,11 +444,11 @@ var ScaffoldGeneratorService = class {
|
|
|
447
444
|
async generateFeatureScaffold(options) {
|
|
448
445
|
const { templateName, featureName, description, instruction, variables, includes = [], patterns = [] } = options;
|
|
449
446
|
const templatePath = node_path.join(this.templatesPath, templateName);
|
|
450
|
-
await (0,
|
|
447
|
+
await (0, _agiflowai_aicode_utils.ensureDir)(templatePath);
|
|
451
448
|
const scaffoldYamlPath = node_path.join(templatePath, "scaffold.yaml");
|
|
452
449
|
let scaffoldConfig = {};
|
|
453
|
-
if (await (0,
|
|
454
|
-
const yamlContent = await (0,
|
|
450
|
+
if (await (0, _agiflowai_aicode_utils.pathExists)(scaffoldYamlPath)) {
|
|
451
|
+
const yamlContent = await (0, _agiflowai_aicode_utils.readFile)(scaffoldYamlPath, "utf-8");
|
|
455
452
|
scaffoldConfig = js_yaml.load(yamlContent);
|
|
456
453
|
}
|
|
457
454
|
if (!scaffoldConfig.features) scaffoldConfig.features = [];
|
|
@@ -481,7 +478,7 @@ var ScaffoldGeneratorService = class {
|
|
|
481
478
|
if (instruction) featureDefinition.instruction = instruction;
|
|
482
479
|
if (patterns && patterns.length > 0) featureDefinition.patterns = patterns;
|
|
483
480
|
scaffoldConfig.features.push(featureDefinition);
|
|
484
|
-
await (0,
|
|
481
|
+
await (0, _agiflowai_aicode_utils.writeFile)(scaffoldYamlPath, this.dumpYamlWithLiteralBlocks(scaffoldConfig), "utf-8");
|
|
485
482
|
return {
|
|
486
483
|
success: true,
|
|
487
484
|
message: `Feature '${featureName}' added to ${scaffoldYamlPath}`,
|
|
@@ -493,16 +490,15 @@ var ScaffoldGeneratorService = class {
|
|
|
493
490
|
* List all templates (directories in templates folder)
|
|
494
491
|
*/
|
|
495
492
|
async listTemplates() {
|
|
496
|
-
return (await (0,
|
|
493
|
+
return (await (0, _agiflowai_aicode_utils.readdir)(this.templatesPath, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
497
494
|
}
|
|
498
495
|
/**
|
|
499
496
|
* Check if a template exists
|
|
500
497
|
*/
|
|
501
498
|
async templateExists(templateName) {
|
|
502
|
-
return (0,
|
|
499
|
+
return (0, _agiflowai_aicode_utils.pathExists)(node_path.join(this.templatesPath, templateName));
|
|
503
500
|
}
|
|
504
501
|
};
|
|
505
|
-
|
|
506
502
|
//#endregion
|
|
507
503
|
//#region src/tools/GenerateBoilerplateFileTool.ts
|
|
508
504
|
/**
|
|
@@ -664,7 +660,7 @@ Use this after generate-boilerplate or generate-feature-scaffold to create the a
|
|
|
664
660
|
try {
|
|
665
661
|
let { templateName } = args;
|
|
666
662
|
if (this.isMonolith && !templateName) try {
|
|
667
|
-
templateName = (await
|
|
663
|
+
templateName = (await _agiflowai_aicode_utils.ProjectConfigResolver.resolveProjectConfig(process.cwd())).sourceTemplate;
|
|
668
664
|
} catch (error) {
|
|
669
665
|
return {
|
|
670
666
|
content: [{
|
|
@@ -713,7 +709,6 @@ Use this after generate-boilerplate or generate-feature-scaffold to create the a
|
|
|
713
709
|
}
|
|
714
710
|
}
|
|
715
711
|
};
|
|
716
|
-
|
|
717
712
|
//#endregion
|
|
718
713
|
//#region src/tools/GenerateBoilerplateTool.ts
|
|
719
714
|
/**
|
|
@@ -897,7 +892,7 @@ Use this to add custom boilerplate configurations for frameworks not yet support
|
|
|
897
892
|
try {
|
|
898
893
|
let { templateName, targetFolder } = args;
|
|
899
894
|
if (this.isMonolith && !templateName) try {
|
|
900
|
-
templateName = (await
|
|
895
|
+
templateName = (await _agiflowai_aicode_utils.ProjectConfigResolver.resolveProjectConfig(process.cwd())).sourceTemplate;
|
|
901
896
|
} catch (error) {
|
|
902
897
|
return {
|
|
903
898
|
content: [{
|
|
@@ -959,7 +954,6 @@ Use this to add custom boilerplate configurations for frameworks not yet support
|
|
|
959
954
|
}
|
|
960
955
|
}
|
|
961
956
|
};
|
|
962
|
-
|
|
963
957
|
//#endregion
|
|
964
958
|
//#region src/tools/GenerateFeatureScaffoldTool.ts
|
|
965
959
|
/**
|
|
@@ -1124,7 +1118,7 @@ Use this to add custom feature scaffolds (pages, components, services, etc.) for
|
|
|
1124
1118
|
try {
|
|
1125
1119
|
let { templateName } = args;
|
|
1126
1120
|
if (this.isMonolith && !templateName) try {
|
|
1127
|
-
templateName = (await
|
|
1121
|
+
templateName = (await _agiflowai_aicode_utils.ProjectConfigResolver.resolveProjectConfig(process.cwd())).sourceTemplate;
|
|
1128
1122
|
} catch (error) {
|
|
1129
1123
|
return {
|
|
1130
1124
|
content: [{
|
|
@@ -1178,11 +1172,9 @@ Use this to add custom feature scaffolds (pages, components, services, etc.) for
|
|
|
1178
1172
|
}
|
|
1179
1173
|
}
|
|
1180
1174
|
};
|
|
1181
|
-
|
|
1182
1175
|
//#endregion
|
|
1183
1176
|
//#region src/instructions/tools/list-boilerplates/description.md?raw
|
|
1184
1177
|
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";
|
|
1185
|
-
|
|
1186
1178
|
//#endregion
|
|
1187
1179
|
//#region src/tools/ListBoilerplatesTool.ts
|
|
1188
1180
|
var ListBoilerplatesTool = class ListBoilerplatesTool {
|
|
@@ -1235,11 +1227,9 @@ var ListBoilerplatesTool = class ListBoilerplatesTool {
|
|
|
1235
1227
|
}
|
|
1236
1228
|
}
|
|
1237
1229
|
};
|
|
1238
|
-
|
|
1239
1230
|
//#endregion
|
|
1240
1231
|
//#region src/instructions/tools/use-boilerplate/description.md?raw
|
|
1241
1232
|
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";
|
|
1242
|
-
|
|
1243
1233
|
//#endregion
|
|
1244
1234
|
//#region src/tools/UseBoilerplateTool.ts
|
|
1245
1235
|
var UseBoilerplateTool = class UseBoilerplateTool {
|
|
@@ -1323,7 +1313,6 @@ The boilerplate provides a starting point - you may need to add features or cust
|
|
|
1323
1313
|
}
|
|
1324
1314
|
}
|
|
1325
1315
|
};
|
|
1326
|
-
|
|
1327
1316
|
//#endregion
|
|
1328
1317
|
//#region src/tools/UseScaffoldMethodTool.ts
|
|
1329
1318
|
var UseScaffoldMethodTool = class UseScaffoldMethodTool {
|
|
@@ -1420,7 +1409,7 @@ IMPORTANT:
|
|
|
1420
1409
|
variables,
|
|
1421
1410
|
marker
|
|
1422
1411
|
});
|
|
1423
|
-
const scaffoldId = (0,
|
|
1412
|
+
const scaffoldId = (0, _agiflowai_aicode_utils.generateStableId)(6);
|
|
1424
1413
|
if (result.createdFiles && result.createdFiles.length > 0) await this.writePendingScaffoldLog(scaffoldId, resolvedProjectPath, scaffold_feature_name, result.createdFiles);
|
|
1425
1414
|
return { content: [{
|
|
1426
1415
|
type: "text",
|
|
@@ -1449,7 +1438,6 @@ Do not skip the implementation step - the scaffolded files contain templates tha
|
|
|
1449
1438
|
}
|
|
1450
1439
|
}
|
|
1451
1440
|
};
|
|
1452
|
-
|
|
1453
1441
|
//#endregion
|
|
1454
1442
|
//#region src/tools/WriteToFileTool.ts
|
|
1455
1443
|
var WriteToFileTool = class WriteToFileTool {
|
|
@@ -1458,6 +1446,13 @@ var WriteToFileTool = class WriteToFileTool {
|
|
|
1458
1446
|
constructor() {
|
|
1459
1447
|
this.fileSystemService = new require_ListScaffoldingMethodsTool.FileSystemService();
|
|
1460
1448
|
}
|
|
1449
|
+
resolveWorkspaceFilePath(filePath) {
|
|
1450
|
+
const workspaceRoot = node_path.default.resolve(process.cwd());
|
|
1451
|
+
const resolvedPath = node_path.default.resolve(workspaceRoot, filePath);
|
|
1452
|
+
const relativeToWorkspace = node_path.default.relative(workspaceRoot, resolvedPath);
|
|
1453
|
+
if (!(!relativeToWorkspace.startsWith(`..${node_path.default.sep}`) && relativeToWorkspace !== ".." && !node_path.default.isAbsolute(relativeToWorkspace))) throw new Error(`Path "${filePath}" is outside the workspace directory`);
|
|
1454
|
+
return resolvedPath;
|
|
1455
|
+
}
|
|
1461
1456
|
/**
|
|
1462
1457
|
* Get the tool definition for MCP
|
|
1463
1458
|
*/
|
|
@@ -1473,14 +1468,14 @@ This tool will:
|
|
|
1473
1468
|
- Overwrite existing files with new content
|
|
1474
1469
|
|
|
1475
1470
|
Parameters:
|
|
1476
|
-
- file_path: Absolute or relative path to the
|
|
1471
|
+
- file_path: Absolute or relative path to a file inside the current workspace
|
|
1477
1472
|
- content: The content to write to the file`,
|
|
1478
1473
|
inputSchema: {
|
|
1479
1474
|
type: "object",
|
|
1480
1475
|
properties: {
|
|
1481
1476
|
file_path: {
|
|
1482
1477
|
type: "string",
|
|
1483
|
-
description: "Path to the file to write
|
|
1478
|
+
description: "Path to the file to write within the current workspace directory"
|
|
1484
1479
|
},
|
|
1485
1480
|
content: {
|
|
1486
1481
|
type: "string",
|
|
@@ -1500,7 +1495,7 @@ Parameters:
|
|
|
1500
1495
|
const { file_path, content } = args;
|
|
1501
1496
|
if (!file_path) throw new Error("Missing required parameter: file_path");
|
|
1502
1497
|
if (content === void 0 || content === null) throw new Error("Missing required parameter: content");
|
|
1503
|
-
const resolvedPath =
|
|
1498
|
+
const resolvedPath = this.resolveWorkspaceFilePath(file_path);
|
|
1504
1499
|
const dirPath = node_path.default.dirname(resolvedPath);
|
|
1505
1500
|
await this.fileSystemService.ensureDir(dirPath);
|
|
1506
1501
|
await this.fileSystemService.writeFile(resolvedPath, content);
|
|
@@ -1519,65 +1514,64 @@ Parameters:
|
|
|
1519
1514
|
}
|
|
1520
1515
|
}
|
|
1521
1516
|
};
|
|
1522
|
-
|
|
1523
1517
|
//#endregion
|
|
1524
|
-
Object.defineProperty(exports,
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1518
|
+
Object.defineProperty(exports, "BoilerplateGeneratorService", {
|
|
1519
|
+
enumerable: true,
|
|
1520
|
+
get: function() {
|
|
1521
|
+
return BoilerplateGeneratorService;
|
|
1522
|
+
}
|
|
1529
1523
|
});
|
|
1530
|
-
Object.defineProperty(exports,
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1524
|
+
Object.defineProperty(exports, "BoilerplateService", {
|
|
1525
|
+
enumerable: true,
|
|
1526
|
+
get: function() {
|
|
1527
|
+
return BoilerplateService;
|
|
1528
|
+
}
|
|
1535
1529
|
});
|
|
1536
|
-
Object.defineProperty(exports,
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1530
|
+
Object.defineProperty(exports, "GenerateBoilerplateFileTool", {
|
|
1531
|
+
enumerable: true,
|
|
1532
|
+
get: function() {
|
|
1533
|
+
return GenerateBoilerplateFileTool;
|
|
1534
|
+
}
|
|
1541
1535
|
});
|
|
1542
|
-
Object.defineProperty(exports,
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1536
|
+
Object.defineProperty(exports, "GenerateBoilerplateTool", {
|
|
1537
|
+
enumerable: true,
|
|
1538
|
+
get: function() {
|
|
1539
|
+
return GenerateBoilerplateTool;
|
|
1540
|
+
}
|
|
1547
1541
|
});
|
|
1548
|
-
Object.defineProperty(exports,
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1542
|
+
Object.defineProperty(exports, "GenerateFeatureScaffoldTool", {
|
|
1543
|
+
enumerable: true,
|
|
1544
|
+
get: function() {
|
|
1545
|
+
return GenerateFeatureScaffoldTool;
|
|
1546
|
+
}
|
|
1553
1547
|
});
|
|
1554
|
-
Object.defineProperty(exports,
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1548
|
+
Object.defineProperty(exports, "ListBoilerplatesTool", {
|
|
1549
|
+
enumerable: true,
|
|
1550
|
+
get: function() {
|
|
1551
|
+
return ListBoilerplatesTool;
|
|
1552
|
+
}
|
|
1559
1553
|
});
|
|
1560
|
-
Object.defineProperty(exports,
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1554
|
+
Object.defineProperty(exports, "ScaffoldGeneratorService", {
|
|
1555
|
+
enumerable: true,
|
|
1556
|
+
get: function() {
|
|
1557
|
+
return ScaffoldGeneratorService;
|
|
1558
|
+
}
|
|
1565
1559
|
});
|
|
1566
|
-
Object.defineProperty(exports,
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1560
|
+
Object.defineProperty(exports, "UseBoilerplateTool", {
|
|
1561
|
+
enumerable: true,
|
|
1562
|
+
get: function() {
|
|
1563
|
+
return UseBoilerplateTool;
|
|
1564
|
+
}
|
|
1571
1565
|
});
|
|
1572
|
-
Object.defineProperty(exports,
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1566
|
+
Object.defineProperty(exports, "UseScaffoldMethodTool", {
|
|
1567
|
+
enumerable: true,
|
|
1568
|
+
get: function() {
|
|
1569
|
+
return UseScaffoldMethodTool;
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
Object.defineProperty(exports, "WriteToFileTool", {
|
|
1573
|
+
enumerable: true,
|
|
1574
|
+
get: function() {
|
|
1575
|
+
return WriteToFileTool;
|
|
1576
|
+
}
|
|
1577
1577
|
});
|
|
1578
|
-
Object.defineProperty(exports, 'WriteToFileTool', {
|
|
1579
|
-
enumerable: true,
|
|
1580
|
-
get: function () {
|
|
1581
|
-
return WriteToFileTool;
|
|
1582
|
-
}
|
|
1583
|
-
});
|
|
@@ -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-
|
|
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";
|
|
@@ -8,7 +8,6 @@ import { readdirSync } from "node:fs";
|
|
|
8
8
|
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
9
9
|
import * as fs$1 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.
|
|
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,7 +1310,6 @@ The boilerplate provides a starting point - you may need to add features or cust
|
|
|
1320
1310
|
}
|
|
1321
1311
|
}
|
|
1322
1312
|
};
|
|
1323
|
-
|
|
1324
1313
|
//#endregion
|
|
1325
1314
|
//#region src/tools/UseScaffoldMethodTool.ts
|
|
1326
1315
|
var UseScaffoldMethodTool = class UseScaffoldMethodTool {
|
|
@@ -1446,7 +1435,6 @@ Do not skip the implementation step - the scaffolded files contain templates tha
|
|
|
1446
1435
|
}
|
|
1447
1436
|
}
|
|
1448
1437
|
};
|
|
1449
|
-
|
|
1450
1438
|
//#endregion
|
|
1451
1439
|
//#region src/tools/WriteToFileTool.ts
|
|
1452
1440
|
var WriteToFileTool = class WriteToFileTool {
|
|
@@ -1455,6 +1443,13 @@ var WriteToFileTool = class WriteToFileTool {
|
|
|
1455
1443
|
constructor() {
|
|
1456
1444
|
this.fileSystemService = new FileSystemService();
|
|
1457
1445
|
}
|
|
1446
|
+
resolveWorkspaceFilePath(filePath) {
|
|
1447
|
+
const workspaceRoot = path.resolve(process.cwd());
|
|
1448
|
+
const resolvedPath = path.resolve(workspaceRoot, filePath);
|
|
1449
|
+
const relativeToWorkspace = path.relative(workspaceRoot, resolvedPath);
|
|
1450
|
+
if (!(!relativeToWorkspace.startsWith(`..${path.sep}`) && relativeToWorkspace !== ".." && !path.isAbsolute(relativeToWorkspace))) throw new Error(`Path "${filePath}" is outside the workspace directory`);
|
|
1451
|
+
return resolvedPath;
|
|
1452
|
+
}
|
|
1458
1453
|
/**
|
|
1459
1454
|
* Get the tool definition for MCP
|
|
1460
1455
|
*/
|
|
@@ -1470,14 +1465,14 @@ This tool will:
|
|
|
1470
1465
|
- Overwrite existing files with new content
|
|
1471
1466
|
|
|
1472
1467
|
Parameters:
|
|
1473
|
-
- file_path: Absolute or relative path to the
|
|
1468
|
+
- file_path: Absolute or relative path to a file inside the current workspace
|
|
1474
1469
|
- content: The content to write to the file`,
|
|
1475
1470
|
inputSchema: {
|
|
1476
1471
|
type: "object",
|
|
1477
1472
|
properties: {
|
|
1478
1473
|
file_path: {
|
|
1479
1474
|
type: "string",
|
|
1480
|
-
description: "Path to the file to write
|
|
1475
|
+
description: "Path to the file to write within the current workspace directory"
|
|
1481
1476
|
},
|
|
1482
1477
|
content: {
|
|
1483
1478
|
type: "string",
|
|
@@ -1497,7 +1492,7 @@ Parameters:
|
|
|
1497
1492
|
const { file_path, content } = args;
|
|
1498
1493
|
if (!file_path) throw new Error("Missing required parameter: file_path");
|
|
1499
1494
|
if (content === void 0 || content === null) throw new Error("Missing required parameter: content");
|
|
1500
|
-
const resolvedPath =
|
|
1495
|
+
const resolvedPath = this.resolveWorkspaceFilePath(file_path);
|
|
1501
1496
|
const dirPath = path.dirname(resolvedPath);
|
|
1502
1497
|
await this.fileSystemService.ensureDir(dirPath);
|
|
1503
1498
|
await this.fileSystemService.writeFile(resolvedPath, content);
|
|
@@ -1516,6 +1511,5 @@ Parameters:
|
|
|
1516
1511
|
}
|
|
1517
1512
|
}
|
|
1518
1513
|
};
|
|
1519
|
-
|
|
1520
1514
|
//#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 };
|
|
1515
|
+
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 };
|