@agiflowai/scaffold-mcp 1.0.21 → 1.0.23

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/index.d.mts CHANGED
@@ -1,9 +1,306 @@
1
- import { JsonSchema } from "@composio/json-schema-to-zod";
2
- import { z } from "zod";
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
2
  import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ import { z } from "zod";
4
+ import { JsonSchema } from "@composio/json-schema-to-zod";
4
5
  import "express";
5
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
6
 
7
+ //#region src/server/index.d.ts
8
+ interface ServerOptions {
9
+ adminEnabled?: boolean;
10
+ isMonolith?: boolean;
11
+ promptAsSkill?: boolean;
12
+ fallbackTool?: string;
13
+ fallbackToolConfig?: Record<string, unknown>;
14
+ }
15
+ declare function createServer(options?: ServerOptions): Server;
16
+ //#endregion
17
+ //#region src/transports/types.d.ts
18
+ /**
19
+ * Transport mode types
20
+ */
21
+ declare enum TransportMode {
22
+ STDIO = "stdio",
23
+ HTTP = "http",
24
+ SSE = "sse",
25
+ CLI = "cli",
26
+ }
27
+ /**
28
+ * Transport configuration options
29
+ */
30
+ interface TransportConfig {
31
+ mode: TransportMode;
32
+ port?: number;
33
+ host?: string;
34
+ }
35
+ /**
36
+ * Base interface for all transport handlers
37
+ */
38
+ interface TransportHandler {
39
+ start(): Promise<void>;
40
+ stop(): Promise<void>;
41
+ }
42
+ /**
43
+ * HTTP transport specific types
44
+ */
45
+ interface HttpTransportHandler$1 extends TransportHandler {
46
+ getPort(): number;
47
+ getHost(): string;
48
+ }
49
+ //#endregion
50
+ //#region src/transports/stdio.d.ts
51
+ /**
52
+ * Stdio transport handler for MCP server
53
+ * Used for command-line and direct integrations
54
+ */
55
+ declare class StdioTransportHandler implements TransportHandler {
56
+ private server;
57
+ private transport;
58
+ constructor(server: Server);
59
+ start(): Promise<void>;
60
+ stop(): Promise<void>;
61
+ }
62
+ //#endregion
63
+ //#region src/transports/sse.d.ts
64
+ /**
65
+ * SSE (Server-Sent Events) transport handler
66
+ * Legacy transport for backwards compatibility (protocol version 2024-11-05)
67
+ * Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
68
+ */
69
+ declare class SseTransportHandler implements HttpTransportHandler$1 {
70
+ private serverFactory;
71
+ private app;
72
+ private server;
73
+ private sessionManager;
74
+ private config;
75
+ constructor(serverFactory: Server | (() => Server), config: TransportConfig);
76
+ private setupMiddleware;
77
+ private setupRoutes;
78
+ private handleSseConnection;
79
+ private handlePostMessage;
80
+ start(): Promise<void>;
81
+ stop(): Promise<void>;
82
+ getPort(): number;
83
+ getHost(): string;
84
+ }
85
+ //#endregion
86
+ //#region src/transports/http.d.ts
87
+ /**
88
+ * HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
89
+ * Provides stateful session management with resumability support
90
+ */
91
+ declare class HttpTransportHandler implements HttpTransportHandler$1 {
92
+ private serverFactory;
93
+ private app;
94
+ private server;
95
+ private sessionManager;
96
+ private config;
97
+ constructor(serverFactory: Server | (() => Server), config: TransportConfig);
98
+ private setupMiddleware;
99
+ private setupRoutes;
100
+ private handlePostRequest;
101
+ private handleGetRequest;
102
+ private handleDeleteRequest;
103
+ start(): Promise<void>;
104
+ stop(): Promise<void>;
105
+ getPort(): number;
106
+ getHost(): string;
107
+ }
108
+ //#endregion
109
+ //#region src/tools/types.d.ts
110
+ /**
111
+ * Shared type definitions for MCP tools
112
+ */
113
+ interface ToolDefinition {
114
+ name: string;
115
+ description: string;
116
+ inputSchema: {
117
+ type: string;
118
+ properties: Record<string, any>;
119
+ required?: string[];
120
+ additionalProperties: boolean;
121
+ };
122
+ }
123
+ //#endregion
124
+ //#region src/tools/GenerateBoilerplateFileTool.d.ts
125
+ /**
126
+ * Tool to generate template files for boilerplates and features
127
+ */
128
+ declare class GenerateBoilerplateFileTool {
129
+ static readonly TOOL_NAME = "generate-boilerplate-file";
130
+ private boilerplateGeneratorService;
131
+ private isMonolith;
132
+ constructor(templatesPath: string, isMonolith?: boolean);
133
+ /**
134
+ * Get the tool definition for MCP
135
+ */
136
+ getDefinition(): ToolDefinition;
137
+ /**
138
+ * Execute the tool
139
+ */
140
+ execute(args: {
141
+ templateName?: string;
142
+ filePath: string;
143
+ content?: string;
144
+ sourceFile?: string;
145
+ header?: string;
146
+ }): Promise<CallToolResult>;
147
+ }
148
+ //#endregion
149
+ //#region src/tools/GenerateBoilerplateTool.d.ts
150
+ /**
151
+ * Tool to generate a new boilerplate configuration in scaffold.yaml
152
+ */
153
+ declare class GenerateBoilerplateTool {
154
+ static readonly TOOL_NAME = "generate-boilerplate";
155
+ private boilerplateGeneratorService;
156
+ private isMonolith;
157
+ constructor(templatesPath: string, isMonolith?: boolean);
158
+ /**
159
+ * Get the tool definition for MCP
160
+ */
161
+ getDefinition(): ToolDefinition;
162
+ /**
163
+ * Execute the tool
164
+ */
165
+ execute(args: {
166
+ templateName?: string;
167
+ boilerplateName: string;
168
+ description: string;
169
+ instruction?: string;
170
+ targetFolder?: string;
171
+ variables: Array<{
172
+ name: string;
173
+ description: string;
174
+ type: string;
175
+ required: boolean;
176
+ default?: any;
177
+ }>;
178
+ includes?: string[];
179
+ }): Promise<CallToolResult>;
180
+ }
181
+ //#endregion
182
+ //#region src/tools/GenerateFeatureScaffoldTool.d.ts
183
+ /**
184
+ * Tool to generate a new feature scaffold configuration in scaffold.yaml
185
+ */
186
+ declare class GenerateFeatureScaffoldTool {
187
+ static readonly TOOL_NAME = "generate-feature-scaffold";
188
+ private scaffoldGeneratorService;
189
+ private isMonolith;
190
+ constructor(templatesPath: string, isMonolith?: boolean);
191
+ /**
192
+ * Get the tool definition for MCP
193
+ */
194
+ getDefinition(): ToolDefinition;
195
+ /**
196
+ * Execute the tool
197
+ */
198
+ execute(args: {
199
+ templateName?: string;
200
+ featureName: string;
201
+ description: string;
202
+ instruction?: string;
203
+ variables: Array<{
204
+ name: string;
205
+ description: string;
206
+ type: string;
207
+ required: boolean;
208
+ default?: any;
209
+ }>;
210
+ includes?: string[];
211
+ patterns?: string[];
212
+ }): Promise<CallToolResult>;
213
+ }
214
+ //#endregion
215
+ //#region src/tools/ListBoilerplatesTool.d.ts
216
+ declare class ListBoilerplatesTool {
217
+ static readonly TOOL_NAME = "list-boilerplates";
218
+ private boilerplateService;
219
+ private templateService;
220
+ private isMonolith;
221
+ constructor(templatesPath: string, isMonolith?: boolean);
222
+ /**
223
+ * Get the tool definition for MCP
224
+ */
225
+ getDefinition(): ToolDefinition;
226
+ /**
227
+ * Execute the tool
228
+ */
229
+ execute(args?: Record<string, any>): Promise<CallToolResult>;
230
+ }
231
+ //#endregion
232
+ //#region src/tools/ListScaffoldingMethodsTool.d.ts
233
+ declare class ListScaffoldingMethodsTool {
234
+ static readonly TOOL_NAME = "list-scaffolding-methods";
235
+ private fileSystemService;
236
+ private scaffoldingMethodsService;
237
+ private templateService;
238
+ private isMonolith;
239
+ constructor(templatesPath: string, isMonolith?: boolean);
240
+ /**
241
+ * Get the tool definition for MCP
242
+ */
243
+ getDefinition(): ToolDefinition;
244
+ /**
245
+ * Execute the tool
246
+ */
247
+ execute(args: Record<string, any>): Promise<CallToolResult>;
248
+ }
249
+ //#endregion
250
+ //#region src/tools/UseBoilerplateTool.d.ts
251
+ declare class UseBoilerplateTool {
252
+ static readonly TOOL_NAME = "use-boilerplate";
253
+ private boilerplateService;
254
+ private templateService;
255
+ private isMonolith;
256
+ constructor(templatesPath: string, isMonolith?: boolean);
257
+ /**
258
+ * Get the tool definition for MCP
259
+ */
260
+ getDefinition(): ToolDefinition;
261
+ /**
262
+ * Execute the tool
263
+ */
264
+ execute(args: Record<string, any>): Promise<CallToolResult>;
265
+ }
266
+ //#endregion
267
+ //#region src/tools/UseScaffoldMethodTool.d.ts
268
+ declare class UseScaffoldMethodTool {
269
+ static readonly TOOL_NAME = "use-scaffold-method";
270
+ private static readonly TEMP_LOG_DIR;
271
+ private fileSystemService;
272
+ private scaffoldingMethodsService;
273
+ private isMonolith;
274
+ constructor(templatesPath: string, isMonolith?: boolean);
275
+ /**
276
+ * Write scaffold execution info to temp log file for hook processing
277
+ */
278
+ private writePendingScaffoldLog;
279
+ /**
280
+ * Get the tool definition for MCP
281
+ */
282
+ getDefinition(): ToolDefinition;
283
+ /**
284
+ * Execute the tool
285
+ */
286
+ execute(args: Record<string, any>): Promise<CallToolResult>;
287
+ }
288
+ //#endregion
289
+ //#region src/tools/WriteToFileTool.d.ts
290
+ declare class WriteToFileTool {
291
+ static readonly TOOL_NAME = "write-to-file";
292
+ private fileSystemService;
293
+ constructor();
294
+ /**
295
+ * Get the tool definition for MCP
296
+ */
297
+ getDefinition(): ToolDefinition;
298
+ /**
299
+ * Execute the tool
300
+ */
301
+ execute(args: Record<string, any>): Promise<CallToolResult>;
302
+ }
303
+ //#endregion
7
304
  //#region src/services/BoilerplateGeneratorService.d.ts
