@procedures/fs 0.1.0 → 0.2.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 +20 -0
- package/README.md +5 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +7 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +26 -1
- package/dist/module.js.map +1 -1
- package/dist/register.d.ts +3 -4
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +4 -9
- package/dist/register.js.map +1 -1
- package/package.json +6 -3
- package/src/index.ts +1 -1
- package/src/module.ts +28 -1
- package/src/register.ts +4 -10
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
|
package/dist/module.d.ts
CHANGED
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
* Registers fs.* procedures with the client system.
|
|
7
7
|
* This file is referenced by package.json's client.procedures field.
|
|
8
8
|
*/
|
|
9
|
-
import { type ProcedureModule } from "@procedures/client";
|
|
9
|
+
import { type ProcedureModule, type ProcedureRegistry } from "@procedures/client";
|
|
10
10
|
/**
|
|
11
11
|
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
12
12
|
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
13
13
|
*/
|
|
14
14
|
export declare const fsModule: ProcedureModule;
|
|
15
15
|
export default fsModule;
|
|
16
|
+
/**
|
|
17
|
+
* This function registers the procedures of @procedures/fs, and of the modules that it requires, in
|
|
18
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
19
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
20
|
+
*/
|
|
21
|
+
export declare function registerFsProcedures(registry?: ProcedureRegistry): void;
|
|
16
22
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA2D,KAAK,eAAe,EAAuC,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAoOhL;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,eAYnB,CAAC;eAEU,QAAQ;AAEvB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,GAAE,iBAAsC,GAAG,IAAI,CAE3F"}
|
package/dist/module.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Registers fs.* procedures with the client system.
|
|
7
7
|
* This file is referenced by package.json's client.procedures field.
|
|
8
8
|
*/
|
|
9
|
-
import { createProcedure, zodAdapter, defineModule } from "@procedures/client";
|
|
9
|
+
import { createProcedure, zodAdapter, defineModule, PROCEDURE_REGISTRY, registerModules } from "@procedures/client";
|
|
10
10
|
import { read } from "./procedures/fs/read.js";
|
|
11
11
|
import { write } from "./procedures/fs/write.js";
|
|
12
12
|
import { exists } from "./procedures/fs/exists.js";
|
|
@@ -22,6 +22,8 @@ import { ReadInputSchema, WriteInputSchema, ExistsInputSchema, MkdirInputSchema,
|
|
|
22
22
|
// =============================================================================
|
|
23
23
|
// Procedure Definitions
|
|
24
24
|
// =============================================================================
|
|
25
|
+
/** The effects of a procedure that reads the files of the host and changes nothing. */
|
|
26
|
+
const READS_FILES = { reads: ["fs"], writes: [] };
|
|
25
27
|
const fsReadProcedure = createProcedure()
|
|
26
28
|
.path(["fs", "read"])
|
|
27
29
|
.input(zodAdapter(ReadInputSchema))
|
|
@@ -31,6 +33,7 @@ const fsReadProcedure = createProcedure()
|
|
|
31
33
|
args: ["path"],
|
|
32
34
|
shorts: { encoding: "e" },
|
|
33
35
|
output: "json",
|
|
36
|
+
effects: READS_FILES,
|
|
34
37
|
})
|
|
35
38
|
.handler(read)
|
|
36
39
|
.build();
|
|
@@ -43,6 +46,8 @@ const fsWriteProcedure = createProcedure()
|
|
|
43
46
|
args: ["path", "content"],
|
|
44
47
|
shorts: { encoding: "e", mode: "m" },
|
|
45
48
|
output: "json",
|
|
49
|
+
// It replaces the file, or appends to it. A second append adds the content again.
|
|
50
|
+
effects: { reads: [], writes: ["fs"] },
|
|
46
51
|
})
|
|
47
52
|
.handler(write)
|
|
48
53
|
.build();
|
|
@@ -55,6 +60,7 @@ const fsExistsProcedure = createProcedure()
|
|
|
55
60
|
args: ["path"],
|
|
56
61
|
shorts: {},
|
|
57
62
|
output: "json",
|
|
63
|
+
effects: READS_FILES,
|
|
58
64
|
})
|
|
59
65
|
.handler(exists)
|
|
60
66
|
.build();
|
|
@@ -67,6 +73,8 @@ const fsMkdirProcedure = createProcedure()
|
|
|
67
73
|
args: ["path"],
|
|
68
74
|
shorts: { recursive: "r" },
|
|
69
75
|
output: "json",
|
|
76
|
+
// It creates only a missing folder. An existing folder gives `created: false`.
|
|
77
|
+
effects: { reads: ["fs"], writes: ["fs"], destructive: false, idempotent: true },
|
|
70
78
|
})
|
|
71
79
|
.handler(mkdir)
|
|
72
80
|
.build();
|
|
@@ -79,6 +87,7 @@ const fsRmProcedure = createProcedure()
|
|
|
79
87
|
args: ["path"],
|
|
80
88
|
shorts: { recursive: "r", force: "f" },
|
|
81
89
|
output: "json",
|
|
90
|
+
effects: { reads: ["fs"], writes: ["fs"], idempotent: true },
|
|
82
91
|
})
|
|
83
92
|
.handler(rm)
|
|
84
93
|
.build();
|
|
@@ -91,6 +100,7 @@ const fsReaddirProcedure = createProcedure()
|
|
|
91
100
|
args: ["path"],
|
|
92
101
|
shorts: { recursive: "r", includeStats: "s" },
|
|
93
102
|
output: "json",
|
|
103
|
+
effects: READS_FILES,
|
|
94
104
|
})
|
|
95
105
|
.handler(readdir)
|
|
96
106
|
.build();
|
|
@@ -103,6 +113,7 @@ const fsStatProcedure = createProcedure()
|
|
|
103
113
|
args: ["path"],
|
|
104
114
|
shorts: {},
|
|
105
115
|
output: "json",
|
|
116
|
+
effects: READS_FILES,
|
|
106
117
|
})
|
|
107
118
|
.handler(stat)
|
|
108
119
|
.build();
|
|
@@ -115,6 +126,8 @@ const fsCopyProcedure = createProcedure()
|
|
|
115
126
|
args: ["src", "dest"],
|
|
116
127
|
shorts: { recursive: "r", overwrite: "o" },
|
|
117
128
|
output: "json",
|
|
129
|
+
// With `overwrite`, it replaces the files at the destination
|
|
130
|
+
effects: { reads: ["fs"], writes: ["fs"], idempotent: true },
|
|
118
131
|
})
|
|
119
132
|
.handler(copy)
|
|
120
133
|
.build();
|
|
@@ -127,6 +140,8 @@ const fsMoveProcedure = createProcedure()
|
|
|
127
140
|
args: ["src", "dest"],
|
|
128
141
|
shorts: { overwrite: "o" },
|
|
129
142
|
output: "json",
|
|
143
|
+
// With `overwrite`, it replaces the destination. A second call finds no source and changes nothing.
|
|
144
|
+
effects: { reads: ["fs"], writes: ["fs"], idempotent: true },
|
|
130
145
|
})
|
|
131
146
|
.handler(move)
|
|
132
147
|
.build();
|
|
@@ -139,6 +154,7 @@ const fsGlobProcedure = createProcedure()
|
|
|
139
154
|
args: ["pattern"],
|
|
140
155
|
shorts: { cwd: "c", absolute: "a", dot: "d" },
|
|
141
156
|
output: "json",
|
|
157
|
+
effects: READS_FILES,
|
|
142
158
|
})
|
|
143
159
|
.handler(glob)
|
|
144
160
|
.build();
|
|
@@ -151,6 +167,7 @@ const fsReadJsonProcedure = createProcedure()
|
|
|
151
167
|
args: ["path"],
|
|
152
168
|
shorts: {},
|
|
153
169
|
output: "json",
|
|
170
|
+
effects: READS_FILES,
|
|
154
171
|
})
|
|
155
172
|
.handler(readJson)
|
|
156
173
|
.build();
|
|
@@ -175,4 +192,12 @@ export const fsModule = defineModule("@procedures/fs", [
|
|
|
175
192
|
fsReadJsonProcedure,
|
|
176
193
|
]);
|
|
177
194
|
export default fsModule;
|
|
195
|
+
/**
|
|
196
|
+
* This function registers the procedures of @procedures/fs, and of the modules that it requires, in
|
|
197
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
198
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
199
|
+
*/
|
|
200
|
+
export function registerFsProcedures(registry = PROCEDURE_REGISTRY) {
|
|
201
|
+
registerModules(registry, [fsModule]);
|
|
202
|
+
}
|
|
178
203
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"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EAAE,CAAC;AAEX,MAAM,mBAAmB,GAAG,eAAe,EAAE;KAC1C,IAAI,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KACzB,KAAK,CAAC,UAAU,CAAgB,mBAAmB,CAAC,CAAC;KACrD,MAAM,CAAC,UAAU,CAAiB,oBAAoB,CAAC,CAAC;KACxD,IAAI,CAAC;IACJ,WAAW,EAAE,0BAA0B;IACvC,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,WAAW;CACrB,CAAC;KACD,OAAO,CAAC,QAAQ,CAAC;KACjB,KAAK,EAAE,CAAC;AAEX,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAoB,YAAY,CAAC,gBAAgB,EAAE;IACpE,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,kBAAkB;IAClB,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,mBAAmB;CACpB,CAAC,CAAC;AAEL,eAAe,QAAQ,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAQ,GAAsB,kBAAkB;IACnF,eAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/register.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/fs
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/fs, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/fs/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
6
|
export * from "./module.js";
|
|
7
|
-
export declare function registerFsProcedures(): void;
|
|
8
7
|
//# sourceMappingURL=register.d.ts.map
|
package/dist/register.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,aAAa,CAAC"}
|
package/dist/register.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/fs
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/fs, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/fs/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { fsModule } from "./module.js";
|
|
6
|
+
import { registerFsProcedures } from "./module.js";
|
|
8
7
|
export * from "./module.js";
|
|
9
|
-
export function registerFsProcedures() {
|
|
10
|
-
registerProcedures(fsModule.procedures);
|
|
11
|
-
}
|
|
12
|
-
// Auto-register when this module is loaded
|
|
13
8
|
registerFsProcedures();
|
|
14
9
|
//# sourceMappingURL=register.js.map
|
package/dist/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,aAAa,CAAC;AAE5B,oBAAoB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/fs",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "File system procedures: read, write, copy, move, glob, exists, mkdir and JSON read and write, callable in process, over RPC or from Claude through MCP.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"filesystem",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"./module": {
|
|
34
34
|
"types": "./dist/module.d.ts",
|
|
35
35
|
"import": "./dist/module.js"
|
|
36
|
+
},
|
|
37
|
+
"./register": {
|
|
38
|
+
"types": "./dist/register.d.ts",
|
|
39
|
+
"import": "./dist/register.js"
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
"files": [
|
|
@@ -44,7 +48,6 @@
|
|
|
44
48
|
"CHANGELOG.md"
|
|
45
49
|
],
|
|
46
50
|
"sideEffects": [
|
|
47
|
-
"./dist/index.js",
|
|
48
51
|
"./dist/register.js"
|
|
49
52
|
],
|
|
50
53
|
"engines": {
|
|
@@ -58,7 +61,7 @@
|
|
|
58
61
|
"procedures": "./dist/register.js"
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
|
-
"@procedures/client": "0.
|
|
64
|
+
"@procedures/client": "0.2.0",
|
|
62
65
|
"zod": "^4.6.5"
|
|
63
66
|
},
|
|
64
67
|
"devDependencies": {
|
package/src/index.ts
CHANGED
package/src/module.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This file is referenced by package.json's client.procedures field.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { createProcedure, zodAdapter, defineModule, type ProcedureModule } from "@procedures/client";
|
|
10
|
+
import { createProcedure, zodAdapter, defineModule, type Effects, type ProcedureModule, PROCEDURE_REGISTRY, registerModules, type ProcedureRegistry } from "@procedures/client";
|
|
11
11
|
import { read } from "./procedures/fs/read.js";
|
|
12
12
|
import { write } from "./procedures/fs/write.js";
|
|
13
13
|
import { exists } from "./procedures/fs/exists.js";
|
|
@@ -70,6 +70,9 @@ import {
|
|
|
70
70
|
// Procedure Definitions
|
|
71
71
|
// =============================================================================
|
|
72
72
|
|
|
73
|
+
/** The effects of a procedure that reads the files of the host and changes nothing. */
|
|
74
|
+
const READS_FILES: Effects = { reads: ["fs"], writes: [] };
|
|
75
|
+
|
|
73
76
|
const fsReadProcedure = createProcedure()
|
|
74
77
|
.path(["fs", "read"])
|
|
75
78
|
.input(zodAdapter<ReadInput>(ReadInputSchema))
|
|
@@ -79,6 +82,7 @@ const fsReadProcedure = createProcedure()
|
|
|
79
82
|
args: ["path"],
|
|
80
83
|
shorts: { encoding: "e" },
|
|
81
84
|
output: "json",
|
|
85
|
+
effects: READS_FILES,
|
|
82
86
|
})
|
|
83
87
|
.handler(read)
|
|
84
88
|
.build();
|
|
@@ -92,6 +96,8 @@ const fsWriteProcedure = createProcedure()
|
|
|
92
96
|
args: ["path", "content"],
|
|
93
97
|
shorts: { encoding: "e", mode: "m" },
|
|
94
98
|
output: "json",
|
|
99
|
+
// It replaces the file, or appends to it. A second append adds the content again.
|
|
100
|
+
effects: { reads: [], writes: ["fs"] },
|
|
95
101
|
})
|
|
96
102
|
.handler(write)
|
|
97
103
|
.build();
|
|
@@ -105,6 +111,7 @@ const fsExistsProcedure = createProcedure()
|
|
|
105
111
|
args: ["path"],
|
|
106
112
|
shorts: {},
|
|
107
113
|
output: "json",
|
|
114
|
+
effects: READS_FILES,
|
|
108
115
|
})
|
|
109
116
|
.handler(exists)
|
|
110
117
|
.build();
|
|
@@ -118,6 +125,8 @@ const fsMkdirProcedure = createProcedure()
|
|
|
118
125
|
args: ["path"],
|
|
119
126
|
shorts: { recursive: "r" },
|
|
120
127
|
output: "json",
|
|
128
|
+
// It creates only a missing folder. An existing folder gives `created: false`.
|
|
129
|
+
effects: { reads: ["fs"], writes: ["fs"], destructive: false, idempotent: true },
|
|
121
130
|
})
|
|
122
131
|
.handler(mkdir)
|
|
123
132
|
.build();
|
|
@@ -131,6 +140,7 @@ const fsRmProcedure = createProcedure()
|
|
|
131
140
|
args: ["path"],
|
|
132
141
|
shorts: { recursive: "r", force: "f" },
|
|
133
142
|
output: "json",
|
|
143
|
+
effects: { reads: ["fs"], writes: ["fs"], idempotent: true },
|
|
134
144
|
})
|
|
135
145
|
.handler(rm)
|
|
136
146
|
.build();
|
|
@@ -144,6 +154,7 @@ const fsReaddirProcedure = createProcedure()
|
|
|
144
154
|
args: ["path"],
|
|
145
155
|
shorts: { recursive: "r", includeStats: "s" },
|
|
146
156
|
output: "json",
|
|
157
|
+
effects: READS_FILES,
|
|
147
158
|
})
|
|
148
159
|
.handler(readdir)
|
|
149
160
|
.build();
|
|
@@ -157,6 +168,7 @@ const fsStatProcedure = createProcedure()
|
|
|
157
168
|
args: ["path"],
|
|
158
169
|
shorts: {},
|
|
159
170
|
output: "json",
|
|
171
|
+
effects: READS_FILES,
|
|
160
172
|
})
|
|
161
173
|
.handler(stat)
|
|
162
174
|
.build();
|
|
@@ -170,6 +182,8 @@ const fsCopyProcedure = createProcedure()
|
|
|
170
182
|
args: ["src", "dest"],
|
|
171
183
|
shorts: { recursive: "r", overwrite: "o" },
|
|
172
184
|
output: "json",
|
|
185
|
+
// With `overwrite`, it replaces the files at the destination
|
|
186
|
+
effects: { reads: ["fs"], writes: ["fs"], idempotent: true },
|
|
173
187
|
})
|
|
174
188
|
.handler(copy)
|
|
175
189
|
.build();
|
|
@@ -183,6 +197,8 @@ const fsMoveProcedure = createProcedure()
|
|
|
183
197
|
args: ["src", "dest"],
|
|
184
198
|
shorts: { overwrite: "o" },
|
|
185
199
|
output: "json",
|
|
200
|
+
// With `overwrite`, it replaces the destination. A second call finds no source and changes nothing.
|
|
201
|
+
effects: { reads: ["fs"], writes: ["fs"], idempotent: true },
|
|
186
202
|
})
|
|
187
203
|
.handler(move)
|
|
188
204
|
.build();
|
|
@@ -196,6 +212,7 @@ const fsGlobProcedure = createProcedure()
|
|
|
196
212
|
args: ["pattern"],
|
|
197
213
|
shorts: { cwd: "c", absolute: "a", dot: "d" },
|
|
198
214
|
output: "json",
|
|
215
|
+
effects: READS_FILES,
|
|
199
216
|
})
|
|
200
217
|
.handler(glob)
|
|
201
218
|
.build();
|
|
@@ -209,6 +226,7 @@ const fsReadJsonProcedure = createProcedure()
|
|
|
209
226
|
args: ["path"],
|
|
210
227
|
shorts: {},
|
|
211
228
|
output: "json",
|
|
229
|
+
effects: READS_FILES,
|
|
212
230
|
})
|
|
213
231
|
.handler(readJson)
|
|
214
232
|
.build();
|
|
@@ -236,3 +254,12 @@ export const fsModule: ProcedureModule = defineModule("@procedures/fs", [
|
|
|
236
254
|
]);
|
|
237
255
|
|
|
238
256
|
export default fsModule;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* This function registers the procedures of @procedures/fs, and of the modules that it requires, in
|
|
260
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
261
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
262
|
+
*/
|
|
263
|
+
export function registerFsProcedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
|
|
264
|
+
registerModules(registry, [fsModule]);
|
|
265
|
+
}
|
package/src/register.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/fs
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/fs, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/fs/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { fsModule } from "./module.js";
|
|
7
|
+
import { registerFsProcedures } from "./module.js";
|
|
9
8
|
|
|
10
9
|
export * from "./module.js";
|
|
11
10
|
|
|
12
|
-
export function registerFsProcedures(): void {
|
|
13
|
-
registerProcedures(fsModule.procedures);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Auto-register when this module is loaded
|
|
17
11
|
registerFsProcedures();
|