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