@mcptoolshop/file-forge 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -0
  3. package/build/config/index.d.ts +29 -0
  4. package/build/config/index.d.ts.map +1 -0
  5. package/build/config/index.js +229 -0
  6. package/build/config/index.js.map +1 -0
  7. package/build/index.d.ts +9 -0
  8. package/build/index.d.ts.map +1 -0
  9. package/build/index.js +23 -0
  10. package/build/index.js.map +1 -0
  11. package/build/security/index.d.ts +8 -0
  12. package/build/security/index.d.ts.map +1 -0
  13. package/build/security/index.js +8 -0
  14. package/build/security/index.js.map +1 -0
  15. package/build/security/read-only.d.ts +32 -0
  16. package/build/security/read-only.d.ts.map +1 -0
  17. package/build/security/read-only.js +62 -0
  18. package/build/security/read-only.js.map +1 -0
  19. package/build/security/sandbox.d.ts +60 -0
  20. package/build/security/sandbox.d.ts.map +1 -0
  21. package/build/security/sandbox.js +231 -0
  22. package/build/security/sandbox.js.map +1 -0
  23. package/build/server.d.ts +20 -0
  24. package/build/server.d.ts.map +1 -0
  25. package/build/server.js +63 -0
  26. package/build/server.js.map +1 -0
  27. package/build/tools/metadata.d.ts +11 -0
  28. package/build/tools/metadata.d.ts.map +1 -0
  29. package/build/tools/metadata.js +423 -0
  30. package/build/tools/metadata.js.map +1 -0
  31. package/build/tools/read.d.ts +11 -0
  32. package/build/tools/read.d.ts.map +1 -0
  33. package/build/tools/read.js +335 -0
  34. package/build/tools/read.js.map +1 -0
  35. package/build/tools/scaffold.d.ts +11 -0
  36. package/build/tools/scaffold.d.ts.map +1 -0
  37. package/build/tools/scaffold.js +345 -0
  38. package/build/tools/scaffold.js.map +1 -0
  39. package/build/tools/search.d.ts +11 -0
  40. package/build/tools/search.d.ts.map +1 -0
  41. package/build/tools/search.js +250 -0
  42. package/build/tools/search.js.map +1 -0
  43. package/build/tools/write.d.ts +11 -0
  44. package/build/tools/write.d.ts.map +1 -0
  45. package/build/tools/write.js +538 -0
  46. package/build/tools/write.js.map +1 -0
  47. package/build/types.d.ts +402 -0
  48. package/build/types.d.ts.map +1 -0
  49. package/build/types.js +146 -0
  50. package/build/types.js.map +1 -0
  51. package/build/utils/errors.d.ts +43 -0
  52. package/build/utils/errors.d.ts.map +1 -0
  53. package/build/utils/errors.js +125 -0
  54. package/build/utils/errors.js.map +1 -0
  55. package/build/utils/index.d.ts +10 -0
  56. package/build/utils/index.d.ts.map +1 -0
  57. package/build/utils/index.js +9 -0
  58. package/build/utils/index.js.map +1 -0
  59. package/build/utils/logger.d.ts +88 -0
  60. package/build/utils/logger.d.ts.map +1 -0
  61. package/build/utils/logger.js +166 -0
  62. package/build/utils/logger.js.map +1 -0
  63. package/build/utils/validation.d.ts +43 -0
  64. package/build/utils/validation.d.ts.map +1 -0
  65. package/build/utils/validation.js +196 -0
  66. package/build/utils/validation.js.map +1 -0
  67. package/package.json +64 -0
  68. package/templates/typescript-starter/package.json +18 -0
  69. package/templates/typescript-starter/src/index.ts +9 -0
  70. package/templates/typescript-starter/template.json +24 -0
  71. package/templates/typescript-starter/tsconfig.json +14 -0
