@procedures/fs 0.0.0-stage → 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.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +895 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +16 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +178 -0
- package/dist/module.js.map +1 -0
- package/dist/procedures/fs/copy.d.ts +11 -0
- package/dist/procedures/fs/copy.d.ts.map +1 -0
- package/dist/procedures/fs/copy.js +21 -0
- package/dist/procedures/fs/copy.js.map +1 -0
- package/dist/procedures/fs/exists.d.ts +11 -0
- package/dist/procedures/fs/exists.d.ts.map +1 -0
- package/dist/procedures/fs/exists.js +20 -0
- package/dist/procedures/fs/exists.js.map +1 -0
- package/dist/procedures/fs/glob.d.ts +17 -0
- package/dist/procedures/fs/glob.d.ts.map +1 -0
- package/dist/procedures/fs/glob.js +85 -0
- package/dist/procedures/fs/glob.js.map +1 -0
- package/dist/procedures/fs/index.d.ts +12 -0
- package/dist/procedures/fs/index.d.ts.map +1 -0
- package/dist/procedures/fs/index.js +12 -0
- package/dist/procedures/fs/index.js.map +1 -0
- package/dist/procedures/fs/json.d.ts +11 -0
- package/dist/procedures/fs/json.d.ts.map +1 -0
- package/dist/procedures/fs/json.js +16 -0
- package/dist/procedures/fs/json.js.map +1 -0
- package/dist/procedures/fs/mkdir.d.ts +11 -0
- package/dist/procedures/fs/mkdir.d.ts.map +1 -0
- package/dist/procedures/fs/mkdir.js +39 -0
- package/dist/procedures/fs/mkdir.js.map +1 -0
- package/dist/procedures/fs/move.d.ts +11 -0
- package/dist/procedures/fs/move.d.ts.map +1 -0
- package/dist/procedures/fs/move.js +46 -0
- package/dist/procedures/fs/move.js.map +1 -0
- package/dist/procedures/fs/read.d.ts +11 -0
- package/dist/procedures/fs/read.d.ts.map +1 -0
- package/dist/procedures/fs/read.js +21 -0
- package/dist/procedures/fs/read.js.map +1 -0
- package/dist/procedures/fs/readdir.d.ts +11 -0
- package/dist/procedures/fs/readdir.d.ts.map +1 -0
- package/dist/procedures/fs/readdir.js +38 -0
- package/dist/procedures/fs/readdir.js.map +1 -0
- package/dist/procedures/fs/rm.d.ts +11 -0
- package/dist/procedures/fs/rm.d.ts.map +1 -0
- package/dist/procedures/fs/rm.js +30 -0
- package/dist/procedures/fs/rm.js.map +1 -0
- package/dist/procedures/fs/stat.d.ts +11 -0
- package/dist/procedures/fs/stat.d.ts.map +1 -0
- package/dist/procedures/fs/stat.js +29 -0
- package/dist/procedures/fs/stat.js.map +1 -0
- package/dist/procedures/fs/write.d.ts +11 -0
- package/dist/procedures/fs/write.d.ts.map +1 -0
- package/dist/procedures/fs/write.js +24 -0
- package/dist/procedures/fs/write.js.map +1 -0
- package/dist/procedures/fs.d.ts +5 -0
- package/dist/procedures/fs.d.ts.map +1 -0
- package/dist/procedures/fs.js +5 -0
- package/dist/procedures/fs.js.map +1 -0
- package/dist/register.d.ts +8 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +14 -0
- package/dist/register.js.map +1 -0
- package/dist/types.d.ts +187 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +197 -0
- package/dist/types.js.map +1 -0
- package/package.json +74 -3
- package/src/index.ts +17 -0
- package/src/module.ts +238 -0
- package/src/procedures/fs/copy.ts +24 -0
- package/src/procedures/fs/exists.ts +20 -0
- package/src/procedures/fs/glob.ts +92 -0
- package/src/procedures/fs/index.ts +11 -0
- package/src/procedures/fs/json.ts +21 -0
- package/src/procedures/fs/mkdir.ts +43 -0
- package/src/procedures/fs/move.ts +47 -0
- package/src/procedures/fs/read.ts +23 -0
- package/src/procedures/fs/readdir.ts +44 -0
- package/src/procedures/fs/rm.ts +31 -0
- package/src/procedures/fs/stat.ts +30 -0
- package/src/procedures/fs/write.ts +27 -0
- package/src/procedures/fs.ts +5 -0
- package/src/register.ts +17 -0
- package/src/types.ts +407 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for client-fs procedures
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Stats } from "node:fs";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// read Types - Read file contents
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
export const ReadInputSchema: z.ZodObject<{
|
|
13
|
+
path: z.ZodString;
|
|
14
|
+
encoding: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
15
|
+
}> = z.object({
|
|
16
|
+
/** Path to file to read */
|
|
17
|
+
path: z.string().describe("Path to file to read"),
|
|
18
|
+
/** File encoding (default: utf8) */
|
|
19
|
+
encoding: z.string().optional().default("utf8").describe("File encoding (default: utf8)"),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type ReadInput = z.infer<typeof ReadInputSchema>;
|
|
23
|
+
|
|
24
|
+
export interface ReadOutput {
|
|
25
|
+
/** File content */
|
|
26
|
+
content: string;
|
|
27
|
+
/** File path */
|
|
28
|
+
path: string;
|
|
29
|
+
/** File size in bytes */
|
|
30
|
+
stats: StatOutput;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// write Types - Write content to file
|
|
35
|
+
// =============================================================================
|
|
36
|
+
|
|
37
|
+
export const WriteInputSchema: z.ZodObject<{
|
|
38
|
+
path: z.ZodString;
|
|
39
|
+
content: z.ZodString;
|
|
40
|
+
encoding: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
41
|
+
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{ write: "write"; append: "append" }>>>;
|
|
42
|
+
}> = z.object({
|
|
43
|
+
/** Path to file to write */
|
|
44
|
+
path: z.string().describe("Path to file to write"),
|
|
45
|
+
/** Content to write */
|
|
46
|
+
content: z.string().describe("Content to write"),
|
|
47
|
+
/** File encoding (default: utf8) */
|
|
48
|
+
encoding: z.string().optional().default("utf8").describe("File encoding (default: utf8)"),
|
|
49
|
+
/** Write mode: write (overwrite) or append (default: write) */
|
|
50
|
+
mode: z.enum(["write", "append"]).optional().default("write").describe("Write mode: write (overwrite) or append (default: write)"),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export type WriteInput = z.infer<typeof WriteInputSchema>;
|
|
54
|
+
|
|
55
|
+
export interface WriteOutput {
|
|
56
|
+
/** File path that was written */
|
|
57
|
+
path: string;
|
|
58
|
+
/** Bytes written */
|
|
59
|
+
bytesWritten: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export const FileTypeInputSchema : z.ZodObject<{
|
|
64
|
+
path: z.ZodString;
|
|
65
|
+
}> = z.object({
|
|
66
|
+
/** Path to check */
|
|
67
|
+
path: z.string().describe("Path to check"),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type FileTypeInput = z.infer<typeof FileTypeInputSchema>;
|
|
71
|
+
export interface FileTypeOutput {
|
|
72
|
+
/** Path that was checked */
|
|
73
|
+
path : string;
|
|
74
|
+
/** Type if exists: file, directory, or other */
|
|
75
|
+
type : FileType;
|
|
76
|
+
stats : Stats
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
// =============================================================================
|
|
81
|
+
// exists Types - Check if file or directory exists
|
|
82
|
+
// =============================================================================
|
|
83
|
+
|
|
84
|
+
export const ExistsInputSchema: z.ZodObject<{
|
|
85
|
+
path: z.ZodString;
|
|
86
|
+
}> = z.object({
|
|
87
|
+
/** Path to check */
|
|
88
|
+
path: z.string().describe("Path to check"),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export type ExistsInput = z.infer<typeof ExistsInputSchema>;
|
|
92
|
+
export enum FileType {
|
|
93
|
+
File = "file",
|
|
94
|
+
Directory = "directory",
|
|
95
|
+
Other = "other",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type ExistsOutput = {exists : false} | {exists : true, stats : StatOutput};
|
|
99
|
+
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// mkdir Types - Create directory
|
|
102
|
+
// =============================================================================
|
|
103
|
+
|
|
104
|
+
export const MkdirInputSchema: z.ZodObject<{
|
|
105
|
+
path: z.ZodString;
|
|
106
|
+
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
107
|
+
}> = z.object({
|
|
108
|
+
/** Path of directory to create */
|
|
109
|
+
path: z.string().describe("Path of directory to create"),
|
|
110
|
+
/** Create parent directories if needed (default: true) */
|
|
111
|
+
recursive: z.boolean().optional().default(true).describe("Create parent directories if needed (default: true)"),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export type MkdirInput = z.infer<typeof MkdirInputSchema>;
|
|
115
|
+
|
|
116
|
+
export interface MkdirOutput {
|
|
117
|
+
/** Path that was created */
|
|
118
|
+
path: string;
|
|
119
|
+
/** Whether the directory was created (false if already existed) */
|
|
120
|
+
created: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// =============================================================================
|
|
124
|
+
// rm Types - Remove file or directory
|
|
125
|
+
// =============================================================================
|
|
126
|
+
|
|
127
|
+
export const RmInputSchema: z.ZodObject<{
|
|
128
|
+
path: z.ZodString;
|
|
129
|
+
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
130
|
+
force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
131
|
+
}> = z.object({
|
|
132
|
+
/** Path to remove */
|
|
133
|
+
path: z.string().describe("Path to remove"),
|
|
134
|
+
/** Remove directories and contents recursively (default: false) */
|
|
135
|
+
recursive: z.boolean().optional().default(false).describe("Remove directories and contents recursively (default: false)"),
|
|
136
|
+
/** Ignore errors if path doesn't exist (default: false) */
|
|
137
|
+
force: z.boolean().optional().default(false).describe("Ignore errors if path doesn't exist (default: false)"),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export type RmInput = z.infer<typeof RmInputSchema>;
|
|
141
|
+
|
|
142
|
+
export interface RmOutput {
|
|
143
|
+
/** Path that was removed */
|
|
144
|
+
path: string;
|
|
145
|
+
/** Whether something was removed (false if didn't exist with force=true) */
|
|
146
|
+
removed: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// =============================================================================
|
|
150
|
+
// readdir Types - Read directory contents
|
|
151
|
+
// =============================================================================
|
|
152
|
+
|
|
153
|
+
export const ReaddirInputSchema: z.ZodObject<{
|
|
154
|
+
path: z.ZodString;
|
|
155
|
+
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
156
|
+
includeStats: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
157
|
+
}> = z.object({
|
|
158
|
+
/** Path of directory to read */
|
|
159
|
+
path: z.string().describe("Path of directory to read"),
|
|
160
|
+
/** Read subdirectories recursively (default: false) */
|
|
161
|
+
recursive: z.boolean().optional().default(false).describe("Read subdirectories recursively (default: false)"),
|
|
162
|
+
/** Include file stats with each entry (default: false) */
|
|
163
|
+
includeStats: z.boolean().optional().default(false).describe("Include file stats with each entry (default: false)"),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export type ReaddirInput = z.infer<typeof ReaddirInputSchema>;
|
|
167
|
+
|
|
168
|
+
export interface ReaddirEntry {
|
|
169
|
+
/** Entry name */
|
|
170
|
+
name: string;
|
|
171
|
+
/** Full path */
|
|
172
|
+
path: string;
|
|
173
|
+
/** Type: file, directory, or other */
|
|
174
|
+
type: FileType;
|
|
175
|
+
/** Stats if includeStats was true */
|
|
176
|
+
stats?: StatOutput | undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface ReaddirOutput {
|
|
180
|
+
/** Directory path */
|
|
181
|
+
path: string;
|
|
182
|
+
/** Directory entries */
|
|
183
|
+
entries: ReaddirEntry[];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// =============================================================================
|
|
187
|
+
// stat Types - Get file or directory stats
|
|
188
|
+
// =============================================================================
|
|
189
|
+
|
|
190
|
+
export const StatInputSchema: z.ZodObject<{
|
|
191
|
+
path: z.ZodString;
|
|
192
|
+
}> = z.object({
|
|
193
|
+
/** Path to get stats for */
|
|
194
|
+
path: z.string().describe("Path to get stats for"),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export type StatInput = z.infer<typeof StatInputSchema>;
|
|
198
|
+
|
|
199
|
+
export interface StatOutput {
|
|
200
|
+
/** Path */
|
|
201
|
+
path: string;
|
|
202
|
+
/** Type: file, directory, or other */
|
|
203
|
+
type: FileType;
|
|
204
|
+
/** Size in bytes */
|
|
205
|
+
size: number;
|
|
206
|
+
/** Last modified time (ISO string) */
|
|
207
|
+
mtime: string;
|
|
208
|
+
/** Creation time (ISO string) */
|
|
209
|
+
ctime: string;
|
|
210
|
+
/** Last access time (ISO string) */
|
|
211
|
+
atime: string;
|
|
212
|
+
/** Unix mode/permissions */
|
|
213
|
+
mode: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// =============================================================================
|
|
217
|
+
// copy Types - Copy file or directory
|
|
218
|
+
// =============================================================================
|
|
219
|
+
|
|
220
|
+
export const CopyInputSchema: z.ZodObject<{
|
|
221
|
+
src: z.ZodString;
|
|
222
|
+
dest: z.ZodString;
|
|
223
|
+
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
224
|
+
overwrite: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
225
|
+
}> = z.object({
|
|
226
|
+
/** Source path */
|
|
227
|
+
src: z.string().describe("Source path"),
|
|
228
|
+
/** Destination path */
|
|
229
|
+
dest: z.string().describe("Destination path"),
|
|
230
|
+
/** Copy directories recursively (default: true) */
|
|
231
|
+
recursive: z.boolean().optional().default(true).describe("Copy directories recursively (default: true)"),
|
|
232
|
+
/** Overwrite existing files (default: false) */
|
|
233
|
+
overwrite: z.boolean().optional().default(false).describe("Overwrite existing files (default: false)"),
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export type CopyInput = z.infer<typeof CopyInputSchema>;
|
|
237
|
+
|
|
238
|
+
export interface CopyOutput {
|
|
239
|
+
/** Source path */
|
|
240
|
+
src: string;
|
|
241
|
+
/** Destination path */
|
|
242
|
+
dest: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// =============================================================================
|
|
246
|
+
// move Types - Move or rename file/directory
|
|
247
|
+
// =============================================================================
|
|
248
|
+
|
|
249
|
+
export const MoveInputSchema: z.ZodObject<{
|
|
250
|
+
src: z.ZodString;
|
|
251
|
+
dest: z.ZodString;
|
|
252
|
+
overwrite: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
253
|
+
}> = z.object({
|
|
254
|
+
/** Source path */
|
|
255
|
+
src: z.string().describe("Source path"),
|
|
256
|
+
/** Destination path */
|
|
257
|
+
dest: z.string().describe("Destination path"),
|
|
258
|
+
/** Overwrite existing files (default: false) */
|
|
259
|
+
overwrite: z.boolean().optional().default(false).describe("Overwrite existing files (default: false)"),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export type MoveInput = z.infer<typeof MoveInputSchema>;
|
|
263
|
+
|
|
264
|
+
export interface MoveOutput {
|
|
265
|
+
/** Source path (original) */
|
|
266
|
+
src: string;
|
|
267
|
+
/** Destination path (new location) */
|
|
268
|
+
dest: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// =============================================================================
|
|
272
|
+
// glob Types - Find files matching glob pattern
|
|
273
|
+
// =============================================================================
|
|
274
|
+
|
|
275
|
+
export const GlobInputSchema: z.ZodObject<{
|
|
276
|
+
pattern: z.ZodString;
|
|
277
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
278
|
+
absolute: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
279
|
+
dot: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
280
|
+
ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
281
|
+
}> = z.object({
|
|
282
|
+
/** Glob pattern to match */
|
|
283
|
+
pattern: z.string().describe("Glob pattern to match"),
|
|
284
|
+
/** Working directory (default: process.cwd()) */
|
|
285
|
+
cwd: z.string().optional().describe("Working directory (default: process.cwd())"),
|
|
286
|
+
/** Return absolute paths (default: false) */
|
|
287
|
+
absolute: z.boolean().optional().default(false).describe("Return absolute paths (default: false)"),
|
|
288
|
+
/** Include dotfiles (default: false) */
|
|
289
|
+
dot: z.boolean().optional().default(false).describe("Include dotfiles (default: false)"),
|
|
290
|
+
/** Glob patterns of the paths to leave out. The search does not enter the folders that they match. */
|
|
291
|
+
ignore: z.array(z.string()).optional().describe("Glob patterns of the paths to leave out. The search does not enter the folders that they match."),
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
export type GlobInput = z.infer<typeof GlobInputSchema>;
|
|
295
|
+
|
|
296
|
+
export interface GlobOutput {
|
|
297
|
+
/** Glob pattern used */
|
|
298
|
+
pattern: string;
|
|
299
|
+
/** Matching paths, sorted: relative to `cwd` with "/" separators, or absolute with `absolute: true` */
|
|
300
|
+
matches: string[];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// =============================================================================
|
|
304
|
+
// read.json Types - Read and parse JSON file
|
|
305
|
+
// =============================================================================
|
|
306
|
+
|
|
307
|
+
export const ReadJsonInputSchema: z.ZodObject<{
|
|
308
|
+
path: z.ZodString;
|
|
309
|
+
}> = z.object({
|
|
310
|
+
/** Path to JSON file */
|
|
311
|
+
path: z.string().describe("Path to JSON file"),
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
export type ReadJsonInput = z.infer<typeof ReadJsonInputSchema>;
|
|
315
|
+
|
|
316
|
+
export interface ReadJsonOutput {
|
|
317
|
+
/** File path */
|
|
318
|
+
path: string;
|
|
319
|
+
/** Parsed JSON data */
|
|
320
|
+
data: unknown;
|
|
321
|
+
stats : StatOutput
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// =============================================================================
|
|
325
|
+
// Output schemas (roadmap 2.1)
|
|
326
|
+
// =============================================================================
|
|
327
|
+
|
|
328
|
+
// Loose objects: a field that a schema does not name stays in the result (a strict schema would
|
|
329
|
+
// remove it when the output is validated).
|
|
330
|
+
|
|
331
|
+
const fileType = z.enum(FileType).describe("file, directory or other");
|
|
332
|
+
|
|
333
|
+
export const StatOutputSchema: z.ZodType<StatOutput> = z.looseObject({
|
|
334
|
+
path: z.string().describe("The path"),
|
|
335
|
+
type: fileType,
|
|
336
|
+
size: z.number().describe("The size, in bytes"),
|
|
337
|
+
mtime: z.string().describe("The time of the last change (ISO 8601)"),
|
|
338
|
+
ctime: z.string().describe("The time of the last status change (ISO 8601)"),
|
|
339
|
+
atime: z.string().describe("The time of the last access (ISO 8601)"),
|
|
340
|
+
mode: z.number().describe("The mode bits (type and permissions)"),
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
export const ReadOutputSchema: z.ZodType<ReadOutput> = z.looseObject({
|
|
344
|
+
content: z.string().describe("The content of the file"),
|
|
345
|
+
path: z.string().describe("The path of the file"),
|
|
346
|
+
stats: StatOutputSchema.describe("The stats of the file"),
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
export const WriteOutputSchema: z.ZodType<WriteOutput> = z.looseObject({
|
|
350
|
+
path: z.string().describe("The path of the file"),
|
|
351
|
+
bytesWritten: z.number().describe("The number of bytes written"),
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
export const ExistsOutputSchema: z.ZodType<ExistsOutput> = z.union([
|
|
355
|
+
z.looseObject({ exists: z.literal(false).describe("The path does not exist") }),
|
|
356
|
+
z.looseObject({
|
|
357
|
+
exists: z.literal(true).describe("The path exists"),
|
|
358
|
+
stats: StatOutputSchema.describe("The stats of the path"),
|
|
359
|
+
}),
|
|
360
|
+
]);
|
|
361
|
+
|
|
362
|
+
export const MkdirOutputSchema: z.ZodType<MkdirOutput> = z.looseObject({
|
|
363
|
+
path: z.string().describe("The path of the folder"),
|
|
364
|
+
created: z.boolean().describe("False when the folder existed already"),
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
export const RmOutputSchema: z.ZodType<RmOutput> = z.looseObject({
|
|
368
|
+
path: z.string().describe("The path"),
|
|
369
|
+
removed: z.boolean().describe("False when the path did not exist (with force)"),
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
export const ReaddirOutputSchema: z.ZodType<ReaddirOutput> = z.looseObject({
|
|
373
|
+
path: z.string().describe("The path of the folder"),
|
|
374
|
+
entries: z
|
|
375
|
+
.array(
|
|
376
|
+
z.looseObject({
|
|
377
|
+
name: z.string().describe("The name of the entry"),
|
|
378
|
+
path: z.string().describe("The full path of the entry"),
|
|
379
|
+
type: fileType,
|
|
380
|
+
stats: StatOutputSchema.optional().describe("The stats, with includeStats"),
|
|
381
|
+
})
|
|
382
|
+
)
|
|
383
|
+
.describe("The entries of the folder"),
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
export const CopyOutputSchema: z.ZodType<CopyOutput> = z.looseObject({
|
|
387
|
+
src: z.string().describe("The source path"),
|
|
388
|
+
dest: z.string().describe("The destination path"),
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
export const MoveOutputSchema: z.ZodType<MoveOutput> = z.looseObject({
|
|
392
|
+
src: z.string().describe("The old path"),
|
|
393
|
+
dest: z.string().describe("The new path"),
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
export const GlobOutputSchema: z.ZodType<GlobOutput> = z.looseObject({
|
|
397
|
+
pattern: z.string().describe("The glob pattern"),
|
|
398
|
+
matches: z
|
|
399
|
+
.array(z.string())
|
|
400
|
+
.describe('The matching paths, sorted: relative to cwd with "/" separators, or absolute with absolute: true'),
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
export const ReadJsonOutputSchema: z.ZodType<ReadJsonOutput> = z.looseObject({
|
|
404
|
+
path: z.string().describe("The path of the file"),
|
|
405
|
+
data: z.unknown().describe("The parsed JSON value"),
|
|
406
|
+
stats: StatOutputSchema.describe("The stats of the file"),
|
|
407
|
+
});
|