@agiflowai/scaffold-mcp 0.5.0 → 1.0.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/README.md +11 -71
- package/dist/ScaffoldConfigLoader-CI0T6zdG.js +142 -0
- package/dist/{ScaffoldConfigLoader-DzcV5a_c.cjs → ScaffoldConfigLoader-DQMCLVGD.cjs} +1 -1
- package/dist/ScaffoldConfigLoader-DhthV6xq.js +3 -0
- package/dist/{ScaffoldService-BgFWAOLQ.cjs → ScaffoldService-B-L4gwHt.cjs} +6 -0
- package/dist/ScaffoldService-Cx4ZonaT.cjs +3 -0
- package/dist/ScaffoldService-DVsusUh5.js +3 -0
- package/dist/ScaffoldService-QgQKHMM-.js +290 -0
- package/dist/TemplateService-BZRt3NI8.cjs +3 -0
- package/dist/TemplateService-CiZJA06s.js +79 -0
- package/dist/TemplateService-DropYdp8.js +3 -0
- package/dist/VariableReplacementService-B3qARIC9.js +66 -0
- package/dist/{VariableReplacementService-YUpL5nAC.cjs → VariableReplacementService-BrJ1PdKm.cjs} +1 -1
- package/dist/VariableReplacementService-D8C-IsP-.js +3 -0
- package/dist/cli.cjs +1363 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1355 -0
- package/dist/index.cjs +32 -3144
- package/dist/index.d.cts +798 -0
- package/dist/index.d.ts +799 -0
- package/dist/index.js +7 -0
- package/dist/stdio-Cz5aRdvr.cjs +2210 -0
- package/dist/stdio-Dmpwju2k.js +2074 -0
- package/package.json +19 -4
- package/dist/ScaffoldService-BvD9WvRi.cjs +0 -3
- package/dist/TemplateService-B5EZjPB0.cjs +0 -3
- /package/dist/{ScaffoldConfigLoader-1Pcv9cxm.cjs → ScaffoldConfigLoader-BrmvENTo.cjs} +0 -0
- /package/dist/{TemplateService-_KpkoLfZ.cjs → TemplateService-DRubcvS9.cjs} +0 -0
- /package/dist/{VariableReplacementService-ClshNY_C.cjs → VariableReplacementService-BL84vnKk.cjs} +0 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
import { JsonSchema } from "@composio/json-schema-to-zod";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
|
+
|
|
6
|
+
//#region src/services/BoilerplateGeneratorService.d.ts
|
|
7
|
+
interface GenerateBoilerplateOptions {
|
|
8
|
+
templateName: string;
|
|
9
|
+
boilerplateName: string;
|
|
10
|
+
description: string;
|
|
11
|
+
instruction?: string;
|
|
12
|
+
targetFolder: string;
|
|
13
|
+
variables: Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
type: string;
|
|
17
|
+
required: boolean;
|
|
18
|
+
default?: any;
|
|
19
|
+
}>;
|
|
20
|
+
includes?: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Service for generating boilerplate configurations in scaffold.yaml files
|
|
24
|
+
*/
|
|
25
|
+
declare class BoilerplateGeneratorService {
|
|
26
|
+
private templatesPath;
|
|
27
|
+
constructor(templatesPath: string);
|
|
28
|
+
/**
|
|
29
|
+
* Custom YAML dumper that forces literal block style (|) for description and instruction fields
|
|
30
|
+
*/
|
|
31
|
+
private dumpYamlWithLiteralBlocks;
|
|
32
|
+
/**
|
|
33
|
+
* Process config to ensure description and instruction use literal block style
|
|
34
|
+
*/
|
|
35
|
+
private processConfigForLiteralBlocks;
|
|
36
|
+
/**
|
|
37
|
+
* Ensure string is properly formatted for YAML literal blocks
|
|
38
|
+
*/
|
|
39
|
+
private ensureMultilineFormat;
|
|
40
|
+
/**
|
|
41
|
+
* Generate or update a boilerplate configuration in scaffold.yaml
|
|
42
|
+
*/
|
|
43
|
+
generateBoilerplate(options: GenerateBoilerplateOptions): Promise<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
message: string;
|
|
46
|
+
templatePath?: string;
|
|
47
|
+
scaffoldYamlPath?: string;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* List all templates (directories in templates folder)
|
|
51
|
+
*/
|
|
52
|
+
listTemplates(): Promise<string[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Check if a template exists
|
|
55
|
+
*/
|
|
56
|
+
templateExists(templateName: string): Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Create or update a template file for a boilerplate
|
|
59
|
+
*/
|
|
60
|
+
createTemplateFile(options: {
|
|
61
|
+
templateName: string;
|
|
62
|
+
filePath: string;
|
|
63
|
+
content?: string;
|
|
64
|
+
sourceFile?: string;
|
|
65
|
+
header?: string;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
message: string;
|
|
69
|
+
filePath?: string;
|
|
70
|
+
fullPath?: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/types/boilerplateTypes.d.ts
|
|
75
|
+
interface BoilerplateConfig {
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
instruction: string;
|
|
79
|
+
variables_schema: JsonSchema;
|
|
80
|
+
includes: string[];
|
|
81
|
+
targetFolder: string;
|
|
82
|
+
}
|
|
83
|
+
interface FeatureConfig {
|
|
84
|
+
name: string;
|
|
85
|
+
generator: string;
|
|
86
|
+
instruction: string;
|
|
87
|
+
variables_schema: JsonSchema;
|
|
88
|
+
includes: string[];
|
|
89
|
+
}
|
|
90
|
+
interface ScaffoldYamlConfig {
|
|
91
|
+
boilerplate?: BoilerplateConfig[];
|
|
92
|
+
feature?: FeatureConfig[];
|
|
93
|
+
}
|
|
94
|
+
interface BoilerplateInfo {
|
|
95
|
+
name: string;
|
|
96
|
+
description: string;
|
|
97
|
+
instruction: string;
|
|
98
|
+
variables_schema: JsonSchema;
|
|
99
|
+
template_path: string;
|
|
100
|
+
target_folder: string;
|
|
101
|
+
includes: string[];
|
|
102
|
+
}
|
|
103
|
+
interface UseBoilerplateRequest {
|
|
104
|
+
boilerplateName: string;
|
|
105
|
+
variables: Record<string, any>;
|
|
106
|
+
monolith?: boolean;
|
|
107
|
+
targetFolderOverride?: string;
|
|
108
|
+
}
|
|
109
|
+
interface ListBoilerplateResponse {
|
|
110
|
+
boilerplates: BoilerplateInfo[];
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/types/interfaces.d.ts
|
|
114
|
+
/**
|
|
115
|
+
* Interface for file system operations
|
|
116
|
+
*/
|
|
117
|
+
interface IFileSystemService {
|
|
118
|
+
pathExists(path: string): Promise<boolean>;
|
|
119
|
+
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
120
|
+
readJson(path: string): Promise<any>;
|
|
121
|
+
writeFile(path: string, content: string, encoding?: BufferEncoding): Promise<void>;
|
|
122
|
+
ensureDir(path: string): Promise<void>;
|
|
123
|
+
copy(src: string, dest: string): Promise<void>;
|
|
124
|
+
readdir(path: string): Promise<string[]>;
|
|
125
|
+
stat(path: string): Promise<{
|
|
126
|
+
isDirectory(): boolean;
|
|
127
|
+
isFile(): boolean;
|
|
128
|
+
}>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Interface for template rendering
|
|
132
|
+
*/
|
|
133
|
+
interface ITemplateService {
|
|
134
|
+
renderString(template: string, variables: Record<string, any>): string;
|
|
135
|
+
containsTemplateVariables(content: string): boolean;
|
|
136
|
+
}
|
|
137
|
+
type INunjucksService = ITemplateService;
|
|
138
|
+
/**
|
|
139
|
+
* Interface for scaffold config loading operations
|
|
140
|
+
*/
|
|
141
|
+
interface IScaffoldConfigLoader {
|
|
142
|
+
parseArchitectConfig(templatePath: string): Promise<ArchitectConfig | null>;
|
|
143
|
+
parseIncludeEntry(includeEntry: string, variables: Record<string, any>): ParsedInclude;
|
|
144
|
+
replaceVariablesInPath(pathStr: string, variables: Record<string, any>): string;
|
|
145
|
+
shouldIncludeFile(conditions: Record<string, string> | undefined, variables: Record<string, any>): boolean;
|
|
146
|
+
validateTemplate(templatePath: string, scaffoldType: string): Promise<TemplateValidationResult>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Interface for variable replacement in files
|
|
150
|
+
*/
|
|
151
|
+
interface IVariableReplacementService {
|
|
152
|
+
processFilesForVariableReplacement(dirPath: string, variables: Record<string, any>): Promise<void>;
|
|
153
|
+
replaceVariablesInFile(filePath: string, variables: Record<string, any>): Promise<void>;
|
|
154
|
+
isBinaryFile(filePath: string): boolean;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Main scaffold service interface
|
|
158
|
+
*/
|
|
159
|
+
interface IScaffoldService {
|
|
160
|
+
useBoilerplate(options: BoilerplateOptions): Promise<ScaffoldResult>;
|
|
161
|
+
useFeature(options: FeatureOptions): Promise<ScaffoldResult>;
|
|
162
|
+
}
|
|
163
|
+
type ITemplateParserService = IScaffoldConfigLoader;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/types/scaffold.d.ts
|
|
166
|
+
interface BoilerplateOptions {
|
|
167
|
+
projectName: string;
|
|
168
|
+
packageName: string;
|
|
169
|
+
targetFolder: string;
|
|
170
|
+
templateFolder: string;
|
|
171
|
+
boilerplateName: string;
|
|
172
|
+
variables?: Record<string, any>;
|
|
173
|
+
}
|
|
174
|
+
interface FeatureOptions {
|
|
175
|
+
projectPath: string;
|
|
176
|
+
templateFolder: string;
|
|
177
|
+
featureName: string;
|
|
178
|
+
variables?: Record<string, any>;
|
|
179
|
+
}
|
|
180
|
+
interface ArchitectConfig {
|
|
181
|
+
[key: string]: {
|
|
182
|
+
name: string;
|
|
183
|
+
description: string;
|
|
184
|
+
variables_schema: {
|
|
185
|
+
type: string;
|
|
186
|
+
properties: Record<string, any>;
|
|
187
|
+
required: string[];
|
|
188
|
+
additionalProperties: boolean;
|
|
189
|
+
};
|
|
190
|
+
includes: string[];
|
|
191
|
+
generator?: string;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
interface ParsedInclude {
|
|
195
|
+
sourcePath: string;
|
|
196
|
+
targetPath: string;
|
|
197
|
+
conditions?: Record<string, string>;
|
|
198
|
+
}
|
|
199
|
+
interface ScaffoldResult {
|
|
200
|
+
success: boolean;
|
|
201
|
+
message: string;
|
|
202
|
+
warnings?: string[];
|
|
203
|
+
createdFiles?: string[];
|
|
204
|
+
existingFiles?: string[];
|
|
205
|
+
}
|
|
206
|
+
interface TemplateValidationResult {
|
|
207
|
+
isValid: boolean;
|
|
208
|
+
errors: string[];
|
|
209
|
+
missingFiles: string[];
|
|
210
|
+
}
|
|
211
|
+
interface GeneratorContext {
|
|
212
|
+
variables: Record<string, any>;
|
|
213
|
+
config: ArchitectConfig[string];
|
|
214
|
+
targetPath: string;
|
|
215
|
+
templatePath: string;
|
|
216
|
+
fileSystem: IFileSystemService;
|
|
217
|
+
scaffoldConfigLoader: IScaffoldConfigLoader;
|
|
218
|
+
variableReplacer: IVariableReplacementService;
|
|
219
|
+
}
|
|
220
|
+
type GeneratorFunction = (context: GeneratorContext) => Promise<ScaffoldResult>;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/services/BoilerplateService.d.ts
|
|
223
|
+
declare class BoilerplateService {
|
|
224
|
+
private templatesPath;
|
|
225
|
+
private templateService;
|
|
226
|
+
private scaffoldService;
|
|
227
|
+
constructor(templatesPath: string);
|
|
228
|
+
/**
|
|
229
|
+
* Scans all scaffold.yaml files and returns available boilerplates
|
|
230
|
+
*/
|
|
231
|
+
listBoilerplates(): Promise<ListBoilerplateResponse>;
|
|
232
|
+
/**
|
|
233
|
+
* Dynamically discovers template directories by finding all directories
|
|
234
|
+
* that contain both package.json and scaffold.yaml files
|
|
235
|
+
*/
|
|
236
|
+
private discoverTemplateDirectories;
|
|
237
|
+
/**
|
|
238
|
+
* Executes a specific boilerplate with provided variables
|
|
239
|
+
*/
|
|
240
|
+
useBoilerplate(request: UseBoilerplateRequest): Promise<ScaffoldResult>;
|
|
241
|
+
/**
|
|
242
|
+
* Gets a specific boilerplate configuration by name with optional variable rendering
|
|
243
|
+
*/
|
|
244
|
+
getBoilerplate(name: string, variables?: Record<string, any>): Promise<BoilerplateInfo | null>;
|
|
245
|
+
/**
|
|
246
|
+
* Processes boilerplate instruction with template service
|
|
247
|
+
*/
|
|
248
|
+
processBoilerplateInstruction(instruction: string, variables: Record<string, any>): string;
|
|
249
|
+
/**
|
|
250
|
+
* Validates boilerplate variables against schema using Zod
|
|
251
|
+
*/
|
|
252
|
+
validateBoilerplateVariables(boilerplate: BoilerplateInfo, variables: Record<string, any>): {
|
|
253
|
+
isValid: boolean;
|
|
254
|
+
errors: string[];
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/services/FileSystemService.d.ts
|
|
259
|
+
declare class FileSystemService implements IFileSystemService {
|
|
260
|
+
pathExists(path: string): Promise<boolean>;
|
|
261
|
+
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
262
|
+
readJson(path: string): Promise<any>;
|
|
263
|
+
writeFile(path: string, content: string, encoding?: BufferEncoding): Promise<void>;
|
|
264
|
+
ensureDir(path: string): Promise<void>;
|
|
265
|
+
copy(src: string, dest: string): Promise<void>;
|
|
266
|
+
readdir(path: string): Promise<string[]>;
|
|
267
|
+
stat(path: string): Promise<{
|
|
268
|
+
isDirectory(): boolean;
|
|
269
|
+
isFile(): boolean;
|
|
270
|
+
}>;
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/services/ScaffoldConfigLoader.d.ts
|
|
274
|
+
|
|
275
|
+
declare class ScaffoldConfigLoader implements IScaffoldConfigLoader {
|
|
276
|
+
private fileSystem;
|
|
277
|
+
private templateService;
|
|
278
|
+
constructor(fileSystem: IFileSystemService, templateService: ITemplateService);
|
|
279
|
+
parseArchitectConfig(templatePath: string): Promise<ArchitectConfig | null>;
|
|
280
|
+
parseIncludeEntry(includeEntry: string, variables: Record<string, any>): ParsedInclude;
|
|
281
|
+
replaceVariablesInPath(pathStr: string, variables: Record<string, any>): string;
|
|
282
|
+
shouldIncludeFile(conditions: Record<string, string> | undefined, variables: Record<string, any>): boolean;
|
|
283
|
+
validateTemplate(templatePath: string, scaffoldType: string): Promise<TemplateValidationResult>;
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/services/ScaffoldGeneratorService.d.ts
|
|
287
|
+
interface GenerateFeatureScaffoldOptions {
|
|
288
|
+
templateName: string;
|
|
289
|
+
featureName: string;
|
|
290
|
+
description: string;
|
|
291
|
+
instruction?: string;
|
|
292
|
+
variables: Array<{
|
|
293
|
+
name: string;
|
|
294
|
+
description: string;
|
|
295
|
+
type: string;
|
|
296
|
+
required: boolean;
|
|
297
|
+
default?: any;
|
|
298
|
+
}>;
|
|
299
|
+
includes?: string[];
|
|
300
|
+
patterns?: string[];
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Service for generating feature scaffold configurations in scaffold.yaml files
|
|
304
|
+
*/
|
|
305
|
+
declare class ScaffoldGeneratorService {
|
|
306
|
+
private templatesPath;
|
|
307
|
+
constructor(templatesPath: string);
|
|
308
|
+
/**
|
|
309
|
+
* Custom YAML dumper that forces literal block style (|) for description and instruction fields
|
|
310
|
+
*/
|
|
311
|
+
private dumpYamlWithLiteralBlocks;
|
|
312
|
+
/**
|
|
313
|
+
* Process config to ensure description and instruction use literal block style
|
|
314
|
+
*/
|
|
315
|
+
private processConfigForLiteralBlocks;
|
|
316
|
+
/**
|
|
317
|
+
* Ensure string is properly formatted for YAML literal blocks
|
|
318
|
+
*/
|
|
319
|
+
private ensureMultilineFormat;
|
|
320
|
+
/**
|
|
321
|
+
* Generate or update a feature configuration in scaffold.yaml
|
|
322
|
+
*/
|
|
323
|
+
generateFeatureScaffold(options: GenerateFeatureScaffoldOptions): Promise<{
|
|
324
|
+
success: boolean;
|
|
325
|
+
message: string;
|
|
326
|
+
templatePath?: string;
|
|
327
|
+
scaffoldYamlPath?: string;
|
|
328
|
+
}>;
|
|
329
|
+
/**
|
|
330
|
+
* List all templates (directories in templates folder)
|
|
331
|
+
*/
|
|
332
|
+
listTemplates(): Promise<string[]>;
|
|
333
|
+
/**
|
|
334
|
+
* Check if a template exists
|
|
335
|
+
*/
|
|
336
|
+
templateExists(templateName: string): Promise<boolean>;
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/services/ScaffoldingMethodsService.d.ts
|
|
340
|
+
interface ScaffoldMethod {
|
|
341
|
+
name: string;
|
|
342
|
+
description?: string;
|
|
343
|
+
instruction?: string;
|
|
344
|
+
variables_schema: {
|
|
345
|
+
type: string;
|
|
346
|
+
properties: Record<string, any>;
|
|
347
|
+
required: string[];
|
|
348
|
+
additionalProperties: boolean;
|
|
349
|
+
};
|
|
350
|
+
generator?: string;
|
|
351
|
+
}
|
|
352
|
+
interface ListScaffoldingMethodsResult {
|
|
353
|
+
sourceTemplate: string;
|
|
354
|
+
templatePath: string;
|
|
355
|
+
methods: ScaffoldMethod[];
|
|
356
|
+
}
|
|
357
|
+
interface UseScaffoldMethodRequest {
|
|
358
|
+
projectPath: string;
|
|
359
|
+
scaffold_feature_name: string;
|
|
360
|
+
variables: Record<string, any>;
|
|
361
|
+
}
|
|
362
|
+
declare class ScaffoldingMethodsService {
|
|
363
|
+
private fileSystem;
|
|
364
|
+
private templatesRootPath;
|
|
365
|
+
private templateService;
|
|
366
|
+
constructor(fileSystem: IFileSystemService, templatesRootPath: string);
|
|
367
|
+
listScaffoldingMethods(projectPath: string): Promise<ListScaffoldingMethodsResult>;
|
|
368
|
+
/**
|
|
369
|
+
* Gets scaffolding methods with instructions rendered using provided variables
|
|
370
|
+
*/
|
|
371
|
+
listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>): Promise<ListScaffoldingMethodsResult>;
|
|
372
|
+
/**
|
|
373
|
+
* Processes scaffold instruction with template service
|
|
374
|
+
*/
|
|
375
|
+
processScaffoldInstruction(instruction: string, variables: Record<string, any>): string;
|
|
376
|
+
private findTemplatePath;
|
|
377
|
+
/**
|
|
378
|
+
* Dynamically discovers all template directories
|
|
379
|
+
* Supports both flat structure (templates/nextjs-15) and nested structure (templates/apps/nextjs-15)
|
|
380
|
+
**/
|
|
381
|
+
private discoverTemplateDirs;
|
|
382
|
+
useScaffoldMethod(request: UseScaffoldMethodRequest): Promise<ScaffoldResult>;
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/services/ScaffoldProcessingService.d.ts
|
|
386
|
+
/**
|
|
387
|
+
* Shared service for common scaffolding operations like processing templates and tracking files
|
|
388
|
+
*/
|
|
389
|
+
declare class ScaffoldProcessingService {
|
|
390
|
+
private fileSystem;
|
|
391
|
+
private variableReplacer;
|
|
392
|
+
constructor(fileSystem: IFileSystemService, variableReplacer: IVariableReplacementService);
|
|
393
|
+
/**
|
|
394
|
+
* Process a target path for variable replacement, handling both files and directories
|
|
395
|
+
*/
|
|
396
|
+
processTargetForVariableReplacement(targetPath: string, variables: Record<string, any>): Promise<void>;
|
|
397
|
+
/**
|
|
398
|
+
* Track all created files, handling both single files and directories
|
|
399
|
+
*/
|
|
400
|
+
trackCreatedFiles(targetPath: string, createdFiles: string[]): Promise<void>;
|
|
401
|
+
/**
|
|
402
|
+
* Track all existing files, handling both single files and directories
|
|
403
|
+
*/
|
|
404
|
+
trackExistingFiles(targetPath: string, existingFiles: string[]): Promise<void>;
|
|
405
|
+
/**
|
|
406
|
+
* Copy source to target, then process templates and track files
|
|
407
|
+
* Now supports tracking existing files separately from created files
|
|
408
|
+
* Automatically handles .liquid template files by stripping the extension
|
|
409
|
+
*/
|
|
410
|
+
copyAndProcess(sourcePath: string, targetPath: string, variables: Record<string, any>, createdFiles: string[], existingFiles?: string[]): Promise<void>;
|
|
411
|
+
/**
|
|
412
|
+
* Recursively collect all file paths in a directory for created files
|
|
413
|
+
*/
|
|
414
|
+
private trackCreatedFilesRecursive;
|
|
415
|
+
/**
|
|
416
|
+
* Recursively collect all file paths in a directory for existing files
|
|
417
|
+
*/
|
|
418
|
+
private trackExistingFilesRecursive;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/services/ScaffoldService.d.ts
|
|
422
|
+
declare class ScaffoldService implements IScaffoldService {
|
|
423
|
+
private fileSystem;
|
|
424
|
+
private scaffoldConfigLoader;
|
|
425
|
+
private variableReplacer;
|
|
426
|
+
private readonly templatesRootPath;
|
|
427
|
+
private readonly processingService;
|
|
428
|
+
constructor(fileSystem: IFileSystemService, scaffoldConfigLoader: IScaffoldConfigLoader, variableReplacer: IVariableReplacementService, templatesRootPath?: string);
|
|
429
|
+
/**
|
|
430
|
+
* Scaffold a new project from a boilerplate template
|
|
431
|
+
*/
|
|
432
|
+
useBoilerplate(options: BoilerplateOptions): Promise<ScaffoldResult>;
|
|
433
|
+
/**
|
|
434
|
+
* Scaffold a new feature into an existing project
|
|
435
|
+
*/
|
|
436
|
+
useFeature(options: FeatureOptions): Promise<ScaffoldResult>;
|
|
437
|
+
/**
|
|
438
|
+
* Common scaffolding processing logic shared by both useBoilerplate and useFeature
|
|
439
|
+
*/
|
|
440
|
+
private processScaffold;
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/services/TemplateService.d.ts
|
|
444
|
+
interface ITemplateService$1 {
|
|
445
|
+
renderString(template: string, variables: Record<string, any>): string;
|
|
446
|
+
containsTemplateVariables(content: string): boolean;
|
|
447
|
+
}
|
|
448
|
+
declare class TemplateService implements ITemplateService$1 {
|
|
449
|
+
private liquid;
|
|
450
|
+
constructor();
|
|
451
|
+
private toPascalCase;
|
|
452
|
+
private setupCustomFilters;
|
|
453
|
+
renderString(template: string, variables: Record<string, any>): string;
|
|
454
|
+
containsTemplateVariables(content: string): boolean;
|
|
455
|
+
}
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/services/VariableReplacementService.d.ts
|
|
458
|
+
declare class VariableReplacementService implements IVariableReplacementService {
|
|
459
|
+
private fileSystem;
|
|
460
|
+
private templateService;
|
|
461
|
+
private readonly binaryExtensions;
|
|
462
|
+
constructor(fileSystem: IFileSystemService, templateService: ITemplateService);
|
|
463
|
+
processFilesForVariableReplacement(dirPath: string, variables: Record<string, any>): Promise<void>;
|
|
464
|
+
replaceVariablesInFile(filePath: string, variables: Record<string, any>): Promise<void>;
|
|
465
|
+
isBinaryFile(filePath: string): boolean;
|
|
466
|
+
}
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/tools/types.d.ts
|
|
469
|
+
/**
|
|
470
|
+
* Shared type definitions for MCP tools
|
|
471
|
+
*/
|
|
472
|
+
interface ToolDefinition {
|
|
473
|
+
name: string;
|
|
474
|
+
description: string;
|
|
475
|
+
inputSchema: {
|
|
476
|
+
type: string;
|
|
477
|
+
properties: Record<string, any>;
|
|
478
|
+
required?: string[];
|
|
479
|
+
additionalProperties: boolean;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/tools/GenerateBoilerplateFileTool.d.ts
|
|
484
|
+
/**
|
|
485
|
+
* Tool to generate template files for boilerplates and features
|
|
486
|
+
*/
|
|
487
|
+
declare class GenerateBoilerplateFileTool {
|
|
488
|
+
static readonly TOOL_NAME = "generate-boilerplate-file";
|
|
489
|
+
private boilerplateGeneratorService;
|
|
490
|
+
constructor(templatesPath: string);
|
|
491
|
+
/**
|
|
492
|
+
* Get the tool definition for MCP
|
|
493
|
+
*/
|
|
494
|
+
getDefinition(): ToolDefinition;
|
|
495
|
+
/**
|
|
496
|
+
* Execute the tool
|
|
497
|
+
*/
|
|
498
|
+
execute(args: {
|
|
499
|
+
templateName: string;
|
|
500
|
+
filePath: string;
|
|
501
|
+
content?: string;
|
|
502
|
+
sourceFile?: string;
|
|
503
|
+
header?: string;
|
|
504
|
+
}): Promise<CallToolResult>;
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/tools/GenerateBoilerplateTool.d.ts
|
|
508
|
+
/**
|
|
509
|
+
* Tool to generate a new boilerplate configuration in scaffold.yaml
|
|
510
|
+
*/
|
|
511
|
+
declare class GenerateBoilerplateTool {
|
|
512
|
+
static readonly TOOL_NAME = "generate-boilerplate";
|
|
513
|
+
private boilerplateGeneratorService;
|
|
514
|
+
constructor(templatesPath: string);
|
|
515
|
+
/**
|
|
516
|
+
* Get the tool definition for MCP
|
|
517
|
+
*/
|
|
518
|
+
getDefinition(): ToolDefinition;
|
|
519
|
+
/**
|
|
520
|
+
* Execute the tool
|
|
521
|
+
*/
|
|
522
|
+
execute(args: {
|
|
523
|
+
templateName: string;
|
|
524
|
+
boilerplateName: string;
|
|
525
|
+
description: string;
|
|
526
|
+
instruction?: string;
|
|
527
|
+
targetFolder: string;
|
|
528
|
+
variables: Array<{
|
|
529
|
+
name: string;
|
|
530
|
+
description: string;
|
|
531
|
+
type: string;
|
|
532
|
+
required: boolean;
|
|
533
|
+
default?: any;
|
|
534
|
+
}>;
|
|
535
|
+
includes?: string[];
|
|
536
|
+
}): Promise<CallToolResult>;
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/tools/GenerateFeatureScaffoldTool.d.ts
|
|
540
|
+
/**
|
|
541
|
+
* Tool to generate a new feature scaffold configuration in scaffold.yaml
|
|
542
|
+
*/
|
|
543
|
+
declare class GenerateFeatureScaffoldTool {
|
|
544
|
+
static readonly TOOL_NAME = "generate-feature-scaffold";
|
|
545
|
+
private scaffoldGeneratorService;
|
|
546
|
+
constructor(templatesPath: string);
|
|
547
|
+
/**
|
|
548
|
+
* Get the tool definition for MCP
|
|
549
|
+
*/
|
|
550
|
+
getDefinition(): ToolDefinition;
|
|
551
|
+
/**
|
|
552
|
+
* Execute the tool
|
|
553
|
+
*/
|
|
554
|
+
execute(args: {
|
|
555
|
+
templateName: string;
|
|
556
|
+
featureName: string;
|
|
557
|
+
description: string;
|
|
558
|
+
instruction?: string;
|
|
559
|
+
variables: Array<{
|
|
560
|
+
name: string;
|
|
561
|
+
description: string;
|
|
562
|
+
type: string;
|
|
563
|
+
required: boolean;
|
|
564
|
+
default?: any;
|
|
565
|
+
}>;
|
|
566
|
+
includes?: string[];
|
|
567
|
+
patterns?: string[];
|
|
568
|
+
}): Promise<CallToolResult>;
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/tools/ListBoilerplatesTool.d.ts
|
|
572
|
+
declare class ListBoilerplatesTool {
|
|
573
|
+
static readonly TOOL_NAME = "list-boilerplates";
|
|
574
|
+
private boilerplateService;
|
|
575
|
+
constructor(templatesPath: string);
|
|
576
|
+
/**
|
|
577
|
+
* Get the tool definition for MCP
|
|
578
|
+
*/
|
|
579
|
+
getDefinition(): ToolDefinition;
|
|
580
|
+
/**
|
|
581
|
+
* Execute the tool
|
|
582
|
+
*/
|
|
583
|
+
execute(_args?: Record<string, any>): Promise<CallToolResult>;
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/tools/ListScaffoldingMethodsTool.d.ts
|
|
587
|
+
declare class ListScaffoldingMethodsTool {
|
|
588
|
+
static readonly TOOL_NAME = "list-scaffolding-methods";
|
|
589
|
+
private fileSystemService;
|
|
590
|
+
private scaffoldingMethodsService;
|
|
591
|
+
constructor(templatesPath: string);
|
|
592
|
+
/**
|
|
593
|
+
* Get the tool definition for MCP
|
|
594
|
+
*/
|
|
595
|
+
getDefinition(): ToolDefinition;
|
|
596
|
+
/**
|
|
597
|
+
* Execute the tool
|
|
598
|
+
*/
|
|
599
|
+
execute(args: Record<string, any>): Promise<CallToolResult>;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/tools/UseBoilerplateTool.d.ts
|
|
603
|
+
declare class UseBoilerplateTool {
|
|
604
|
+
static readonly TOOL_NAME = "use-boilerplate";
|
|
605
|
+
private boilerplateService;
|
|
606
|
+
constructor(templatesPath: string);
|
|
607
|
+
/**
|
|
608
|
+
* Get the tool definition for MCP
|
|
609
|
+
*/
|
|
610
|
+
getDefinition(): ToolDefinition;
|
|
611
|
+
/**
|
|
612
|
+
* Execute the tool
|
|
613
|
+
*/
|
|
614
|
+
execute(args: Record<string, any>): Promise<CallToolResult>;
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/tools/UseScaffoldMethodTool.d.ts
|
|
618
|
+
declare class UseScaffoldMethodTool {
|
|
619
|
+
static readonly TOOL_NAME = "use-scaffold-method";
|
|
620
|
+
private fileSystemService;
|
|
621
|
+
private scaffoldingMethodsService;
|
|
622
|
+
constructor(templatesPath: string);
|
|
623
|
+
/**
|
|
624
|
+
* Get the tool definition for MCP
|
|
625
|
+
*/
|
|
626
|
+
getDefinition(): ToolDefinition;
|
|
627
|
+
/**
|
|
628
|
+
* Execute the tool
|
|
629
|
+
*/
|
|
630
|
+
execute(args: Record<string, any>): Promise<CallToolResult>;
|
|
631
|
+
}
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/tools/WriteToFileTool.d.ts
|
|
634
|
+
declare class WriteToFileTool {
|
|
635
|
+
static readonly TOOL_NAME = "write-to-file";
|
|
636
|
+
private fileSystemService;
|
|
637
|
+
constructor();
|
|
638
|
+
/**
|
|
639
|
+
* Get the tool definition for MCP
|
|
640
|
+
*/
|
|
641
|
+
getDefinition(): ToolDefinition;
|
|
642
|
+
/**
|
|
643
|
+
* Execute the tool
|
|
644
|
+
*/
|
|
645
|
+
execute(args: Record<string, any>): Promise<CallToolResult>;
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region src/transports/types.d.ts
|
|
649
|
+
/**
|
|
650
|
+
* Transport mode types
|
|
651
|
+
*/
|
|
652
|
+
declare enum TransportMode {
|
|
653
|
+
STDIO = "stdio",
|
|
654
|
+
HTTP = "http",
|
|
655
|
+
SSE = "sse",
|
|
656
|
+
CLI = "cli",
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Transport configuration options
|
|
660
|
+
*/
|
|
661
|
+
interface TransportConfig {
|
|
662
|
+
mode: TransportMode;
|
|
663
|
+
port?: number;
|
|
664
|
+
host?: string;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Base interface for all transport handlers
|
|
668
|
+
*/
|
|
669
|
+
interface TransportHandler {
|
|
670
|
+
start(): Promise<void>;
|
|
671
|
+
stop(): Promise<void>;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* HTTP transport specific types
|
|
675
|
+
*/
|
|
676
|
+
interface HttpTransportHandler$1 extends TransportHandler {
|
|
677
|
+
getPort(): number;
|
|
678
|
+
getHost(): string;
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region src/transports/http.d.ts
|
|
682
|
+
/**
|
|
683
|
+
* HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
|
|
684
|
+
* Provides stateful session management with resumability support
|
|
685
|
+
*/
|
|
686
|
+
declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
687
|
+
private serverFactory;
|
|
688
|
+
private app;
|
|
689
|
+
private server;
|
|
690
|
+
private sessionManager;
|
|
691
|
+
private config;
|
|
692
|
+
constructor(serverFactory: Server | (() => Server), config: TransportConfig);
|
|
693
|
+
private setupMiddleware;
|
|
694
|
+
private setupRoutes;
|
|
695
|
+
private handlePostRequest;
|
|
696
|
+
private handleGetRequest;
|
|
697
|
+
private handleDeleteRequest;
|
|
698
|
+
start(): Promise<void>;
|
|
699
|
+
stop(): Promise<void>;
|
|
700
|
+
getPort(): number;
|
|
701
|
+
getHost(): string;
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/transports/sse.d.ts
|
|
705
|
+
/**
|
|
706
|
+
* SSE (Server-Sent Events) transport handler
|
|
707
|
+
* Legacy transport for backwards compatibility (protocol version 2024-11-05)
|
|
708
|
+
* Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
|
|
709
|
+
*/
|
|
710
|
+
declare class SseTransportHandler implements HttpTransportHandler$1 {
|
|
711
|
+
private serverFactory;
|
|
712
|
+
private app;
|
|
713
|
+
private server;
|
|
714
|
+
private sessionManager;
|
|
715
|
+
private config;
|
|
716
|
+
constructor(serverFactory: Server | (() => Server), config: TransportConfig);
|
|
717
|
+
private setupMiddleware;
|
|
718
|
+
private setupRoutes;
|
|
719
|
+
private handleSseConnection;
|
|
720
|
+
private handlePostMessage;
|
|
721
|
+
start(): Promise<void>;
|
|
722
|
+
stop(): Promise<void>;
|
|
723
|
+
getPort(): number;
|
|
724
|
+
getHost(): string;
|
|
725
|
+
}
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region src/transports/stdio.d.ts
|
|
728
|
+
/**
|
|
729
|
+
* Stdio transport handler for MCP server
|
|
730
|
+
* Used for command-line and direct integrations
|
|
731
|
+
*/
|
|
732
|
+
declare class StdioTransportHandler implements TransportHandler {
|
|
733
|
+
private server;
|
|
734
|
+
private transport;
|
|
735
|
+
constructor(server: Server);
|
|
736
|
+
start(): Promise<void>;
|
|
737
|
+
stop(): Promise<void>;
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/types/tools.d.ts
|
|
741
|
+
declare const scaffoldArgsSchema: z.ZodObject<{
|
|
742
|
+
appName: z.ZodString;
|
|
743
|
+
}, "strip", z.ZodTypeAny, {
|
|
744
|
+
appName: string;
|
|
745
|
+
}, {
|
|
746
|
+
appName: string;
|
|
747
|
+
}>;
|
|
748
|
+
type ScaffoldArgs = z.infer<typeof scaffoldArgsSchema>;
|
|
749
|
+
interface Tool {
|
|
750
|
+
name: string;
|
|
751
|
+
description: string;
|
|
752
|
+
inputSchema: {
|
|
753
|
+
type: 'object';
|
|
754
|
+
properties: Record<string, any>;
|
|
755
|
+
required: string[];
|
|
756
|
+
};
|
|
757
|
+
execute: (args: unknown) => Promise<string>;
|
|
758
|
+
}
|
|
759
|
+
//#endregion
|
|
760
|
+
//#region src/utils/git.d.ts
|
|
761
|
+
/**
|
|
762
|
+
* Find the workspace root by searching upwards for .git folder
|
|
763
|
+
* Returns null if no .git folder is found (indicating a new project setup is needed)
|
|
764
|
+
*/
|
|
765
|
+
declare function findWorkspaceRoot(startPath?: string): Promise<string | null>;
|
|
766
|
+
/**
|
|
767
|
+
* Parse GitHub URL to detect if it's a subdirectory
|
|
768
|
+
* Supports formats:
|
|
769
|
+
* - https://github.com/user/repo
|
|
770
|
+
* - https://github.com/user/repo/tree/branch/path/to/dir
|
|
771
|
+
* - https://github.com/user/repo/tree/main/path/to/dir
|
|
772
|
+
*/
|
|
773
|
+
declare function parseGitHubUrl(url: string): {
|
|
774
|
+
owner?: string;
|
|
775
|
+
repo?: string;
|
|
776
|
+
repoUrl: string;
|
|
777
|
+
branch?: string;
|
|
778
|
+
subdirectory?: string;
|
|
779
|
+
isSubdirectory: boolean;
|
|
780
|
+
};
|
|
781
|
+
/**
|
|
782
|
+
* Clone a subdirectory from a git repository using sparse checkout
|
|
783
|
+
*/
|
|
784
|
+
declare function cloneSubdirectory(repoUrl: string, branch: string, subdirectory: string, targetFolder: string): Promise<void>;
|
|
785
|
+
/**
|
|
786
|
+
* Clone entire repository
|
|
787
|
+
*/
|
|
788
|
+
declare function cloneRepository(repoUrl: string, targetFolder: string): Promise<void>;
|
|
789
|
+
/**
|
|
790
|
+
* Fetch directory listing from GitHub API
|
|
791
|
+
*/
|
|
792
|
+
declare function fetchGitHubDirectoryContents(owner: string, repo: string, path: string, branch?: string): Promise<Array<{
|
|
793
|
+
name: string;
|
|
794
|
+
type: string;
|
|
795
|
+
path: string;
|
|
796
|
+
}>>;
|
|
797
|
+
//#endregion
|
|
798
|
+
export { ArchitectConfig, BoilerplateConfig, BoilerplateGeneratorService, BoilerplateInfo, BoilerplateOptions, BoilerplateService, FeatureConfig, FeatureOptions, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, GeneratorContext, GeneratorFunction, HttpTransportHandler, IFileSystemService, INunjucksService, IScaffoldConfigLoader, IScaffoldService, ITemplateParserService, ITemplateService, IVariableReplacementService, ListBoilerplateResponse, ListBoilerplatesTool, ListScaffoldingMethodsTool, ParsedInclude, ScaffoldArgs, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, Tool, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, cloneRepository, cloneSubdirectory, fetchGitHubDirectoryContents, findWorkspaceRoot, parseGitHubUrl, scaffoldArgsSchema };
|