@@ -0,0 +1,402 @@
1
+ /**
2
+ * MCP File Forge - Type Definitions
3
+ *
4
+ * Core types used throughout the server.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Standard success result from a tool.
9
+ */
10
+ export interface ToolSuccess {
11
+ [key: string]: unknown;
12
+ content: Array<{
13
+ type: 'text';
14
+ text: string;
15
+ }>;
16
+ }
17
+ /**
18
+ * Standard error result from a tool.
19
+ */
20
+ export interface ToolError {
21
+ [key: string]: unknown;
22
+ isError: true;
23
+ content: Array<{
24
+ type: 'text';
25
+ text: string;
26
+ }>;
27
+ }
28
+ export type ToolResult = ToolSuccess | ToolError;
29
+ export declare const ErrorCode: {
30
+ readonly PATH_OUTSIDE_SANDBOX: "PATH_OUTSIDE_SANDBOX";
31
+ readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
32
+ readonly PERMISSION_DENIED: "PERMISSION_DENIED";
33
+ readonly FILE_TOO_LARGE: "FILE_TOO_LARGE";
34
+ readonly DEPTH_EXCEEDED: "DEPTH_EXCEEDED";
35
+ readonly INVALID_ENCODING: "INVALID_ENCODING";
36
+ readonly WRITE_DISABLED: "WRITE_DISABLED";
37
+ readonly DIRECTORY_NOT_EMPTY: "DIRECTORY_NOT_EMPTY";
38
+ readonly ALREADY_EXISTS: "ALREADY_EXISTS";
39
+ readonly INVALID_PATH: "INVALID_PATH";
40
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
41
+ };
42
+ export type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode];
43
+ /**
44
+ * Structured error information.
45
+ */
46
+ export interface FileForgeError {
47
+ code: ErrorCodeType;
48
+ message: string;
49
+ details?: Record<string, unknown>;
50
+ }
51
+ /**
52
+ * File or directory statistics.
53
+ */
54
+ export interface FileStat {
55
+ path: string;
56
+ name: string;
57
+ size: number;
58
+ isFile: boolean;
59
+ isDirectory: boolean;
60
+ isSymlink: boolean;
61
+ created: string;
62
+ modified: string;
63
+ accessed: string;
64
+ permissions?: string;
65
+ }
66
+ /**
67
+ * Directory entry (lighter than full FileStat).
68
+ */
69
+ export interface DirectoryEntry {
70
+ name: string;
71
+ path: string;
72
+ isFile: boolean;
73
+ isDirectory: boolean;
74
+ size?: number;
75
+ }
76
+ /**
77
+ * Sandbox configuration.
78
+ */
79
+ export declare const SandboxConfigSchema: z.ZodObject<{
80
+ allowed_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
81
+ denied_paths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
+ follow_symlinks: z.ZodDefault<z.ZodBoolean>;
83
+ max_file_size: z.ZodDefault<z.ZodNumber>;
84
+ max_depth: z.ZodDefault<z.ZodNumber>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ allowed_paths: string[];
87
+ follow_symlinks: boolean;
88
+ max_file_size: number;
89
+ max_depth: number;
90
+ denied_paths?: string[] | undefined;
91
+ }, {
92
+ allowed_paths?: string[] | undefined;
93
+ denied_paths?: string[] | undefined;
94
+ follow_symlinks?: boolean | undefined;
95
+ max_file_size?: number | undefined;
96
+ max_depth?: number | undefined;
97
+ }>;
98
+ export type SandboxConfig = z.infer<typeof SandboxConfigSchema>;
99
+ /**
100
+ * Template configuration.
101
+ */
102
+ export declare const TemplateConfigSchema: z.ZodObject<{
103
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ paths: string[];
106
+ }, {
107
+ paths?: string[] | undefined;
108
+ }>;
109
+ export type TemplateConfig = z.infer<typeof TemplateConfigSchema>;
110
+ /**
111
+ * Logging configuration.
112
+ */
113
+ export declare const LogConfigSchema: z.ZodObject<{
114
+ level: z.ZodDefault<z.ZodEnum<["error", "warn", "info", "debug"]>>;
115
+ file: z.ZodOptional<z.ZodString>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ level: "error" | "warn" | "info" | "debug";
118
+ file?: string | undefined;
119
+ }, {
120
+ level?: "error" | "warn" | "info" | "debug" | undefined;
121
+ file?: string | undefined;
122
+ }>;
123
+ export type LogConfig = z.infer<typeof LogConfigSchema>;
124
+ /**
125
+ * Full server configuration.
126
+ */
127
+ export declare const ServerConfigSchema: z.ZodObject<{
128
+ sandbox: z.ZodDefault<z.ZodObject<{
129
+ allowed_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
130
+ denied_paths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
131
+ follow_symlinks: z.ZodDefault<z.ZodBoolean>;
132
+ max_file_size: z.ZodDefault<z.ZodNumber>;
133
+ max_depth: z.ZodDefault<z.ZodNumber>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ allowed_paths: string[];
136
+ follow_symlinks: boolean;
137
+ max_file_size: number;
138
+ max_depth: number;
139
+ denied_paths?: string[] | undefined;
140
+ }, {
141
+ allowed_paths?: string[] | undefined;
142
+ denied_paths?: string[] | undefined;
143
+ follow_symlinks?: boolean | undefined;
144
+ max_file_size?: number | undefined;
145
+ max_depth?: number | undefined;
146
+ }>>;
147
+ templates: z.ZodDefault<z.ZodObject<{
148
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ paths: string[];
151
+ }, {
152
+ paths?: string[] | undefined;
153
+ }>>;
154
+ logging: z.ZodDefault<z.ZodObject<{
155
+ level: z.ZodDefault<z.ZodEnum<["error", "warn", "info", "debug"]>>;
156
+ file: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ level: "error" | "warn" | "info" | "debug";
159
+ file?: string | undefined;
160
+ }, {
161
+ level?: "error" | "warn" | "info" | "debug" | undefined;
162
+ file?: string | undefined;
163
+ }>>;
164
+ read_only: z.ZodDefault<z.ZodBoolean>;
165
+ }, "strip", z.ZodTypeAny, {
166
+ sandbox: {
167
+ allowed_paths: string[];
168
+ follow_symlinks: boolean;
169
+ max_file_size: number;
170
+ max_depth: number;
171
+ denied_paths?: string[] | undefined;
172
+ };
173
+ templates: {
174
+ paths: string[];
175
+ };
176
+ logging: {
177
+ level: "error" | "warn" | "info" | "debug";
178
+ file?: string | undefined;
179
+ };
180
+ read_only: boolean;
181
+ }, {
182
+ sandbox?: {
183
+ allowed_paths?: string[] | undefined;
184
+ denied_paths?: string[] | undefined;
185
+ follow_symlinks?: boolean | undefined;
186
+ max_file_size?: number | undefined;
187
+ max_depth?: number | undefined;
188
+ } | undefined;
189
+ templates?: {
190
+ paths?: string[] | undefined;
191
+ } | undefined;
192
+ logging?: {
193
+ level?: "error" | "warn" | "info" | "debug" | undefined;
194
+ file?: string | undefined;
195
+ } | undefined;
196
+ read_only?: boolean | undefined;
197
+ }>;
198
+ export type ServerConfig = z.infer<typeof ServerConfigSchema>;
199
+ export declare const ReadFileInputSchema: z.ZodObject<{
200
+ path: z.ZodString;
201
+ encoding: z.ZodDefault<z.ZodString>;
202
+ start_line: z.ZodOptional<z.ZodNumber>;
203
+ end_line: z.ZodOptional<z.ZodNumber>;
204
+ max_size_kb: z.ZodDefault<z.ZodNumber>;
205
+ }, "strip", z.ZodTypeAny, {
206
+ path: string;
207
+ encoding: string;
208
+ max_size_kb: number;
209
+ start_line?: number | undefined;
210
+ end_line?: number | undefined;
211
+ }, {
212
+ path: string;
213
+ encoding?: string | undefined;
214
+ start_line?: number | undefined;
215
+ end_line?: number | undefined;
216
+ max_size_kb?: number | undefined;
217
+ }>;
218
+ export type ReadFileInput = z.infer<typeof ReadFileInputSchema>;
219
+ export declare const ReadDirectoryInputSchema: z.ZodObject<{
220
+ path: z.ZodString;
221
+ recursive: z.ZodDefault<z.ZodBoolean>;
222
+ max_depth: z.ZodDefault<z.ZodNumber>;
223
+ include_hidden: z.ZodDefault<z.ZodBoolean>;
224
+ pattern: z.ZodOptional<z.ZodString>;
225
+ }, "strip", z.ZodTypeAny, {
226
+ path: string;
227
+ max_depth: number;
228
+ recursive: boolean;
229
+ include_hidden: boolean;
230
+ pattern?: string | undefined;
231
+ }, {
232
+ path: string;
233
+ max_depth?: number | undefined;
234
+ recursive?: boolean | undefined;
235
+ include_hidden?: boolean | undefined;
236
+ pattern?: string | undefined;
237
+ }>;
238
+ export type ReadDirectoryInput = z.infer<typeof ReadDirectoryInputSchema>;
239
+ export declare const WriteFileInputSchema: z.ZodObject<{
240
+ path: z.ZodString;
241
+ content: z.ZodString;
242
+ encoding: z.ZodDefault<z.ZodString>;
243
+ create_dirs: z.ZodDefault<z.ZodBoolean>;
244
+ overwrite: z.ZodDefault<z.ZodBoolean>;
245
+ backup: z.ZodDefault<z.ZodBoolean>;
246
+ }, "strip", z.ZodTypeAny, {
247
+ content: string;
248
+ path: string;
249
+ encoding: string;
250
+ create_dirs: boolean;
251
+ overwrite: boolean;
252
+ backup: boolean;
253
+ }, {
254
+ content: string;
255
+ path: string;
256
+ encoding?: string | undefined;
257
+ create_dirs?: boolean | undefined;
258
+ overwrite?: boolean | undefined;
259
+ backup?: boolean | undefined;
260
+ }>;
261
+ export type WriteFileInput = z.infer<typeof WriteFileInputSchema>;
262
+ export declare const CreateDirectoryInputSchema: z.ZodObject<{
263
+ path: z.ZodString;
264
+ recursive: z.ZodDefault<z.ZodBoolean>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ path: string;
267
+ recursive: boolean;
268
+ }, {
269
+ path: string;
270
+ recursive?: boolean | undefined;
271
+ }>;
272
+ export type CreateDirectoryInput = z.infer<typeof CreateDirectoryInputSchema>;
273
+ export declare const CopyFileInputSchema: z.ZodObject<{
274
+ source: z.ZodString;
275
+ destination: z.ZodString;
276
+ overwrite: z.ZodDefault<z.ZodBoolean>;
277
+ recursive: z.ZodDefault<z.ZodBoolean>;
278
+ }, "strip", z.ZodTypeAny, {
279
+ recursive: boolean;
280
+ overwrite: boolean;
281
+ source: string;
282
+ destination: string;
283
+ }, {
284
+ source: string;
285
+ destination: string;
286
+ recursive?: boolean | undefined;
287
+ overwrite?: boolean | undefined;
288
+ }>;
289
+ export type CopyFileInput = z.infer<typeof CopyFileInputSchema>;
290
+ export declare const MoveFileInputSchema: z.ZodObject<{
291
+ source: z.ZodString;
292
+ destination: z.ZodString;
293
+ overwrite: z.ZodDefault<z.ZodBoolean>;
294
+ }, "strip", z.ZodTypeAny, {
295
+ overwrite: boolean;
296
+ source: string;
297
+ destination: string;
298
+ }, {
299
+ source: string;
300
+ destination: string;
301
+ overwrite?: boolean | undefined;
302
+ }>;
303
+ export type MoveFileInput = z.infer<typeof MoveFileInputSchema>;
304
+ export declare const DeleteFileInputSchema: z.ZodObject<{
305
+ path: z.ZodString;
306
+ recursive: z.ZodDefault<z.ZodBoolean>;
307
+ force: z.ZodDefault<z.ZodBoolean>;
308
+ }, "strip", z.ZodTypeAny, {
309
+ path: string;
310
+ recursive: boolean;
311
+ force: boolean;
312
+ }, {
313
+ path: string;
314
+ recursive?: boolean | undefined;
315
+ force?: boolean | undefined;
316
+ }>;
317
+ export type DeleteFileInput = z.infer<typeof DeleteFileInputSchema>;
318
+ export declare const GlobSearchInputSchema: z.ZodObject<{
319
+ pattern: z.ZodString;
320
+ base_path: z.ZodOptional<z.ZodString>;
321
+ max_results: z.ZodDefault<z.ZodNumber>;
322
+ include_dirs: z.ZodDefault<z.ZodBoolean>;
323
+ }, "strip", z.ZodTypeAny, {
324
+ pattern: string;
325
+ max_results: number;
326
+ include_dirs: boolean;
327
+ base_path?: string | undefined;
328
+ }, {
329
+ pattern: string;
330
+ base_path?: string | undefined;
331
+ max_results?: number | undefined;
332
+ include_dirs?: boolean | undefined;
333
+ }>;
334
+ export type GlobSearchInput = z.infer<typeof GlobSearchInputSchema>;
335
+ export declare const GrepSearchInputSchema: z.ZodObject<{
336
+ pattern: z.ZodString;
337
+ path: z.ZodOptional<z.ZodString>;
338
+ glob: z.ZodOptional<z.ZodString>;
339
+ case_sensitive: z.ZodDefault<z.ZodBoolean>;
340
+ max_results: z.ZodDefault<z.ZodNumber>;
341
+ context_lines: z.ZodDefault<z.ZodNumber>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ pattern: string;
344
+ max_results: number;
345
+ case_sensitive: boolean;
346
+ context_lines: number;
347
+ path?: string | undefined;
348
+ glob?: string | undefined;
349
+ }, {
350
+ pattern: string;
351
+ path?: string | undefined;
352
+ max_results?: number | undefined;
353
+ glob?: string | undefined;
354
+ case_sensitive?: boolean | undefined;
355
+ context_lines?: number | undefined;
356
+ }>;
357
+ export type GrepSearchInput = z.infer<typeof GrepSearchInputSchema>;
358
+ export declare const FileStatInputSchema: z.ZodObject<{
359
+ path: z.ZodString;
360
+ }, "strip", z.ZodTypeAny, {
361
+ path: string;
362
+ }, {
363
+ path: string;
364
+ }>;
365
+ export type FileStatInput = z.infer<typeof FileStatInputSchema>;
366
+ export declare const FileExistsInputSchema: z.ZodObject<{
367
+ path: z.ZodString;
368
+ type: z.ZodDefault<z.ZodEnum<["file", "directory", "any"]>>;
369
+ }, "strip", z.ZodTypeAny, {
370
+ path: string;
371
+ type: "file" | "directory" | "any";
372
+ }, {
373
+ path: string;
374
+ type?: "file" | "directory" | "any" | undefined;
375
+ }>;
376
+ export type FileExistsInput = z.infer<typeof FileExistsInputSchema>;
377
+ export declare const ScaffoldProjectInputSchema: z.ZodObject<{
378
+ template: z.ZodString;
379
+ destination: z.ZodString;
380
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
381
+ overwrite: z.ZodDefault<z.ZodBoolean>;
382
+ }, "strip", z.ZodTypeAny, {
383
+ overwrite: boolean;
384
+ destination: string;
385
+ template: string;
386
+ variables?: Record<string, string> | undefined;
387
+ }, {
388
+ destination: string;
389
+ template: string;
390
+ overwrite?: boolean | undefined;
391
+ variables?: Record<string, string> | undefined;
392
+ }>;
393
+ export type ScaffoldProjectInput = z.infer<typeof ScaffoldProjectInputSchema>;
394
+ export declare const ListTemplatesInputSchema: z.ZodObject<{
395
+ category: z.ZodOptional<z.ZodString>;
396
+ }, "strip", z.ZodTypeAny, {
397
+ category?: string | undefined;
398
+ }, {
399
+ category?: string | undefined;
400
+ }>;
401
+ export type ListTemplatesInput = z.infer<typeof ListTemplatesInputSchema>;
402
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,KA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BAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,mBAAmB;;;;;;EAE9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAKrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAG9E,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/build/types.js ADDED
@@ -0,0 +1,146 @@
1
+ /**
2
+ * MCP File Forge - Type Definitions
3
+ *
4
+ * Core types used throughout the server.
5
+ */
6
+ import { z } from 'zod';
7
+ // ============================================================================
8
+ // Error Codes
9
+ // ============================================================================
10
+ export const ErrorCode = {
11
+ PATH_OUTSIDE_SANDBOX: 'PATH_OUTSIDE_SANDBOX',
12
+ FILE_NOT_FOUND: 'FILE_NOT_FOUND',
13
+ PERMISSION_DENIED: 'PERMISSION_DENIED',
14
+ FILE_TOO_LARGE: 'FILE_TOO_LARGE',
15
+ DEPTH_EXCEEDED: 'DEPTH_EXCEEDED',
16
+ INVALID_ENCODING: 'INVALID_ENCODING',
17
+ WRITE_DISABLED: 'WRITE_DISABLED',
18
+ DIRECTORY_NOT_EMPTY: 'DIRECTORY_NOT_EMPTY',
19
+ ALREADY_EXISTS: 'ALREADY_EXISTS',
20
+ INVALID_PATH: 'INVALID_PATH',
21
+ UNKNOWN_ERROR: 'UNKNOWN_ERROR',
22
+ };
23
+ // ============================================================================
24
+ // Configuration Types
25
+ // ============================================================================
26
+ /**
27
+ * Sandbox configuration.
28
+ */
29
+ export const SandboxConfigSchema = z.object({
30
+ allowed_paths: z.array(z.string()).default(['.']),
31
+ denied_paths: z.array(z.string()).optional(),
32
+ follow_symlinks: z.boolean().default(false),
33
+ max_file_size: z.number().default(104857600), // 100MB
34
+ max_depth: z.number().default(20),
35
+ });
36
+ /**
37
+ * Template configuration.
38
+ */
39
+ export const TemplateConfigSchema = z.object({
40
+ paths: z.array(z.string()).default(['./templates']),
41
+ });
42
+ /**
43
+ * Logging configuration.
44
+ */
45
+ export const LogConfigSchema = z.object({
46
+ level: z.enum(['error', 'warn', 'info', 'debug']).default('info'),
47
+ file: z.string().optional(),
48
+ });
49
+ /**
50
+ * Full server configuration.
51
+ */
52
+ export const ServerConfigSchema = z.object({
53
+ sandbox: SandboxConfigSchema.default({}),
54
+ templates: TemplateConfigSchema.default({}),
55
+ logging: LogConfigSchema.default({}),
56
+ read_only: z.boolean().default(false),
57
+ });
58
+ // ============================================================================
59
+ // Tool Input Schemas
60
+ // ============================================================================
61
+ // Read file input
62
+ export const ReadFileInputSchema = z.object({
63
+ path: z.string().describe('Absolute or relative path to the file'),
64
+ encoding: z.string().default('utf-8').describe('File encoding'),
65
+ start_line: z.number().optional().describe('Start line (1-indexed)'),
66
+ end_line: z.number().optional().describe('End line (inclusive)'),
67
+ max_size_kb: z.number().default(10240).describe('Max size in KB'),
68
+ });
69
+ // Read directory input
70
+ export const ReadDirectoryInputSchema = z.object({
71
+ path: z.string().describe('Path to directory'),
72
+ recursive: z.boolean().default(false).describe('Include subdirectories'),
73
+ max_depth: z.number().default(5).describe('Max recursion depth'),
74
+ include_hidden: z.boolean().default(false).describe('Include hidden files'),
75
+ pattern: z.string().optional().describe('Glob pattern filter'),
76
+ });
77
+ // Write file input
78
+ export const WriteFileInputSchema = z.object({
79
+ path: z.string().describe('Path to write to'),
80
+ content: z.string().describe('Content to write'),
81
+ encoding: z.string().default('utf-8').describe('File encoding'),
82
+ create_dirs: z.boolean().default(true).describe('Create parent directories'),
83
+ overwrite: z.boolean().default(true).describe('Overwrite if exists'),
84
+ backup: z.boolean().default(false).describe('Create backup before overwrite'),
85
+ });
86
+ // Create directory input
87
+ export const CreateDirectoryInputSchema = z.object({
88
+ path: z.string().describe('Path to create'),
89
+ recursive: z.boolean().default(true).describe('Create parent directories'),
90
+ });
91
+ // Copy file input
92
+ export const CopyFileInputSchema = z.object({
93
+ source: z.string().describe('Source path'),
94
+ destination: z.string().describe('Destination path'),
95
+ overwrite: z.boolean().default(false).describe('Overwrite if exists'),
96
+ recursive: z.boolean().default(true).describe('Copy directories recursively'),
97
+ });
98
+ // Move file input
99
+ export const MoveFileInputSchema = z.object({
100
+ source: z.string().describe('Source path'),
101
+ destination: z.string().describe('Destination path'),
102
+ overwrite: z.boolean().default(false).describe('Overwrite if exists'),
103
+ });
104
+ // Delete file input
105
+ export const DeleteFileInputSchema = z.object({
106
+ path: z.string().describe('Path to delete'),
107
+ recursive: z.boolean().default(false).describe('Delete directories recursively'),
108
+ force: z.boolean().default(false).describe('Ignore errors'),
109
+ });
110
+ // Glob search input
111
+ export const GlobSearchInputSchema = z.object({
112
+ pattern: z.string().describe('Glob pattern'),
113
+ base_path: z.string().optional().describe('Base directory'),
114
+ max_results: z.number().default(1000).describe('Maximum results'),
115
+ include_dirs: z.boolean().default(false).describe('Include directories'),
116
+ });
117
+ // Grep search input
118
+ export const GrepSearchInputSchema = z.object({
119
+ pattern: z.string().describe('Regex pattern'),
120
+ path: z.string().optional().describe('File or directory to search'),
121
+ glob: z.string().optional().describe('File pattern filter'),
122
+ case_sensitive: z.boolean().default(true).describe('Case sensitive'),
123
+ max_results: z.number().default(100).describe('Maximum results'),
124
+ context_lines: z.number().default(0).describe('Context lines'),
125
+ });
126
+ // File stat input
127
+ export const FileStatInputSchema = z.object({
128
+ path: z.string().describe('Path to file or directory'),
129
+ });
130
+ // File exists input
131
+ export const FileExistsInputSchema = z.object({
132
+ path: z.string().describe('Path to check'),
133
+ type: z.enum(['file', 'directory', 'any']).default('any').describe('Type to check for'),
134
+ });
135
+ // Scaffold project input
136
+ export const ScaffoldProjectInputSchema = z.object({
137
+ template: z.string().describe('Template name or path'),
138
+ destination: z.string().describe('Destination directory'),
139
+ variables: z.record(z.string()).optional().describe('Template variables'),
140
+ overwrite: z.boolean().default(false).describe('Overwrite existing'),
141
+ });
142
+ // List templates input
143
+ export const ListTemplatesInputSchema = z.object({
144
+ category: z.string().optional().describe('Filter by category'),
145
+ });
146
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,oBAAoB,EAAE,sBAAsB;IAC5C,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IA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,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CACxF,CAAC,CAAC;AAIH,yBAAyB;AACzB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACtD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACzD,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IACzE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CACrE,CAAC,CAAC;AAIH,uBAAuB;AACvB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CAC/D,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * MCP File Forge - Error Utilities
3
+ *
4
+ * Structured error handling and response formatting.
5
+ */
6
+ import type { FileForgeError, ToolResult, ErrorCodeType } from '../types.js';
7
+ /**
8
+ * Create a structured error object.
9
+ */
10
+ export declare function createError(code: ErrorCodeType, message: string, details?: Record<string, unknown>): FileForgeError;
11
+ /**
12
+ * Format a FileForgeError as a tool error result.
13
+ */
14
+ export declare function formatErrorResult(error: FileForgeError): ToolResult;
15
+ /**
16
+ * Create an error result directly.
17
+ */
18
+ export declare function errorResult(code: ErrorCodeType, message: string, details?: Record<string, unknown>): ToolResult;
19
+ /**
20
+ * Format a success result with JSON data.
21
+ */
22
+ export declare function successResult(data: unknown): ToolResult;
23
+ /**
24
+ * Wrap a function with error handling.
25
+ */
26
+ export declare function withErrorHandling<T extends unknown[]>(fn: (...args: T) => Promise<ToolResult>, context: string): (...args: T) => Promise<ToolResult>;
27
+ /**
28
+ * Validate that a value is defined.
29
+ */
30
+ export declare function assertDefined<T>(value: T | undefined | null, errorMessage: string): asserts value is T;
31
+ /**
32
+ * Safe JSON parse with error handling.
33
+ */
34
+ export declare function safeJsonParse<T>(json: string): T | null;
35
+ /**
36
+ * Format bytes to human readable string.
37
+ */
38
+ export declare function formatBytes(bytes: number, decimals?: number): string;
39
+ /**
40
+ * Truncate a string to a maximum length.
41
+ */
42
+ export declare function truncate(str: string, maxLength: number, suffix?: string): string;
43
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI7E;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,cAAc,CAMhB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,UAAU,CAYnE;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,UAAU,CAEZ;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