8
305
  interface GenerateBoilerplateOptions {
9
306
  templateName: string;
@@ -494,434 +791,147 @@ interface ScaffoldMethod {
494
791
  generator?: string;
495
792
  }
496
793
  interface ListScaffoldingMethodsResult {
497
- sourceTemplate: string;
498
- templatePath: string;
499
- methods: ScaffoldMethod[];
500
- nextCursor?: string;
501
- _meta?: {
502
- total: number;
503
- offset: number;
504
- limit: number;
505
- };
506
- }
507
- interface UseScaffoldMethodRequest {
508
- projectPath: string;
509
- scaffold_feature_name: string;
510
- variables: Record<string, any>;
511
- /** Optional session ID for logging scaffold execution */
512
- sessionId?: string;
513
- /** Optional scaffold-generated marker tag to inject into generated code files (default: @scaffold-generated) */
514
- marker?: string;
515
- }
516
- declare class ScaffoldingMethodsService {
517
- private fileSystem;
518
- private templatesRootPath;
519
- private templateService;
520
- constructor(fileSystem: IFileSystemService, templatesRootPath: string);
521
- listScaffoldingMethods(projectPath: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
522
- /**
523
- * Collects all scaffold methods for a template (no pagination)
524
- * Used internally for lookups that need to search all methods
525
- */
526
- private collectAllMethodsByTemplate;
527
- listScaffoldingMethodsByTemplate(templateName: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
528
- /**
529
- * Gets scaffolding methods with instructions rendered using provided variables
530
- */
531
- listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>, cursor?: string): Promise<ListScaffoldingMethodsResult>;
532
- /**
533
- * Processes scaffold instruction with template service
534
- */
535
- processScaffoldInstruction(instruction: string, variables: Record<string, any>): string;
536
- private findTemplatePath;
537
- /**
538
- * Resolves the project path, handling both monorepo and monolith cases
539
- * Uses ProjectConfigResolver to find the correct workspace/project root
540
- */
541
- private resolveProjectPath;
542
- /**
543
- * Dynamically discovers all template directories
544
- * Supports both flat structure (templates/nextjs-15) and nested structure (templates/apps/nextjs-15)
545
- **/
546
- private discoverTemplateDirs;
547
- useScaffoldMethod(request: UseScaffoldMethodRequest): Promise<ScaffoldResult>;
548
- }
549
- //#endregion
550
- //#region src/services/ScaffoldProcessingService.d.ts
551
- /**
552
- * Shared service for common scaffolding operations like processing templates and tracking files
553
- */
554
- declare class ScaffoldProcessingService {
555
- private fileSystem;
556
- private variableReplacer;
557
- constructor(fileSystem: IFileSystemService, variableReplacer: IVariableReplacementService);
558
- /**
559
- * Process a target path for variable replacement, handling both files and directories
560
- */
561
- processTargetForVariableReplacement(targetPath: string, variables: Record<string, any>): Promise<void>;
562
- /**
563
- * Track all created files, handling both single files and directories
564
- */
565
- trackCreatedFiles(targetPath: string, createdFiles: string[]): Promise<void>;
566
- /**
567
- * Track all existing files, handling both single files and directories
568
- */
569
- trackExistingFiles(targetPath: string, existingFiles: string[]): Promise<void>;
570
- /**
571
- * Copy source to target, then process templates and track files
572
- * Now supports tracking existing files separately from created files
573
- * Automatically handles .liquid template files by stripping the extension
574
- */
575
- copyAndProcess(sourcePath: string, targetPath: string, variables: Record<string, any>, createdFiles: string[], existingFiles?: string[]): Promise<void>;
576
- /**
577
- * Recursively collect all file paths in a directory for created files
578
- */
579
- private trackCreatedFilesRecursive;
580
- /**
581
- * Recursively collect all file paths in a directory for existing files
582
- */
583
- private trackExistingFilesRecursive;
584
- }
585
- //#endregion
586
- //#region src/services/ScaffoldService.d.ts
587
- declare class ScaffoldService implements IScaffoldService {
588
- private fileSystem;
589
- private scaffoldConfigLoader;
590
- private variableReplacer;
591
- static readonly DEFAULT_MARKER = "@scaffold-generated";
592
- private readonly templatesRootPath;
593
- private readonly processingService;
594
- constructor(fileSystem: IFileSystemService, scaffoldConfigLoader: IScaffoldConfigLoader, variableReplacer: IVariableReplacementService, templatesRootPath?: string);
595
- /**
596
- * Scaffold a new project from a boilerplate template
597
- */
598
- useBoilerplate(options: BoilerplateOptions): Promise<ScaffoldResult>;
599
- /**
600
- * Scaffold a new feature into an existing project
601
- */
602
- useFeature(options: FeatureOptions): Promise<ScaffoldResult>;
603
- /**
604
- * Inject scaffold marker comment into generated code files.
605
- * Prepends `// <marker>` to .ts/.tsx/.js/.jsx files that don't already have it.
606
- * Fails silently — marker injection should never break scaffold output.
607
- */
608
- private injectScaffoldMarkers;
609
- /**
610
- * Common scaffolding processing logic shared by both useBoilerplate and useFeature
611
- */
612
- private processScaffold;
613
- }
614
- //#endregion
615
- //#region src/services/TemplateService.d.ts
616
- interface ITemplateService$1 {
617
- renderString(template: string, variables: Record<string, any>): string;
618
- containsTemplateVariables(content: string): boolean;
619
- }
620
- declare class TemplateService implements ITemplateService$1 {
621
- private liquid;
622
- constructor();
623
- private toPascalCase;
624
- private setupCustomFilters;
625
- renderString(template: string, variables: Record<string, any>): string;
626
- containsTemplateVariables(content: string): boolean;
627
- }
628
- //#endregion
629
- //#region src/services/VariableReplacementService.d.ts
630
- declare class VariableReplacementService implements IVariableReplacementService {
631
- private fileSystem;
632
- private templateService;
633
- private readonly binaryExtensions;
634
- constructor(fileSystem: IFileSystemService, templateService: ITemplateService);
635
- processFilesForVariableReplacement(dirPath: string, variables: Record<string, any>): Promise<void>;
636
- replaceVariablesInFile(filePath: string, variables: Record<string, any>): Promise<void>;
637
- isBinaryFile(filePath: string): boolean;
638
- }
639
- //#endregion
640
- //#region src/tools/types.d.ts
641
- /**
642
- * Shared type definitions for MCP tools
643
- */
644
- interface ToolDefinition {
645
- name: string;
646
- description: string;
647
- inputSchema: {
648
- type: string;
649
- properties: Record<string, any>;
650
- required?: string[];
651
- additionalProperties: boolean;
652
- };
653
- }
654
- //#endregion
655
- //#region src/tools/GenerateBoilerplateFileTool.d.ts
656
- /**
657
- * Tool to generate template files for boilerplates and features
658
- */
659
- declare class GenerateBoilerplateFileTool {
660
- static readonly TOOL_NAME = "generate-boilerplate-file";
661
- private boilerplateGeneratorService;
662
- private isMonolith;
663
- constructor(templatesPath: string, isMonolith?: boolean);
664
- /**
665
- * Get the tool definition for MCP
666
- */
667
- getDefinition(): ToolDefinition;
668
- /**
669
- * Execute the tool
670
- */
671
- execute(args: {
672
- templateName?: string;
673
- filePath: string;
674
- content?: string;
675
- sourceFile?: string;
676
- header?: string;
677
- }): Promise<CallToolResult>;
678
- }
679
- //#endregion
680
- //#region src/tools/GenerateBoilerplateTool.d.ts
681
- /**
682
- * Tool to generate a new boilerplate configuration in scaffold.yaml
683
- */
684
- declare class GenerateBoilerplateTool {
685
- static readonly TOOL_NAME = "generate-boilerplate";
686
- private boilerplateGeneratorService;
687
- private isMonolith;
688
- constructor(templatesPath: string, isMonolith?: boolean);
689
- /**
690
- * Get the tool definition for MCP
691
- */
692
- getDefinition(): ToolDefinition;
693
- /**
694
- * Execute the tool
695
- */
696
- execute(args: {
697
- templateName?: string;
698
- boilerplateName: string;
699
- description: string;
700
- instruction?: string;
701
- targetFolder?: string;
702
- variables: Array<{
703
- name: string;
704
- description: string;
705
- type: string;
706
- required: boolean;
707
- default?: any;
708
- }>;
709
- includes?: string[];
710
- }): Promise<CallToolResult>;
711
- }
712
- //#endregion
713
- //#region src/tools/GenerateFeatureScaffoldTool.d.ts
714
- /**
715
- * Tool to generate a new feature scaffold configuration in scaffold.yaml
716
- */
717
- declare class GenerateFeatureScaffoldTool {
718
- static readonly TOOL_NAME = "generate-feature-scaffold";
719
- private scaffoldGeneratorService;
720
- private isMonolith;
721
- constructor(templatesPath: string, isMonolith?: boolean);
722
- /**
723
- * Get the tool definition for MCP
724
- */
725
- getDefinition(): ToolDefinition;
726
- /**
727
- * Execute the tool
728
- */
729
- execute(args: {
730
- templateName?: string;
731
- featureName: string;
732
- description: string;
733
- instruction?: string;
734
- variables: Array<{
735
- name: string;
736
- description: string;
737
- type: string;
738
- required: boolean;
739
- default?: any;
740
- }>;
741
- includes?: string[];
742
- patterns?: string[];
743
- }): Promise<CallToolResult>;
794
+ sourceTemplate: string;
795
+ templatePath: string;
796
+ methods: ScaffoldMethod[];
797
+ nextCursor?: string;
798
+ _meta?: {
799
+ total: number;
800
+ offset: number;
801
+ limit: number;
802
+ };
744
803
  }
745
- //#endregion
746
- //#region src/tools/ListBoilerplatesTool.d.ts
747
- declare class ListBoilerplatesTool {
748
- static readonly TOOL_NAME = "list-boilerplates";
749
- private boilerplateService;
804
+ interface UseScaffoldMethodRequest {
805
+ projectPath: string;
806
+ scaffold_feature_name: string;
807
+ variables: Record<string, any>;
808
+ /** Optional session ID for logging scaffold execution */
809
+ sessionId?: string;
810
+ /** Optional scaffold-generated marker tag to inject into generated code files (default: @scaffold-generated) */
811
+ marker?: string;
812
+ }
813
+ declare class ScaffoldingMethodsService {
814
+ private fileSystem;
815
+ private templatesRootPath;
750
816
  private templateService;
751
- private isMonolith;
752
- constructor(templatesPath: string, isMonolith?: boolean);
817
+ constructor(fileSystem: IFileSystemService, templatesRootPath: string);
818
+ listScaffoldingMethods(projectPath: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
753
819
  /**
754
- * Get the tool definition for MCP
820
+ * Collects all scaffold methods for a template (no pagination)
821
+ * Used internally for lookups that need to search all methods
755
822
  */
756
- getDefinition(): ToolDefinition;
823
+ private collectAllMethodsByTemplate;
824
+ listScaffoldingMethodsByTemplate(templateName: string, cursor?: string): Promise<ListScaffoldingMethodsResult>;
757
825
  /**
758
- * Execute the tool
826
+ * Gets scaffolding methods with instructions rendered using provided variables
759
827
  */
760
- execute(args?: Record<string, any>): Promise<CallToolResult>;
761
- }
762
- //#endregion
763
- //#region src/tools/ListScaffoldingMethodsTool.d.ts
764
- declare class ListScaffoldingMethodsTool {
765
- static readonly TOOL_NAME = "list-scaffolding-methods";
766
- private fileSystemService;
767
- private scaffoldingMethodsService;
768
- private templateService;
769
- private isMonolith;
770
- constructor(templatesPath: string, isMonolith?: boolean);
828
+ listScaffoldingMethodsWithVariables(projectPath: string, variables: Record<string, any>, cursor?: string): Promise<ListScaffoldingMethodsResult>;
771
829
  /**
772
- * Get the tool definition for MCP
830
+ * Processes scaffold instruction with template service
773
831
  */
774
- getDefinition(): ToolDefinition;
832
+ processScaffoldInstruction(instruction: string, variables: Record<string, any>): string;
833
+ private findTemplatePath;
775
834
  /**
776
- * Execute the tool
835
+ * Resolves the project path, handling both monorepo and monolith cases
836
+ * Uses ProjectConfigResolver to find the correct workspace/project root
777
837
  */
778
- execute(args: Record<string, any>): Promise<CallToolResult>;
838
+ private resolveProjectPath;
839
+ /**
840
+ * Dynamically discovers all template directories
841
+ * Supports both flat structure (templates/nextjs-15) and nested structure (templates/apps/nextjs-15)
842
+ **/
843
+ private discoverTemplateDirs;
844
+ useScaffoldMethod(request: UseScaffoldMethodRequest): Promise<ScaffoldResult>;
779
845
  }
780
846
  //#endregion
781
- //#region src/tools/UseBoilerplateTool.d.ts
782
- declare class UseBoilerplateTool {
783
- static readonly TOOL_NAME = "use-boilerplate";
784
- private boilerplateService;
785
- private templateService;
786
- private isMonolith;
787
- constructor(templatesPath: string, isMonolith?: boolean);
847
+ //#region src/services/ScaffoldProcessingService.d.ts
848
+ /**
849
+ * Shared service for common scaffolding operations like processing templates and tracking files
850
+ */
851
+ declare class ScaffoldProcessingService {
852
+ private fileSystem;
853
+ private variableReplacer;
854
+ constructor(fileSystem: IFileSystemService, variableReplacer: IVariableReplacementService);
788
855
  /**
789
- * Get the tool definition for MCP
856
+ * Process a target path for variable replacement, handling both files and directories
790
857
  */
791
- getDefinition(): ToolDefinition;
858
+ processTargetForVariableReplacement(targetPath: string, variables: Record<string, any>): Promise<void>;
792
859
  /**
793
- * Execute the tool
860
+ * Track all created files, handling both single files and directories
794
861
  */
795
- execute(args: Record<string, any>): Promise<CallToolResult>;
796
- }
797
- //#endregion
798
- //#region src/tools/UseScaffoldMethodTool.d.ts
799
- declare class UseScaffoldMethodTool {
800
- static readonly TOOL_NAME = "use-scaffold-method";
801
- private static readonly TEMP_LOG_DIR;
802
- private fileSystemService;
803
- private scaffoldingMethodsService;
804
- private isMonolith;
805
- constructor(templatesPath: string, isMonolith?: boolean);
862
+ trackCreatedFiles(targetPath: string, createdFiles: string[]): Promise<void>;
806
863
  /**
807
- * Write scaffold execution info to temp log file for hook processing
864
+ * Track all existing files, handling both single files and directories
808
865
  */
809
- private writePendingScaffoldLog;
866
+ trackExistingFiles(targetPath: string, existingFiles: string[]): Promise<void>;
810
867
  /**
811
- * Get the tool definition for MCP
868
+ * Copy source to target, then process templates and track files
869
+ * Now supports tracking existing files separately from created files
870
+ * Automatically handles .liquid template files by stripping the extension
812
871
  */
813
- getDefinition(): ToolDefinition;
872
+ copyAndProcess(sourcePath: string, targetPath: string, variables: Record<string, any>, createdFiles: string[], existingFiles?: string[]): Promise<void>;
814
873
  /**
815
- * Execute the tool
874
+ * Recursively collect all file paths in a directory for created files
816
875
  */
817
- execute(args: Record<string, any>): Promise<CallToolResult>;
876
+ private trackCreatedFilesRecursive;
877
+ /**
878
+ * Recursively collect all file paths in a directory for existing files
879
+ */
880
+ private trackExistingFilesRecursive;
818
881
  }
819
882
  //#endregion
820
- //#region src/tools/WriteToFileTool.d.ts
821
- declare class WriteToFileTool {
822
- static readonly TOOL_NAME = "write-to-file";
823
- private fileSystemService;
824
- constructor();
883
+ //#region src/services/ScaffoldService.d.ts
884
+ declare class ScaffoldService implements IScaffoldService {
885
+ private fileSystem;
886
+ private scaffoldConfigLoader;
887
+ private variableReplacer;
888
+ static readonly DEFAULT_MARKER = "@scaffold-generated";
889
+ private readonly templatesRootPath;
890
+ private readonly processingService;
891
+ constructor(fileSystem: IFileSystemService, scaffoldConfigLoader: IScaffoldConfigLoader, variableReplacer: IVariableReplacementService, templatesRootPath?: string);
825
892
  /**
826
- * Get the tool definition for MCP
893
+ * Scaffold a new project from a boilerplate template
827
894
  */
828
- getDefinition(): ToolDefinition;
895
+ useBoilerplate(options: BoilerplateOptions): Promise<ScaffoldResult>;
829
896
  /**
830
- * Execute the tool
897
+ * Scaffold a new feature into an existing project
831
898
  */
832
- execute(args: Record<string, any>): Promise<CallToolResult>;
833
- }
834
- //#endregion
835
- //#region src/transports/types.d.ts
836
- /**
837
- * Transport mode types
838
- */
839
- declare enum TransportMode {
840
- STDIO = "stdio",
841
- HTTP = "http",
842
- SSE = "sse",
843
- CLI = "cli",
844
- }
845
- /**
846
- * Transport configuration options
847
- */
848
- interface TransportConfig {
849
- mode: TransportMode;
850
- port?: number;
851
- host?: string;
852
- }
853
- /**
854
- * Base interface for all transport handlers
855
- */
856
- interface TransportHandler {
857
- start(): Promise<void>;
858
- stop(): Promise<void>;
859
- }
860
- /**
861
- * HTTP transport specific types
862
- */
863
- interface HttpTransportHandler$1 extends TransportHandler {
864
- getPort(): number;
865
- getHost(): string;
899
+ useFeature(options: FeatureOptions): Promise<ScaffoldResult>;
900
+ /**
901
+ * Inject scaffold marker comment into generated code files.
902
+ * Prepends `// <marker>` to .ts/.tsx/.js/.jsx files that don't already have it.
903
+ * Fails silently — marker injection should never break scaffold output.
904
+ */
905
+ private injectScaffoldMarkers;
906
+ /**
907
+ * Common scaffolding processing logic shared by both useBoilerplate and useFeature
908
+ */
909
+ private processScaffold;
866
910
  }
867
911
  //#endregion
868
- //#region src/transports/http.d.ts
869
- /**
870
- * HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
871
- * Provides stateful session management with resumability support
872
- */
873
- declare class HttpTransportHandler implements HttpTransportHandler$1 {
874
- private serverFactory;
875
- private app;
876
- private server;
877
- private sessionManager;
878
- private config;
879
- constructor(serverFactory: Server | (() => Server), config: TransportConfig);
880
- private setupMiddleware;
881
- private setupRoutes;
882
- private handlePostRequest;
883
- private handleGetRequest;
884
- private handleDeleteRequest;
885
- start(): Promise<void>;
886
- stop(): Promise<void>;
887
- getPort(): number;
888
- getHost(): string;
912
+ //#region src/services/TemplateService.d.ts
913
+ interface ITemplateService$1 {
914
+ renderString(template: string, variables: Record<string, any>): string;
915
+ containsTemplateVariables(content: string): boolean;
889
916
  }
890
- //#endregion
891
- //#region src/transports/sse.d.ts
892
- /**
893
- * SSE (Server-Sent Events) transport handler
894
- * Legacy transport for backwards compatibility (protocol version 2024-11-05)
895
- * Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
896
- */
897
- declare class SseTransportHandler implements HttpTransportHandler$1 {
898
- private serverFactory;
899
- private app;
900
- private server;
901
- private sessionManager;
902
- private config;
903
- constructor(serverFactory: Server | (() => Server), config: TransportConfig);
904
- private setupMiddleware;
905
- private setupRoutes;
906
- private handleSseConnection;
907
- private handlePostMessage;
908
- start(): Promise<void>;
909
- stop(): Promise<void>;
910
- getPort(): number;
911
- getHost(): string;
917
+ declare class TemplateService implements ITemplateService$1 {
918
+ private liquid;
919
+ constructor();
920
+ private toPascalCase;
921
+ private setupCustomFilters;
922
+ renderString(template: string, variables: Record<string, any>): string;
923
+ containsTemplateVariables(content: string): boolean;
912
924
  }
913
925
  //#endregion
914
- //#region src/transports/stdio.d.ts
915
- /**
916
- * Stdio transport handler for MCP server
917
- * Used for command-line and direct integrations
918
- */
919
- declare class StdioTransportHandler implements TransportHandler {
920
- private server;
921
- private transport;
922
- constructor(server: Server);
923
- start(): Promise<void>;
924
- stop(): Promise<void>;
926
+ //#region src/services/VariableReplacementService.d.ts
927
+ declare class VariableReplacementService implements IVariableReplacementService {
928
+ private fileSystem;
929
+ private templateService;
930
+ private readonly binaryExtensions;
931
+ constructor(fileSystem: IFileSystemService, templateService: ITemplateService);
932
+ processFilesForVariableReplacement(dirPath: string, variables: Record<string, any>): Promise<void>;
933
+ replaceVariablesInFile(filePath: string, variables: Record<string, any>): Promise<void>;
934
+ isBinaryFile(filePath: string): boolean;
925
935
  }
926
936
  //#endregion
927
937
  //#region src/types/tools.d.ts
@@ -944,4 +954,4 @@ interface Tool {
944
954
  execute: (args: unknown) => Promise<string>;
945
955
  }
946
956
  //#endregion
947
- 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, PaginationMeta, ParsedInclude, ScaffoldArgs, ScaffoldConfigEntry, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, TemplateVariables, Tool, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, VariablesSchema, WriteToFileTool, scaffoldArgsSchema };
957
+ 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, PaginationMeta, ParsedInclude, ScaffoldArgs, ScaffoldConfigEntry, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, type ServerOptions, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, TemplateVariables, Tool, type TransportConfig, type TransportHandler, TransportMode, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, VariablesSchema, WriteToFileTool, createServer, scaffoldArgsSchema };